1 #ifndef _moviefile__hpp__included__
2 #define _moviefile__hpp__included__
8 #include "core/controllerframe.hpp"
9 #include "core/rom.hpp"
10 #include "core/subtitles.hpp"
14 * This structure gives parsed representationg of movie file, as result of decoding or for encoding.
19 * This constructor construct movie structure with default settings.
21 * throws std::bad_alloc: Not enough memory.
23 moviefile() throw(std::bad_alloc
);
26 * This constructor loads a movie/savestate file and fills structure accordingly.
28 * parameter filename: The file to load.
29 * parameter romtype: Type of ROM.
30 * throws std::bad_alloc: Not enough memory.
31 * throws std::runtime_error: Can't load the movie file
33 moviefile(const std::string
& filename
, core_type
& romtype
) throw(std::bad_alloc
, std::runtime_error
);
36 * Reads this movie structure and saves it into file.
38 * parameter filename: The file to save to.
39 * parameter compression: The compression level 0-9. 0 is uncompressed.
40 * throws std::bad_alloc: Not enough memory.
41 * throws std::runtime_error: Can't save the movie file.
43 void save(const std::string
& filename
, unsigned compression
) throw(std::bad_alloc
, std::runtime_error
);
46 * Force loading as corrupt.
50 * What is the ROM type and region?
52 core_sysregion
* gametype
;
56 std::map
<std::string
, std::string
> settings
;
58 * Emulator Core version string.
60 std::string coreversion
;
66 * Project ID (used to identify if two movies are from the same project).
68 std::string projectid
;
70 * Rerecord count (only saved).
72 std::string rerecords
;
74 * SHA-256 of ROM (empty string if none).
76 std::string romimg_sha256
[27];
78 * SHA-256 of ROM XML (empty string if none).
80 std::string romxml_sha256
[27];
82 * Authors of the run, first in each pair is full name, second is nickname.
84 std::vector
<std::pair
<std::string
, std::string
>> authors
;
86 * Contents of SRAM on time of initial powerup.
88 std::map
<std::string
, std::vector
<char>> movie_sram
;
90 * True if savestate, false if movie.
94 * Contents of SRAM on time of savestate (if is_savestate is true).
96 std::map
<std::string
, std::vector
<char>> sram
;
98 * Core savestate (if is_savestate is true).
100 std::vector
<char> savestate
; //Savestate to load (if is_savestate is true).
102 * Anchoring core savestate (if not empty).
104 std::vector
<char> anchor_savestate
;
106 * Host memory (if is_savestate is true).
108 std::vector
<char> host_memory
;
110 * Screenshot (if is_savestate is true).
112 std::vector
<char> screenshot
;
114 * Current frame (if is_savestate is true).
118 * Number of lagged frames (if is_savestate is true).
120 uint64_t lagged_frames
;
122 * Poll counters (if is_savestate is true).
124 std::vector
<uint32_t> pollcounters
;
132 std::vector
<char> c_rrdata
;
134 * Input for each (sub)frame.
136 controller_frame_vector input
; //Input for each frame.
138 * Current RTC second.
142 * Current RTC subsecond.
144 int64_t rtc_subsecond
;
146 * Movie starting RTC second.
148 int64_t movie_rtc_second
;
150 * Movie starting RTC subsecond.
152 int64_t movie_rtc_subsecond
;
162 * Lazy project create flag.
164 bool lazy_project_create
;
168 std::map
<moviefile_subtiming
, std::string
> subtitles
;
170 * Get number of frames in movie.
172 * returns: Number of frames.
174 uint64_t get_frame_count() throw();
176 * Get length of the movie
178 * returns: Length of the movie in nanoseconds.
180 uint64_t get_movie_length() throw();
183 std::string
sanitize_prefix(const std::string
& in
) throw(std::bad_alloc
);