foxygit / doom Log in
commit c88aa553db9d97d1da182dba05e69cfbd7c8511f
Author:     Jonathan Dowland <jon@dow.land>
AuthorDate: Mon Jun 27 06:57:31 2016 +0100
Commit:     Jonathan Dowland <jon@dow.land>
CommitDate: Mon Jun 27 10:32:03 2016 +0100

    setup: Add joystick config for 8bitdo SFC/SNES30

    In both Bluetooth controller mode (Start+R) in both SFC30 and SNES30 variants
    and and USB controller mode for SFC30 (tested with a beta firmware due to a bug
    on OS X).

    Information on this controller: http://www.8bitdo.com/sfc30/
---
 src/setup/joystick.c | 41 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)

diff --git a/src/setup/joystick.c b/src/setup/joystick.c
index df5feabe..06f9e7ec 100644
--- a/src/setup/joystick.c
+++ b/src/setup/joystick.c
@@ -340,6 +340,20 @@ static const joystick_config_t nes30_pro_controller[] =
     {NULL, 0},
 };

+// http://www.8bitdo.com/sfc30/ or http://www.8bitdo.com/snes30/
+static const joystick_config_t sfc30_controller[] =
+{
+    {"joystick_strafe_axis",   0},
+    {"joystick_y_axis",        1},
+    {"joystick_x_axis",        CREATE_BUTTON_AXIS(4,0)}, // Y-A
+    {"joyb_use",               6}, // L
+    {"joyb_fire",              7}, // R
+    {"joyb_prevweapon",        3}, // X
+    {"joyb_nextweapon",        1}, // B
+    {"joyb_menu_activate",    11}, // Start
+    {NULL, 0},
+};
+
 static const known_joystick_t known_joysticks[] =
 {
     {
@@ -439,6 +453,33 @@ static const known_joystick_t known_joysticks[] =
         4, 16, 1,
         nes30_pro_controller,
     },
+
+    // 8Bitdo SFC30 SNES replica controller in bluetooth controller mode
+    // (hold R + Start on power on)
+    // http://www.8bitdo.com/sfc30/
+    {
+        "8Bitdo SFC30 GamePad Joystick",
+        4, 16, 1,
+        sfc30_controller,
+    },
+
+    // SNES30 colour variation of the above
+    // http://www.8bitdo.com/snes30/
+    {
+        "8Bitdo SNES30 GamePad Joystick",
+        4, 16, 1,
+        sfc30_controller,
+    },
+
+    // 8Bitdo SFC30 SNES replica controller in USB controller mode
+    // tested with firmware V2.68 (Beta); latest stable V2.65 doesn't work on
+    // OS X in USB controller mode
+    // XXX: there is probably a SNES30 variant of this too
+    {
+        "SFC30 Joystick",
+        4, 12, 1,
+        sfc30_controller,
+    },
 };

 static const known_joystick_t *GetJoystickType(int index)