summaryrefslogtreecommitdiffhomepage
path: root/src/l4dreset.c
diff options
context:
space:
mode:
authorMichael Smith <mikesmiffy128@gmail.com>2024-01-21 21:59:23 +0000
committerMichael Smith <mikesmiffy128@gmail.com>2024-01-21 22:02:14 +0000
commit670488716dde7ba7813dd281f24403a0b24d8690 (patch)
tree9b138c009e4131e32ed7bf4645e3eba7f8a5b18d /src/l4dreset.c
parent506f095bcb528468f25a637977efcc408590ae67 (diff)
Rethink mem_loadoffset, and consequently, kill it
Suggested by bill. Having something semantically pointer-sized that's only ever used for stuff that's always 32-bit doesn't really make sense. Note that I intentionally did not add a copyright line for myself in hud.c because, I mean, come on. I'll just say I waive any claim to that tiny trivial change.
Diffstat (limited to 'src/l4dreset.c')
-rw-r--r--src/l4dreset.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/l4dreset.c b/src/l4dreset.c
index 479a1c8..e95a1ac 100644
--- a/src/l4dreset.c
+++ b/src/l4dreset.c
@@ -1,6 +1,6 @@
/*
* Copyright © 2023 Willian Henrique <wsimanbrazil@yahoo.com.br>
- * Copyright © 2023 Michael Smith <mikesmiffy128@gmail.com>
+ * Copyright © 2024 Michael Smith <mikesmiffy128@gmail.com>
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -318,7 +318,7 @@ static inline bool find_voteissues(const uchar *insns) {
for (const uchar *p = insns; p - insns < 16;) {
// Look for the last call before the ret - that has to be ListIssues()
if (p[0] == X86_CALL && p[5] == X86_RET) {
- insns = p + 5 + mem_loadoffset(p + 1);
+ insns = p + 5 + mem_loads32(p + 1);
goto ok;
}
NEXT_INSN(p, "ListIssues call");
@@ -329,7 +329,7 @@ ok: for (const uchar *p = insns; p - insns < 96;) {
// Each pointer is loaded from a CUtlVector at an offset from `this`, so
// we can find that offset from the mov into ECX.
if (p[0] == X86_MOVRMW && (p[1] & 0xF8) == 0x88) {
- int off = mem_loadoffset(p + 2);
+ int off = mem_loads32(p + 2);
if (off > 800) { // sanity check: offset is always fairly high
off_voteissues = off;
return true;
@@ -357,8 +357,8 @@ static inline bool find_votecallers(void *votectrlspawn) {
// to happen), but the vector of interest always comes 8 bytes later.
// "mov dword ptr [<reg> + off], 0", mod == 0b11
if (p[0] == X86_MOVMIW && (p[1] & 0xC0) == 0x80 &&
- mem_load32(p + 6) == 0) {
- off_callerrecords = mem_load32(p + 2) + 8;
+ mem_loads32(p + 6) == 0) {
+ off_callerrecords = mem_loads32(p + 2) + 8;
return true;
}
NEXT_INSN(p, "offset to vote caller record vector");
@@ -394,7 +394,7 @@ static inline bool find_UnfreezeTeam(void *GameFrame) { // note: L4D1 only
if (p[0] == X86_MOVRMW && p[1] == X86_MODRM(0, 1, 5) &&
mem_loadptr(mem_loadptr(p + 2)) == director &&
p[6] == X86_CALL) {
- p += 11 + mem_loadoffset(p + 7);
+ p += 11 + mem_loads32(p + 7);
insns = p;
goto ok;
}
@@ -406,7 +406,7 @@ ok: // Director::Update calls UnfreezeTeam after the first jmp instruction
// jz XXX; mov ecx, <reg>; call Director::UnfreezeTeam
if (p[0] == X86_JZ && p[2] == X86_MOVRMW && (p[3] & 0xF8) == 0xC8 &&
p[4] == X86_CALL) {
- p += 9 + mem_loadoffset(p + 5);
+ p += 9 + mem_loads32(p + 5);
orig_UnfreezeTeam = (UnfreezeTeam_func)p;
return true;
}