better handle input mapping in cores with modes
fixes GG and SMS paks (but still doesn't provide unique overrides for the individual modes)
This commit is contained in:
parent
6f0f8cf88f
commit
2e34a86a78
2 changed files with 12 additions and 5 deletions
|
|
@ -1215,9 +1215,9 @@ void Input_init(const struct retro_input_descriptor *vars) {
|
||||||
ButtonMapping* mapping = &config.controls[i];
|
ButtonMapping* mapping = &config.controls[i];
|
||||||
mapping->default_ = mapping->local;
|
mapping->default_ = mapping->local;
|
||||||
|
|
||||||
// null mappings that aren't available in this core
|
// ignore mappings that aren't available in this core
|
||||||
if (core_mapped && !present[mapping->retro]) {
|
if (core_mapped && !present[mapping->retro]) {
|
||||||
mapping->name = NULL;
|
mapping->ignore = 1;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
LOG_info("%s: <%s>\n", mapping->name, (mapping->local==BTN_ID_NONE ? "NONE" : device_button_names[mapping->local]));
|
LOG_info("%s: <%s>\n", mapping->name, (mapping->local==BTN_ID_NONE ? "NONE" : device_button_names[mapping->local]));
|
||||||
|
|
@ -2887,9 +2887,12 @@ static int OptionControls_openMenu(MenuList* list, int i) {
|
||||||
if (OptionControls_menu.items==NULL) {
|
if (OptionControls_menu.items==NULL) {
|
||||||
// TODO: where do I free this?
|
// TODO: where do I free this?
|
||||||
OptionControls_menu.items = calloc(RETRO_BUTTON_COUNT+1, sizeof(MenuItem));
|
OptionControls_menu.items = calloc(RETRO_BUTTON_COUNT+1, sizeof(MenuItem));
|
||||||
|
int k = 0;
|
||||||
for (int j=0; config.controls[j].name; j++) {
|
for (int j=0; config.controls[j].name; j++) {
|
||||||
ButtonMapping* button = &config.controls[j];
|
ButtonMapping* button = &config.controls[j];
|
||||||
MenuItem* item = &OptionControls_menu.items[j];
|
if (button->ignore) continue;
|
||||||
|
|
||||||
|
MenuItem* item = &OptionControls_menu.items[k++];
|
||||||
item->id = j;
|
item->id = j;
|
||||||
item->name = button->name;
|
item->name = button->name;
|
||||||
item->desc = NULL;
|
item->desc = NULL;
|
||||||
|
|
@ -2899,9 +2902,12 @@ static int OptionControls_openMenu(MenuList* list, int i) {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// update values
|
// update values
|
||||||
|
int k = 0;
|
||||||
for (int j=0; config.controls[j].name; j++) {
|
for (int j=0; config.controls[j].name; j++) {
|
||||||
ButtonMapping* button = &config.controls[j];
|
ButtonMapping* button = &config.controls[j];
|
||||||
MenuItem* item = &OptionControls_menu.items[j];
|
if (button->ignore) continue;
|
||||||
|
|
||||||
|
MenuItem* item = &OptionControls_menu.items[k++];
|
||||||
item->value = button->local + 1;
|
item->value = button->local + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
typedef struct OptionOverride {
|
typedef struct OptionOverride {
|
||||||
char* key;
|
char* key;
|
||||||
char* value;
|
char* value;
|
||||||
int lock; // prevents changing this value
|
int lock; // prevents showing/changing this value
|
||||||
} OptionOverride;
|
} OptionOverride;
|
||||||
|
|
||||||
typedef struct ButtonMapping {
|
typedef struct ButtonMapping {
|
||||||
|
|
@ -13,6 +13,7 @@ typedef struct ButtonMapping {
|
||||||
int local; // TODO: dislike this name...
|
int local; // TODO: dislike this name...
|
||||||
int mod;
|
int mod;
|
||||||
int default_;
|
int default_;
|
||||||
|
int ignore;
|
||||||
} ButtonMapping;
|
} ButtonMapping;
|
||||||
|
|
||||||
typedef struct CoreOverrides {
|
typedef struct CoreOverrides {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue