]> Shamusworld >> Repos - virtualjaguar/blobdiff - src/joystick.cpp
Preliminary key handling using Qt key types.
[virtualjaguar] / src / joystick.cpp
index 057d059bf7ef756aa09dd20f68373a4837d99442..2de43cecfabd054952d95b013381141a014acf98 100644 (file)
@@ -52,6 +52,9 @@
 static uint8 joystick_ram[4];
 static uint8 joypad_0_buttons[21];
 static uint8 joypad_1_buttons[21];
+
+bool keyBuffer[21];
+
 //extern bool finished;
 ////extern bool showGUI;
 bool GUIKeyHeld = false;
@@ -95,6 +98,7 @@ void JoystickExec(void)
        // Keybindings in order of U, D, L, R, C, B, A, Op, Pa, 0-9, #, *
 //     vjs.p1KeyBindings[0] = sdlemu_getval_int("p1k_up", SDLK_UP);
 
+#if 0
        if (keystate[vjs.p1KeyBindings[0]])
                joypad_0_buttons[BUTTON_U] = 0x01;
        if (keystate[vjs.p1KeyBindings[1]])
@@ -110,6 +114,23 @@ void JoystickExec(void)
                joypad_0_buttons[BUTTON_B] = 0x01;
        if (keystate[vjs.p1KeyBindings[6]])
                joypad_0_buttons[BUTTON_A] = 0x01;
+#else
+       if (keyBuffer[0])
+               joypad_0_buttons[BUTTON_U] = 0x01;
+       if (keyBuffer[1])
+               joypad_0_buttons[BUTTON_D] = 0x01;
+       if (keyBuffer[2])
+               joypad_0_buttons[BUTTON_L] = 0x01;
+       if (keyBuffer[3])
+               joypad_0_buttons[BUTTON_R] = 0x01;
+       // The buttons are labelled C,B,A on the controller (going from left to right)
+       if (keyBuffer[4])
+               joypad_0_buttons[BUTTON_C] = 0x01;
+       if (keyBuffer[5])
+               joypad_0_buttons[BUTTON_B] = 0x01;
+       if (keyBuffer[6])
+               joypad_0_buttons[BUTTON_A] = 0x01;
+#endif
 //I may yet move these to O and P...
        if (keystate[vjs.p1KeyBindings[7]])
                joypad_0_buttons[BUTTON_OPTION] = 0x01;