From e3470a6a0dd4408b1749849ffa4eb995c9458ef7 Mon Sep 17 00:00:00 2001 From: Malkierian Date: Tue, 28 Jan 2025 12:07:33 -0700 Subject: [PATCH] Fix ResourceManagerHelpers initialization order. Rename `LoadDelayedPersistentAltAssets` to `LoadDelayedPersistentAssets`. Remove audio path from LoadDelayedPersistentAssets, as that's already handled in OTRAudio_Init. Exclude textures/buttons from LoadDelayedPersistentAssets (PNGs, don't have a factory). --- soh/soh/OTRGlobals.cpp | 9 ++++----- soh/soh/ResourceManagerHelpers.cpp | 11 ++--------- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/soh/soh/OTRGlobals.cpp b/soh/soh/OTRGlobals.cpp index 6e64d55ad..06eb4fa6b 100644 --- a/soh/soh/OTRGlobals.cpp +++ b/soh/soh/OTRGlobals.cpp @@ -554,7 +554,7 @@ void OTRAudio_Thread() { extern "C" void OTRAudio_Init() { // Precache all our samples, sequences, etc... - ResourceMgr_LoadDirectory("audio"); + ResourceMgr_LoadDirectory("audio/*"); if (!audio.running) { audio.running = true; @@ -1133,11 +1133,9 @@ extern "C" void InitOTR() { OTRGlobals::Instance = new OTRGlobals(); - ResourceMgr_LoadPersistentAltAssets(); CustomMessageManager::Instance = new CustomMessageManager(); ItemTableManager::Instance = new ItemTableManager(); GameInteractor::Instance = new GameInteractor(); - ResourceMgr_RegisterHooks(); SaveManager::Instance = new SaveManager(); std::shared_ptr conf = OTRGlobals::Instance->context->GetConfig(); @@ -1168,6 +1166,9 @@ extern "C" void InitOTR() { OTRMessage_Init(); OTRAudio_Init(); + ResourceMgr_Init(); + ResourceMgr_RegisterHooks(); + ResourceMgr_LoadPersistentAltAssets(); OTRExtScanner(); VanillaItemTable_Init(); DebugConsole_Init(); @@ -1200,8 +1201,6 @@ extern "C" void InitOTR() { Sail::Instance->Enable(); } #endif - - ResourceMgr_Init(); } extern "C" void SaveManager_ThreadPoolWait() { diff --git a/soh/soh/ResourceManagerHelpers.cpp b/soh/soh/ResourceManagerHelpers.cpp index 547c0f554..53a281ed2 100644 --- a/soh/soh/ResourceManagerHelpers.cpp +++ b/soh/soh/ResourceManagerHelpers.cpp @@ -591,12 +591,11 @@ extern "C" void ResourceMgr_UnloadSceneAssets() { 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 - static std::list textureIncludes = {"audio/fonts/00_Sound_Effects_1", "audio/fonts/00_Sound_Effects_2", - "audio/*", "textures/*", "overlays/*", "code/*", "misc/*", "text/*", "objects/*", "scenes/*", + static std::list textureIncludes = { "textures/*", "overlays/*", "code/*", "misc/*", "text/*", "objects/*", "scenes/*", "alt/textures/parameter*", "alt/textures/icon*", "alt/textures/item*", "alt/textures/font*", "alt/objects/gameplay_*", "alt/overlays/*", "alt/code/*", "alt/textures/*", }; - static std::list textureExcludes = { "alt/textures/vr_holy*", "alt/textures/vr_cloud*", "alt/textures/vr_fine*" }; + static std::list textureExcludes = { "alt/textures/vr_holy*", "alt/textures/vr_cloud*", "alt/textures/vr_fine*", "textures/buttons/*" }; Ship::Context::GetInstance()->GetResourceManager()->LoadResourcesAsync({textureIncludes, textureExcludes, 0, nullptr}); } @@ -638,16 +637,10 @@ extern "C" void ResourceMgr_LoadPersistentAltAssets() { ResourceLoadDirectoryAsync("alt/scenes/*/spot00*"); // Title logos ResourceLoadDirectoryAsync("alt/objects/object_mag/*"); - // Title screen music - Ship::Context::GetInstance()->GetResourceManager()->LoadResourceAsync("audio/sequences/030_Title_Theme"); - Ship::Context::GetInstance()->GetResourceManager()->LoadResourceAsync("audio/fonts/06_Title_Theme"); } else if (skipTitle && fastFile == 4) { Ship::Context::GetInstance()->GetResourceManager()->LoadResourcesAsync({ {"alt/overlays/ovl_file_choose/*", "alt/textures/title_static/*", "alt/objects/gameplay_keep/*", "alt/textures/vr_fine3*", "alt/textures/vr_fine0*"}, {}, 0, nullptr}); - // File Select music - Ship::Context::GetInstance()->GetResourceManager()->LoadResourceAsync("audio/sequences/087_File_Select"); - Ship::Context::GetInstance()->GetResourceManager()->LoadResourceAsync("audio/fonts/09_Fairy_Fountain"); } else if (skipTitle && fastFile < 3) { ResourceLoadDirectoryAsync("alt/textures/icon*"); ResourceLoadDirectoryAsync("alt/textures/do_action_static/*");