MaterialSystem: add pak load for startup_sdk.rpak

Allow the startup_sdk.rpak file to be loaded directly after startup.rpak, while also offering the ability to patch assets in startup.rpak.
This commit is contained in:
Kawe Mazidjatari 2025-02-04 17:51:34 +01:00
parent eaf313ab7a
commit 27285fc087

View File

@ -47,10 +47,10 @@ static bool s_useLowLatency = false;
InitReturnVal_t CMaterialSystem::Init(CMaterialSystem* thisptr) InitReturnVal_t CMaterialSystem::Init(CMaterialSystem* thisptr)
{ {
#ifdef MATERIALSYSTEM_NODX #ifdef MATERIALSYSTEM_NODX
// Only load the 'startup.rpak' file, as 'common_early.rpak' has assets // Only load the startup pak files, as 'common_early.rpak' has assets
// that references assets in 'startup.rpak'. // that references assets in 'startup.rpak'.
const PakHandle_t pakHandle = g_pakLoadApi->LoadAsync("startup.rpak", AlignedMemAlloc(), 5, 0); g_pakLoadApi->LoadAsyncAndWait("startup.rpak", AlignedMemAlloc(), 5, 0);
g_pakLoadApi->WaitForAsyncLoad(pakHandle, nullptr); g_pakLoadApi->LoadAsyncAndWait("startup_sdk.rpak", AlignedMemAlloc(), 5, 0);
// Trick: return INIT_FAILED to disable the loading of hardware // Trick: return INIT_FAILED to disable the loading of hardware
// configuration data, since we don't need it on the dedi. // configuration data, since we don't need it on the dedi.
@ -71,7 +71,14 @@ InitReturnVal_t CMaterialSystem::Init(CMaterialSystem* thisptr)
g_PCLStatsAvailable = true; g_PCLStatsAvailable = true;
} }
return CMaterialSystem__Init(thisptr); const InitReturnVal_t result = CMaterialSystem__Init(thisptr);
// Must be loaded after the call to CMaterialSystem::Init() as we want
// to load startup_sdk.rpak after startup.rpak. This pak file can be
// used to load paks as early as startup.rpak, while still offering the
// ability to patch/update its containing assets on time.
g_pakLoadApi->LoadAsyncAndWait("startup_sdk.rpak", AlignedMemAlloc(), 5, 0);
return result;
#endif #endif
} }