]> Shamusworld >> Repos - virtualjaguar/commitdiff
Fix stupid button failure bug for controller #2.
authorShamus Hammons <jlhamm@acm.org>
Sun, 15 Nov 2015 21:40:45 +0000 (15:40 -0600)
committerShamus Hammons <jlhamm@acm.org>
Sun, 15 Nov 2015 21:40:45 +0000 (15:40 -0600)
cross-compile
src/joystick.cpp

index 852ec95972875592311934e5a7091f857b3c33b2..afbca738bec04d41686a5f670a08269f02bb9b95 100755 (executable)
@@ -9,13 +9,13 @@
 #rm makefile-qt
 
 echo "Cross compiling for Win32..."
-SUFFIX=-win32
+SUFFIX=win32
 export PATH=/opt/mxe-32/usr/bin:$PATH
 /opt/mxe-32/usr/bin/i686-w64-mingw32.static-qmake-qt5 -o makefile-qt
 make CROSS=i686-w64-mingw32.static-
 
 #echo "Cross compiling for Win64..."
-#SUFFIX=-win64
+#SUFFIX=win64
 #export PATH=/opt/mxe/usr/bin:$PATH
 #/opt/mxe/usr/bin/x86_64-w64-mingw32.static-qmake-qt5 -o makefile-qt
 #make CROSS=x86_64-w64-mingw32.static-
index 619a751df7490dec02c0a156e71201a1de1be441..4b2549384fc9d9fa311edf254399782381f5fbf4 100644 (file)
@@ -131,11 +131,12 @@ uint16_t JoystickReadWord(uint32_t offset)
 
                // Joystick data returns active low for buttons pressed, high for non-
                // pressed.
-               uint8_t offset0 = joypad0Offset[joystick_ram[1] & 0x0F] / 4;
-               uint8_t offset1 = joypad1Offset[(joystick_ram[1] >> 4) & 0x0F] / 4;
+               uint8_t offset0 = joypad0Offset[joystick_ram[1] & 0x0F];
+               uint8_t offset1 = joypad1Offset[(joystick_ram[1] >> 4) & 0x0F];
 
                if (offset0 != 0xFF)
                {
+                       offset0 /= 4;   // Make index 0, 1, 2, 3 instead of 0, 4, 8, 12
                        uint8_t mask[4][2] = { { BUTTON_A, BUTTON_PAUSE }, { BUTTON_B, -1 }, { BUTTON_C, -1 }, { BUTTON_OPTION, -1 } };
                        data &= (joypad0Buttons[mask[offset0][0]] ? 0xFFFD : 0xFFFF);
 
@@ -145,6 +146,7 @@ uint16_t JoystickReadWord(uint32_t offset)
 
                if (offset1 != 0xFF)
                {
+                       offset1 /= 4;   // Make index 0, 1, 2, 3 instead of 0, 4, 8, 12
                        uint8_t mask[4][2] = { { BUTTON_A, BUTTON_PAUSE }, { BUTTON_B, -1 }, { BUTTON_C, -1 }, { BUTTON_OPTION, -1 } };
                        data &= (joypad1Buttons[mask[offset1][0]] ? 0xFFF7 : 0xFFFF);