mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-07-14 00:53:07 -07:00
Move Game Saving to Separate Thread (#2820)
* Refactor `Vec2f`, `Vec3f`, `Vec3s` in `z64math` to avoid reserved identifiers. * Include `z64save` in SaveManager, which requires encapsulating `#include gameplaystats.h` and `InitStatTracker` in the cpp to fix compile issues. Adds SaveContext reference parameters to SaveFunc and existing implementations in preparation for threaded saves. * Threaded saves fully implemented. Platform-specific save code removed. Thread safety added. Will wait for thread pool tasks to finish before resetting or closing. * Converted gSaveContext copy for save threads to the heap with `new`, deleted at the end of the threaded function to prevent possible issues with the stack. * Turns out leaving the call to `ThreadPoolWait` in a `GameInteractor::OnExitGame` hook seems to be just fine. * Removed unnecessary references to `SaveManager::ThreadPoolWait()`, game hooks are the only places it's called now. * Re-added WiiU/Switch performance save code. * Added call to `SaveManager::ThreadPoolWait` in `Sram_InitSave` to prevent trying to load a newly "created" save before the save file was actually written. --------- Co-authored-by: Christopher Leggett <chris@leggett.dev>
This commit is contained in:
parent
81372c092d
commit
778f548b01
7 changed files with 240 additions and 208 deletions
|
@ -222,6 +222,7 @@ void Sram_InitSave(FileChooseContext* fileChooseCtx) {
|
|||
}
|
||||
|
||||
Save_SaveFile();
|
||||
SaveManager_ThreadPoolWait();
|
||||
}
|
||||
|
||||
void Sram_InitSram(GameState* gameState) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue