From 78eb2ac767240ab80a97d3604202397a3f159b71 Mon Sep 17 00:00:00 2001 From: quaK Date: Mon, 26 Aug 2024 17:05:40 +0300 Subject: [PATCH 1/2] dedi patches --- data/cdata/custom_scripts/cp/patches.gsc | 20 ++++++++++++++++ src/client/component/dedicated.cpp | 23 ++++++++++++++++--- src/client/game/demonware/loot/loot.cpp | 2 ++ .../demonware/services/bdBandwidthTest.cpp | 2 +- .../game/demonware/services/bdMarketplace.cpp | 8 ++++++- 5 files changed, 50 insertions(+), 5 deletions(-) create mode 100644 data/cdata/custom_scripts/cp/patches.gsc diff --git a/data/cdata/custom_scripts/cp/patches.gsc b/data/cdata/custom_scripts/cp/patches.gsc new file mode 100644 index 00000000..d7d34675 --- /dev/null +++ b/data/cdata/custom_scripts/cp/patches.gsc @@ -0,0 +1,20 @@ +main() +{ + replacefunc(scripts\cp\agents\gametype_zombie::get_closest_player_near_interaction_point, ::get_closest_player_near_interaction_point_stub); +} + +get_closest_player_near_interaction_point_stub( var_0 ) +{ + var_1 = scripts\engine\utility::get_array_of_closest( var_0.origin, level.players )[0]; + var_2 = scripts\engine\utility::getclosest( var_0.origin, level.current_interaction_structs ); + + if( !isDefined( var_1 ) || !isDefined( var_2 ) ) + { + return undefined; + } + + if ( !scripts\cp\agents\gametype_zombie::is_player_near_interaction_point( var_1, var_2 ) ) + var_1 = undefined; + + return var_1; +} \ No newline at end of file diff --git a/src/client/component/dedicated.cpp b/src/client/component/dedicated.cpp index 37efc00c..5b124948 100644 --- a/src/client/component/dedicated.cpp +++ b/src/client/component/dedicated.cpp @@ -251,7 +251,7 @@ namespace dedicated dvars::override::register_bool("intro", false, game::DVAR_FLAG_READ); // Stop crashing from sys_errors - utils::hook::jump(0x140D34180, sys_error_stub, true); + //utils::hook::jump(0x140D34180, sys_error_stub, true); // Is party dedicated utils::hook::jump(0x1405DFC10, party_is_server_dedicated_stub); @@ -301,12 +301,29 @@ namespace dedicated // check the sounddata when server is launched start_server_hook.create(0x140C56050, start_server_stub); - // IMAGE patches - // image stream (pak) + // AlwaysLoaded + utils::hook::set(0x140A81D40, 0xC3); + + // remove imagefile load utils::hook::set(0x140A7DB10, 0xC3); // DB_CreateGfxImageStreamInternal + utils::hook::set(0x140E01F00, 0xC3); // Load_Texture + + // remove assetfile load + //utils::hook::jump(0x1409E762F, 0x1409E7713); + //utils::hook::set(0x1403BA0A0, 0xC3); + //utils::hook::jump(0x140571E5F, 0x140571EF0); + + // remove transient loads + utils::hook::set(0x140A79AE0, 0xC3); + utils::hook::set(0x1403BB990, 0xC3); + utils::hook::set(0x140A78910, 0xC3); + + // remove emblem stuff + utils::hook::set(0x14003B9A0, 0xC3); // UI patches utils::hook::set(0x140615090, 0xC3); // LUI_CoD_Init + utils::hook::set(0x140348A90, 0xC3); // CL_InitUI // IW7 patches utils::hook::set(0x140E06060, 0xC3C033); // directx diff --git a/src/client/game/demonware/loot/loot.cpp b/src/client/game/demonware/loot/loot.cpp index aa6b8f7a..51cff29a 100644 --- a/src/client/game/demonware/loot/loot.cpp +++ b/src/client/game/demonware/loot/loot.cpp @@ -180,6 +180,7 @@ namespace demonware lootmap.clear(); const auto asset = game::DB_FindXAssetHeader(game::ASSET_TYPE_STRINGTABLE, csv.file.data(), 0).stringTable; + if (!asset) return; for (auto row = 0; row < asset->rowCount; row++) { @@ -268,6 +269,7 @@ namespace demonware lootcrates.clear(); const auto asset = game::DB_FindXAssetHeader(game::ASSET_TYPE_STRINGTABLE, csv::loot_crate.file.data(), 0).stringTable; + if (!asset) return; for (auto row = 0; row < asset->rowCount; row++) { diff --git a/src/client/game/demonware/services/bdBandwidthTest.cpp b/src/client/game/demonware/services/bdBandwidthTest.cpp index dfe4f441..1525887f 100644 --- a/src/client/game/demonware/services/bdBandwidthTest.cpp +++ b/src/client/game/demonware/services/bdBandwidthTest.cpp @@ -21,7 +21,7 @@ namespace demonware byte_buffer buffer; buffer.write(sizeof bandwidth_iw6, bandwidth_iw6); - auto reply = server->create_message(5); + auto reply = server->create_message(BD_LSG_SERVICE_TASK_REPLY); reply.send(&buffer, true); } } diff --git a/src/client/game/demonware/services/bdMarketplace.cpp b/src/client/game/demonware/services/bdMarketplace.cpp index 001518fa..7874cd99 100644 --- a/src/client/game/demonware/services/bdMarketplace.cpp +++ b/src/client/game/demonware/services/bdMarketplace.cpp @@ -1,7 +1,7 @@ #include #include "../dw_include.hpp" -#include +#include "game/game.hpp" #include "steam/steam.hpp" @@ -281,6 +281,12 @@ namespace demonware void bdMarketplace::getInventoryPaginated(service_server* server, byte_buffer* buffer) const { + if (game::environment::is_dedi()) + { + server->create_reply(this->task_id()).send(); + return; + } + std::string platform; std::uint32_t itemsPerPage, pageNum; From d0a43f06fc4543304474d866cb90a85401ac7086 Mon Sep 17 00:00:00 2001 From: quaK Date: Mon, 26 Aug 2024 23:25:00 +0300 Subject: [PATCH 2/2] dedi customization fix --- src/client/component/dedicated.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/client/component/dedicated.cpp b/src/client/component/dedicated.cpp index 5b124948..2b8d0e0a 100644 --- a/src/client/component/dedicated.cpp +++ b/src/client/component/dedicated.cpp @@ -321,6 +321,9 @@ namespace dedicated // remove emblem stuff utils::hook::set(0x14003B9A0, 0xC3); + // remove customization xmodel stuff + utils::hook::set(0x1405D0690, 0xC3); + // UI patches utils::hook::set(0x140615090, 0xC3); // LUI_CoD_Init utils::hook::set(0x140348A90, 0xC3); // CL_InitUI