Handle conflicting sysregions
[lsnes.git] / include / core / moviefile.hpp
blob14e7f856890f47afa78a3cb4b8b245027a07af60
1 #ifndef _moviefile__hpp__included__
2 #define _moviefile__hpp__included__
4 #include <string>
5 #include <vector>
6 #include <stdexcept>
7 #include <map>
8 #include "core/controllerframe.hpp"
9 #include "core/rom.hpp"
10 #include "core/subtitles.hpp"
13 /**
14 * This structure gives parsed representationg of movie file, as result of decoding or for encoding.
16 struct moviefile
18 /**
19 * This constructor construct movie structure with default settings.
21 * throws std::bad_alloc: Not enough memory.
23 moviefile() throw(std::bad_alloc);
25 /**
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);
35 /**
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);
45 /**
46 * Force loading as corrupt.
48 bool force_corrupt;
49 /**
50 * What is the ROM type and region?
52 core_sysregion* gametype;
53 /**
54 * Settings.
56 std::map<std::string, std::string> settings;
57 /**
58 * Emulator Core version string.
60 std::string coreversion;
61 /**
62 * Name of the game
64 std::string gamename;
65 /**
66 * Project ID (used to identify if two movies are from the same project).
68 std::string projectid;
69 /**
70 * Rerecord count (only saved).
72 std::string rerecords;
73 /**
74 * SHA-256 of ROM (empty string if none).
76 std::string romimg_sha256[27];
77 /**
78 * SHA-256 of ROM XML (empty string if none).
80 std::string romxml_sha256[27];
81 /**
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;
85 /**
86 * Contents of SRAM on time of initial powerup.
88 std::map<std::string, std::vector<char>> movie_sram;
89 /**
90 * True if savestate, false if movie.
92 bool is_savestate;
93 /**
94 * Contents of SRAM on time of savestate (if is_savestate is true).
96 std::map<std::string, std::vector<char>> sram;
97 /**
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).
116 uint64_t save_frame;
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;
126 * Poll flag.
128 unsigned poll_flag;
130 * Compressed rrdata.
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.
140 int64_t 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;
154 * Movie prefix.
156 std::string prefix;
158 * Start paused flag.
160 bool start_paused;
162 * Lazy project create flag.
164 bool lazy_project_create;
166 * Subtitles.
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);
185 #endif