stringtable overriding

This commit is contained in:
m 2023-07-10 15:49:36 -05:00
parent 83f8faa838
commit 86810f7b87

View File

@ -74,12 +74,13 @@ namespace fastfiles
dump_gsc_script(name, result);
}
const std::string override_asset_name = "override/"s + name;
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);
const auto override_rawfile = db_find_xasset_header_hook.invoke<game::XAssetHeader>(type, override_asset_name.data(), 0);
if (override_rawfile.rawfile)
{
result.rawfile = override_rawfile.rawfile;
@ -88,6 +89,19 @@ namespace fastfiles
}
}
if (type == game::XAssetType::ASSET_TYPE_STRINGTABLE)
{
if (result.stringTable)
{
const auto override_stringtable = db_find_xasset_header_hook.invoke<game::XAssetHeader>(type, override_asset_name.data(), 0);
if (override_stringtable.stringTable)
{
result.stringTable = override_stringtable.stringTable;
console::debug("using override asset for stringtable: \"%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",