Fix all warnings -Wall spews
[lsnes.git] / moviefile.hpp
blob217e3a7f1a42c883edfef35559d68fddbe0013a2
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 * \brief Parsed representation of movie file
15 * This structure gives parsed representationg of movie file, as result of decoding or for encoding.
17 struct moviefile
19 /**
20 * \brief Construct empty movie
22 * This constructor construct movie structure with default settings.
24 * \throws std::bad_alloc Not enough memory.
26 moviefile() throw(std::bad_alloc);
28 /**
29 * \brief Load a movie/savestate file
31 * This constructor loads a movie/savestate file and fills structure accordingly.
33 * \param filename The file to load.
34 * \throws std::bad_alloc Not enough memory.
35 * \throws std::runtime_error Can't load the movie file
37 moviefile(const std::string& filename) throw(std::bad_alloc, std::runtime_error);
39 /**
40 * \brief Save a movie or savestate.
42 * Reads this movie structure and saves it into file.
44 * \param filename The file to save to.
45 * \param compression The compression level 0-9. 0 is uncompressed.
46 * \throws std::bad_alloc Not enough memory.
47 * \throws std::runtime_error Can't save the movie file.
49 void save(const std::string& filename, unsigned compression) throw(std::bad_alloc, std::runtime_error);
51 /**
52 * \brief What is the ROM type and region?
54 gametype_t gametype;
55 /**
56 * \brief What's in port #1?
58 porttype_t port1;
59 /**
60 * \brief What's in port #2?
62 porttype_t port2;
63 /**
64 * \brief Emulator Core version string.
66 std::string coreversion;
67 /**
68 * \brief Name of the game
70 std::string gamename;
71 /**
72 * \brief Project ID (used to identify if two movies are from the same project).
74 std::string projectid;
75 /**
76 * \brief Rerecord count (only loaded).
78 std::string rerecords;
79 /**
80 * \brief SHA-256 of main ROM (empty string if none).
82 std::string rom_sha256; //SHA-256 of main ROM.
83 /**
84 * \brief SHA-256 of main ROM XML (empty string if none).
86 std::string romxml_sha256; //SHA-256 of main ROM XML.
87 /**
88 * \brief SHA-256 of slot A ROM (empty string if none).
90 std::string slota_sha256; //SHA-256 of SLOT A ROM.
91 /**
92 * \brief SHA-256 of slot A XML (empty string if none).
94 std::string slotaxml_sha256; //SHA-256 of SLOT A XML.
95 /**
96 * \brief SHA-256 of slot B ROM (empty string if none).
98 std::string slotb_sha256; //SHA-256 of SLOT B ROM.
99 /**
100 * \brief SHA-256 of slot B XML (empty string if none).
102 std::string slotbxml_sha256; //SHA-256 of SLOT B XML.
104 * \brief Authors of the run, first in each pair is full name, second is nickname.
106 std::vector<std::pair<std::string, std::string>> authors;
108 * \brief Contents of SRAM on time of initial powerup.
110 std::map<std::string, std::vector<char>> movie_sram;
112 * \brief True if savestate, false if movie.
114 bool is_savestate;
116 * \brief Contents of SRAM on time of savestate (if is_savestate is true).
118 std::map<std::string, std::vector<char>> sram;
120 * \brief Core savestate (if is_savestate is true).
122 std::vector<char> savestate; //Savestate to load (if is_savestate is true).
124 * \brief Host memory (if is_savestate is true).
126 std::vector<char> host_memory;
128 * \brief Screenshot (if is_savestate is true).
130 std::vector<char> screenshot;
132 * \brief State of movie code (if is_savestate is true).
134 std::vector<char> movie_state;
136 * \brief Input for each (sub)frame.
138 std::vector<controls_t> input; //Input for each frame.
141 * \brief Get number of frames in movie.
143 * \return Number of frames.
145 uint64_t get_frame_count() throw();
148 * \brief Get length of the movie
150 * \return Length of the movie in nanoseconds.
152 uint64_t get_movie_length() throw();
155 #endif