More cleanups/move more state to menu_popup.c

This commit is contained in:
twinaphex 2016-09-04 23:07:10 +02:00
parent 9c897e262b
commit a20cd41d4b
5 changed files with 45 additions and 9 deletions

View File

@ -27,6 +27,7 @@
#include "../menu_setting.h" #include "../menu_setting.h"
#include "../menu_shader.h" #include "../menu_shader.h"
#include "../menu_navigation.h" #include "../menu_navigation.h"
#include "../menu_popup.h"
#include "../menu_content.h" #include "../menu_content.h"
#include "../../configuration.h" #include "../../configuration.h"
@ -240,9 +241,8 @@ int generic_action_ok_displaylist_push(const char *path,
break; break;
case ACTION_OK_DL_HELP: case ACTION_OK_DL_HELP:
info_label = label; info_label = label;
menu->help_screen.type = type;
menu->help_screen.push = true;
dl_type = DISPLAYLIST_HELP; dl_type = DISPLAYLIST_HELP;
menu_popup_push_pending(menu, true, type);
break; break;
case ACTION_OK_DL_RPL_ENTRY: case ACTION_OK_DL_RPL_ENTRY:
strlcpy(menu->deferred_path, label, sizeof(menu->deferred_path)); strlcpy(menu->deferred_path, label, sizeof(menu->deferred_path));

View File

@ -28,6 +28,7 @@
#include "menu_content.h" #include "menu_content.h"
#include "menu_driver.h" #include "menu_driver.h"
#include "menu_navigation.h" #include "menu_navigation.h"
#include "menu_popup.h"
#include "menu_cbs.h" #include "menu_cbs.h"
#ifdef HAVE_LIBRETRODB #ifdef HAVE_LIBRETRODB
@ -4177,7 +4178,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data)
case DISPLAYLIST_HELP: case DISPLAYLIST_HELP:
menu_entries_append_enum(info->list, info->path, menu_entries_append_enum(info->list, info->path,
info->label, MSG_UNKNOWN, info->type, info->directory_ptr, 0); info->label, MSG_UNKNOWN, info->type, info->directory_ptr, 0);
menu->help_screen.push = false; menu_popup_push_pending(menu, false, MENU_HELP_NONE);
break; break;
case DISPLAYLIST_SETTING_ENUM: case DISPLAYLIST_SETTING_ENUM:
{ {

View File

@ -24,6 +24,7 @@
#include "menu_cbs.h" #include "menu_cbs.h"
#include "menu_display.h" #include "menu_display.h"
#include "menu_navigation.h" #include "menu_navigation.h"
#include "menu_popup.h"
#include "menu_shader.h" #include "menu_shader.h"
#include "../config.def.h" #include "../config.def.h"
@ -171,8 +172,9 @@ static bool menu_init(menu_handle_t *menu_data)
if (settings->menu_show_start_screen) if (settings->menu_show_start_screen)
{ {
menu_data->help_screen.push = true; menu_popup_push_pending(menu_data, true,
menu_data->help_screen.type = MENU_HELP_WELCOME; MENU_HELP_WELCOME);
settings->menu_show_start_screen = false; settings->menu_show_start_screen = false;
command_event(CMD_EVENT_MENU_SAVE_CURRENT_CONFIG, NULL); command_event(CMD_EVENT_MENU_SAVE_CURRENT_CONFIG, NULL);
} }
@ -181,15 +183,14 @@ static bool menu_init(menu_handle_t *menu_data)
&& !string_is_empty(settings->path.bundle_assets_src) && !string_is_empty(settings->path.bundle_assets_src)
&& !string_is_empty(settings->path.bundle_assets_dst) && !string_is_empty(settings->path.bundle_assets_dst)
#ifdef IOS #ifdef IOS
&& menu_data->help_screen.push && menu_popup_is_push_pending(menu_data)
#else #else
&& (settings->bundle_assets_extract_version_current && (settings->bundle_assets_extract_version_current
!= settings->bundle_assets_extract_last_version) != settings->bundle_assets_extract_last_version)
#endif #endif
) )
{ {
menu_data->help_screen.type = MENU_HELP_EXTRACT; menu_popup_push_pending(menu_data, true, MENU_HELP_EXTRACT);
menu_data->help_screen.push = true;
#ifdef HAVE_ZLIB #ifdef HAVE_ZLIB
task_push_decompress(settings->path.bundle_assets_src, task_push_decompress(settings->path.bundle_assets_src,
settings->path.bundle_assets_dst, settings->path.bundle_assets_dst,
@ -567,6 +568,7 @@ bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data)
core_info_deinit_list(); core_info_deinit_list();
core_info_free_current_core(); core_info_free_current_core();
menu_popup_deinit(menu_driver_data);
free(menu_driver_data); free(menu_driver_data);
} }
menu_driver_data = NULL; menu_driver_data = NULL;

View File

@ -220,11 +220,27 @@ int menu_popup_iterate_help(menu_handle_t *menu,
return 0; return 0;
} }
void menu_popup_push_pending(menu_handle_t *menu,
bool push, enum menu_help_type type)
{
if (!menu)
return;
menu->help_screen.push = push;
menu->help_screen.type = type;
}
bool menu_popup_is_push_pending(menu_handle_t *menu)
{
if (!menu)
return false;
return menu->help_screen.push;
}
void menu_popup_push(menu_handle_t *menu) void menu_popup_push(menu_handle_t *menu)
{ {
menu_displaylist_info_t info = {0}; menu_displaylist_info_t info = {0};
if (!menu->help_screen.push) if (!menu_popup_is_push_pending(menu))
return; return;
info.list = menu_entries_get_menu_stack_ptr(0); info.list = menu_entries_get_menu_stack_ptr(0);
@ -235,3 +251,11 @@ void menu_popup_push(menu_handle_t *menu)
menu_displaylist_ctl(DISPLAYLIST_HELP, &info); menu_displaylist_ctl(DISPLAYLIST_HELP, &info);
} }
void menu_popup_deinit(menu_handle_t *menu)
{
if (!menu)
return;
menu->help_screen.push = false;
menu->help_screen.type = MENU_HELP_NONE;
}

View File

@ -20,6 +20,8 @@
#include <stdint.h> #include <stdint.h>
#include <stdlib.h> #include <stdlib.h>
#include <boolean.h>
#include <retro_common_api.h> #include <retro_common_api.h>
RETRO_BEGIN_DECLS RETRO_BEGIN_DECLS
@ -27,8 +29,15 @@ RETRO_BEGIN_DECLS
int menu_popup_iterate_help(menu_handle_t *menu, int menu_popup_iterate_help(menu_handle_t *menu,
char *s, size_t len, const char *label); char *s, size_t len, const char *label);
bool menu_popup_is_push_pending(menu_handle_t *menu);
void menu_popup_push_pending(menu_handle_t *menu,
bool push, enum menu_help_type type);
void menu_popup_push(menu_handle_t *menu); void menu_popup_push(menu_handle_t *menu);
void menu_popup_deinit(menu_handle_t *menu);
RETRO_END_DECLS RETRO_END_DECLS
#endif #endif