(Menu) Refactor most of the main menu settings

This commit is contained in:
twinaphex 2014-08-28 00:08:13 +02:00
parent 3b51da134c
commit 9bef38186a
6 changed files with 76 additions and 40 deletions

View File

@ -3158,10 +3158,6 @@ static int menu_common_setting_set(unsigned id, unsigned action, rarch_setting_t
{
switch (id)
{
case MENU_START_SCREEN:
if (action == MENU_ACTION_OK)
file_list_push(driver.menu->menu_stack, "", "", MENU_START_SCREEN, 0, NULL);
break;
case MENU_SETTINGS_SAVESTATE_SAVE:
case MENU_SETTINGS_SAVESTATE_LOAD:
if (action == MENU_ACTION_OK)
@ -3183,17 +3179,6 @@ static int menu_common_setting_set(unsigned id, unsigned action, rarch_setting_t
else if (action == MENU_ACTION_RIGHT)
g_settings.state_slot++;
break;
case MENU_SETTINGS_SCREENSHOT:
if (action == MENU_ACTION_OK)
rarch_main_command(RARCH_CMD_TAKE_SCREENSHOT);
break;
case MENU_SETTINGS_RESTART_GAME:
if (action == MENU_ACTION_OK)
{
rarch_main_command(RARCH_CMD_RESET);
return -1;
}
break;
case MENU_SETTINGS_DISK_INDEX:
{
int step = 0;
@ -3216,29 +3201,6 @@ static int menu_common_setting_set(unsigned id, unsigned action, rarch_setting_t
break;
}
case MENU_SETTINGS_RESTART_EMULATOR:
if (action == MENU_ACTION_OK)
{
#if defined(GEKKO) && defined(HW_RVL)
fill_pathname_join(g_extern.fullpath, g_defaults.core_dir, SALAMANDER_FILE,
sizeof(g_extern.fullpath));
#endif
g_extern.lifecycle_state &= ~(1ULL << MODE_GAME);
g_extern.lifecycle_state |= (1ULL << MODE_EXITSPAWN);
return -1;
}
break;
case MENU_SETTINGS_RESUME_GAME:
if (action == MENU_ACTION_OK)
{
g_extern.lifecycle_state |= (1ULL << MODE_GAME);
return -1;
}
break;
case MENU_SETTINGS_SAVE_CONFIG:
if (action == MENU_ACTION_OK)
menu_save_new_config();
break;
// controllers
case MENU_SETTINGS_BIND_PLAYER:
if (action == MENU_ACTION_START)

View File

@ -691,3 +691,8 @@ void menu_build_scroll_indices(file_list_t *buf)
driver.menu->scroll_indices[driver.menu->scroll_indices_size++] = buf->size - 1;
}
void menu_push_info_screen(void)
{
file_list_push(driver.menu->menu_stack, "", "", MENU_START_SCREEN, 0, NULL);
}

View File

@ -110,6 +110,7 @@ uint64_t menu_input(void);
void menu_flush_stack_type(unsigned final_type);
void menu_update_system_info(menu_handle_t *menu, bool *load_no_content);
void menu_build_scroll_indices(file_list_t *buf);
void menu_push_info_screen(void);
#ifdef __cplusplus
}

View File

@ -124,7 +124,10 @@ enum basic_event
RARCH_CMD_VIDEO_SET_NONBLOCKING_STATE,
RARCH_CMD_VIDEO_SET_ASPECT_RATIO,
RARCH_CMD_RESET_CONTEXT,
RARCH_CMD_RESTART_RETROARCH,
RARCH_CMD_QUIT_RETROARCH,
RARCH_CMD_RESUME,
RARCH_CMD_MENU_SAVE_CONFIG,
};
enum menu_enums

View File

@ -3365,9 +3365,23 @@ void rarch_main_command(unsigned action)
init_drivers();
break;
case RARCH_CMD_QUIT_RETROARCH:
#ifdef HAVE_MENU
g_extern.lifecycle_state &= ~(1ULL << MODE_MENU);
g_extern.lifecycle_state &= ~(1ULL << MODE_GAME);
break;
case RARCH_CMD_RESUME:
g_extern.lifecycle_state |= (1ULL << MODE_GAME);
break;
case RARCH_CMD_RESTART_RETROARCH:
#if defined(GEKKO) && defined(HW_RVL)
fill_pathname_join(g_extern.fullpath, g_defaults.core_dir, SALAMANDER_FILE,
sizeof(g_extern.fullpath));
#endif
g_extern.lifecycle_state &= ~(1ULL << MODE_GAME);
g_extern.lifecycle_state |= (1ULL << MODE_EXITSPAWN);
break;
case RARCH_CMD_MENU_SAVE_CONFIG:
#ifdef HAVE_MENU
menu_save_new_config();
#endif
break;
}

View File

@ -1358,7 +1358,58 @@ static void general_write_handler(const void *data)
*setting->value.boolean = false;
}
}
if (!strcmp(setting->name, "fps_show"))
else if (!strcmp(setting->name, "save_new_config"))
{
if (*setting->value.boolean)
{
rarch_cmd = RARCH_CMD_MENU_SAVE_CONFIG;
*setting->value.boolean = false;
}
}
else if (!strcmp(setting->name, "restart_retroarch"))
{
if (*setting->value.boolean)
{
rarch_cmd = RARCH_CMD_RESTART_RETROARCH;
*setting->value.boolean = false;
}
}
else if (!strcmp(setting->name, "resume_content"))
{
if (*setting->value.boolean)
{
rarch_cmd = RARCH_CMD_RESUME;
*setting->value.boolean = false;
}
}
else if (!strcmp(setting->name, "restart_content"))
{
if (*setting->value.boolean)
{
rarch_cmd = RARCH_CMD_RESET;
*setting->value.boolean = false;
}
}
else if (!strcmp(setting->name, "take_screenshot"))
{
if (*setting->value.boolean)
{
rarch_cmd = RARCH_CMD_TAKE_SCREENSHOT;
*setting->value.boolean = false;
}
}
else if (!strcmp(setting->name, "help"))
{
if (*setting->value.boolean)
{
#ifdef HAVE_MENU
extern void menu_push_info_screen(void);
menu_push_info_screen();
#endif
*setting->value.boolean = false;
}
}
else if (!strcmp(setting->name, "fps_show"))
g_settings.fps_show = *setting->value.boolean;
else if (!strcmp(setting->name, "pause_nonactive"))
g_settings.pause_nonactive = *setting->value.boolean;