IOS: STM: Save event hook to savestates
This allows a STM event hook to be saved and restored correctly and fixes the power/reset button after loading a state in some cases.
This commit is contained in:
parent
9c28121af6
commit
6291cd0bce
|
@ -8,6 +8,7 @@
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#include "Common/Assert.h"
|
#include "Common/Assert.h"
|
||||||
|
#include "Common/ChunkFile.h"
|
||||||
#include "Common/Logging/Log.h"
|
#include "Common/Logging/Log.h"
|
||||||
#include "Core/HW/Memmap.h"
|
#include "Core/HW/Memmap.h"
|
||||||
|
|
||||||
|
@ -90,6 +91,17 @@ IPCCommandResult STMEventHook::IOCtl(const IOCtlRequest& request)
|
||||||
return GetNoReply();
|
return GetNoReply();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void STMEventHook::DoState(PointerWrap& p)
|
||||||
|
{
|
||||||
|
u32 address = s_event_hook_request ? s_event_hook_request->address : 0;
|
||||||
|
p.Do(address);
|
||||||
|
if (address != 0)
|
||||||
|
s_event_hook_request = std::make_unique<IOCtlRequest>(address);
|
||||||
|
else
|
||||||
|
s_event_hook_request.reset();
|
||||||
|
Device::DoState(p);
|
||||||
|
}
|
||||||
|
|
||||||
bool STMEventHook::HasHookInstalled() const
|
bool STMEventHook::HasHookInstalled() const
|
||||||
{
|
{
|
||||||
return s_event_hook_request != nullptr;
|
return s_event_hook_request != nullptr;
|
||||||
|
|
|
@ -10,6 +10,8 @@
|
||||||
#include "Core/IOS/Device.h"
|
#include "Core/IOS/Device.h"
|
||||||
#include "Core/IOS/IPC.h"
|
#include "Core/IOS/IPC.h"
|
||||||
|
|
||||||
|
class PointerWrap;
|
||||||
|
|
||||||
namespace IOS
|
namespace IOS
|
||||||
{
|
{
|
||||||
namespace HLE
|
namespace HLE
|
||||||
|
@ -55,6 +57,7 @@ public:
|
||||||
STMEventHook(u32 device_id, const std::string& device_name) : Device(device_id, device_name) {}
|
STMEventHook(u32 device_id, const std::string& device_name) : Device(device_id, device_name) {}
|
||||||
void Close() override;
|
void Close() override;
|
||||||
IPCCommandResult IOCtl(const IOCtlRequest& request) override;
|
IPCCommandResult IOCtl(const IOCtlRequest& request) override;
|
||||||
|
void DoState(PointerWrap& p) override;
|
||||||
|
|
||||||
bool HasHookInstalled() const;
|
bool HasHookInstalled() const;
|
||||||
void ResetButton() const;
|
void ResetButton() const;
|
||||||
|
|
|
@ -71,7 +71,7 @@ static Common::Event g_compressAndDumpStateSyncEvent;
|
||||||
static std::thread g_save_thread;
|
static std::thread g_save_thread;
|
||||||
|
|
||||||
// Don't forget to increase this after doing changes on the savestate system
|
// Don't forget to increase this after doing changes on the savestate system
|
||||||
static const u32 STATE_VERSION = 71; // Last changed in PR 4687
|
static const u32 STATE_VERSION = 72; // Last changed in PR 4710
|
||||||
|
|
||||||
// Maps savestate versions to Dolphin versions.
|
// Maps savestate versions to Dolphin versions.
|
||||||
// Versions after 42 don't need to be added to this list,
|
// Versions after 42 don't need to be added to this list,
|
||||||
|
|
Loading…
Reference in New Issue