From: Lockl00p <97256723+Lockl00p@users.noreply.github.com> Date: Fri, 24 May 2024 03:20:38 +0000 (-0500) Subject: Fix issue with A button being automatically selected when changing keybinds X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=64587477cd558f378fea64071ca0c82cbd2d0f3c;p=xonotic%2Fdarkplaces.git Fix issue with A button being automatically selected when changing keybinds --- diff --git a/README.md b/README.md index e4de8552..50385096 100644 --- a/README.md +++ b/README.md @@ -119,6 +119,7 @@ Note: This requires a modded switch. 3. Build using `DP_MAKE_TARGET=switch make sdl-release`. 4. Copy `darkplaces-sdl.nro` to your switch's SD Card (under `/switch`) 5. Make the `/switch/darkplaces` directory. +(Press Minus to save any config changes) (Basedir is `/switch/darkplaces/(switch username)`) ## Contributing diff --git a/console.c b/console.c index a33264c1..e21f66a3 100644 --- a/console.c +++ b/console.c @@ -929,7 +929,9 @@ void Con_Init (void) Cmd_AddCommand(CF_SHARED, "clear", Con_Clear_f, "clear console history"); Cmd_AddCommand(CF_SHARED, "maps", Con_Maps_f, "list information about available maps"); Cmd_AddCommand(CF_SHARED, "condump", Con_ConDump_f, "output console history to a file (see also log_file)"); - + #ifdef __SWITCH__ + Sys_Register_Commands(); + #endif con_initialized = true; } diff --git a/sys_switch.c b/sys_switch.c index 119d4fa2..61c8a3a1 100644 --- a/sys_switch.c +++ b/sys_switch.c @@ -76,6 +76,15 @@ int StartupError(char message[]){ } } +void menu_enter_f(cmd_state_t *cmd) +{ + Key_Event(K_ENTER,0,true); + Key_Event(K_ENTER,0,false); +} + +void Sys_Register_Commands(){ + Cmd_AddCommand(CF_SHARED, "emulate_enter", menu_enter_f, "Emulate pressing Enter"); +} int main(int argc, char *argv[]) { diff --git a/vid_sdl.c b/vid_sdl.c index fc580002..0bf349eb 100644 --- a/vid_sdl.c +++ b/vid_sdl.c @@ -1125,8 +1125,10 @@ void Sys_SDL_HandleEvents(void) case SDL_JOYBUTTONDOWN: #ifdef __SWITCH__ if(event.jbutton.button == 0){ - Key_Event( K_ENTER, 0, true ); - Key_Event( K_ENTER, 0, false ); + SDL_FlushEvent(SDL_JOYBUTTONDOWN); + SDL_FlushEvent(SDL_JOYBUTTONUP); + Cbuf_AddText(cmd_local, "\nwait\nwait\nwait\n\nemulate_enter\n"); + } else if(event.jbutton.button == 13){ Key_Event( K_UPARROW, 0, true ); @@ -1152,6 +1154,9 @@ void Sys_SDL_HandleEvents(void) Key_Event( K_BACKSPACE, 0, true ); Key_Event( K_BACKSPACE, 0, false ); } + else if(event.jbutton.button == 11){ + Cbuf_AddText(cmd_local, "\nsaveconfig\n"); + } break; #endif