mirror of
https://github.com/CTCaer/RetroArch.git
synced 2024-12-16 15:27:41 +00:00
(Menu) Refactor disk_index/disk_image_append settings
This commit is contained in:
parent
f6625b4edf
commit
447e65c6f4
@ -855,12 +855,8 @@ static int menu_setting_set(unsigned id, unsigned action)
|
||||
);
|
||||
|
||||
if (setting)
|
||||
handle_setting(setting, id, action);
|
||||
else
|
||||
{
|
||||
switch (id)
|
||||
{
|
||||
case MENU_SETTINGS_DISK_INDEX:
|
||||
if (!strcmp(setting->name, "disk_index"))
|
||||
{
|
||||
int step = 0;
|
||||
|
||||
@ -882,10 +878,17 @@ static int menu_setting_set(unsigned id, unsigned action)
|
||||
rarch_disk_control_set_index(next_index);
|
||||
rarch_disk_control_set_eject(false, false);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
// controllers
|
||||
else if (!strcmp(setting->name, "disk_image_append"))
|
||||
{
|
||||
}
|
||||
|
||||
handle_setting(setting, id, action);
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (id)
|
||||
{
|
||||
case MENU_SETTINGS_BIND_PLAYER:
|
||||
if (action == MENU_ACTION_START)
|
||||
driver.menu->current_pad = 0;
|
||||
@ -1283,7 +1286,7 @@ static int menu_setting_ok_toggle(unsigned type,
|
||||
menu_common_type_is(label, type) == MENU_SETTINGS ||
|
||||
!strcmp(label, "core_list") ||
|
||||
!strcmp(label, "configurations") ||
|
||||
type == MENU_SETTINGS_DISK_APPEND
|
||||
!strcmp(label, "disk_image_append")
|
||||
)
|
||||
{
|
||||
menu_entries_push(driver.menu->menu_stack,
|
||||
@ -1397,7 +1400,7 @@ static int menu_settings_iterate(unsigned action)
|
||||
dir = g_settings.libretro_directory;
|
||||
else if (!strcmp(label, "configurations"))
|
||||
dir = g_settings.menu_config_directory;
|
||||
else if (type == MENU_SETTINGS_DISK_APPEND)
|
||||
else if (!strcmp(label, "disk_image_append"))
|
||||
dir = g_settings.menu_content_directory;
|
||||
|
||||
if (driver.menu->need_refresh && action != MENU_ACTION_MESSAGE)
|
||||
@ -1906,8 +1909,7 @@ static int menu_action_ok(const char *dir,
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else if (menu_type == MENU_SETTINGS_DISK_APPEND
|
||||
&& type == MENU_FILE_PLAIN)
|
||||
else if (!strcmp(menu_label, "disk_image_append") && type == MENU_FILE_PLAIN)
|
||||
{
|
||||
char image[PATH_MAX];
|
||||
fill_pathname_join(image, dir, path, sizeof(image));
|
||||
@ -2293,6 +2295,18 @@ static void menu_common_setting_set_label(char *type_str,
|
||||
else
|
||||
strlcpy(type_str, "<default>", type_str_size);
|
||||
}
|
||||
else if (!strcmp(setting->name, "disk_index"))
|
||||
{
|
||||
const struct retro_disk_control_callback *control =
|
||||
(const struct retro_disk_control_callback*)
|
||||
&g_extern.system.disk_control;
|
||||
unsigned images = control->get_num_images();
|
||||
unsigned current = control->get_image_index();
|
||||
if (current >= images)
|
||||
strlcpy(type_str, "No Disk", type_str_size);
|
||||
else
|
||||
snprintf(type_str, type_str_size, "%u", current + 1);
|
||||
}
|
||||
else
|
||||
handle_setting_label(type_str, type_str_size, setting);
|
||||
}
|
||||
@ -2317,23 +2331,9 @@ static void menu_common_setting_set_label(char *type_str,
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
case MENU_SETTINGS_DISK_INDEX:
|
||||
{
|
||||
const struct retro_disk_control_callback *control =
|
||||
(const struct retro_disk_control_callback*)
|
||||
&g_extern.system.disk_control;
|
||||
unsigned images = control->get_num_images();
|
||||
unsigned current = control->get_image_index();
|
||||
if (current >= images)
|
||||
strlcpy(type_str, "No Disk", type_str_size);
|
||||
else
|
||||
snprintf(type_str, type_str_size, "%u", current + 1);
|
||||
break;
|
||||
}
|
||||
case MENU_SETTINGS_CUSTOM_VIEWPORT:
|
||||
case MENU_SETTINGS_SHADER_PRESET:
|
||||
case MENU_SETTINGS_SHADER_PRESET_SAVE:
|
||||
case MENU_SETTINGS_DISK_APPEND:
|
||||
case MENU_SETTINGS_CUSTOM_BIND_ALL:
|
||||
case MENU_SETTINGS_CUSTOM_BIND_DEFAULT_ALL:
|
||||
strlcpy(type_str, "...", type_str_size);
|
||||
|
@ -11,7 +11,7 @@ static void get_title(const char *label, const char *dir,
|
||||
snprintf(title, sizeof_title, "DETECTED CORES %s", dir);
|
||||
else if (!strcmp(label, "configurations"))
|
||||
snprintf(title, sizeof_title, "CONFIG %s", dir);
|
||||
else if (menu_type == MENU_SETTINGS_DISK_APPEND)
|
||||
else if (!strcmp(label, "disk_image_append"))
|
||||
snprintf(title, sizeof_title, "DISK APPEND %s", dir);
|
||||
else if (!strcmp(label, "Video Options"))
|
||||
strlcpy(title, "VIDEO OPTIONS", sizeof_title);
|
||||
|
@ -103,10 +103,6 @@ typedef enum
|
||||
MENU_SETTINGS_SHADER_LAST = MENU_SETTINGS_SHADER_0_SCALE + (3 * (GFX_MAX_SHADERS - 1)),
|
||||
MENU_SETTINGS_SHADER_PRESET_SAVE,
|
||||
|
||||
// settings options are done here too
|
||||
MENU_SETTINGS_DISK_INDEX,
|
||||
MENU_SETTINGS_DISK_APPEND,
|
||||
|
||||
MENU_SETTINGS_BIND_PLAYER,
|
||||
MENU_SETTINGS_BIND_DEVICE,
|
||||
MENU_SETTINGS_BIND_DEVICE_TYPE,
|
||||
|
@ -522,10 +522,8 @@ int menu_entries_push_list(menu_handle_t *menu,
|
||||
else if (!strcmp(label, "disk_options"))
|
||||
{
|
||||
file_list_clear(list);
|
||||
file_list_push(list, "Disk Index", "disk_index",
|
||||
MENU_SETTINGS_DISK_INDEX, 0);
|
||||
file_list_push(list, "Disk Image Append", "disk_image_append",
|
||||
MENU_SETTINGS_DISK_APPEND, 0);
|
||||
file_list_push(list, "Disk Index", "disk_index", 0, 0);
|
||||
file_list_push(list, "Disk Image Append", "disk_image_append", 0, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -579,7 +577,7 @@ int menu_parse_check(const char *label, unsigned menu_type)
|
||||
!strcmp(label, "audio_dsp_plugin") ||
|
||||
!strcmp(label, "core_list") ||
|
||||
!strcmp(label, "configurations") ||
|
||||
menu_type == MENU_SETTINGS_DISK_APPEND)))
|
||||
!strcmp(label, "disk_image_append"))))
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user