aboutsummaryrefslogtreecommitdiff
path: root/primedev/scripts/scriptdatatables.cpp
diff options
context:
space:
mode:
authorJack <66967891+ASpoonPlaysGames@users.noreply.github.com>2024-09-07 21:10:28 +0100
committerGitHub <noreply@github.com>2024-09-07 22:10:28 +0200
commit160f503bc81bffdef6dbaa16eec7c73fccef0eee (patch)
tree8d92b3ad01cd8b17f456e997126bfe44430d5044 /primedev/scripts/scriptdatatables.cpp
parentdab57649caef0f2bea82d5cd2a7d4729e4b0bd19 (diff)
downloadNorthstarLauncher-160f503bc81bffdef6dbaa16eec7c73fccef0eee.tar.gz
NorthstarLauncher-160f503bc81bffdef6dbaa16eec7c73fccef0eee.zip
Big rpak loading refactor (#766)v1.28.0-rc3v1.28.0-rc2
This reworks how rpaks are loaded, unloaded and tracked. It allows for rpak reloading between map loads, meaning that skins and map overhauls could be enabled and disabled on the fly. Previous methods of loading rpaks still work.
Diffstat (limited to 'primedev/scripts/scriptdatatables.cpp')
-rw-r--r--primedev/scripts/scriptdatatables.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/primedev/scripts/scriptdatatables.cpp b/primedev/scripts/scriptdatatables.cpp
index c91e16ff..b3c59921 100644
--- a/primedev/scripts/scriptdatatables.cpp
+++ b/primedev/scripts/scriptdatatables.cpp
@@ -70,10 +70,11 @@ REPLACE_SQFUNC(GetDataTable, (ScriptContext::UI | ScriptContext::CLIENT | Script
g_pSquirrel<context>->raiseerror(sqvm, fmt::format("Asset \"{}\" doesn't start with \"datatable/\"", pAssetName).c_str());
return SQRESULT_ERROR;
}
- else if (!Cvar_ns_prefer_datatable_from_disk->GetBool() && g_pPakLoadManager->LoadFile(pAssetName))
+ else if (!Cvar_ns_prefer_datatable_from_disk->GetBool() && g_pPakLoadManager->OpenFile(pAssetName))
+ {
return g_pSquirrel<context>->m_funcOriginals["GetDataTable"](sqvm);
- // either we prefer disk datatables, or we're loading a datatable that wasn't found in rpak
- else
+ }
+ else // either we prefer disk datatables, or we're loading a datatable that wasn't found in rpak
{
std::string sAssetPath(fmt::format("scripts/{}", pAssetName));
@@ -223,7 +224,7 @@ REPLACE_SQFUNC(GetDataTable, (ScriptContext::UI | ScriptContext::CLIENT | Script
return SQRESULT_NOTNULL;
}
// the file doesn't exist on disk, check rpak if we haven't already
- else if (Cvar_ns_prefer_datatable_from_disk->GetBool() && g_pPakLoadManager->LoadFile(pAssetName))
+ else if (Cvar_ns_prefer_datatable_from_disk->GetBool() && g_pPakLoadManager->OpenFile(pAssetName))
return g_pSquirrel<context>->m_funcOriginals["GetDataTable"](sqvm);
// the file doesn't exist at all, error
else
@@ -750,7 +751,7 @@ std::string DataTableToString(Datatable* datatable)
void DumpDatatable(const char* pDatatablePath)
{
- Datatable* pDatatable = (Datatable*)g_pPakLoadManager->LoadFile(pDatatablePath);
+ Datatable* pDatatable = (Datatable*)g_pPakLoadManager->OpenFile(pDatatablePath);
if (!pDatatable)
{
spdlog::error("couldn't load datatable {} (rpak containing it may not be loaded?)", pDatatablePath);