diff --git a/driver.c b/driver.c index ffcc05f874..323bad989d 100644 --- a/driver.c +++ b/driver.c @@ -255,9 +255,8 @@ static void driver_set_nonblock_state(void) * * Returns: true (1) if successful, otherwise false (0). **/ -bool driver_update_system_av_info(const void *data) +static bool driver_update_system_av_info(const struct retro_system_av_info *info) { - const struct retro_system_av_info *info = (const struct retro_system_av_info*)data; struct retro_system_av_info *av_info = video_viewport_get_system_av_info(); memcpy(av_info, info, sizeof(*av_info)); @@ -461,6 +460,14 @@ bool driver_ctl(enum driver_ctl_state state, void *data) case RARCH_DRIVER_CTL_SET_NONBLOCK_STATE: driver_set_nonblock_state(); break; + case RARCH_DRIVER_CTL_UPDATE_SYSTEM_AV_INFO: + { + const struct retro_system_av_info **info = (const struct retro_system_av_info**)data; + if (!info) + return false; + return driver_update_system_av_info(*info); + } + return true; case RARCH_DRIVER_CTL_NONE: default: break; diff --git a/driver.h b/driver.h index ac08689c8e..e81ef64904 100644 --- a/driver.h +++ b/driver.h @@ -190,7 +190,11 @@ enum driver_ctl_state * * If nonblock state is false, sets blocking state for both * audio and video drivers instead. */ - RARCH_DRIVER_CTL_SET_NONBLOCK_STATE + RARCH_DRIVER_CTL_SET_NONBLOCK_STATE, + /* Update the system Audio/Video information. + * Will reinitialize audio/video drivers. + * Used by RETRO_ENVIRONMENT_SET_SYSTEM_AV_INFO. */ + RARCH_DRIVER_CTL_UPDATE_SYSTEM_AV_INFO }; @@ -253,18 +257,6 @@ bool find_prev_driver(const char *label, char *s, size_t len); **/ bool find_next_driver(const char *label, char *s, size_t len); -/** - * driver_update_system_av_info: - * @info : pointer to new A/V info - * - * Update the system Audio/Video information. - * Will reinitialize audio/video drivers. - * Used by RETRO_ENVIRONMENT_SET_SYSTEM_AV_INFO. - * - * Returns: true (1) if successful, otherwise false (0). - **/ -bool driver_update_system_av_info(const void *data); - /** * find_driver_index: * @label : string of driver type to be found. diff --git a/dynamic.c b/dynamic.c index a35fcabe76..faba2c2de9 100644 --- a/dynamic.c +++ b/dynamic.c @@ -1096,8 +1096,8 @@ bool rarch_environment_cb(unsigned cmd, void *data) case RETRO_ENVIRONMENT_SET_SYSTEM_AV_INFO: { RARCH_LOG("Environ SET_SYSTEM_AV_INFO.\n"); - return driver_update_system_av_info( - (const struct retro_system_av_info*)data); + return driver_ctl(RARCH_DRIVER_CTL_UPDATE_SYSTEM_AV_INFO, + (void**)&data); } case RETRO_ENVIRONMENT_SET_SUBSYSTEM_INFO: