Only rcord_driver.c references driver->recording now

This commit is contained in:
twinaphex 2015-12-05 16:05:35 +01:00
parent bde80b1159
commit 7e5d1f3117
6 changed files with 39 additions and 11 deletions

View File

@ -307,14 +307,13 @@ void driver_set_nonblock_state(void)
bool driver_update_system_av_info(const struct retro_system_av_info *info)
{
struct retro_system_av_info *av_info = video_viewport_get_system_av_info();
driver_t *driver = driver_get_ptr();
memcpy(av_info, info, sizeof(*av_info));
event_command(EVENT_CMD_REINIT);
/* Cannot continue recording with different parameters.
* Take the easiest route out and just restart the recording. */
if (driver->recording_data)
if (recording_driver_get_data_ptr())
{
rarch_main_msg_queue_push_new(
MSG_RESTARTING_RECORDING_DUE_TO_DRIVER_REINIT, 2, 180, false);

View File

@ -662,10 +662,9 @@ static bool rarch_game_specific_options(char **output)
bool rarch_environment_cb(unsigned cmd, void *data)
{
unsigned p;
driver_t *driver = driver_get_ptr();
settings_t *settings = config_get_ptr();
global_t *global = global_get_ptr();
rarch_system_info_t *system = rarch_system_info_get_ptr();
settings_t *settings = config_get_ptr();
global_t *global = global_get_ptr();
rarch_system_info_t *system = rarch_system_info_get_ptr();
if (ignore_environment_cb)
return false;
@ -1049,7 +1048,7 @@ bool rarch_environment_cb(unsigned cmd, void *data)
(const struct retro_audio_callback*)data;
RARCH_LOG("Environ SET_AUDIO_CALLBACK.\n");
if (driver->recording_data) /* A/V sync is a must. */
if (recording_driver_get_data_ptr()) /* A/V sync is a must. */
return false;
#ifdef HAVE_NETPLAY

View File

@ -1136,13 +1136,13 @@ void video_driver_set_pixel_format(enum retro_pixel_format fmt)
static bool video_driver_cached_frame(void)
{
driver_t *driver = driver_get_ptr();
void *recording = driver ? driver->recording_data : NULL;
void *recording = recording_driver_get_data_ptr();
if (runloop_ctl(RUNLOOP_CTL_IS_IDLE, NULL))
return true; /* Maybe return false here for indication of idleness? */
/* Cannot allow recording when pushing duped frames. */
driver->recording_data = NULL;
recording_driver_clear_data_ptr();
/* Not 100% safe, since the library might have
* freed the memory, but no known implementations do this.
@ -1156,7 +1156,7 @@ static bool video_driver_cached_frame(void)
video_driver_state.frame_cache.height,
video_driver_state.frame_cache.pitch);
driver->recording_data = recording;
recording_driver_set_data_ptr(recording);
return true;
}

View File

@ -416,3 +416,27 @@ bool recording_init(void)
return true;
}
void *recording_driver_get_data_ptr(void)
{
driver_t *driver = driver_get_ptr();
if (!driver)
return NULL;
return driver->recording_data;
}
void recording_driver_clear_data_ptr(void)
{
driver_t *driver = driver_get_ptr();
if (!driver)
return;
driver->recording_data = NULL;
}
void recording_driver_set_data_ptr(void *data)
{
driver_t *driver = driver_get_ptr();
if (!driver)
return;
driver->recording_data = data;
}

View File

@ -166,6 +166,12 @@ void recording_set_state(bool state);
void recording_push_audio(const int16_t *data, size_t samples);
void *recording_driver_get_data_ptr(void);
void recording_driver_clear_data_ptr(void);
void recording_driver_set_data_ptr(void *data);
#ifdef __cplusplus
}
#endif

View File

@ -1079,7 +1079,7 @@ int rarch_main_iterate(unsigned *sleep_ms)
retro_time_t delta = current - frame_time_last;
bool is_locked_fps = (runloop_ctl(RUNLOOP_CTL_IS_PAUSED, NULL) ||
input_driver_ctl(RARCH_INPUT_CTL_IS_NONBLOCK_STATE, NULL)) |
!!driver->recording_data;
!!recording_driver_get_data_ptr();
runloop_ctl(RUNLOOP_CTL_IS_SLOWMOTION, &is_slowmotion);