mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-16 11:09:16 +01:00
6e774f1b64
This is good hygiene, and also happens to be required to build Dolphin using Clang modules. (Under this setup, each header file becomes a module, and each #include is automatically translated to a module import. Recursive includes still leak through (by default), but modules are compiled independently, and can't depend on defines or types having previously been set up. The main reason to retrofit it onto Dolphin is compilation performance - no more textual includes whatsoever, rather than putting a few blessed common headers into a PCH. Unfortunately, I found multiple Clang bugs while trying to build Dolphin this way, so it's not ready yet, but I can start with this prerequisite.)
66 lines
1.5 KiB
C++
66 lines
1.5 KiB
C++
// Copyright 2013 Dolphin Emulator Project
|
|
// Licensed under GPLv2
|
|
// Refer to the license.txt file included.
|
|
|
|
|
|
// Emulator state saving support.
|
|
|
|
#pragma once
|
|
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
#include "Common/CommonTypes.h"
|
|
|
|
namespace State
|
|
{
|
|
|
|
// number of states
|
|
static const u32 NUM_STATES = 10;
|
|
|
|
struct StateHeader
|
|
{
|
|
u8 gameID[6];
|
|
u32 size;
|
|
double time;
|
|
};
|
|
|
|
void Init();
|
|
|
|
void Shutdown();
|
|
|
|
void EnableCompression(bool compression);
|
|
|
|
bool ReadHeader(const std::string& filename, StateHeader& header);
|
|
|
|
// These don't happen instantly - they get scheduled as events.
|
|
// ...But only if we're not in the main cpu thread.
|
|
// If we're in the main cpu thread then they run immediately instead
|
|
// because some things (like Lua) need them to run immediately.
|
|
// Slots from 0-99.
|
|
void Save(int slot, bool wait = false);
|
|
void Load(int slot);
|
|
void Verify(int slot);
|
|
|
|
void SaveAs(const std::string &filename, bool wait = false);
|
|
void LoadAs(const std::string &filename);
|
|
void VerifyAt(const std::string &filename);
|
|
|
|
void SaveToBuffer(std::vector<u8>& buffer);
|
|
void LoadFromBuffer(std::vector<u8>& buffer);
|
|
void VerifyBuffer(std::vector<u8>& buffer);
|
|
|
|
void LoadLastSaved(int i = 1);
|
|
void SaveFirstSaved();
|
|
void UndoSaveState();
|
|
void UndoLoadState();
|
|
|
|
// wait until previously scheduled savestate event (if any) is done
|
|
void Flush();
|
|
|
|
// for calling back into UI code without introducing a dependency on it in core
|
|
typedef void(*CallbackFunc)(void);
|
|
void SetOnAfterLoadCallback(CallbackFunc callback);
|
|
|
|
}
|