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/bones.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/bones.cpp') diff --git a/src/bones.cpp b/src/bones.cpp index 787af1b..0df13f2 100644 --- a/src/bones.cpp +++ b/src/bones.cpp @@ -265,22 +265,22 @@ static void build_core_mask(BoneEntry *e) { static void dump_hitboxes(const BoneEntry *e) { const StudioHdr *h = e->hdr; - logf("hitbox dump: idx=%d sets=%d setidx=%d", e->idx, h->numhitboxsets, + logd("hitbox dump: idx=%d sets=%d setidx=%d", e->idx, h->numhitboxsets, h->hitboxsetindex); const HitboxSet *s = hitbox_set0(h); if (!s) { - logf("hitbox dump: no usable hitbox set"); + logd("hitbox dump: no usable hitbox set"); return; } const Hitbox *hb = hitboxes(s); - logf("hitbox dump: set0 n=%d hitboxindex=%d", s->numhitboxes, + logd("hitbox dump: set0 n=%d hitboxindex=%d", s->numhitboxes, s->hitboxindex); int n = s->numhitboxes < 24 ? s->numhitboxes : 24; for (int i = 0; i < n; i++) { const char *bn = (hb[i].bone >= 0 && hb[i].bone < e->count) ? bone_name_raw(h, hb[i].bone) : nullptr; - logf(" hb %d name='%s' bone=%d(%s) bb=(%.1f %.1f %.1f)-(%.1f %.1f %.1f)", + logd(" hb %d name='%s' bone=%d(%s) bb=(%.1f %.1f %.1f)-(%.1f %.1f %.1f)", i, hitbox_name(hb[i]), hb[i].bone, bn ? bn : "?", hb[i].bbmin.x, hb[i].bbmin.y, hb[i].bbmin.z, hb[i].bbmax.x, hb[i].bbmax.y, hb[i].bbmax.z); @@ -370,7 +370,7 @@ bool bones_update(int idx, void *ent) { e->stamp = now; if (g_logged < 4) { g_logged++; - logf("bones: idx=%d count=%d invalid=%d bone0=%s", idx, e->count, + logd("bones: idx=%d count=%d invalid=%d bone0=%s", idx, e->count, invalid_bones, bone_name_raw(hdr, 0) ? bone_name_raw(hdr, 0) : "?"); } -- cgit v1.2.3