diff options
author | BobTheBob <for.oliver.kirkham@gmail.com> | 2023-03-07 15:03:16 +0000 |
---|---|---|
committer | BobTheBob <for.oliver.kirkham@gmail.com> | 2023-03-07 15:03:16 +0000 |
commit | 946ab08b068c4d0b575724bb2c038f4a87f80b73 (patch) | |
tree | a02f3e941ff5804644c5ba6c2b4a8e6fad076b18 | |
parent | c6fdbc83b74a57bac91372f028f2dd9b8b74ffd6 (diff) | |
download | NorthstarLauncher-946ab08b068c4d0b575724bb2c038f4a87f80b73.tar.gz NorthstarLauncher-946ab08b068c4d0b575724bb2c038f4a87f80b73.zip |
clear datatable cache
-rw-r--r-- | NorthstarDLL/mods/modmanager.cpp | 8 | ||||
-rw-r--r-- | NorthstarDLL/scripts/scriptdatatables.cpp | 6 |
2 files changed, 9 insertions, 5 deletions
diff --git a/NorthstarDLL/mods/modmanager.cpp b/NorthstarDLL/mods/modmanager.cpp index 0af73e04..c4f30386 100644 --- a/NorthstarDLL/mods/modmanager.cpp +++ b/NorthstarDLL/mods/modmanager.cpp @@ -1016,14 +1016,12 @@ void ModManager::ReloadNecessaryModAssets(bool bDeferred, const ModAssetsToReloa if (pAssetsToReload->bAimAssistSettings) vReloadCommands.push_back("ReloadAimAssistSettings"); + if (pAssetsToReload->bDatatables) + vReloadCommands.push_back("ns_cleardatatablecache"); + if (pAssetsToReload->bModels) spdlog::warn("Need to reload models but can't without a restart!"); - if (pAssetsToReload->bDatatables) - { - // TODO: clear disk datatable cache in scriptdatatables.cpp - } - // deferred - load files using engine functions where possible, on level load if (bDeferred) { diff --git a/NorthstarDLL/scripts/scriptdatatables.cpp b/NorthstarDLL/scripts/scriptdatatables.cpp index b050ff8d..94cfbf7f 100644 --- a/NorthstarDLL/scripts/scriptdatatables.cpp +++ b/NorthstarDLL/scripts/scriptdatatables.cpp @@ -885,6 +885,11 @@ void ConCommand_dump_datatables(const CCommand& args) DumpDatatable(datatable); } +void ConCommand_ns_cleardatatablecache(const CCommand& args) +{ + CSVCache.clear(); +} + ON_DLL_LOAD_RELIESON("server.dll", ServerScriptDatatables, ServerSquirrel, (CModule module)) { SQ_GetDatatableInternal<ScriptContext::SERVER> = module.Offset(0x1250f0).As<Datatable* (*)(HSquirrelVM*)>(); @@ -906,4 +911,5 @@ ON_DLL_LOAD_RELIESON("engine.dll", SharedScriptDataTables, ConVar, (CModule modu RegisterConCommand("dump_datatables", ConCommand_dump_datatables, "dumps all datatables from a hardcoded list", FCVAR_NONE); RegisterConCommand("dump_datatable", ConCommand_dump_datatable, "dump a datatable", FCVAR_NONE); + RegisterConCommand("ns_cleardatatablecache", ConCommand_ns_cleardatatablecache, "clears script datatable cache", FCVAR_NONE); } |