Add db_printLoadedAssets

This commit is contained in:
fed 2022-11-11 21:18:58 +01:00
parent d5cac5ffc5
commit 02b3dd1493
2 changed files with 26 additions and 5 deletions

View File

@ -18,6 +18,7 @@ namespace fastfiles
namespace
{
game::dvar_t* db_print_default_assets = nullptr;
game::dvar_t* db_print_loaded_assets = nullptr;
template <size_t Bits>
struct bit_array
@ -27,6 +28,7 @@ namespace fastfiles
utils::hook::detour db_try_load_x_file_internal_hook;
utils::hook::detour db_find_xasset_header;
utils::hook::detour load_xasset_header_hook;
void db_try_load_x_file_internal(const char* zone_name, const int flags)
{
@ -468,6 +470,18 @@ namespace fastfiles
console::warn("No aipaths found for this map\n");
}
}
void load_xasset_header_stub(void* a1)
{
if (db_print_loaded_assets->current.enabled)
{
const auto type = **reinterpret_cast<int**>(0x14224F608);
const auto type_name = game::g_assetNames[type];
console::info("Loading asset type \"%s\"\n", type_name);
}
load_xasset_header_hook.invoke<void>(a1);
}
}
bool exists(const std::string& zone)
@ -515,6 +529,9 @@ namespace fastfiles
db_print_default_assets = dvars::register_bool("db_printDefaultAssets",
false, game::DVAR_FLAG_SAVED, "Print default asset usage");
db_print_loaded_assets = dvars::register_bool("db_printLoadedAssets",
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);
@ -549,6 +566,8 @@ namespace fastfiles
// Don't sys_error if aipaths are missing
utils::hook::call(0x140522299, db_find_aipaths_stub);
load_xasset_header_hook.create(0x140400790, load_xasset_header_stub);
command::add("loadzone", [](const command::params& params)
{
if (params.size() < 2)

View File

@ -20,8 +20,10 @@ namespace renderer
{
switch (dvars::r_fullbright->current.integer)
{
case 4:
return 53; // wireframe
case 3:
return 3;
return 3; // debug
case 2:
return 13;
default:
@ -32,9 +34,9 @@ namespace renderer
void gfxdrawmethod()
{
game::gfxDrawMethod->drawScene = game::GFX_DRAW_SCENE_STANDARD;
game::gfxDrawMethod->baseTechType = dvars::r_fullbright->current.enabled ? get_fullbright_technique() : game::TECHNIQUE_LIT;
game::gfxDrawMethod->emissiveTechType = dvars::r_fullbright->current.enabled ? get_fullbright_technique() : game::TECHNIQUE_EMISSIVE;
game::gfxDrawMethod->forceTechType = dvars::r_fullbright->current.enabled ? get_fullbright_technique() : 254;
game::gfxDrawMethod->baseTechType = dvars::r_fullbright->current.integer ? get_fullbright_technique() : game::TECHNIQUE_LIT;
game::gfxDrawMethod->emissiveTechType = dvars::r_fullbright->current.integer ? get_fullbright_technique() : game::TECHNIQUE_EMISSIVE;
game::gfxDrawMethod->forceTechType = dvars::r_fullbright->current.integer ? get_fullbright_technique() : 254;
}
void r_init_draw_method_stub()
@ -61,7 +63,7 @@ namespace renderer
public:
void post_unpack() override
{
dvars::r_fullbright = dvars::register_int("r_fullbright", 0, 0, 3, game::DVAR_FLAG_SAVED, "Fullbright method");
dvars::r_fullbright = dvars::register_int("r_fullbright", 0, 0, 4, game::DVAR_FLAG_SAVED, "Fullbright method");
r_init_draw_method_hook.create(0x14072F950, &r_init_draw_method_stub);
r_update_front_end_dvar_options_hook.create(0x14076EE70, &r_update_front_end_dvar_options_stub);