use override rawfiles if found

This commit is contained in:
quaK 2022-11-10 21:56:35 +02:00
parent 4542b97a96
commit 2f21d655e6

View File

@ -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<game::XAssetHeader>(type, name, allow_create_default);
auto result = db_find_xasset_header_hook.invoke<game::XAssetHeader>(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<game::XAssetHeader>(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(