mirror of
https://github.com/libretro/RetroArch
synced 2025-03-22 07:21:15 +00:00
Create video_driver_ctl and get rid of video_driver_get_frame_count
This commit is contained in:
parent
1686eb8f7f
commit
533b799692
@ -369,11 +369,13 @@ static bool xdk_renderchain_render(void *data, const void *frame,
|
|||||||
{
|
{
|
||||||
unsigned i;
|
unsigned i;
|
||||||
unsigned width, height;
|
unsigned width, height;
|
||||||
|
uint64_t *frame_count = NULL;
|
||||||
d3d_video_t *d3d = (d3d_video_t*)data;
|
d3d_video_t *d3d = (d3d_video_t*)data;
|
||||||
LPDIRECT3DDEVICE d3dr = (LPDIRECT3DDEVICE)d3d->dev;
|
LPDIRECT3DDEVICE d3dr = (LPDIRECT3DDEVICE)d3d->dev;
|
||||||
settings_t *settings = config_get_ptr();
|
settings_t *settings = config_get_ptr();
|
||||||
xdk_renderchain_t *chain = (xdk_renderchain_t*)d3d->renderchain_data;
|
xdk_renderchain_t *chain = (xdk_renderchain_t*)d3d->renderchain_data;
|
||||||
uint64_t *frame_count = video_driver_get_frame_count();
|
|
||||||
|
video_driver_ctl(RARCH_DISPLAY_CTL_GET_FRAME_COUNT, &frame_count);
|
||||||
|
|
||||||
video_driver_get_size(&width, &height);
|
video_driver_get_size(&width, &height);
|
||||||
|
|
||||||
|
@ -235,14 +235,15 @@ bool gfx_ctx_has_windowed(void *data)
|
|||||||
bool gfx_ctx_check_window(void *data, bool *quit, bool *resize,
|
bool gfx_ctx_check_window(void *data, bool *quit, bool *resize,
|
||||||
unsigned *width, unsigned *height)
|
unsigned *width, unsigned *height)
|
||||||
{
|
{
|
||||||
|
uint64_t *frame_count;
|
||||||
const gfx_ctx_driver_t *ctx = gfx_ctx_get_ptr();
|
const gfx_ctx_driver_t *ctx = gfx_ctx_get_ptr();
|
||||||
uint64_t *frame_count = video_driver_get_frame_count();
|
|
||||||
|
video_driver_ctl(RARCH_DISPLAY_CTL_GET_FRAME_COUNT, &frame_count);
|
||||||
|
|
||||||
if (!data)
|
if (!data)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
ctx->check_window(data, quit, resize, width, height,
|
ctx->check_window(data, quit, resize, width, height, *frame_count);
|
||||||
(unsigned int)*frame_count);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -256,11 +256,6 @@ uintptr_t video_driver_get_current_framebuffer(void)
|
|||||||
|
|
||||||
static uint64_t video_frame_count;
|
static uint64_t video_frame_count;
|
||||||
|
|
||||||
uint64_t *video_driver_get_frame_count(void)
|
|
||||||
{
|
|
||||||
return &video_frame_count;
|
|
||||||
}
|
|
||||||
|
|
||||||
retro_proc_address_t video_driver_get_proc_address(const char *sym)
|
retro_proc_address_t video_driver_get_proc_address(const char *sym)
|
||||||
{
|
{
|
||||||
driver_t *driver = driver_get_ptr();
|
driver_t *driver = driver_get_ptr();
|
||||||
@ -1211,3 +1206,24 @@ void video_driver_set_pixel_format(enum retro_pixel_format fmt)
|
|||||||
{
|
{
|
||||||
video_state.pix_fmt = fmt;
|
video_state.pix_fmt = fmt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool video_driver_ctl(enum rarch_display_ctl_state state, void *data)
|
||||||
|
{
|
||||||
|
switch (state)
|
||||||
|
{
|
||||||
|
case RARCH_DISPLAY_CTL_GET_FRAME_COUNT:
|
||||||
|
{
|
||||||
|
uint64_t **ptr = (uint64_t**)data;
|
||||||
|
if (!ptr)
|
||||||
|
return false;
|
||||||
|
*ptr = &video_frame_count;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case RARCH_DISPLAY_CTL_NONE:
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
@ -218,6 +218,14 @@ enum rarch_display_type
|
|||||||
RARCH_DISPLAY_OSX
|
RARCH_DISPLAY_OSX
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum rarch_display_ctl_state
|
||||||
|
{
|
||||||
|
RARCH_DISPLAY_CTL_NONE = 0,
|
||||||
|
RARCH_DISPLAY_CTL_GET_FRAME_COUNT
|
||||||
|
};
|
||||||
|
|
||||||
|
bool video_driver_ctl(enum rarch_display_ctl_state state, void *data);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* video_driver_find_handle:
|
* video_driver_find_handle:
|
||||||
* @index : index of driver to get handle to.
|
* @index : index of driver to get handle to.
|
||||||
@ -381,8 +389,6 @@ void video_driver_cached_frame_get(const void **data, unsigned *width,
|
|||||||
|
|
||||||
bool video_driver_cached_frame_has_valid_fb(void);
|
bool video_driver_cached_frame_has_valid_fb(void);
|
||||||
|
|
||||||
uint64_t *video_driver_get_frame_count(void);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -102,7 +102,7 @@ static void video_frame(const void *data, unsigned width,
|
|||||||
pitch = output_pitch;
|
pitch = output_pitch;
|
||||||
}
|
}
|
||||||
|
|
||||||
frame_count = video_driver_get_frame_count();
|
video_driver_ctl(RARCH_DISPLAY_CTL_GET_FRAME_COUNT, &frame_count);
|
||||||
|
|
||||||
if (!video->frame(driver->video_data, data, width, height, *frame_count,
|
if (!video->frame(driver->video_data, data, width, height, *frame_count,
|
||||||
pitch, driver->current_msg))
|
pitch, driver->current_msg))
|
||||||
|
@ -584,9 +584,10 @@ static void mui_render_menu_list(mui_handle_t *mui,
|
|||||||
float *pure_white)
|
float *pure_white)
|
||||||
{
|
{
|
||||||
unsigned header_height;
|
unsigned header_height;
|
||||||
|
uint64_t *frame_count;
|
||||||
size_t i = 0;
|
size_t i = 0;
|
||||||
uint64_t *frame_count = video_driver_get_frame_count();
|
|
||||||
size_t end = menu_entries_get_end();
|
size_t end = menu_entries_get_end();
|
||||||
|
video_driver_ctl(RARCH_DISPLAY_CTL_GET_FRAME_COUNT, &frame_count);
|
||||||
|
|
||||||
if (!menu_display_ctl(MENU_DISPLAY_CTL_UPDATE_PENDING, NULL))
|
if (!menu_display_ctl(MENU_DISPLAY_CTL_UPDATE_PENDING, NULL))
|
||||||
return;
|
return;
|
||||||
@ -732,11 +733,11 @@ static void mui_frame(void)
|
|||||||
char title_buf[PATH_MAX_LENGTH];
|
char title_buf[PATH_MAX_LENGTH];
|
||||||
size_t selection;
|
size_t selection;
|
||||||
size_t title_margin;
|
size_t title_margin;
|
||||||
|
uint64_t *frame_count;
|
||||||
mui_handle_t *mui = NULL;
|
mui_handle_t *mui = NULL;
|
||||||
driver_t *driver = driver_get_ptr();
|
driver_t *driver = driver_get_ptr();
|
||||||
menu_handle_t *menu = menu_driver_get_ptr();
|
menu_handle_t *menu = menu_driver_get_ptr();
|
||||||
settings_t *settings = config_get_ptr();
|
settings_t *settings = config_get_ptr();
|
||||||
uint64_t *frame_count = video_driver_get_frame_count();
|
|
||||||
const uint32_t normal_color = 0x212121ff;
|
const uint32_t normal_color = 0x212121ff;
|
||||||
const uint32_t hover_color = 0x212121ff;
|
const uint32_t hover_color = 0x212121ff;
|
||||||
const uint32_t title_color = 0xffffffff;
|
const uint32_t title_color = 0xffffffff;
|
||||||
@ -745,6 +746,7 @@ static void mui_frame(void)
|
|||||||
bool background_rendered = false;
|
bool background_rendered = false;
|
||||||
bool libretro_running = menu_display_ctl(MENU_DISPLAY_CTL_LIBRETRO_RUNNING, NULL);
|
bool libretro_running = menu_display_ctl(MENU_DISPLAY_CTL_LIBRETRO_RUNNING, NULL);
|
||||||
|
|
||||||
|
video_driver_ctl(RARCH_DISPLAY_CTL_GET_FRAME_COUNT, &frame_count);
|
||||||
(void)passivetab_color;
|
(void)passivetab_color;
|
||||||
(void)activetab_color;
|
(void)activetab_color;
|
||||||
|
|
||||||
|
@ -418,6 +418,7 @@ static void rgui_render(void)
|
|||||||
size_t i, end, fb_pitch;
|
size_t i, end, fb_pitch;
|
||||||
unsigned fb_width, fb_height;
|
unsigned fb_width, fb_height;
|
||||||
int bottom;
|
int bottom;
|
||||||
|
uint64_t *frame_count;
|
||||||
char title[256], title_buf[256], title_msg[64];
|
char title[256], title_buf[256], title_msg[64];
|
||||||
char msg[PATH_MAX_LENGTH], timedate[PATH_MAX_LENGTH];
|
char msg[PATH_MAX_LENGTH], timedate[PATH_MAX_LENGTH];
|
||||||
uint16_t *fb_data = NULL;
|
uint16_t *fb_data = NULL;
|
||||||
@ -425,7 +426,8 @@ static void rgui_render(void)
|
|||||||
menu_handle_t *menu = menu_driver_get_ptr();
|
menu_handle_t *menu = menu_driver_get_ptr();
|
||||||
driver_t *driver = driver_get_ptr();
|
driver_t *driver = driver_get_ptr();
|
||||||
settings_t *settings = config_get_ptr();
|
settings_t *settings = config_get_ptr();
|
||||||
uint64_t *frame_count = video_driver_get_frame_count();
|
|
||||||
|
video_driver_ctl(RARCH_DISPLAY_CTL_GET_FRAME_COUNT, &frame_count);
|
||||||
|
|
||||||
msg[0] = '\0';
|
msg[0] = '\0';
|
||||||
title[0] = '\0';
|
title[0] = '\0';
|
||||||
|
@ -122,15 +122,17 @@ end:
|
|||||||
static void rmenu_render(void)
|
static void rmenu_render(void)
|
||||||
{
|
{
|
||||||
bool msg_force;
|
bool msg_force;
|
||||||
|
uint64_t *frame_count;
|
||||||
size_t begin, end, i, j, selection;
|
size_t begin, end, i, j, selection;
|
||||||
struct font_params font_parms = {0};
|
struct font_params font_parms = {0};
|
||||||
char title[256] = {0};
|
char title[256] = {0};
|
||||||
char title_buf[256] = {0};
|
char title_buf[256] = {0};
|
||||||
char title_msg[64] = {0};
|
char title_msg[64] = {0};
|
||||||
menu_handle_t *menu = menu_driver_get_ptr();
|
menu_handle_t *menu = menu_driver_get_ptr();
|
||||||
uint64_t *frame_count = video_driver_get_frame_count();
|
|
||||||
size_t entries_end = menu_entries_get_end();
|
size_t entries_end = menu_entries_get_end();
|
||||||
|
|
||||||
|
video_driver_ctl(RARCH_DISPLAY_CTL_GET_FRAME_COUNT, &frame_count);
|
||||||
|
|
||||||
if (!menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &selection))
|
if (!menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &selection))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -534,6 +534,7 @@ static void rmenu_xui_set_list_text(int index, const wchar_t* leftText,
|
|||||||
|
|
||||||
static void rmenu_xui_render(void)
|
static void rmenu_xui_render(void)
|
||||||
{
|
{
|
||||||
|
uint64_t *frame_count;
|
||||||
bool display_kb, msg_force;
|
bool display_kb, msg_force;
|
||||||
unsigned fb_width;
|
unsigned fb_width;
|
||||||
size_t end, i, selection;
|
size_t end, i, selection;
|
||||||
@ -542,7 +543,8 @@ static void rmenu_xui_render(void)
|
|||||||
const char *label = NULL;
|
const char *label = NULL;
|
||||||
unsigned menu_type = 0;
|
unsigned menu_type = 0;
|
||||||
menu_handle_t *menu = menu_driver_get_ptr();
|
menu_handle_t *menu = menu_driver_get_ptr();
|
||||||
uint64_t *frame_count = video_driver_get_frame_count();
|
|
||||||
|
video_driver_ctl(RARCH_DISPLAY_CTL_GET_FRAME_COUNT, &frame_count);
|
||||||
|
|
||||||
menu_display_ctl(MENU_DISPLAY_CTL_WIDTH, &fb_width);
|
menu_display_ctl(MENU_DISPLAY_CTL_WIDTH, &fb_width);
|
||||||
menu_display_ctl(MENU_DISPLAY_CTL_MSG_FORCE, &msg_force);
|
menu_display_ctl(MENU_DISPLAY_CTL_MSG_FORCE, &msg_force);
|
||||||
|
@ -1311,14 +1311,16 @@ static void xmb_draw_items(xmb_handle_t *xmb,
|
|||||||
size_t current, size_t cat_selection_ptr, float *color,
|
size_t current, size_t cat_selection_ptr, float *color,
|
||||||
unsigned width, unsigned height)
|
unsigned width, unsigned height)
|
||||||
{
|
{
|
||||||
|
uint64_t *frame_count;
|
||||||
unsigned i, ticker_limit;
|
unsigned i, ticker_limit;
|
||||||
math_matrix_4x4 mymat;
|
math_matrix_4x4 mymat;
|
||||||
xmb_node_t *core_node = NULL;
|
xmb_node_t *core_node = NULL;
|
||||||
size_t end = 0;
|
size_t end = 0;
|
||||||
uint64_t *frame_count = video_driver_get_frame_count();
|
|
||||||
menu_handle_t *menu = menu_driver_get_ptr();
|
menu_handle_t *menu = menu_driver_get_ptr();
|
||||||
settings_t *settings = config_get_ptr();
|
settings_t *settings = config_get_ptr();
|
||||||
|
|
||||||
|
video_driver_ctl(RARCH_DISPLAY_CTL_GET_FRAME_COUNT, &frame_count);
|
||||||
|
|
||||||
if (!list || !list->size || !menu)
|
if (!list || !list->size || !menu)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -464,6 +464,7 @@ static bool zarch_zui_button(zui_t *zui, int x1, int y1, const char *label)
|
|||||||
static bool zarch_zui_list_item(zui_t *zui, zui_tabbed_t *tab, int x1, int y1,
|
static bool zarch_zui_list_item(zui_t *zui, zui_tabbed_t *tab, int x1, int y1,
|
||||||
const char *label, unsigned item_id, const char *entry)
|
const char *label, unsigned item_id, const char *entry)
|
||||||
{
|
{
|
||||||
|
uint64_t *frame_count;
|
||||||
char title_buf[PATH_MAX_LENGTH];
|
char title_buf[PATH_MAX_LENGTH];
|
||||||
unsigned ticker_size;
|
unsigned ticker_size;
|
||||||
bool set_active_id = false;
|
bool set_active_id = false;
|
||||||
@ -472,7 +473,8 @@ static bool zarch_zui_list_item(zui_t *zui, zui_tabbed_t *tab, int x1, int y1,
|
|||||||
int y2 = y1 + 50;
|
int y2 = y1 + 50;
|
||||||
bool active = zarch_zui_check_button_up(zui, id, x1, y1, x2, y2);
|
bool active = zarch_zui_check_button_up(zui, id, x1, y1, x2, y2);
|
||||||
const float *bg = ZUI_BG_PANEL;
|
const float *bg = ZUI_BG_PANEL;
|
||||||
uint64_t *frame_count = video_driver_get_frame_count();
|
|
||||||
|
video_driver_ctl(RARCH_DISPLAY_CTL_GET_FRAME_COUNT, &frame_count);
|
||||||
|
|
||||||
if (tab->active_id != tab->prev_id)
|
if (tab->active_id != tab->prev_id)
|
||||||
{
|
{
|
||||||
|
@ -875,6 +875,7 @@ static void rarch_main_cmd_get_state(driver_t *driver,
|
|||||||
*/
|
*/
|
||||||
static INLINE int rarch_main_iterate_time_to_exit(event_cmd_state_t *cmd)
|
static INLINE int rarch_main_iterate_time_to_exit(event_cmd_state_t *cmd)
|
||||||
{
|
{
|
||||||
|
uint64_t *frame_count = NULL;
|
||||||
settings_t *settings = config_get_ptr();
|
settings_t *settings = config_get_ptr();
|
||||||
global_t *global = global_get_ptr();
|
global_t *global = global_get_ptr();
|
||||||
driver_t *driver = driver_get_ptr();
|
driver_t *driver = driver_get_ptr();
|
||||||
@ -883,8 +884,10 @@ static INLINE int rarch_main_iterate_time_to_exit(event_cmd_state_t *cmd)
|
|||||||
bool shutdown_pressed = (system && system->shutdown) || cmd->quit_key_pressed;
|
bool shutdown_pressed = (system && system->shutdown) || cmd->quit_key_pressed;
|
||||||
bool video_alive = video && video->alive(driver->video_data);
|
bool video_alive = video && video->alive(driver->video_data);
|
||||||
bool movie_end = (global->bsv.movie_end && global->bsv.eof_exit);
|
bool movie_end = (global->bsv.movie_end && global->bsv.eof_exit);
|
||||||
uint64_t *frame_count = video_driver_get_frame_count();
|
bool frame_count_end = false;
|
||||||
bool frame_count_end = main_max_frames && (*frame_count >= main_max_frames);
|
|
||||||
|
video_driver_ctl(RARCH_DISPLAY_CTL_GET_FRAME_COUNT, &frame_count);
|
||||||
|
frame_count_end = main_max_frames && (*frame_count >= main_max_frames);
|
||||||
|
|
||||||
if (shutdown_pressed || frame_count_end || movie_end || !video_alive || global->exec)
|
if (shutdown_pressed || frame_count_end || movie_end || !video_alive || global->exec)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user