diff --git a/Source/Project64-core/N64System/N64System.cpp b/Source/Project64-core/N64System/N64System.cpp index 6fa78132e..c1b17d561 100644 --- a/Source/Project64-core/N64System/N64System.cpp +++ b/Source/Project64-core/N64System/N64System.cpp @@ -1873,7 +1873,7 @@ bool CN64System::LoadState(const char * FileName) } zlib_filefunc64_def 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; if (file != nullptr) { @@ -1938,7 +1938,7 @@ bool CN64System::LoadState(const char * FileName) { uint64_t 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_FPR, sizeof(int64_t) * 32); diff --git a/Source/Project64-rsp-core/cpu/RspSystem.cpp b/Source/Project64-rsp-core/cpu/RspSystem.cpp index 7f1826e9d..5d5dcbafd 100644 --- a/Source/Project64-rsp-core/cpu/RspSystem.cpp +++ b/Source/Project64-rsp-core/cpu/RspSystem.cpp @@ -120,6 +120,11 @@ void CRSPSystem::Reset(RSP_INFO & Info) { m_RdramSize = 0x00400000; } + if (m_RSPRegisterHandler != nullptr) + { + delete m_RSPRegisterHandler; + m_RSPRegisterHandler = nullptr; + } m_RSPRegisterHandler = new RSPRegisterHandlerPlugin(*this); if (m_SyncSystem != nullptr) @@ -130,11 +135,7 @@ void CRSPSystem::Reset(RSP_INFO & Info) void CRSPSystem::RomClosed(void) { - if (m_RSPRegisterHandler != nullptr) - { - delete m_RSPRegisterHandler; - m_RSPRegisterHandler = nullptr; - } + } void CRSPSystem::RunRecompiler(void)