Refactor and make the joystick querier re-runnable
The previous function could only be effectively run one because it changes the value of the global 'joytype' to something other than AUTO, which is what this function looks for to re-query the joysticks. Second, if this function is run more than once, then it clobbers the prior set number of joysticks back to zero (without re-requerying for the actual quantity), rendering the joysticks unuseable. Finally, this function depends on several SDL calls to the joystick subsystem, but fails to check or initialize it. The commit: - Checks for an initializes the joystick subsystem before using it - Always re-queries the current state of the joystick (re-runnable) - Simplifies the logic to determine useability (retains criteria) - Conservatively writes the joysticks quantities at the end
This commit is contained in:
parent
d815c52965
commit
81efce0862
2 changed files with 49 additions and 58 deletions
|
@ -2824,7 +2824,6 @@ int main(int argc, char* argv[]) {
|
|||
}
|
||||
|
||||
/* Init the keyMapper */
|
||||
MAPPER_Init();
|
||||
if (control->cmdline->FindExist("-startmapper")) MAPPER_RunInternal();
|
||||
/* Start up main machine */
|
||||
control->StartUp();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue