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
+28 -28
View File
@@ -160,16 +160,16 @@ static void IN_DisableOSXMouseAccel(void) {
kIOReturnSuccess) {
if (IOHIDSetAccelerationWithKey(mouseDev, CFSTR(kIOHIDMouseAccelerationType), -1.0) != kIOReturnSuccess) {
convar::set("in_disablemacosxmouseaccel", "0");
Con_Printf("WARNING: Could not disable mouse acceleration (failed at IOHIDSetAccelerationWithKey).\n");
console::info("WARNING: Could not disable mouse acceleration (failed at IOHIDSetAccelerationWithKey).\n");
}
} else {
convar::set("in_disablemacosxmouseaccel", "0");
Con_Printf("WARNING: Could not disable mouse acceleration (failed at IOHIDGetAccelerationWithKey).\n");
console::info("WARNING: Could not disable mouse acceleration (failed at IOHIDGetAccelerationWithKey).\n");
}
IOServiceClose(mouseDev);
} else {
convar::set("in_disablemacosxmouseaccel", "0");
Con_Printf("WARNING: Could not disable mouse acceleration (failed at IO_GetIOHandle).\n");
console::info("WARNING: Could not disable mouse acceleration (failed at IO_GetIOHandle).\n");
}
}
@@ -178,10 +178,10 @@ static void IN_ReenableOSXMouseAccel(void) {
if (mouseDev != 0) {
if (IOHIDSetAccelerationWithKey(mouseDev, CFSTR(kIOHIDMouseAccelerationType), originalMouseSpeed) !=
kIOReturnSuccess)
Con_Printf("WARNING: Could not re-enable mouse acceleration (failed at IOHIDSetAccelerationWithKey).\n");
console::info("WARNING: Could not re-enable mouse acceleration (failed at IOHIDSetAccelerationWithKey).\n");
IOServiceClose(mouseDev);
} else {
Con_Printf("WARNING: Could not re-enable mouse acceleration (failed at IO_GetIOHandle).\n");
console::info("WARNING: Could not re-enable mouse acceleration (failed at IO_GetIOHandle).\n");
}
originalMouseSpeed = -1;
}
@@ -209,19 +209,19 @@ void IN_Activate(void) {
#endif
if (SDL_SetRelativeMouseMode(SDL_TRUE) != 0) {
Con_Printf("WARNING: SDL_SetRelativeMouseMode(SDL_TRUE) failed.\n");
console::info("WARNING: SDL_SetRelativeMouseMode(SDL_TRUE) failed.\n");
}
#else
if (SDL_WM_GrabInput(SDL_GRAB_QUERY) != SDL_GRAB_ON) {
SDL_WM_GrabInput(SDL_GRAB_ON);
if (SDL_WM_GrabInput(SDL_GRAB_QUERY) != SDL_GRAB_ON)
Con_Printf("WARNING: SDL_WM_GrabInput(SDL_GRAB_ON) failed.\n");
console::info("WARNING: SDL_WM_GrabInput(SDL_GRAB_ON) failed.\n");
}
if (SDL_ShowCursor(SDL_QUERY) != SDL_DISABLE) {
SDL_ShowCursor(SDL_DISABLE);
if (SDL_ShowCursor(SDL_QUERY) != SDL_DISABLE)
Con_Printf("WARNING: SDL_ShowCursor(SDL_DISABLE) failed.\n");
console::info("WARNING: SDL_ShowCursor(SDL_DISABLE) failed.\n");
}
#endif
@@ -247,13 +247,13 @@ void IN_Deactivate(bool free_cursor) {
if (SDL_WM_GrabInput(SDL_GRAB_QUERY) != SDL_GRAB_OFF) {
SDL_WM_GrabInput(SDL_GRAB_OFF);
if (SDL_WM_GrabInput(SDL_GRAB_QUERY) != SDL_GRAB_OFF)
Con_Printf("WARNING: SDL_WM_GrabInput(SDL_GRAB_OFF) failed.\n");
console::info("WARNING: SDL_WM_GrabInput(SDL_GRAB_OFF) failed.\n");
}
if (SDL_ShowCursor(SDL_QUERY) != SDL_ENABLE) {
SDL_ShowCursor(SDL_ENABLE);
if (SDL_ShowCursor(SDL_QUERY) != SDL_ENABLE)
Con_Printf("WARNING: SDL_ShowCursor(SDL_ENABLE) failed.\n");
console::info("WARNING: SDL_ShowCursor(SDL_ENABLE) failed.\n");
}
#endif
}
@@ -273,7 +273,7 @@ void IN_StartupJoystick(void) {
return;
if (SDL_InitSubSystem(SDL_INIT_GAMECONTROLLER) == -1) {
Con_Warning("could not initialize SDL Game Controller\n");
console::warn("could not initialize SDL Game Controller\n");
return;
}
@@ -281,14 +281,14 @@ void IN_StartupJoystick(void) {
q_snprintf(controllerdb, sizeof(controllerdb), "%s/gamecontrollerdb.txt", com_basedir);
nummappings = SDL_GameControllerAddMappingsFromFile(controllerdb);
if (nummappings > 0)
Con_Printf("%d mappings loaded from gamecontrollerdb.txt\n", nummappings);
console::info("%d mappings loaded from gamecontrollerdb.txt\n", nummappings);
// Also try host_parms->userdir
if (host_parms->userdir != host_parms->basedir) {
q_snprintf(controllerdb, sizeof(controllerdb), "%s/gamecontrollerdb.txt", host_parms->userdir);
nummappings = SDL_GameControllerAddMappingsFromFile(controllerdb);
if (nummappings > 0)
Con_Printf("%d mappings loaded from gamecontrollerdb.txt\n", nummappings);
console::info("%d mappings loaded from gamecontrollerdb.txt\n", nummappings);
}
for (i = 0; i < SDL_NumJoysticks(); i++) {
@@ -297,16 +297,16 @@ void IN_StartupJoystick(void) {
const char *controllername = SDL_GameControllerNameForIndex(i);
gamecontroller = SDL_GameControllerOpen(i);
if (gamecontroller) {
Con_Printf("detected controller: %s\n", controllername != NULL ? controllername : "NULL");
console::info("detected controller: %s\n", controllername != NULL ? controllername : "NULL");
joy_active_instaceid = SDL_JoystickInstanceID(SDL_GameControllerGetJoystick(gamecontroller));
joy_active_controller = gamecontroller;
break;
} else {
Con_Warning("failed to open controller: %s\n", controllername != NULL ? controllername : "NULL");
console::warn("failed to open controller: %s\n", controllername != NULL ? controllername : "NULL");
}
} else {
Con_Warning("joystick missing controller mappings: %s\n", joyname != NULL ? joyname : "NULL");
console::warn("joystick missing controller mappings: %s\n", joyname != NULL ? joyname : "NULL");
}
}
#endif
@@ -324,7 +324,7 @@ void IN_Init(void) {
#if !defined(USE_SDL2)
SDL_EnableUNICODE(textmode);
if (SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL) == -1)
Con_Printf("Warning: SDL_EnableKeyRepeat() failed.\n");
console::info("Warning: SDL_EnableKeyRepeat() failed.\n");
#else
if (textmode)
SDL_StartTextInput();
@@ -706,16 +706,16 @@ void IN_UpdateInputMode(void) {
#if !defined(USE_SDL2)
SDL_EnableUNICODE(textmode);
if (in_debugkeys.value)
Con_Printf("SDL_EnableUNICODE %d time: %g\n", textmode, Sys_DoubleTime());
console::info("SDL_EnableUNICODE %d time: %g\n", textmode, Sys_DoubleTime());
#else
if (textmode) {
SDL_StartTextInput();
if (in_debugkeys.value)
Con_Printf("SDL_StartTextInput time: %g\n", Sys_DoubleTime());
console::info("SDL_StartTextInput time: %g\n", Sys_DoubleTime());
} else {
SDL_StopTextInput();
if (in_debugkeys.value)
Con_Printf("SDL_StopTextInput time: %g\n", Sys_DoubleTime());
console::info("SDL_StopTextInput time: %g\n", Sys_DoubleTime());
}
#endif
}
@@ -918,20 +918,20 @@ static inline int IN_SDL2_ScancodeToQuakeKey(SDL_Scancode scancode) {
#if defined(USE_SDL2)
static void IN_DebugTextEvent(SDL_Event *event) {
Con_Printf("SDL_TEXTINPUT '%s' time: %g\n", event->text.text, Sys_DoubleTime());
console::info("SDL_TEXTINPUT '%s' time: %g\n", event->text.text, Sys_DoubleTime());
}
#endif
static void IN_DebugKeyEvent(SDL_Event *event) {
const char *eventtype = (event->key.state == SDL_PRESSED) ? "SDL_KEYDOWN" : "SDL_KEYUP";
#if defined(USE_SDL2)
Con_Printf("%s scancode: '%s' keycode: '%s' time: %g\n",
console::info("%s scancode: '%s' keycode: '%s' time: %g\n",
eventtype,
SDL_GetScancodeName(event->key.keysym.scancode),
SDL_GetKeyName(event->key.keysym.sym),
Sys_DoubleTime());
#else
Con_Printf("%s sym: '%s' unicode: %04x time: %g\n",
console::info("%s sym: '%s' unicode: %04x time: %g\n",
eventtype,
SDL_GetKeyName(event->key.keysym.sym),
(int) event->key.keysym.unicode,
@@ -1013,7 +1013,7 @@ void IN_SendKeyEvents(void) {
case SDL_MOUSEBUTTONUP:
if (event.button.button < 1 ||
event.button.button > std::size(buttonremap)) {
Con_Printf("Ignored event for mouse button %d\n",
console::info("Ignored event for mouse button %d\n",
event.button.button);
break;
}
@@ -1041,14 +1041,14 @@ void IN_SendKeyEvents(void) {
if (joy_active_instaceid == -1) {
joy_active_controller = SDL_GameControllerOpen(event.cdevice.which);
if (joy_active_controller == NULL)
Con_DPrintf("Couldn't open game controller\n");
console::debug("Couldn't open game controller\n");
else {
SDL_Joystick *joy;
joy = SDL_GameControllerGetJoystick(joy_active_controller);
joy_active_instaceid = SDL_JoystickInstanceID(joy);
}
} else
Con_DPrintf("Ignoring SDL_CONTROLLERDEVICEADDED\n");
console::debug("Ignoring SDL_CONTROLLERDEVICEADDED\n");
break;
case SDL_CONTROLLERDEVICEREMOVED:
if (joy_active_instaceid != -1 && event.cdevice.which == joy_active_instaceid) {
@@ -1056,10 +1056,10 @@ void IN_SendKeyEvents(void) {
joy_active_controller = NULL;
joy_active_instaceid = -1;
} else
Con_DPrintf("Ignoring SDL_CONTROLLERDEVICEREMOVED\n");
console::debug("Ignoring SDL_CONTROLLERDEVICEREMOVED\n");
break;
case SDL_CONTROLLERDEVICEREMAPPED:
Con_DPrintf("Ignoring SDL_CONTROLLERDEVICEREMAPPED\n");
console::debug("Ignoring SDL_CONTROLLERDEVICEREMAPPED\n");
break;
#endif