From 9a462d3ca8dd038a8269b5ac07ae080dac170e9e Mon Sep 17 00:00:00 2001 From: fgsfds Date: Sat, 25 Jan 2025 11:55:50 +0100 Subject: [PATCH 1/3] port: log controller GUID to aid in binding generation --- port/src/input.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/port/src/input.c b/port/src/input.c index 8500f4716..ede18d9e3 100644 --- a/port/src/input.c +++ b/port/src/input.c @@ -333,6 +333,14 @@ static inline void inputInitController(const s32 cidx, const s32 jidx) sysLogPrintf(LOG_NOTE, "input: assigned controller '%d: (%s)' (id %d) to player %d", jidx, SDL_GameControllerName(pads[cidx]), inputControllerGetId(pads[cidx]), cidx); + + SDL_Joystick* joy = SDL_GameControllerGetJoystick(pads[cidx]); + if (joy) { + char guidStr[1024] = ""; + SDL_JoystickGUID guid = SDL_JoystickGetGUID(joy); + SDL_JoystickGetGUIDString(guid, guidStr, sizeof(guidStr)); + sysLogPrintf(LOG_NOTE, "input: GUID for controller %d: %s", jidx, guidStr); + } } static inline void inputCloseController(const s32 cidx) From f1084b6d9312bff61f06a5ef513ab8b015aa127d Mon Sep 17 00:00:00 2001 From: fgsfds Date: Sat, 25 Jan 2025 12:00:48 +0100 Subject: [PATCH 2/3] ci: use ubuntu-22.04 for i686-linux because ubuntu-24.04 is wack --- .github/workflows/c-cpp.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/c-cpp.yml b/.github/workflows/c-cpp.yml index 0b7e6de0b..ddee809e7 100644 --- a/.github/workflows/c-cpp.yml +++ b/.github/workflows/c-cpp.yml @@ -50,7 +50,7 @@ jobs: retention-days: 0 build-i686-linux: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - name: Install dependencies run: | From 8a3dd74d5cd42df5d47af74e694ede254da6d20a Mon Sep 17 00:00:00 2001 From: fgsfds Date: Tue, 11 Feb 2025 20:02:35 +0100 Subject: [PATCH 3/3] port: add option to reload with use key in extcontrols --- port/src/main.c | 1 + port/src/optionsmenu.c | 23 +++++++++++++++++++++++ src/game/bondmove.c | 4 +++- src/game/lv.c | 2 +- src/game/mplayer/mplayer.c | 1 + src/include/types.h | 1 + 6 files changed, 30 insertions(+), 2 deletions(-) diff --git a/port/src/main.c b/port/src/main.c index 5e404426d..c367b7253 100644 --- a/port/src/main.c +++ b/port/src/main.c @@ -182,5 +182,6 @@ PD_CONSTRUCTOR static void gameConfigInit(void) configRegisterUInt(strFmt("Game.Player%d.CrosshairColour", i), &g_PlayerExtCfg[j].crosshaircolour, 0, 0xFFFFFFFF); configRegisterUInt(strFmt("Game.Player%d.CrosshairSize", i), &g_PlayerExtCfg[j].crosshairsize, 0, 4); configRegisterInt(strFmt("Game.Player%d.CrosshairHealth", i), &g_PlayerExtCfg[j].crosshairhealth, 0, CROSSHAIR_HEALTH_ON_WHITE); + configRegisterInt(strFmt("Game.Player%d.UseKeyReloads", i), &g_PlayerExtCfg[j].usereloads, 0, false); } } diff --git a/port/src/optionsmenu.c b/port/src/optionsmenu.c index 91353705b..aa7f501b3 100644 --- a/port/src/optionsmenu.c +++ b/port/src/optionsmenu.c @@ -965,6 +965,21 @@ struct menudialogdef g_ExtendedAudioMenuDialog = { NULL, }; +static MenuItemHandlerResult menuhandlerUseKeyReloads(s32 operation, struct menuitem *item, union handlerdata *data) +{ + switch (operation) { + case MENUOP_CHECKDISABLED: + return !g_PlayerExtCfg[g_ExtMenuPlayer].extcontrols; + case MENUOP_GET: + return g_PlayerExtCfg[g_ExtMenuPlayer].usereloads; + case MENUOP_SET: + g_PlayerExtCfg[g_ExtMenuPlayer].usereloads = data->checkbox.value; + break; + } + + return 0; +} + static MenuItemHandlerResult menuhandlerCrouchMode(s32 operation, struct menuitem *item, union handlerdata *data) { static const char *opts[] = { @@ -1269,6 +1284,14 @@ struct menuitem g_ExtendedGameMenuItems[] = { 0, menuhandlerCrosshairHealth, }, + { + MENUITEMTYPE_CHECKBOX, + 0, + MENUITEMFLAG_LITERAL_TEXT, + (uintptr_t)"Use Key Reloads", + 0, + menuhandlerUseKeyReloads, + }, { MENUITEMTYPE_SEPARATOR, 0, diff --git a/src/game/bondmove.c b/src/game/bondmove.c index 552dd0f83..1a5dcb6a8 100644 --- a/src/game/bondmove.c +++ b/src/game/bondmove.c @@ -1810,7 +1810,9 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i g_Vars.currentplayer->bondactivateorreload = 0; + s32 usereloads = (controlmode != CONTROLMODE_PC); #ifndef PLATFORM_N64 + usereloads = usereloads || PLAYER_EXTCFG().usereloads; if (controlmode == CONTROLMODE_PC && movedata.alt1tapcount) { g_Vars.currentplayer->bondactivateorreload = g_Vars.currentplayer->bondactivateorreload | JO_ACTION_RELOAD; } @@ -1818,7 +1820,7 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i if (movedata.btapcount) { g_Vars.currentplayer->activatetimelast = g_Vars.currentplayer->activatetimethis; g_Vars.currentplayer->activatetimethis = g_Vars.lvframe60; - if (controlmode == CONTROLMODE_PC) { + if (!usereloads) { g_Vars.currentplayer->bondactivateorreload = g_Vars.currentplayer->bondactivateorreload | JO_ACTION_ACTIVATE; } else { g_Vars.currentplayer->bondactivateorreload = movedata.btapcount ? diff --git a/src/game/lv.c b/src/game/lv.c index 22f3993a8..ec71608e8 100644 --- a/src/game/lv.c +++ b/src/game/lv.c @@ -1303,7 +1303,7 @@ Gfx *lvRender(Gfx *gdl) if (!currentPlayerInteract(false)) { #ifndef PLATFORM_N64 // n64 behavior: interact sucessful, cancel reload - if (!PLAYER_EXTCFG().extcontrols) { + if (!PLAYER_EXTCFG().extcontrols || PLAYER_EXTCFG().usereloads) { g_Vars.currentplayer->bondactivateorreload = (g_Vars.currentplayer->bondactivateorreload & ~JO_ACTION_RELOAD); } #endif diff --git a/src/game/mplayer/mplayer.c b/src/game/mplayer/mplayer.c index df78ced21..13f394492 100644 --- a/src/game/mplayer/mplayer.c +++ b/src/game/mplayer/mplayer.c @@ -130,6 +130,7 @@ struct mpweapon g_MpWeapons[NUM_MPWEAPONS] = { .crosshaircolour = 0x00ff0028, \ .crosshairsize = 2, \ .crosshairhealth = CROSSHAIR_HEALTH_OFF, \ + .usereloads = false, \ } struct extplayerconfig g_PlayerExtCfg[MAX_PLAYERS] = { diff --git a/src/include/types.h b/src/include/types.h index 79f553fc9..58df9fd2e 100644 --- a/src/include/types.h +++ b/src/include/types.h @@ -6152,6 +6152,7 @@ struct extplayerconfig { u32 crosshaircolour; u32 crosshairsize; s32 crosshairhealth; + s32 usereloads; }; #endif