Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cclcc fix save #90

Merged
merged 2 commits into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/debugmenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -707,10 +707,10 @@
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",
Expand Down Expand Up @@ -766,7 +766,7 @@
float texWidth = sprite->Sheet.DesignWidth;
float texHeight = sprite->Sheet.DesignHeight;
ImGui::Image(
(ImTextureID)sprite->Sheet.Texture,

Check warning on line 769 in src/debugmenu.cpp

View workflow job for this annotation

GitHub Actions / windows

'type cast': conversion from 'const uint32_t' to 'ImTextureID' of greater size

Check warning on line 769 in src/debugmenu.cpp

View workflow job for this annotation

GitHub Actions / windows

'type cast': conversion from 'const uint32_t' to 'ImTextureID' of greater size
ImVec2(sprite->Bounds.Width, sprite->Bounds.Height),
ImVec2(sprite->Bounds.X / texWidth, sprite->Bounds.Y / texHeight),
ImVec2((sprite->Bounds.X + sprite->Bounds.Width) / texWidth,
Expand All @@ -793,9 +793,9 @@
// Only OpenGL for now
if (Profile::ActiveRenderer == +RendererType::OpenGL) {
ImVec2 pos = ImGui::GetCursorScreenPos();
ImGui::Image((ImTextureID)spriteSheet.second.Texture,

Check warning on line 796 in src/debugmenu.cpp

View workflow job for this annotation

GitHub Actions / windows

'type cast': conversion from 'const uint32_t' to 'ImTextureID' of greater size

Check warning on line 796 in src/debugmenu.cpp

View workflow job for this annotation

GitHub Actions / windows

'type cast': conversion from 'const uint32_t' to 'ImTextureID' of greater size
ImVec2(texWidth, texHeight));
ImageTooltip(pos, (ImTextureID)spriteSheet.second.Texture, texWidth,

Check warning on line 798 in src/debugmenu.cpp

View workflow job for this annotation

GitHub Actions / windows

'type cast': conversion from 'const uint32_t' to 'ImTextureID' of greater size

Check warning on line 798 in src/debugmenu.cpp

View workflow job for this annotation

GitHub Actions / windows

'type cast': conversion from 'const uint32_t' to 'ImTextureID' of greater size
texHeight);
}

Expand Down
1 change: 1 addition & 0 deletions src/games/cclcc/savesystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,7 @@
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);
Expand Down Expand Up @@ -730,5 +731,5 @@
case SaveFull:
return ((SaveFileEntry*)FullSaveEntries[id])->SaveThumbnail;
}
}

Check warning on line 734 in src/games/cclcc/savesystem.cpp

View workflow job for this annotation

GitHub Actions / linux

control reaches end of non-void function [-Wreturn-type]

Check warning on line 734 in src/games/cclcc/savesystem.cpp

View workflow job for this annotation

GitHub Actions / windows

'Impacto::CCLCC::SaveSystem::GetSaveThumbnail': not all control paths return a value

Check warning on line 734 in src/games/cclcc/savesystem.cpp

View workflow job for this annotation

GitHub Actions / linux

control reaches end of non-void function [-Wreturn-type]

Check warning on line 734 in src/games/cclcc/savesystem.cpp

View workflow job for this annotation

GitHub Actions / windows

'Impacto::CCLCC::SaveSystem::GetSaveThumbnail': not all control paths return a value
} // namespace CCLCC
Expand Down
13 changes: 9 additions & 4 deletions src/vm/inst_system.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -730,19 +729,25 @@ 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);
ImpLogSlow(LL_Warning, LC_VMStub,
"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);
Expand All @@ -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
Expand Down
Loading