Skip to content

Commit

Permalink
dedi patches
Browse files Browse the repository at this point in the history
  • Loading branch information
Joelrau committed Aug 26, 2024
1 parent 70b3d38 commit 78eb2ac
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 5 deletions.
20 changes: 20 additions & 0 deletions data/cdata/custom_scripts/cp/patches.gsc
Original file line number Diff line number Diff line change
@@ -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;
}
23 changes: 20 additions & 3 deletions src/client/component/dedicated.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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<uint8_t>(0x140A81D40, 0xC3);

// remove imagefile load
utils::hook::set<uint8_t>(0x140A7DB10, 0xC3); // DB_CreateGfxImageStreamInternal
utils::hook::set<uint8_t>(0x140E01F00, 0xC3); // Load_Texture

// remove assetfile load
//utils::hook::jump(0x1409E762F, 0x1409E7713);
//utils::hook::set<uint8_t>(0x1403BA0A0, 0xC3);
//utils::hook::jump(0x140571E5F, 0x140571EF0);

// remove transient loads
utils::hook::set<uint8_t>(0x140A79AE0, 0xC3);
utils::hook::set<uint8_t>(0x1403BB990, 0xC3);
utils::hook::set<uint8_t>(0x140A78910, 0xC3);

// remove emblem stuff
utils::hook::set<uint8_t>(0x14003B9A0, 0xC3);

// UI patches
utils::hook::set<uint8_t>(0x140615090, 0xC3); // LUI_CoD_Init
utils::hook::set<uint8_t>(0x140348A90, 0xC3); // CL_InitUI

// IW7 patches
utils::hook::set(0x140E06060, 0xC3C033); // directx
Expand Down
2 changes: 2 additions & 0 deletions src/client/game/demonware/loot/loot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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++)
{
Expand Down Expand Up @@ -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++)
{
Expand Down
2 changes: 1 addition & 1 deletion src/client/game/demonware/services/bdBandwidthTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
8 changes: 7 additions & 1 deletion src/client/game/demonware/services/bdMarketplace.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include <std_include.hpp>
#include "../dw_include.hpp"

#include <utils/io.hpp>
#include "game/game.hpp"

#include "steam/steam.hpp"

Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit 78eb2ac

Please sign in to comment.