Skip to content

Commit

Permalink
Remove unnecessary offset on patch_vm
Browse files Browse the repository at this point in the history
  • Loading branch information
tjone270 committed Jun 16, 2024
1 parent a3e7774 commit 1a4a7b7
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 13 deletions.
2 changes: 1 addition & 1 deletion hooks.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ void __cdecl My_Sys_SetModuleOffset(char* moduleName, void* offset) {
SearchVmFunctions();
HookVm();
InitializeVm();
patch_vm(offset);
patch_vm();
}
}

Expand Down
12 changes: 2 additions & 10 deletions patches.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,6 @@ void vote_clientkick_fix(void) {
patch_by_mask( ADDR_VOTE_CLIENTKICK_FIX, PTRN_VOTE_CLIENTKICK_FIX, MASK_VOTE_CLIENTKICK_FIX );
}

void framerate_fix(void* offset) {
unsigned char str_125[] = "125";
int page_size = sysconf(_SC_PAGESIZE);
mprotect((void*)((uint64_t)(offset + 0x254878) & ~(page_size-1)), page_size, PROT_READ | PROT_WRITE);
*(int64_t*)(offset + 0x254878) = (int64_t)str_125;
}

void patch_vm(void* moduleOffset) {
void patch_vm(void) {
vote_clientkick_fix();
framerate_fix(moduleOffset);
}
}
4 changes: 2 additions & 2 deletions patches.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
void patch_vm(void* moduleOffset);
void patch_vm(void);

#if defined(__x86_64__) || defined(_M_X64)

Expand All @@ -12,4 +12,4 @@ void patch_vm(void* moduleOffset);
#define PTRN_VOTE_CLIENTKICK_FIX "\x69\xc8\xd0\x0b\x0\x0\x01\xca\x90\x0\x44\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x6c\x90\x90\x90\x90\x90\x90\x90\x90"
#define MASK_VOTE_CLIENTKICK_FIX "XXXXXXXXX-X------------XXXXXXXXX"

#endif
#endif

0 comments on commit 1a4a7b7

Please sign in to comment.