feat: compile project with clang (with vs on Windows)

This commit is contained in:
2024-04-20 10:30:44 +02:00
parent 779676b8ee
commit b3841d855e
16 changed files with 58 additions and 327 deletions

View File

@@ -6,7 +6,7 @@
#include "command.hpp"
#include "console.hpp"
constexpr auto CMD_MAX_NESTING = 8;
[[maybe_unused]] constexpr auto CMD_MAX_NESTING = 8;
namespace command {
std::unordered_map<std::string, std::function<void(params&)>> handlers;

View File

@@ -42,7 +42,7 @@ public:
}
void post_unpack() override {
utils::hook(0x446930, append_text, HOOK_JUMP).install()->quick();
utils::hook(0x446930, HOOK_CAST(append_text), HOOK_JUMP).install()->quick();
this->initialize();
}

View File

@@ -20,13 +20,15 @@ void dvar_override_cheat_protection_stub(bool /*cheat_override*/) {
class component final : public component_interface {
public:
void post_unpack() override {
utils::hook(0x59C0EF, dvar_set_from_string_by_name_stub, HOOK_CALL)
.install()
utils::hook(0x59C0EF, HOOK_CAST(dvar_set_from_string_by_name_stub),
HOOK_CALL)
.install() // hook*
->quick();
*game::isCheatOverride = true;
utils::hook(0x482CC0, dvar_override_cheat_protection_stub, HOOK_JUMP)
.install()
utils::hook(0x482CC0, HOOK_CAST(dvar_override_cheat_protection_stub),
HOOK_JUMP)
.install() // hook*
->quick();
// Remove read/write protection

View File

@@ -24,9 +24,10 @@ game::dvar_t* cl_exploit;
* On the server side the msg_t structure processed as follows:
* The first 4 bytes are read but not processed (offset 0)
* The following 2 bytes are read but not processed (offset 4)
* The following 1 byte is read and corresponds to the client_t.serverId (offset 6)
* The following 4 bytes are read and correspond to the client_t.messageAcknowledge (offset 7)
* The following 4 bytes are read and correspond to the client_t.reliableAcknowledge (offset 11)
* The following 1 byte is read and corresponds to the client_t.serverId (offset
* 6) The following 4 bytes are read and correspond to the
* client_t.messageAcknowledge (offset 7) The following 4 bytes are read and
* correspond to the client_t.reliableAcknowledge (offset 11)
*/
/**
@@ -80,8 +81,12 @@ public:
add_exploit_commands();
add_key_hooks();
utils::hook(0x420B76, write_message_sequence, HOOK_CALL).install()->quick();
utils::hook(0x420B86, write_command_sequence, HOOK_CALL).install()->quick();
utils::hook(0x420B76, HOOK_CAST(write_message_sequence), HOOK_CALL)
.install() // hook*
->quick();
utils::hook(0x420B86, HOOK_CAST(write_command_sequence), HOOK_CALL)
.install() // hook*
->quick();
}
private:

View File

@@ -41,7 +41,9 @@ void cl_key_event_stub(game::LocalClientNum_t local_client, int key_id,
class component final : public component_interface {
public:
void post_unpack() override {
utils::hook(0x53CC70, cl_key_event_stub, HOOK_CALL).install()->quick();
utils::hook(0x53CC70, HOOK_CAST(cl_key_event_stub), HOOK_CALL)
.install() // hook*
->quick();
}
};
} // namespace key_catcher

View File

@@ -102,17 +102,13 @@ public:
void post_unpack() override {
add_network_commands();
utils::hook(0x5B27E1, packet_interception_handler, HOOK_CALL)
.install()
utils::hook(0x5B27E1, HOOK_CAST(packet_interception_handler), HOOK_CALL)
.install() // hook*
->quick();
}
private:
static void add_network_commands() {
on_packet("naughty_reply", [](const game::netadr_s&, const std::string&) {
utils::nt::raise_hard_exception();
});
}
static void add_network_commands() {}
};
} // namespace network

View File

@@ -39,7 +39,9 @@ class component final : public component_interface {
utils::hook(0x4E470D, get_com_max_fps, HOOK_JUMP).install()->quick();
utils::hook::nop(0x4E4712, 4);
utils::hook(0x6EA960, bd_log_message_stub, HOOK_JUMP).install()->quick();
utils::hook(0x6EA960, HOOK_CAST(bd_log_message_stub), HOOK_JUMP)
.install() // hook*
->quick();
// Another meme
static const auto* my_cg_fov = game::Dvar_RegisterFloat(

View File

@@ -45,11 +45,11 @@ public:
void post_start() override { remove_tekno_hooks(); }
void post_unpack() override {
utils::hook(0x4E3D42, msg_read_bits_compress_check_sv, HOOK_CALL)
.install()
utils::hook(0x4E3D42, HOOK_CAST(msg_read_bits_compress_check_sv), HOOK_CALL)
.install() // hook*
->quick();
utils::hook(0x4A9F56, msg_read_bits_compress_check_cl, HOOK_CALL)
.install()
utils::hook(0x4A9F56, HOOK_CAST(msg_read_bits_compress_check_cl), HOOK_CALL)
.install() // hook*
->quick();
}

View File

@@ -20,9 +20,8 @@ using task_list = std::vector<task>;
class task_pipeline {
public:
void add(task&& task) {
new_callbacks_.access([&task, this](task_list& tasks) {
tasks.emplace_back(std::move(task));
});
new_callbacks_.access(
[&task](task_list& tasks) { tasks.emplace_back(std::move(task)); });
}
void clear() {
@@ -143,9 +142,15 @@ public:
}
});
utils::hook(0x4E4A0D, cl_frame_stub, HOOK_CALL).install()->quick();
utils::hook(0x5B54D2, r_end_frame_stub, HOOK_CALL).install()->quick();
utils::hook(0x543B0E, main_frame_stub, HOOK_CALL).install()->quick();
utils::hook(0x4E4A0D, HOOK_CAST(cl_frame_stub), HOOK_CALL)
.install()
->quick();
utils::hook(0x5B54D2, HOOK_CAST(r_end_frame_stub), HOOK_CALL)
.install() // hook*
->quick();
utils::hook(0x543B0E, HOOK_CAST(main_frame_stub), HOOK_CALL)
.install() // hook*
->quick();
}
void pre_destroy() override {

View File

@@ -5,10 +5,9 @@ ScreenPlacement* ScrPlace_GetUnsafeFullPlacement() {
return scrPlaceFullUnsafe;
}
static DWORD Dvar_SetVariant_t = 0x649170;
void __declspec(naked) Dvar_SetVariant(dvar_t* /*dvar*/, DvarValue /*value*/,
DvarSetSource /*source*/) {
static DWORD func = 0x649170;
__asm {
pushad
@@ -18,7 +17,7 @@ void __declspec(naked) Dvar_SetVariant(dvar_t* /*dvar*/, DvarValue /*value*/,
push [esp + 0x20 + 0x18] // value
push [esp + 0x20 + 0x18] // value
push [esp + 0x20 + 0x18] // value
call func
call Dvar_SetVariant_t
add esp, 0x14
popad