mirror of
https://github.com/CTCaer/RetroArch.git
synced 2025-01-27 06:11:51 +00:00
Start hooking up Disk Options -> Disk Index again
This commit is contained in:
parent
b623b42615
commit
481c5ce9d4
@ -402,33 +402,7 @@ int menu_action_setting_set(unsigned id, const char *label,
|
||||
driver.menu->list_mainmenu, list->list[driver.menu->selection_ptr].label);
|
||||
|
||||
if (setting)
|
||||
{
|
||||
if (!strcmp(setting->name, "disk_index"))
|
||||
{
|
||||
int step = 0;
|
||||
|
||||
if (action == MENU_ACTION_RIGHT || action == MENU_ACTION_OK)
|
||||
step = 1;
|
||||
else if (action == MENU_ACTION_LEFT)
|
||||
step = -1;
|
||||
|
||||
if (step)
|
||||
{
|
||||
const struct retro_disk_control_callback *control =
|
||||
(const struct retro_disk_control_callback*)
|
||||
&g_extern.system.disk_control;
|
||||
unsigned num_disks = control->get_num_images();
|
||||
unsigned current = control->get_image_index();
|
||||
unsigned next_index = (current + num_disks + 1 + step)
|
||||
% (num_disks + 1);
|
||||
rarch_disk_control_set_eject(true, false);
|
||||
rarch_disk_control_set_index(next_index);
|
||||
rarch_disk_control_set_eject(false, false);
|
||||
}
|
||||
}
|
||||
|
||||
return menu_action_handle_setting(setting, id, label, action);
|
||||
}
|
||||
|
||||
/* Fallback. */
|
||||
|
||||
|
@ -118,6 +118,9 @@ typedef enum
|
||||
MENU_SETTINGS_SHADER_PASS_SCALE_0,
|
||||
MENU_SETTINGS_SHADER_PASS_SCALE_LAST = MENU_SETTINGS_SHADER_PASS_SCALE_0 + (GFX_MAX_SHADERS - 1),
|
||||
|
||||
MENU_SETTINGS_CORE_DISK_OPTIONS_DISK_INDEX,
|
||||
MENU_SETTINGS_CORE_DISK_OPTIONS_DISK_IMAGE_APPEND,
|
||||
|
||||
// Match up with libretro order for simplicity.
|
||||
MENU_SETTINGS_BIND_BEGIN,
|
||||
MENU_SETTINGS_BIND_LAST = MENU_SETTINGS_BIND_BEGIN + RARCH_ANALOG_RIGHT_Y_MINUS,
|
||||
|
@ -182,7 +182,7 @@ static int push_list(menu_handle_t *menu,
|
||||
bool do_action = false;
|
||||
bool is_history_list = !strcmp(label, "history_list");
|
||||
|
||||
#if 0
|
||||
#if 1
|
||||
RARCH_LOG("Label is: %s\n", label);
|
||||
RARCH_LOG("Path is: %s\n", path);
|
||||
RARCH_LOG("Menu type is: %d\n", menu_type);
|
||||
@ -506,8 +506,10 @@ static int push_list(menu_handle_t *menu,
|
||||
else if (!strcmp(label, "disk_options"))
|
||||
{
|
||||
file_list_clear(list);
|
||||
file_list_push(list, "Disk Index", "disk_index", 0, 0);
|
||||
file_list_push(list, "Disk Image Append", "disk_image_append", 0, 0);
|
||||
file_list_push(list, "Disk Index", "disk_index",
|
||||
MENU_SETTINGS_CORE_DISK_OPTIONS_DISK_INDEX, 0);
|
||||
file_list_push(list, "Disk Image Append", "disk_image_append",
|
||||
MENU_SETTINGS_CORE_DISK_OPTIONS_DISK_IMAGE_APPEND, 0);
|
||||
}
|
||||
else if (
|
||||
!strcmp(label, "video_shader_preset_parameters") ||
|
||||
@ -765,7 +767,7 @@ static int menu_parse_list(file_list_t *list, file_list_t *menu_list,
|
||||
|
||||
static int menu_parse_check(const char *label, unsigned menu_type)
|
||||
{
|
||||
#if 0
|
||||
#if 1
|
||||
RARCH_LOG("label is menu_parse_check: %s\n", label);
|
||||
#endif
|
||||
bool check = (!((menu_type == MENU_FILE_DIRECTORY ||
|
||||
@ -796,7 +798,7 @@ int menu_entries_deferred_push(file_list_t *list, file_list_t *menu_list)
|
||||
|
||||
file_list_get_last(menu_list, &path, &label, &type);
|
||||
|
||||
#if 0
|
||||
#if 1
|
||||
RARCH_LOG("label: %s\n", label);
|
||||
#endif
|
||||
|
||||
|
@ -652,6 +652,33 @@ static int core_setting_toggle(unsigned type, const char *label,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int disk_options_disk_index_toggle(unsigned type, const char *label,
|
||||
unsigned action)
|
||||
{
|
||||
int step = 0;
|
||||
|
||||
if (action == MENU_ACTION_RIGHT || action == MENU_ACTION_OK)
|
||||
step = 1;
|
||||
else if (action == MENU_ACTION_LEFT)
|
||||
step = -1;
|
||||
|
||||
if (step)
|
||||
{
|
||||
const struct retro_disk_control_callback *control =
|
||||
(const struct retro_disk_control_callback*)
|
||||
&g_extern.system.disk_control;
|
||||
unsigned num_disks = control->get_num_images();
|
||||
unsigned current = control->get_image_index();
|
||||
unsigned next_index = (current + num_disks + 1 + step)
|
||||
% (num_disks + 1);
|
||||
rarch_disk_control_set_eject(true, false);
|
||||
rarch_disk_control_set_index(next_index);
|
||||
rarch_disk_control_set_eject(false, false);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int action_start_bind(unsigned type, const char *label,
|
||||
unsigned action)
|
||||
{
|
||||
@ -852,6 +879,8 @@ static void menu_entries_cbs_init_bind_toggle(menu_file_list_cbs_t *cbs,
|
||||
else if (type >= MENU_SETTINGS_LIBRETRO_PERF_COUNTERS_BEGIN &&
|
||||
type <= MENU_SETTINGS_LIBRETRO_PERF_COUNTERS_END)
|
||||
cbs->action_toggle = performance_counters_core_toggle;
|
||||
else if (type == MENU_SETTINGS_CORE_DISK_OPTIONS_DISK_INDEX)
|
||||
cbs->action_toggle = disk_options_disk_index_toggle;
|
||||
}
|
||||
|
||||
void menu_entries_cbs_init(void *data,
|
||||
|
@ -1844,18 +1844,6 @@ void setting_data_get_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
|
||||
setting_data_get_string_representation(setting, type_str, type_str_size);
|
||||
}
|
||||
@ -1889,6 +1877,18 @@ void setting_data_get_label(char *type_str,
|
||||
strlcpy(type_str, driver.menu->bind_mode_keyboard ?
|
||||
"RetroKeyboard" : "RetroPad", type_str_size);
|
||||
break;
|
||||
case MENU_SETTINGS_CORE_DISK_OPTIONS_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);
|
||||
}
|
||||
default:
|
||||
*type_str = '\0';
|
||||
*w = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user