forked from Ports/goldeneye-pc-port
D309: add GE_D309 diagnostic probe at chrGoToBond failure branches (diagnosis only, #ifdef PORT)
This commit is contained in:
1 parent
ede16415f2
commit
8be34ba1f6
1 file changed
+57
@@ -10116,6 +10116,30 @@ bool chrGoToBond(ChrRecord *self, SPEED speed)
|
||||
{
|
||||
PropRecord *bondprop;
|
||||
|
||||
#ifdef PORT
|
||||
/* D309 (diagnosis only, GE_D309=1): the Caverns->intro complete freeze
|
||||
* spins in ai() on m_RunToBondPersistent the first time TRYRunToBond
|
||||
* FAILS for a guard on that list (the 1-byte AI_PRINT record is then
|
||||
* mis-sized by chraiitemsize's NUL scan -> phantom GotoNext(0) ->
|
||||
* chraiGoToLabel returns 0 -> tight restart loop, see findings.md D309).
|
||||
* The code+data are byte-matched ground truth, so the open question is
|
||||
* WHICH failure branch fires and in what game state at Caverns' end --
|
||||
* dead/shot gate, seen-count gate, or plot_course (whose three sub-
|
||||
* conditions are logged here: own stan-path, Bond's stan-path, route).
|
||||
* Read-only probe: chrlvStanPathRelated/waypointFindRoute are pure
|
||||
* lookups. No behavior change; N64 build unaffected. */
|
||||
extern char *getenv(const char *);
|
||||
extern u8 m_RunToBondPersistent[];
|
||||
extern s32 g_MainStageNum;
|
||||
extern LEVELID bossGetStageNum(void);
|
||||
static int s_d309 = -1;
|
||||
static int s_d309n = 0;
|
||||
int d309log;
|
||||
|
||||
if (s_d309 < 0) { s_d309 = getenv("GE_D309") != NULL; }
|
||||
d309log = s_d309 && (self->ailist == (AIRecord *)m_RunToBondPersistent) && (s_d309n < 400);
|
||||
#endif
|
||||
|
||||
if (chrIsNotDeadOrShot(self) && (g_SeenBondRecentlyGuardCount < 10))
|
||||
{
|
||||
bondprop = getCurrentPlayerProp();
|
||||
@@ -10124,12 +10148,45 @@ bool chrGoToBond(ChrRecord *self, SPEED speed)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
#ifdef PORT
|
||||
if (d309log)
|
||||
{
|
||||
waypoint *wpSelf = chrlvStanPathRelated(&self->prop->pos, self->prop->stan);
|
||||
waypoint *wpBond = chrlvStanPathRelated(&bondprop->pos, bondprop->stan);
|
||||
s32 route = -1;
|
||||
|
||||
if (wpSelf && wpBond)
|
||||
{
|
||||
waypoint sp44[MAX_CHRWAYPOINTS];
|
||||
|
||||
route = waypointFindRoute(wpSelf, wpBond, sp44, MAX_CHRWAYPOINTS);
|
||||
}
|
||||
osSyncPrintf("D309: FAIL-plot chr=%d act=%d flags2=0x%x stage=%d curload=%d mainstage=%d cammode=%d stoptime=%d seen=%d bondprop=%p bondstan=%p wpSelf=%p wpBond=%p route=%d\n",
|
||||
(int)self->chrnum, (int)self->actiontype, (int)self->chrflags & 0xffff,
|
||||
(int)bossGetStageNum(), (int)lvlGetCurrentStageToLoad(), (int)g_MainStageNum,
|
||||
(int)g_CameraMode, (int)stop_time_flag, (int)g_SeenBondRecentlyGuardCount,
|
||||
(void *)bondprop, (void *)bondprop->stan, (void *)wpSelf, (void *)wpBond, (int)route);
|
||||
s_d309n++;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#ifdef PORT
|
||||
else if (d309log)
|
||||
{
|
||||
osSyncPrintf("D309: FAIL-gate chr=%d act=%d deadOrShot=%d seen=%d stage=%d curload=%d mainstage=%d cammode=%d stoptime=%d\n",
|
||||
(int)self->chrnum, (int)self->actiontype, (int)(!chrIsNotDeadOrShot(self)),
|
||||
(int)g_SeenBondRecentlyGuardCount,
|
||||
(int)bossGetStageNum(), (int)lvlGetCurrentStageToLoad(), (int)g_MainStageNum,
|
||||
(int)g_CameraMode, (int)stop_time_flag);
|
||||
s_d309n++;
|
||||
}
|
||||
#endif
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Address 0x7F03350C0.
|
||||
*/
|
||||
|
||||
Reference in new issue
Block a user