mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-09-05 01:26:17 -04:00
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:
@@ -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();
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user