From 16546e5818408f35adc60c2d937cf4541ff7840a Mon Sep 17 00:00:00 2001 From: salmonik Date: Wed, 28 Oct 2026 12:24:10 +0100 Subject: 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. --- src/netvars.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/netvars.cpp') 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) { strcmp(tname, "DT_BasePlayer") == 0); if (dump) { g_dumped_tables++; - logf("dump %s: %d props @ table %#lx (base_off %#lx)", tname, nprops, + logd("dump %s: %d props @ table %#lx (base_off %#lx)", tname, nprops, (unsigned long)table, (unsigned long)base_off); } @@ -65,7 +65,7 @@ static void collect_netvars(uintptr_t table, uintptr_t base_off, int depth) { continue; if (dump) - logf(" [%s] %s type=%d off=%d(0x%x) table=%s array=%s", tname, pname2, + logd(" [%s] %s type=%d off=%d(0x%x) table=%s array=%s", tname, pname2, ptype, poff, poff, ptable ? "yes" : "no", parray ? "yes" : "no"); if (ptable) { collect_netvars(ptable, base_off + (uint32_t)poff, depth + 1); @@ -150,7 +150,7 @@ static bool resolve_movetype() { break; } if (!str_va) { - logf("m_MoveType string not found"); + logd("m_MoveType string not found"); return false; } @@ -181,7 +181,7 @@ static bool resolve_movetype() { } } if (ncand == 0) { - logf("m_MoveType typedescription not found"); + logd("m_MoveType typedescription not found"); return false; } int best = 0; @@ -210,7 +210,7 @@ static bool resolve_absvelocity() { break; } if (!str_va) { - logf("m_vecAbsVelocity string not found"); + logd("m_vecAbsVelocity string not found"); return false; } @@ -241,7 +241,7 @@ static bool resolve_absvelocity() { } } if (ncand == 0) { - logf("m_vecAbsVelocity typedescription not found"); + logd("m_vecAbsVelocity typedescription not found"); return false; } int best = 0; @@ -266,7 +266,7 @@ void resolve_netvars() { classes++; collect_netvars(*(uintptr_t *)(cc + 0x0C), 0, 0); } - logf("client classes walked: %d", classes); + logd("client classes walked: %d", classes); if (g_net.movetype < 0 && !resolve_movetype()) { // movetype unresolved — bhop still works, just no noclip/ladder guard -- cgit v1.2.3