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.
This commit is contained in:
zhupengfei 2020-07-03 22:14:26 +08:00
parent bd88667247
commit 06bc37a67d
No known key found for this signature in database
GPG key ID: DD129E108BD09378
2 changed files with 9 additions and 14 deletions

View file

@ -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<u8> input(size - sizeof(header));
save_record.ReadArray(input.data(), input.size());
return ValidateInput(input, header.input_count);

View file

@ -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<u8>& input, u64 expected_count) const;
void SaveMovie();