mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2024-11-21 17:05:04 -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);
|
||||
}
|
||||
|
||||
void SaveManager::SaveFile(int fileNum) {
|
||||
void SaveManager::SaveFile(int fileNum, bool threaded) {
|
||||
if (fileNum == 0xFF) {
|
||||
return;
|
||||
}
|
||||
// Can't think of any time the promise would be needed, so use push_task instead of submit
|
||||
auto saveContext = new SaveContext;
|
||||
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() {
|
||||
@ -2135,7 +2139,7 @@ void SaveManager::ConvertFromUnversioned() {
|
||||
static SaveContext saveContextSave = gSaveContext;
|
||||
InitFile(false);
|
||||
CopyV0Save(*file, gSaveContext);
|
||||
SaveFile(fileNum);
|
||||
SaveFile(fileNum, false);
|
||||
InitMeta(fileNum);
|
||||
gSaveContext = saveContextSave;
|
||||
}
|
||||
@ -2156,7 +2160,7 @@ extern "C" void Save_InitFile(int isDebug) {
|
||||
}
|
||||
|
||||
extern "C" void Save_SaveFile(void) {
|
||||
SaveManager::Instance->SaveFile(gSaveContext.fileNum);
|
||||
SaveManager::Instance->SaveFile(gSaveContext.fileNum, true);
|
||||
}
|
||||
|
||||
extern "C" void Save_SaveGlobal(void) {
|
||||
|
@ -52,7 +52,7 @@ public:
|
||||
|
||||
void Init();
|
||||
void InitFile(bool isDebug);
|
||||
void SaveFile(int fileNum);
|
||||
void SaveFile(int fileNum, bool threaded);
|
||||
void SaveGlobal();
|
||||
void LoadFile(int fileNum);
|
||||
bool SaveFile_Exist(int fileNum);
|
||||
|
Loading…
Reference in New Issue
Block a user