From 2f21d655e6d5b37f52cf83dc9b7088edd7e92c78 Mon Sep 17 00:00:00 2001 From: quaK <38787176+Joelrau@users.noreply.github.com> Date: Thu, 10 Nov 2022 21:56:35 +0200 Subject: [PATCH] use override rawfiles if found --- src/client/component/fastfiles.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/client/component/fastfiles.cpp b/src/client/component/fastfiles.cpp index 0dcbf4aa..260f6321 100644 --- a/src/client/component/fastfiles.cpp +++ b/src/client/component/fastfiles.cpp @@ -60,7 +60,7 @@ namespace fastfiles game::XAssetHeader db_find_xasset_header_stub(game::XAssetType type, const char* name, int allow_create_default) { const auto start = game::Sys_Milliseconds(); - const auto result = db_find_xasset_header_hook.invoke(type, name, allow_create_default); + auto result = db_find_xasset_header_hook.invoke(type, name, allow_create_default); const auto diff = game::Sys_Milliseconds() - start; if (type == game::XAssetType::ASSET_TYPE_SCRIPTFILE) @@ -68,6 +68,20 @@ namespace fastfiles dump_gsc_script(name, result); } + if (type == game::XAssetType::ASSET_TYPE_RAWFILE) + { + if (result.rawfile) + { + const std::string override_rawfile_name = "override/"s + name; + const auto override_rawfile = db_find_xasset_header_hook.invoke(type, override_rawfile_name.data(), 0); + if (override_rawfile.rawfile) + { + result.rawfile = override_rawfile.rawfile; + console::debug("using override asset for rawfile: \"%s\"\n", name); + } + } + } + if (diff > 100) { console::print(