Files
BFM-decomp/src/800_shared.h
T
Drew T 7df4895e7b feat(main): split src/800.c at the jtbl-span TU boundaries — spans B and C now carve
BYTE-IDENTICAL with NO function banked (gate_main --assert-baseline, clean rebuild),
which is the whole point: the structure lands first and proves neutral, then drafts bank
against it.

One code object contributes exactly ONE contiguous .rodata run, and 800.o's is span A,
so spans B and C each needed their own object:

  800    vram 0x800123F0-0x8002B0B4  -> .rodata span A (0x80072A38-0x80072C70)
  800_b  vram 0x8002B0B4-0x80035270  -> .rodata span B (0x80072E44-0x80073140)
  800_c  vram 0x80035270-0x8003A444  -> .rodata span C (0x800732A0-0x8007344C)

The span owners' address ranges are disjoint and ordered — tables pack tight WITHIN a
TU and are separated by other data ACROSS TUs — so these are (at least some of) the
original translation-unit boundaries. Splitting here is both the fix and the minimum;
any extra split would be speculation.

main's island is now a 7-piece data->rodata sandwich, so ld_interleave moves from
--front/--tail to --order.

THE SPLIT WAS CHEAP, AND MY FIRST ESTIMATE WAS WRONG. I costed it at '2,318 scattered
extern lines' — that is the TOTAL; what matters is how many CROSS a boundary, and that
is 57 of 1,247 declared names (4.6%), of which 19 are typedefs with exactly one
definition each and zero shape conflicts. Zero file-local statics. src/800_shared.h
carries exactly those, derived from the COMPILER's own errors rather than a regex model
of C (R33), and each typedef was MOVED, never copied.

Unlocks 17 functions / 4,471 instructions = 39% of what is left in main, incl.
SaveLoadRoutine (1139) and func_8003388C (663).
2026-09-02 13:27:29 -06:00

191 lines
4.5 KiB
C

