foxygit / fake-08-xbox360 Log in
commit df31feb98d6192cbde593118fc6b49247a5a2e71
Author:     Jon Bell <j.to.the.bell@gmail.com>
AuthorDate: Sat Jul 8 16:49:20 2023 -0600
Commit:     Jon Bell <j.to.the.bell@gmail.com>
CommitDate: Sat Jul 8 16:49:20 2023 -0600

    Add input descriptors to libretro

    Allow better control remapping
---
 platform/libretro/libretro.cpp | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/platform/libretro/libretro.cpp b/platform/libretro/libretro.cpp
index e4a1fb9..b3a119e 100644
--- a/platform/libretro/libretro.cpp
+++ b/platform/libretro/libretro.cpp
@@ -96,6 +96,20 @@ EXPORT void retro_init()
         printf("retro init called. no retro logger\n");
 	}

+    struct retro_input_descriptor input_desc[] = {
+      { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_LEFT,  "D-Pad Left" },
+      { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_UP,    "D-Pad Up" },
+      { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_DOWN,  "D-Pad Down" },
+      { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_RIGHT, "D-Pad Right" },
+      { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_B,     "Button O" },
+      { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_A,     "Button X" },
+      { 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_START, "Button Pause" },
+
+      { 0 },
+   };
+
+   enviro_cb(RETRO_ENVIRONMENT_SET_INPUT_DESCRIPTORS, input_desc);
+
     //called once. do setup (create host and vm?)
     _host = new Host();