core/movie: Allow setting a playback completion callback

Instead of specifying it when starting playback. This is necessary as
you can end up playing the movie even if you started as Recording
(for example, loading a state in R/O mode will switch to Playing mode)
This commit is contained in:
zhupengfei 2020-07-07 16:38:24 +08:00
parent 06bc37a67d
commit 5a42a80f40
No known key found for this signature in database
GPG key ID: DD129E108BD09378
2 changed files with 8 additions and 6 deletions

View file

@ -486,8 +486,11 @@ void Movie::SaveMovie() {
}
}
void Movie::StartPlayback(const std::string& movie_file,
std::function<void()> completion_callback) {
void Movie::SetPlaybackCompletionCallback(std::function<void()> completion_callback) {
playback_completion_callback = completion_callback;
}
void Movie::StartPlayback(const std::string& movie_file) {
LOG_INFO(Movie, "Loading Movie for playback");
FileUtil::IOFile save_record(movie_file, "rb");
const u64 size = save_record.GetSize();
@ -510,7 +513,6 @@ void Movie::StartPlayback(const std::string& movie_file,
current_byte = 0;
id = header.id;
playback_completion_callback = completion_callback;
LOG_INFO(Movie, "Loaded Movie, ID: {:016X}", id);
}