diff --git a/src/debugmenu.cpp b/src/debugmenu.cpp index 700ebbe4..df6237c2 100644 --- a/src/debugmenu.cpp +++ b/src/debugmenu.cpp @@ -707,10 +707,10 @@ void ShowScriptDebugger() { auto& thd = Vm::ThreadPool[ScriptDebuggerSelectedThreadId]; uint8_t* returnAddress = (Profile::Vm::UseReturnIds) - ? thd.ReturnAddresses[i] - : Vm::ScriptGetRetAddress( + ? Vm::ScriptGetRetAddress( Vm::ScriptBuffers[thd.ReturnScriptBufferIds[i]], - thd.ReturnIds[i]); + thd.ReturnIds[i]) + : thd.ReturnAddresses[i]; ImGui::Text( "%s - %08X", diff --git a/src/games/cclcc/savesystem.cpp b/src/games/cclcc/savesystem.cpp index 6e93aa8f..d5e49224 100644 --- a/src/games/cclcc/savesystem.cpp +++ b/src/games/cclcc/savesystem.cpp @@ -545,6 +545,7 @@ void SaveSystem::LoadMemoryNew(LoadProcess load) { if (load == LoadProcess::LoadVars) { ScrWork[SW_PLAYTIME] = WorkingSaveEntry->PlayTime; ScrWork[SW_TITLE] = WorkingSaveEntry->SwTitle; + ScrWork[SW_AUTOSAVERESTART] = WorkingSaveEntry->SaveType; memcpy(&FlagWork[50], WorkingSaveEntry->FlagWorkScript1, 50); memcpy(&FlagWork[300], WorkingSaveEntry->FlagWorkScript2, 100); diff --git a/src/vm/inst_system.cpp b/src/vm/inst_system.cpp index aa778eda..4da73e78 100644 --- a/src/vm/inst_system.cpp +++ b/src/vm/inst_system.cpp @@ -720,8 +720,7 @@ VmInstruction(InstDebugData) { VmInstruction(InstAutoSave) { StartInstruction; auto quickSave = [&](int autosaveRestartCheck, int saveType) { - SaveSystem::SaveMemory(); - if (ScrWork[2112] != autosaveRestartCheck) { + if (ScrWork[SW_AUTOSAVERESTART] != autosaveRestartCheck) { int quicksaveEntries = SaveSystem::GetQuickSaveOpenSlot(); if (quicksaveEntries != -1) { SaveIconDisplay::ShowFor(2.4f); @@ -730,12 +729,15 @@ VmInstruction(InstAutoSave) { } } SetFlag(1285, 1); - ScrWork[2112] = 0; + ScrWork[SW_AUTOSAVERESTART] = 0; }; PopUint8(type); switch (type) { case 0: // QuickSave + if (ScrWork[SW_TITLE] == 0xffff) break; + SaveSystem::SaveMemory(); + [[fallthrough]]; case 20: if (ScrWork[SW_TITLE] == 0xffff) break; quickSave(1, 1); @@ -743,6 +745,9 @@ VmInstruction(InstAutoSave) { "STUB instruction AutoSave(type: QuickSave)\n"); break; case 1: // AutoSaveRestart (?) + if (ScrWork[SW_TITLE] == 0xffff) break; + SaveSystem::SaveMemory(); + [[fallthrough]]; case 21: if (ScrWork[SW_TITLE] == 0xffff) break; quickSave(3, 3); @@ -767,7 +772,7 @@ VmInstruction(InstAutoSave) { if (ScrWork[SW_TITLE] != 0xffff) { SaveSystem::SaveMemory(); SetFlag(1285, 1); - ScrWork[2112] = 0; + ScrWork[SW_AUTOSAVERESTART] = 0; } } break; case 10: { // SetCheckpointId