Skip to content

Commit

Permalink
Updated to v1.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelDeets committed Oct 12, 2024
1 parent 0535bf5 commit 35bf157
Show file tree
Hide file tree
Showing 12 changed files with 264 additions and 115 deletions.
66 changes: 66 additions & 0 deletions src/client/component/bullet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ namespace bullet
{
game::dvar_t* bg_surface_penetration;
game::dvar_t* bg_fallback_max_range;
game::dvar_t* bg_penetrate_all;
utils::hook::detour bg_get_surface_penetration_depth_hook;

float bg_get_surface_penetration_depth_stub(game::Weapon weapon, bool is_alternate, int surface_type)
Expand Down Expand Up @@ -58,6 +59,71 @@ namespace bullet
"Modifies the max range for weapons without a defined damage range value (eg. Intervention)");

utils::hook::jump(0x3F3FFF_b, utils::hook::assemble(bullet_fire_internal_stub), true);

// Patoke @todo: finish implementing
//bg_penetrate_all = dvars::register_bool("bg_penetrateAll", false, flags,
// "Forces bullet to penetrate all surfaces");

//// patch BG_GetSurfacePenetrationDepth call
//utils::hook::jump(0x3F36C2_b, utils::hook::assemble([](utils::hook::assembler& a)
//{
// const auto return_stub = a.newLabel();

// a.push(rax);
// a.mov(rax, qword_ptr(reinterpret_cast<int64_t>(&bg_penetrate_all)));
// a.mov(al, byte_ptr(rax, 0x10));
// a.cmp(al, 1);
// a.pop(rax);

// a.jz(return_stub);

// a.push(eax);
// a.mov(eax, FLT_MAX);
// a.movd(xmm7, eax);
// a.pop(eax);

// // skip whole penetration setup code
// a.jmp(0x3F372D_b);

// a.bind(return_stub);

// // original code
// a.test(rax, rax);
// a.jz(0x3F36E8_b);
// a.test(dword_ptr(rax, 0x1DC0), 0x80000);

// a.jmp(0x3F36D4_b);
//}), true);

//// patch number of bullet penetrations possible
//utils::hook::jump(0x3F35CA_b, utils::hook::assemble([](utils::hook::assembler& a)
//{
// const auto return_stub = a.newLabel();

// a.push(rax);
// a.mov(rax, qword_ptr(reinterpret_cast<int64_t>(&bg_penetrate_all)));
// a.mov(al, byte_ptr(rax, 0x10));
// a.cmp(al, 1);
// a.pop(rax);

// a.mov(ecx, 5);
// a.mov(ptr(rsp, 0x80), 5);

// a.jz(return_stub);

// a.mov(ecx, INT_MAX);
// a.mov(ptr(rsp, 0x80), INT_MAX);

// a.jmp(0x3F3608_b);

// a.bind(return_stub);

// // original code
// a.test(rax, rax);
// a.jz(0x3F35E3_b);

// a.jmp(0x3F35D7_b);
//}), true);
}
};
}
Expand Down
6 changes: 3 additions & 3 deletions src/client/component/clantags.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ namespace clantags
{
{"H2M", {"h2", 64, 64}},
{"SM2", {"sm", 77, 48}},
{"VER", {"vr", 64, 64}},
{"HMW", {"hm", 77, 77}}
// Could add more tags here in the future
{"VER", {"vr", 64, 64}}
//{"HMW", {"hm", 77, 77}}
// Could add more tags here in the future
};
}
5 changes: 5 additions & 0 deletions src/client/component/command.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -587,6 +587,11 @@ namespace command
public:
void post_unpack() override
{
if (!game::environment::is_dedi())
{
utils::hook::set<uint8_t>(0x139B8A_b, 0xEB);
}

utils::hook::call(0x15C44B_b, parse_commandline_stub);
add_commands_mp();

Expand Down
49 changes: 0 additions & 49 deletions src/client/component/experimental.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,52 +31,6 @@ namespace experimental
#endif
namespace
{
bool load_zone_files(const std::vector<std::string>& zone_files)
{
game::XZoneInfo zone_allocs[7] = {};
int files_to_load = 0;

for (const auto& zone_file : zone_files)
{
if (fastfiles::exists(zone_file))
{
auto& zone = zone_allocs[files_to_load];

zone.name = zone_file.data();
zone.allocFlags = game::DB_ZONE_COMMON | game::DB_ZONE_CUSTOM;
zone.freeFlags = 0;

files_to_load++;
}
else
{
console::print(1, "Couldn't find zone %s\n", zone_file.data());
}
}

if (files_to_load == 0)
return false;

game::DB_LoadXAssets(zone_allocs, files_to_load, game::DBSyncMode::DB_LOAD_ASYNC_NO_SYNC_THREADS);

return true;
}

void load_h2m_zones()
{
std::vector<std::string> new_zone_files = {};

new_zone_files.emplace_back("h2m_killstreak");
new_zone_files.emplace_back("h2m_attachments");
new_zone_files.emplace_back("h2m_ar1");
new_zone_files.emplace_back("h2m_smg");
new_zone_files.emplace_back("h2m_shotgun");
new_zone_files.emplace_back("h2m_launcher");
new_zone_files.emplace_back("h2m_rangers");

load_zone_files(new_zone_files);
}

void open_lui_mapvote()
{
if (sv_open_menu_mapvote && sv_open_menu_mapvote->current.enabled)
Expand Down Expand Up @@ -591,9 +545,6 @@ namespace experimental
utils::hook::copy_string(0x8E31D8_b, "h2_loading_animation"); // swap loading icon
utils::hook::set<uint8_t>(0xC393F_b, 11); // increment persistent player data clcState check

// Marketing_Init stub
utils::hook::call(0x15CDB2_b, load_h2m_zones);

utils::hook::set<float>(0x8FBA04_b, 350.f); // modify position of loading information
utils::hook::set<uint8_t>(0x53C9FA_b, 0xEB); // Patoke @todo: what is this?

Expand Down
8 changes: 8 additions & 0 deletions src/client/component/gameplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,14 @@ namespace gameplay
utils::hook::set<uint32_t>(0x2CC609_b + 6, game::BG_GetPerkBit(game::PERK_LONGERSPRINT)); // PM_GetSprintLeft
utils::hook::set<uint32_t>(0x2CFAD7_b + 6, game::BG_GetPerkBit(game::PERK_LONGERSPRINT)); // PM_UpdateSprint

// override PERK_COLDBLOODED mention for PERK_RADARIMMUNE, this is a bitshift, 0x13 is PERK_COLDBLOODED
// this disables thermal vision
utils::hook::set<uint8_t>(0x1160D9_b + 2, 0x14); // CG_Player

// override perk bit of PERK_COLDBLOODED for PERK_RADARIMMUNE
// this disables red overlay over players (doesn't seem to work?)
utils::hook::set<uint32_t>(0x11607C_b + 3, game::BG_GetPerkBit(game::PERK_RADARIMMUNE)); // CG_Player

#ifdef DEBUG
// Make noclip work
client_end_frame_hook.create(0x3FF7D0_b, client_end_frame_stub2);
Expand Down
Loading

0 comments on commit 35bf157

Please sign in to comment.