Skip to content

Commit

Permalink
Implement individual button remap menu
Browse files Browse the repository at this point in the history
Not too proud of the code that I wrote for this as I feel
like it's VERY clunky, but it does work!
  • Loading branch information
SuperFromND committed Oct 9, 2023
1 parent 8df4465 commit 6e84ed3
Show file tree
Hide file tree
Showing 3 changed files with 283 additions and 10 deletions.
16 changes: 16 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1127,6 +1127,22 @@ string get_current_mapping() {

}

string get_current_mapping_explicit(bool type, unsigned int index) {
// similar to the above but you can manually specify which index and type to get
// used only for options.cpp right now, and probably not necessary with a refactor, but this is the easiest way to implement it

if (type == true) {
return SDL_GetKeyName(keymap[index]);
}

if (type == false) {
return SDL_GameControllerGetStringForButton(buttonmap[index]);
}

return "?";

}

string get_input_name() {
// used in the options menu when rebinding
// returns a string of the abstract controller that everything is mapped onto; named after the PS1 pad
Expand Down
1 change: 1 addition & 0 deletions src/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ std::string get_cpu_sequence();
std::string get_player_sequence();
std::string get_version_string();
std::string get_current_mapping();
std::string get_current_mapping_explicit(bool, unsigned int);
std::string get_input_name();

void save_settings();
Expand Down
Loading

0 comments on commit 6e84ed3

Please sign in to comment.