core, citra_qt: Implement a save states file format and slot UI
10 slots are offered along with 'Save to Oldest Slot' and 'Load from Newest Slot'. The savestate format is similar to the movie file format. It is called CST (Citra SavesTate), and is basically a 0x100 byte header (consisting of magic, revision, creation time and title ID) followed by Zstd compressed raw savestate data. The savestate files are saved to the `states` folder in Citra's user folder. The files are named like `<Title ID>.<Slot ID>.cst`.
This commit is contained in:
parent
7d880f94db
commit
a487016cb4
11 changed files with 384 additions and 77 deletions
|
@ -5,6 +5,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include <string>
|
||||
#include "boost/serialization/access.hpp"
|
||||
#include "common/common_types.h"
|
||||
|
@ -92,6 +93,8 @@ public:
|
|||
ErrorUnknown ///< Any other error
|
||||
};
|
||||
|
||||
~System();
|
||||
|
||||
/**
|
||||
* Run the core CPU loop
|
||||
* This function runs the core for the specified number of CPU instructions before trying to
|
||||
|
@ -118,7 +121,7 @@ public:
|
|||
|
||||
enum class Signal : u32 { None, Shutdown, Reset, Save, Load };
|
||||
|
||||
bool SendSignal(Signal signal);
|
||||
bool SendSignal(Signal signal, u32 param = 0);
|
||||
|
||||
/// Request reset of the system
|
||||
void RequestReset() {
|
||||
|
@ -276,9 +279,9 @@ public:
|
|||
return registered_image_interface;
|
||||
}
|
||||
|
||||
void Save(std::ostream& stream) const;
|
||||
void SaveState(u32 slot) const;
|
||||
|
||||
void Load(std::istream& stream, std::size_t size);
|
||||
void LoadState(u32 slot);
|
||||
|
||||
private:
|
||||
/**
|
||||
|
@ -344,8 +347,11 @@ private:
|
|||
/// Saved variables for reset
|
||||
Frontend::EmuWindow* m_emu_window;
|
||||
std::string m_filepath;
|
||||
u64 title_id;
|
||||
|
||||
std::atomic<Signal> current_signal;
|
||||
std::mutex signal_mutex;
|
||||
Signal current_signal;
|
||||
u32 signal_param;
|
||||
|
||||
friend class boost::serialization::access;
|
||||
template <typename Archive>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue