From 946ab08b068c4d0b575724bb2c038f4a87f80b73 Mon Sep 17 00:00:00 2001 From: BobTheBob Date: Tue, 7 Mar 2023 15:03:16 +0000 Subject: clear datatable cache --- NorthstarDLL/mods/modmanager.cpp | 8 +++----- 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 = module.Offset(0x1250f0).As(); @@ -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); } -- cgit v1.2.3