diff --git a/control.cpp b/control.cpp index 00293364..70f2804d 100644 --- a/control.cpp +++ b/control.cpp @@ -805,7 +805,7 @@ EX bool is_joy_any(int sym) { } EX bool is_joy_index(int sym, int index) { - return is_joy_any(sym) && (sym & 127) == index; + return is_joy_any(sym) && (sym & (JOY_ID - 1)) == index; } #if HDR @@ -1227,7 +1227,7 @@ EX void handle_event(SDL_Event& ev) { } else if(ev.type == SDL_EVENT_JOYSTICK_BUTTON_DOWN && defaultjoy) { - sym = uni = PSEUDOKEY_JOY + 128 * ev.jbutton.which + ev.jbutton.button; + sym = uni = PSEUDOKEY_JOY + JOY_ID * ev.jbutton.which + ev.jbutton.button; } #endif diff --git a/sysconfig.h b/sysconfig.h index ed4d5e29..1b06703b 100644 --- a/sysconfig.h +++ b/sysconfig.h @@ -252,6 +252,7 @@ #define PSEUDOKEY_ONSCREEN_KEYBOARD 2509 #define PSEUDOKEY_JOY 4096 +#define JOY_ID 128 #ifndef CAP_PNG #define CAP_PNG (!ISMOBWEB)