mirror of
https://github.com/CTCaer/RetroArch.git
synced 2025-01-10 21:10:15 +00:00
Make menu_popup.c self-contained
This commit is contained in:
parent
a20cd41d4b
commit
9e2a148b7e
@ -242,7 +242,7 @@ int generic_action_ok_displaylist_push(const char *path,
|
||||
case ACTION_OK_DL_HELP:
|
||||
info_label = label;
|
||||
dl_type = DISPLAYLIST_HELP;
|
||||
menu_popup_push_pending(menu, true, type);
|
||||
menu_popup_push_pending(true, type);
|
||||
break;
|
||||
case ACTION_OK_DL_RPL_ENTRY:
|
||||
strlcpy(menu->deferred_path, label, sizeof(menu->deferred_path));
|
||||
|
@ -100,7 +100,7 @@ int generic_menu_iterate(void *data, void *userdata, enum menu_action action)
|
||||
switch (iterate_type)
|
||||
{
|
||||
case ITERATE_TYPE_HELP:
|
||||
ret = menu_popup_iterate_help(menu,
|
||||
ret = menu_popup_iterate_help(
|
||||
menu->menu_state.msg, sizeof(menu->menu_state.msg), label);
|
||||
BIT64_SET(menu->state, MENU_STATE_RENDER_MESSAGEBOX);
|
||||
BIT64_SET(menu->state, MENU_STATE_POST_ITERATE);
|
||||
@ -232,7 +232,7 @@ int generic_menu_iterate(void *data, void *userdata, enum menu_action action)
|
||||
BIT64_SET(menu->state, MENU_STATE_POST_ITERATE);
|
||||
|
||||
/* Have to defer it so we let settings refresh. */
|
||||
menu_popup_push(menu);
|
||||
menu_popup_push();
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -4178,7 +4178,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data)
|
||||
case DISPLAYLIST_HELP:
|
||||
menu_entries_append_enum(info->list, info->path,
|
||||
info->label, MSG_UNKNOWN, info->type, info->directory_ptr, 0);
|
||||
menu_popup_push_pending(menu, false, MENU_HELP_NONE);
|
||||
menu_popup_push_pending(false, MENU_HELP_NONE);
|
||||
break;
|
||||
case DISPLAYLIST_SETTING_ENUM:
|
||||
{
|
||||
|
@ -172,7 +172,7 @@ static bool menu_init(menu_handle_t *menu_data)
|
||||
|
||||
if (settings->menu_show_start_screen)
|
||||
{
|
||||
menu_popup_push_pending(menu_data, true,
|
||||
menu_popup_push_pending(true,
|
||||
MENU_HELP_WELCOME);
|
||||
|
||||
settings->menu_show_start_screen = false;
|
||||
@ -183,14 +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_dst)
|
||||
#ifdef IOS
|
||||
&& menu_popup_is_push_pending(menu_data)
|
||||
&& menu_popup_is_push_pending()
|
||||
#else
|
||||
&& (settings->bundle_assets_extract_version_current
|
||||
!= settings->bundle_assets_extract_last_version)
|
||||
#endif
|
||||
)
|
||||
{
|
||||
menu_popup_push_pending(menu_data, true, MENU_HELP_EXTRACT);
|
||||
menu_popup_push_pending(true, MENU_HELP_EXTRACT);
|
||||
#ifdef HAVE_ZLIB
|
||||
task_push_decompress(settings->path.bundle_assets_src,
|
||||
settings->path.bundle_assets_dst,
|
||||
@ -568,7 +568,7 @@ bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data)
|
||||
core_info_deinit_list();
|
||||
core_info_free_current_core();
|
||||
|
||||
menu_popup_deinit(menu_driver_data);
|
||||
menu_popup_deinit();
|
||||
free(menu_driver_data);
|
||||
}
|
||||
menu_driver_data = NULL;
|
||||
|
@ -64,21 +64,6 @@ enum menu_environ_cb
|
||||
MENU_ENVIRON_LAST
|
||||
};
|
||||
|
||||
enum menu_help_type
|
||||
{
|
||||
MENU_HELP_NONE = 0,
|
||||
MENU_HELP_WELCOME,
|
||||
MENU_HELP_EXTRACT,
|
||||
MENU_HELP_CONTROLS,
|
||||
MENU_HELP_CHEEVOS_DESCRIPTION,
|
||||
MENU_HELP_LOADING_CONTENT,
|
||||
MENU_HELP_WHAT_IS_A_CORE,
|
||||
MENU_HELP_CHANGE_VIRTUAL_GAMEPAD,
|
||||
MENU_HELP_AUDIO_VIDEO_TROUBLESHOOTING,
|
||||
MENU_HELP_SCANNING_CONTENT,
|
||||
MENU_HELP_LAST
|
||||
};
|
||||
|
||||
enum menu_state_changes
|
||||
{
|
||||
MENU_STATE_RENDER_FRAMEBUFFER = 0,
|
||||
@ -233,13 +218,6 @@ enum menu_settings_type
|
||||
|
||||
typedef struct
|
||||
{
|
||||
struct
|
||||
{
|
||||
bool push;
|
||||
unsigned id;
|
||||
enum menu_help_type type;
|
||||
} help_screen;
|
||||
|
||||
char deferred_path[PATH_MAX_LENGTH];
|
||||
|
||||
char scratch_buf[PATH_MAX_LENGTH];
|
||||
|
@ -26,8 +26,11 @@
|
||||
#include "../input/input_autodetect.h"
|
||||
#include "../input/input_config.h"
|
||||
|
||||
int menu_popup_iterate_help(menu_handle_t *menu,
|
||||
char *s, size_t len, const char *label)
|
||||
static bool menu_popup_pending_push = false;
|
||||
static unsigned menu_popup_id = 0;
|
||||
static enum menu_help_type menu_popup_type = MENU_HELP_NONE;
|
||||
|
||||
int menu_popup_iterate_help(char *s, size_t len, const char *label)
|
||||
{
|
||||
#ifdef HAVE_CHEEVOS
|
||||
cheevos_ctx_desc_t desc_info;
|
||||
@ -35,7 +38,7 @@ int menu_popup_iterate_help(menu_handle_t *menu,
|
||||
bool do_exit = false;
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
switch (menu->help_screen.type)
|
||||
switch (menu_popup_type)
|
||||
{
|
||||
case MENU_HELP_WELCOME:
|
||||
{
|
||||
@ -167,7 +170,7 @@ int menu_popup_iterate_help(menu_handle_t *menu,
|
||||
|
||||
#ifdef HAVE_CHEEVOS
|
||||
case MENU_HELP_CHEEVOS_DESCRIPTION:
|
||||
desc_info.idx = menu->help_screen.id;
|
||||
desc_info.idx = menu_popup_id;
|
||||
desc_info.s = s;
|
||||
desc_info.len = len;
|
||||
cheevos_get_description(&desc_info);
|
||||
@ -213,34 +216,29 @@ int menu_popup_iterate_help(menu_handle_t *menu,
|
||||
|
||||
if (do_exit)
|
||||
{
|
||||
menu->help_screen.type = MENU_HELP_NONE;
|
||||
menu_popup_type = MENU_HELP_NONE;
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void menu_popup_push_pending(menu_handle_t *menu,
|
||||
bool push, enum menu_help_type type)
|
||||
void menu_popup_push_pending(bool push, enum menu_help_type type)
|
||||
{
|
||||
if (!menu)
|
||||
return;
|
||||
menu->help_screen.push = push;
|
||||
menu->help_screen.type = type;
|
||||
menu_popup_pending_push = push;
|
||||
menu_popup_type = type;
|
||||
}
|
||||
|
||||
bool menu_popup_is_push_pending(menu_handle_t *menu)
|
||||
bool menu_popup_is_push_pending(void)
|
||||
{
|
||||
if (!menu)
|
||||
return false;
|
||||
return menu->help_screen.push;
|
||||
return menu_popup_pending_push;
|
||||
}
|
||||
|
||||
void menu_popup_push(menu_handle_t *menu)
|
||||
void menu_popup_push(void)
|
||||
{
|
||||
menu_displaylist_info_t info = {0};
|
||||
|
||||
if (!menu_popup_is_push_pending(menu))
|
||||
if (!menu_popup_is_push_pending())
|
||||
return;
|
||||
|
||||
info.list = menu_entries_get_menu_stack_ptr(0);
|
||||
@ -252,10 +250,9 @@ void menu_popup_push(menu_handle_t *menu)
|
||||
menu_displaylist_ctl(DISPLAYLIST_HELP, &info);
|
||||
}
|
||||
|
||||
void menu_popup_deinit(menu_handle_t *menu)
|
||||
void menu_popup_deinit(void)
|
||||
{
|
||||
if (!menu)
|
||||
return;
|
||||
menu->help_screen.push = false;
|
||||
menu->help_screen.type = MENU_HELP_NONE;
|
||||
menu_popup_pending_push = false;
|
||||
menu_popup_id = 0;
|
||||
menu_popup_type = MENU_HELP_NONE;
|
||||
}
|
||||
|
@ -24,19 +24,32 @@
|
||||
|
||||
#include <retro_common_api.h>
|
||||
|
||||
enum menu_help_type
|
||||
{
|
||||
MENU_HELP_NONE = 0,
|
||||
MENU_HELP_WELCOME,
|
||||
MENU_HELP_EXTRACT,
|
||||
MENU_HELP_CONTROLS,
|
||||
MENU_HELP_CHEEVOS_DESCRIPTION,
|
||||
MENU_HELP_LOADING_CONTENT,
|
||||
MENU_HELP_WHAT_IS_A_CORE,
|
||||
MENU_HELP_CHANGE_VIRTUAL_GAMEPAD,
|
||||
MENU_HELP_AUDIO_VIDEO_TROUBLESHOOTING,
|
||||
MENU_HELP_SCANNING_CONTENT,
|
||||
MENU_HELP_LAST
|
||||
};
|
||||
|
||||
RETRO_BEGIN_DECLS
|
||||
|
||||
int menu_popup_iterate_help(menu_handle_t *menu,
|
||||
char *s, size_t len, const char *label);
|
||||
int menu_popup_iterate_help(char *s, size_t len, const char *label);
|
||||
|
||||
bool menu_popup_is_push_pending(menu_handle_t *menu);
|
||||
bool menu_popup_is_push_pending(void);
|
||||
|
||||
void menu_popup_push_pending(menu_handle_t *menu,
|
||||
bool push, enum menu_help_type type);
|
||||
void menu_popup_push_pending(bool push, enum menu_help_type type);
|
||||
|
||||
void menu_popup_push(menu_handle_t *menu);
|
||||
void menu_popup_push(void);
|
||||
|
||||
void menu_popup_deinit(menu_handle_t *menu);
|
||||
void menu_popup_deinit(void);
|
||||
|
||||
RETRO_END_DECLS
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user