mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2024-11-28 12:22:20 -05:00
Threaded save was causing issues for old oot-save.sav
conversion. Added an option just for that instance to run SaveManager::SaveFileThreaded
outside of a thread. Everything else still runs threaded. (#2894)
This commit is contained in:
parent
d8891f1fe4
commit
099d9cd0fd
@ -754,14 +754,18 @@ void SaveManager::SaveFileThreaded(int fileNum, SaveContext* saveContext) {
|
|||||||
GameInteractor::Instance->ExecuteHooks<GameInteractor::OnSaveFile>(fileNum);
|
GameInteractor::Instance->ExecuteHooks<GameInteractor::OnSaveFile>(fileNum);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SaveManager::SaveFile(int fileNum) {
|
void SaveManager::SaveFile(int fileNum, bool threaded) {
|
||||||
if (fileNum == 0xFF) {
|
if (fileNum == 0xFF) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Can't think of any time the promise would be needed, so use push_task instead of submit
|
// Can't think of any time the promise would be needed, so use push_task instead of submit
|
||||||
auto saveContext = new SaveContext;
|
auto saveContext = new SaveContext;
|
||||||
memcpy(saveContext, &gSaveContext, sizeof(gSaveContext));
|
memcpy(saveContext, &gSaveContext, sizeof(gSaveContext));
|
||||||
smThreadPool->push_task_back(&SaveManager::SaveFileThreaded, this, fileNum, saveContext);
|
if (threaded) {
|
||||||
|
smThreadPool->push_task_back(&SaveManager::SaveFileThreaded, this, fileNum, saveContext);
|
||||||
|
} else {
|
||||||
|
SaveFileThreaded(fileNum, saveContext);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SaveManager::SaveGlobal() {
|
void SaveManager::SaveGlobal() {
|
||||||
@ -2135,7 +2139,7 @@ void SaveManager::ConvertFromUnversioned() {
|
|||||||
static SaveContext saveContextSave = gSaveContext;
|
static SaveContext saveContextSave = gSaveContext;
|
||||||
InitFile(false);
|
InitFile(false);
|
||||||
CopyV0Save(*file, gSaveContext);
|
CopyV0Save(*file, gSaveContext);
|
||||||
SaveFile(fileNum);
|
SaveFile(fileNum, false);
|
||||||
InitMeta(fileNum);
|
InitMeta(fileNum);
|
||||||
gSaveContext = saveContextSave;
|
gSaveContext = saveContextSave;
|
||||||
}
|
}
|
||||||
@ -2156,7 +2160,7 @@ extern "C" void Save_InitFile(int isDebug) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
extern "C" void Save_SaveFile(void) {
|
extern "C" void Save_SaveFile(void) {
|
||||||
SaveManager::Instance->SaveFile(gSaveContext.fileNum);
|
SaveManager::Instance->SaveFile(gSaveContext.fileNum, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" void Save_SaveGlobal(void) {
|
extern "C" void Save_SaveGlobal(void) {
|
||||||
|
@ -52,7 +52,7 @@ public:
|
|||||||
|
|
||||||
void Init();
|
void Init();
|
||||||
void InitFile(bool isDebug);
|
void InitFile(bool isDebug);
|
||||||
void SaveFile(int fileNum);
|
void SaveFile(int fileNum, bool threaded);
|
||||||
void SaveGlobal();
|
void SaveGlobal();
|
||||||
void LoadFile(int fileNum);
|
void LoadFile(int fileNum);
|
||||||
bool SaveFile_Exist(int fileNum);
|
bool SaveFile_Exist(int fileNum);
|
||||||
|
Loading…
Reference in New Issue
Block a user