Skip to content

Commit

Permalink
set SDL_HINT_JOYSTICK_THREAD to address dropped input issues (#796)
Browse files Browse the repository at this point in the history
i was testing the "z-target dropping" issue in soh and added some logging to `SDLAxisDirectionToButtonMapping` where we call `SDL_GameControllerGetAxis`

i found that when reproducing the z-target drop error the value we got from there would occasionally drop from the max (trigger held down) to `0` for a single frame

i searched for issues on the SDL repo related to `SDL_GameControllerGetAxis` and found libsdl-org/SDL#9270

this hint was recommended and the original reporter of that issue said it fixed it for them

i was not able to reproduce the dropped z-target issue after applying this hint

Co-authored-by: briaguya <briaguya@shipdev>
  • Loading branch information
briaguya-ai and briaguya authored Jan 23, 2025
1 parent 2e7d1fe commit 3a6518f
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/public/libultra/os.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ int32_t osContInit(OSMesgQueue* mq, uint8_t* controllerBits, OSContStatus* statu
*controllerBits = 0;
status->status |= 1;

SDL_SetHint(SDL_HINT_JOYSTICK_THREAD, "1");
if (SDL_Init(SDL_INIT_GAMECONTROLLER) != 0) {
SPDLOG_ERROR("Failed to initialize SDL game controllers ({})", SDL_GetError());
exit(EXIT_FAILURE);
Expand Down

0 comments on commit 3a6518f

Please sign in to comment.