mirror of
https://github.com/libretro/RetroArch
synced 2025-02-28 12:40:23 +00:00
Create wrapper functions for video driver functions
This commit is contained in:
parent
de8d41a0f8
commit
71dcc021a7
@ -608,3 +608,50 @@ bool video_driver_set_rotation(unsigned rotation)
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void video_driver_set_video_mode(unsigned width,
|
||||
unsigned height, bool fullscreen)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
|
||||
if (!driver->video_data)
|
||||
return;
|
||||
if (!driver->video_poke)
|
||||
return;
|
||||
if (!driver->video_poke->set_video_mode)
|
||||
return;
|
||||
|
||||
driver->video_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();
|
||||
|
||||
if (!driver->video_data)
|
||||
return false;
|
||||
if (!driver->video_poke)
|
||||
return false;
|
||||
if (!driver->video_poke->get_video_output_size)
|
||||
return false;
|
||||
|
||||
driver->video_poke->get_video_output_size(driver->video_data,
|
||||
width, height);
|
||||
return true;
|
||||
}
|
||||
|
||||
void video_driver_set_aspect_ratio(unsigned aspectratio_index)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
|
||||
if (!driver->video_data)
|
||||
return;
|
||||
if (!driver->video_poke)
|
||||
return;
|
||||
if (!driver->video_poke->set_aspect_ratio)
|
||||
return;
|
||||
|
||||
driver->video_poke->set_aspect_ratio(driver->video_data,
|
||||
aspectratio_index);
|
||||
}
|
||||
|
@ -278,6 +278,14 @@ void video_driver_set_nonblock_state(bool toggle);
|
||||
|
||||
bool video_driver_set_rotation(unsigned rotation);
|
||||
|
||||
void video_driver_set_video_mode(unsigned width,
|
||||
unsigned height, bool fullscreen);
|
||||
|
||||
bool video_driver_get_video_output_size(
|
||||
unsigned *width, unsigned *height);
|
||||
|
||||
void video_driver_set_aspect_ratio(unsigned aspectratio_index);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -1100,6 +1100,7 @@ static int action_ok_help(const char *path,
|
||||
static int action_ok_video_resolution(const char *path,
|
||||
const char *label, unsigned type, size_t idx)
|
||||
{
|
||||
unsigned width = 0, height = 0;
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
(void)global;
|
||||
@ -1122,18 +1123,9 @@ static int action_ok_video_resolution(const char *path,
|
||||
#else
|
||||
driver_t *driver = driver_get_ptr();
|
||||
|
||||
if (driver->video_data && driver->video_poke &&
|
||||
driver->video_poke->get_video_output_size)
|
||||
{
|
||||
unsigned width = 0, height = 0;
|
||||
driver->video_poke->get_video_output_size(driver->video_data,
|
||||
&width, &height);
|
||||
|
||||
if (driver->video_data && driver->video_poke &&
|
||||
driver->video_poke->set_video_mode)
|
||||
driver->video_poke->set_video_mode(driver->video_data,
|
||||
width, height, true);
|
||||
}
|
||||
if (video_driver_get_video_output_size(&width, &height))
|
||||
video_driver_set_video_mode(width, height, true);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
@ -516,13 +516,8 @@ static void menu_action_setting_disp_set_label_menu_video_resolution(
|
||||
|
||||
strlcpy(path_buf, path, path_buf_size);
|
||||
|
||||
if (driver->video_data && driver->video_poke &&
|
||||
driver->video_poke->get_video_output_size)
|
||||
{
|
||||
driver->video_poke->get_video_output_size(driver->video_data,
|
||||
&width, &height);
|
||||
if (video_driver_get_video_output_size(&width, &height))
|
||||
snprintf(type_str, type_str_size, "%ux%u", width, height);
|
||||
}
|
||||
else
|
||||
strlcpy(type_str, "N/A", type_str_size);
|
||||
}
|
||||
|
16
retroarch.c
16
retroarch.c
@ -1958,14 +1958,13 @@ int rarch_main_init(int argc, char *argv[])
|
||||
rarch_main_command(RARCH_CMD_SAVEFILES_INIT);
|
||||
#if defined(GEKKO) && defined(HW_RVL)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
rarch_main_command(RARCH_CMD_VIDEO_SET_ASPECT_RATIO);
|
||||
if (driver->video_data && driver->video_poke
|
||||
&& driver->video_poke->set_aspect_ratio)
|
||||
driver->video_poke->set_aspect_ratio(driver->video_data,
|
||||
settings->video.aspect_ratio_idx);
|
||||
if (settings)
|
||||
{
|
||||
rarch_main_command(RARCH_CMD_VIDEO_SET_ASPECT_RATIO);
|
||||
video_driver_set_aspect_ratio(settings->video.aspect_ratio_idx);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -2620,10 +2619,7 @@ bool rarch_main_command(unsigned cmd)
|
||||
video_driver_set_nonblock_state(boolean);
|
||||
break;
|
||||
case RARCH_CMD_VIDEO_SET_ASPECT_RATIO:
|
||||
if (driver->video_data && driver->video_poke
|
||||
&& driver->video_poke->set_aspect_ratio)
|
||||
driver->video_poke->set_aspect_ratio(driver->video_data,
|
||||
settings->video.aspect_ratio_idx);
|
||||
video_driver_set_aspect_ratio(settings->video.aspect_ratio_idx);
|
||||
break;
|
||||
case RARCH_CMD_AUDIO_SET_NONBLOCKING_STATE:
|
||||
boolean = true; /* fall-through */
|
||||
|
Loading…
x
Reference in New Issue
Block a user