diff --git a/src/client/component/fastfiles.cpp b/src/client/component/fastfiles.cpp index c6ac7e2b..15ad4e29 100644 --- a/src/client/component/fastfiles.cpp +++ b/src/client/component/fastfiles.cpp @@ -30,7 +30,7 @@ namespace fastfiles }; utils::hook::detour db_try_load_x_file_internal_hook; - utils::hook::detour db_find_xasset_header; + utils::hook::detour db_find_xasset_header_hook; utils::hook::detour load_xasset_header_hook; utils::hook::detour db_unload_x_zones_hook; @@ -47,9 +47,20 @@ 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.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 (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 (db_print_default_assets->current.enabled && game::DB_IsXAssetDefault(type, name)) { console::warn("Waited %i msec for default asset \"%s\" of type \"%s\"\n", @@ -450,6 +461,7 @@ namespace fastfiles reallocate_asset_pool_multiplier(); reallocate_asset_pool_multiplier(); reallocate_asset_pool_multiplier(); + reallocate_asset_pool_multiplier(); } void add_custom_level_load_zone(game::LevelLoad* load, const std::string& name, const size_t size_est) @@ -661,7 +673,7 @@ namespace fastfiles false, game::DVAR_FLAG_NONE, "Print asset types being loaded"); db_try_load_x_file_internal_hook.create(0x1404173B0, db_try_load_x_file_internal); - db_find_xasset_header.create(game::DB_FindXAssetHeader, db_find_xasset_header_stub); + db_find_xasset_header_hook.create(game::DB_FindXAssetHeader, db_find_xasset_header_stub); db_unload_x_zones_hook.create(0x140417D80, db_unload_x_zones_stub);