diff options
author | Arisotura <thetotalworm@gmail.com> | 2019-06-11 23:48:49 +0200 |
---|---|---|
committer | Arisotura <thetotalworm@gmail.com> | 2019-06-11 23:48:49 +0200 |
commit | 82f4f4fdcbd4f2947d8aa2bab7e047bfca436c08 (patch) | |
tree | 7f4be06fb2461885ab94af4b682825b9fa49946c | |
parent | bfc12a038ee1056abcfd46b51231dadb503729dc (diff) |
fix bugs, make it more responsive
-rw-r--r-- | src/libui_sdl/DlgInputConfig.cpp | 9 | ||||
-rw-r--r-- | src/libui_sdl/main.cpp | 4 |
2 files changed, 5 insertions, 8 deletions
diff --git a/src/libui_sdl/DlgInputConfig.cpp b/src/libui_sdl/DlgInputConfig.cpp index 3358ccd..7a8a768 100644 --- a/src/libui_sdl/DlgInputConfig.cpp +++ b/src/libui_sdl/DlgInputConfig.cpp @@ -54,7 +54,7 @@ typedef struct uiButton* pollbtn; SDL_TimerID timer; - Sint16 axes_rest[16]; + int axes_rest[16]; } InputDlgData; @@ -266,8 +266,6 @@ Uint32 JoyPoll(Uint32 interval, void* param) return 0; } - SDL_JoystickUpdate(); - SDL_Joystick* joy = Joystick; if (!joy) { @@ -320,8 +318,8 @@ Uint32 JoyPoll(Uint32 interval, void* param) for (int i = 0; i < naxes; i++) { Sint16 axisval = SDL_JoystickGetAxis(joy, i); - Sint16 diff = abs(axisval - dlg->axes_rest[i]); - + int diff = abs(axisval - dlg->axes_rest[i]); +printf("axis%d: val=%d, diff=%d\n", i, axisval, diff); if (dlg->axes_rest[i] < -16384 && axisval >= 0) { dlg->joymap[id] = (oldmap & 0xFFFF) | 0x10000 | (2 << 20) | (i << 24); @@ -380,7 +378,6 @@ void OnJoyStartConfig(uiButton* btn, void* data) return; } - SDL_JoystickUpdate(); int naxes = SDL_JoystickNumAxes(Joystick); if (naxes > 16) naxes = 16; for (int a = 0; a < naxes; a++) diff --git a/src/libui_sdl/main.cpp b/src/libui_sdl/main.cpp index 47c6e17..6b323c6 100644 --- a/src/libui_sdl/main.cpp +++ b/src/libui_sdl/main.cpp @@ -788,12 +788,12 @@ int EmuThreadFunc(void* burp) while (EmuRunning != 0) { + SDL_JoystickUpdate(); + if (EmuRunning == 1) { EmuStatus = 1; - SDL_JoystickUpdate(); - if (Joystick) { if (!SDL_JoystickGetAttached(Joystick)) |