SaveService: Move save_slot_written call and onWritten notification (#2388)

* move onWritten notification to before sidecar flush

* call save_slot_written in dataWrite() instead of memCardDataSaveWait2

* move save_slot_written to memCardDataSaveWait
This commit is contained in:
gymnast86
2026-09-04 02:10:02 -05:00
committed by GitHub
parent bc32702cb4
commit 0a4a335e4a
2 changed files with 8 additions and 6 deletions
+6 -4
View File
@@ -1452,6 +1452,12 @@ void dMenu_save_c::memCardDataSaveWait() {
mCmdState = g_mDoMemCd_control.SaveSync();
if (mCmdState != 0) {
#if TARGET_PC
if (mCmdState == 1) {
dusk::mods::svc::save_slot_written(
mSelectedFile, mSaveBuffer + mSelectedFile * QUEST_LOG_SIZE);
}
#endif
printf("save cmdState %d\n", mCmdState);
mMenuProc = PROC_MEMCARD_DATA_SAVE_WAIT2;
}
@@ -1469,10 +1475,6 @@ void dMenu_save_c::memCardDataSaveWait2() {
dComIfGs_setDataNum(mSelectedFile);
dComIfGs_setNoFile(0);
#if TARGET_PC
dusk::mods::svc::save_slot_written(mSelectedFile, mSaveBuffer + mSelectedFile * QUEST_LOG_SIZE);
#endif
if (mUseType == TYPE_WHITE_EVENT || mUseType == TYPE_BLACK_EVENT) {
headerTxtSet(0x530); // Saved.
mWarning->closeInit();
+2 -2
View File
@@ -193,6 +193,8 @@ void save_slot_written(uint32_t slot, const void* slotData) {
if (slot >= kSlotCount) {
return;
}
s_currentSlot = static_cast<int32_t>(slot);
notify(slot, &SaveObserverRecord::onWritten, "save-written");
load_sidecar();
auto& store = s_slots[slot];
if (slotData != nullptr) {
@@ -200,8 +202,6 @@ void save_slot_written(uint32_t slot, const void* slotData) {
store.snapshotCrc = utils::crc32(slotData, kQuestLogSize);
}
flush_sidecar();
s_currentSlot = static_cast<int32_t>(slot);
notify(slot, &SaveObserverRecord::onWritten, "save-written");
}
void save_slot_copied(uint32_t fromSlot, uint32_t toSlot) {