|
31 | 31 |
|
32 | 32 | #define GAMEPORT 0x201 |
33 | 33 |
|
| 34 | +/* Gameport status byte button bits (active low) */ |
| 35 | +#define GAMEPORT_BUTTON1 0x10 /* bit 4 */ |
| 36 | +#define GAMEPORT_BUTTON2 0x20 /* bit 5 */ |
| 37 | +#define GAMEPORT_BUTTON3 0x40 /* bit 6 */ |
| 38 | +#define GAMEPORT_BUTTON4 0x80 /* bit 7 */ |
| 39 | + |
34 | 40 | /* Static state for detection */ |
35 | 41 | static bool dos_joystick_detected = false; |
36 | 42 | static SDL_JoystickID dos_joystick_id = 0; |
@@ -263,10 +269,10 @@ static void DOS_JoystickUpdate(SDL_Joystick *joystick) |
263 | 269 |
|
264 | 270 | /* Buttons are a passive port read (no timing loop), always safe to poll */ |
265 | 271 | val = inportb(GAMEPORT); |
266 | | - SDL_SendJoystickButton(0, joystick, 0, !(val & 0x10)); /* button 1 */ |
267 | | - SDL_SendJoystickButton(0, joystick, 1, !(val & 0x20)); /* button 2 */ |
268 | | - SDL_SendJoystickButton(0, joystick, 2, !(val & 0x40)); /* button 3 */ |
269 | | - SDL_SendJoystickButton(0, joystick, 3, !(val & 0x80)); /* button 4 */ |
| 272 | + SDL_SendJoystickButton(0, joystick, 0, !(val & GAMEPORT_BUTTON1)); |
| 273 | + SDL_SendJoystickButton(0, joystick, 1, !(val & GAMEPORT_BUTTON2)); |
| 274 | + SDL_SendJoystickButton(0, joystick, 2, !(val & GAMEPORT_BUTTON3)); |
| 275 | + SDL_SendJoystickButton(0, joystick, 3, !(val & GAMEPORT_BUTTON4)); |
270 | 276 |
|
271 | 277 | /* Throttle axis reads — BIOS INT 15h subfunction 1 does an internal |
272 | 278 | timing loop that is very expensive. ~60 Hz is more than enough for |
|
0 commit comments