11 #include "ISavestate.h" 15 #include <flatbuffers/flatbuffers.h> 22 struct SavestateBuilder;
31 void Reset()
override;
32 bool Serialize(
const uint8_t*& data,
size_t& size)
const override;
33 SAVE_TYPE
Type()
const override;
34 uint8_t
Slot()
const override;
35 std::string
Label()
const override;
36 std::string
Caption()
const override;
56 void SetType(SAVE_TYPE type)
override;
57 void SetSlot(uint8_t slot)
override;
58 void SetLabel(
const std::string& label)
override;
59 void SetCaption(
const std::string& caption)
override;
60 void SetCreated(
const CDateTime& createdUTC)
override;
61 void SetGameFileName(
const std::string& gameFileName)
override;
62 void SetTimestampFrames(uint64_t timestampFrames)
override;
63 void SetTimestampWallClock(
double timestampWallClock)
override;
64 void SetGameClientID(
const std::string& gameClient)
override;
65 void SetGameClientVersion(
const std::string& gameClient)
override;
66 void SetPixelFormat(AVPixelFormat pixelFormat)
override;
67 void SetNominalWidth(
unsigned int nominalWidth)
override;
68 void SetNominalHeight(
unsigned int nominalHeight)
override;
69 void SetMaxWidth(
unsigned int maxWidth)
override;
70 void SetMaxHeight(
unsigned int maxHeight)
override;
71 void SetPixelAspectRatio(
float pixelAspectRatio)
override;
72 uint8_t* GetVideoBuffer(
size_t size)
override;
73 void SetVideoWidth(
unsigned int videoWidth)
override;
74 void SetVideoHeight(
unsigned int videoHeight)
override;
75 void SetRotationDegCCW(
unsigned int rotationCCW)
override;
76 uint8_t* GetMemoryBuffer(
size_t size)
override;
77 void Finalize()
override;
78 bool Deserialize(std::vector<uint8_t> data)
override;
86 std::unique_ptr<flatbuffers::FlatBufferBuilder> m_builder;
93 std::vector<uint8_t> m_data;
98 const Savestate* m_savestate =
nullptr;
100 using StringOffset = flatbuffers::Offset<flatbuffers::String>;
101 using VectorOffset = flatbuffers::Offset<flatbuffers::Vector<uint8_t>>;
104 SAVE_TYPE m_type = SAVE_TYPE::UNKNOWN;
106 std::unique_ptr<StringOffset> m_labelOffset;
107 std::unique_ptr<StringOffset> m_captionOffset;
108 std::unique_ptr<StringOffset> m_createdOffset;
109 std::unique_ptr<StringOffset> m_gameFileNameOffset;
110 uint64_t m_timestampFrames = 0;
111 double m_timestampWallClock = 0.0;
112 std::unique_ptr<StringOffset> m_emulatorAddonIdOffset;
113 std::unique_ptr<StringOffset> m_emulatorVersionOffset;
114 AVPixelFormat m_pixelFormat{AV_PIX_FMT_NONE};
115 unsigned int m_nominalWidth{0};
116 unsigned int m_nominalHeight{0};
117 unsigned int m_maxWidth{0};
118 unsigned int m_maxHeight{0};
119 float m_pixelAspectRatio{0.0f};
120 std::unique_ptr<VectorOffset> m_videoDataOffset;
121 unsigned int m_videoWidth{0};
122 unsigned int m_videoHeight{0};
123 unsigned int m_rotationCCW{0};
124 std::unique_ptr<VectorOffset> m_memoryDataOffset;
uint8_t Slot() const override
The slot this savestate was saved into, or 0 for no slot.
Definition: SavestateFlatBuffer.cpp:232
Definition: SavestateFlatBuffer.h:24
unsigned int GetVideoWidth() const override
The width of the video frame, in pixels.
Definition: SavestateFlatBuffer.cpp:464
unsigned int GetRotationDegCCW() const override
The rotation of the video frame, in degrees counter-clockwise.
Definition: SavestateFlatBuffer.cpp:490
uint64_t TimestampFrames() const override
The number of frames in the entire gameplay history.
Definition: SavestateFlatBuffer.cpp:306
Definition: ISavestate.h:28
SAVE_TYPE Type() const override
The type of save action that created this savestate, either manual or automatic.
Definition: SavestateFlatBuffer.cpp:219
CDateTime Created() const override
The timestamp of this savestate's creation.
Definition: SavestateFlatBuffer.cpp:275
std::string GameClientID() const override
The game client add-on ID that created this savestate.
Definition: SavestateFlatBuffer.cpp:329
void Reset() override
Reset to the initial state.
Definition: SavestateFlatBuffer.cpp:195
std::string Caption() const override
A caption that describes the state of the game for this savestate.
Definition: SavestateFlatBuffer.cpp:260
unsigned int GetVideoHeight() const override
The height of the video frame, in pixels.
Definition: SavestateFlatBuffer.cpp:477
AVPixelFormat GetPixelFormat() const override
The pixel format of the video stream.
Definition: SavestateFlatBuffer.cpp:360
unsigned int GetMaxHeight() const override
The maximum height of the video stream, in pixels.
Definition: SavestateFlatBuffer.cpp:412
size_t GetVideoSize() const override
The size of the frame's video data, in bytes.
Definition: SavestateFlatBuffer.cpp:446
Definition: AudioDecoder.h:18
const uint8_t * GetVideoData() const override
A pointer to the frame's video data (pixels)
Definition: SavestateFlatBuffer.cpp:438
std::string GameFileName() const override
The name of the file belonging to this savestate's game.
Definition: SavestateFlatBuffer.cpp:291
unsigned int GetMaxWidth() const override
The maximum width of the video stream, in pixels.
Definition: SavestateFlatBuffer.cpp:399
DateTime class, which uses FileTime as it's base.
Definition: XBDateTime.h:63
double TimestampWallClock() const override
The duration of the entire gameplay history as seen by a wall clock.
Definition: SavestateFlatBuffer.cpp:316
bool Serialize(const uint8_t *&data, size_t &size) const override
Definition: SavestateFlatBuffer.cpp:202
bool Deserialize(std::vector< uint8_t > data) override
}
Definition: SavestateFlatBuffer.cpp:618
unsigned int GetNominalWidth() const override
The nominal width of the video stream, a good guess for subsequent frames.
Definition: SavestateFlatBuffer.cpp:373
const uint8_t * GetMemoryData() const override
A pointer to the internal memory (SRAM) of the frame.
Definition: SavestateFlatBuffer.cpp:503
std::string Label() const override
The label shown in the GUI for this savestate.
Definition: SavestateFlatBuffer.cpp:245
float GetPixelAspectRatio() const override
The pixel aspect ratio of the video stream.
Definition: SavestateFlatBuffer.cpp:425
size_t GetMemorySize() const override
The size of the memory region returned by GetMemoryData()
Definition: SavestateFlatBuffer.cpp:511
unsigned int GetNominalHeight() const override
The nominal height of the video stream, a good guess for subsequent frames.
Definition: SavestateFlatBuffer.cpp:386
std::string GameClientVersion() const override
The semantic version of the game client.
Definition: SavestateFlatBuffer.cpp:344