mirror of
https://github.com/libretro/RetroArch
synced 2025-01-31 06:32:48 +00:00
Merge branch 'master' of github.com:libretro/RetroArch
This commit is contained in:
commit
3d1679f027
20
driver.c
20
driver.c
@ -362,11 +362,6 @@ void init_drivers(int flags)
|
||||
|
||||
if (flags & DRIVER_VIDEO)
|
||||
{
|
||||
runloop_t *runloop = rarch_main_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
runloop->frames.video.count = 0;
|
||||
|
||||
init_video();
|
||||
|
||||
if (!driver->video_cache_context_ack
|
||||
@ -431,15 +426,14 @@ void uninit_drivers(int flags)
|
||||
#ifdef HAVE_MENU
|
||||
if (flags & DRIVER_MENU)
|
||||
{
|
||||
if (driver->menu_ctx && driver->menu_ctx->context_destroy)
|
||||
driver->menu_ctx->context_destroy();
|
||||
menu_driver_context_destroy();
|
||||
|
||||
if (!driver->menu_data_own)
|
||||
{
|
||||
menu_free_list(driver->menu);
|
||||
menu_free(driver->menu);
|
||||
driver->menu = NULL;
|
||||
}
|
||||
if (!driver->menu_data_own)
|
||||
{
|
||||
menu_free_list(driver->menu);
|
||||
menu_free(driver->menu);
|
||||
driver->menu = NULL;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -222,6 +222,22 @@ void *video_driver_get_ptr(const video_driver_t **drv)
|
||||
return driver->video_data;
|
||||
}
|
||||
|
||||
static const video_poke_interface_t *video_driver_get_poke_ptr(void)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
if (!driver)
|
||||
return NULL;
|
||||
return driver->video_poke;
|
||||
}
|
||||
|
||||
static const video_driver_t *video_driver_ctx_get_ptr(void)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
if (!driver)
|
||||
return NULL;
|
||||
return driver->video;
|
||||
}
|
||||
|
||||
/**
|
||||
* video_driver_get_current_framebuffer:
|
||||
*
|
||||
@ -233,50 +249,50 @@ void *video_driver_get_ptr(const video_driver_t **drv)
|
||||
uintptr_t video_driver_get_current_framebuffer(void)
|
||||
{
|
||||
#ifdef HAVE_FBO
|
||||
driver_t *driver = driver_get_ptr();
|
||||
if (driver && driver->video_poke && driver->video_poke->get_current_framebuffer)
|
||||
return driver->video_poke->get_current_framebuffer(driver->video_data);
|
||||
driver_t *driver = driver_get_ptr();
|
||||
const video_poke_interface_t *poke = video_driver_get_poke_ptr();
|
||||
|
||||
if (poke && poke->get_current_framebuffer)
|
||||
return poke->get_current_framebuffer(driver->video_data);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
retro_proc_address_t video_driver_get_proc_address(const char *sym)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
if (driver && driver->video_data && driver->video_poke && driver->video_poke->get_proc_address)
|
||||
return driver->video_poke->get_proc_address(driver->video_data, sym);
|
||||
driver_t *driver = driver_get_ptr();
|
||||
const video_poke_interface_t *poke = video_driver_get_poke_ptr();
|
||||
|
||||
if (poke && poke->get_proc_address)
|
||||
return poke->get_proc_address(driver->video_data, sym);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool video_driver_is_alive(void)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
/* Possible race issue, return true */
|
||||
if (driver->video && driver->video_data)
|
||||
return driver->video->alive(driver->video_data);
|
||||
return false;
|
||||
const video_driver_t *video = video_driver_ctx_get_ptr();
|
||||
|
||||
return video->alive(driver->video_data);
|
||||
}
|
||||
|
||||
bool video_driver_has_focus(void)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
if (driver->video && driver->video_data)
|
||||
return driver->video->focus(driver->video_data);
|
||||
return false;
|
||||
const video_driver_t *video = video_driver_ctx_get_ptr();
|
||||
|
||||
return video->focus(driver->video_data);
|
||||
}
|
||||
|
||||
bool video_driver_set_shader(enum rarch_shader_type type,
|
||||
const char *path)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
if (!driver)
|
||||
return false;
|
||||
if (!driver->video_data)
|
||||
return false;
|
||||
if (!driver->video->set_shader)
|
||||
return false;
|
||||
driver_t *driver = driver_get_ptr();
|
||||
const video_driver_t *video = video_driver_ctx_get_ptr();
|
||||
|
||||
return driver->video->set_shader(driver->video_data, type, path);
|
||||
if (video->set_shader)
|
||||
return video->set_shader(driver->video_data, type, path);
|
||||
return false;
|
||||
}
|
||||
|
||||
static void deinit_video_filter(void)
|
||||
@ -410,15 +426,17 @@ void uninit_video_input(void)
|
||||
void init_video(void)
|
||||
{
|
||||
unsigned max_dim, scale, width, height;
|
||||
video_viewport_t *custom_vp = NULL;
|
||||
const input_driver_t *tmp = NULL;
|
||||
video_viewport_t *custom_vp = NULL;
|
||||
const input_driver_t *tmp = NULL;
|
||||
const struct retro_game_geometry *geom = NULL;
|
||||
video_info_t video = {0};
|
||||
video_info_t video = {0};
|
||||
static uint16_t dummy_pixels[32] = {0};
|
||||
runloop_t *runloop = rarch_main_get_ptr();
|
||||
driver_t *driver = driver_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
runloop_t *runloop = rarch_main_get_ptr();
|
||||
driver_t *driver = driver_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
runloop->frames.video.count = 0;
|
||||
|
||||
init_video_filter(global->system.pix_fmt);
|
||||
rarch_main_command(RARCH_CMD_SHADER_DIR_INIT);
|
||||
@ -463,13 +481,10 @@ void init_video(void)
|
||||
unsigned base_width = roundf(geom->base_height *
|
||||
global->system.aspect_ratio);
|
||||
width = roundf(base_width * settings->video.scale);
|
||||
height = roundf(geom->base_height * settings->video.scale);
|
||||
}
|
||||
else
|
||||
{
|
||||
width = roundf(geom->base_width * settings->video.scale);
|
||||
height = roundf(geom->base_height * settings->video.scale);
|
||||
}
|
||||
height = roundf(geom->base_height * settings->video.scale);
|
||||
}
|
||||
|
||||
if (width && height)
|
||||
@ -547,9 +562,7 @@ void init_video(void)
|
||||
video_driver_set_rotation(
|
||||
(settings->video.rotation + global->system.rotation) % 4);
|
||||
|
||||
if (driver->video->suppress_screensaver)
|
||||
driver->video->suppress_screensaver(driver->video_data,
|
||||
settings->ui.suspend_screensaver_enable);
|
||||
video_driver_suppress_screensaver(settings->ui.suspend_screensaver_enable);
|
||||
|
||||
if (!driver->input)
|
||||
init_video_input(tmp);
|
||||
@ -569,59 +582,64 @@ void init_video(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
bool video_driver_suppress_screensaver(bool enable)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
const video_driver_t *video = video_driver_ctx_get_ptr();
|
||||
|
||||
return video->suppress_screensaver(driver->video_data, enable);
|
||||
}
|
||||
|
||||
bool video_driver_has_windowed(void)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
driver_t *driver = driver_get_ptr();
|
||||
const video_driver_t *video = video_driver_ctx_get_ptr();
|
||||
|
||||
if (!driver || !driver->video)
|
||||
return false;
|
||||
return driver->video->has_windowed(driver->video_data);
|
||||
return video->has_windowed(driver->video_data);
|
||||
}
|
||||
|
||||
void video_driver_set_nonblock_state(bool toggle)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
driver_t *driver = driver_get_ptr();
|
||||
const video_driver_t *video = video_driver_ctx_get_ptr();
|
||||
|
||||
if (driver && driver->video)
|
||||
driver->video->set_nonblock_state(driver->video_data, toggle);
|
||||
if (video->set_nonblock_state)
|
||||
video->set_nonblock_state(driver->video_data, toggle);
|
||||
}
|
||||
|
||||
bool video_driver_set_rotation(unsigned rotation)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
driver_t *driver = driver_get_ptr();
|
||||
const video_driver_t *video = video_driver_ctx_get_ptr();
|
||||
|
||||
if (driver && driver->video)
|
||||
if (video->set_rotation)
|
||||
{
|
||||
driver->video->set_rotation(driver->video_data, rotation);
|
||||
video->set_rotation(driver->video_data, rotation);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void video_driver_set_video_mode(unsigned width,
|
||||
unsigned height, bool fullscreen)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
driver_t *driver = driver_get_ptr();
|
||||
const video_poke_interface_t *poke = video_driver_get_poke_ptr();
|
||||
|
||||
if (driver
|
||||
&& driver->video_data
|
||||
&& driver->video_poke
|
||||
&& driver->video_poke->set_video_mode)
|
||||
driver->video_poke->set_video_mode(driver->video_data,
|
||||
if (poke && poke->set_video_mode)
|
||||
poke->set_video_mode(driver->video_data,
|
||||
width, height, fullscreen);
|
||||
}
|
||||
|
||||
bool video_driver_get_video_output_size(unsigned *width, unsigned *height)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
driver_t *driver = driver_get_ptr();
|
||||
const video_poke_interface_t *poke = video_driver_get_poke_ptr();
|
||||
|
||||
if (driver
|
||||
&& driver->video_data
|
||||
&& driver->video_poke
|
||||
&& driver->video_poke->get_video_output_size)
|
||||
if (poke && poke->get_video_output_size)
|
||||
{
|
||||
driver->video_poke->get_video_output_size(driver->video_data,
|
||||
width, height);
|
||||
poke->get_video_output_size(driver->video_data, width, height);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -629,51 +647,40 @@ bool video_driver_get_video_output_size(unsigned *width, unsigned *height)
|
||||
|
||||
void video_driver_set_aspect_ratio(unsigned aspectratio_index)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
driver_t *driver = driver_get_ptr();
|
||||
const video_poke_interface_t *poke = video_driver_get_poke_ptr();
|
||||
|
||||
if (driver
|
||||
&& driver->video_data
|
||||
&& driver->video_poke
|
||||
&& driver->video_poke->set_aspect_ratio)
|
||||
driver->video_poke->set_aspect_ratio(driver->video_data,
|
||||
aspectratio_index);
|
||||
if (poke && poke->set_aspect_ratio)
|
||||
poke->set_aspect_ratio(driver->video_data, aspectratio_index);
|
||||
}
|
||||
|
||||
void video_driver_show_mouse(bool state)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
driver_t *driver = driver_get_ptr();
|
||||
const video_poke_interface_t *poke = video_driver_get_poke_ptr();
|
||||
|
||||
if (driver
|
||||
&& driver->video_data
|
||||
&& driver->video_poke
|
||||
&& driver->video_poke->show_mouse)
|
||||
driver->video_poke->show_mouse(
|
||||
driver->video_data, state);
|
||||
if (poke && poke->show_mouse)
|
||||
poke->show_mouse(driver->video_data, state);
|
||||
}
|
||||
|
||||
void video_driver_set_osd_msg(const char *msg,
|
||||
const struct font_params *params, void *font)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
driver_t *driver = driver_get_ptr();
|
||||
const video_poke_interface_t *poke = video_driver_get_poke_ptr();
|
||||
|
||||
if (driver
|
||||
&& driver->video_data
|
||||
&& driver->video_poke
|
||||
&& driver->video_poke->set_osd_msg)
|
||||
driver->video_poke->set_osd_msg(driver->video_data,
|
||||
msg, params, font);
|
||||
if (poke && poke->set_osd_msg)
|
||||
poke->set_osd_msg(driver->video_data, msg, params, font);
|
||||
}
|
||||
|
||||
void video_driver_set_texture_enable(bool enable, bool fullscreen)
|
||||
{
|
||||
#ifdef HAVE_MENU
|
||||
driver_t *driver = driver_get_ptr();
|
||||
driver_t *driver = driver_get_ptr();
|
||||
const video_poke_interface_t *poke = video_driver_get_poke_ptr();
|
||||
|
||||
if (driver
|
||||
&& driver->video_data
|
||||
&& driver->video_poke
|
||||
&& driver->video_poke->set_texture_enable)
|
||||
driver->video_poke->set_texture_enable(driver->video_data,
|
||||
if (poke && poke->set_texture_enable)
|
||||
poke->set_texture_enable(driver->video_data,
|
||||
enable, fullscreen);
|
||||
#endif
|
||||
}
|
||||
@ -682,27 +689,23 @@ void video_driver_set_texture_frame(const void *frame, bool rgb32,
|
||||
unsigned width, unsigned height, float alpha)
|
||||
{
|
||||
#ifdef HAVE_MENU
|
||||
driver_t *driver = driver_get_ptr();
|
||||
driver_t *driver = driver_get_ptr();
|
||||
const video_poke_interface_t *poke = video_driver_get_poke_ptr();
|
||||
|
||||
if (driver
|
||||
&& driver->video_data
|
||||
&& driver->video_poke
|
||||
&& driver->video_poke->set_texture_frame)
|
||||
driver->video_poke->set_texture_frame(
|
||||
driver->video_data, frame, rgb32, width, height, alpha);
|
||||
if (poke && poke->set_texture_frame)
|
||||
poke->set_texture_frame(driver->video_data,
|
||||
frame, rgb32, width, height, alpha);
|
||||
#endif
|
||||
}
|
||||
|
||||
bool video_driver_viewport_info(struct video_viewport *vp)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
driver_t *driver = driver_get_ptr();
|
||||
const video_driver_t *video = video_driver_ctx_get_ptr();
|
||||
|
||||
if (driver
|
||||
&& driver->video_data
|
||||
&& driver->video
|
||||
&& driver->video->viewport_info)
|
||||
if (video->viewport_info)
|
||||
{
|
||||
driver->video->viewport_info(driver->video_data, vp);
|
||||
video->viewport_info(driver->video_data, vp);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -710,35 +713,32 @@ bool video_driver_viewport_info(struct video_viewport *vp)
|
||||
|
||||
bool video_driver_read_viewport(uint8_t *buffer)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
driver_t *driver = driver_get_ptr();
|
||||
const video_driver_t *video = video_driver_ctx_get_ptr();
|
||||
|
||||
if (driver
|
||||
&& driver->video
|
||||
&& driver->video->read_viewport)
|
||||
return driver->video->read_viewport(driver->video_data,
|
||||
if (video->read_viewport)
|
||||
return video->read_viewport(driver->video_data,
|
||||
buffer);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool video_driver_focus(void)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
driver_t *driver = driver_get_ptr();
|
||||
const video_driver_t *video = video_driver_ctx_get_ptr();
|
||||
|
||||
if (driver && driver->video)
|
||||
return driver->video->focus(driver->video_data);
|
||||
return false;
|
||||
return video->focus(driver->video_data);
|
||||
}
|
||||
|
||||
#ifdef HAVE_OVERLAY
|
||||
bool video_driver_overlay_interface(const video_overlay_interface_t **iface)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
driver_t *driver = driver_get_ptr();
|
||||
const video_driver_t *video = video_driver_ctx_get_ptr();
|
||||
|
||||
if (driver
|
||||
&& driver->video
|
||||
&& driver->video->overlay_interface)
|
||||
if (video->overlay_interface)
|
||||
{
|
||||
driver->video->overlay_interface(driver->video_data, iface);
|
||||
video->overlay_interface(driver->video_data, iface);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -748,68 +748,60 @@ bool video_driver_overlay_interface(const video_overlay_interface_t **iface)
|
||||
void * video_driver_read_frame_raw(unsigned *width,
|
||||
unsigned *height, size_t *pitch)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
driver_t *driver = driver_get_ptr();
|
||||
const video_driver_t *video = video_driver_ctx_get_ptr();
|
||||
|
||||
if (driver
|
||||
&& driver->video
|
||||
&& driver->video->read_frame_raw)
|
||||
return driver->video->read_frame_raw(driver->video_data, width,
|
||||
if (video->read_frame_raw)
|
||||
return video->read_frame_raw(driver->video_data, width,
|
||||
height, pitch);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void video_driver_set_filtering(unsigned index, bool smooth)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
driver_t *driver = driver_get_ptr();
|
||||
const video_poke_interface_t *poke = video_driver_get_poke_ptr();
|
||||
|
||||
if (driver
|
||||
&& driver->video && driver->video_poke
|
||||
&& driver->video_poke->set_filtering)
|
||||
driver->video_poke->set_filtering(driver->video_data,
|
||||
index, smooth);
|
||||
if (poke && poke->set_filtering)
|
||||
poke->set_filtering(driver->video_data, index, smooth);
|
||||
}
|
||||
|
||||
void video_driver_apply_state_changes(void)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
driver_t *driver = driver_get_ptr();
|
||||
const video_poke_interface_t *poke = video_driver_get_poke_ptr();
|
||||
|
||||
if (driver && driver->video && driver->video_poke
|
||||
&& driver->video_poke->apply_state_changes)
|
||||
driver->video_poke->apply_state_changes(driver->video_data);
|
||||
if (poke && poke->apply_state_changes)
|
||||
poke->apply_state_changes(driver->video_data);
|
||||
}
|
||||
|
||||
void video_driver_get_video_output_next(void)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
driver_t *driver = driver_get_ptr();
|
||||
const video_poke_interface_t *poke = video_driver_get_poke_ptr();
|
||||
|
||||
if (driver
|
||||
&& driver->video
|
||||
&& driver->video_data
|
||||
&& driver->video_poke
|
||||
&& driver->video_poke->get_video_output_next)
|
||||
driver->video_poke->get_video_output_next(driver->video_data);
|
||||
if (poke && poke->get_video_output_next)
|
||||
poke->get_video_output_next(driver->video_data);
|
||||
}
|
||||
|
||||
void video_driver_get_video_output_prev(void)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
driver_t *driver = driver_get_ptr();
|
||||
const video_poke_interface_t *poke = video_driver_get_poke_ptr();
|
||||
|
||||
if (driver
|
||||
&& driver->video
|
||||
&& driver->video_data
|
||||
&& driver->video_poke
|
||||
&& driver->video_poke->get_video_output_prev)
|
||||
driver->video_poke->get_video_output_prev(driver->video_data);
|
||||
if (poke && poke->get_video_output_prev)
|
||||
poke->get_video_output_prev(driver->video_data);
|
||||
}
|
||||
|
||||
bool video_driver_frame(const void *frame, unsigned width,
|
||||
unsigned height, unsigned pitch, const char *msg)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
runloop_t *runloop = rarch_main_get_ptr();
|
||||
if (driver && driver->video
|
||||
&& driver->video->frame(driver->video_data,
|
||||
frame, width, height, pitch, msg))
|
||||
driver_t *driver = driver_get_ptr();
|
||||
const video_driver_t *video = video_driver_ctx_get_ptr();
|
||||
runloop_t *runloop = rarch_main_get_ptr();
|
||||
|
||||
if (video->frame(driver->video_data, frame,
|
||||
width, height, pitch, msg))
|
||||
{
|
||||
runloop->frames.video.count++;
|
||||
return true;
|
||||
|
@ -331,6 +331,8 @@ void video_driver_get_video_output_prev(void);
|
||||
bool video_driver_frame(const void *frame, unsigned width,
|
||||
unsigned height, unsigned pitch, const char *msg);
|
||||
|
||||
bool video_driver_suppress_screensaver(bool enable);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -174,185 +174,200 @@ menu_handle_t *menu_driver_get_ptr(void)
|
||||
return driver->menu;
|
||||
}
|
||||
|
||||
void menu_driver_navigation_increment(void)
|
||||
static const menu_ctx_driver_t *menu_ctx_driver_get_ptr(void)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
if (!driver)
|
||||
return;
|
||||
if (!driver || !driver->menu_ctx)
|
||||
return NULL;
|
||||
return driver->menu_ctx;
|
||||
}
|
||||
|
||||
if (driver->menu_ctx && driver->menu_ctx->navigation_increment)
|
||||
driver->menu_ctx->navigation_increment();
|
||||
void menu_driver_list_delete(file_list_t *list, size_t i, size_t list_size)
|
||||
{
|
||||
const menu_ctx_driver_t *driver = menu_ctx_driver_get_ptr();
|
||||
|
||||
if (driver->list_delete)
|
||||
driver->list_delete(list, i, list_size);
|
||||
}
|
||||
|
||||
void menu_driver_list_clear(file_list_t *list)
|
||||
{
|
||||
const menu_ctx_driver_t *driver = menu_ctx_driver_get_ptr();
|
||||
|
||||
if (driver->list_clear)
|
||||
driver->list_clear(list);
|
||||
}
|
||||
|
||||
void menu_driver_context_destroy(void)
|
||||
{
|
||||
const menu_ctx_driver_t *driver = menu_ctx_driver_get_ptr();
|
||||
|
||||
if (driver->context_destroy)
|
||||
driver->context_destroy();
|
||||
}
|
||||
|
||||
void menu_driver_list_set_selection(file_list_t *list)
|
||||
{
|
||||
const menu_ctx_driver_t *driver = menu_ctx_driver_get_ptr();
|
||||
|
||||
if (driver->list_set_selection)
|
||||
driver->list_set_selection(list);
|
||||
}
|
||||
|
||||
void menu_driver_list_insert(file_list_t *list, const char *path,
|
||||
const char *label, size_t list_size)
|
||||
{
|
||||
const menu_ctx_driver_t *driver = menu_ctx_driver_get_ptr();
|
||||
|
||||
if (driver->list_insert)
|
||||
driver->list_insert(list, path, label, list_size);
|
||||
}
|
||||
|
||||
void menu_driver_list_cache(bool state, unsigned action)
|
||||
{
|
||||
const menu_ctx_driver_t *driver = menu_ctx_driver_get_ptr();
|
||||
|
||||
if (driver->list_cache)
|
||||
driver->list_cache(state, action);
|
||||
}
|
||||
|
||||
void menu_driver_navigation_increment(void)
|
||||
{
|
||||
const menu_ctx_driver_t *driver = menu_ctx_driver_get_ptr();
|
||||
|
||||
if (driver->navigation_increment)
|
||||
driver->navigation_increment();
|
||||
}
|
||||
|
||||
void menu_driver_navigation_decrement(void)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
if (!driver)
|
||||
return;
|
||||
const menu_ctx_driver_t *driver = menu_ctx_driver_get_ptr();
|
||||
|
||||
if (driver->menu_ctx && driver->menu_ctx->navigation_decrement)
|
||||
driver->menu_ctx->navigation_decrement();
|
||||
if (driver->navigation_decrement)
|
||||
driver->navigation_decrement();
|
||||
}
|
||||
|
||||
void menu_driver_navigation_clear(bool pending_push)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
if (!driver)
|
||||
return;
|
||||
const menu_ctx_driver_t *driver = menu_ctx_driver_get_ptr();
|
||||
|
||||
if (driver->menu_ctx && driver->menu_ctx->navigation_clear)
|
||||
driver->menu_ctx->navigation_clear(pending_push);
|
||||
if (driver->navigation_clear)
|
||||
driver->navigation_clear(pending_push);
|
||||
}
|
||||
|
||||
void menu_driver_navigation_set(bool scroll)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
if (!driver)
|
||||
return;
|
||||
const menu_ctx_driver_t *driver = menu_ctx_driver_get_ptr();
|
||||
|
||||
if (driver->menu_ctx && driver->menu_ctx->navigation_set)
|
||||
driver->menu_ctx->navigation_set(scroll);
|
||||
if (driver->navigation_set)
|
||||
driver->navigation_set(scroll);
|
||||
}
|
||||
|
||||
void menu_driver_navigation_set_last(void)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
if (!driver)
|
||||
return;
|
||||
const menu_ctx_driver_t *driver = menu_ctx_driver_get_ptr();
|
||||
|
||||
if (driver->menu_ctx && driver->menu_ctx->navigation_set_last)
|
||||
driver->menu_ctx->navigation_set_last();
|
||||
if (driver->navigation_set_last)
|
||||
driver->navigation_set_last();
|
||||
}
|
||||
|
||||
void menu_driver_set_texture(void)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
if (!driver)
|
||||
return;
|
||||
const menu_ctx_driver_t *driver = menu_ctx_driver_get_ptr();
|
||||
|
||||
if (driver->menu_ctx && driver->menu_ctx->set_texture)
|
||||
driver->menu_ctx->set_texture();
|
||||
if (driver->set_texture)
|
||||
driver->set_texture();
|
||||
}
|
||||
|
||||
void menu_driver_context_reset(void)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
if (!driver)
|
||||
return;
|
||||
const menu_ctx_driver_t *driver = menu_ctx_driver_get_ptr();
|
||||
|
||||
if (driver->menu_ctx && driver->menu_ctx->context_reset)
|
||||
driver->menu_ctx->context_reset();
|
||||
if (driver->context_reset)
|
||||
driver->context_reset();
|
||||
}
|
||||
|
||||
void menu_driver_frame(void)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
if (!driver)
|
||||
return;
|
||||
const menu_ctx_driver_t *driver = menu_ctx_driver_get_ptr();
|
||||
|
||||
if (driver->menu_ctx && driver->menu_ctx->frame)
|
||||
driver->menu_ctx->frame();
|
||||
if (driver->frame)
|
||||
driver->frame();
|
||||
}
|
||||
|
||||
void menu_driver_entry_iterate(unsigned action)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
if (!driver)
|
||||
return;
|
||||
const menu_ctx_driver_t *driver = menu_ctx_driver_get_ptr();
|
||||
|
||||
if (driver->menu_ctx && driver->menu_ctx->entry_iterate)
|
||||
driver->menu_ctx->entry_iterate(action);
|
||||
if (driver->entry_iterate)
|
||||
driver->entry_iterate(action);
|
||||
}
|
||||
|
||||
void menu_driver_free(menu_handle_t *menu)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
if (!driver)
|
||||
return;
|
||||
const menu_ctx_driver_t *driver = menu_ctx_driver_get_ptr();
|
||||
|
||||
if (driver->menu_ctx && driver->menu_ctx->free)
|
||||
driver->menu_ctx->free(menu);
|
||||
if (driver->free)
|
||||
driver->free(menu);
|
||||
}
|
||||
|
||||
void menu_driver_render_messagebox(const char *msg)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
if (!driver)
|
||||
return;
|
||||
if (!driver->video_data)
|
||||
return;
|
||||
if (!driver->menu_ctx)
|
||||
return;
|
||||
if (!driver->menu_ctx->render_messagebox)
|
||||
return;
|
||||
const menu_ctx_driver_t *driver = menu_ctx_driver_get_ptr();
|
||||
if (!msg)
|
||||
return;
|
||||
|
||||
if (msg[0] != '\0')
|
||||
driver->menu_ctx->render_messagebox(msg);
|
||||
if (driver->render_messagebox && msg[0] != '\0')
|
||||
driver->render_messagebox(msg);
|
||||
}
|
||||
|
||||
void menu_driver_render(void)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
if (!driver)
|
||||
return;
|
||||
if (!driver->video_data)
|
||||
return;
|
||||
const menu_ctx_driver_t *driver = menu_ctx_driver_get_ptr();
|
||||
|
||||
if (driver->menu_ctx && driver->menu_ctx->render)
|
||||
driver->menu_ctx->render();
|
||||
if (driver->render)
|
||||
driver->render();
|
||||
}
|
||||
|
||||
void menu_driver_toggle(bool latch)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
if (!driver)
|
||||
return;
|
||||
const menu_ctx_driver_t *driver = menu_ctx_driver_get_ptr();
|
||||
|
||||
if (driver->menu_ctx && driver->menu_ctx->toggle)
|
||||
driver->menu_ctx->toggle(latch);
|
||||
if (driver->toggle)
|
||||
driver->toggle(latch);
|
||||
}
|
||||
|
||||
void menu_driver_populate_entries(const char *path, const char *label,
|
||||
unsigned k)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
if (!driver)
|
||||
return;
|
||||
const menu_ctx_driver_t *driver = menu_ctx_driver_get_ptr();
|
||||
|
||||
if (driver->menu_ctx && driver->menu_ctx->populate_entries)
|
||||
driver->menu_ctx->populate_entries(path, label, k);
|
||||
if (driver->populate_entries)
|
||||
driver->populate_entries(path, label, k);
|
||||
}
|
||||
|
||||
bool menu_driver_load_background(void *data)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
if (!driver)
|
||||
return false;
|
||||
const menu_ctx_driver_t *driver = menu_ctx_driver_get_ptr();
|
||||
|
||||
if (driver->menu_ctx && driver->menu_ctx->load_background)
|
||||
return driver->menu_ctx->load_background(data);
|
||||
if (driver->load_background)
|
||||
return driver->load_background(data);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void menu_driver_navigation_descend_alphabet(size_t *ptr_out)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
if (!driver)
|
||||
return;
|
||||
const menu_ctx_driver_t *driver = menu_ctx_driver_get_ptr();
|
||||
|
||||
if (driver->menu_ctx && driver->menu_ctx->navigation_descend_alphabet)
|
||||
driver->menu_ctx->navigation_descend_alphabet(ptr_out);
|
||||
if (driver->navigation_descend_alphabet)
|
||||
driver->navigation_descend_alphabet(ptr_out);
|
||||
}
|
||||
|
||||
void menu_driver_navigation_ascend_alphabet(size_t *ptr_out)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
if (!driver)
|
||||
return;
|
||||
const menu_ctx_driver_t *driver = menu_ctx_driver_get_ptr();
|
||||
|
||||
if (driver->menu_ctx && driver->menu_ctx->navigation_ascend_alphabet)
|
||||
driver->menu_ctx->navigation_ascend_alphabet(ptr_out);
|
||||
if (driver->navigation_ascend_alphabet)
|
||||
driver->navigation_ascend_alphabet(ptr_out);
|
||||
}
|
||||
|
@ -336,6 +336,19 @@ void menu_driver_navigation_descend_alphabet(size_t *);
|
||||
|
||||
void menu_driver_navigation_ascend_alphabet(size_t *);
|
||||
|
||||
void menu_driver_list_cache(bool state, unsigned action);
|
||||
|
||||
void menu_driver_list_delete(file_list_t *list, size_t i, size_t list_size);
|
||||
|
||||
void menu_driver_list_insert(file_list_t *list, const char *path,
|
||||
const char *label, size_t list_size);
|
||||
|
||||
void menu_driver_list_clear(file_list_t *list);
|
||||
|
||||
void menu_driver_list_set_selection(file_list_t *list);
|
||||
|
||||
void menu_driver_context_destroy(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -91,9 +91,10 @@ int menu_entries_push_list(menu_handle_t *menu,
|
||||
if (menu && menu->list_settings)
|
||||
settings_list_free(menu->list_settings);
|
||||
|
||||
menu->list_settings = (rarch_setting_t *)setting_new(setting_flags);
|
||||
menu->list_settings = (rarch_setting_t *)setting_new(setting_flags);
|
||||
setting = (rarch_setting_t*)menu_setting_find(label);
|
||||
|
||||
if (!(setting = (rarch_setting_t*)menu_setting_find(label)))
|
||||
if (!setting)
|
||||
return -1;
|
||||
|
||||
menu_list_clear(list);
|
||||
@ -101,10 +102,11 @@ int menu_entries_push_list(menu_handle_t *menu,
|
||||
for (; setting->type != ST_END_GROUP; setting++)
|
||||
{
|
||||
if (
|
||||
setting->type == ST_GROUP ||
|
||||
setting->type == ST_SUB_GROUP ||
|
||||
setting->type == ST_END_SUB_GROUP ||
|
||||
(setting->flags & SD_FLAG_ADVANCED && !settings->menu.show_advanced_settings)
|
||||
setting->type == ST_GROUP
|
||||
|| setting->type == ST_SUB_GROUP
|
||||
|| setting->type == ST_END_SUB_GROUP
|
||||
|| (setting->flags & SD_FLAG_ADVANCED &&
|
||||
!settings->menu.show_advanced_settings)
|
||||
)
|
||||
continue;
|
||||
|
||||
@ -197,8 +199,8 @@ int menu_entries_push_horizontal_menu_list(menu_handle_t *menu,
|
||||
const char *path, const char *label,
|
||||
unsigned menu_type)
|
||||
{
|
||||
core_info_t *info = NULL;
|
||||
global_t *global = global_get_ptr();
|
||||
core_info_t *info = NULL;
|
||||
global_t *global = global_get_ptr();
|
||||
core_info_list_t *info_list = (core_info_list_t*)global->core_info;
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
@ -327,10 +329,10 @@ int menu_entries_parse_list(
|
||||
{
|
||||
size_t i, list_size;
|
||||
bool path_is_compressed, push_dir;
|
||||
int device = 0;
|
||||
int device = 0;
|
||||
struct string_list *str_list = NULL;
|
||||
settings_t *settings = config_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
(void)device;
|
||||
|
||||
@ -488,7 +490,7 @@ int menu_entries_deferred_push(file_list_t *list, file_list_t *menu_list)
|
||||
const char *path = NULL;
|
||||
const char *label = NULL;
|
||||
menu_file_list_cbs_t *cbs = NULL;
|
||||
driver_t *driver = driver_get_ptr();
|
||||
driver_t *driver = driver_get_ptr();
|
||||
|
||||
menu_list_get_last_stack(driver->menu->menu_list, &path, &label, &type);
|
||||
|
||||
|
@ -235,8 +235,7 @@ static int action_toggle_mainmenu(unsigned type, const char *label,
|
||||
switch (push_list)
|
||||
{
|
||||
case 1:
|
||||
if (driver->menu_ctx->list_cache)
|
||||
driver->menu_ctx->list_cache(true, action);
|
||||
menu_driver_list_cache(true, action);
|
||||
|
||||
if (cbs && cbs->action_content_list_switch)
|
||||
return cbs->action_content_list_switch(
|
||||
|
@ -149,8 +149,7 @@ static void menu_list_destroy(file_list_t *list)
|
||||
|
||||
for (i = 0; i < list->size; i++)
|
||||
{
|
||||
if (driver->menu_ctx->list_delete)
|
||||
driver->menu_ctx->list_delete(list, i, list->size);
|
||||
menu_driver_list_delete(list, i, list->size);
|
||||
menu_common_list_delete(list, i, list->size);
|
||||
}
|
||||
|
||||
@ -280,15 +279,13 @@ void menu_list_flush_stack_by_needle(menu_list_t *list,
|
||||
void menu_list_pop_stack(menu_list_t *list)
|
||||
{
|
||||
menu_handle_t *menu = menu_driver_get_ptr();
|
||||
driver_t *driver = driver_get_ptr();
|
||||
if (!menu || !list)
|
||||
return;
|
||||
|
||||
if (file_list_get_size(list->menu_stack) <= 1)
|
||||
return;
|
||||
|
||||
if (driver->menu_ctx->list_cache)
|
||||
driver->menu_ctx->list_cache(false, 0);
|
||||
menu_driver_list_cache(false, 0);
|
||||
|
||||
menu_list_pop(list->menu_stack, &menu->navigation.selection_ptr);
|
||||
menu->need_refresh = true;
|
||||
@ -325,8 +322,7 @@ void menu_list_pop(file_list_t *list, size_t *directory_ptr)
|
||||
{
|
||||
size_t list_size = list->size - 1;
|
||||
|
||||
if (driver->menu_ctx->list_delete)
|
||||
driver->menu_ctx->list_delete(list, list_size, list_size);
|
||||
menu_driver_list_delete(list, list_size, list_size);
|
||||
menu_common_list_delete(list, list_size, list_size);
|
||||
}
|
||||
|
||||
@ -336,9 +332,7 @@ end:
|
||||
if (!driver->menu_ctx)
|
||||
return;
|
||||
|
||||
if (driver->menu_ctx->list_set_selection)
|
||||
driver->menu_ctx->list_set_selection(list);
|
||||
|
||||
menu_driver_list_set_selection(list);
|
||||
menu_common_list_set_selection(list);
|
||||
}
|
||||
|
||||
@ -348,8 +342,7 @@ void menu_list_clear(file_list_t *list)
|
||||
if (!driver->menu_ctx)
|
||||
goto end;
|
||||
|
||||
if (driver->menu_ctx->list_clear)
|
||||
driver->menu_ctx->list_clear(list);
|
||||
menu_driver_list_clear(list);
|
||||
|
||||
end:
|
||||
menu_common_list_clear(list);
|
||||
@ -363,9 +356,7 @@ static void menu_list_insert(file_list_t *list,
|
||||
if (!driver->menu_ctx)
|
||||
return;
|
||||
|
||||
if (driver->menu_ctx->list_insert)
|
||||
driver->menu_ctx->list_insert(list, path, label, list->size - 1);
|
||||
|
||||
menu_driver_list_insert(list, path, label, list->size - 1);
|
||||
menu_common_list_insert(list, path, label, type, list->size - 1);
|
||||
}
|
||||
|
||||
@ -404,14 +395,12 @@ int menu_list_push_stack_refresh(menu_list_t *list, const char *path, const char
|
||||
unsigned type, size_t directory_ptr)
|
||||
{
|
||||
menu_handle_t *menu = menu_driver_get_ptr();
|
||||
driver_t *driver = driver_get_ptr();
|
||||
if (!menu)
|
||||
return -1;
|
||||
if (!list)
|
||||
return -1;
|
||||
|
||||
if (driver->menu_ctx->list_cache)
|
||||
driver->menu_ctx->list_cache(false, 0);
|
||||
menu_driver_list_cache(false, 0);
|
||||
|
||||
menu_list_push_stack(list, path, label, type, directory_ptr);
|
||||
menu_navigation_clear(&menu->navigation, true);
|
||||
|
Loading…
x
Reference in New Issue
Block a user