2019-03-12 09:15:57 -04:00
|
|
|
#pragma once
|
|
|
|
#include "stdafx.h"
|
|
|
|
|
|
|
|
class Console;
|
|
|
|
|
|
|
|
class SaveStateManager
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
static constexpr uint32_t MaxIndex = 10;
|
|
|
|
|
|
|
|
atomic<uint32_t> _lastIndex;
|
|
|
|
shared_ptr<Console> _console;
|
|
|
|
|
2020-12-19 23:30:09 +03:00
|
|
|
string GetStateFilepath(int stateIndex);
|
2020-02-05 21:30:16 -05:00
|
|
|
void SaveScreenshotData(ostream& stream);
|
|
|
|
bool GetScreenshotData(vector<uint8_t>& out, uint32_t& width, uint32_t& height, istream& stream);
|
2019-03-12 09:15:57 -04:00
|
|
|
|
|
|
|
public:
|
2020-06-18 00:58:22 -04:00
|
|
|
static constexpr uint32_t FileFormatVersion = 8;
|
2019-03-12 09:15:57 -04:00
|
|
|
|
|
|
|
SaveStateManager(shared_ptr<Console> console);
|
|
|
|
|
|
|
|
void SaveState();
|
|
|
|
bool LoadState();
|
|
|
|
|
2020-12-19 23:30:09 +03:00
|
|
|
void GetSaveStateHeader(ostream& stream);
|
2019-03-12 09:15:57 -04:00
|
|
|
|
2020-12-19 23:30:09 +03:00
|
|
|
void SaveState(ostream& stream);
|
2019-03-12 09:15:57 -04:00
|
|
|
bool SaveState(string filepath);
|
|
|
|
void SaveState(int stateIndex, bool displayMessage = true);
|
2020-12-19 23:30:09 +03:00
|
|
|
bool LoadState(istream& stream, bool hashCheckRequired = true);
|
2019-03-12 09:15:57 -04:00
|
|
|
bool LoadState(string filepath, bool hashCheckRequired = true);
|
|
|
|
bool LoadState(int stateIndex);
|
|
|
|
|
2019-03-14 18:07:25 -04:00
|
|
|
void SaveRecentGame(string romName, string romPath, string patchPath);
|
|
|
|
void LoadRecentGame(string filename, bool resetGame);
|
2019-03-12 09:15:57 -04:00
|
|
|
|
2020-02-05 21:30:16 -05:00
|
|
|
int32_t GetSaveStatePreview(string saveStatePath, uint8_t* pngData);
|
|
|
|
|
2019-12-26 14:11:33 -05:00
|
|
|
void SelectSaveSlot(int slotIndex);
|
2019-03-12 09:15:57 -04:00
|
|
|
void MoveToNextSlot();
|
|
|
|
void MoveToPreviousSlot();
|
2020-12-19 23:30:09 +03:00
|
|
|
};
|