From aa96f9ceb3f8a7d35218fd814485dab03c363baf Mon Sep 17 00:00:00 2001 From: Alug Date: Tue, 20 Jan 2026 14:57:18 +0100 Subject: [PATCH 1/6] V_DrawVhsEffect: fix scaling with highreshudscale, fix downwards bar going out of screen bounds this shouldnt account for highreshudscale at all on very high resolutions the bars are still only half size, but atleast they dont become minuscule or just dont draw at all also ensures both bars are clamped, on some resolutions sometimes they just go out of visible screen range --- src/v_video.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/v_video.c b/src/v_video.c index dbb3b385b..b5be19a97 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -1742,6 +1742,7 @@ void V_DrawHorizontallyScaledFullScreenPatch(patch_t *patch) void V_DrawVhsEffect(boolean rewind) { fixed_t uby, dby; + // upbary is the bar going from top to bottom for some reason static fixed_t upbary = 100*FRACUNIT, downbary = 150*FRACUNIT; UINT8 barsize, updistort, downdistort; @@ -1759,20 +1760,26 @@ void V_DrawVhsEffect(boolean rewind) if (cv_reducevfx.value) return; - barsize = vid.dup << 5; - updistort = vid.dup << (rewind ? 5 : 3); + const INT32 dup = min(vid.width / BASEVIDWIDTH, vid.height / BASEVIDHEIGHT); + + barsize = dup << 5; + updistort = dup << (rewind ? 5 : 3); downdistort = updistort >> 1; if (rewind) V_DrawVhsEffect(false); // experimentation - upbary -= renderdeltatics * (vid.dup * (rewind ? 3 : 1.8f)); - downbary += renderdeltatics * (vid.dup * (rewind ? 2 : 1)); + upbary -= renderdeltatics * (fixed_t)(dup * (rewind ? 3 : 1.8f)); + downbary += renderdeltatics * (dup * (rewind ? 2 : 1)); if (upbary < -barsize*FRACUNIT) upbary = vid.height << FRACBITS; + if (upbary > vid.height << FRACBITS) + upbary = -barsize*FRACUNIT; if (downbary > vid.height << FRACBITS) downbary = -barsize*FRACUNIT; + if (downbary < -barsize*FRACUNIT) + downbary = vid.height << FRACBITS; uby = upbary >> FRACBITS; dby = downbary >> FRACBITS; From 43d3ac102d1273f7874b43b0a5e4477bd85165c2 Mon Sep 17 00:00:00 2001 From: Alug Date: Tue, 20 Jan 2026 15:42:37 +0100 Subject: [PATCH 2/6] HWR_RenderPlane: cleanup code that does nothing --- src/hardware/hw_main.cpp | 45 +++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 24 deletions(-) diff --git a/src/hardware/hw_main.cpp b/src/hardware/hw_main.cpp index 1622a4528..24d3af8ae 100644 --- a/src/hardware/hw_main.cpp +++ b/src/hardware/hw_main.cpp @@ -101,7 +101,8 @@ sector_t *gl_backsector = NULL; static constexpr float clipping_distances[] = {1024.0f, 2048.0f, 4096.0f, 6144.0f, 8192.0f, 12288.0f, 16384.0f}; // values for bsp culling // slightly higher than the far clipping plane to compensate for impreciseness -static constexpr INT32 bsp_culling_distances[] = {(1024+512)*FRACUNIT, (2048+512)*FRACUNIT, (4096+512)*FRACUNIT, +static constexpr INT32 bsp_culling_distances[] = { + (1024+512)*FRACUNIT, (2048+512)*FRACUNIT, (4096+512)*FRACUNIT, (6144+512)*FRACUNIT, (8192+512)*FRACUNIT, (12288+512)*FRACUNIT, (16384+512)*FRACUNIT}; // Performance stats @@ -587,15 +588,11 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool const sector_t *sec = FOFsector ? FOFsector : gl_frontsector; // Get the slope pointer to simplify future code - if (sec->f_slope && !isceiling) + if (!isceiling && sec->f_slope) slope = sec->f_slope; - else if (sec->c_slope && isceiling) + else if (isceiling && sec->c_slope) slope = sec->c_slope; - // Set fixedheight to the slope's height from our viewpoint, if we have a slope - if (slope) - fixedheight = P_GetSlopeZAt(slope, viewx, viewy); - height = FixedToFloat(fixedheight); // Allocate plane-vertex buffer if we need to @@ -687,18 +684,19 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool vert->s = (tempxsow * cosangf) - (tempytow * sinangf);\ vert->t = (tempxsow * sinangf) + (tempytow * cosangf);\ }\ +\ + if (slope)\ + {\ + fixedheight = P_GetSlopeZAt(slope, FloatToFixed((vx)), FloatToFixed((vy)));\ + height = FixedToFloat(fixedheight);\ + }\ \ vert->x = (vx);\ vert->y = height;\ vert->z = (vy);\ \ - if (slope)\ - {\ - fixedheight = P_GetSlopeZAt(slope, FloatToFixed((vx)), FloatToFixed((vy)));\ - vert->y = FixedToFloat(fixedheight);\ - }\ } - for (i = 0, v3d = planeVerts; i < (INT32)nrPlaneVerts; i++,v3d++,pv++) + for (i = 0, v3d = planeVerts; i < (INT32)nrPlaneVerts; i++,v3d++, pv++) SETUP3DVERT(v3d, pv->x, pv->y); if (slope) @@ -1785,10 +1783,10 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom // Single sided line... Deal only with the middletexture (if one exists) if (gl_midtexture && gl_linedef->special != HORIZONSPECIAL) // Ignore horizon line for OGL { - glTex = HWR_GetTexture(gl_midtexture, noencore); - fixed_t texturevpeg; + glTex = HWR_GetTexture(gl_midtexture, noencore); + // PEGGING if ((gl_linedef->flags & (ML_DONTPEGBOTTOM|ML_EFFECT2)) == (ML_DONTPEGBOTTOM|ML_EFFECT2)) texturevpeg = gl_frontsector->floorheight + textureheight[gl_sidedef->midtexture] - gl_frontsector->ceilingheight + gl_sidedef->rowoffset; @@ -1875,8 +1873,8 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom //Hurdler: 3d-floors test if (!gl_drawing_stencil && gl_backsector && gl_frontsector->tag != gl_backsector->tag && (gl_backsector->ffloors || gl_frontsector->ffloors)) { - ffloor_t * rover; - fixed_t highcut = 0, lowcut = 0; + ffloor_t *rover; + fixed_t highcut = 0, lowcut = 0; fixed_t lowcutslope = 0, highcutslope = 0; // Used for height comparisons and etc across FOFs and slopes @@ -2947,7 +2945,7 @@ static void HWR_Subsector(size_t num) static sector_t tempsec; //SoM: 4/7/2000 INT32 floorlightlevel; INT32 ceilinglightlevel; - INT32 locFloorHeight, locCeilingHeight; + INT32 locFloorHeight = 0, locCeilingHeight = 0; INT32 cullFloorHeight, cullCeilingHeight; INT32 light = 0; extracolormap_t *floorcolormap; @@ -2993,11 +2991,12 @@ static void HWR_Subsector(size_t num) cullFloorHeight = P_GetSectorFloorZAt (gl_frontsector, viewx, viewy); cullCeilingHeight = P_GetSectorCeilingZAt(gl_frontsector, viewx, viewy); - locFloorHeight = P_GetSectorFloorZAt (gl_frontsector, gl_frontsector->soundorg.x, gl_frontsector->soundorg.y); - locCeilingHeight = P_GetSectorCeilingZAt(gl_frontsector, gl_frontsector->soundorg.x, gl_frontsector->soundorg.y); if (gl_frontsector->ffloors) { + locFloorHeight = P_GetSectorFloorZAt (gl_frontsector, gl_frontsector->soundorg.x, gl_frontsector->soundorg.y); + locCeilingHeight = P_GetSectorCeilingZAt(gl_frontsector, gl_frontsector->soundorg.x, gl_frontsector->soundorg.y); + boolean anyMoved = gl_frontsector->moved; if (anyMoved == false) @@ -3052,8 +3051,7 @@ static void HWR_Subsector(size_t num) { HWR_GetFlat(levelflats[gl_frontsector->floorpic].lumpnum, R_NoEncore(gl_frontsector, false)); HWR_RenderPlane(sub, &extrasubsectors[num], false, - // Hack to make things continue to work around slopes. - locFloorHeight == cullFloorHeight ? locFloorHeight : gl_frontsector->floorheight, + gl_frontsector->floorheight, // We now return you to your regularly scheduled rendering. PF_Occlude, floorlightlevel, levelflats[gl_frontsector->floorpic].lumpnum, NULL, 255, floorcolormap); } @@ -3068,8 +3066,7 @@ static void HWR_Subsector(size_t num) { HWR_GetFlat(levelflats[gl_frontsector->ceilingpic].lumpnum, R_NoEncore(gl_frontsector, true)); HWR_RenderPlane(sub, &extrasubsectors[num], true, - // Hack to make things continue to work around slopes. - locCeilingHeight == cullCeilingHeight ? locCeilingHeight : gl_frontsector->ceilingheight, + gl_frontsector->ceilingheight, // We now return you to your regularly scheduled rendering. PF_Occlude, ceilinglightlevel, levelflats[gl_frontsector->ceilingpic].lumpnum, NULL, 255, ceilingcolormap); } From 073b35690b52a9673bf62236cfdea66877358fc1 Mon Sep 17 00:00:00 2001 From: Alug Date: Tue, 20 Jan 2026 16:25:07 +0100 Subject: [PATCH 3/6] dont attempt to show sdl message box on non dedicated builds running as dedicated --- src/sdl/i_system.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/sdl/i_system.cpp b/src/sdl/i_system.cpp index 15ba76917..b868d34c0 100644 --- a/src/sdl/i_system.cpp +++ b/src/sdl/i_system.cpp @@ -1776,9 +1776,10 @@ FUNCNORETURN static ATTRNORETURN void newsignalhandler_Warn(const char *pr) I_OutputMsg("%s\n", text); - SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, - "Startup error", - text, NULL); + if (!M_CheckParm("-dedicated")) + SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, + "Startup error", + text, NULL); I_ShutdownConsole(); exit(-1); @@ -1979,9 +1980,10 @@ FUNCIERROR void ATTRNORETURN I_Error(const char *error, ...) // Implement message box with SDL_ShowSimpleMessageBox, // which should fail gracefully if it can't put a message box up // on the target system - SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, - "SRB2Kart " VERSIONSTRING " Recursive Error", - buffer, NULL); + if (!M_CheckParm("-dedicated")) + SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, + "SRB2Kart " VERSIONSTRING " Recursive Error", + buffer, NULL); W_Shutdown(); exit(-1); // recursive errors detected @@ -2024,7 +2026,8 @@ FUNCIERROR void ATTRNORETURN I_Error(const char *error, ...) // Implement message box with SDL_ShowSimpleMessageBox, // which should fail gracefully if it can't put a message box up // on the target system - SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "SRB2Kart " VERSIONSTRING " Error", buffer, NULL); + if (!M_CheckParm("-dedicated")) + SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "SRB2Kart " VERSIONSTRING " Error", buffer, NULL); // Note that SDL_ShowSimpleMessageBox does *not* require SDL to be // initialized at the time, so calling it after SDL_Quit() is // perfectly okay! In addition, we do this on purpose so the From 5289f138918a1f2b279dd06cdb1ebd1d2dc3a151 Mon Sep 17 00:00:00 2001 From: Alug Date: Tue, 20 Jan 2026 17:31:58 +0100 Subject: [PATCH 4/6] Show report issue button also on I_Error also make wrapper functions for everything, to reduce code dupe --- src/sdl/i_system.cpp | 84 ++++++++++++++++++++++++-------------------- 1 file changed, 46 insertions(+), 38 deletions(-) diff --git a/src/sdl/i_system.cpp b/src/sdl/i_system.cpp index b868d34c0..eeeb2373c 100644 --- a/src/sdl/i_system.cpp +++ b/src/sdl/i_system.cpp @@ -1629,24 +1629,13 @@ static int I_OpenURL(const char *url) #endif } -static void I_ReportSignal(int num, int coredumped) +static void I_ShowErrorBox(const char *title, const char *msg) { - char sigmsg[512]; - char signame[128]; - char sigttl[512] = "Process killed by signal: "; - const char *reportmsg = "\n\n\nTo help us figure out the cause, please report the issue to our github page with " CRASH_LOGFILE_NAME " attached.\n\nSorry for the inconvenience!"; - - I_PrintSignal(num, coredumped, sigmsg, signame); - - size_t len = strlen(sigmsg); - snprintf(sigmsg + len, sizeof(sigmsg) - len, "\n\nCrash report has been saved into %s", CRASH_LOGFILE_NAME); - - strcat(sigttl, signame); - I_OutputMsg("\n%s\n\n", sigttl); - if (M_CheckParm("-dedicated")) return; + const char *reportmsg = "\n\n\nTo help us figure out the cause, please report the issue to our github page with " CRASH_LOGFILE_NAME " attached.\n\nSorry for the inconvenience!"; + const SDL_MessageBoxButtonData buttons[] = { { SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT, 0, "OK" }, { 0, 1, "Report Issue" }, @@ -1655,8 +1644,8 @@ static void I_ReportSignal(int num, int coredumped) const SDL_MessageBoxData messageboxdata = { SDL_MESSAGEBOX_ERROR, /* .flags */ NULL, /* .window */ - sigttl, /* .title */ - va("%s %s", sigmsg, reportmsg), /* .message */ + title, /* .title */ + va("%s %s", msg, reportmsg), /* .message */ SDL_arraysize(buttons), /* .numbuttons */ buttons, /* .buttons */ NULL /* .colorScheme */ @@ -1670,6 +1659,39 @@ static void I_ReportSignal(int num, int coredumped) I_OpenURL("https://github.com/Indev450/SRB2Kart-Saturn/issues"); } +static void I_ShowSimpleErrorBox(const char *title, char *msg) +{ + if (M_CheckParm("-dedicated")) + return; + + // Implement message box with SDL_ShowSimpleMessageBox, + // which should fail gracefully if it can't put a message box up + // on the target system + SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, title, msg, NULL); + // Note that SDL_ShowSimpleMessageBox does *not* require SDL to be + // initialized at the time, so calling it after SDL_Quit() is + // perfectly okay! In addition, we do this on purpose so the + // fullscreen window is closed before displaying the error message + // in case the fullscreen window blocks it for some absurd reason. +} + +static void I_ReportSignal(int num, int coredumped) +{ + char sigmsg[512]; + char signame[128]; + char sigttl[512] = "Process killed by signal: "; + + I_PrintSignal(num, coredumped, sigmsg, signame); + + size_t len = strlen(sigmsg); + snprintf(sigmsg + len, sizeof(sigmsg) - len, "\n\nCrash report has been saved into %s", CRASH_LOGFILE_NAME); + + strcat(sigttl, signame); + I_OutputMsg("\n%s\n\n", sigttl); + //I_ShowSimpleErrorBox(sigttl, sigmsg); + I_ShowErrorBox(sigttl, sigmsg); +} + #ifndef NEWSIGNALHANDLER FUNCNORETURN static ATTRNORETURN void signal_handler(INT32 num) { @@ -1775,11 +1797,7 @@ FUNCNORETURN static ATTRNORETURN void newsignalhandler_Warn(const char *pr) ); I_OutputMsg("%s\n", text); - - if (!M_CheckParm("-dedicated")) - SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, - "Startup error", - text, NULL); + I_ShowSimpleErrorBox("Startup error", text); I_ShutdownConsole(); exit(-1); @@ -1941,6 +1959,7 @@ FUNCIERROR void ATTRNORETURN I_Error(const char *error, ...) { va_list argptr; char buffer[8192]; + const char *sigttl = ""; #ifdef HAVE_THREADS if (std::this_thread::get_id() != g_main_thread_id) @@ -1977,13 +1996,9 @@ FUNCIERROR void ATTRNORETURN I_Error(const char *error, ...) va_start(argptr, error); vsnprintf(buffer, 8192, error, argptr); va_end(argptr); - // Implement message box with SDL_ShowSimpleMessageBox, - // which should fail gracefully if it can't put a message box up - // on the target system - if (!M_CheckParm("-dedicated")) - SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, - "SRB2Kart " VERSIONSTRING " Recursive Error", - buffer, NULL); + + sigttl = "SRB2Kart " VERSIONSTRING " Recursive Error"; + I_ShowSimpleErrorBox(sigttl, buffer); W_Shutdown(); exit(-1); // recursive errors detected @@ -2023,16 +2038,9 @@ FUNCIERROR void ATTRNORETURN I_Error(const char *error, ...) I_ShutdownSystem(); SDL_Quit(); - // Implement message box with SDL_ShowSimpleMessageBox, - // which should fail gracefully if it can't put a message box up - // on the target system - if (!M_CheckParm("-dedicated")) - SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "SRB2Kart " VERSIONSTRING " Error", buffer, NULL); - // Note that SDL_ShowSimpleMessageBox does *not* require SDL to be - // initialized at the time, so calling it after SDL_Quit() is - // perfectly okay! In addition, we do this on purpose so the - // fullscreen window is closed before displaying the error message - // in case the fullscreen window blocks it for some absurd reason. + sigttl = "SRB2Kart " VERSIONSTRING " Error"; + //I_ShowSimpleErrorBox(sigttl, buffer); + I_ShowErrorBox(sigttl, buffer); W_Shutdown(); From 4e75d9902653db35ba2349612479d977cfbf04bb Mon Sep 17 00:00:00 2001 From: Alug Date: Wed, 21 Jan 2026 19:49:26 +0100 Subject: [PATCH 5/6] simplify LUA_Alloc Z_Realloc already handles everything internally, no need to manually free anything --- src/lua_infolib.c | 2 +- src/lua_script.c | 39 ++++++++++++++++++--------------------- 2 files changed, 19 insertions(+), 22 deletions(-) diff --git a/src/lua_infolib.c b/src/lua_infolib.c index 68ca6b4d0..4c84c48d5 100644 --- a/src/lua_infolib.c +++ b/src/lua_infolib.c @@ -25,7 +25,7 @@ #include "lua_hook.h" // cmd errors boolean LUA_CallAction(enum actionnum actionnum, mobj_t *actor); -state_t *astate; +state_t *astate = NULL; boolean actionsoverridden[NUMACTIONS] = {false}; diff --git a/src/lua_script.c b/src/lua_script.c index 2aa88cd52..8982688a1 100644 --- a/src/lua_script.c +++ b/src/lua_script.c @@ -45,20 +45,20 @@ int hook_defrosting = 0; // List of internal libraries to load from SRB2 static lua_CFunction liblist[] = { - LUA_EnumLib, // global metatable for enums - LUA_SOCLib, // A_Action functions, freeslot - LUA_BaseLib, // string concatination by +, CONS_Printf, p_local.h stuff (P_InstaThrust, P_Move), etc. - LUA_MathLib, // fixed_t and angle_t math functions - LUA_HookLib, // hookAdd and hook-calling functions - LUA_ConsoleLib, // console command/variable functions and structs - LUA_InfoLib, // info.h stuff: mobjinfo_t, mobjinfo[], state_t, states[] - LUA_MobjLib, // mobj_t, mapthing_t - LUA_PlayerLib, // player_t - LUA_SkinLib, // skin_t, skins[] - LUA_ThinkerLib, // thinker_t - LUA_MapLib, // line_t, side_t, sector_t, subsector_t - LUA_BlockmapLib, // blockmap stuff - LUA_HudLib, // HUD stuff + LUA_EnumLib, // global metatable for enums + LUA_SOCLib, // A_Action functions, freeslot + LUA_BaseLib, // string concatination by +, CONS_Printf, p_local.h stuff (P_InstaThrust, P_Move), etc. + LUA_MathLib, // fixed_t and angle_t math functions + LUA_HookLib, // hookAdd and hook-calling functions + LUA_ConsoleLib, // console command/variable functions and structs + LUA_InfoLib, // info.h stuff: mobjinfo_t, mobjinfo[], state_t, states[] + LUA_MobjLib, // mobj_t, mapthing_t + LUA_PlayerLib, // player_t + LUA_SkinLib, // skin_t, skins[] + LUA_ThinkerLib, // thinker_t + LUA_MapLib, // line_t, side_t, sector_t, subsector_t + LUA_BlockmapLib, // blockmap stuff + LUA_HudLib, // HUD stuff NULL }; @@ -66,12 +66,8 @@ static lua_CFunction liblist[] = { static void *LUA_Alloc(void *ud, void *ptr, size_t osize, size_t nsize) { (void)ud; - if (nsize == 0) { - if (osize != 0) - Z_Free(ptr); - return NULL; - } else - return Z_Realloc(ptr, nsize, PU_LUA, NULL); + (void)osize; + return Z_Realloc(ptr, nsize, PU_LUA, NULL); } // Panic function Lua calls when there's an unprotected error. @@ -213,7 +209,8 @@ void LUA_ClearState(void) lua_setfield(L, LUA_REGISTRYINDEX, LREG_VALID); // open srb2 libraries - for(i = 0; liblist[i]; i++) { + for (i = 0; liblist[i]; i++) + { lua_pushcfunction(L, liblist[i]); lua_call(L, 0, 0); } From 59c9af97c2d9dbfcb5405acf7c6d6a5403132d28 Mon Sep 17 00:00:00 2001 From: Alug Date: Wed, 21 Jan 2026 19:53:49 +0100 Subject: [PATCH 6/6] joy_open: make debug prints actually print the player number --- src/sdl/i_system.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/sdl/i_system.cpp b/src/sdl/i_system.cpp index eeeb2373c..ea10ed34c 100644 --- a/src/sdl/i_system.cpp +++ b/src/sdl/i_system.cpp @@ -885,13 +885,13 @@ static int joy_open(int playerIndex, int joyIndex) if (SDL_WasInit(SDL_INIT_JOYSTICK) == 0) { - CONS_Printf(M_GetText("Joystick subsystem not started\n")); + CONS_Printf("Joystick subsystem not started\n"); return -1; } if (SDL_WasInit(SDL_INIT_GAMECONTROLLER) == 0) { - CONS_Printf(M_GetText("Game Controller subsystem not started\n")); + CONS_Printf("Game Controller subsystem not started\n"); return -1; } @@ -902,7 +902,7 @@ static int joy_open(int playerIndex, int joyIndex) if (num_joy == 0) { - CONS_Printf("%s", M_GetText("Found no joysticks on this system\n")); + CONS_Printf("%s", "Found no joysticks on this system\n"); return -1; } @@ -925,7 +925,7 @@ static int joy_open(int playerIndex, int joyIndex) return SDL_CONTROLLER_AXIS_MAX; // Else, we're changing devices, so send neutral joy events - CONS_Debug(DBG_GAMELOGIC, "Joystick1 device is changing; resetting events...\n"); + CONS_Debug(DBG_GAMELOGIC, "Joystick %d device is changing; resetting events...\n", playerIndex+1); I_ShutdownJoystick(playerIndex); } @@ -933,11 +933,11 @@ static int joy_open(int playerIndex, int joyIndex) if (JoyInfo[playerIndex].dev == NULL) { - CONS_Debug(DBG_GAMELOGIC, M_GetText("Joystick1: Couldn't open device - %s\n"), SDL_GetError()); + CONS_Debug(DBG_GAMELOGIC, "Joystick %d: Couldn't open device - %s\n", playerIndex+1, SDL_GetError()); return -1; } - CONS_Debug(DBG_GAMELOGIC, M_GetText("Joystick1: %s\n"), SDL_GameControllerName(JoyInfo[playerIndex].dev)); + CONS_Debug(DBG_GAMELOGIC, "Joystick %d: %s\n", playerIndex+1, SDL_GameControllerName(JoyInfo[playerIndex].dev)); JoyInfo[playerIndex].id = I_GetJoystickDeviceIndex(JoyInfo[playerIndex].dev);