mirror of
				https://github.com/PabloMK7/citra.git
				synced 2025-10-31 13:50:03 +00:00 
			
		
		
		
	core/movie: Add future event and timeline check
As specified in TASVideos [Laws of TAS](http://tasvideos.org/LawsOfTAS/OnSavestates.html)
This commit is contained in:
		
							parent
							
								
									b6f8cc884f
								
							
						
					
					
						commit
						e188f86582
					
				
					 1 changed files with 10 additions and 3 deletions
				
			
		|  | @ -2,6 +2,7 @@ | ||||||
| // Licensed under GPLv2 or any later version
 | // Licensed under GPLv2 or any later version
 | ||||||
| // Refer to the license.txt file included.
 | // Refer to the license.txt file included.
 | ||||||
| 
 | 
 | ||||||
|  | #include <algorithm> | ||||||
| #include <cstring> | #include <cstring> | ||||||
| #include <stdexcept> | #include <stdexcept> | ||||||
| #include <string> | #include <string> | ||||||
|  | @ -182,10 +183,16 @@ void Movie::serialize(Archive& ar, const unsigned int file_version) { | ||||||
|             if (play_mode == PlayMode::Recording) { |             if (play_mode == PlayMode::Recording) { | ||||||
|                 SaveMovie(); |                 SaveMovie(); | ||||||
|             } |             } | ||||||
|             if (current_byte >= recorded_input.size()) { |             if (recorded_input_.size() >= recorded_input.size()) { | ||||||
|                 throw std::runtime_error( |                 throw std::runtime_error("Future event savestate not allowed in R/O mode"); | ||||||
|                     "This savestate was created at a later point and must be loaded in R+W mode"); |  | ||||||
|             } |             } | ||||||
|  |             // Ensure that the current movie and savestate movie are in the same timeline
 | ||||||
|  |             if (std::mismatch(recorded_input_.begin(), recorded_input_.end(), | ||||||
|  |                               recorded_input.begin()) | ||||||
|  |                     .first != recorded_input_.end()) { | ||||||
|  |                 throw std::runtime_error("Timeline mismatch not allowed in R/O mode"); | ||||||
|  |             } | ||||||
|  | 
 | ||||||
|             play_mode = PlayMode::Playing; |             play_mode = PlayMode::Playing; | ||||||
|             total_input = GetInputCount(recorded_input); |             total_input = GetInputCount(recorded_input); | ||||||
|         } else { |         } else { | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue