From 06bc37a67d6de975ceac8bffb57d93dc359e851a Mon Sep 17 00:00:00 2001 From: zhupengfei Date: Fri, 3 Jul 2020 22:14:26 +0800 Subject: [PATCH] core/movie: Remove program ID checks Most other emulators handle this automatically in the frontend, booting/restarting the corresponding game instead of reporting an error. Therefore, remove these checks and errors from the module. --- src/core/movie.cpp | 18 +++++++----------- src/core/movie.h | 5 ++--- 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/src/core/movie.cpp b/src/core/movie.cpp index 35157508b..2be5dfd27 100644 --- a/src/core/movie.cpp +++ b/src/core/movie.cpp @@ -413,21 +413,13 @@ u64 Movie::GetOverrideInitTime() const { return init_time; } -Movie::ValidationResult Movie::ValidateHeader(const CTMHeader& header, u64 program_id) const { +Movie::ValidationResult Movie::ValidateHeader(const CTMHeader& header) const { if (header_magic_bytes != header.filetype) { LOG_ERROR(Movie, "Playback file does not have valid header"); return ValidationResult::Invalid; } std::string revision = fmt::format("{:02x}", fmt::join(header.revision, "")); - - if (!program_id) - Core::System::GetInstance().GetAppLoader().ReadProgramId(program_id); - if (program_id != header.program_id) { - LOG_WARNING(Movie, "This movie was recorded using a ROM with a different program id"); - return ValidationResult::GameDismatch; - } - if (revision != Common::g_scm_rev) { LOG_WARNING(Movie, "This movie was created on a different version of Citra, playback may desync"); @@ -576,7 +568,7 @@ void Movie::PrepareForRecording() { : Settings::values.init_time); } -Movie::ValidationResult Movie::ValidateMovie(const std::string& movie_file, u64 program_id) const { +Movie::ValidationResult Movie::ValidateMovie(const std::string& movie_file) const { LOG_INFO(Movie, "Validating Movie file '{}'", movie_file); FileUtil::IOFile save_record(movie_file, "rb"); @@ -593,11 +585,15 @@ Movie::ValidationResult Movie::ValidateMovie(const std::string& movie_file, u64 return ValidationResult::Invalid; } - auto result = ValidateHeader(header, program_id); + auto result = ValidateHeader(header); if (result != ValidationResult::OK) { return result; } + if (!header.input_count) { // Probably created by an older version. + return ValidationResult::OK; + } + std::vector input(size - sizeof(header)); save_record.ReadArray(input.data(), input.size()); return ValidateInput(input, header.input_count); diff --git a/src/core/movie.h b/src/core/movie.h index 7093290c2..09912c3f8 100644 --- a/src/core/movie.h +++ b/src/core/movie.h @@ -31,7 +31,6 @@ public: enum class ValidationResult { OK, RevisionDismatch, - GameDismatch, InputCountDismatch, Invalid, }; @@ -65,7 +64,7 @@ public: /// Prepare to override the clock before recording movies void PrepareForRecording(); - ValidationResult ValidateMovie(const std::string& movie_file, u64 program_id = 0) const; + ValidationResult ValidateMovie(const std::string& movie_file) const; /// Get the init time that would override the one in the settings u64 GetOverrideInitTime() const; @@ -148,7 +147,7 @@ private: void Record(const Service::IR::PadState& pad_state, const s16& c_stick_x, const s16& c_stick_y); void Record(const Service::IR::ExtraHIDResponse& extra_hid_response); - ValidationResult ValidateHeader(const CTMHeader& header, u64 program_id = 0) const; + ValidationResult ValidateHeader(const CTMHeader& header) const; ValidationResult ValidateInput(const std::vector& input, u64 expected_count) const; void SaveMovie();