2015-07-01 23:17:14 -04:00
|
|
|
#pragma once
|
|
|
|
#include "stdafx.h"
|
|
|
|
|
2018-07-01 15:21:05 -04:00
|
|
|
class Console;
|
|
|
|
|
2015-07-01 23:17:14 -04:00
|
|
|
class SaveStateManager
|
|
|
|
{
|
|
|
|
private:
|
2018-07-01 15:21:05 -04:00
|
|
|
static constexpr uint32_t MaxIndex = 10;
|
2016-09-02 19:36:37 -04:00
|
|
|
|
2018-07-01 15:21:05 -04:00
|
|
|
atomic<uint32_t> _lastIndex;
|
|
|
|
shared_ptr<Console> _console;
|
|
|
|
|
|
|
|
string GetStateFilepath(int stateIndex);
|
2020-01-28 23:33:37 -05:00
|
|
|
void SaveScreenshotData(ostream& stream);
|
|
|
|
bool GetScreenshotData(vector<uint8_t>& out, istream& stream);
|
2015-07-01 23:17:14 -04:00
|
|
|
|
|
|
|
public:
|
2020-01-28 20:20:54 -05:00
|
|
|
static constexpr uint32_t FileFormatVersion = 13;
|
2018-07-01 15:21:05 -04:00
|
|
|
|
|
|
|
SaveStateManager(shared_ptr<Console> console);
|
2016-02-14 18:36:08 -05:00
|
|
|
|
2018-07-01 15:21:05 -04:00
|
|
|
void SaveState();
|
|
|
|
bool LoadState();
|
2016-09-02 19:36:37 -04:00
|
|
|
|
2018-07-15 18:26:08 -04:00
|
|
|
void GetSaveStateHeader(ostream & stream);
|
|
|
|
|
2018-07-01 15:21:05 -04:00
|
|
|
void SaveState(ostream &stream);
|
|
|
|
bool SaveState(string filepath);
|
|
|
|
void SaveState(int stateIndex, bool displayMessage = true);
|
|
|
|
bool LoadState(istream &stream, bool hashCheckRequired = true);
|
|
|
|
bool LoadState(string filepath, bool hashCheckRequired = true);
|
|
|
|
bool LoadState(int stateIndex);
|
2016-09-02 19:36:37 -04:00
|
|
|
|
2018-07-01 15:21:05 -04:00
|
|
|
void SaveRecentGame(string romName, string romPath, string patchPath);
|
|
|
|
void LoadRecentGame(string filename, bool resetGame);
|
2017-05-06 15:27:48 -04:00
|
|
|
|
2020-01-28 20:20:54 -05:00
|
|
|
int32_t GetSaveStatePreview(string saveStatePath, uint8_t* pngData);
|
|
|
|
|
2019-12-23 14:50:34 -05:00
|
|
|
void SelectSaveSlot(int slotIndex);
|
2018-07-01 15:21:05 -04:00
|
|
|
void MoveToNextSlot();
|
|
|
|
void MoveToPreviousSlot();
|
2015-07-01 23:17:14 -04:00
|
|
|
};
|