#ifndef BFM_800_SHARED_H
#define BFM_800_SHARED_H
/* The include environment the original single TU had. Every TU of the split needs the same
* one: `psyq/libcd.h` supplies CdlLOC/CdlFILE to functions now in 800_c.c, and
* `shared/clearTbl40.h` supplies the CLEAR_TBL40 dedup macro whose two instantiation sites
* ended up in DIFFERENT TUs after the split. Both are guarded, so src/800.c keeping its own
* copies is harmless. */
#include "psyq/libcd.h"
#include "shared/clearTbl40.h"
/* P31 S72 — the declarations that CROSS the src/800.c -> 800_b.c -> 800_c.c split.
*
* Measured, not guessed: of 1,247 names declared across the three regions, only 57 are used
* outside the region that declares them, and 19 of those are typedefs. Every one had exactly
* ONE definition and zero shape conflicts, so this is a partition of the old file, not a
* rewrite — each typedef was MOVED here, never copied (a duplicate typedef is a C89 error).
* The set was derived from the compiler's own errors, not from a regex model of C (R33).
* See cookbook §426 and config/splat.us.exe.yaml for why the split exists at all. */
/* was: src/800.c */
typedef struct Ent30D80 {
/* 0x00 */ s32 unk00;
/* 0x04 */ u8 pad04[6];
/* 0x0A */ u16 unk0A;
/* 0x0C */ u8 pad0C[0x34];
/* 0x40 */ void (*unk40)(s32, s32);
/* 0x44 */ s32 unk44;
/* 0x48 */ u8 pad48[6];
/* 0x4E */ u8 unk4E;
/* 0x4F */ u8 pad4F;
/* 0x50 */ u8 unk50;
/* 0x51 */ u8 unk51;
} Ent30D80;
/* was: src/800.c */
typedef struct { u8 v; } W8;
/* was: src/800.c */
typedef struct Rec14 {
/* 0x00 */ u16 unk00;
/* 0x02 */ u16 unk02;
/* 0x04 */ u32 unk04;
/* 0x08 */ u32 unk08;
/* 0x0C */ u16 unk0C;
/* 0x0E */ u16 unk0E;
/* 0x10 */ u32 unk10;
} Rec14; /* 0x14 */
/* was: src/800.c */
typedef struct Owner4EE8 {
/* 0x00 */ u8 pad00[0x14];
/* 0x14 */ Rec14 **unk14;
} Owner4EE8;
/* was: src/800.c */
typedef struct Slot {
/* 0x00 */ s32 unk00;
/* 0x04 */ s32 unk04;
/* 0x08 */ u8 unk08[0xC];
/* 0x14 */ s16 unk14;
/* 0x16 */ u8 unk16[2];
/* 0x18 */ s16 unk18;
/* 0x1A */ u8 unk1A[0x26];
/* 0x40 */ s32 unk40;
/* 0x44 */ u8 unk44;
/* 0x45 */ u8 unk45[3];
} Slot;
/* was: src/800.c */
typedef struct {
s16 unk00;
s16 unk02;
s16 unk04;
s16 unk06;
s16 unk08;
s16 unk0A;
s16 unk0C;
s16 unk0E;
u8 unk10;
u8 unk11;
u8 unk12;
u8 unk13;
s32 unk14;
} Rsc24; /* 0x18 */
/* was: src/800.c */
typedef struct {
/* 0x00 */ u8 *unk00;
/* 0x04 */ u8 pad04[2];
/* 0x06 */ u8 unk06;
/* 0x07 */ u8 unk07;
/* 0x08 */ u8 unk08;
/* 0x09 */ u8 pad09[3];
} A12; /* 0x0C */
/* was: src/800.c */
typedef struct {
/* 0x00 */ s32 unk00;
/* 0x04 */ s16 unk04;
/* 0x06 */ s16 unk06;
/* 0x08 */ s16 unk08;
/* 0x0A */ u8 unk0A;
/* 0x0B */ u8 unk0B;
} B12; /* 0x0C */
/* was: src/800.c */
typedef struct {
/* 0x00 */ u8 pad00[4];
/* 0x04 */ u8 unk04;
/* 0x05 */ u8 pad05[11];
/* 0x10 */ u16 unk10;
/* 0x12 */ u16 unk12;
/* 0x14 */ u8 pad14[2];
/* 0x16 */ s16 unk16;
/* 0x18 */ u8 pad18[8];
} C24; /* 0x20 */
/* was: src/800.c */
typedef struct { /* 0x18 stride; D_800A463C + k*0x18 */
s32 unk00;
u8 unk04[0x14];
} Ent24;
/* was: src/800.c */
typedef struct { /* base 0x80064D49, stride 0x0C */
u8 unk00;
u8 pad[11];
} Elm12;
/* was: src/800.c */
typedef struct { /* base 0x80076240, stride 0x10 */
u16 unk00;
u16 unk02;
s32 unk04;
s32 unk08;
s32 unk0C;
} Slot16A;
/* was: src/800.c */
typedef struct {
s32 unk00;
s32 unk04;
s32 unk08;
u8 unk0C;
u8 unk0D;
u8 unk0E;
u8 unk0F;
} Slot16; /* 0x10 */
/* was: src/800.c */
typedef struct { s32 v; } W32;
/* was: src/800.c */
typedef struct Slot54 {
/* 0x00 */ s16 unk00;
/* 0x02 */ s16 unk02;
/* 0x04 */ s16 unk04;
/* 0x06 */ s16 unk06;
/* 0x08 */ u16 unk08;
/* 0x0A */ s8 unk0A;
} Slot54;
/* was: src/800.c */
typedef struct { u16 f0; } H2; /* 0x2 */
/* was: src/800.c */
typedef struct {
s32 unk00;
u8 unk04;
u8 unk05;
u8 unk06;
u8 unk07;
u8 unk08;
u8 unk09;
u8 unk0A;
u8 unk0B;
s32 unk0C;
} Rsc16; /* 0x10 */
/* was: src/800_c.c */
typedef struct { s16 v; } W16;
/* was: src/800_c.c */
typedef struct {
u8 unk00;
u8 unk01[11];
} Rsc12; /* 0x0C */
#endif /* BFM_800_SHARED_H */