SaveState: Use enum for freeze mode

Instead of preprocessor defines.
This commit is contained in:
Ziemas 2021-07-06 08:08:18 +02:00 committed by lightningterror
parent 4f50e7e478
commit 3ba2ae0275
32 changed files with 104 additions and 98 deletions

View File

@ -366,7 +366,7 @@ public:
void SendDataPacket();
void SendGameCRC( u32 crc );
void WaitForOpen();
void Freeze( int mode, MTGS_FreezeData& data );
void Freeze( FreezeAction mode, MTGS_FreezeData& data );
void SendSimpleGSPacket( MTGS_RingCommand type, u32 offset, u32 size, GIF_PATH path );
void SendSimplePacket( MTGS_RingCommand type, int data0, int data1, int data2 );

View File

@ -675,19 +675,19 @@ void GSkeyEvent(GSKeyEventData* e)
}
}
int GSfreeze(int mode, freezeData* data)
int GSfreeze(FreezeAction mode, freezeData* data)
{
try
{
if (mode == FREEZE_SAVE)
if (mode == FreezeAction::Save)
{
return s_gs->Freeze(data, false);
}
else if (mode == FREEZE_SIZE)
else if (mode == FreezeAction::Size)
{
return s_gs->Freeze(data, true);
}
else if (mode == FREEZE_LOAD)
else if (mode == FreezeAction::Load)
{
return s_gs->Defrost(data);
}
@ -950,7 +950,7 @@ void GSReplay(char* lpszCmdLine, int renderer)
fd.data = new char[fd.size];
file->Read(fd.data, fd.size);
GSfreeze(FREEZE_LOAD, &fd);
GSfreeze(FreezeAction::Load, &fd);
delete[] fd.data;
file->Read(regs, 0x2000);

View File

@ -1805,7 +1805,7 @@ void GSgifTransfer3(uint8* mem, uint32 size);
void GSvsync(int field);
uint32 GSmakeSnapshot(char* path);
void GSkeyEvent(GSKeyEventData* e);
int GSfreeze(int mode, freezeData* data);
int GSfreeze(FreezeAction mode, freezeData* data);
void GSconfigure();
int GStest();
void GSirqCallback(void (*irq)());

View File

@ -501,7 +501,7 @@ void SysMtgsThread::ExecuteTaskInThread()
{
MTGS_FreezeData* data = (MTGS_FreezeData*)tag.pointer;
int mode = tag.data[0];
data->retval = GSfreeze(mode, (freezeData*)data->fdata);
data->retval = GSfreeze((FreezeAction)mode, (freezeData*)data->fdata);
}
break;
@ -927,10 +927,10 @@ void SysMtgsThread::WaitForOpen()
RethrowException();
}
void SysMtgsThread::Freeze(int mode, MTGS_FreezeData& data)
void SysMtgsThread::Freeze(FreezeAction mode, MTGS_FreezeData& data)
{
pxAssertDev(!IsSelf(), "This method is only allowed from threads *not* named MTGS.");
SendPointerPacket(GS_RINGTYPE_FREEZE, mode, &data);
SendPointerPacket(GS_RINGTYPE_FREEZE, (int)mode, &data);
// make sure MTGS is processing the packet we send it
Resume();
// we are forced to wait for the semaphore to be released, otherwise

View File

@ -151,16 +151,16 @@ s32 PADsetSlot(u8 port, u8 slot)
return 1;
}
s32 PADfreeze(int mode, freezeData* data)
s32 PADfreeze(FreezeAction mode, freezeData* data)
{
if (!data)
return -1;
if (mode == FREEZE_SIZE)
if (mode == FreezeAction::Size)
{
data->size = sizeof(PadFullFreezeData);
}
else if (mode == FREEZE_LOAD)
else if (mode == FreezeAction::Load)
{
PadFullFreezeData* pdata = (PadFullFreezeData*)(data->data);
@ -196,7 +196,7 @@ s32 PADfreeze(int mode, freezeData* data)
slots[port] = pdata->slot[port];
}
}
else if (mode == FREEZE_SAVE)
else if (mode == FreezeAction::Save)
{
if (data->size != sizeof(PadFullFreezeData))
return 0;

View File

@ -47,7 +47,7 @@ s32 PADopen(void* pDsp);
void PADsetLogDir(const char* dir);
void PADclose();
s32 PADsetSlot(u8 port, u8 slot);
s32 PADfreeze(int mode, freezeData* data);
s32 PADfreeze(FreezeAction mode, freezeData* data);
u8 PADstartPoll(int pad);
u8 PADpoll(u8 value);
keyEvent* PADkeyEvent();

View File

@ -1567,7 +1567,7 @@ struct PadFullFreezeData
QueryInfo query;
};
s32 PADfreeze(int mode, freezeData* data)
s32 PADfreeze(FreezeAction mode, freezeData* data)
{
if (!data)
{
@ -1575,11 +1575,11 @@ s32 PADfreeze(int mode, freezeData* data)
return -1;
}
if (mode == FREEZE_SIZE)
if (mode == FreezeAction::Size)
{
data->size = sizeof(PadFullFreezeData);
}
else if (mode == FREEZE_LOAD)
else if (mode == FreezeAction::Load)
{
PadFullFreezeData& pdata = *(PadFullFreezeData*)(data->data);
StopVibrate();
@ -1618,7 +1618,7 @@ s32 PADfreeze(int mode, freezeData* data)
slots[port] = pdata.slot[port];
}
}
else if (mode == FREEZE_SAVE)
else if (mode == FreezeAction::Save)
{
if (data->size != sizeof(PadFullFreezeData))
return 0;

View File

@ -34,6 +34,7 @@
#include <queue>
#include "App.h"
#include "SaveState.h"
typedef struct
{
@ -53,6 +54,6 @@ u8 PADstartPoll(int pad);
u8 PADpoll(u8 value);
keyEvent* PADkeyEvent();
void PADconfigure();
s32 PADfreeze(int mode, freezeData* data);
s32 PADfreeze(FreezeAction mode, freezeData* data);
s32 PADsetSlot(u8 port, u8 slot);
void PADsetSettingsDir(const char* dir);

View File

@ -541,7 +541,7 @@ void SPU2endRecording()
RecordStop();
}
s32 SPU2freeze(int mode, freezeData* data)
s32 SPU2freeze(FreezeAction mode, freezeData* data)
{
pxAssume(data != nullptr);
if (!data)
@ -550,13 +550,13 @@ s32 SPU2freeze(int mode, freezeData* data)
return -1;
}
if (mode == FREEZE_SIZE)
if (mode == FreezeAction::Size)
{
data->size = SPU2Savestate::SizeIt();
return 0;
}
pxAssume(mode == FREEZE_LOAD || mode == FREEZE_SAVE);
pxAssume(mode == FreezeAction::Load || mode == FreezeAction::Save);
if (data->data == nullptr)
{
@ -564,13 +564,13 @@ s32 SPU2freeze(int mode, freezeData* data)
return -1;
}
SPU2Savestate::DataBlock& spud = (SPU2Savestate::DataBlock&)*(data->data);
auto& spud = (SPU2Savestate::DataBlock&)*(data->data);
switch (mode)
{
case FREEZE_LOAD:
case FreezeAction::Load:
return SPU2Savestate::ThawIt(spud);
case FREEZE_SAVE:
case FreezeAction::Save:
return SPU2Savestate::FreezeIt(spud);
jNO_DEFAULT;

View File

@ -36,7 +36,7 @@ bool SPU2setupRecording(const std::string* filename);
void SPU2endRecording();
void SPU2async(u32 cycles);
s32 SPU2freeze(int mode, freezeData* data);
s32 SPU2freeze(FreezeAction mode, freezeData* data);
void SPU2configure();

View File

@ -15,13 +15,16 @@
#pragma once
#define FREEZE_LOAD 0
#define FREEZE_SAVE 1
#define FREEZE_SIZE 2
#include "System.h"
#include "Utilities/Exceptions.h"
enum class FreezeAction
{
Load,
Save,
Size,
};
// Savestate Versioning!
// If you make changes to the savestate version, please increment the value below.
// If the change is minor and compatibility with old states is retained, increment

View File

@ -341,12 +341,12 @@ void USBsetRAM(void* mem)
Reset();
}
s32 USBfreeze(int mode, freezeData* data)
s32 USBfreeze(FreezeAction mode, freezeData* data)
{
USBfreezeData usbd = {0};
//TODO FREEZE_SIZE mismatch causes loading to fail in PCSX2 beforehand
if (mode == FREEZE_LOAD)
if (mode == FreezeAction::Load)
{
if ((long unsigned int)data->size < sizeof(USBfreezeData))
{
@ -412,7 +412,7 @@ s32 USBfreeze(int mode, freezeData* data)
if (proxy && usb_device[i]) /* usb device creation may have failed for some reason */
{
if (proxy->Freeze(FREEZE_SIZE, usb_device[i], nullptr) != (s32)usbd.device[i].size)
if (proxy->Freeze(FreezeAction::Size, usb_device[i], nullptr) != (s32)usbd.device[i].size)
{
Console.WriteLn(Color_Red, "USB: Port %d: device's freeze size doesn't match.", i);
return -1;
@ -442,7 +442,7 @@ s32 USBfreeze(int mode, freezeData* data)
usb_desc_set_interface(usb_device[i], k, tmp.altsetting[k]);
}
proxy->Freeze(FREEZE_LOAD, usb_device[i], ptr);
proxy->Freeze(FreezeAction::Load, usb_device[i], ptr);
if (!usb_device[i]->attached)
{ // FIXME FREEZE_SAVE fcked up
usb_device[i]->attached = true;
@ -496,7 +496,7 @@ s32 USBfreeze(int mode, freezeData* data)
}
}
//TODO straight copying of structs can break cross-platform/cross-compiler save states 'cause padding 'n' stuff
else if (mode == FREEZE_SAVE)
else if (mode == FreezeAction::Save)
{
memset(data->data, 0, data->size); //maybe it already is...
RegisterDevice& regInst = RegisterDevice::instance();
@ -510,7 +510,7 @@ s32 USBfreeze(int mode, freezeData* data)
usbd.device[i].index = index;
if (proxy && usb_device[i])
usbd.device[i].size = proxy->Freeze(FREEZE_SIZE, usb_device[i], nullptr);
usbd.device[i].size = proxy->Freeze(FreezeAction::Size, usb_device[i], nullptr);
else
usbd.device[i].size = 0;
@ -545,7 +545,7 @@ s32 USBfreeze(int mode, freezeData* data)
{
usbd.device[i].dev = *usb_device[i];
if (proxy && usbd.device[i].size)
proxy->Freeze(FREEZE_SAVE, usb_device[i], ptr);
proxy->Freeze(FreezeAction::Save, usb_device[i], ptr);
}
memset(&usbd.device[i].dev.klass, 0, sizeof(USBDeviceClass));
@ -559,7 +559,7 @@ s32 USBfreeze(int mode, freezeData* data)
*(USBfreezeData*)data->data = usbd;
}
else if (mode == FREEZE_SIZE)
else if (mode == FreezeAction::Size)
{
data->size = 0x10000;
}

View File

@ -39,7 +39,7 @@ void USBasync(u32 cycles);
void USBshutdown();
void USBclose();
s32 USBopen(void* pDsp);
s32 USBfreeze(int mode, freezeData* data);
s32 USBfreeze(FreezeAction mode, freezeData* data);
u8 USBread8(u32 addr);
u16 USBread16(u32 addr);

View File

@ -27,7 +27,7 @@ void USBasync(u32 cycles) {}
void USBshutdown() {}
void USBclose() {}
s32 USBopen(void* pDsp) { return 0; }
s32 USBfreeze(int mode, freezeData* data) { return 0; }
s32 USBfreeze(FreezeAction mode, freezeData* data) { return 0; }
u8 USBread8(u32 addr) { return 0; }
u16 USBread16(u32 addr) { return 0; }

View File

@ -26,6 +26,7 @@
#include "helpers.h"
#include "proxybase.h"
#include "qemu-usb/USBinternal.h"
#include "SaveState.h"
void RegisterAPIs();
void UnregisterAPIs();
@ -79,7 +80,7 @@ public:
virtual int Configure(int port, const std::string& api, void* data) = 0;
virtual std::list<std::string> ListAPIs() = 0;
virtual const TCHAR* LongAPIName(const std::string& name) = 0;
virtual int Freeze(int mode, USBDevice* dev, void* data) = 0;
virtual int Freeze(FreezeAction mode, USBDevice* dev, void* data) = 0;
virtual std::vector<std::string> SubTypes() = 0;
virtual bool IsValidAPI(const std::string& api)
@ -124,7 +125,7 @@ public:
{
return T::LongAPIName(name);
}
virtual int Freeze(int mode, USBDevice* dev, void* data)
virtual int Freeze(FreezeAction mode, USBDevice* dev, void* data)
{
return T::Freeze(mode, dev, data);
}

View File

@ -607,7 +607,7 @@ namespace usb_eyetoy
return RESULT_CANCELED;
}
int EyeToyWebCamDevice::Freeze(int mode, USBDevice* dev, void* data)
int EyeToyWebCamDevice::Freeze(FreezeAction mode, USBDevice* dev, void* data)
{
/*switch (mode)
{

View File

@ -51,7 +51,7 @@ namespace usb_eyetoy
return nullptr;
}
static int Configure(int port, const std::string& api, void* data);
static int Freeze(int mode, USBDevice* dev, void* data);
static int Freeze(FreezeAction mode, USBDevice* dev, void* data);
static std::vector<std::string> SubTypes()
{
return {};

View File

@ -794,7 +794,7 @@ namespace usb_hid
return RESULT_CANCELED;
}
int HIDKbdDevice::Freeze(int mode, USBDevice* dev, void* data)
int HIDKbdDevice::Freeze(FreezeAction mode, USBDevice* dev, void* data)
{
auto s = reinterpret_cast<UsbHIDState*>(dev);
auto freezed = reinterpret_cast<UsbHIDState::freeze*>(data);
@ -803,19 +803,19 @@ namespace usb_hid
return 0;
switch (mode)
{
case FREEZE_LOAD:
case FreezeAction::Load:
if (!s)
return -1;
s->f = *freezed;
hid_init(&s->f.hid, HID_KEYBOARD, usb_hid_changed);
return sizeof(UsbHIDState::freeze);
case FREEZE_SAVE:
case FreezeAction::Save:
if (!s)
return -1;
*freezed = s->f;
return sizeof(UsbHIDState::freeze);
case FREEZE_SIZE:
case FreezeAction::Size:
return sizeof(UsbHIDState::freeze);
default:
break;
@ -893,7 +893,7 @@ namespace usb_hid
return RESULT_CANCELED;
}
int HIDMouseDevice::Freeze(int mode, USBDevice* dev, void* data)
int HIDMouseDevice::Freeze(FreezeAction mode, USBDevice* dev, void* data)
{
auto s = reinterpret_cast<UsbHIDState*>(dev);
auto freezed = reinterpret_cast<UsbHIDState::freeze*>(data);
@ -902,19 +902,19 @@ namespace usb_hid
return 0;
switch (mode)
{
case FREEZE_LOAD:
case FreezeAction::Load:
if (!s)
return -1;
s->f = *freezed;
hid_init(&s->f.hid, HID_MOUSE, usb_hid_changed);
return sizeof(UsbHIDState::freeze);
case FREEZE_SAVE:
case FreezeAction::Save:
if (!s)
return -1;
*freezed = s->f;
return sizeof(UsbHIDState::freeze);
case FREEZE_SIZE:
case FreezeAction::Size:
return sizeof(UsbHIDState::freeze);
default:
break;
@ -996,7 +996,7 @@ namespace usb_hid
return RESULT_CANCELED;
}
int BeatManiaDevice::Freeze(int mode, USBDevice* dev, void* data)
int BeatManiaDevice::Freeze(FreezeAction mode, USBDevice* dev, void* data)
{
return HIDKbdDevice::Freeze(mode, dev, data);
}

View File

@ -14,6 +14,7 @@
*/
#pragma once
#include "SaveState.h"
#include "USB/configuration.h"
#include "USB/qemu-usb/hid.h"
#include <list>
@ -71,7 +72,7 @@ namespace usb_hid
static std::list<std::string> ListAPIs();
static const TCHAR* LongAPIName(const std::string& name);
static int Configure(int port, const std::string& api, void* data);
static int Freeze(int mode, USBDevice* dev, void* data);
static int Freeze(FreezeAction mode, USBDevice* dev, void* data);
static std::vector<std::string> SubTypes()
{
return {};
@ -94,7 +95,7 @@ namespace usb_hid
static std::list<std::string> ListAPIs();
static const TCHAR* LongAPIName(const std::string& name);
static int Configure(int port, const std::string& api, void* data);
static int Freeze(int mode, USBDevice* dev, void* data);
static int Freeze(FreezeAction mode, USBDevice* dev, void* data);
static std::vector<std::string> SubTypes()
{
return {};
@ -117,7 +118,7 @@ namespace usb_hid
static std::list<std::string> ListAPIs();
static const TCHAR* LongAPIName(const std::string& name);
static int Configure(int port, const std::string& api, void* data);
static int Freeze(int mode, USBDevice* dev, void* data);
static int Freeze(FreezeAction mode, USBDevice* dev, void* data);
static std::vector<std::string> SubTypes()
{
return {};

View File

@ -1053,24 +1053,24 @@ namespace usb_mic
return RESULT_CANCELED;
}
int HeadsetDevice::Freeze(int mode, USBDevice* dev, void* data)
int HeadsetDevice::Freeze(FreezeAction mode, USBDevice* dev, void* data)
{
HeadsetState* s = (HeadsetState*)dev;
if (!s)
return 0;
switch (mode)
{
case FREEZE_LOAD:
case FreezeAction::Load:
s->f = *(HeadsetState::freeze*)data;
if (s->audsrc)
s->audsrc->SetResampling(s->f.in.srate);
if (s->audsink)
s->audsink->SetResampling(s->f.out.srate);
return sizeof(HeadsetState::freeze);
case FREEZE_SAVE:
case FreezeAction::Save:
*(HeadsetState::freeze*)data = s->f;
return sizeof(HeadsetState::freeze);
case FREEZE_SIZE:
case FreezeAction::Size:
return sizeof(HeadsetState::freeze);
default:
break;

View File

@ -36,7 +36,7 @@ namespace usb_mic
static std::list<std::string> ListAPIs();
static const TCHAR* LongAPIName(const std::string& name);
static int Configure(int port, const std::string& api, void* data);
static int Freeze(int mode, USBDevice* dev, void* data);
static int Freeze(FreezeAction mode, USBDevice* dev, void* data);
static std::vector<std::string> SubTypes()
{
return {};

View File

@ -862,24 +862,24 @@ namespace usb_mic
return RESULT_CANCELED;
}
int SingstarDevice::Freeze(int mode, USBDevice* dev, void* data)
int SingstarDevice::Freeze(FreezeAction mode, USBDevice* dev, void* data)
{
SINGSTARMICState* s = (SINGSTARMICState*)dev;
if (!s)
return 0;
switch (mode)
{
case FREEZE_LOAD:
case FreezeAction::Load:
s->f = *(SINGSTARMICState::freeze*)data;
if (s->audsrc[0])
s->audsrc[0]->SetResampling(s->f.srate[0]);
if (s->audsrc[1])
s->audsrc[1]->SetResampling(s->f.srate[1]);
return sizeof(SINGSTARMICState::freeze);
case FREEZE_SAVE:
case FreezeAction::Save:
*(SINGSTARMICState::freeze*)data = s->f;
return sizeof(SINGSTARMICState::freeze);
case FREEZE_SIZE:
case FreezeAction::Size:
return sizeof(SINGSTARMICState::freeze);
default:
break;

View File

@ -48,7 +48,7 @@ namespace usb_mic
return nullptr;
}
static int Configure(int port, const std::string& api, void* data);
static int Freeze(int mode, USBDevice* dev, void* data);
static int Freeze(FreezeAction mode, USBDevice* dev, void* data);
static std::vector<std::string> SubTypes()
{
return {};

View File

@ -1049,7 +1049,7 @@ namespace usb_msd
return "msd";
}
int MsdDevice::Freeze(int mode, USBDevice* dev, void* data)
int MsdDevice::Freeze(FreezeAction mode, USBDevice* dev, void* data)
{
MSDState* s = (MSDState*)dev;
MSDState::freeze* tmp;
@ -1058,7 +1058,7 @@ namespace usb_msd
return 0;
switch (mode)
{
case FREEZE_LOAD:
case FreezeAction::Load:
//if (s->f.req) free (s->f.req);
tmp = (MSDState::freeze*)data;
@ -1072,12 +1072,12 @@ namespace usb_msd
usb_reattach(dev->port);
return sizeof(MSDState::freeze); // + sizeof(ReqState);
case FREEZE_SAVE:
case FreezeAction::Save:
tmp = (MSDState::freeze*)data;
*tmp = s->f;
return sizeof(MSDState::freeze);
case FREEZE_SIZE:
case FreezeAction::Size:
return sizeof(MSDState::freeze); // + sizeof(ReqState);
default:
break;

View File

@ -41,7 +41,7 @@ namespace usb_msd
return TEXT("cstdio");
}
static int Configure(int port, const std::string& api, void* data);
static int Freeze(int mode, USBDevice* dev, void* data);
static int Freeze(FreezeAction mode, USBDevice* dev, void* data);
static std::vector<std::string> SubTypes()
{
return {};

View File

@ -649,7 +649,7 @@ namespace usb_pad
return RESULT_CANCELED;
}
int PadDevice::Freeze(int mode, USBDevice* dev, void* data)
int PadDevice::Freeze(FreezeAction mode, USBDevice* dev, void* data)
{
PADState* s = (PADState*)dev;
@ -657,14 +657,14 @@ namespace usb_pad
return 0;
switch (mode)
{
case FREEZE_LOAD:
case FreezeAction::Load:
s->f = *(PADState::freeze*)data;
s->pad->Type((PS2WheelTypes)s->f.dev_subtype);
return sizeof(PADState::freeze);
case FREEZE_SAVE:
case FreezeAction::Save:
*(PADState::freeze*)data = s->f;
return sizeof(PADState::freeze);
case FREEZE_SIZE:
case FreezeAction::Size:
return sizeof(PADState::freeze);
default:
break;
@ -724,7 +724,7 @@ namespace usb_pad
return RESULT_CANCELED;
}
int RBDrumKitDevice::Freeze(int mode, USBDevice* dev, void* data)
int RBDrumKitDevice::Freeze(FreezeAction mode, USBDevice* dev, void* data)
{
return PadDevice::Freeze(mode, dev, data);
}
@ -781,7 +781,7 @@ namespace usb_pad
return RESULT_CANCELED;
}
int BuzzDevice::Freeze(int mode, USBDevice* dev, void* data)
int BuzzDevice::Freeze(FreezeAction mode, USBDevice* dev, void* data)
{
return PadDevice::Freeze(mode, dev, data);
}

View File

@ -58,7 +58,7 @@ namespace usb_pad
static std::list<std::string> ListAPIs();
static const TCHAR* LongAPIName(const std::string& name);
static int Configure(int port, const std::string& api, void* data);
static int Freeze(int mode, USBDevice* dev, void* data);
static int Freeze(FreezeAction mode, USBDevice* dev, void* data);
static std::vector<std::string> SubTypes()
{
return {"Driving Force", "Driving Force Pro", "Driving Force Pro (rev11.02)", "GT Force"};
@ -81,7 +81,7 @@ namespace usb_pad
static std::list<std::string> ListAPIs();
static const TCHAR* LongAPIName(const std::string& name);
static int Configure(int port, const std::string& api, void* data);
static int Freeze(int mode, USBDevice* dev, void* data);
static int Freeze(FreezeAction mode, USBDevice* dev, void* data);
static std::vector<std::string> SubTypes()
{
return {};
@ -104,7 +104,7 @@ namespace usb_pad
static std::list<std::string> ListAPIs();
static const TCHAR* LongAPIName(const std::string& name);
static int Configure(int port, const std::string& api, void* data);
static int Freeze(int mode, USBDevice* dev, void* data);
static int Freeze(FreezeAction mode, USBDevice* dev, void* data);
static std::vector<std::string> SubTypes()
{
return {};
@ -127,7 +127,7 @@ namespace usb_pad
static std::list<std::string> ListAPIs();
static const TCHAR* LongAPIName(const std::string& name);
static int Configure(int port, const std::string& api, void* data);
static int Freeze(int mode, USBDevice* dev, void* data);
static int Freeze(FreezeAction mode, USBDevice* dev, void* data);
static std::vector<std::string> SubTypes()
{
return {};

View File

@ -467,7 +467,7 @@ namespace usb_pad
return RESULT_CANCELED;
}
int SeamicDevice::Freeze(int mode, USBDevice* dev, void* data)
int SeamicDevice::Freeze(FreezeAction mode, USBDevice* dev, void* data)
{
return 0;
// SeamicState *s = (SeamicState *)dev;

View File

@ -781,12 +781,12 @@ void Dialogs::GSDumpDialog::GSThread::ExecuteTaskInThread()
GSsetGameCRC((int)crc, 0);
if (GSfreeze(0, &fd))
if (GSfreeze(FreezeAction::Load, &fd))
GSDump::isRunning = false;
GSvsync(1);
GSreset();
GSsetBaseMem((u8*)regs);
GSfreeze(0, &fd);
GSfreeze(FreezeAction::Load, &fd);
size_t i = 0;
m_debug_index = 0;

View File

@ -404,12 +404,12 @@ namespace Implementations
ScopedCoreThreadPause paused_core;
freezeData fP = {0, nullptr};
MTGS_FreezeData sstate = {&fP, 0};
GetMTGS().Freeze(FREEZE_SIZE, sstate);
GetMTGS().Freeze(FreezeAction::Size, sstate);
fP.data = new char[fP.size];
GetMTGS().Freeze(FREEZE_SAVE, sstate);
GetMTGS().Freeze(FreezeAction::Save, sstate);
GetMTGS().Suspend(true);
renderswitch = !renderswitch;
GetMTGS().Freeze(FREEZE_LOAD, sstate);
GetMTGS().Freeze(FreezeAction::Load, sstate);
delete[] fP.data;
paused_core.AllowResume();
reentrant = false;

View File

@ -100,15 +100,15 @@ void MainEmuFrame::Menu_GSSettings_Click(wxCommandEvent& event)
MTGS_FreezeData sstate = {&fP, 0};
if (is_frame_init)
{
GetMTGS().Freeze(FREEZE_SIZE, sstate);
GetMTGS().Freeze(FreezeAction::Size, sstate);
fP.data = new char[fP.size];
GetMTGS().Freeze(FREEZE_SAVE, sstate);
GetMTGS().Freeze(FreezeAction::Save, sstate);
GetMTGS().Suspend(true);
}
GSconfigure();
if (is_frame_init)
{
GetMTGS().Freeze(FREEZE_LOAD, sstate);
GetMTGS().Freeze(FreezeAction::Load, sstate);
delete[] fP.data;
}
if (need_shutdown)

View File

@ -48,10 +48,10 @@ static const wxChar* EntryFilename_InternalStructures = L"PCSX2 Internal Structu
struct SysState_Component
{
const char* name;
int (*freeze)(int, freezeData*);
int (*freeze)(FreezeAction, freezeData*);
};
int SysState_MTGSFreeze(int mode, freezeData* fP)
int SysState_MTGSFreeze(FreezeAction mode, freezeData* fP)
{
ScopedCoreThreadPause paused_core;
MTGS_FreezeData sstate = {fP, 0};
@ -69,21 +69,21 @@ static constexpr SysState_Component GS{"GS", SysState_MTGSFreeze};
void SysState_ComponentFreezeOutRoot(void* dest, SysState_Component comp)
{
freezeData fP = {0, (char*)dest};
if (comp.freeze(FREEZE_SIZE, &fP) != 0)
if (comp.freeze(FreezeAction::Size, &fP) != 0)
return;
if (!fP.size)
return;
Console.Indent().WriteLn("Saving %s", comp.name);
if (comp.freeze(FREEZE_SAVE, &fP) != 0)
if (comp.freeze(FreezeAction::Save, &fP) != 0)
throw std::runtime_error(std::string(" * ") + comp.name + std::string(": Error saving state!\n"));
}
void SysState_ComponentFreezeIn(pxInputStream& infp, SysState_Component comp)
{
freezeData fP = {0, nullptr};
if (comp.freeze(FREEZE_SIZE, &fP) != 0)
if (comp.freeze(FreezeAction::Size, &fP) != 0)
fP.size = 0;
Console.Indent().WriteLn("Loading %s", comp.name);
@ -102,14 +102,14 @@ void SysState_ComponentFreezeIn(pxInputStream& infp, SysState_Component comp)
fP.data = data.GetPtr();
infp.Read(fP.data, fP.size);
if (comp.freeze(FREEZE_LOAD, &fP) != 0)
if (comp.freeze(FreezeAction::Load, &fP) != 0)
throw std::runtime_error(std::string(" * ") + comp.name + std::string(": Error loading state!\n"));
}
void SysState_ComponentFreezeOut(SaveStateBase& writer, SysState_Component comp)
{
freezeData fP = {0, NULL};
if (comp.freeze(FREEZE_SIZE, &fP) == 0)
if (comp.freeze(FreezeAction::Size, &fP) == 0)
{
const int size = fP.size;
writer.PrepBlock(size);