Merge pull request #11177 from Lobsterzelda/simplify-device-save-state
IOS: Simplify IOS::HLE::Device savestate method
This commit is contained in:
commit
ee5a93c6b8
|
@ -53,7 +53,7 @@ DIDevice::DIDevice(Kernel& ios, const std::string& device_name) : Device(ios, de
|
||||||
|
|
||||||
void DIDevice::DoState(PointerWrap& p)
|
void DIDevice::DoState(PointerWrap& p)
|
||||||
{
|
{
|
||||||
DoStateShared(p);
|
Device::DoState(p);
|
||||||
p.Do(m_commands_to_execute);
|
p.Do(m_commands_to_execute);
|
||||||
p.Do(m_executing_command);
|
p.Do(m_executing_command);
|
||||||
p.Do(m_current_partition);
|
p.Do(m_current_partition);
|
||||||
|
|
|
@ -147,12 +147,6 @@ Device::Device(Kernel& ios, const std::string& device_name, const DeviceType typ
|
||||||
}
|
}
|
||||||
|
|
||||||
void Device::DoState(PointerWrap& p)
|
void Device::DoState(PointerWrap& p)
|
||||||
{
|
|
||||||
DoStateShared(p);
|
|
||||||
p.Do(m_is_active);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Device::DoStateShared(PointerWrap& p)
|
|
||||||
{
|
{
|
||||||
p.Do(m_name);
|
p.Do(m_name);
|
||||||
p.Do(m_device_type);
|
p.Do(m_device_type);
|
||||||
|
|
|
@ -181,7 +181,6 @@ public:
|
||||||
|
|
||||||
virtual ~Device() = default;
|
virtual ~Device() = default;
|
||||||
virtual void DoState(PointerWrap& p);
|
virtual void DoState(PointerWrap& p);
|
||||||
void DoStateShared(PointerWrap& p);
|
|
||||||
|
|
||||||
const std::string& GetDeviceName() const { return m_name; }
|
const std::string& GetDeviceName() const { return m_name; }
|
||||||
// Replies to Open and Close requests are sent by the IPC request handler (HandleCommand),
|
// Replies to Open and Close requests are sent by the IPC request handler (HandleCommand),
|
||||||
|
|
|
@ -93,6 +93,7 @@ FSDevice::FSDevice(Kernel& ios, const std::string& device_name) : Device(ios, de
|
||||||
|
|
||||||
void FSDevice::DoState(PointerWrap& p)
|
void FSDevice::DoState(PointerWrap& p)
|
||||||
{
|
{
|
||||||
|
Device::DoState(p);
|
||||||
p.Do(m_dirty_cache);
|
p.Do(m_dirty_cache);
|
||||||
p.Do(m_cache_chain_index);
|
p.Do(m_cache_chain_index);
|
||||||
p.Do(m_cache_fd);
|
p.Do(m_cache_fd);
|
||||||
|
|
|
@ -75,7 +75,7 @@ NetIPTopDevice::NetIPTopDevice(Kernel& ios, const std::string& device_name)
|
||||||
|
|
||||||
void NetIPTopDevice::DoState(PointerWrap& p)
|
void NetIPTopDevice::DoState(PointerWrap& p)
|
||||||
{
|
{
|
||||||
DoStateShared(p);
|
Device::DoState(p);
|
||||||
WiiSockMan::GetInstance().DoState(p);
|
WiiSockMan::GetInstance().DoState(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,7 @@ void SDIOSlot0Device::RefreshConfig()
|
||||||
|
|
||||||
void SDIOSlot0Device::DoState(PointerWrap& p)
|
void SDIOSlot0Device::DoState(PointerWrap& p)
|
||||||
{
|
{
|
||||||
DoStateShared(p);
|
Device::DoState(p);
|
||||||
if (p.IsReadMode())
|
if (p.IsReadMode())
|
||||||
{
|
{
|
||||||
OpenInternal();
|
OpenInternal();
|
||||||
|
|
|
@ -81,13 +81,13 @@ std::optional<IPCReply> STMEventHookDevice::IOCtl(const IOCtlRequest& request)
|
||||||
|
|
||||||
void STMEventHookDevice::DoState(PointerWrap& p)
|
void STMEventHookDevice::DoState(PointerWrap& p)
|
||||||
{
|
{
|
||||||
|
Device::DoState(p);
|
||||||
u32 address = s_event_hook_request ? s_event_hook_request->address : 0;
|
u32 address = s_event_hook_request ? s_event_hook_request->address : 0;
|
||||||
p.Do(address);
|
p.Do(address);
|
||||||
if (address != 0)
|
if (address != 0)
|
||||||
s_event_hook_request = std::make_unique<IOCtlRequest>(address);
|
s_event_hook_request = std::make_unique<IOCtlRequest>(address);
|
||||||
else
|
else
|
||||||
s_event_hook_request.reset();
|
s_event_hook_request.reset();
|
||||||
Device::DoState(p);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool STMEventHookDevice::HasHookInstalled() const
|
bool STMEventHookDevice::HasHookInstalled() const
|
||||||
|
|
|
@ -102,7 +102,7 @@ void BluetoothEmuDevice::DoState(PointerWrap& p)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
p.Do(m_is_active);
|
Device::DoState(p);
|
||||||
p.Do(m_controller_bd);
|
p.Do(m_controller_bd);
|
||||||
DoStateForMessage(m_ios, p, m_hci_endpoint);
|
DoStateForMessage(m_ios, p, m_hci_endpoint);
|
||||||
DoStateForMessage(m_ios, p, m_acl_endpoint);
|
DoStateForMessage(m_ios, p, m_acl_endpoint);
|
||||||
|
|
|
@ -323,6 +323,7 @@ void BluetoothRealDevice::DoState(PointerWrap& p)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Device::DoState(p);
|
||||||
// Prevent the transfer callbacks from messing with m_current_transfers after we have started
|
// Prevent the transfer callbacks from messing with m_current_transfers after we have started
|
||||||
// writing a savestate. We cannot use a scoped lock here because DoState is called twice and
|
// writing a savestate. We cannot use a scoped lock here because DoState is called twice and
|
||||||
// we would lose the lock between the two calls.
|
// we would lose the lock between the two calls.
|
||||||
|
|
|
@ -55,6 +55,7 @@ void USBHost::UpdateWantDeterminism(const bool new_want_determinism)
|
||||||
|
|
||||||
void USBHost::DoState(PointerWrap& p)
|
void USBHost::DoState(PointerWrap& p)
|
||||||
{
|
{
|
||||||
|
Device::DoState(p);
|
||||||
if (IsOpened() && p.IsReadMode())
|
if (IsOpened() && p.IsReadMode())
|
||||||
{
|
{
|
||||||
// After a state has loaded, there may be insertion hooks for devices that were
|
// After a state has loaded, there may be insertion hooks for devices that were
|
||||||
|
|
|
@ -44,7 +44,7 @@ OH0Device::OH0Device(Kernel& ios, const std::string& name) : Device(ios, name, D
|
||||||
void OH0Device::DoState(PointerWrap& p)
|
void OH0Device::DoState(PointerWrap& p)
|
||||||
{
|
{
|
||||||
m_oh0 = std::static_pointer_cast<OH0>(GetIOS()->GetDeviceByName("/dev/usb/oh0"));
|
m_oh0 = std::static_pointer_cast<OH0>(GetIOS()->GetDeviceByName("/dev/usb/oh0"));
|
||||||
p.Do(m_name);
|
Device::DoState(p);
|
||||||
p.Do(m_vid);
|
p.Do(m_vid);
|
||||||
p.Do(m_pid);
|
p.Do(m_pid);
|
||||||
p.Do(m_device_id);
|
p.Do(m_device_id);
|
||||||
|
|
|
@ -94,7 +94,7 @@ static size_t s_state_writes_in_queue;
|
||||||
static std::condition_variable s_state_write_queue_is_empty;
|
static std::condition_variable s_state_write_queue_is_empty;
|
||||||
|
|
||||||
// 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
|
||||||
constexpr u32 STATE_VERSION = 153; // Last changed in PR 11137
|
constexpr u32 STATE_VERSION = 154; // Last changed in PR 11177
|
||||||
|
|
||||||
// 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