Core fix up load states

This commit is contained in:
zilmar 2024-12-06 21:50:31 +10:30
parent a045a4fcd4
commit 8392ea5c0f
2 changed files with 8 additions and 7 deletions

View File

@ -1873,7 +1873,7 @@ bool CN64System::LoadState(const char * FileName)
} }
zlib_filefunc64_def ffunc; zlib_filefunc64_def ffunc;
fill_win32_filefunc64W(&ffunc); fill_win32_filefunc64W(&ffunc);
unzFile file = unzOpen2_64(stdstr((std::string &)SaveFile).ToUTF16().c_str(), &ffunc); unzFile file = unzOpen2_64(stdstr(std::string(SaveFile)).ToUTF16().c_str(), &ffunc);
int port = -1; int port = -1;
if (file != nullptr) if (file != nullptr)
{ {
@ -1938,7 +1938,7 @@ bool CN64System::LoadState(const char * FileName)
{ {
uint64_t ReadProgramCounter; uint64_t ReadProgramCounter;
unzReadCurrentFile(file, &ReadProgramCounter, sizeof(ReadProgramCounter)); unzReadCurrentFile(file, &ReadProgramCounter, sizeof(ReadProgramCounter));
m_Reg.m_PROGRAM_COUNTER = (uint32_t)ReadProgramCounter; m_Reg.m_PROGRAM_COUNTER = (int32_t)ReadProgramCounter;
} }
unzReadCurrentFile(file, m_Reg.m_GPR, sizeof(int64_t) * 32); unzReadCurrentFile(file, m_Reg.m_GPR, sizeof(int64_t) * 32);
unzReadCurrentFile(file, m_Reg.m_FPR, sizeof(int64_t) * 32); unzReadCurrentFile(file, m_Reg.m_FPR, sizeof(int64_t) * 32);

View File

@ -120,6 +120,11 @@ void CRSPSystem::Reset(RSP_INFO & Info)
{ {
m_RdramSize = 0x00400000; m_RdramSize = 0x00400000;
} }
if (m_RSPRegisterHandler != nullptr)
{
delete m_RSPRegisterHandler;
m_RSPRegisterHandler = nullptr;
}
m_RSPRegisterHandler = new RSPRegisterHandlerPlugin(*this); m_RSPRegisterHandler = new RSPRegisterHandlerPlugin(*this);
if (m_SyncSystem != nullptr) if (m_SyncSystem != nullptr)
@ -130,11 +135,7 @@ void CRSPSystem::Reset(RSP_INFO & Info)
void CRSPSystem::RomClosed(void) void CRSPSystem::RomClosed(void)
{ {
if (m_RSPRegisterHandler != nullptr)
{
delete m_RSPRegisterHandler;
m_RSPRegisterHandler = nullptr;
}
} }
void CRSPSystem::RunRecompiler(void) void CRSPSystem::RunRecompiler(void)