diff options
| author | Malkierian <malkierian@live.com> | 2023-05-05 14:20:34 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-05-05 17:20:34 -0400 |
| commit | 778f548b0139d86889b5c6e2455adf30ca849e64 (patch) | |
| tree | 3b164ea34392765dd0851f97aba12e3674914755 /soh/src/code | |
| parent | 81372c092dbc9e07e632e6115053a6d42be6a9d3 (diff) | |
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>
Diffstat (limited to 'soh/src/code')
| -rw-r--r-- | soh/src/code/z_sram.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/soh/src/code/z_sram.c b/soh/src/code/z_sram.c index beb3ce147..1735a2eb9 100644 --- a/soh/src/code/z_sram.c +++ b/soh/src/code/z_sram.c @@ -222,6 +222,7 @@ void Sram_InitSave(FileChooseContext* fileChooseCtx) { } Save_SaveFile(); + SaveManager_ThreadPoolWait(); } void Sram_InitSram(GameState* gameState) { |
