mirror of
https://github.com/libretro/RetroArch
synced 2025-03-29 22:20:21 +00:00
Create menu context wrapper functions
This commit is contained in:
parent
a635c8c80d
commit
0fd8fb77e9
15
menu/menu.c
15
menu/menu.c
@ -68,16 +68,6 @@ static void draw_frame(void)
|
||||
rarch_render_cached_frame();
|
||||
}
|
||||
|
||||
void menu_context_reset(void)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
if (!driver)
|
||||
return;
|
||||
|
||||
if (driver->menu_ctx && driver->menu_ctx->context_reset)
|
||||
driver->menu_ctx->context_reset();
|
||||
}
|
||||
|
||||
/**
|
||||
* menu_update_libretro_info:
|
||||
* @info : Pointer to system info
|
||||
@ -93,7 +83,7 @@ static void menu_update_libretro_info(struct retro_system_info *info)
|
||||
rarch_main_command(RARCH_CMD_CORE_INFO_INIT);
|
||||
rarch_main_command(RARCH_CMD_LOAD_CORE_PERSIST);
|
||||
|
||||
menu_context_reset();
|
||||
menu_driver_context_reset();
|
||||
}
|
||||
|
||||
static void menu_environment_get(int *argc, char *argv[],
|
||||
@ -442,8 +432,7 @@ int menu_iterate(retro_input_t input,
|
||||
if (runloop->is_menu && !runloop->is_idle)
|
||||
draw_frame();
|
||||
|
||||
if (driver->menu_ctx && driver->menu_ctx->set_texture)
|
||||
driver->menu_ctx->set_texture();
|
||||
menu_driver_set_texture();
|
||||
|
||||
if (ret)
|
||||
return -1;
|
||||
|
@ -193,8 +193,6 @@ void menu_free(void *data);
|
||||
**/
|
||||
bool menu_load_content(void);
|
||||
|
||||
void menu_context_reset(void);
|
||||
|
||||
void menu_update_system_info(menu_handle_t *menu, bool *load_no_content);
|
||||
|
||||
void menu_apply_deferred_settings(void);
|
||||
|
@ -165,7 +165,7 @@ void init_menu(void)
|
||||
rarch_fail(1, "init_menu()");
|
||||
}
|
||||
|
||||
menu_context_reset();
|
||||
menu_driver_context_reset();
|
||||
}
|
||||
|
||||
menu_handle_t *menu_driver_get_ptr(void)
|
||||
@ -175,3 +175,73 @@ menu_handle_t *menu_driver_get_ptr(void)
|
||||
return NULL;
|
||||
return driver->menu;
|
||||
}
|
||||
|
||||
void menu_driver_navigation_increment(void)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
if (!driver)
|
||||
return;
|
||||
|
||||
if (driver->menu_ctx && driver->menu_ctx->navigation_increment)
|
||||
driver->menu_ctx->navigation_increment();
|
||||
}
|
||||
|
||||
void menu_driver_navigation_decrement(void)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
if (!driver)
|
||||
return;
|
||||
|
||||
if (driver->menu_ctx && driver->menu_ctx->navigation_decrement)
|
||||
driver->menu_ctx->navigation_decrement();
|
||||
}
|
||||
|
||||
void menu_driver_navigation_clear(bool pending_push)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
if (!driver)
|
||||
return;
|
||||
|
||||
if (driver->menu_ctx && driver->menu_ctx->navigation_clear)
|
||||
driver->menu_ctx->navigation_clear(pending_push);
|
||||
}
|
||||
|
||||
void menu_driver_navigation_set(bool scroll)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
if (!driver)
|
||||
return;
|
||||
|
||||
if (driver->menu_ctx && driver->menu_ctx->navigation_set)
|
||||
driver->menu_ctx->navigation_set(scroll);
|
||||
}
|
||||
|
||||
void menu_driver_navigation_set_last(void)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
if (!driver)
|
||||
return;
|
||||
|
||||
if (driver->menu_ctx && driver->menu_ctx->navigation_set_last)
|
||||
driver->menu_ctx->navigation_set_last();
|
||||
}
|
||||
|
||||
void menu_driver_set_texture(void)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
if (!driver)
|
||||
return;
|
||||
|
||||
if (driver->menu_ctx && driver->menu_ctx->set_texture)
|
||||
driver->menu_ctx->set_texture();
|
||||
}
|
||||
|
||||
void menu_driver_context_reset(void)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
if (!driver)
|
||||
return;
|
||||
|
||||
if (driver->menu_ctx && driver->menu_ctx->context_reset)
|
||||
driver->menu_ctx->context_reset();
|
||||
}
|
||||
|
@ -288,6 +288,20 @@ void init_menu(void);
|
||||
|
||||
menu_handle_t *menu_driver_get_ptr(void);
|
||||
|
||||
void menu_driver_navigation_increment(void);
|
||||
|
||||
void menu_driver_navigation_decrement(void);
|
||||
|
||||
void menu_driver_navigation_clear(bool pending_push);
|
||||
|
||||
void menu_driver_navigation_set(bool scroll);
|
||||
|
||||
void menu_driver_navigation_set_last(void);
|
||||
|
||||
void menu_driver_set_texture(void);
|
||||
|
||||
void menu_driver_context_reset(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -30,14 +30,12 @@
|
||||
**/
|
||||
void menu_navigation_clear(menu_navigation_t *nav, bool pending_push)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
if (!nav)
|
||||
return;
|
||||
|
||||
nav->selection_ptr = 0;
|
||||
|
||||
if (driver->menu_ctx && driver->menu_ctx->navigation_clear)
|
||||
driver->menu_ctx->navigation_clear(pending_push);
|
||||
menu_driver_navigation_clear(pending_push);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -65,8 +63,7 @@ void menu_navigation_decrement(menu_navigation_t *nav, unsigned scroll_speed)
|
||||
menu_navigation_set(nav, 0, true);
|
||||
}
|
||||
|
||||
if (driver->menu_ctx && driver->menu_ctx->navigation_decrement)
|
||||
driver->menu_ctx->navigation_decrement();
|
||||
menu_driver_navigation_decrement();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -94,8 +91,7 @@ void menu_navigation_increment(menu_navigation_t *nav, unsigned scroll_speed)
|
||||
menu_list_get_size(driver->menu->menu_list) - 1, true);
|
||||
}
|
||||
|
||||
if (driver->menu_ctx && driver->menu_ctx->navigation_increment)
|
||||
driver->menu_ctx->navigation_increment();
|
||||
menu_driver_navigation_increment();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -108,14 +104,12 @@ void menu_navigation_increment(menu_navigation_t *nav, unsigned scroll_speed)
|
||||
void menu_navigation_set(menu_navigation_t *nav,
|
||||
size_t idx, bool scroll)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
if (!nav)
|
||||
return;
|
||||
|
||||
nav->selection_ptr = idx;
|
||||
|
||||
if (driver->menu_ctx && driver->menu_ctx->navigation_set)
|
||||
driver->menu_ctx->navigation_set(scroll);
|
||||
menu_driver_navigation_set(scroll);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -125,15 +119,13 @@ void menu_navigation_set(menu_navigation_t *nav,
|
||||
**/
|
||||
void menu_navigation_set_last(menu_navigation_t *nav)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
menu_handle_t *menu = menu_driver_get_ptr();
|
||||
if (!menu || !nav)
|
||||
return;
|
||||
|
||||
nav->selection_ptr = menu_list_get_size(menu->menu_list) - 1;
|
||||
|
||||
if (driver->menu_ctx && driver->menu_ctx->navigation_set_last)
|
||||
driver->menu_ctx->navigation_set_last();
|
||||
menu_driver_navigation_set_last();
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user