From 56ac2ab870b206d3c34b5620f5ffe4e2a6966e9e Mon Sep 17 00:00:00 2001 From: James Dansereau <106631954+jkdansereau@users.noreply.github.com> Date: Sun, 20 Sep 2026 23:10:57 -0400 Subject: [PATCH] Phase 0 hygiene: remove GE_OBJT probes (D321 closed; M-192 item 7) The D321 stage-flag writer probe (chrSetStageFlags/chrUnsetStageFlags in chraction.c, GAS_RELEASING destruction timestamp in propobj.c) did its job (D321 trigger chain mapped + closed); all three blocks were #ifdef PORT diagnostics with no N64-build or runtime effect when unset. Dropped the GE-ENV-PROBES.md row too (drift check passes). getenv hot-path sweep (D302 follow-up, HANDOFF M-192): function-level scan of all 171 GE_* getenv sites found no uncached calls at frame/triangle rate -- the only candidates are snd.c's event-rate probe guards (all #ifdef PORT) and bossReturnTitleStage (once per title return). fast3d has zero raw 'if (getenv(' sites. --- src/game/chraction.c | 51 -------------------------------------------- src/game/propobj.c | 18 ---------------- 2 files changed, 69 deletions(-) diff --git a/src/game/chraction.c b/src/game/chraction.c index e560b19f..9c6d4c88 100644 --- a/src/game/chraction.c +++ b/src/game/chraction.c @@ -9994,35 +9994,6 @@ bool chrHasFlags2ById(ChrRecord *self, s32 chrNum, u8 flags2) */ void chrSetStageFlags(ChrRecord *self, s32 arg1) { -#ifdef PORT - /* D318-followup (diagnosis only, GE_OBJT=1): attribute writes to the LOW - * bits of objectiveregisters1 (the Facility execution derail triggers: - * 0x04 gas/combat, 0x20 surrender/monologue, 0x40 flee -- none of which - * the level setup script ever sets; only character-action scripts do). - * Logs the writing chr + its AI position so the writer's script state is - * correlatable against a simultaneous D318T capture. Read-only, capped, - * no behavior change; N64 build unaffected. */ - extern char *getenv(const char *); - extern s32 chraiGetAIListID(AIRecord *AIList, bool *isGlobalAIList); /* chrai.c */ - static int s_objt = -1; - static int s_objtn = 0; - int objtlog; - s32 aid; - bool aig; - - if (s_objt < 0) { s_objt = getenv("GE_OBJT") != NULL; } - objtlog = s_objt && (arg1 & 0x0000FFFF) && (s_objtn < 500); - if (objtlog) - { - aid = self->ailist ? chraiGetAIListID(self->ailist, &aig) : -1; - osSyncPrintf("OBJT: t=%d SET mask=0x%08x by chr %d (act=%d off=%d aiid=0x%04x%s ailist=%p) reg=0x%08x\n", - (int)g_GlobalTimer, (unsigned)arg1, (int)self->chrnum, - (int)self->actiontype, (int)self->aioffset, (unsigned)aid, - aig ? "G" : "", (void *)self->ailist, - (unsigned)objectiveregisters1); - s_objtn++; - } -#endif objectiveregisters1 |= arg1; } @@ -10032,28 +10003,6 @@ void chrSetStageFlags(ChrRecord *self, s32 arg1) */ void chrUnsetStageFlags(ChrRecord *self, u32 flags) { -#ifdef PORT - extern char *getenv(const char *); - extern s32 chraiGetAIListID(AIRecord *AIList, bool *isGlobalAIList); /* chrai.c */ - static int s_objtu = -1; - static int s_objtun = 0; - int objtulog; - s32 aid; - bool aig; - - if (s_objtu < 0) { s_objtu = getenv("GE_OBJT") != NULL; } - objtulog = s_objtu && (flags & 0x0000FFFF) && (s_objtun < 500); - if (objtulog) - { - aid = self->ailist ? chraiGetAIListID(self->ailist, &aig) : -1; - osSyncPrintf("OBJT: t=%d UNS mask=0x%08x by chr %d (act=%d off=%d aiid=0x%04x%s ailist=%p) reg=0x%08x\n", - (int)g_GlobalTimer, (unsigned)flags, (int)self->chrnum, - (int)self->actiontype, (int)self->aioffset, (unsigned)aid, - aig ? "G" : "", (void *)self->ailist, - (unsigned)objectiveregisters1); - s_objtun++; - } -#endif objectiveregisters1 = ~flags & objectiveregisters1; //shorthand does not match } diff --git a/src/game/propobj.c b/src/game/propobj.c index 7acc4213..1c38e18b 100644 --- a/src/game/propobj.c +++ b/src/game/propobj.c @@ -9427,24 +9427,6 @@ apply_damage: { if (objGetDestroyedLevel(obj) == 1) { -#ifdef PORT - /* D318-followup (diagnosis only, GE_OBJT=1): timestamp each - * GAS_RELEASING prop destruction so the tank-blow tick is - * correlatable against the OBJT stage-flag writes. Read-only, - * capped, no behavior change; N64 build unaffected. */ - extern char *getenv(const char *); - static int s_gas = -1; - static int s_gasn = 0; - - if (s_gas < 0) { s_gas = getenv("GE_OBJT") != NULL; } - if (s_gas && (s_gasn < 200)) - { - osSyncPrintf("OBJT: t=%d GAS prop destroyed at (%.0f,%.0f,%.0f) [gas effect armed]\n", - (int)g_GlobalTimer, (double)obj->runtime_pos.x, - (double)obj->runtime_pos.y, (double)obj->runtime_pos.z); - s_gasn++; - } -#endif init_trigger_toxic_gas_effect(&obj->runtime_pos); } }