diff --git a/soh/soh/ResourceManagerHelpers.cpp b/soh/soh/ResourceManagerHelpers.cpp index 777421b8a58..796ebf4d3f2 100644 --- a/soh/soh/ResourceManagerHelpers.cpp +++ b/soh/soh/ResourceManagerHelpers.cpp @@ -604,27 +604,38 @@ extern "C" void ResourceMgr_UnloadSceneAssets() { } } +// Persisted assets never unload, generally because they're used in multiple places. The biggest use of this +// is the skyboxes, handled by "alt/textures/*", and also take the most memory in the biggest packs +// Overlays loads the file select and pause menus, textures also handles icons for those menus extern "C" void ResourceMgr_LoadDelayedPersistentAltAssets() { + // Load sound effects first for title screen "Press Start" and pause sounds. These are loaded + // before the alt assets to prevent load lock for the audio itself Ship::Context::GetInstance()->GetResourceManager()->LoadResourceAsync("audio/fonts/00_Sound_Effects_1"); Ship::Context::GetInstance()->GetResourceManager()->LoadResourceAsync("audio/fonts/00_Sound_Effects_2"); ResourceLoadDirectoryAsync("audio/*"); ResourceLoadDirectoryAsync("alt/overlays/*"); - ResourceLoadDirectoryAsync("alt/textures/*"); + // Load the skyboxes before anything else ResourceLoadDirectoryAsync("alt/textures/vr_cloud*"); + ResourceLoadDirectoryAsync("alt/textures/vr_fine*"); + ResourceLoadDirectoryAsync("alt/textures/*"); ResourceLoadDirectoryAsync("alt/objects/gameplay_*"); - ResourceLoadDirectoryAsync("alt/scenes/*/spot00*"); ResourceLoadDirectoryAsync("alt/code/*"); } +// Setup initial preload based on Fast File Select and Save Index options extern "C" void ResourceMgr_LoadPersistentAltAssets() { bool skipTitle = CVarGetInteger(CVAR_DEVELOPER_TOOLS("SkipLogoTitle"), 0); int fastFile = CVarGetInteger(CVAR_DEVELOPER_TOOLS("SaveFileID"), 0); if (!skipTitle) { ResourceLoadDirectoryAsync("alt/textures/nintendo_rogo_static/*"); + // Title screen/hyrule field ResourceLoadDirectoryAsync("alt/scenes/*/spot00*"); + // Title logos ResourceLoadDirectoryAsync("alt/objects/object_mag/*"); + // Non-in-game gameplay_keep ResourceLoadDirectoryAsync("alt/objects/gameplay_keep/*"); + // Title screen music Ship::Context::GetInstance()->GetResourceManager()->LoadResourceAsync("audio/sequences/030_Title_Theme"); Ship::Context::GetInstance()->GetResourceManager()->LoadResourceAsync("audio/fonts/06_Title_Theme"); } @@ -632,6 +643,9 @@ extern "C" void ResourceMgr_LoadPersistentAltAssets() { ResourceLoadDirectoryAsync("alt/overlays/ovl_file_choose/*"); ResourceLoadDirectoryAsync("alt/textures/title_static/*"); ResourceLoadDirectoryAsync("alt/objects/gameplay_keep/*"); + ResourceLoadDirectoryAsync("alt/textures/vr_cloud*"); + ResourceLoadDirectoryAsync("alt/textures/vr_fine*"); + // File Select music Ship::Context::GetInstance()->GetResourceManager()->LoadResourceAsync("audio/sequences/087_File_Select"); Ship::Context::GetInstance()->GetResourceManager()->LoadResourceAsync("audio/fonts/09_Fairy_Fountain"); } diff --git a/soh/src/code/game.c b/soh/src/code/game.c index efcb602a445..9780a277329 100644 --- a/soh/src/code/game.c +++ b/soh/src/code/game.c @@ -474,8 +474,8 @@ void GameState_Destroy(GameState* gameState) { // Performing clear skeletons before unload resources fixes an actor heap corruption crash due to the skeleton patching system. ResourceMgr_ClearSkeletons(); - if (sceneNum > -0 && sceneNum <= SCENE_TESTROOM) { - ResourceMgr_RegisterUnloadSceneAssets(sceneNum); + if (play->sceneNum >= SCENE_DEKU_TREE && play->sceneNum <= SCENE_TESTROOM) { + ResourceMgr_RegisterUnloadSceneAssets(play->sceneNum); } if (ResourceMgr_IsAltAssetsEnabled()) {