mirror of
https://github.com/libretro/RetroArch.git
synced 2024-12-02 21:37:14 +00:00
(menu_cbs_{left|right}) Refactor away usage of strcmp
This commit is contained in:
parent
b5333cdbab
commit
d3ac2bff96
@ -14,6 +14,7 @@
|
||||
*/
|
||||
|
||||
#include <file/file_path.h>
|
||||
#include <rhash.h>
|
||||
|
||||
#include "../menu.h"
|
||||
#include "../menu_hash.h"
|
||||
@ -354,7 +355,9 @@ static int menu_cbs_init_bind_left_compare_label(menu_file_list_cbs_t *cbs,
|
||||
|
||||
if (setting)
|
||||
{
|
||||
if (!strcmp(setting->parent_group, "Main Menu") && setting->type == ST_GROUP)
|
||||
uint32_t parent_group_hash = djb2_calculate(setting->parent_group);
|
||||
|
||||
if ((parent_group_hash == MENU_VALUE_MAIN_MENU) && (setting->type == ST_GROUP))
|
||||
{
|
||||
cbs->action_left = action_left_scroll;
|
||||
return 0;
|
||||
@ -363,14 +366,18 @@ static int menu_cbs_init_bind_left_compare_label(menu_file_list_cbs_t *cbs,
|
||||
|
||||
for (i = 0; i < MAX_USERS; i++)
|
||||
{
|
||||
uint32_t label_setting_hash;
|
||||
char label_setting[PATH_MAX_LENGTH] = {0};
|
||||
|
||||
snprintf(label_setting, sizeof(label_setting), "input_player%d_joypad_index", i + 1);
|
||||
|
||||
if (!strcmp(label, label_setting))
|
||||
{
|
||||
cbs->action_left = bind_left_generic;
|
||||
return 0;
|
||||
}
|
||||
label_setting_hash = djb2_calculate(label_setting);
|
||||
|
||||
if (label_hash != label_setting_hash)
|
||||
continue;
|
||||
|
||||
cbs->action_left = bind_left_generic;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (strstr(label, "rdb_entry"))
|
||||
|
@ -14,6 +14,7 @@
|
||||
*/
|
||||
|
||||
#include <file/file_path.h>
|
||||
#include <rhash.h>
|
||||
|
||||
#include "../menu.h"
|
||||
#include "../menu_hash.h"
|
||||
@ -423,11 +424,13 @@ static int menu_cbs_init_bind_right_compare_label(menu_file_list_cbs_t *cbs,
|
||||
const char *label, uint32_t label_hash, uint32_t menu_label_hash, const char *elem0)
|
||||
{
|
||||
unsigned i;
|
||||
rarch_setting_t *setting = menu_setting_find(label);
|
||||
rarch_setting_t *setting = menu_setting_find(label);
|
||||
|
||||
if (setting)
|
||||
{
|
||||
if (!strcmp(setting->parent_group, "Settings") && setting->type == ST_GROUP)
|
||||
uint32_t parent_group_hash = djb2_calculate(setting->parent_group);
|
||||
|
||||
if ((parent_group_hash == MENU_LABEL_SETTINGS) && (setting->type == ST_GROUP))
|
||||
{
|
||||
cbs->action_right = action_right_scroll;
|
||||
return 0;
|
||||
@ -436,14 +439,18 @@ static int menu_cbs_init_bind_right_compare_label(menu_file_list_cbs_t *cbs,
|
||||
|
||||
for (i = 0; i < MAX_USERS; i++)
|
||||
{
|
||||
uint32_t label_setting_hash;
|
||||
char label_setting[PATH_MAX_LENGTH] = {0};
|
||||
|
||||
snprintf(label_setting, sizeof(label_setting), "input_player%d_joypad_index", i + 1);
|
||||
|
||||
if (!strcmp(label, label_setting))
|
||||
{
|
||||
cbs->action_right = bind_right_generic;
|
||||
return 0;
|
||||
}
|
||||
label_setting_hash = djb2_calculate(label_setting);
|
||||
|
||||
if (label_hash != label_setting_hash)
|
||||
continue;
|
||||
|
||||
cbs->action_right = bind_right_generic;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (strstr(label, "rdb_entry"))
|
||||
|
@ -312,7 +312,6 @@ void menu_list_pop_stack_by_needle(menu_list_t *list,
|
||||
needle_hash = djb2_calculate(needle);
|
||||
label_hash = djb2_calculate(label);
|
||||
|
||||
|
||||
while (needle_hash == label_hash)
|
||||
{
|
||||
menu_list_pop(list->menu_stack, &nav->selection_ptr);
|
||||
|
Loading…
Reference in New Issue
Block a user