(Menu) Cleanup hardcoded labels
This commit is contained in:
parent
33a40727a3
commit
390e5f6b0c
|
@ -1141,7 +1141,7 @@ static int menu_displaylist_parse_database_entry(menu_displaylist_info_t *info)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
rdb_entry_start_game_selection_ptr = j;
|
rdb_entry_start_game_selection_ptr = j;
|
||||||
menu_list_push(info->list, "Start Content", "rdb_entry_start_game",
|
menu_list_push(info->list, "Start Content", "rdb_entry_start_content",
|
||||||
MENU_FILE_PLAYLIST_ENTRY, 0);
|
MENU_FILE_PLAYLIST_ENTRY, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <file/file_path.h>
|
#include <file/file_path.h>
|
||||||
|
#include <rhash.h>
|
||||||
|
|
||||||
#include "menu.h"
|
#include "menu.h"
|
||||||
#include "menu_display.h"
|
#include "menu_display.h"
|
||||||
|
@ -29,8 +30,6 @@
|
||||||
|
|
||||||
#include "../input/input_remapping.h"
|
#include "../input/input_remapping.h"
|
||||||
|
|
||||||
#include <rhash.h>
|
|
||||||
|
|
||||||
/* FIXME - Global variables, refactor */
|
/* FIXME - Global variables, refactor */
|
||||||
unsigned rdb_entry_start_game_selection_ptr;
|
unsigned rdb_entry_start_game_selection_ptr;
|
||||||
size_t hack_shader_pass = 0;
|
size_t hack_shader_pass = 0;
|
||||||
|
@ -56,6 +55,7 @@ static int action_ok_file_load_with_detect_core(const char *path,
|
||||||
menu_handle_t *menu = menu_driver_get_ptr();
|
menu_handle_t *menu = menu_driver_get_ptr();
|
||||||
settings_t *settings = config_get_ptr();
|
settings_t *settings = config_get_ptr();
|
||||||
global_t *global = global_get_ptr();
|
global_t *global = global_get_ptr();
|
||||||
|
uint32_t hash_label = djb2_calculate(label);
|
||||||
|
|
||||||
if (!menu)
|
if (!menu)
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -69,23 +69,21 @@ static int action_ok_file_load_with_detect_core(const char *path,
|
||||||
|
|
||||||
if (ret == -1)
|
if (ret == -1)
|
||||||
{
|
{
|
||||||
|
switch (hash_label)
|
||||||
if (!strcmp(label, "collection"))
|
|
||||||
{
|
{
|
||||||
info.list = menu->menu_list->menu_stack;
|
case MENU_LABEL_COLLECTION:
|
||||||
info.type = 0;
|
info.list = menu->menu_list->menu_stack;
|
||||||
info.directory_ptr = idx;
|
info.type = 0;
|
||||||
rdb_entry_start_game_selection_ptr = idx;
|
info.directory_ptr = idx;
|
||||||
strlcpy(info.path, settings->libretro_directory, sizeof(info.path));
|
rdb_entry_start_game_selection_ptr = idx;
|
||||||
strlcpy(info.label, "deferred_core_list_set", sizeof(info.label));
|
strlcpy(info.path, settings->libretro_directory, sizeof(info.path));
|
||||||
|
strlcpy(info.label, "deferred_core_list_set", sizeof(info.label));
|
||||||
|
|
||||||
return menu_displaylist_push_list(&info, DISPLAYLIST_GENERIC);
|
return menu_displaylist_push_list(&info, DISPLAYLIST_GENERIC);
|
||||||
}
|
default:
|
||||||
else
|
event_command(EVENT_CMD_LOAD_CORE);
|
||||||
{
|
menu_entries_common_load_content(false);
|
||||||
event_command(EVENT_CMD_LOAD_CORE);
|
return -1;
|
||||||
menu_entries_common_load_content(false);
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,13 +93,17 @@ static int action_ok_file_load_with_detect_core(const char *path,
|
||||||
info.type = 0;
|
info.type = 0;
|
||||||
info.directory_ptr = idx;
|
info.directory_ptr = idx;
|
||||||
strlcpy(info.path, settings->libretro_directory, sizeof(info.path));
|
strlcpy(info.path, settings->libretro_directory, sizeof(info.path));
|
||||||
if (!strcmp(label, "collection"))
|
|
||||||
|
switch (hash_label)
|
||||||
{
|
{
|
||||||
rdb_entry_start_game_selection_ptr = idx;
|
case MENU_LABEL_COLLECTION:
|
||||||
strlcpy(info.label, "deferred_core_list_set", sizeof(info.label));
|
rdb_entry_start_game_selection_ptr = idx;
|
||||||
|
strlcpy(info.label, "deferred_core_list_set", sizeof(info.label));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
strlcpy(info.label, "deferred_core_list", sizeof(info.label));
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
strlcpy(info.label, "deferred_core_list", sizeof(info.label));
|
|
||||||
|
|
||||||
ret = menu_displaylist_push_list(&info, DISPLAYLIST_GENERIC);
|
ret = menu_displaylist_push_list(&info, DISPLAYLIST_GENERIC);
|
||||||
}
|
}
|
||||||
|
@ -118,28 +120,36 @@ static int action_ok_playlist_entry(const char *path,
|
||||||
const char *core_name = NULL;
|
const char *core_name = NULL;
|
||||||
size_t selection_ptr = 0;
|
size_t selection_ptr = 0;
|
||||||
content_playlist_t *playlist = g_defaults.history;
|
content_playlist_t *playlist = g_defaults.history;
|
||||||
menu_handle_t *menu = menu_driver_get_ptr();
|
menu_handle_t *menu = menu_driver_get_ptr();
|
||||||
|
uint32_t hash_label = djb2_calculate(label);
|
||||||
|
|
||||||
if (!menu)
|
if (!menu)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (!strcmp(label, "collection") ||
|
switch (hash_label)
|
||||||
!strcmp(label, "rdb_entry_start_game"))
|
|
||||||
{
|
{
|
||||||
if (!menu->playlist)
|
case MENU_LABEL_COLLECTION:
|
||||||
{
|
case MENU_LABEL_RDB_ENTRY_START_CONTENT:
|
||||||
menu->playlist = content_playlist_init(menu->db_playlist_file, 1000);
|
|
||||||
|
|
||||||
if (!menu->playlist)
|
if (!menu->playlist)
|
||||||
return -1;
|
{
|
||||||
}
|
menu->playlist = content_playlist_init(menu->db_playlist_file, 1000);
|
||||||
|
|
||||||
playlist = menu->playlist;
|
if (!menu->playlist)
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
playlist = menu->playlist;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
selection_ptr = menu->navigation.selection_ptr;
|
selection_ptr = menu->navigation.selection_ptr;
|
||||||
|
|
||||||
if (!strcmp(label, "rdb_entry_start_game"))
|
switch (hash_label)
|
||||||
selection_ptr = rdb_entry_start_game_selection_ptr;
|
{
|
||||||
|
case MENU_LABEL_RDB_ENTRY_START_CONTENT:
|
||||||
|
selection_ptr = rdb_entry_start_game_selection_ptr;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
content_playlist_get_index(playlist, selection_ptr,
|
content_playlist_get_index(playlist, selection_ptr,
|
||||||
&entry_path, &entry_label, &core_path, &core_name, NULL);
|
&entry_path, &entry_label, &core_path, &core_name, NULL);
|
||||||
|
|
|
@ -148,9 +148,7 @@ extern "C" {
|
||||||
|
|
||||||
#define MENU_LABEL_TURBO 0x107434f1U
|
#define MENU_LABEL_TURBO 0x107434f1U
|
||||||
|
|
||||||
|
#define MENU_LABEL_RDB_ENTRY_START_CONTENT 0x95025a55U
|
||||||
|
|
||||||
|
|
||||||
#define MENU_LABEL_RDB_ENTRY_PUBLISHER 0x4d7bcdfbU
|
#define MENU_LABEL_RDB_ENTRY_PUBLISHER 0x4d7bcdfbU
|
||||||
#define MENU_LABEL_RDB_ENTRY_DEVELOPER 0x06f61093U
|
#define MENU_LABEL_RDB_ENTRY_DEVELOPER 0x06f61093U
|
||||||
#define MENU_LABEL_RDB_ENTRY_ORIGIN 0xb176aad5U
|
#define MENU_LABEL_RDB_ENTRY_ORIGIN 0xb176aad5U
|
||||||
|
@ -329,6 +327,7 @@ extern "C" {
|
||||||
#define MENU_LABEL_OSK_ENABLE 0x8e208498U
|
#define MENU_LABEL_OSK_ENABLE 0x8e208498U
|
||||||
#define MENU_LABEL_AUDIO_MUTE 0xe0ca1151U
|
#define MENU_LABEL_AUDIO_MUTE 0xe0ca1151U
|
||||||
#define MENU_LABEL_EXIT_EMULATOR 0x86d5d467U
|
#define MENU_LABEL_EXIT_EMULATOR 0x86d5d467U
|
||||||
|
#define MENU_LABEL_COLLECTION 0x5fea5991U
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue