]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
Fix issue with A button being automatically selected when changing keybinds
authorLockl00p <97256723+Lockl00p@users.noreply.github.com>
Fri, 24 May 2024 03:20:38 +0000 (22:20 -0500)
committerLockl00p <97256723+Lockl00p@users.noreply.github.com>
Fri, 24 May 2024 03:20:38 +0000 (22:20 -0500)
README.md
console.c
sys_switch.c
vid_sdl.c

index e4de8552581cf6bbdf99373b849989e03162e063..503850965e63d5760574bbfcfcdd56d365b6bd92 100644 (file)
--- 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
index a33264c19affe9e785083dde3b0aa96cd066f266..e21f66a30ed24e96f3d69033acfab47a38c9a4d1 100644 (file)
--- 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;
 }
 
index 119d4fa2e2f12de0c44e68b62c3ca2b9deaa272d..61c8a3a118c9cdca1c3114d0b08805bc70e1aec0 100644 (file)
@@ -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[])
 {
        
index fc580002f43f32bfca7d776426e814cbf57a79a9..0bf349ebbd1c3d920ab17e3e9ccad3cf4830bd19 100644 (file)
--- 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