More cleanups
[lsnes.git] / moviefile.hpp
blob74fe1bb14857c78d96268feb513098da1d612308
1 #ifndef _moviefile__hpp__included__
2 #define _moviefile__hpp__included__
4 #include <string>
5 #include <vector>
6 #include <stdexcept>
7 #include <map>
8 #include "controllerdata.hpp"
9 #include "rom.hpp"
12 /**
13 * This structure gives parsed representationg of movie file, as result of decoding or for encoding.
15 struct moviefile
17 /**
18 * This constructor construct movie structure with default settings.
20 * throws std::bad_alloc: Not enough memory.
22 moviefile() throw(std::bad_alloc);
24 /**
25 * This constructor loads a movie/savestate file and fills structure accordingly.
27 * parameter filename: The file to load.
28 * throws std::bad_alloc: Not enough memory.
29 * throws std::runtime_error: Can't load the movie file
31 moviefile(const std::string& filename) throw(std::bad_alloc, std::runtime_error);
33 /**
34 * Reads this movie structure and saves it into file.
36 * parameter filename: The file to save to.
37 * parameter compression: The compression level 0-9. 0 is uncompressed.
38 * throws std::bad_alloc: Not enough memory.
39 * throws std::runtime_error: Can't save the movie file.
41 void save(const std::string& filename, unsigned compression) throw(std::bad_alloc, std::runtime_error);
43 /**
44 * What is the ROM type and region?
46 gametype_t gametype;
47 /**
48 * What's in port #1?
50 porttype_t port1;
51 /**
52 * What's in port #2?
54 porttype_t port2;
55 /**
56 * Emulator Core version string.
58 std::string coreversion;
59 /**
60 * Name of the game
62 std::string gamename;
63 /**
64 * Project ID (used to identify if two movies are from the same project).
66 std::string projectid;
67 /**
68 * Rerecord count (only saved).
70 std::string rerecords;
71 /**
72 * SHA-256 of main ROM (empty string if none).
74 std::string rom_sha256; //SHA-256 of main ROM.
75 /**
76 * SHA-256 of main ROM XML (empty string if none).
78 std::string romxml_sha256; //SHA-256 of main ROM XML.
79 /**
80 * SHA-256 of slot A ROM (empty string if none).
82 std::string slota_sha256; //SHA-256 of SLOT A ROM.
83 /**
84 * SHA-256 of slot A XML (empty string if none).
86 std::string slotaxml_sha256; //SHA-256 of SLOT A XML.
87 /**
88 * SHA-256 of slot B ROM (empty string if none).
90 std::string slotb_sha256; //SHA-256 of SLOT B ROM.
91 /**
92 * SHA-256 of slot B XML (empty string if none).
94 std::string slotbxml_sha256; //SHA-256 of SLOT B XML.
95 /**
96 * Authors of the run, first in each pair is full name, second is nickname.
98 std::vector<std::pair<std::string, std::string>> authors;
99 /**
100 * Contents of SRAM on time of initial powerup.
102 std::map<std::string, std::vector<char>> movie_sram;
104 * True if savestate, false if movie.
106 bool is_savestate;
108 * Contents of SRAM on time of savestate (if is_savestate is true).
110 std::map<std::string, std::vector<char>> sram;
112 * Core savestate (if is_savestate is true).
114 std::vector<char> savestate; //Savestate to load (if is_savestate is true).
116 * Host memory (if is_savestate is true).
118 std::vector<char> host_memory;
120 * Screenshot (if is_savestate is true).
122 std::vector<char> screenshot;
124 * State of movie code (if is_savestate is true).
126 std::vector<char> movie_state;
128 * Input for each (sub)frame.
130 std::vector<controls_t> input; //Input for each frame.
133 * Get number of frames in movie.
135 * returns: Number of frames.
137 uint64_t get_frame_count() throw();
140 * Get length of the movie
142 * returns: Length of the movie in nanoseconds.
144 uint64_t get_movie_length() throw();
147 #endif