Skip to content

Commit

Permalink
Add joystick count function
Browse files Browse the repository at this point in the history
  • Loading branch information
thesourcehim committed Oct 30, 2024
1 parent 7e94363 commit 8d112ac
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
9 changes: 9 additions & 0 deletions desmume/src/frontend/posix/shared/ctrlssdl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,15 @@ int get_joystick_number_by_id(SDL_JoystickID id)
return -1;
}

int get_number_of_joysticks()
{
int i, n=0;
for(i=0; i<MAX_JOYSTICKS; ++i)
if(open_joysticks[i].first)
++n;
return n;
}

static u16 shift_pressed;

void
Expand Down
1 change: 1 addition & 0 deletions desmume/src/frontend/posix/shared/ctrlssdl.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,5 +119,6 @@ void
process_joystick_device_events();

int get_joystick_number_by_id(SDL_JoystickID id);
int get_number_of_joysticks();

#endif /* CTRLSSDL_H */

0 comments on commit 8d112ac

Please sign in to comment.