From fbd57d38e1a633dac8f0a5a907a9416ebd2ca464 Mon Sep 17 00:00:00 2001 From: Christopher Williams Date: Fri, 25 Sep 2026 10:39:15 -0400 Subject: [PATCH] phase12: track verified adjacency sources --- src/func_8008FFC4.c | 27 +++++++++++++++++++++++++++ src/func_80107D18.c | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+) create mode 100644 src/func_8008FFC4.c create mode 100644 src/func_80107D18.c diff --git a/src/func_8008FFC4.c b/src/func_8008FFC4.c new file mode 100644 index 0000000..404636f --- /dev/null +++ b/src/func_8008FFC4.c @@ -0,0 +1,27 @@ +/* + * func_8008FFC4 — 100 bytes at 0x8008FFC4..0x80090028 + * + * Gate one callback on a gp sentinel, then dispatch on the low byte of the + * argument to one of two no-argument callbacks. + * + * The globals and helper purposes are address-based hypotheses; the byte + * match is the evidence for this region. + */ + +extern int D_80121EF4; +extern int D_80122660; +extern int D_80122670; +extern void func_8008FCD8(int, int); +extern void func_80100334(void); +extern void func_8010036C(void); + +void func_8008FFC4(int a0) +{ + if (D_80121EF4 != -1) + func_8008FCD8(D_80122660, D_80122670); + + if ((a0 & 0xff) != 0) + func_80100334(); + else + func_8010036C(); +} diff --git a/src/func_80107D18.c b/src/func_80107D18.c new file mode 100644 index 0000000..2b0347f --- /dev/null +++ b/src/func_80107D18.c @@ -0,0 +1,38 @@ +/* + * func_80107D18 — 100 bytes at 0x80107D18..0x80107D7C + * + * Insert a node into a doubly linked list, updating the head when the list is + * empty. The next field is cleared before the list walk so its store occupies + * the branch delay slot in the original. + * + * The list field meanings and global names are address-based hypotheses; the + * byte match is the evidence for this region. + */ + +extern int D_801221C4; +extern int D_801221C8; + +void func_80107D18(int *a0) +{ + int *p = (int *)D_801221C4; + + D_801221C8 = 1; + if (p == a0) + goto done; + if (a0[0] != 0) + goto done; + a0[1] = 0; + + if (p == 0) { + D_801221C4 = (int)a0; + a0[0] = 0; + } else { + while (p[1] != 0) + p = (int *)p[1]; + p[1] = (int)a0; + a0[0] = (int)p; + } + +done: + D_801221C8 = 0; +}