kodi
ISavestate.h
1 /*
2  * Copyright (C) 2018 Team Kodi
3  * This file is part of Kodi - https://kodi.tv
4  *
5  * SPDX-License-Identifier: GPL-2.0-or-later
6  * See LICENSES/README.md for more information.
7  */
8 
9 #pragma once
10 
11 #include "SavestateTypes.h"
12 
13 #include <stdint.h>
14 #include <string>
15 #include <vector>
16 
17 extern "C"
18 {
19 #include <libavutil/pixfmt.h>
20 }
21 
22 class CDateTime;
23 
24 namespace KODI
25 {
26 namespace RETRO
27 {
29 {
30 public:
31  virtual ~ISavestate() = default;
32 
36  virtual void Reset() = 0;
37 
41  virtual bool Serialize(const uint8_t*& data, size_t& size) const = 0;
42 
45 
49  virtual SAVE_TYPE Type() const = 0;
50 
56  virtual uint8_t Slot() const = 0;
57 
61  virtual std::string Label() const = 0;
62 
66  virtual std::string Caption() const = 0;
67 
71  virtual CDateTime Created() const = 0;
73 
76 
79  virtual std::string GameFileName() const = 0;
81 
84 
87  virtual uint64_t TimestampFrames() const = 0;
88 
92  virtual double TimestampWallClock() const = 0;
94 
97 
100  virtual std::string GameClientID() const = 0;
101 
105  virtual std::string GameClientVersion() const = 0;
107 
110 
113  virtual AVPixelFormat GetPixelFormat() const = 0;
114 
118  virtual unsigned int GetNominalWidth() const = 0;
119 
123  virtual unsigned int GetNominalHeight() const = 0;
124 
128  virtual unsigned int GetMaxWidth() const = 0;
129 
133  virtual unsigned int GetMaxHeight() const = 0;
134 
138  virtual float GetPixelAspectRatio() const = 0;
140 
143 
146  virtual const uint8_t* GetVideoData() const = 0;
147 
151  virtual size_t GetVideoSize() const = 0;
152 
156  virtual unsigned int GetVideoWidth() const = 0;
157 
161  virtual unsigned int GetVideoHeight() const = 0;
162 
166  virtual unsigned int GetRotationDegCCW() const = 0;
168 
171 
174  virtual const uint8_t* GetMemoryData() const = 0;
175 
179  virtual size_t GetMemorySize() const = 0;
181 
184  virtual void SetType(SAVE_TYPE type) = 0;
185  virtual void SetSlot(uint8_t slot) = 0;
186  virtual void SetLabel(const std::string& label) = 0;
187  virtual void SetCaption(const std::string& caption) = 0;
188  virtual void SetCreated(const CDateTime& createdUTC) = 0;
189  virtual void SetGameFileName(const std::string& gameFileName) = 0;
190  virtual void SetTimestampFrames(uint64_t timestampFrames) = 0;
191  virtual void SetTimestampWallClock(double timestampWallClock) = 0;
192  virtual void SetGameClientID(const std::string& gameClient) = 0;
193  virtual void SetGameClientVersion(const std::string& gameClient) = 0;
194  virtual void SetPixelFormat(AVPixelFormat pixelFormat) = 0;
195  virtual void SetNominalWidth(unsigned int nominalWidth) = 0;
196  virtual void SetNominalHeight(unsigned int nominalHeight) = 0;
197  virtual void SetMaxWidth(unsigned int maxWidth) = 0;
198  virtual void SetMaxHeight(unsigned int maxHeight) = 0;
199  virtual void SetPixelAspectRatio(float pixelAspectRatio) = 0;
200  virtual uint8_t* GetVideoBuffer(size_t size) = 0;
201  virtual void SetVideoWidth(unsigned int videoWidth) = 0;
202  virtual void SetVideoHeight(unsigned int videoHeight) = 0;
203  virtual void SetRotationDegCCW(unsigned int rotationCCW) = 0;
204  virtual uint8_t* GetMemoryBuffer(size_t size) = 0;
205  virtual void Finalize() = 0;
207 
211  virtual bool Deserialize(std::vector<uint8_t> data) = 0;
212 };
213 } // namespace RETRO
214 } // namespace KODI
virtual bool Deserialize(std::vector< uint8_t > data)=0
}
virtual unsigned int GetVideoWidth() const =0
The width of the video frame, in pixels.
virtual size_t GetMemorySize() const =0
The size of the memory region returned by GetMemoryData()
virtual std::string Caption() const =0
A caption that describes the state of the game for this savestate.
virtual AVPixelFormat GetPixelFormat() const =0
The pixel format of the video stream.
virtual unsigned int GetVideoHeight() const =0
The height of the video frame, in pixels.
Definition: ISavestate.h:28
virtual std::string GameClientID() const =0
The game client add-on ID that created this savestate.
virtual const uint8_t * GetMemoryData() const =0
A pointer to the internal memory (SRAM) of the frame.
virtual size_t GetVideoSize() const =0
The size of the frame&#39;s video data, in bytes.
virtual void Reset()=0
Reset to the initial state.
virtual uint64_t TimestampFrames() const =0
The number of frames in the entire gameplay history.
virtual CDateTime Created() const =0
The timestamp of this savestate&#39;s creation.
virtual const uint8_t * GetVideoData() const =0
A pointer to the frame&#39;s video data (pixels)
virtual unsigned int GetNominalHeight() const =0
The nominal height of the video stream, a good guess for subsequent frames.
virtual unsigned int GetMaxHeight() const =0
The maximum height of the video stream, in pixels.
Definition: AudioDecoder.h:18
virtual SAVE_TYPE Type() const =0
The type of save action that created this savestate, either manual or automatic.
DateTime class, which uses FileTime as it&#39;s base.
Definition: XBDateTime.h:63
virtual std::string GameClientVersion() const =0
The semantic version of the game client.
virtual float GetPixelAspectRatio() const =0
The pixel aspect ratio of the video stream.
virtual bool Serialize(const uint8_t *&data, size_t &size) const =0
virtual double TimestampWallClock() const =0
The duration of the entire gameplay history as seen by a wall clock.
virtual std::string GameFileName() const =0
The name of the file belonging to this savestate&#39;s game.
virtual unsigned int GetMaxWidth() const =0
The maximum width of the video stream, in pixels.
virtual uint8_t Slot() const =0
The slot this savestate was saved into, or 0 for no slot.
virtual std::string Label() const =0
The label shown in the GUI for this savestate.
virtual unsigned int GetRotationDegCCW() const =0
The rotation of the video frame, in degrees counter-clockwise.
virtual unsigned int GetNominalWidth() const =0
The nominal width of the video stream, a good guess for subsequent frames.