gsdump: new freeze definition, the dump now gets correctly loaded in memory

This commit is contained in:
Gauvain 'GovanifY' Roussel-Tarbouriech 2021-03-06 13:42:04 +01:00 committed by Kojin
parent 6840041ee6
commit dae36f59d2
4 changed files with 7 additions and 13 deletions

View File

@ -167,7 +167,6 @@ typedef void(CALLBACK *_GSosdMonitor)(const char *key, const char *value, u32 co
typedef s32(CALLBACK *_GSopen)(void *pDsp, const char *Title, int multithread);
typedef s32(CALLBACK *_GSopen2)(void *pDsp, u32 flags);
typedef void(CALLBACK *_GSvsync)(int field);
typedef s32(CALLBACK* _GSfreeze)(int mode, freezeData* data);
typedef void(CALLBACK *_GSgifTransfer)(const u32 *pMem, u32 size);
typedef void(CALLBACK *_GSgifTransfer1)(u32 *pMem, u32 addr);
typedef void(CALLBACK *_GSgifTransfer2)(u32 *pMem, u32 size);
@ -203,7 +202,6 @@ extern _GSosdLog GSosdLog;
extern _GSosdMonitor GSosdMonitor;
extern _GSopen GSopen;
extern _GSopen2 GSopen2;
extern _GSfreeze GSfreeze;
extern _GSvsync GSvsync;
extern _GSgifTransfer GSgifTransfer;
extern _GSgifTransfer1 GSgifTransfer1;

View File

@ -157,7 +157,6 @@ _GSosdLog GSosdLog;
_GSosdMonitor GSosdMonitor;
_GSopen GSopen;
_GSopen2 GSopen2;
_GSfreeze GSfreeze;
_GSgifTransfer GSgifTransfer;
_GSgifTransfer1 GSgifTransfer1;
_GSgifTransfer2 GSgifTransfer2;
@ -1042,9 +1041,9 @@ bool SysCorePlugins::Shutdown()
// For internal use only, unless you're the MTGS. Then it's for you too!
// Returns false if the plugin returned an error.
bool SysCorePlugins::DoFreeze( PluginsEnum_t pid, int mode, freezeData* data )
bool SysCorePlugins::DoFreeze( PluginsEnum_t pid, int mode, freezeData* data, bool bypass_tsafety )
{
if( (pid == PluginId_GS) && !GetMTGS().IsSelf() )
if( (pid == PluginId_GS) && !GetMTGS().IsSelf() && !bypass_tsafety )
{
// GS needs some thread safety love...

View File

@ -379,7 +379,7 @@ public:
virtual void FreezeOut( PluginsEnum_t pid, pxOutputStream& outfp );
virtual void FreezeIn( PluginsEnum_t pid, pxInputStream& infp );
virtual void Freeze( PluginsEnum_t pid, SaveStateBase& state );
virtual bool DoFreeze( PluginsEnum_t pid, int mode, freezeData* data );
virtual bool DoFreeze( PluginsEnum_t pid, int mode, freezeData* data, bool bypass_tsafety=false );
virtual bool KeyEvent( const keyEvent& evt );
virtual void Configure( PluginsEnum_t pid );

View File

@ -666,7 +666,7 @@ void Dialogs::GSDumpDialog::GSThread::ExecuteTaskInThread()
dump_file.Read(&regs, 8192);
int ssi = ss;
freezeData fd = {0, (s8*)state_data};
freezeData fd = {ss, (s8*)state_data};
m_root_window->m_dump_packets.clear();
while (dump_file.Tell() < dump_file.Length())
@ -727,15 +727,12 @@ void Dialogs::GSDumpDialog::GSThread::ExecuteTaskInThread()
GSsetGameCRC((int)crc, 0);
//OnStop();
return;
if (GSfreeze(0, &fd) == -1)
if (!GetCorePlugins().DoFreeze(PluginId_GS, 0, &fd, true))
m_running = false;
GSvsync(1);
GSreset();
GSsetBaseMem((void*)regs);
GSfreeze(0, &fd);
GetCorePlugins().DoFreeze(PluginId_GS, 0, &fd, true);
size_t i = 0;
int RunTo = 0;
@ -788,7 +785,7 @@ void Dialogs::GSDumpDialog::GSThread::ExecuteTaskInThread()
}
else
{
while (i < m_root_window->m_dump_packets.size())
while (i < (m_root_window->m_dump_packets.size()-1))
{
m_root_window->ProcessDumpEvent(m_root_window->m_dump_packets[i++], regs);