Overhaul to console structure, a bit

This commit is contained in:
iikorni
2026-08-30 00:50:23 -05:00
parent de75b014b3
commit 216dd1aecd
70 changed files with 2081 additions and 2260 deletions
+78 -78
View File
@@ -207,18 +207,18 @@ static void VID_Gamma_SetGamma(void) {
#if defined(USE_SDL2)
# if USE_GAMMA_RAMPS
if (SDL_SetWindowGammaRamp(draw_context, vid_gamma_red, vid_gamma_green, vid_gamma_blue) != 0)
Con_Printf("VID_Gamma_SetGamma: failed on SDL_SetWindowGammaRamp\n");
console::info("VID_Gamma_SetGamma: failed on SDL_SetWindowGammaRamp\n");
# else
if (SDL_SetWindowBrightness(draw_context, value) != 0)
Con_Printf("VID_Gamma_SetGamma: failed on SDL_SetWindowBrightness\n");
console::info("VID_Gamma_SetGamma: failed on SDL_SetWindowBrightness\n");
# endif
#else /* USE_SDL2 */
# if USE_GAMMA_RAMPS
if (SDL_SetGammaRamp(vid_gamma_red, vid_gamma_green, vid_gamma_blue) == -1)
Con_Printf("VID_Gamma_SetGamma: failed on SDL_SetGammaRamp\n");
console::info("VID_Gamma_SetGamma: failed on SDL_SetGammaRamp\n");
# else
if (SDL_SetGamma(value, value, value) == -1)
Con_Printf("VID_Gamma_SetGamma: failed on SDL_SetGamma\n");
console::info("VID_Gamma_SetGamma: failed on SDL_SetGamma\n");
# endif
#endif /* USE_SDL2 */
}
@@ -237,18 +237,18 @@ static void VID_Gamma_Restore(void) {
#if defined(USE_SDL2)
# if USE_GAMMA_RAMPS
if (SDL_SetWindowGammaRamp(draw_context, vid_sysgamma_red, vid_sysgamma_green, vid_sysgamma_blue) != 0)
Con_Printf("VID_Gamma_Restore: failed on SDL_SetWindowGammaRamp\n");
console::info("VID_Gamma_Restore: failed on SDL_SetWindowGammaRamp\n");
# else
if (SDL_SetWindowBrightness(draw_context, 1) != 0)
Con_Printf("VID_Gamma_Restore: failed on SDL_SetWindowBrightness\n");
console::info("VID_Gamma_Restore: failed on SDL_SetWindowBrightness\n");
# endif
#else /* USE_SDL2 */
# if USE_GAMMA_RAMPS
if (SDL_SetGammaRamp(vid_sysgamma_red, vid_sysgamma_green, vid_sysgamma_blue) == -1)
Con_Printf("VID_Gamma_Restore: failed on SDL_SetGammaRamp\n");
console::info("VID_Gamma_Restore: failed on SDL_SetGammaRamp\n");
# else
if (SDL_SetGamma(1, 1, 1) == -1)
Con_Printf("VID_Gamma_Restore: failed on SDL_SetGamma\n");
console::info("VID_Gamma_Restore: failed on SDL_SetGamma\n");
# endif
#endif /* USE_SDL2 */
}
@@ -319,7 +319,7 @@ static void VID_Gamma_Init(void) {
#endif /* USE_SDL2 */
if (!gammaworks)
Con_SafePrintf("gamma adjustment not available\n");
console::safe_print("gamma adjustment not available\n");
}
/*
@@ -565,7 +565,7 @@ static bool VID_SetMode(int width, int height, int refreshrate, int bpp, bool fu
int previous_display;
#endif
// so Con_Printfs don't mess us up by forcing vid and snd updates
// so console::infos don't mess us up by forcing vid and snd updates
temp = scr_disabled_for_loading;
scr_disabled_for_loading = true;
@@ -728,7 +728,7 @@ static bool VID_SetMode(int width, int height, int refreshrate, int bpp, bool fu
// fix the leftover Alt from any Alt-Tab or the like that switched us away
ClearAllStates();
Con_SafePrintf("Video mode %dx%dx%d %dHz (%d-bit z-buffer, %dx FSAA) initialized\n",
console::safe_print("Video mode %dx%dx%d %dHz (%d-bit z-buffer, %dx FSAA) initialized\n",
VID_GetCurrentWidth(),
VID_GetCurrentHeight(),
VID_GetCurrentBPP(),
@@ -775,7 +775,7 @@ static void VID_Restart(void) {
// validate new mode
//
if (!VID_ValidMode(width, height, refreshrate, bpp, fullscreen)) {
Con_Printf("%dx%dx%d %dHz %s is not a valid mode\n",
console::info("%dx%dx%d %dHz %s is not a valid mode\n",
width, height, bpp, refreshrate, fullscreen ? "fullscreen" : "windowed");
return;
}
@@ -933,10 +933,10 @@ GL_Info_f -- johnfitz
===============
*/
static void GL_Info_f(void) {
Con_SafePrintf("GL_VENDOR: %s\n", gl_vendor);
Con_SafePrintf("GL_RENDERER: %s\n", gl_renderer);
Con_SafePrintf("GL_VERSION: %s\n", gl_version);
Con_Printf("GL_EXTENSIONS: %s\n", gl_extensions_nice);
console::safe_print("GL_VENDOR: %s\n", gl_vendor);
console::safe_print("GL_RENDERER: %s\n", gl_renderer);
console::safe_print("GL_VERSION: %s\n", gl_version);
console::info("GL_EXTENSIONS: %s\n", gl_extensions_nice);
}
/*
@@ -973,9 +973,9 @@ static void GL_CheckExtensions(void) {
// ARB_vertex_buffer_object
//
if (common::check_param("-novbo").has_value())
Con_Warning("Vertex buffer objects disabled at command line\n");
console::warn("Vertex buffer objects disabled at command line\n");
else if (gl_version_major < 1 || (gl_version_major == 1 && gl_version_minor < 5))
Con_Warning("OpenGL version < 1.5, skipping ARB_vertex_buffer_object check\n");
console::warn("OpenGL version < 1.5, skipping ARB_vertex_buffer_object check\n");
else {
GL_BindBufferFunc = (PFNGLBINDBUFFERARBPROC) SDL_GL_GetProcAddress("glBindBufferARB");
GL_BufferDataFunc = (PFNGLBUFFERDATAARBPROC) SDL_GL_GetProcAddress("glBufferDataARB");
@@ -984,70 +984,70 @@ static void GL_CheckExtensions(void) {
GL_GenBuffersFunc = (PFNGLGENBUFFERSARBPROC) SDL_GL_GetProcAddress("glGenBuffersARB");
if (GL_BindBufferFunc && GL_BufferDataFunc && GL_BufferSubDataFunc && GL_DeleteBuffersFunc &&
GL_GenBuffersFunc) {
Con_Printf("FOUND: ARB_vertex_buffer_object\n");
console::info("FOUND: ARB_vertex_buffer_object\n");
gl_vbo_able = true;
} else {
Con_Warning("ARB_vertex_buffer_object not available\n");
console::warn("ARB_vertex_buffer_object not available\n");
}
}
// multitexture
//
if (common::check_param("-nomtex").has_value())
Con_Warning("Mutitexture disabled at command line\n");
console::warn("Mutitexture disabled at command line\n");
else if (GL_ParseExtensionList(gl_extensions, "GL_ARB_multitexture")) {
GL_MTexCoord2fFunc = (PFNGLMULTITEXCOORD2FARBPROC) SDL_GL_GetProcAddress("glMultiTexCoord2fARB");
GL_SelectTextureFunc = (PFNGLACTIVETEXTUREARBPROC) SDL_GL_GetProcAddress("glActiveTextureARB");
GL_ClientActiveTextureFunc = (PFNGLCLIENTACTIVETEXTUREARBPROC)
SDL_GL_GetProcAddress("glClientActiveTextureARB");
if (GL_MTexCoord2fFunc && GL_SelectTextureFunc && GL_ClientActiveTextureFunc) {
Con_Printf("FOUND: ARB_multitexture\n");
console::info("FOUND: ARB_multitexture\n");
gl_mtexable = true;
glGetIntegerv(GL_MAX_TEXTURE_UNITS, &gl_max_texture_units);
Con_Printf("GL_MAX_TEXTURE_UNITS: %d\n", (int) gl_max_texture_units);
console::info("GL_MAX_TEXTURE_UNITS: %d\n", (int) gl_max_texture_units);
} else {
Con_Warning("Couldn't link to multitexture functions\n");
console::warn("Couldn't link to multitexture functions\n");
}
} else {
Con_Warning("multitexture not supported (extension not found)\n");
console::warn("multitexture not supported (extension not found)\n");
}
// texture_env_combine
//
if (common::check_param("-nocombine").has_value())
Con_Warning("texture_env_combine disabled at command line\n");
console::warn("texture_env_combine disabled at command line\n");
else if (GL_ParseExtensionList(gl_extensions, "GL_ARB_texture_env_combine")) {
Con_Printf("FOUND: ARB_texture_env_combine\n");
console::info("FOUND: ARB_texture_env_combine\n");
gl_texture_env_combine = true;
} else if (GL_ParseExtensionList(gl_extensions, "GL_EXT_texture_env_combine")) {
Con_Printf("FOUND: EXT_texture_env_combine\n");
console::info("FOUND: EXT_texture_env_combine\n");
gl_texture_env_combine = true;
} else {
Con_Warning("texture_env_combine not supported\n");
console::warn("texture_env_combine not supported\n");
}
// texture_env_add
//
if (common::check_param("-noadd").has_value())
Con_Warning("texture_env_add disabled at command line\n");
console::warn("texture_env_add disabled at command line\n");
else if (GL_ParseExtensionList(gl_extensions, "GL_ARB_texture_env_add")) {
Con_Printf("FOUND: ARB_texture_env_add\n");
console::info("FOUND: ARB_texture_env_add\n");
gl_texture_env_add = true;
} else if (GL_ParseExtensionList(gl_extensions, "GL_EXT_texture_env_add")) {
Con_Printf("FOUND: EXT_texture_env_add\n");
console::info("FOUND: EXT_texture_env_add\n");
gl_texture_env_add = true;
} else {
Con_Warning("texture_env_add not supported\n");
console::warn("texture_env_add not supported\n");
}
// swap control
//
if (!gl_swap_control) {
#if defined(USE_SDL2)
Con_Warning("vertical sync not supported (SDL_GL_SetSwapInterval failed)\n");
console::warn("vertical sync not supported (SDL_GL_SetSwapInterval failed)\n");
#else
Con_Warning("vertical sync not supported (SDL_GL_SetAttribute failed)\n");
console::warn("vertical sync not supported (SDL_GL_SetAttribute failed)\n");
#endif
}
#if defined(USE_SDL2)
@@ -1058,18 +1058,18 @@ static void GL_CheckExtensions(void) {
{
gl_swap_control = false;
#if defined(USE_SDL2)
Con_Warning("vertical sync not supported (SDL_GL_GetSwapInterval failed)\n");
console::warn("vertical sync not supported (SDL_GL_GetSwapInterval failed)\n");
#else
Con_Warning("vertical sync not supported (SDL_GL_GetAttribute failed)\n");
console::warn("vertical sync not supported (SDL_GL_GetAttribute failed)\n");
#endif
} else if ((vid_vsync.value && swap_control != 1) || (!vid_vsync.value && swap_control != 0)) {
gl_swap_control = false;
Con_Warning("vertical sync not supported (swap_control doesn't match vid_vsync)\n");
console::warn("vertical sync not supported (swap_control doesn't match vid_vsync)\n");
} else {
#if defined(USE_SDL2)
Con_Printf("FOUND: SDL_GL_SetSwapInterval\n");
console::info("FOUND: SDL_GL_SetSwapInterval\n");
#else
Con_Printf("FOUND: SDL_GL_SWAP_CONTROL\n");
console::info("FOUND: SDL_GL_SWAP_CONTROL\n");
#endif
}
@@ -1090,10 +1090,10 @@ static void GL_CheckExtensions(void) {
glDeleteTextures(1, &tex);
if (test1 == 1 && test2 == 2) {
Con_Printf("FOUND: EXT_texture_filter_anisotropic\n");
console::info("FOUND: EXT_texture_filter_anisotropic\n");
gl_anisotropy_able = true;
} else {
Con_Warning("anisotropic filtering locked by driver. Current driver setting is %f\n", test1);
console::warn("anisotropic filtering locked by driver. Current driver setting is %f\n", test1);
}
//get max value either way, so the menu and stuff know it
@@ -1101,28 +1101,28 @@ static void GL_CheckExtensions(void) {
if (gl_max_anisotropy < 2) {
gl_anisotropy_able = false;
gl_max_anisotropy = 1;
Con_Warning("anisotropic filtering broken: disabled\n");
console::warn("anisotropic filtering broken: disabled\n");
}
} else {
gl_max_anisotropy = 1;
Con_Warning("texture_filter_anisotropic not supported\n");
console::warn("texture_filter_anisotropic not supported\n");
}
// texture_non_power_of_two
//
if (common::check_param("-notexturenpot").has_value())
Con_Warning("texture_non_power_of_two disabled at command line\n");
console::warn("texture_non_power_of_two disabled at command line\n");
else if (GL_ParseExtensionList(gl_extensions, "GL_ARB_texture_non_power_of_two")) {
Con_Printf("FOUND: ARB_texture_non_power_of_two\n");
console::info("FOUND: ARB_texture_non_power_of_two\n");
gl_texture_NPOT = true;
} else {
Con_Warning("texture_non_power_of_two not supported\n");
console::warn("texture_non_power_of_two not supported\n");
}
// GLSL
//
if (common::check_param("-noglsl").has_value())
Con_Warning("GLSL disabled at command line\n");
console::warn("GLSL disabled at command line\n");
else if (gl_version_major >= 2) {
GL_CreateShaderFunc = (QS_PFNGLCREATESHADERPROC) SDL_GL_GetProcAddress("glCreateShader");
GL_DeleteShaderFunc = (QS_PFNGLDELETESHADERPROC) SDL_GL_GetProcAddress("glDeleteShader");
@@ -1173,70 +1173,70 @@ static void GL_CheckExtensions(void) {
GL_Uniform1fFunc &&
GL_Uniform3fFunc &&
GL_Uniform4fFunc) {
Con_Printf("FOUND: GLSL\n");
console::info("FOUND: GLSL\n");
gl_glsl_able = true;
} else {
Con_Warning("GLSL not available\n");
console::warn("GLSL not available\n");
}
} else {
Con_Warning("OpenGL version < 2, GLSL not available\n");
console::warn("OpenGL version < 2, GLSL not available\n");
}
// GLSL gamma
//
if (common::check_param("-noglslgamma").has_value())
Con_Warning("GLSL gamma disabled at command line\n");
console::warn("GLSL gamma disabled at command line\n");
else if (gl_glsl_able) {
gl_glsl_gamma_able = true;
Con_Printf("Enabled: GLSL gamma\n");
console::info("Enabled: GLSL gamma\n");
} else {
Con_Warning("GLSL gamma not available, using hardware gamma\n");
console::warn("GLSL gamma not available, using hardware gamma\n");
}
// GLSL alias model rendering
//
if (common::check_param("-noglslalias").has_value())
Con_Warning("GLSL alias model rendering disabled at command line\n");
console::warn("GLSL alias model rendering disabled at command line\n");
else if (gl_glsl_able && gl_vbo_able && gl_max_texture_units >= 3) {
gl_glsl_alias_able = true;
Con_Printf("Enabled: GLSL alias model rendering\n");
console::info("Enabled: GLSL alias model rendering\n");
} else {
Con_Warning("GLSL alias model rendering not available, using Fitz renderer\n");
console::warn("GLSL alias model rendering not available, using Fitz renderer\n");
}
// packed_pixels
//
if (common::check_param("-nopackedpixels").has_value())
Con_Warning("EXT_packed_pixels disabled at command line\n");
console::warn("EXT_packed_pixels disabled at command line\n");
else if (gl_glsl_alias_able) {
gl_packed_pixels = true;
Con_Printf("Enabled: EXT_packed_pixels\n");
console::info("Enabled: EXT_packed_pixels\n");
}
#if 0 /* Disabling for non-GLSL path, needs more surgery. */
else if (GL_ParseExtensionList(gl_extensions, "GL_APPLE_packed_pixels")) {
Con_Printf("FOUND: APPLE_packed_pixels\n");
console::info("FOUND: APPLE_packed_pixels\n");
gl_packed_pixels = true;
} else if (GL_ParseExtensionList(gl_extensions, "GL_EXT_packed_pixels")) {
Con_Printf("FOUND: EXT_packed_pixels\n");
console::info("FOUND: EXT_packed_pixels\n");
gl_packed_pixels = true;
} else {
Con_Warning("packed_pixels not supported\n");
console::warn("packed_pixels not supported\n");
}
#endif
// glGenerateMipmap for warp textures
if (common::check_param("-nowarpmipmaps").has_value())
Con_Warning("glGenerateMipmap disabled at command line\n");
console::warn("glGenerateMipmap disabled at command line\n");
else {
if (gl_version_major >= 3 || GL_ParseExtensionList(gl_extensions, "GL_ARB_framebuffer_object")) {
GL_GenerateMipmap = (QS_PFNGENERATEMIPMAP) SDL_GL_GetProcAddress("glGenerateMipmap");
if (GL_GenerateMipmap != NULL)
Con_Printf("FOUND: glGenerateMipmap\n");
console::info("FOUND: glGenerateMipmap\n");
} else if (GL_ParseExtensionList(gl_extensions, "GL_EXT_framebuffer_object")) {
GL_GenerateMipmap = (QS_PFNGENERATEMIPMAP) SDL_GL_GetProcAddress("glGenerateMipmapEXT");
if (GL_GenerateMipmap != NULL)
Con_Printf("FOUND: glGenerateMipmapEXT\n");
console::info("FOUND: glGenerateMipmapEXT\n");
}
if (GL_GenerateMipmap == NULL)
Con_Warning("glGenerateMipmap not available, liquids won't have mipmaps\n");
console::warn("glGenerateMipmap not available, liquids won't have mipmaps\n");
}
}
@@ -1278,9 +1278,9 @@ static void GL_Init(void) {
gl_version = (const char *) glGetString(GL_VERSION);
gl_extensions = (const char *) glGetString(GL_EXTENSIONS);
Con_SafePrintf("GL_VENDOR: %s\n", gl_vendor);
Con_SafePrintf("GL_RENDERER: %s\n", gl_renderer);
Con_SafePrintf("GL_VERSION: %s\n", gl_version);
console::safe_print("GL_VENDOR: %s\n", gl_vendor);
console::safe_print("GL_RENDERER: %s\n", gl_renderer);
console::safe_print("GL_VERSION: %s\n", gl_version);
if (gl_version == NULL || sscanf(gl_version, "%d.%d", &gl_version_major, &gl_version_minor) < 2) {
gl_version_major = 0;
@@ -1298,13 +1298,13 @@ static void GL_Init(void) {
// https://developer.apple.com/library/mac/technotes/tn2085/
if (host_parms->numcpus > 1 &&
kCGLNoError != CGLEnable(CGLGetCurrentContext(), kCGLCEMPEngine)) {
Con_Warning("Couldn't enable multi-threaded OpenGL");
console::warn("Couldn't enable multi-threaded OpenGL");
}
#endif
//johnfitz -- intel video workarounds from Baker
if (!strcmp(gl_vendor, "Intel")) {
Con_Printf("Intel Display Adapter detected, enabling gl_clear\n");
console::info("Intel Display Adapter detected, enabling gl_clear\n");
command::buffer::add_text("gl_clear 1");
}
//johnfitz
@@ -1387,7 +1387,7 @@ VID_DescribeCurrentMode_f
*/
static void VID_DescribeCurrentMode_f(void) {
if (draw_context)
Con_Printf("%dx%dx%d %dHz %s\n",
console::info("%dx%dx%d %dHz %s\n",
VID_GetCurrentWidth(),
VID_GetCurrentHeight(),
VID_GetCurrentBPP(),
@@ -1409,8 +1409,8 @@ static void VID_DescribeModes_f(void) {
for (i = 0; i < nummodes; i++) {
if (lastwidth != modelist[i].width || lastheight != modelist[i].height || lastbpp != modelist[i].bpp) {
if (count > 0)
Con_SafePrintf("\n");
Con_SafePrintf(" %4i x %4i x %i : %i", modelist[i].width, modelist[i].height, modelist[i].bpp,
console::safe_print("\n");
console::safe_print(" %4i x %4i x %i : %i", modelist[i].width, modelist[i].height, modelist[i].bpp,
modelist[i].refreshrate);
lastwidth = modelist[i].width;
lastheight = modelist[i].height;
@@ -1418,7 +1418,7 @@ static void VID_DescribeModes_f(void) {
count++;
}
}
Con_Printf("\n%i modes\n", count);
console::info("\n%i modes\n", count);
}
/*
@@ -1429,7 +1429,7 @@ VID_FSAA_f -- ericw -- warn that vid_fsaa requires engine restart
static void VID_FSAA_f(convar *var) {
// don't print the warning if vid_fsaa is set during startup
if (vid_initialized)
Con_Printf("%s %d requires engine restart to take effect\n", var->name.c_str(), (int) var->value);
console::info("%s %d requires engine restart to take effect\n", var->name.c_str(), (int) var->value);
}
//==========================================================================
@@ -1509,7 +1509,7 @@ static void VID_InitModelist(void) {
}
if (nummodes == originalnummodes)
Con_SafePrintf("No fullscreen DIB modes found\n");
console::safe_print("No fullscreen DIB modes found\n");
#endif /* !defined(USE_SDL2) */
}
@@ -1753,7 +1753,7 @@ void VID_Toggle(void) {
}
} else {
vid_toggle_works = false;
Con_DPrintf("SDL_WM_ToggleFullScreen failed, attempting VID_Restart\n");
console::debug("SDL_WM_ToggleFullScreen failed, attempting VID_Restart\n");
vrestart:
vid_fullscreen.set(VID_GetFullscreen() ? "0" : "1");
command::buffer::add_text("vid_restart\n");