Add some commands
This commit is contained in:
parent
c1e2a29ee2
commit
452670256c
@ -26,6 +26,7 @@ namespace fastfiles
|
|||||||
utils::hook::detour db_find_xasset_header_hook;
|
utils::hook::detour db_find_xasset_header_hook;
|
||||||
|
|
||||||
game::dvar_t* g_dump_scripts;
|
game::dvar_t* g_dump_scripts;
|
||||||
|
game::dvar_t* db_print_default_assets;
|
||||||
|
|
||||||
std::vector<HANDLE> fastfile_handles;
|
std::vector<HANDLE> fastfile_handles;
|
||||||
bool is_mod_pre_gfx = false;
|
bool is_mod_pre_gfx = false;
|
||||||
@ -87,6 +88,12 @@ namespace fastfiles
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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",
|
||||||
|
diff, name, game::g_assetNames[type]);
|
||||||
|
}
|
||||||
|
|
||||||
if (diff > 100)
|
if (diff > 100)
|
||||||
{
|
{
|
||||||
console::print(
|
console::print(
|
||||||
@ -1078,6 +1085,9 @@ namespace fastfiles
|
|||||||
db_unload_x_zones_hook.create(SELECT_VALUE(0x1F6040_b,
|
db_unload_x_zones_hook.create(SELECT_VALUE(0x1F6040_b,
|
||||||
0x39B3C0_b), db_unload_x_zones_stub);
|
0x39B3C0_b), db_unload_x_zones_stub);
|
||||||
|
|
||||||
|
db_print_default_assets = dvars::register_bool("db_printDefaultAssets",
|
||||||
|
false, game::DVAR_FLAG_SAVED, "Print default asset usage");
|
||||||
|
|
||||||
if (!game::environment::is_sp())
|
if (!game::environment::is_sp())
|
||||||
{
|
{
|
||||||
db_link_x_asset_entry_hook.create(0x396E80_b, db_link_x_asset_entry_stub);
|
db_link_x_asset_entry_hook.create(0x396E80_b, db_link_x_asset_entry_stub);
|
||||||
@ -1168,6 +1178,53 @@ namespace fastfiles
|
|||||||
console::warn("loadzone: zone \"%s\" could not be found!\n", name);
|
console::warn("loadzone: zone \"%s\" could not be found!\n", name);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
command::add("poolUsages", []()
|
||||||
|
{
|
||||||
|
for (auto i = 0; i < game::ASSET_TYPE_COUNT; i++)
|
||||||
|
{
|
||||||
|
auto count = 0;
|
||||||
|
enum_assets(static_cast<game::XAssetType>(i), [&](game::XAssetHeader header)
|
||||||
|
{
|
||||||
|
count++;
|
||||||
|
}, true);
|
||||||
|
|
||||||
|
console::info("%i %s: %i / %i\n", i, game::g_assetNames[i], count, game::g_poolSize[i]);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
command::add("poolUsage", [](const command::params& params)
|
||||||
|
{
|
||||||
|
if (params.size() < 2)
|
||||||
|
{
|
||||||
|
console::info("Usage: poolUsage <type>\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const auto type = static_cast<game::XAssetType>(std::atoi(params.get(1)));
|
||||||
|
|
||||||
|
auto count = 0;
|
||||||
|
enum_assets(type, [&](game::XAssetHeader header)
|
||||||
|
{
|
||||||
|
count++;
|
||||||
|
}, true);
|
||||||
|
|
||||||
|
console::info("%i %s: %i / %i\n", type, game::g_assetNames[type], count, game::g_poolSize[type]);
|
||||||
|
});
|
||||||
|
|
||||||
|
command::add("assetCount", [](const command::params& params)
|
||||||
|
{
|
||||||
|
auto count = 0;
|
||||||
|
for (auto i = 0; i < game::ASSET_TYPE_COUNT; i++)
|
||||||
|
{
|
||||||
|
enum_assets(static_cast<game::XAssetType>(i), [&](game::XAssetHeader header)
|
||||||
|
{
|
||||||
|
count++;
|
||||||
|
}, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
console::info("assets: %i / %i\n", count, 155000);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -300,7 +300,7 @@ namespace game
|
|||||||
|
|
||||||
WEAK symbol<int> connectionState{0x0, 0x2EC82C8};
|
WEAK symbol<int> connectionState{0x0, 0x2EC82C8};
|
||||||
|
|
||||||
WEAK symbol<int> g_poolSize{0x0, 0x10B3C80};
|
WEAK symbol<int> g_poolSize{0xEC97D0, 0x10B3C80};
|
||||||
WEAK symbol<int> g_compressor{0x2574804, 0x3962804};
|
WEAK symbol<int> g_compressor{0x2574804, 0x3962804};
|
||||||
|
|
||||||
WEAK symbol<scrVarGlob_t> scr_VarGlob{0xBD80E00, 0xB138180};
|
WEAK symbol<scrVarGlob_t> scr_VarGlob{0xBD80E00, 0xB138180};
|
||||||
|
Loading…
Reference in New Issue
Block a user