summaryrefslogtreecommitdiffstats
path: root/src/netvars.cpp
diff options
context:
space:
mode:
authorsalmonik <salmonik@tuta.io>2026-10-28 12:24:10 +0100
committersalmonik <salmonik@tuta.io>2026-10-28 12:24:10 +0100
commit16546e5818408f35adc60c2d937cf4541ff7840a (patch)
tree19c405c2c226e69f082d9465f9325c67bb1d0d92 /src/netvars.cpp
parentItem ESP: recover CPhysicsProp model names from the server (diff)
downloadhl2h-16546e5818408f35adc60c2d937cf4541ff7840a.tar.gz
hl2h-16546e5818408f35adc60c2d937cf4541ff7840a.zip
Logging: per-session file and debug-gated verbose logs
- Open /tmp/hl2hake.log once in the library constructor with "w" so each session starts clean, use line buffering, flush each line, and close it via atexit. No more fopen/fclose per message. - Add logd() for verbose diagnostics, enabled only with HL2H_DEBUG=1. - Move ESP/NPC scans, item-prop/item-classification logs, aimbot/silent-aim/ melee/triggerbot/spread details, jumpbug tracking, bone dumps, netvar dumps, cmd-modified and ground-trace noise to logd(). - Keep logf() for lifecycle, config, warnings/errors, GUI open/close, item category/tagging summaries and item-crate detections so crate debugging works without the ESP stream. - Supply crates now respect the max-distance slider (user change), with the stale comment and CONTEXT updated. - Document HL2H_DEBUG=1 in play.sh and CONTEXT.
Diffstat (limited to 'src/netvars.cpp')
-rw-r--r--src/netvars.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/netvars.cpp b/src/netvars.cpp
index 4980acc..adb5a6a 100644
--- a/src/netvars.cpp
+++ b/src/netvars.cpp
@@ -46,7 +46,7 @@ static void collect_netvars(uintptr_t table, uintptr_t base_off, int depth) {
46 strcmp(tname, "DT_BasePlayer") == 0); 46 strcmp(tname, "DT_BasePlayer") == 0);
47 if (dump) { 47 if (dump) {
48 g_dumped_tables++; 48 g_dumped_tables++;
49 logf("dump %s: %d props @ table %#lx (base_off %#lx)", tname, nprops, 49 logd("dump %s: %d props @ table %#lx (base_off %#lx)", tname, nprops,
50 (unsigned long)table, (unsigned long)base_off); 50 (unsigned long)table, (unsigned long)base_off);
51 } 51 }
52 52
@@ -65,7 +65,7 @@ static void collect_netvars(uintptr_t table, uintptr_t base_off, int depth) {
65 continue; 65 continue;
66 66
67 if (dump) 67 if (dump)
68 logf(" [%s] %s type=%d off=%d(0x%x) table=%s array=%s", tname, pname2, 68 logd(" [%s] %s type=%d off=%d(0x%x) table=%s array=%s", tname, pname2,
69 ptype, poff, poff, ptable ? "yes" : "no", parray ? "yes" : "no"); 69 ptype, poff, poff, ptable ? "yes" : "no", parray ? "yes" : "no");
70 if (ptable) { 70 if (ptable) {
71 collect_netvars(ptable, base_off + (uint32_t)poff, depth + 1); 71 collect_netvars(ptable, base_off + (uint32_t)poff, depth + 1);
@@ -150,7 +150,7 @@ static bool resolve_movetype() {
150 break; 150 break;
151 } 151 }
152 if (!str_va) { 152 if (!str_va) {
153 logf("m_MoveType string not found"); 153 logd("m_MoveType string not found");
154 return false; 154 return false;
155 } 155 }
156 156
@@ -181,7 +181,7 @@ static bool resolve_movetype() {
181 } 181 }
182 } 182 }
183 if (ncand == 0) { 183 if (ncand == 0) {
184 logf("m_MoveType typedescription not found"); 184 logd("m_MoveType typedescription not found");
185 return false; 185 return false;
186 } 186 }
187 int best = 0; 187 int best = 0;
@@ -210,7 +210,7 @@ static bool resolve_absvelocity() {
210 break; 210 break;
211 } 211 }
212 if (!str_va) { 212 if (!str_va) {
213 logf("m_vecAbsVelocity string not found"); 213 logd("m_vecAbsVelocity string not found");
214 return false; 214 return false;
215 } 215 }
216 216
@@ -241,7 +241,7 @@ static bool resolve_absvelocity() {
241 } 241 }
242 } 242 }
243 if (ncand == 0) { 243 if (ncand == 0) {
244 logf("m_vecAbsVelocity typedescription not found"); 244 logd("m_vecAbsVelocity typedescription not found");
245 return false; 245 return false;
246 } 246 }
247 int best = 0; 247 int best = 0;
@@ -266,7 +266,7 @@ void resolve_netvars() {
266 classes++; 266 classes++;
267 collect_netvars(*(uintptr_t *)(cc + 0x0C), 0, 0); 267 collect_netvars(*(uintptr_t *)(cc + 0x0C), 0, 0);
268 } 268 }
269 logf("client classes walked: %d", classes); 269 logd("client classes walked: %d", classes);
270 270
271 if (g_net.movetype < 0 && !resolve_movetype()) { 271 if (g_net.movetype < 0 && !resolve_movetype()) {
272 // movetype unresolved — bhop still works, just no noclip/ladder guard 272 // movetype unresolved — bhop still works, just no noclip/ladder guard