From 2ea90da2681bed108bd376e7afc5630c588bbe79 Mon Sep 17 00:00:00 2001 From: xoxor4d Date: Fri, 16 Feb 2024 22:21:23 +0100 Subject: [PATCH] a little code cleanup --- src/components/loader.cpp | 2 - src/components/loader.hpp | 4 +- src/components/modules/_client.cpp | 15 -- src/components/modules/_common.cpp | 28 +-- src/components/modules/_ggame.cpp | 2 +- src/components/modules/_map.cpp | 2 +- src/components/modules/_renderer.cpp | 169 ++++++------------ src/components/modules/_ui.cpp | 132 ++++++-------- src/components/modules/gui.cpp | 35 ++-- src/components/modules/movement.cpp | 2 +- src/components/modules/patches.cpp | 43 ++--- src/components/modules/rtx/rtx.cpp | 127 +------------ .../modules/rtx/rtx_fixed_function.cpp | 3 +- src/game/dvars.cpp | 3 - src/game/dvars.hpp | 3 - src/main.cpp | 2 - 16 files changed, 157 insertions(+), 415 deletions(-) diff --git a/src/components/loader.cpp b/src/components/loader.cpp index 43ff417..ac13397 100644 --- a/src/components/loader.cpp +++ b/src/components/loader.cpp @@ -8,8 +8,6 @@ namespace components std::vector loader::components_; utils::memory::allocator loader::component_allocator_; - #define USE_MODULE(name, state) active.##name = state - void loader::initialize_() { loader::component_allocator_.clear(); diff --git a/src/components/loader.hpp b/src/components/loader.hpp index 958845b..54676da 100644 --- a/src/components/loader.hpp +++ b/src/components/loader.hpp @@ -53,7 +53,7 @@ namespace components public: component() = default; virtual ~component() = default; - virtual const char* get_name() { return "unknown"; }; + virtual const char* get_name() { return "unknown"; } }; class loader @@ -61,7 +61,7 @@ namespace components public: static void initialize_(); static void uninitialize_(); - static void register_(component* component);//, bool& registered); + static void register_(component* component); static bool is_registered(const char *componentName); static utils::memory::allocator* get_alloctor(); diff --git a/src/components/modules/_client.cpp b/src/components/modules/_client.cpp index 5e53729..37037de 100644 --- a/src/components/modules/_client.cpp +++ b/src/components/modules/_client.cpp @@ -4,21 +4,6 @@ namespace components { void on_disconnect() { - /*if (Components::active.Mvm) - { - const auto& cl_avidemo = Game::Dvar_FindVar("cl_avidemo"); - - if (cl_avidemo && cl_avidemo->current.integer) - { - Game::Dvar_SetValue(cl_avidemo, 0); - } - - if (dvars::cl_avidemo_streams && dvars::cl_avidemo_streams->current.integer) - { - Game::Dvar_SetValue(dvars::cl_avidemo_streams, 0); - } - }*/ - game::glob::mainmenu_fade_done = false; game::glob::loaded_main_menu = false; diff --git a/src/components/modules/_common.cpp b/src/components/modules/_common.cpp index 45ca112..7b62840 100644 --- a/src/components/modules/_common.cpp +++ b/src/components/modules/_common.cpp @@ -110,7 +110,7 @@ namespace components call force_dvars_on_init; popad; - mov ecx, 0Ch; // overwritten op + mov ecx, 0xC; // overwritten op jmp retn_addr; } } @@ -121,7 +121,7 @@ namespace components const static uint32_t retn_addr = 0x56B3A1; __asm { - movzx eax, word ptr[edi + 8]; // overwritten op + movzx eax, word ptr [edi + 8]; // overwritten op jmp retn_addr; } } @@ -162,7 +162,7 @@ namespace components // --------------------------------------------------------------------------------------------------------- // if addon_menu loading is enabled - if (FF_LOAD_ADDON_MENU) + if constexpr (FF_LOAD_ADDON_MENU) { // if the fastfile exists if (FF_ADDON_MENU_NAME && game::DB_FileExists(FF_ADDON_MENU_NAME, game::DB_FILE_EXISTS_PATH::DB_PATH_ZONE)) @@ -190,7 +190,7 @@ namespace components } // if addon_menu loading is enabled and file not found - else if (FF_LOAD_ADDON_MENU) + else if constexpr (FF_LOAD_ADDON_MENU) { game::Com_PrintMessage(0, utils::va("^1DB_LoadCommonFastFiles^7:: %s.ff not found. \n", FF_ADDON_MENU_NAME), 0); } @@ -246,7 +246,7 @@ namespace components // ------------------------------------ // load user addon zone - if (FF_LOAD_ADDON_OPT) + if constexpr (FF_LOAD_ADDON_OPT) { // custom addon file if (game::DB_FileExists(FF_ADDON_OPT_NAME, game::DB_FILE_EXISTS_PATH::DB_PATH_ZONE)) @@ -274,7 +274,7 @@ namespace components } // load required addon fastfile last, if addon_required loading enabled - if (FF_LOAD_ADDON_REQ) + if constexpr (FF_LOAD_ADDON_REQ) { // if the fastfile exists if (FF_ADDON_REQ_NAME && game::DB_FileExists(FF_ADDON_REQ_NAME, game::DB_FILE_EXISTS_PATH::DB_PATH_ZONE)) @@ -307,7 +307,7 @@ namespace components game::XZoneInfo XZoneInfoStack[2]; // if addon menu loading is enabled - if (FF_LOAD_ADDON_MENU) + if constexpr (FF_LOAD_ADDON_MENU) { // if the fastfile exists if (FF_ADDON_MENU_NAME && game::DB_FileExists(FF_ADDON_MENU_NAME, game::DB_FILE_EXISTS_PATH::DB_PATH_ZONE)) @@ -325,7 +325,7 @@ namespace components } // if addon menu loading is enabled and file not found - else if (FF_LOAD_ADDON_MENU) + else if constexpr (FF_LOAD_ADDON_MENU) { game::Com_PrintMessage(0, utils::va("^1Com_StartHunkUsers^7:: %s.ff not found. \n", FF_ADDON_MENU_NAME), 0); } @@ -407,7 +407,7 @@ namespace components MATCH: mov ebx, [ebp - 4]; // whatever df that is mov [ebp - 8], 1; // set qLocalized to true ;) - mov [ebp - 0Ch], esi; // whatever df that is + mov [ebp - 0xC], esi; // whatever df that is jmp retn_addr; } } @@ -419,7 +419,7 @@ namespace components void _common::db_realloc_entry_pool() { const size_t ALLOC_SIZE = 789312; - game::XAssetEntry* entry_pool = utils::memory::get_allocator()->allocate_array(ALLOC_SIZE); + const auto entry_pool = utils::memory::get_allocator()->allocate_array(ALLOC_SIZE); // Apply new size utils::hook::set(0x488F50, ALLOC_SIZE); @@ -434,9 +434,9 @@ namespace components 0x48B4A4, 0x48B4F8 }; - for (int i = 0; i < ARRAYSIZE(asset_entry_pool_patches); ++i) + for (const auto addr : asset_entry_pool_patches) { - utils::hook::set(asset_entry_pool_patches[i], entry_pool); + utils::hook::set(addr, entry_pool); } utils::hook::set(0x488F31, entry_pool + 1); @@ -520,10 +520,10 @@ namespace components } game::XZoneInfo info[2]; - std::string zone = params[1]; + const std::string zone = params[1]; // unload - info[0].name = 0; + info[0].name = nullptr; info[0].allocFlags = game::XZONE_FLAGS::XZONE_ZERO; info[0].freeFlags = game::XZONE_FLAGS::XZONE_MOD; diff --git a/src/components/modules/_ggame.cpp b/src/components/modules/_ggame.cpp index 15ba2ca..2b3ad48 100644 --- a/src/components/modules/_ggame.cpp +++ b/src/components/modules/_ggame.cpp @@ -23,7 +23,7 @@ namespace components bool _ggame::get_entity_token(char* buffer, int buffer_size) { - char* s = game::Com_Parse(&game::g_entityBeginParsePoint); + const char* s = game::Com_Parse(&game::g_entityBeginParsePoint); utils::q_strncpyz(buffer, s, buffer_size); if (!game::g_entityBeginParsePoint) diff --git a/src/components/modules/_map.cpp b/src/components/modules/_map.cpp index 3135738..2bd5152 100644 --- a/src/components/modules/_map.cpp +++ b/src/components/modules/_map.cpp @@ -37,7 +37,7 @@ namespace components { // overwritten op's add esp, 8; - and esi, 0FFFFFFF0h; + and esi, 0xFFFFFFF0; call _map::on_load; jmp retn_addr; diff --git a/src/components/modules/_renderer.cpp b/src/components/modules/_renderer.cpp index 19cd994..74b6ae3 100644 --- a/src/components/modules/_renderer.cpp +++ b/src/components/modules/_renderer.cpp @@ -1,14 +1,5 @@ #include "std_include.hpp" -//#define RELOC_GFX_SURFS_BUFFER - -// BACKUP -//#define GFX_SKINNED_CACHE_VB_POOL_SIZE 0x2000000 // stock : 0x480000 : gfxBuf.skinnedCacheVbPool -//#define GFX_SMODEL_CACHE_VB_SIZE 0x1400000 // stock : 0x800000 : gfxBuf.smodelCacheVb -//#define GFX_SMODEL_CACHE_SIZE 0x250000 // stock : 0x100000 : gfxBuf.smodelCache -//#define GFX_DYN_IB_POOL_SIZE 0x250000 // stock : 0x100000 : gfxBuf.dynamicIndexBufferPool -//#define GFX_PRETESS_IB_POOL_SIZE GFX_DYN_IB_POOL_SIZE // stock : 0x100000 : gfxBuf.preTessIndexBufferPool - namespace components { /* ---------------------------------------------------------- */ @@ -20,10 +11,8 @@ namespace components { return game::glob::d3d9_device; } - else - { - return *game::dx9_device_ptr; - } + + return *game::dx9_device_ptr; } // R_AllocDynamicIndexBuffer @@ -33,9 +22,9 @@ namespace components { return 0; } - - HRESULT hr = get_d3d_device()->CreateIndexBuffer(size_in_bytes, (D3DUSAGE_DYNAMIC | D3DUSAGE_WRITEONLY), D3DFMT_INDEX16, D3DPOOL_DEFAULT, ib, nullptr); - if (hr < 0) + + if (HRESULT hr = get_d3d_device()->CreateIndexBuffer(size_in_bytes, (D3DUSAGE_DYNAMIC | D3DUSAGE_WRITEONLY), D3DFMT_INDEX16, D3DPOOL_DEFAULT, ib, nullptr); + hr < 0) { const char* msg = utils::function(0x685F98)(hr); // R_ErrorDescription msg = utils::va("DirectX didn't create a 0x%.8x dynamic index buffer: %s\n", size_in_bytes, msg); @@ -48,24 +37,24 @@ namespace components } // R_InitDynamicIndexBufferState - void init_dynamic_index_buffer_state(game::GfxIndexBufferState* ib, int indexCount, const char* buffer_name, bool loadForRenderer) + void init_dynamic_index_buffer_state(game::GfxIndexBufferState* ib, int index_count, const char* buffer_name, bool load_for_renderer) { ib->used = 0; - ib->total = indexCount; + ib->total = index_count; - alloc_dynamic_index_buffer(&ib->buffer, 2 * indexCount, buffer_name, loadForRenderer); + alloc_dynamic_index_buffer(&ib->buffer, 2 * index_count, buffer_name, load_for_renderer); } // R_AllocDynamicVertexBuffer - char* alloc_dynamic_vertex_buffer(IDirect3DVertexBuffer9** vb, int size_in_bytes, const char* buffer_name, bool load_for_renderer) + char* alloc_dynamic_vertex_buffer(IDirect3DVertexBuffer9** vb, std::uint32_t size_in_bytes, const char* buffer_name, bool load_for_renderer) { if (!load_for_renderer) { return nullptr; } - HRESULT hr = get_d3d_device()->CreateVertexBuffer(size_in_bytes, (D3DUSAGE_DYNAMIC | D3DUSAGE_WRITEONLY), 0, D3DPOOL_DEFAULT, vb, 0); - if (hr < 0) + if (HRESULT hr = get_d3d_device()->CreateVertexBuffer(size_in_bytes, (D3DUSAGE_DYNAMIC | D3DUSAGE_WRITEONLY), 0, D3DPOOL_DEFAULT, vb, nullptr); + hr < 0) { const char* msg = utils::function(0x685F98)(hr); // R_ErrorDescription msg = utils::va("DirectX didn't create a 0x%.8x dynamic vertex buffer: %s\n", size_in_bytes, msg); @@ -78,17 +67,17 @@ namespace components } // R_InitDynamicVertexBufferState - void init_dynamic_vertex_buffer_state(game::GfxVertexBufferState* vb, int bytes, const char* buffer_name, bool load_for_renderer) + void init_dynamic_vertex_buffer_state(game::GfxVertexBufferState* vb, std::uint32_t bytes, const char* buffer_name, bool load_for_renderer) { vb->used = 0; - vb->total = bytes; - vb->verts = 0; + vb->total = static_cast(bytes); + vb->verts = nullptr; alloc_dynamic_vertex_buffer(&vb->buffer, bytes, buffer_name, load_for_renderer); } // R_InitTempSkinBuf :: Temp skin buffer within backenddata - void init_temp_skin_buf(int bytes) + void init_temp_skin_buf(std::uint32_t bytes) { auto* back_end_data = reinterpret_cast(0xCC9F600); @@ -139,32 +128,21 @@ namespace components } - for (auto i = 0; i != 1; ++i) - { - init_dynamic_vertex_buffer_state(&gfx_buf.dynamicVertexBufferPool[i], dynamic_vb_size, "dynamicVertexBufferPool", r_loadForRenderer); - } + init_dynamic_vertex_buffer_state(&gfx_buf.dynamicVertexBufferPool[0], dynamic_vb_size, "dynamicVertexBufferPool", r_loadForRenderer); gfx_buf.dynamicVertexBuffer = gfx_buf.dynamicVertexBufferPool; - for (auto i = 0; i != 2; ++i) - { - init_dynamic_vertex_buffer_state(&gfx_buf.skinnedCacheVbPool[i], skinned_cache_size, "skinnedCacheVbPool", r_loadForRenderer); - } - + init_dynamic_vertex_buffer_state(&gfx_buf.skinnedCacheVbPool[0], skinned_cache_size, "skinnedCacheVbPool", r_loadForRenderer); + init_dynamic_vertex_buffer_state(&gfx_buf.skinnedCacheVbPool[1], skinned_cache_size, "skinnedCacheVbPool", r_loadForRenderer); init_temp_skin_buf(temp_skin_size); - for (auto i = 0; i != 1; ++i) - { - init_dynamic_index_buffer_state(&gfx_buf.dynamicIndexBufferPool[i], dynamic_ib_size, "dynamicIndexBufferPool", r_loadForRenderer); - } + init_dynamic_index_buffer_state(&gfx_buf.dynamicIndexBufferPool[0], dynamic_ib_size, "dynamicIndexBufferPool", r_loadForRenderer); gfx_buf.dynamicIndexBuffer = gfx_buf.dynamicIndexBufferPool; - for (auto i = 0; i != 2; ++i) - { - init_dynamic_index_buffer_state(&gfx_buf.preTessIndexBufferPool[i], pretess_ib_size, "preTessIndexBufferPool", r_loadForRenderer); - } + init_dynamic_index_buffer_state(&gfx_buf.preTessIndexBufferPool[0], pretess_ib_size, "preTessIndexBufferPool", r_loadForRenderer); + init_dynamic_index_buffer_state(&gfx_buf.preTessIndexBufferPool[1], pretess_ib_size, "preTessIndexBufferPool", r_loadForRenderer); gfx_buf.preTessBufferFrame = 0; gfx_buf.preTessIndexBuffer = gfx_buf.preTessIndexBufferPool; } @@ -176,7 +154,6 @@ namespace components void alloc_dynamic_vertex_buffer() { auto& gfx_buf = *reinterpret_cast(0xD2B0840); - const auto& r_loadForRenderer = game::Dvar_FindVar("r_loadForRenderer")->current.enabled; // default size in bytes std::uint32_t smodel_cache_vb_size = 8 * 1048576; @@ -187,17 +164,17 @@ namespace components smodel_cache_vb_size = dvars::r_buf_smodelCacheVb->current.integer * 1048576; } - if (r_loadForRenderer) + if (const auto& r_loadForRenderer = game::Dvar_FindVar("r_loadForRenderer"); + r_loadForRenderer && r_loadForRenderer->current.enabled) { - HRESULT hr = get_d3d_device()->CreateVertexBuffer(smodel_cache_vb_size, (D3DUSAGE_DYNAMIC | D3DUSAGE_WRITEONLY), 0, D3DPOOL_DEFAULT, &gfx_buf.smodelCacheVb, 0); - if (hr < 0) + if (HRESULT hr = get_d3d_device()->CreateVertexBuffer(smodel_cache_vb_size, (D3DUSAGE_DYNAMIC | D3DUSAGE_WRITEONLY), 0, D3DPOOL_DEFAULT, &gfx_buf.smodelCacheVb, nullptr); + hr < 0) { const char* msg = utils::function(0x685F98)(hr); // R_ErrorDescription msg = utils::va("DirectX didn't create a 0x%.8x dynamic vertex buffer: %s\n", smodel_cache_vb_size, msg); utils::function(0x576A30)(msg); // Sys_Error } - game::Com_PrintMessage(0, utils::va("D3D9: Created Vertexbuffer (smodelCacheVb) of size: 0x%.8x\n", smodel_cache_vb_size), 0); } @@ -237,7 +214,7 @@ namespace components } game::Com_PrintMessage(0, utils::va("Allocated smodelCache (smodelCacheIb) of size: 0x%.8x\n", smodel_cache_ib_size), 0); - gfx_buf.smodelCache.indices = static_cast(mem_reserve); + gfx_buf.smodelCache.indices = static_cast(mem_reserve); } __declspec(naked) void init_smodel_indices_stub() @@ -390,20 +367,20 @@ namespace components // push msg // push dropType - mov eax, [esp + 8h]; // move sampler string into eax + mov eax, [esp + 0x8]; // move sampler string into eax push eax; // decreased esp by 4 - mov eax, [esp + 14h]; // move GfxCmdBufState* into eax (now at 14h) + mov eax, [esp + 0x14]; // move GfxCmdBufState* into eax (now at 14h) push eax; // GfxCmdBufState* push ebx; // GfxCmdBufSourceState* push edi; // MaterialShaderArgument* #if DEBUG - Call codesampler_error; // only dump info on debug builds + call codesampler_error; // only dump info on debug builds #endif add esp, 28; - mov eax, [esp + 14h]; - mov ecx, [esp + 24h]; + mov eax, [esp + 0x14]; + mov ecx, [esp + 0x24]; movzx esi, word ptr[edi + 2]; push eax; push ecx; @@ -423,10 +400,10 @@ namespace components // skip error and R_SetSampler add esp, 12; - mov eax, [esp + 20h]; + mov eax, [esp + 0x20]; movzx esi, word ptr[edi + 2]; push eax; - mov eax, [esp + 18h]; + mov eax, [esp + 0x18]; push ebx; push ebp; @@ -542,8 +519,6 @@ namespace components // return new material if valid, stock material otherwise void _renderer::switch_material(game::switch_material_t* swm, const char* material_name) { - - if (const auto material = game::Material_RegisterHandle(material_name, 3); material) { @@ -563,19 +538,13 @@ namespace components swm->material = swm->current_material; } - // memes - // bool rendered_scope = false; - // * // :> int R_SetMaterial(game::MaterialTechniqueType techType, game::GfxCmdBufSourceState* src, game::GfxCmdBufState* state, game::GfxDrawSurf drawSurf) { - auto& rg = *reinterpret_cast(0xCC9D150); - auto rgp = reinterpret_cast(0xCC98280); - game::switch_material_t mat = {}; - mat.current_material = rgp->sortedMaterials[(drawSurf.packed >> 29) & 0x7FF]; + mat.current_material = game::rgp->sortedMaterials[drawSurf.fields.materialSortedIndex & 2047u]; mat.current_technique = mat.current_material->techniqueSet->remappedTechniqueSet->techniques[techType]; mat.material = mat.current_material; @@ -713,7 +682,7 @@ namespace components state->technique = mat.technique; - if (!state->technique || (state->technique->flags & 1) != 0 && !rg.distortion) + if (!state->technique || (state->technique->flags & 1) != 0 && !game::rg->distortion) { return 0; } @@ -756,7 +725,7 @@ namespace components push esi; // techType call R_SetMaterial; pop esi; - add esp, 10h; + add esp, 0x10; test eax, eax; // do not return BOOL if you test 4 byte sized registers :> jz memes; @@ -876,9 +845,8 @@ namespace components // loop through all argument defs to find custom codeconsts for (auto arg = 0; arg < state->pass->perObjArgCount + state->pass->perPrimArgCount + state->pass->stableArgCount; arg++) { - const auto arg_def = &state->pass->args[arg]; - - if (arg_def && arg_def->type == 5) + if (const auto arg_def = &state->pass->args[arg]; + arg_def && arg_def->type == 5) { if (components::active.daynight_cycle) { @@ -889,22 +857,6 @@ namespace components { ocean::set_pixelshader_constants(state, arg_def); } - -#ifdef DEVGUI_XO_BLUR - // dev stuff - if (state->pass->pixelShader && !utils::q_stricmp(state->pass->pixelShader->name, "sm2_blur")) - { - float constant[4] = { game::glob::xo_blur_directions, game::glob::xo_blur_quality, game::glob::xo_blur_size, game::glob::xo_blur_alpha }; - - if (arg_def->u.codeConst.index == game::ShaderCodeConstants::CONST_SRC_CODE_FILTER_TAP_0) { - (*game::dx9_device_ptr)->SetPixelShaderConstantF(arg_def->dest, constant, 1); - } - - if (arg_def->u.codeConst.index == game::ShaderCodeConstants::CONST_SRC_CODE_MATERIAL_COLOR) { - (*game::dx9_device_ptr)->SetPixelShaderConstantF(arg_def->dest, constant, 1); - } - } -#endif } } } @@ -922,7 +874,7 @@ namespace components add esp, 8; // GfxCmdBufState - mov edx, [esp + 0Ch]; + mov edx, [esp + 0xC]; pushad; push edx; @@ -943,9 +895,8 @@ namespace components // loop through all argument defs to find custom codeconsts for (auto arg = 0; arg < state->pass->perObjArgCount + state->pass->perPrimArgCount + state->pass->stableArgCount; arg++) { - const auto arg_def = &state->pass->args[arg]; - - if (arg_def && arg_def->type == 3) + if (const auto arg_def = &state->pass->args[arg]; + arg_def && arg_def->type == 3) { if (components::active.ocean) { @@ -968,8 +919,8 @@ namespace components add esp, 8; // GfxCmdBufState - mov ecx, [esp + 8h]; - mov edx, [esp + 0Ch]; + mov ecx, [esp + 0x8]; + mov edx, [esp + 0xC]; pushad; push edx; // state @@ -1001,7 +952,7 @@ namespace components // rewrite of CG_GetViewFov() float calculate_gunfov_with_zoom(float fov_val) { - float calc_fov; + float calc_fov = 80.0f; const auto& cg_fovMin = game::Dvar_FindVar("cg_fovMin"); unsigned int offhand_index = game::cgs->predictedPlayerState.offHandIndex; @@ -1042,9 +993,9 @@ namespace components return check_flags_and_fovmin(); } - if (0.0f != game::cgs->predictedPlayerState.fWeaponPosFrac) + if (game::cgs->predictedPlayerState.fWeaponPosFrac != 0.0f) { - float ads_factor; + float ads_factor = 0.0f; if (game::cgs->playerEntity.bPositionToADS) { @@ -1053,6 +1004,7 @@ namespace components { return check_flags_and_fovmin(); } + ads_factor = w_pos_frac / weapon->fAdsZoomInFrac; } else @@ -1062,6 +1014,7 @@ namespace components { return check_flags_and_fovmin(); } + ads_factor = w_pos_frac / weapon->fAdsZoomOutFrac; } @@ -1077,7 +1030,7 @@ namespace components void set_gunfov(game::GfxViewParms* view_parms) { - if(dvars::cg_fov_tweaks && dvars::cg_fov_tweaks->current.enabled) + if (dvars::cg_fov_tweaks && dvars::cg_fov_tweaks->current.enabled) { // calc gun fov (includes weapon zoom) const float gun_fov = calculate_gunfov_with_zoom(dvars::cg_fov_gun->current.value); @@ -1107,7 +1060,7 @@ namespace components popad; // stock op's - lea ecx, [edi + 0C0h]; + lea ecx, [edi + 0xC0]; jmp retn_addr; } } @@ -1149,13 +1102,9 @@ namespace components utils::hook::set(0x4754D5 + 2, 0xB0); // end on "_dn" + 1 instead of "_bk" (6 images) utils::hook(0x47540C, cubemap_shot_f_stub, HOOK_JUMP).install()->quick(); // dvar info - - - - /* ---------------------------------------------------------- */ - static std::vector r_wireframe_enum = + static std::vector r_wireframe_enum = { "NONE", "SHADED", @@ -1186,20 +1135,6 @@ namespace components /* default */ false, /* flags */ game::dvar_flags::none); - // not in use - //dvars::r_debugShaderToggle = Game::Dvar_RegisterBool( - // /* name */ "r_debugShaderToggle", - // /* desc */ "debugging purpose", - // /* default */ false, - // /* flags */ Game::dvar_flags::none); - - //// not in use - //dvars::r_setmaterial_hk = Game::Dvar_RegisterBool( - // /* name */ "r_setmaterial_hk", - // /* desc */ "debugging purpose", - // /* default */ false, - // /* flags */ Game::dvar_flags::none); - // hook R_SetMaterial utils::hook(0x648F86, R_SetMaterial_stub, HOOK_JUMP).install()->quick(); @@ -1215,7 +1150,7 @@ namespace components utils::hook::nop(0x64BD22, 7); utils::hook(0x64BD22, R_SetVertexShaderConstantFromCode_stub, HOOK_JUMP).install()->quick(); - // seperate world and viewmodel fov + // separate world and viewmodel fov utils::hook::nop(0x5FAA05, 6); utils::hook(0x5FAA05, R_SetViewParmsForScene_stub, HOOK_JUMP).install()->quick(); diff --git a/src/components/modules/_ui.cpp b/src/components/modules/_ui.cpp index 6ed0d41..6a1b5b2 100644 --- a/src/components/modules/_ui.cpp +++ b/src/components/modules/_ui.cpp @@ -838,7 +838,7 @@ R"( call init_white_material; popad; - fld dword ptr[esp + 50h]; // stock op + fld dword ptr[esp + 0x50]; // stock op mov eax, [edi]; // stock op fadd y_offs; // stock op -- itemheight + yOffs mov ecx, [ebp + eax * 4 + 4]; // stock op @@ -846,31 +846,31 @@ R"( // material <-> color mov edx, ui_white_material; // ui white material handle - mov eax, [ebx + 18h]; // stock op - fstp dword ptr[esp + 50h]; // stock op - fld dword ptr[ebx + 10h]; // stock op - mov ecx, [ebx + 14h]; // stock op + mov eax, [ebx + 0x18]; // stock op + fstp dword ptr[esp + 0x50]; // stock op + fld dword ptr[ebx + 0x10]; // stock op + mov ecx, [ebx + 0x14]; // stock op fadd h_offs; // stock op -- h - hOffs - add esp, 1Ch; // stock op + add esp, 0x1C; // stock op push edx; // stock op -- material push eax; // stock op -- vertAlign - fstp dword ptr[esp + 20h]; // stock op + fstp dword ptr[esp + 0x20]; // stock op push ecx; // stock op -- horzAlign - fld dword ptr[esp + 24h]; // stock op - sub esp, 10h; // stock op + fld dword ptr[esp + 0x24]; // stock op + sub esp, 0x10; // stock op fadd meme2; // stock op -- new h + 1.0f mov ecx, color_ptr; // color -- was "xor ecx, ecx" // continue till we are at x mov edx, esi; // stock op -- placement - fstp dword ptr[esp + 44h]; // stock op - fld dword ptr[esp + 44h]; // stock op - fstp dword ptr[esp + 0Ch]; // stock op -- h + fstp dword ptr[esp + 0x44]; // stock op + fld dword ptr[esp + 0x44]; // stock op + fstp dword ptr[esp + 0xC]; // stock op -- h fld width; // stock op fstp dword ptr[esp + 8]; // stock op -- w - fld dword ptr[esp + 50h]; // stock op + fld dword ptr[esp + 0x50]; // stock op fstp dword ptr[esp + 4]; // stock op -- y - fld dword ptr[esp + 30h]; // stock op + fld dword ptr[esp + 0x30]; // stock op fadd x_offs; fstp dword ptr[esp]; // stock op -- x @@ -902,22 +902,22 @@ R"( // material <-> color mov edx, ui_white_material; // ui white material handle fld boxWH; // stock op - mov eax, [ebx + 18h]; // stock op - mov ecx, [ebx + 14h]; // stock op + mov eax, [ebx + 0x18]; // stock op + mov ecx, [ebx + 0x14]; // stock op push edx; // stock op -- material push eax; // stock op -- vertAlign push ecx; // stock op -- horzAlign - sub esp, 10h; // stock op + sub esp, 0x10; // stock op fadd h_offs; - fst dword ptr[esp + 0Ch]; // stock op -- h (uses boxWH) + fst dword ptr[esp + 0xC]; // stock op -- h (uses boxWH) mov ecx, color_ptr; // color -- was "xor ecx, ecx" fsub h_offs; fstp dword ptr[esp + 8]; // stock op -- w (uses boxWH) mov edx, esi; // stock op - fld dword ptr[esp + 34h]; // stock op + fld dword ptr[esp + 0x34]; // stock op fadd y_offs; fstp dword ptr[esp + 4]; // stock op -- y - fld dword ptr[esp + 30h]; // stock op + fld dword ptr[esp + 0x30]; // stock op fadd x_offs; fstp dword ptr[esp]; // stock op -- x @@ -995,7 +995,7 @@ R"( const static uint32_t if_addon_return_addr = 0x546E52; // jump to the valid return point if we had a valid match in addons __asm { - lea edx, [esp + 58h]; // 'out' arg was at 0x5C but we hooked at the push before it => 'out' arg at esp+5C - 4 ;) + lea edx, [esp + 0x58]; // 'out' arg was at 0x5C but we hooked at the push before it => 'out' arg at esp+5C - 4 ;) pushad; push edx; @@ -1020,55 +1020,55 @@ R"( const static uint32_t retn_addr = 0x54B6FA; _asm { - cmp dword ptr[ebx + 3Ch], 2; // if border 2 + cmp dword ptr[ebx + 0x3C], 2; // if border 2 je short border_2; - cmp dword ptr[ebx + 3Ch], 3; // if border 3 + cmp dword ptr[ebx + 0x3C], 3; // if border 3 je short border_3; //fix for full border - fld dword ptr[ebx + 48h]; // stock op - fadd dword ptr[esp + 10h]; // stock op - fstp dword ptr[esp + 10h]; // stock op - fld dword ptr[ebx + 48h]; // stock op - fadd dword ptr[esp + 14h]; // stock op - fstp dword ptr[esp + 14h]; // stock op - fld dword ptr[ebx + 48h]; // stock op - fld dword ptr[esp + 18h]; // stock op + fld dword ptr[ebx + 0x48]; // stock op + fadd dword ptr[esp + 0x10]; // stock op + fstp dword ptr[esp + 0x10]; // stock op + fld dword ptr[ebx + 0x48]; // stock op + fadd dword ptr[esp + 0x14]; // stock op + fstp dword ptr[esp + 0x14]; // stock op + fld dword ptr[ebx + 0x48]; // stock op + fld dword ptr[esp + 0x18]; // stock op fsub st, st(1); // stock op fsub st, st(1); - fstp dword ptr[esp + 18h]; // stock op - fsubr dword ptr[esp + 1Ch]; // subract border size (st0) from height, save in st0 - fsub dword ptr[ebx + 48h]; // subract boder size from st0 - fstp dword ptr[esp + 1Ch]; // stock op + fstp dword ptr[esp + 0x18]; // stock op + fsubr dword ptr[esp + 0x1C]; // subract border size (st0) from height, save in st0 + fsub dword ptr[ebx + 0x48]; // subract boder size from st0 + fstp dword ptr[esp + 0x1C]; // stock op jmp retn_addr; //fix for border 2 border_2: - fld dword ptr[ebx + 48h]; // load bordersize - fadd dword ptr[esp + 14h]; // add y to bordersize - fstp dword ptr[esp + 14h]; // store y, pop st0 + fld dword ptr[ebx + 0x48]; // load bordersize + fadd dword ptr[esp + 0x14]; // add y to bordersize + fstp dword ptr[esp + 0x14]; // store y, pop st0 - fld dword ptr[ebx + 48h]; // load bordersize - fsubr dword ptr[esp + 1Ch]; - fsub dword ptr[ebx + 48h]; - fstp dword ptr[esp + 1Ch]; // store width + fld dword ptr[ebx + 0x48]; // load bordersize + fsubr dword ptr[esp + 0x1C]; + fsub dword ptr[ebx + 0x48]; + fstp dword ptr[esp + 0x1C]; // store width jmp retn_addr; //fix for border 3 border_3: - fld dword ptr[ebx + 48h]; // load bordersize - fadd dword ptr[esp + 10h]; // add x to bordersize - fstp dword ptr[esp + 10h]; // store x, pop st0 - - fld dword ptr[ebx + 48h]; // load bordersize - fsubr dword ptr[esp + 18h]; - fsub dword ptr[ebx + 48h]; - fstp dword ptr[esp + 18h]; // store height + fld dword ptr[ebx + 0x48]; // load bordersize + fadd dword ptr[esp + 0x10]; // add x to bordersize + fstp dword ptr[esp + 0x10]; // store x, pop st0 + + fld dword ptr[ebx + 0x48]; // load bordersize + fsubr dword ptr[esp + 0x18]; + fsub dword ptr[ebx + 0x48]; + fstp dword ptr[esp + 0x18]; // store height jmp retn_addr; } } @@ -1078,7 +1078,7 @@ R"( { __asm { - add esp, 18h; // hook is placed on call to FS_FOpenFileReadForThread, so fix the stack + add esp, 0x18; // hook is placed on call to FS_FOpenFileReadForThread, so fix the stack xor eax, eax; // return a nullptr pop edi; // epilog @@ -1119,10 +1119,10 @@ R"( pushad; push 0; call set_ultrawide_dvar; - add esp, 4h; + add esp, 4; popad; - mov eax, [eax + 0Ch]; // overwritten op + mov eax, [eax + 0xC]; // overwritten op cmp eax, 3; // overwritten op jmp retn_addr; // jump back to break op @@ -1138,7 +1138,7 @@ R"( pushad; push 1; call set_ultrawide_dvar; - add esp, 4h; + add esp, 4; Call set_custom_aspect_ratio; popad; @@ -1157,7 +1157,7 @@ R"( std::wstring header, html; utils::get_html(url, header, html); - std::transform(html.begin(), html.end(), std::back_inserter(game::glob::changelog_html_body), [](wchar_t c) + std::ranges::transform(html.begin(), html.end(), std::back_inserter(game::glob::changelog_html_body), [](wchar_t c) { return (char)c; }); @@ -1319,26 +1319,6 @@ R"( game::Com_PrintMessage(0, "^1Not in-game\n", 0); } } - - /*if (params.length() < 2) - { - game::Com_PrintMessage(0, "Usage :: menu_open_ingame \n", 0); - return; - } - - - if (!game::ui_context) - { - game::Com_PrintMessage(0, "uiContext was null\n", 0); - return; - } - - const char* name = params[1]; - game::UiContext* ui = &game::ui_context[0]; - - game::Key_SetCatcher(); - game::Menus_CloseAll(ui); - game::Menus_OpenByName(name, ui);*/ }); @@ -1524,7 +1504,7 @@ R"( /* maxVal */ 10.0f, /* flags */ game::dvar_flags::saved); - static std::vector r_customAspectratio = + static std::vector r_customAspectratio = { "auto", "4:3", diff --git a/src/components/modules/gui.cpp b/src/components/modules/gui.cpp index bbe414f..a15a44b 100644 --- a/src/components/modules/gui.cpp +++ b/src/components/modules/gui.cpp @@ -67,7 +67,7 @@ namespace components ImFont* get_font() const override { - ImGuiIO& io = ImGui::GetIO(); + const ImGuiIO& io = ImGui::GetIO(); if (m_is_table_header) { @@ -85,15 +85,13 @@ namespace components default: return io.Fonts->Fonts[FONTS::BOLD]; } - }; - + } void open_url() const override { - ShellExecuteA(0, "open", m_href.c_str(), 0, 0, SW_SHOW); + ShellExecuteA(nullptr, "open", m_href.c_str(), nullptr, nullptr, SW_SHOW); } - bool get_image(image_info& nfo) const override { nfo.texture_id = nullptr; @@ -116,7 +114,6 @@ namespace components return true; } - void html_div(const std::string& dclass, bool e) override { if (dclass == "red") @@ -144,8 +141,8 @@ namespace components void gui::redraw_cursor() { - float cur_w = (32.0f * game::scrPlace->scaleVirtualToReal[0]) / game::scrPlace->scaleVirtualToFull[0]; - float cur_h = (32.0f * game::scrPlace->scaleVirtualToReal[1]) / game::scrPlace->scaleVirtualToFull[1]; + float cur_w = (1.0f * game::scrPlaceFull->scaleVirtualToReal[0]) / game::scrPlaceFull->scaleVirtualToFull[0]; + float cur_h = (1.0f * game::scrPlaceFull->scaleVirtualToReal[1]) / game::scrPlaceFull->scaleVirtualToFull[1]; float cur_x = game::ui_context->cursor.x - 0.5f * cur_w; float cur_y = game::ui_context->cursor.y - 0.5f * cur_h; @@ -166,18 +163,16 @@ namespace components if (const auto material = game::Material_RegisterHandle("ui_cursor", 3); material) { - const float cur_size = 54.0f; - const float offs_x = 0.0f; - const float offs_y = cur_size; - - const ImTextureID image = material->textureTable->u.image->texture.data; + const float cur_size = 74.0f; + const float offs_x = -(cur_size * 0.5f); + const float offs_y = cur_size * 0.5f; ImGui::GetWindowDrawList()->AddImageQuad( - image, - ImVec2(cur_x + offs_x, cur_y + offs_y), + material->textureTable->u.image->texture.data, + ImVec2(cur_x + offs_x, cur_y + offs_y), ImVec2(cur_x + cur_size + offs_x, cur_y + offs_y), ImVec2(cur_x + cur_size + offs_x, cur_y - cur_size + offs_y), - ImVec2(cur_x + offs_x, cur_y - cur_size + offs_y), + ImVec2(cur_x + offs_x, cur_y - cur_size + offs_y), ImVec2(0.0f, 1.0f), ImVec2(1.0f, 1.0f), ImVec2(1.0f, 0.0f), @@ -227,7 +222,7 @@ namespace components } // * - // main rendering loop (D3D9Ex::D3D9Device::EndScene()) + // main rendering loop (D3D9Device::EndScene()) void gui::render_loop() { auto& ggui = GET_GGUI; @@ -398,9 +393,9 @@ namespace components auto& ggui = GET_GGUI; const auto& cl_ingame = game::Dvar_FindVar("cl_ingame"); - for (int m = 0; m < GGUI_MENU_COUNT; m++) + for (const auto& menu : ggui.menus) { - if (ggui.menus[m].menustate) + if (menu.menustate) { // positive flag and ingame if (!ggui.any_menus_open && cl_ingame && cl_ingame->current.enabled) @@ -409,7 +404,7 @@ namespace components CMDEXEC("menu_open_ingame pregame_loaderror_mp"); } - if (ggui.menus[m].mouse_ignores_menustate) + if (menu.mouse_ignores_menustate) { ggui.any_menus_open = false; return false; diff --git a/src/components/modules/movement.cpp b/src/components/modules/movement.cpp index 4771f7d..1e88f84 100644 --- a/src/components/modules/movement.cpp +++ b/src/components/modules/movement.cpp @@ -1053,7 +1053,7 @@ namespace components if (ent->client->ps.eFlags & 0x300 || ent->client->ps.pm_flags & 0x100000) { - return *&game::g_entities[157 * ent->client->ps.viewlocked_entNum]; + return game::g_entities[ent->client->ps.viewlocked_entNum].s.number; } if (ent->client->ps.weapFlags & 2) diff --git a/src/components/modules/patches.cpp b/src/components/modules/patches.cpp index 5b1cd53..d85ebae 100644 --- a/src/components/modules/patches.cpp +++ b/src/components/modules/patches.cpp @@ -89,6 +89,16 @@ namespace components jmp retn_addr; } } + + // skip com_error func in 'AimTarget_GetTagPos' and just return the result 'false' + __declspec(naked) void AimTarget_GetTagPos_stub() + { + const static uint32_t retn_addr = 0x40251C; + __asm + { + jmp retn_addr; + } + } patches::patches() { @@ -126,6 +136,9 @@ namespace components SetThreadExecutionState(ES_DISPLAY_REQUIRED); }); + // disable Com_Error calls in 'AimTarget_GetTagPos' + utils::hook::nop(0x402507, 6); utils::hook(0x402507, AimTarget_GetTagPos_stub, HOOK_JUMP).install()->quick(); + // * // Console prints @@ -144,10 +157,6 @@ namespace components utils::hook::nop(0x4BF05B, 5); // gamename utils::hook::nop(0x4BF06C, 5); // gamedate - // 7263D4 - //utils::hook::set(0x7263D4, 0x2); - //utils::hook::set(0x7263D8, 0x2); - // * // bouncepatch stuff @@ -165,30 +174,6 @@ namespace components utils::hook::set(0x500014 + 1, 0x0); utils::hook::set(0x50007F + 1, 0x0); -#if 0 - // * - // patch shadowmap - - Game::Dvar_RegisterFloat( - /* name */ "sm_sunShadowScale", - /* desc */ "Overwritten non-cheat sm_sunShadowScale", - /* default */ 1.0f, - /* minVal */ 0.01f, - /* maxVal */ 8.0f, - /* flags */ Game::dvar_flags::none); - - Game::Dvar_RegisterFloat( - /* name */ "sm_sunSampleSizeNear", - /* desc */ "Overwritten non-cheat sm_sunSampleSizeNear", - /* default */ 0.25f, - /* minVal */ 0.0001f, - /* maxVal */ 64.0f, - /* flags */ Game::dvar_flags::none); - - // R_InitRenderTargets :: shadowmapSun rendertarget size to 2048 - //utils::hook::set(0x63082B + 2, 0x08); -#endif - command::add("xasset_spworld", "[optional] ", "creates a node_dump (sp maps only)", [this](command::params parms) { int node_array_offset = 0; @@ -212,8 +197,6 @@ namespace components } std::ofstream nodes; - - // steam to .map file nodes.open((base_path + "node_dump.txt").c_str()); nodes << "// generated by iw3xo - https://github.com/xoxor4d/iw3xo-dev \n"; diff --git a/src/components/modules/rtx/rtx.cpp b/src/components/modules/rtx/rtx.cpp index cc1af7e..bcb59d9 100644 --- a/src/components/modules/rtx/rtx.cpp +++ b/src/components/modules/rtx/rtx.cpp @@ -12,15 +12,12 @@ // * dynamic meshes (dynEnts, destr. cars and some other static meshes) are not 'static' (debug view) and create a smear effect (motion vectors) // * 'r_preTess' (surface batching) set to false + 'rtx_disable_world_culling' set to less (cull full portals only) = almost stable geo hashes -// ^ bad performance when moving the camera -> all culling turned off is more stable - -//#define STATIC_MODEL_CACHE_TEST // can be ignored namespace components { /** * @brief - send camera matrices down the fixed-function pipeline so that the remix runtime finds the camera - * - update spawned (fixed-function) debug lights + * - update fixed-function debug lights (spawned via the dev-gui) * - force certain dvar's */ void setup_rtx() @@ -619,47 +616,6 @@ namespace components jmp retn_skip; } } - -#ifdef STATIC_MODEL_CACHE_TEST - int R_GetStaticModelId_test(int smodel_index) - { - if (const auto r_smc_enable = game::Dvar_FindVar("r_smc_enable"); r_smc_enable) - { - if (r_smc_enable->current.enabled) - { - if (utils::contains(game::rgp->world->dpvs.smodelDrawInsts[smodel_index].model->name, "grass")) - { - return 0; - } - } - - return r_smc_enable->current.enabled; - } - - return 0; - } - - __declspec(naked) void R_GetStaticModelId_stub() - { - const static uint32_t disabled_addr = 0x63ABF7; - const static uint32_t enabled_addr = 0x63ABB9; - __asm - { - pushad; - push ebx; // smodelIndex - call R_GetStaticModelId_test; - add esp, 4; - cmp eax, 0; - jz loc_63ABF7; - popad; - jmp enabled_addr; - - loc_63ABF7: - popad; - jmp disabled_addr; - } - } -#endif } @@ -670,16 +626,6 @@ namespace components { // update culling vars at the end of a frame (so we don't change culling behaviour mid-frame -> not safe) { - // set world culling to 'less' once on start if culling is disabled completly - /*if (static bool set_less_culling_once = false; !set_less_culling_once) - { - if (dvars::rtx_disable_world_culling && dvars::rtx_disable_world_culling->current.integer > 1) - { - game::dvar_set_value_dirty(dvars::rtx_disable_world_culling, 1); - } - set_less_culling_once = true; - }*/ - // update world culling if (dvars::rtx_disable_world_culling) { @@ -704,72 +650,6 @@ namespace components dvars::bool_override("r_depthPrepass", false); // remix does not like this dvars::bool_override("r_zfeather", false); dvars::bool_override("r_dof_enable", false); - - // r_znear around 4 pushes viewmodel away the further from 0 0 0 we are - 4.002 fixes that - //if (const auto var = game::Dvar_FindVar("r_znear"); var && var->current.value != 4.00195f) - //{ - // game::Cmd_ExecuteSingleCommand(0, 0, "r_znear 4.00195\n"); - //} - - //// show viewmodel - //if (const auto var = game::Dvar_FindVar("r_znear_depthhack"); var && var->current.value != 4.0f) - //{ - // game::Cmd_ExecuteSingleCommand(0, 0, "r_znear_depthhack 4\n"); - //} - -#if DEBUG == FALSE - - //if (const auto var = game::Dvar_FindVar("r_smp_backend"); var && var->current.enabled) - //{ - // game::Cmd_ExecuteSingleCommand(0, 0, "r_smp_backend 0\n"); - //} - //// ^ fix wobbly viewmodels - //if (const auto var = game::Dvar_FindVar("r_skinCache"); var && var->current.enabled) - //{ - // game::Cmd_ExecuteSingleCommand(0, 0, "r_skinCache 0\n"); - //} - - // disable static model caching (stable hashes) - /*if (const auto var = game::Dvar_FindVar("r_smc_enable"); var && var->current.enabled) - { - game::Cmd_ExecuteSingleCommand(0, 0, "r_smc_enable 0\n"); - }*/ - - // remix does not like this - /*if (const auto var = game::Dvar_FindVar("r_depthPrepass"); var && var->current.enabled) - { - game::Cmd_ExecuteSingleCommand(0, 0, "r_depthPrepass 0\n"); - }*/ - - // fps ++ - /*if (const auto var = game::Dvar_FindVar("r_multiGpu"); var && !var->current.enabled) - { - game::Cmd_ExecuteSingleCommand(0, 0, "r_multiGpu 1\n"); - }*/ - - // needed for fixed-function - /*if (const auto var = game::Dvar_FindVar("r_pretess"); var && !var->current.enabled) - { - game::Cmd_ExecuteSingleCommand(0, 0, "r_pretess 1\n"); - }*/ -#endif - - //if (const auto var = game::Dvar_FindVar("r_dof_enable"); var && var->current.enabled) - //{ - // game::Cmd_ExecuteSingleCommand(0, 0, "r_dof_enable 0\n"); - //} - - //// fix effects or other zfeathered materials to cause remix to freak out (turning everything white) - //if (const auto var = game::Dvar_FindVar("r_zfeather"); var && var->current.enabled) - //{ - // game::Cmd_ExecuteSingleCommand(0, 0, "r_zfeather 0\n"); - //} - - // disable weapon tracers - /*if (const auto var = game::Dvar_FindVar("cg_tracerlength"); var && var->current.value != 0.0f) - { - game::Cmd_ExecuteSingleCommand(0, 0, "cg_tracerlength 0\n"); - }*/ } //_common::force_dvars_on_init() @@ -983,11 +863,6 @@ namespace components /* desc */ "Disable culling of game entities (script objects/destructible cars ...)", /* default */ true, /* flags */ game::dvar_flags::saved); - -#ifdef STATIC_MODEL_CACHE_TEST - // can be ignored - utils::hook(0x63ABAE, cull::R_GetStaticModelId_stub, HOOK_JUMP).install()->quick(); -#endif } // * diff --git a/src/components/modules/rtx/rtx_fixed_function.cpp b/src/components/modules/rtx/rtx_fixed_function.cpp index 1777a51..322960f 100644 --- a/src/components/modules/rtx/rtx_fixed_function.cpp +++ b/src/components/modules/rtx/rtx_fixed_function.cpp @@ -2,7 +2,6 @@ // notes: // - r_pretess (surface batching) might cause some messed up normals (sometimes noticeable in water puddles) -// - ^ surface batching is def. needed with fixed-function rendering (fps) // todo // - disable normal and specularmaps so that remix does not pick them up (less clutter in remix ui) @@ -1516,7 +1515,7 @@ namespace components int use_custom_tess_func() { if (const auto str = std::string_view(game::gfxCmdBufState->material->info.name); - str == "$line" || str == "$line_nodepth" || str == "iw3xo_showcollision_wire") + str == "$line" || str == "$line_nodepth" || str == "iw3xo_showcollision_wire" || str == "iw3xo_showcollision_fakelight") { return 1; } diff --git a/src/game/dvars.cpp b/src/game/dvars.cpp index 4536286..9d78e45 100644 --- a/src/game/dvars.cpp +++ b/src/game/dvars.cpp @@ -138,9 +138,6 @@ namespace dvars game::dvar_s* r_buf_dynamicIndexBuffer = nullptr; game::dvar_s* r_buf_preTessIndexBuffer = nullptr; - game::dvar_s* r_debugShaderToggle = nullptr; - game::dvar_s* r_setmaterial_hk = nullptr; - game::dvar_s* r_wireframe_world = nullptr; game::dvar_s* r_wireframe_xmodels = nullptr; diff --git a/src/game/dvars.hpp b/src/game/dvars.hpp index 9501012..15caa5b 100644 --- a/src/game/dvars.hpp +++ b/src/game/dvars.hpp @@ -145,9 +145,6 @@ namespace dvars extern game::dvar_s* r_buf_dynamicIndexBuffer; extern game::dvar_s* r_buf_preTessIndexBuffer; - extern game::dvar_s* r_debugShaderToggle; - extern game::dvar_s* r_setmaterial_hk; - extern game::dvar_s* r_wireframe_world; extern game::dvar_s* r_wireframe_xmodels; diff --git a/src/main.cpp b/src/main.cpp index 8670a0c..00c2058 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -22,7 +22,6 @@ __declspec(naked) void entry_point() { // this has to be called, otherwise the hook is not uninstalled and we're deadlocking call main::initialize; - mov eax, 0x67493C; jmp eax; } @@ -61,7 +60,6 @@ BOOL APIENTRY DllMain(HMODULE /*hModule*/, DWORD ul_reason_for_call, LPVOID /*l VirtualProtect(GetModuleHandle(nullptr), 0xD536000, PAGE_EXECUTE_READWRITE, &oldProtect); main::entry_point_hook_.initialize(0x67493C, entry_point)->install(); - FreeConsole(); // load additional libaries from '\iw3xo\bin\'