frontend: improve sdl gamepad support
authornotaz <notasas@gmail.com>
Tue, 20 May 2025 21:48:28 +0000 (00:48 +0300)
committernotaz <notasas@gmail.com>
Tue, 20 May 2025 21:48:28 +0000 (00:48 +0300)
notaz/pcsx_rearmed#379

frontend/libpicofe
frontend/menu.c
frontend/plat_sdl.c
frontend/plugin_lib.c

index ab0990a..5d8d907 160000 (submodule)
@@ -1 +1 @@
-Subproject commit ab0990ab434971e1ab1f7ebda61ce368bb7a4d11
+Subproject commit 5d8d9079236d022e7f0db795aa18616856d24451
index 0c4ebce..851d3a8 100644 (file)
@@ -436,6 +436,10 @@ static const struct {
        CE_INTVAL(memcard2_sel),
        CE_INTVAL(g_autostateld_opt),
        CE_INTVAL(cd_buf_count),
+       CE_INTVAL_N("adev0_axis0", in_adev_axis[0][0]),
+       CE_INTVAL_N("adev0_axis1", in_adev_axis[0][1]),
+       CE_INTVAL_N("adev1_axis0", in_adev_axis[1][0]),
+       CE_INTVAL_N("adev1_axis1", in_adev_axis[1][1]),
        CE_INTVAL_N("adev0_is_nublike", in_adev_is_nublike[0]),
        CE_INTVAL_N("adev1_is_nublike", in_adev_is_nublike[1]),
        CE_INTVAL_V(frameskip, 4),
@@ -1113,6 +1117,10 @@ static void keys_load_all(const char *cfg)
 
 static int key_config_loop_wrap(int id, int keys)
 {
+       int d;
+
+       for (d = 0; d < IN_MAX_DEVS; d++)
+               in_set_config_int(d, IN_CFG_ANALOG_MAP_ULDR, 0);
        switch (id) {
                case MA_CTRL_PLAYER1:
                        key_config_loop(me_ctrl_actions, array_size(me_ctrl_actions) - 1, 0);
@@ -1126,6 +1134,9 @@ static int key_config_loop_wrap(int id, int keys)
                default:
                        break;
        }
+       for (d = 0; d < IN_MAX_DEVS; d++)
+               in_set_config_int(d, IN_CFG_ANALOG_MAP_ULDR, 1);
+
        return 0;
 }
 
index f207d2a..0027314 100644 (file)
@@ -660,6 +660,8 @@ void plat_gvideo_close(void)
 
 void plat_video_menu_enter(int is_rom_loaded)
 {
+  int d;
+
   in_menu = 1;
 
   /* surface will be lost, must adjust pl_vout_buf for menu bg */
@@ -688,6 +690,9 @@ void plat_video_menu_enter(int is_rom_loaded)
   else
     overlay_or_gl_check_enable();
   centered_clear();
+
+  for (d = 0; d < IN_MAX_DEVS; d++)
+    in_set_config_int(d, IN_CFG_ANALOG_MAP_ULDR, 1);
 }
 
 void plat_video_menu_begin(void)
@@ -749,6 +754,8 @@ void plat_video_menu_end(void)
 
 void plat_video_menu_leave(void)
 {
+  int d;
+
   in_menu = 0;
   if (plat_sdl_overlay != NULL || plat_sdl_gl_active)
     memset(shadow_fb, 0, g_menuscreen_w * g_menuscreen_h * 2);
@@ -758,6 +765,9 @@ void plat_video_menu_leave(void)
   else
     overlay_or_gl_check_enable();
   centered_clear();
+
+  for (d = 0; d < IN_MAX_DEVS; d++)
+    in_set_config_int(d, IN_CFG_ANALOG_MAP_ULDR, 0);
 }
 
 void *plat_prepare_screenshot(int *w, int *h, int *bpp)
index 81998d5..324fede 100644 (file)
@@ -45,7 +45,13 @@ int multitap1;
 int multitap2;
 int in_analog_left[8][2] = {{ 127, 127 },{ 127, 127 },{ 127, 127 },{ 127, 127 },{ 127, 127 },{ 127, 127 },{ 127, 127 },{ 127, 127 }};
 int in_analog_right[8][2] = {{ 127, 127 },{ 127, 127 },{ 127, 127 },{ 127, 127 },{ 127, 127 },{ 127, 127 },{ 127, 127 },{ 127, 127 }};
-int in_adev[2] = { -1, -1 }, in_adev_axis[2][2] = {{ 0, 1 }, { 0, 1 }};
+int in_adev[2] = { -1, -1 };
+int in_adev_axis[2][2] =
+#ifdef PANDORA
+  {{ 0, 1 }, { 0, 1 }};
+#else
+  {{ 0, 1 }, { 2, 3 }};
+#endif
 int in_adev_is_nublike[2];
 unsigned short in_keystate[8];
 int in_mouse[8][2];