Get rid of MENU_ENTREIS_CTL_UNSET_REFRESH and

MENU_ENTRIES_CTL_GET_REFRESH
This commit is contained in:
libretroadmin 2023-05-11 01:18:26 +02:00
parent 22dc543364
commit c3b16e1803
7 changed files with 16 additions and 29 deletions

View File

@ -4702,10 +4702,10 @@ static void cb_net_generic_subdir(retro_task_t *task,
static void cb_net_generic(retro_task_t *task,
void *task_data, void *user_data, const char *err)
{
bool refresh = false;
http_transfer_data_t *data = (http_transfer_data_t*)task_data;
file_transfer_t *state = (file_transfer_t*)user_data;
menu_handle_t *menu = menu_state_get_ptr()->driver_data;
struct menu_state *menu_st = menu_state_get_ptr();
menu_handle_t *menu = menu_st->driver_data;
if (!menu)
goto finish;
@ -4730,8 +4730,7 @@ static void cb_net_generic(retro_task_t *task,
menu->core_len = data->len;
finish:
refresh = true;
menu_entries_ctl(MENU_ENTRIES_CTL_UNSET_REFRESH, &refresh);
menu_st->flags &= ~MENU_ST_FLAG_ENTRIES_NONBLOCKING_REFRESH;
if (!err &&
!string_ends_with_size(state->path,
@ -4776,9 +4775,9 @@ static int generic_action_ok_network(const char *path,
file_transfer_t *transf = NULL;
const char *url_label = NULL;
retro_task_callback_t callback = NULL;
bool refresh = true;
bool suppress_msg = false;
settings_t *settings = config_get_ptr();
struct menu_state *menu_st = menu_state_get_ptr();
const char *network_buildbot_assets_url =
settings->paths.network_buildbot_assets_url;
@ -4847,7 +4846,7 @@ static int generic_action_ok_network(const char *path,
break;
}
menu_entries_ctl(MENU_ENTRIES_CTL_SET_REFRESH, &refresh);
menu_st->flags &= ~MENU_ST_FLAG_ENTRIES_NONBLOCKING_REFRESH;
generic_action_ok_command(CMD_EVENT_NETWORK_INIT);

View File

@ -12166,7 +12166,7 @@ static void ozone_toggle(void *userdata, bool menu_on)
}
settings = config_get_ptr();
if (menu_entries_ctl(MENU_ENTRIES_CTL_NEEDS_REFRESH, NULL))
if (MENU_ENTRIES_NEEDS_REFRESH(menu_st))
menu_st->flags &= ~MENU_ST_FLAG_PREVENT_POPULATE;
else
menu_st->flags |= MENU_ST_FLAG_PREVENT_POPULATE;

View File

@ -5030,8 +5030,7 @@ static void rgui_render(
{
msg_force = p_disp->flags & GFX_DISP_FLAG_MSG_FORCE;
if (menu_entries_ctl(MENU_ENTRIES_CTL_NEEDS_REFRESH, NULL)
&& !msg_force)
if (MENU_ENTRIES_NEEDS_REFRESH(menu_st) && !msg_force)
return;
if ( !display_kb &&

View File

@ -7794,7 +7794,7 @@ static void xmb_toggle(void *userdata, bool menu_on)
gfx_animation_push(&entry);
tmp = !menu_entries_ctl(MENU_ENTRIES_CTL_NEEDS_REFRESH, NULL);
tmp = !MENU_ENTRIES_NEEDS_REFRESH(menu_st);
if (tmp)
menu_st->flags |= MENU_ST_FLAG_PREVENT_POPULATE;

View File

@ -4367,8 +4367,6 @@ bool menu_entries_ctl(enum menu_entries_ctl_state state, void *data)
switch (state)
{
case MENU_ENTRIES_CTL_NEEDS_REFRESH:
return MENU_ENTRIES_NEEDS_REFRESH(menu_st);
case MENU_ENTRIES_CTL_SET_REFRESH:
{
bool *nonblocking = (bool*)data;
@ -4379,16 +4377,6 @@ bool menu_entries_ctl(enum menu_entries_ctl_state state, void *data)
menu_st->flags |= MENU_ST_FLAG_ENTRIES_NEED_REFRESH;
}
break;
case MENU_ENTRIES_CTL_UNSET_REFRESH:
{
bool *nonblocking = (bool*)data;
if (*nonblocking)
menu_st->flags &= ~MENU_ST_FLAG_ENTRIES_NONBLOCKING_REFRESH;
else
menu_st->flags &= ~MENU_ST_FLAG_ENTRIES_NEED_REFRESH;
}
break;
case MENU_ENTRIES_CTL_SET_START:
{
size_t *idx = (size_t*)data;
@ -7653,13 +7641,12 @@ int generic_menu_entry_action(
if (MENU_ENTRIES_NEEDS_REFRESH(menu_st))
{
bool refresh = false;
menu_driver_displaylist_push(
menu_st,
settings,
selection_buf,
menu_stack);
menu_entries_ctl(MENU_ENTRIES_CTL_UNSET_REFRESH, &refresh);
menu_st->flags &= ~MENU_ST_FLAG_ENTRIES_NEED_REFRESH;
}
#ifdef HAVE_ACCESSIBILITY

View File

@ -39,8 +39,6 @@ enum menu_entries_ctl_state
{
MENU_ENTRIES_CTL_NONE = 0,
MENU_ENTRIES_CTL_SET_REFRESH,
MENU_ENTRIES_CTL_UNSET_REFRESH,
MENU_ENTRIES_CTL_NEEDS_REFRESH,
/* Sets the starting index of the menu entry list. */
MENU_ENTRIES_CTL_SET_START,
/* Returns the starting index of the menu entry list. */

View File

@ -402,9 +402,13 @@ static void task_core_updater_get_list_handler(retro_task_t *task)
/* Enable menu refresh, if required */
#if defined(RARCH_INTERNAL) && defined(HAVE_MENU)
if (list_handle->refresh_menu)
menu_entries_ctl(
MENU_ENTRIES_CTL_UNSET_REFRESH,
&list_handle->refresh_menu);
{
struct menu_state *menu_st = menu_state_get_ptr();
if (list_handle->refresh_menu)
menu_st->flags &= ~MENU_ST_FLAG_ENTRIES_NONBLOCKING_REFRESH;
else
menu_st->flags &= ~MENU_ST_FLAG_ENTRIES_NEED_REFRESH;
}
#endif
}
/* fall-through */