Skip to content

Commit 61052e1

Browse files
committed
Tidy up
1 parent 7792f1b commit 61052e1

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

input/bsv/bsvmovie.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1734,6 +1734,8 @@ bool bsv_movie_seek_to_pos_impl(bsv_movie_t *movie, int64_t pos)
17341734
if (!movie || movie->version == 0)
17351735
return false;
17361736
movie_pos = intfstream_tell(movie->file);
1737+
if (pos == movie_pos)
1738+
return true;
17371739
/* assume file is at a frame boundary and frame is at a checkpoint boundary. */
17381740
if (pos < movie_pos)
17391741
/* TODO: this could be made more efficient with backrefs if we
@@ -1746,15 +1748,16 @@ bool bsv_movie_seek_to_pos_impl(bsv_movie_t *movie, int64_t pos)
17461748
bsv_movie_reset_playback(movie);
17471749
if (pos != movie_pos)
17481750
bsv_movie_scan_to(movie, pos);
1749-
ret = bsv_movie_read_next_events(movie, REPLAY_CPBEHAVIOR_DESERIALIZE, false);
1750-
return ret;
1751+
return bsv_movie_read_next_events(movie, REPLAY_CPBEHAVIOR_DESERIALIZE, false);
17511752
}
17521753

17531754
bool movie_skip_to_next_checkpoint(input_driver_state_t *input_st)
17541755
{
1756+
runloop_state_t *runloop_st = runloop_state_get_ptr();
1757+
bool paused = !!(runloop_st->flags & RUNLOOP_FLAG_PAUSED);
17551758
/* For now, can't skip forward in a recording replay */
17561759
if (!input_st->bsv_movie_state_handle ||
1757-
!input_st->bsv_movie_state_handle->playback ||
1760+
(!input_st->bsv_movie_state_handle->playback && !paused) ||
17581761
input_st->bsv_movie_state_handle->version == 0)
17591762
return false;
17601763
#ifdef HAVE_CHEEVOS
@@ -1768,7 +1771,7 @@ bool bsv_movie_skip_to_next_checkpoint_impl(bsv_movie_t *movie)
17681771
{
17691772
uint8_t tok = REPLAY_TOKEN_INVALID;
17701773
uint64_t frame_len;
1771-
int64_t frame = (int64_t)movie->frame_counter, cp_pos, initial_pos;
1774+
int64_t cp_pos, initial_pos;
17721775
if (!movie || movie->version == 0)
17731776
return false;
17741777
initial_pos = intfstream_tell(movie->file);
@@ -1778,6 +1781,8 @@ bool bsv_movie_skip_to_next_checkpoint_impl(bsv_movie_t *movie)
17781781
tok != REPLAY_TOKEN_CHECKPOINT_FRAME &&
17791782
tok != REPLAY_TOKEN_CHECKPOINT2_FRAME))
17801783
intfstream_seek(movie->file, frame_len, SEEK_CUR);
1784+
if (tok == REPLAY_TOKEN_INVALID)
1785+
return false;
17811786
cp_pos = intfstream_tell(movie->file);
17821787
intfstream_seek(movie->file, initial_pos, SEEK_SET);
17831788
return bsv_movie_seek_to_pos_impl(movie, cp_pos);

0 commit comments

Comments
 (0)