mirror of
https://github.com/diamante0018/MW3ServerFreezer.git
synced 2025-04-19 19:52:53 +00:00
FoF
This commit is contained in:
parent
b7a618a649
commit
4ddc368348
90
src/component/cheats.cpp
Normal file
90
src/component/cheats.cpp
Normal file
@ -0,0 +1,90 @@
|
|||||||
|
#include <stdinc.hpp>
|
||||||
|
|
||||||
|
#include <loader/component_loader.hpp>
|
||||||
|
#include <utils/hook.hpp>
|
||||||
|
|
||||||
|
#include "key_catcher.hpp"
|
||||||
|
|
||||||
|
namespace cheats
|
||||||
|
{
|
||||||
|
game::dvar_t* cl_wallhack;
|
||||||
|
|
||||||
|
__declspec(naked) void draw_red_box_stub()
|
||||||
|
{
|
||||||
|
__asm
|
||||||
|
{
|
||||||
|
push eax
|
||||||
|
mov eax, cl_wallhack
|
||||||
|
cmp byte ptr [eax + 12], 1
|
||||||
|
pop eax
|
||||||
|
|
||||||
|
je draw
|
||||||
|
|
||||||
|
test byte ptr ds:0x8FF110, 0x10
|
||||||
|
|
||||||
|
push 0x430568
|
||||||
|
retn
|
||||||
|
|
||||||
|
draw:
|
||||||
|
push 0x43056A
|
||||||
|
retn
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
__declspec(naked) void blind_eye_check_stub()
|
||||||
|
{
|
||||||
|
__asm
|
||||||
|
{
|
||||||
|
push eax
|
||||||
|
mov eax, cl_wallhack
|
||||||
|
cmp byte ptr [eax + 12], 1
|
||||||
|
pop eax
|
||||||
|
|
||||||
|
je draw
|
||||||
|
|
||||||
|
test byte ptr [esi], 0x20
|
||||||
|
jnz skipBecauseBlindeye
|
||||||
|
|
||||||
|
jmp draw
|
||||||
|
|
||||||
|
skipBecauseBlindeye:
|
||||||
|
push 0x5AA5A2
|
||||||
|
retn
|
||||||
|
|
||||||
|
draw:
|
||||||
|
push 0x05AA529
|
||||||
|
retn
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class component final : public component_interface
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
void post_unpack() override
|
||||||
|
{
|
||||||
|
cl_wallhack = game::Dvar_RegisterBool("cl_EnableCheats", false, game::DVAR_FLAG_NONE, "Enable FoF wallhack");
|
||||||
|
|
||||||
|
utils::hook::jump(0x430561, draw_red_box_stub);
|
||||||
|
utils::hook::nop(0x430566, 2);
|
||||||
|
|
||||||
|
utils::hook::jump(0x5AA524, blind_eye_check_stub);
|
||||||
|
|
||||||
|
add_cheat_commands();
|
||||||
|
}
|
||||||
|
private:
|
||||||
|
static void add_cheat_commands()
|
||||||
|
{
|
||||||
|
key_catcher::on_key_press("Z", [](const game::LocalClientNum_t&)
|
||||||
|
{
|
||||||
|
game::Dvar_SetBool(cl_wallhack, true);
|
||||||
|
});
|
||||||
|
|
||||||
|
key_catcher::on_key_press("X", [](const game::LocalClientNum_t&)
|
||||||
|
{
|
||||||
|
game::Dvar_SetBool(cl_wallhack, false);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
REGISTER_COMPONENT(cheats::component)
|
@ -8,11 +8,11 @@
|
|||||||
|
|
||||||
namespace exploit
|
namespace exploit
|
||||||
{
|
{
|
||||||
bool exploit = false;
|
game::dvar_t* cl_exploit;
|
||||||
|
|
||||||
void cl_netchan_transmit_stub(int a1, unsigned char* data, int size)
|
void cl_netchan_transmit_stub(int a1, unsigned char* data, int size)
|
||||||
{
|
{
|
||||||
if (exploit)
|
if (cl_exploit->current.enabled)
|
||||||
{
|
{
|
||||||
data[1] = 0xAA;
|
data[1] = 0xAA;
|
||||||
data[8] = 0x80;
|
data[8] = 0x80;
|
||||||
@ -26,6 +26,8 @@ namespace exploit
|
|||||||
public:
|
public:
|
||||||
void post_unpack() override
|
void post_unpack() override
|
||||||
{
|
{
|
||||||
|
cl_exploit = game::Dvar_RegisterBool("cl_exploit", false, game::DVAR_FLAG_NONE, "Enable server freezer");
|
||||||
|
|
||||||
add_exploit_commands();
|
add_exploit_commands();
|
||||||
add_key_hooks();
|
add_key_hooks();
|
||||||
|
|
||||||
@ -55,12 +57,12 @@ namespace exploit
|
|||||||
{
|
{
|
||||||
command::add("exploit", [](const command::params&)
|
command::add("exploit", [](const command::params&)
|
||||||
{
|
{
|
||||||
exploit = true;
|
game::Dvar_SetBool(cl_exploit, true);
|
||||||
});
|
});
|
||||||
|
|
||||||
command::add("undo_exploit", [](const command::params&)
|
command::add("undo_exploit", [](const command::params&)
|
||||||
{
|
{
|
||||||
exploit = false;
|
game::Dvar_SetBool(cl_exploit, false);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -54,6 +54,11 @@ namespace key_catcher
|
|||||||
{
|
{
|
||||||
cl_key_event_hook.create(0x4CD840, &cl_key_event_stub);
|
cl_key_event_hook.create(0x4CD840, &cl_key_event_stub);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void pre_destroy() override
|
||||||
|
{
|
||||||
|
cl_key_event_hook.clear();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,6 +22,8 @@ namespace game
|
|||||||
Dvar_RegisterString{0x4157E0};
|
Dvar_RegisterString{0x4157E0};
|
||||||
WEAK symbol<dvar_t*(const char* dvarName, float value, float min, float max, unsigned __int16 flags, const char* description)>
|
WEAK symbol<dvar_t*(const char* dvarName, float value, float min, float max, unsigned __int16 flags, const char* description)>
|
||||||
Dvar_RegisterFloat{0x4A5CF0};
|
Dvar_RegisterFloat{0x4A5CF0};
|
||||||
|
WEAK symbol<void(dvar_t* var, bool value)> Dvar_SetBool{0x46DD70};
|
||||||
|
WEAK symbol<void(const char* dvarName, bool value)> Dvar_SetBoolByName{0x48C7D0};
|
||||||
|
|
||||||
WEAK symbol<int(const char* cmd)> Key_GetBindingForCmd{0x47D300};
|
WEAK symbol<int(const char* cmd)> Key_GetBindingForCmd{0x47D300};
|
||||||
WEAK symbol<int(const char* keyAsText)> Key_StringToKeynum{0x50A710}; // Virtual-Key Code
|
WEAK symbol<int(const char* keyAsText)> Key_StringToKeynum{0x50A710}; // Virtual-Key Code
|
||||||
@ -29,10 +31,11 @@ namespace game
|
|||||||
|
|
||||||
WEAK symbol<void(int arg, char* buffer, int bufferLength)> SV_Cmd_ArgvBuffer{0x4F6B00};
|
WEAK symbol<void(int arg, char* buffer, int bufferLength)> SV_Cmd_ArgvBuffer{0x4F6B00};
|
||||||
|
|
||||||
WEAK symbol<bool(netsrc_t, game::netadr_s dest, const char* message)> NET_OutOfBandPrint{0x496230};
|
WEAK symbol<bool(netsrc_t, netadr_s dest, const char* message)> NET_OutOfBandPrint{0x496230};
|
||||||
WEAK symbol<void()> Com_Quit_f{0x556060};
|
WEAK symbol<void()> Com_Quit_f{0x556060};
|
||||||
|
|
||||||
// Variables
|
// Variables
|
||||||
WEAK symbol<CmdArgs> cmd_args{0x1C96850};
|
WEAK symbol<CmdArgs> cmd_args{0x1C96850};
|
||||||
WEAK symbol<PlayerKeyState> playerKeys{0xB3A38C};
|
WEAK symbol<PlayerKeyState> playerKeys{0xB3A38C};
|
||||||
|
WEAK symbol<netadr_s> server_remote{0xB3D370};
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user