Revert "Refactor BSV movie code"

This reverts commit 7dca09d6f87beb1d06f2ad99f117b2ee2a3f00b9.
This commit is contained in:
twinaphex 2017-05-07 18:28:07 +02:00
parent a43289684d
commit a2fe3dcaaf
5 changed files with 20 additions and 39 deletions

View File

@ -1208,7 +1208,7 @@ static void command_event_deinit_core(bool reinit)
command_event(CMD_EVENT_RESTORE_DEFAULT_SHADER_PRESET, NULL);
}
static bool command_event_init_cheats(void)
static void command_event_init_cheats(void)
{
bool allow_cheats = true;
#ifdef HAVE_NETWORKING
@ -1218,11 +1218,9 @@ static bool command_event_init_cheats(void)
allow_cheats &= !bsv_movie_ctl(BSV_MOVIE_CTL_IS_INITED, NULL);
if (!allow_cheats)
return false;
return;
/* TODO/FIXME - add some stuff here. */
return true;
}
static void command_event_load_auto_state(void)
@ -2018,7 +2016,8 @@ bool command_event(enum event_command cmd, void *data)
break;
case CMD_EVENT_CHEATS_INIT:
command_event(CMD_EVENT_CHEATS_DEINIT, NULL);
return command_event_init_cheats();
command_event_init_cheats();
break;
case CMD_EVENT_CHEATS_APPLY:
cheat_manager_apply_cheats();
break;
@ -2431,10 +2430,7 @@ bool command_event(enum event_command cmd, void *data)
break;
case CMD_EVENT_BSV_MOVIE_INIT:
command_event(CMD_EVENT_BSV_MOVIE_DEINIT, NULL);
if (bsv_movie_init())
runloop_set(RUNLOOP_ACTION_BSV_MOVIE);
else
runloop_unset(RUNLOOP_ACTION_BSV_MOVIE);
bsv_movie_init();
break;
#ifdef HAVE_NETWORKING
case CMD_EVENT_NETPLAY_DEINIT:

19
movie.c
View File

@ -248,7 +248,6 @@ error:
/* Used for rewinding while playback/record. */
void bsv_movie_set_frame_start(void)
{
RARCH_LOG("movie state: %d\n", bsv_movie_state_handle);
if (bsv_movie_state_handle)
bsv_movie_state_handle->frame_pos[bsv_movie_state_handle->frame_ptr]
= filestream_tell(bsv_movie_state_handle->file);
@ -316,15 +315,6 @@ static void bsv_movie_frame_rewind(bsv_movie_t *handle)
}
}
static bool bsv_movie_init_handle(const char *path,
enum rarch_movie_type type)
{
bsv_movie_state_handle = bsv_movie_init_internal(path, type);
if (!bsv_movie_state_handle)
return false;
return true;
}
bool bsv_movie_init(void)
{
bool set_granularity = false;
@ -471,6 +461,15 @@ void bsv_movie_set_start_path(const char *path)
sizeof(bsv_movie_state.movie_start_path));
}
bool bsv_movie_init_handle(const char *path,
enum rarch_movie_type type)
{
bsv_movie_state_handle = bsv_movie_init_internal(path, type);
if (!bsv_movie_state_handle)
return false;
return true;
}
void bsv_movie_deinit(void)
{
if (!bsv_movie_state_handle)

View File

@ -80,6 +80,8 @@ bool bsv_movie_ctl(enum bsv_ctl_state state, void *data);
bool bsv_movie_check(void);
bool bsv_movie_init_handle(const char *path, enum rarch_movie_type type);
RETRO_END_DECLS
#endif

View File

@ -132,7 +132,6 @@ static bool runloop_perfcnt_enable = false;
static bool runloop_overrides_active = false;
static bool runloop_game_options_active = false;
static bool runloop_missing_bios = false;
static bool runloop_bsv_movie = false;
static bool runloop_autosave = false;
static retro_time_t frame_limit_minimum_time = 0.0;
static retro_time_t frame_limit_last_time = 0.0;
@ -394,7 +393,6 @@ bool runloop_ctl(enum runloop_ctl_state state, void *data)
runloop_paused = false;
runloop_slowmotion = false;
runloop_overrides_active = false;
runloop_bsv_movie = false;
runloop_autosave = false;
runloop_ctl(RUNLOOP_CTL_FRAME_TIME_FREE, NULL);
break;
@ -676,7 +674,7 @@ bool runloop_ctl(enum runloop_ctl_state state, void *data)
* d) Video driver no longer alive.
* e) End of BSV movie and BSV EOF exit is true. (TODO/FIXME - explain better)
*/
#define time_to_exit(quit_key_pressed) (runloop_shutdown_initiated || quit_key_pressed || !is_alive || (runloop_bsv_movie && bsv_movie_is_end_of_file()) || (runloop_max_frames && (frame_count >= runloop_max_frames)) || runloop_exec)
#define time_to_exit(quit_key_pressed) (runloop_shutdown_initiated || quit_key_pressed || !is_alive || bsv_movie_is_end_of_file() || (runloop_max_frames && (frame_count >= runloop_max_frames)) || runloop_exec)
#define runloop_check_cheevos() (settings->bools.cheevos_enable && cheevos_loaded && (!cheats_are_enabled && !cheats_were_enabled))
@ -1011,12 +1009,7 @@ static enum runloop_state runloop_check_state(
}
if (runloop_cmd_triggered(trigger_input, RARCH_MOVIE_RECORD_TOGGLE))
{
if (bsv_movie_check())
runloop_set(RUNLOOP_ACTION_BSV_MOVIE);
else
runloop_unset(RUNLOOP_ACTION_BSV_MOVIE);
}
bsv_movie_check();
if (runloop_cmd_triggered(trigger_input, RARCH_SHADER_NEXT) ||
runloop_cmd_triggered(trigger_input, RARCH_SHADER_PREV))
@ -1053,9 +1046,6 @@ void runloop_set(enum runloop_action action)
{
switch (action)
{
case RUNLOOP_ACTION_BSV_MOVIE:
runloop_bsv_movie = true;
break;
case RUNLOOP_ACTION_AUTOSAVE:
runloop_autosave = true;
break;
@ -1068,9 +1058,6 @@ void runloop_unset(enum runloop_action action)
{
switch (action)
{
case RUNLOOP_ACTION_BSV_MOVIE:
runloop_bsv_movie = false;
break;
case RUNLOOP_ACTION_AUTOSAVE:
runloop_autosave = false;
break;
@ -1175,8 +1162,7 @@ int runloop_iterate(unsigned *sleep_ms)
if (runloop_autosave)
autosave_lock();
if (runloop_bsv_movie)
bsv_movie_set_frame_start();
bsv_movie_set_frame_start();
camera_driver_ctl(RARCH_CAMERA_CTL_POLL, NULL);
@ -1217,8 +1203,7 @@ int runloop_iterate(unsigned *sleep_ms)
input_pop_analog_dpad(auto_binds);
}
if (runloop_bsv_movie)
bsv_movie_set_frame_end();
bsv_movie_set_frame_end();
if (runloop_autosave)
autosave_unlock();

View File

@ -31,7 +31,6 @@ RETRO_BEGIN_DECLS
enum runloop_action
{
RUNLOOP_ACTION_NONE = 0,
RUNLOOP_ACTION_BSV_MOVIE,
RUNLOOP_ACTION_AUTOSAVE
};