From 2c8e412a66c5819364da5aa9bbc332741e3a340f Mon Sep 17 00:00:00 2001 From: Frank-74 Date: Mon, 21 Nov 2016 16:33:13 +0000 Subject: [PATCH] Only delete old save file being saved. Saving compressed file deletes uncompressed save and vice versa. Also if uncompressed file exists, it loads uncompressed save instead of compressed save. --- Source/Project64-core/N64System/N64Class.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Source/Project64-core/N64System/N64Class.cpp b/Source/Project64-core/N64System/N64Class.cpp index 1d56af4cb..bb41f4d4c 100644 --- a/Source/Project64-core/N64System/N64Class.cpp +++ b/Source/Project64-core/N64System/N64Class.cpp @@ -1518,11 +1518,6 @@ bool CN64System::SaveState() SaveFile.DirectoryCreate(); } - //delete any old save - ExtraInfo.Delete(); - SaveFile.Delete(); - ZipFile.Delete(); - //Open the file if (g_Settings->LoadDword(Game_FuncLookupMode) == FuncFind_ChangeMemory) { @@ -1538,6 +1533,7 @@ bool CN64System::SaveState() uint32_t NextViTimer = m_SystemTimer.GetTimer(CSystemTimer::ViTimer); if (g_Settings->LoadDword(Setting_AutoZipInstantSave)) { + ZipFile.Delete(); zipFile file = zipOpen(ZipFile, 0); zipOpenNewFileInZip(file, SaveFile.GetNameExtension().c_str(), NULL, NULL, 0, NULL, 0, NULL, Z_DEFLATED, Z_DEFAULT_COMPRESSION); zipWriteInFileInZip(file, &SaveID_0, sizeof(SaveID_0)); @@ -1579,6 +1575,8 @@ bool CN64System::SaveState() } else { + ExtraInfo.Delete(); + SaveFile.Delete(); CFile hSaveFile(SaveFile, CFileBase::modeWrite | CFileBase::modeCreate); if (!hSaveFile.IsOpen()) { @@ -1662,6 +1660,10 @@ bool CN64System::LoadState() CPath ZipFileName; ZipFileName = (const std::string &)FileName + ".zip"; + if (g_Settings->LoadDword(Setting_AutoZipInstantSave)) + { + FileName=ZipFileName; + } if ((g_Settings->LoadDword(Setting_AutoZipInstantSave) && ZipFileName.Exists()) || FileName.Exists()) { if (LoadState(FileName)) @@ -2183,4 +2185,4 @@ void CN64System::TLB_Changed() { g_Debugger->TLBChanged(); } -} \ No newline at end of file +}