final_game_tech icon indicating copy to clipboard operation
final_game_tech copied to clipboard

FPL_MAX_GAMEPAD_STATE_COUNT on Linux and Windows

Open KungPhoo opened this issue 6 months ago • 2 comments

fplGamepadStates uses a static array with size FPL_MAX_GAMEPAD_STATE_COUNT. In Windows builds it's defined as XUSER_MAX_COUNT = 4. In Liunx builds, there is FPL__LINUX_MAX_GAME_CONTROLLER_COUNT = 4;

fpl_platform_api bool fplPollGamepadStates(fplGamepadStates* outStates) checks that they are equal with fplAssert(fplArrayCount(controllersState->controllers) == fplArrayCount(outStates->deviceStates));.

But the same constant should be used for both: fpl__LinuxGameControllersState::controllers[] and fplGamepadStates::deviceStates[], because your game only has access to fplGamepadStates. If either of both changes, the game will crash on Linux, only.

KungPhoo avatar Jul 02 '25 04:07 KungPhoo