citra_qt: Fix potential indeterminstism caused by starting record/playback

Previously the movie was started *after* core starts running, causing potential indeterminism.

Some desyncs are still not fixed; they may be caused by core timing. More investigation is required.
This commit is contained in:
zhupengfei 2020-08-27 22:27:29 +08:00
parent e60e20666e
commit f8eb9a541d
No known key found for this signature in database
GPG key ID: DD129E108BD09378
4 changed files with 57 additions and 39 deletions

View file

@ -491,6 +491,7 @@ void Movie::SaveMovie() {
CTMHeader header = {};
header.filetype = header_magic_bytes;
header.program_id = program_id;
header.clock_init_time = init_time;
header.id = id;
@ -500,8 +501,6 @@ void Movie::SaveMovie() {
header.rerecord_count = rerecord_count;
header.input_count = GetInputCount(recorded_input);
Core::System::GetInstance().GetAppLoader().ReadProgramId(header.program_id);
std::string rev_bytes;
CryptoPP::StringSource(Common::g_scm_rev, true,
new CryptoPP::HexDecoder(new CryptoPP::StringSink(rev_bytes)));
@ -562,6 +561,10 @@ void Movie::StartRecording(const std::string& movie_file, const std::string& aut
CryptoPP::AutoSeededRandomPool rng;
rng.GenerateBlock(reinterpret_cast<CryptoPP::byte*>(&id), sizeof(id));
// Get program ID
program_id = 0;
Core::System::GetInstance().GetAppLoader().ReadProgramId(program_id);
LOG_INFO(Movie, "Enabling Movie recording, ID: {:016X}", id);
}