movie: Add clock init time to CTM header

This adds a clock init time field to the CTM header. The clock settings would be overridden when playing a movie. And when recording a movie, if the clock is set to System Time, it would be set to fixed init time at the current moment as well. In this way this keeps consistency with the RNG even if the user does just no setting.
This commit is contained in:
zhupengfei 2018-09-26 20:38:57 +08:00
parent 20e42592ff
commit ae5c658997
No known key found for this signature in database
GPG key ID: 85B82A3E62174206
5 changed files with 96 additions and 20 deletions

View file

@ -44,7 +44,17 @@ public:
void StartPlayback(const std::string& movie_file,
std::function<void()> completion_callback = {});
void StartRecording(const std::string& movie_file);
/// Prepare to override the clock before playing back movies
void PrepareForPlayback(const std::string& movie_file);
/// Prepare to override the clock before recording movies
void PrepareForRecording();
ValidationResult ValidateMovie(const std::string& movie_file, u64 program_id = 0) const;
/// Get the init time that would override the one in the settings
u64 GetOverrideInitTime() const;
u64 GetMovieProgramID(const std::string& movie_file) const;
void Shutdown();
@ -119,6 +129,7 @@ private:
PlayMode play_mode;
std::string record_movie_file;
std::vector<u8> recorded_input;
u64 init_time;
std::function<void()> playback_completion_callback;
std::size_t current_byte = 0;
};