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;
|
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);
|
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
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1100,6 +1100,7 @@ static int action_ok_help(const char *path,
|
||||||
static int action_ok_video_resolution(const char *path,
|
static int action_ok_video_resolution(const char *path,
|
||||||
const char *label, unsigned type, size_t idx)
|
const char *label, unsigned type, size_t idx)
|
||||||
{
|
{
|
||||||
|
unsigned width = 0, height = 0;
|
||||||
global_t *global = global_get_ptr();
|
global_t *global = global_get_ptr();
|
||||||
|
|
||||||
(void)global;
|
(void)global;
|
||||||
|
@ -1122,18 +1123,9 @@ static int action_ok_video_resolution(const char *path,
|
||||||
#else
|
#else
|
||||||
driver_t *driver = driver_get_ptr();
|
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 &&
|
if (video_driver_get_video_output_size(&width, &height))
|
||||||
driver->video_poke->set_video_mode)
|
video_driver_set_video_mode(width, height, true);
|
||||||
driver->video_poke->set_video_mode(driver->video_data,
|
|
||||||
width, height, true);
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -516,13 +516,8 @@ static void menu_action_setting_disp_set_label_menu_video_resolution(
|
||||||
|
|
||||||
strlcpy(path_buf, path, path_buf_size);
|
strlcpy(path_buf, path, path_buf_size);
|
||||||
|
|
||||||
if (driver->video_data && driver->video_poke &&
|
if (video_driver_get_video_output_size(&width, &height))
|
||||||
driver->video_poke->get_video_output_size)
|
|
||||||
{
|
|
||||||
driver->video_poke->get_video_output_size(driver->video_data,
|
|
||||||
&width, &height);
|
|
||||||
snprintf(type_str, type_str_size, "%ux%u", width, height);
|
snprintf(type_str, type_str_size, "%ux%u", width, height);
|
||||||
}
|
|
||||||
else
|
else
|
||||||
strlcpy(type_str, "N/A", type_str_size);
|
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);
|
rarch_main_command(RARCH_CMD_SAVEFILES_INIT);
|
||||||
#if defined(GEKKO) && defined(HW_RVL)
|
#if defined(GEKKO) && defined(HW_RVL)
|
||||||
{
|
{
|
||||||
driver_t *driver = driver_get_ptr();
|
|
||||||
settings_t *settings = config_get_ptr();
|
settings_t *settings = config_get_ptr();
|
||||||
|
|
||||||
rarch_main_command(RARCH_CMD_VIDEO_SET_ASPECT_RATIO);
|
if (settings)
|
||||||
if (driver->video_data && driver->video_poke
|
{
|
||||||
&& driver->video_poke->set_aspect_ratio)
|
rarch_main_command(RARCH_CMD_VIDEO_SET_ASPECT_RATIO);
|
||||||
driver->video_poke->set_aspect_ratio(driver->video_data,
|
video_driver_set_aspect_ratio(settings->video.aspect_ratio_idx);
|
||||||
settings->video.aspect_ratio_idx);
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -2620,10 +2619,7 @@ bool rarch_main_command(unsigned cmd)
|
||||||
video_driver_set_nonblock_state(boolean);
|
video_driver_set_nonblock_state(boolean);
|
||||||
break;
|
break;
|
||||||
case RARCH_CMD_VIDEO_SET_ASPECT_RATIO:
|
case RARCH_CMD_VIDEO_SET_ASPECT_RATIO:
|
||||||
if (driver->video_data && driver->video_poke
|
video_driver_set_aspect_ratio(settings->video.aspect_ratio_idx);
|
||||||
&& driver->video_poke->set_aspect_ratio)
|
|
||||||
driver->video_poke->set_aspect_ratio(driver->video_data,
|
|
||||||
settings->video.aspect_ratio_idx);
|
|
||||||
break;
|
break;
|
||||||
case RARCH_CMD_AUDIO_SET_NONBLOCKING_STATE:
|
case RARCH_CMD_AUDIO_SET_NONBLOCKING_STATE:
|
||||||
boolean = true; /* fall-through */
|
boolean = true; /* fall-through */
|
||||||
|
|
Loading…
Reference in New Issue