From 8bbf2e8e4d5d2c49620613367b020caf5897c3ac Mon Sep 17 00:00:00 2001 From: Drew T <50529377+Druthulu@users.noreply.github.com> Date: Mon, 15 Jun 2026 18:54:21 -0600 Subject: [PATCH] =?UTF-8?q?feat(phase-8):=20link=20libspu+libsnd=20combine?= =?UTF-8?q?d=20sound=20region=20(T9+T10)=20=E2=80=94=2060=20objs=20/=20+22?= =?UTF-8?q?5=20fns?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - libspu and libsnd interleave in 0x3A444..0x4239C (the 800-subseg tail), so they link as ONE combined region rather than two tangled passes - NEW tools/make_snd_used.py: build the curated combined dir — merge both libs by vram, pick the byte-matching object per aliased address (link_object), exclude 4 addresses that don't reconcile in-region (kept as byte-identical stubs): 0x3C438 S_R/S_W, 0x3D424 S_GRMDT/FB/T — scattered-.bss commons, cross-object (§9.1) 0x3D94C S_IH/UT_RON — false placement (inside libsnd SSSTART.o) 0x3FA64 VM_F (237 ins) — scattered-.bss commons (the one real loss) - subsegs via gen_lib_subsegs.py (9 snd blocks + 8 sgap game/excluded-stub gaps); integrate window 0x3A444..0x4239C; region byte-verified 60/60 - src/800.c trimmed at [0x3A444,0x4239C): kept 732 items < 0x3A444 (ALL matched C + game + the deferred SSGM stub preserved), 0 real-C moved - dual byte-gate PASS: 143dbb89 with and without the sound objects - LINKED 710 -> 935 (+225); REAL still 43; byte-identical 48.66% (nearly half the EXE) - deferred: SSGM.o @0x1BD80 (isolated, matched-C region, 8 ins) --- Makefile | 15 +- config/splat.us.exe.yaml | 24 +- docs/progress.md | 8 +- docs/psyq-worklist.md | 3 +- phase-ends/CURRENT_PHASE.md | 3 +- src/800.c | 537 ------------------------------------ src/sgap.c | 3 + src/sgap_2.c | 3 + src/sgap_3.c | 3 + src/sgap_4.c | 5 + src/sgap_5.c | 3 + src/sgap_6.c | 5 + src/sgap_7.c | 15 + src/sgap_8.c | 25 ++ src/snd1.c | 140 ++++++++++ src/snd2.c | 136 +++++++++ src/snd3.c | 11 + src/snd4.c | 27 ++ src/snd5.c | 3 + src/snd6.c | 82 ++++++ src/snd7.c | 24 ++ src/snd8.c | 5 + src/snd9.c | 64 +++++ tools/make_snd_used.py | 66 +++++ 24 files changed, 664 insertions(+), 546 deletions(-) create mode 100644 src/sgap.c create mode 100644 src/sgap_2.c create mode 100644 src/sgap_3.c create mode 100644 src/sgap_4.c create mode 100644 src/sgap_5.c create mode 100644 src/sgap_6.c create mode 100644 src/sgap_7.c create mode 100644 src/sgap_8.c create mode 100644 src/snd1.c create mode 100644 src/snd2.c create mode 100644 src/snd3.c create mode 100644 src/snd4.c create mode 100644 src/snd5.c create mode 100644 src/snd6.c create mode 100644 src/snd7.c create mode 100644 src/snd8.c create mode 100644 src/snd9.c create mode 100644 tools/make_snd_used.py diff --git a/Makefile b/Makefile index a82bc6a3aa..df3f4babaf 100644 --- a/Makefile +++ b/Makefile @@ -211,6 +211,14 @@ LIBGTE_OBJDIR := build/psyq/libgte LIBGTE_SYMS := build/psyq/libgte_externals.ld LIBGTE_STUBS := libgte1,libgte2,libgte3,libgte4,libgte5,libgte6,libgte7,libgte8,libgte9,libgte10,libgte11,libgte12,libgte13,libgte14,libgte15,libgte16,libgte17,libgte18,libgte19,libgte20,libgte21,libgte22 +# Combined libspu+libsnd sound region (Phase 8): the two SDK sound libs interleave in 0x3A444..0x4239C +# so they link as one 60-object region (snd1..snd9). Curated dir .run/obj40/snd_used built by +# tools/make_snd_used.py (4 addresses excluded as scattered-.bss/false-positive stubs). Window arg below. +SND_ELF := .run/obj40/snd_used +SND_OBJDIR := build/psyq/snd +SND_SYMS := build/psyq/snd_externals.ld +SND_STUBS := snd1,snd2,snd3,snd4,snd5,snd6,snd7,snd8,snd9 + # Assembler flags (docs/SETUP.md §6.2). -G0 is confirmed by the disassembly # (ledger #8: zero $gp-relative addressing). -no-pad-sections keeps section ends # un-padded so the link reproduces the original layout. @@ -316,7 +324,12 @@ $(OUT): $(OBJS) $(LD_SCRIPT) else echo " (no $(LIBGTE_ELF) — libgte region stays asm stubs; run tools/psyq_build_libs.sh LIBGTE)" fi - SYMS=""; [ -f "$(LIBCD_SYMS)" ] && SYMS="-T $(LIBCD_SYMS)"; [ -f "$(LIBGS_SYMS)" ] && SYMS="$$SYMS -T $(LIBGS_SYMS)"; [ -f "$(LIBETC_SYMS)" ] && SYMS="$$SYMS -T $(LIBETC_SYMS)"; [ -f "$(LIBGPU_SYMS)" ] && SYMS="$$SYMS -T $(LIBGPU_SYMS)"; [ -f "$(LIBMCRD_SYMS)" ] && SYMS="$$SYMS -T $(LIBMCRD_SYMS)"; [ -f "$(LIBC2_SYMS)" ] && SYMS="$$SYMS -T $(LIBC2_SYMS)"; [ -f "$(LIBGTE_SYMS)" ] && SYMS="$$SYMS -T $(LIBGTE_SYMS)" + if [ -d "$(SND_ELF)" ]; then + $(PYTHON) tools/psyq_integrate.py $(SND_ELF) $(LD_SCRIPT) $(SND_OBJDIR) $(SND_SYMS) $(SND_STUBS) 0x8003A444 0x8004239C + else + echo " (no $(SND_ELF) — sound region stays asm stubs; run tools/psyq_build_libs.sh LIBSPU LIBSND + tools/make_snd_used.py)" + fi + SYMS=""; [ -f "$(LIBCD_SYMS)" ] && SYMS="-T $(LIBCD_SYMS)"; [ -f "$(LIBGS_SYMS)" ] && SYMS="$$SYMS -T $(LIBGS_SYMS)"; [ -f "$(LIBETC_SYMS)" ] && SYMS="$$SYMS -T $(LIBETC_SYMS)"; [ -f "$(LIBGPU_SYMS)" ] && SYMS="$$SYMS -T $(LIBGPU_SYMS)"; [ -f "$(LIBMCRD_SYMS)" ] && SYMS="$$SYMS -T $(LIBMCRD_SYMS)"; [ -f "$(LIBC2_SYMS)" ] && SYMS="$$SYMS -T $(LIBC2_SYMS)"; [ -f "$(LIBGTE_SYMS)" ] && SYMS="$$SYMS -T $(LIBGTE_SYMS)"; [ -f "$(SND_SYMS)" ] && SYMS="$$SYMS -T $(SND_SYMS)" echo " LD $(ELF)" $(LD) -T $(LD_SCRIPT) -T $(UNDEF_SYMS) -T $(UNDEF_FUNCS) $$SYMS --no-check-sections -Map $(MAPFILE) -o $(ELF) echo " OBJCOPY $@" diff --git a/config/splat.us.exe.yaml b/config/splat.us.exe.yaml index 8a5f839c66..17633bfb4b 100644 --- a/config/splat.us.exe.yaml +++ b/config/splat.us.exe.yaml @@ -73,7 +73,29 @@ segments: # INCLUDE_ASM (Phase-7 regression gate) — opt level only affects matched C, not stubs. # Boundary = func_800123F0 (vram 0x800123F0 -> file vram-0x8000F800 = 0x2BF0). - [0x800, c, boot] # -O0 boot module -> src/boot.c (vram 0x80010000-0x800123F0) - - [0x2BF0, c, 800] # -O2 game code -> src/800.c (vram 0x800123F0-0x8004239C); name "800" kept (legacy) so the matched fns + their asm/nonmatchings/800 paths don't migrate + - [0x2BF0, c, 800] # -O2 game code -> src/800.c (vram 0x800123F0-0x8003A444); name "800" kept (legacy) so the matched fns + their asm/nonmatchings/800 paths don't migrate + # PsyQ libspu+libsnd COMBINED sound region (Phase 8): the two SDK sound libs are interleaved here, + # so they link as one 60-object region (curated by tools/make_snd_used.py; 4 addresses excluded as + # scattered-.bss/false-positive stubs: S_R/S_W 0x3C438, S_GRMDT* 0x3D424, S_IH/UT_RON 0x3D94C, + # VM_F 0x3FA64). Subsegs via gen_lib_subsegs.py; integrate window 0x3A444..0x4239C. snd1..snd9 link; + # sgap* = game code + the 4 excluded stubs. (libsnd SSGM.o @0x1BD80 stays a stub in 800.) + - [0x2AC44, c, snd1] # snd block 1: 15 obj (S_INI.o..S_SK.o) vram 0x8003A444-0x8003C438 + - [0x2CC38, c, sgap] # game code (vram 0x8003C438-0x8003C498) + - [0x2CC98, c, snd2] # snd block 2: 8 obj (S_STSA.o..S_SRMD.o) vram 0x8003C498-0x8003D424 + - [0x2DC24, c, sgap_2] # game code + excluded S_GRMDT stub (vram 0x8003D424-0x8003D434) + - [0x2DC34, c, snd3] # snd block 3: 4 obj (S_GRMD.o..SSINIT.o) vram 0x8003D434-0x8003D630 + - [0x2DE30, c, sgap_3] # game code (vram 0x8003D630-0x8003D650) + - [0x2DE50, c, snd4] # snd block 4: 3 obj (SSSATTR.o..SSCALL.o) vram 0x8003D650-0x8003DC90 + - [0x2E490, c, sgap_4] # game code (vram 0x8003DC90-0x8003E248) + - [0x2EA48, c, snd5] # snd block 5: 1 obj (PAUSE.o) vram 0x8003E248-0x8003E2E4 + - [0x2EAE4, c, sgap_5] # game code (vram 0x8003E2E4-0x8003E310) + - [0x2EB10, c, snd6] # snd block 6: 12 obj (MIDIREAD.o..VM_ALOC2.o) vram 0x8003E310-0x8003FA54 + - [0x30254, c, sgap_6] # game code + excluded VM_F stub (vram 0x8003FA54-0x8003FE18) + - [0x30618, c, snd7] # snd block 7: 5 obj (S_SNV.o..VM_N2P.o) vram 0x8003FE18-0x800403A4 + - [0x30BA4, c, sgap_7] # game code (vram 0x800403A4-0x80040868) + - [0x31068, c, snd8] # snd block 8: 1 obj (VM_NOWOF.o) vram 0x80040868-0x80040938 + - [0x31138, c, sgap_8] # game code (vram 0x80040938-0x800414E4) + - [0x31CE4, c, snd9] # snd block 9: 11 obj (VM_VSU.o..VS_VTC.o) vram 0x800414E4-0x8004239C # PsyQ libetc region (Phase 8): 5 objects (VSYNC/INTR/INTR_VB/INTR_DMA/VMODE) form ONE # contiguous block at the tail of the old 800 subseg, ending exactly at libcd1 (0x80043088). # psyq_integrate swaps src/libetc.o(.text) -> build/psyq/libetc/*.o + NOLOAD data (libcd model). diff --git a/docs/progress.md b/docs/progress.md index 06b96b78bf..822836240a 100644 --- a/docs/progress.md +++ b/docs/progress.md @@ -1,17 +1,17 @@ # BFM matching progress (generated by tools/progress.py — authoritative) REAL substantive matches : 43 <- the Gen1-exit >=25 bar counts THIS -LINKED real PsyQ objects : 710 <- byte-identical via linked SDK objects +LINKED real PsyQ objects : 935 <- byte-identical via linked SDK objects NON_MATCHING (near-miss) : 7 splat-auto empty no-ops : 42 -INCLUDE_ASM stubs : 1294 +INCLUDE_ASM stubs : 1069 data blobs (excluded) : 2 ---------------------------------------- matchable functions : 2096 REAL / matchable : 43 / 2096 = 2.05% -byte-identical/ matchable: 795 / 2096 = 37.93% (REAL+LINKED+empties) +byte-identical/ matchable: 1020 / 2096 = 48.66% (REAL+LINKED+empties) -LINKED subsegs: libc2_1 libc2_2 libcd1 libcd2 libetc libgpu libgs1 libgs2 libgs3 libgs4 libgs5 libgs6 libgte1 libgte10 libgte11 libgte12 libgte13 libgte14 libgte15 libgte16 libgte17 libgte18 libgte19 libgte2 libgte20 libgte21 libgte22 libgte3 libgte4 libgte5 libgte6 libgte7 libgte8 libgte9 libmcrd1 libmcrd2 (710 fns) +LINKED subsegs: libc2_1 libc2_2 libcd1 libcd2 libetc libgpu libgs1 libgs2 libgs3 libgs4 libgs5 libgs6 libgte1 libgte10 libgte11 libgte12 libgte13 libgte14 libgte15 libgte16 libgte17 libgte18 libgte19 libgte2 libgte20 libgte21 libgte22 libgte3 libgte4 libgte5 libgte6 libgte7 libgte8 libgte9 libmcrd1 libmcrd2 snd1 snd2 snd3 snd4 snd5 snd6 snd7 snd8 snd9 (935 fns) REAL matches: CdQueueBusy CdReadRequest DebugMenuHandler GameModeDispatch LoaderResetReadState LzssDecodeSector ResourceGetCdLoc func_80012AB0 func_800168B4 func_80018F20 func_80019018 func_80019198 func_80019378 func_80019388 func_80019398 func_800193A8 func_8001AA78 func_8001AA88 func_8001B22C func_8001B374 func_8001B384 func_8001B85C func_8001BE20 func_8001BFA0 func_8001BFE8 func_8001D0E8 func_80029254 func_80029264 func_80029504 func_80029514 func_8002953C func_8002954C func_8002957C func_8002958C func_80029FD4 func_8002A26C func_8002A27C func_8002A4B8 func_8002A4C8 func_8002A728 func_8002A738 func_8002A998 func_8002A9A8 NON_MATCHING: CdReadSectorReadyCB CdReadStateMachine LoaderInitFileTable ResourceLoadStateMachine StreamLoadStateMachine func_80015A74 func_80016714 diff --git a/docs/psyq-worklist.md b/docs/psyq-worklist.md index d5b8f2d48c..e45f6103eb 100644 --- a/docs/psyq-worklist.md +++ b/docs/psyq-worklist.md @@ -19,8 +19,7 @@ | 4 | **libc2** | 17 / 46 | 800b2 (`0x8005C2C8`–`0x5CD98` + STRCAT `0x80061E90`) | ~3.1k | C stdlib (BZERO/MEMCPY/STRCMP/PRINTF/PRNT…); contiguous run + 1 outlier. **PRNT.o (418 ins) has an internal jtbl** — verify NOLOAD `.rodata` placement (the `PRNT_OBJ_24C` rodata note). | | 5 | **libcard** | 11 / 18 | 800b2 (`0x80061F38`–`0x80062808`) | ~0.5k | 11 short objects (mostly 4–46 ins). **C112.o alias with libapi** (both claim `0x80061F38`). Short objects → windowed placement. | | 6 | **libapi** | 33 / 90 | 800b2 (scattered `0x8005CE18`–`0x800626B8`) | ~0.5k | Mostly **4-ins BIOS syscall stubs** (A##/C##/L##); interleaved with libcard/libc2/libmcrd. 1 ambiguous (SEND), C112 alias. **Windowed + alias disambiguation.** | -| 7 | **libspu** | 38 / 129 | 800 sound (`0x8003A444`–`0x800422E8`) | ~12k | SPU.o(741)/S_SRMP(318)/SR_SV(399)/S_SCA(229)…; **interleaved with libsnd**; aliases (S_R≡S_W @`0x8003C438`; S_GRMDT/FB/T @`0x8003D424`; S_IH @`0x8003D94C`≡libsnd UT_RON). 1 ambiguous (S_I). Windowed. | -| 8 | **libsnd** | 32 / 163 | 800 (`0x8003D454`–`0x80042374` + SSGM `0x8001BD80` isolated) | ~12k | SSSTART(206)/MIDIREAD(445)/VS_VH(283)/UT_KEYV(259)…; **interleaved with libspu**; SSINIT_C≡SSINIT_H @`0x8003D518`; UT_RON @`0x8003D94C`. 6 ambiguous (PLAY/SSNOFF/SSQUIT/UT_ROFF/VM_DOFF/VM_VIB). Windowed + isolated SSGM block. | +| 7+8 | **libspu+libsnd** | 60 / (38+32) | 800 sound (`0x8003A444`–`0x8004239C`) | ~24k | ✅ **DONE (combined region): 60 objs / 9 blocks / +225 fns.** The two libs interleave, so linked as ONE region (`tools/make_snd_used.py` dedups + excludes 4 addresses; `gen_lib_subsegs.py` + window). **Excluded:** S_R/S_W `0x3C438`, S_GRMDT* `0x3D424`, S_IH/UT_RON `0x3D94C` (false-positive, inside SSSTART), VM_F `0x3FA64` (237 ins) — all scattered-`.bss`/false-pos, stay stubs. SSGM.o `0x1BD80` deferred (isolated in matched-C, 8 ins). | | 9 | **libgte** | 58 / 381 | 800b (`0x8004787C`–`0x5082C`) + **libgs gaps** | ~48k | ✅ **DONE (T11): 53 objs / 22 blocks linked** in 800b (subsegs via `gen_lib_subsegs.py`; integrate window 0x4787C..0x51804). **5 libgs-gap objects DEFERRED** (MTX_05/07/11/REG03/REG11 → gsgap1/2/4/5 stay stubs; gsgap2≠MTX_07 exactly so needs sub-split). | **SKIP — zero footprint (recorded, not linked by the EXE):** `libmath` 0/48, `libc` 0/56, `libsn` 0/51 (2 tiny ambiguous). BFM links **libc2**, not libc; no libmath/libsn. (Also unbuilt/no-footprint: libcomb, libds, libgun, libsio, libtap, libpress — never converted, no symbols.) diff --git a/phase-ends/CURRENT_PHASE.md b/phase-ends/CURRENT_PHASE.md index e816fbe2d4..6c3044392c 100644 --- a/phase-ends/CURRENT_PHASE.md +++ b/phase-ends/CURRENT_PHASE.md @@ -23,7 +23,8 @@ - [x] **libmcrd** (2 objs / +104 fns) — clean (27 `.bss` commons all recovered); 2 non-adjacent blocks (libmcrd1/libmcrd2) splitting 800c; dual byte-gate PASS; LINKED 424→528. - [x] **libc2** (17 objs / +62 fns) — C stdlib, 2 blocks (16-obj main libc2_1 + STRCAT libc2_2; PRNT jtbl OK). Hit + fixed the **boundary gotcha**: SETJMP.o `.text`=0x80 (8-align pad) not 0x78 → 800c3 boundary was 8 low → +8 global shift; fixed to 0x5CE18. Lesson recorded in worklist. dual byte-gate PASS; LINKED 528→590. - [x] **libgte** (53/58 objs / +120 fns; 22 blocks) — reordered value-first. Built `tools/gen_lib_subsegs.py` (generates multi-block subseg lines w/ section-size boundaries) + integrate window. progress.py now resolves `$(VAR)` stub lists. 5 libgs-gap objects DEFERRED. dual byte-gate PASS; LINKED 590→710, byte-identical **37.93%**. - - [ ] libspu · libsnd · libcard · libapi *(order: value-first; libcard+libapi dense/last)* + - [x] **libspu+libsnd COMBINED sound region** (60/70 objs / +225 fns; 9 blocks) — the two libs interleave so linked as ONE region. New `tools/make_snd_used.py` (alias dedup by byte-match + exclude-by-address). 4 addresses excluded (scattered-`.bss`/false-pos: S_R/S_GRMDT/S_IH/VM_F), SSGM deferred. All matched C preserved (trim kept 732 < 0x3A444). dual byte-gate PASS; LINKED 710→935, byte-identical **48.66%**. + - [ ] libcard + libapi *(dense tiny syscall stubs in 800c2, low value; combined approach; last)* - [ ] **T(N+1)** — Deferred-library hard-case documentation (honest stub deferrals, structured comments, worklist notes). *(xHigh)* - [ ] **T(N+2)** — Game-code harvest (read cookbook+§5.4 first; sig-refresh → difficulty.md regen → cheap non-jtbl game leaves; bank, don't exhaust). *(xHigh; optional breadth)* **→ report #4** - [ ] **T(N+3)** — Headers (`include/psyq/*.h`) + cookbook §9 flywheel (R16) + SETUP/memory-map refresh (R21). *(xHigh)* diff --git a/src/800.c b/src/800.c index 89eb452709..ccf2b36815 100644 --- a/src/800.c +++ b/src/800.c @@ -2807,540 +2807,3 @@ INCLUDE_ASM("asm/nonmatchings/800", func_8003A3D8); INCLUDE_ASM("asm/nonmatchings/800", func_8003A404); INCLUDE_ASM("asm/nonmatchings/800", func_8003A424); - -INCLUDE_ASM("asm/nonmatchings/800", func_8003A444); - -INCLUDE_ASM("asm/nonmatchings/800", func_8003A53C); - -INCLUDE_ASM("asm/nonmatchings/800", func_8003A5B8); - -INCLUDE_ASM("asm/nonmatchings/800", SPU_OBJ_DC); - -INCLUDE_ASM("asm/nonmatchings/800", func_8003A84C); - -INCLUDE_ASM("asm/nonmatchings/800", SPU_OBJ_3AC); - -INCLUDE_ASM("asm/nonmatchings/800", SPU_OBJ_440); - -INCLUDE_ASM("asm/nonmatchings/800", _spu_FiDMA); - -INCLUDE_ASM("asm/nonmatchings/800", SPU_OBJ_510); - -INCLUDE_ASM("asm/nonmatchings/800", _spu_Fr_); - -INCLUDE_ASM("asm/nonmatchings/800", func_8003AB84); - -INCLUDE_ASM("asm/nonmatchings/800", SPU_OBJ_7C0); - -INCLUDE_ASM("asm/nonmatchings/800", SPU_OBJ_848); - -INCLUDE_ASM("asm/nonmatchings/800", func_8003AE14); - -INCLUDE_ASM("asm/nonmatchings/800", SPU_OBJ_8CC); - -INCLUDE_ASM("asm/nonmatchings/800", _spu_Fr); - -INCLUDE_ASM("asm/nonmatchings/800", func_8003AF04); - -void SPU_OBJ_98C(void) { -} - -INCLUDE_ASM("asm/nonmatchings/800", func_8003AF4C); - -void SPU_OBJ_A30(void) { -} - -INCLUDE_ASM("asm/nonmatchings/800", _spu_FgetRXXa); - -void SPU_OBJ_A6C(void) { -} - -INCLUDE_ASM("asm/nonmatchings/800", _spu_FsetPCR); - -INCLUDE_ASM("asm/nonmatchings/800", SPU_OBJ_AC4); - -INCLUDE_ASM("asm/nonmatchings/800", func_8003B08C); - -INCLUDE_ASM("asm/nonmatchings/800", func_8003B0B8); - -INCLUDE_ASM("asm/nonmatchings/800", func_8003B0E4); - -INCLUDE_ASM("asm/nonmatchings/800", func_8003B0FC); - -INCLUDE_ASM("asm/nonmatchings/800", SPU_OBJ_B74); - -INCLUDE_ASM("asm/nonmatchings/800", func_8003B14C); - -INCLUDE_ASM("asm/nonmatchings/800", func_8003B170); - -INCLUDE_ASM("asm/nonmatchings/800", func_8003B1EC); - -void S_SE_OBJ_5C(void) { -} - -INCLUDE_ASM("asm/nonmatchings/800", func_8003B250); - -INCLUDE_ASM("asm/nonmatchings/800", func_8003B280); - -INCLUDE_ASM("asm/nonmatchings/800", S_SR_OBJ_B0); - -INCLUDE_ASM("asm/nonmatchings/800", S_SR_OBJ_B4); - -INCLUDE_ASM("asm/nonmatchings/800", _SpuIsInAllocateArea); - -INCLUDE_ASM("asm/nonmatchings/800", S_M_UTIL_OBJ_2C); - -void S_M_UTIL_OBJ_78(void) { -} - -INCLUDE_ASM("asm/nonmatchings/800", func_8003B3D0); - -INCLUDE_ASM("asm/nonmatchings/800", S_M_UTIL_OBJ_B8); - -void S_M_UTIL_OBJ_104(void) { -} - -INCLUDE_ASM("asm/nonmatchings/800", func_8003B45C); - -INCLUDE_ASM("asm/nonmatchings/800", S_SRMP_OBJ_170); - -INCLUDE_ASM("asm/nonmatchings/800", S_SRMP_OBJ_180); - -INCLUDE_ASM("asm/nonmatchings/800", S_SRMP_OBJ_334); - -INCLUDE_ASM("asm/nonmatchings/800", S_SRMP_OBJ_420); - -INCLUDE_ASM("asm/nonmatchings/800", S_SRMP_OBJ_444); - -INCLUDE_ASM("asm/nonmatchings/800", S_SRMP_OBJ_4C4); - -INCLUDE_ASM("asm/nonmatchings/800", func_8003B954); - -INCLUDE_ASM("asm/nonmatchings/800", func_8003BE24); - -INCLUDE_ASM("asm/nonmatchings/800", S_RRWA_OBJ_40); - -INCLUDE_ASM("asm/nonmatchings/800", func_8003BE74); - -INCLUDE_ASM("asm/nonmatchings/800", func_8003BE98); - -INCLUDE_ASM("asm/nonmatchings/800", S_SAV_OBJ_38); - -INCLUDE_ASM("asm/nonmatchings/800", S_SAV_OBJ_114); - -INCLUDE_ASM("asm/nonmatchings/800", S_SAV_OBJ_1E8); - -INCLUDE_ASM("asm/nonmatchings/800", S_SAV_OBJ_1F8); - -INCLUDE_ASM("asm/nonmatchings/800", func_8003C0A0); - -INCLUDE_ASM("asm/nonmatchings/800", S_CRWA_OBJ_9C); - -INCLUDE_ASM("asm/nonmatchings/800", S_CRWA_OBJ_100); - -INCLUDE_ASM("asm/nonmatchings/800", S_CRWA_OBJ_174); - -INCLUDE_ASM("asm/nonmatchings/800", func_8003C23C); - -INCLUDE_ASM("asm/nonmatchings/800", S_SK_OBJ_1EC); - -void S_SK_OBJ_1F4(void) { -} - -INCLUDE_ASM("asm/nonmatchings/800", func_8003C438); - -INCLUDE_ASM("asm/nonmatchings/800", func_8003C498); - -INCLUDE_ASM("asm/nonmatchings/800", S_STSA_OBJ_48); - -INCLUDE_ASM("asm/nonmatchings/800", func_8003C4F0); - -INCLUDE_ASM("asm/nonmatchings/800", S_ITC_OBJ_88); - -INCLUDE_ASM("asm/nonmatchings/800", S_ITC_OBJ_90); - -INCLUDE_ASM("asm/nonmatchings/800", func_8003C598); - -INCLUDE_ASM("asm/nonmatchings/800", S_SCA_OBJ_5C); - -INCLUDE_ASM("asm/nonmatchings/800", S_SCA_OBJ_64); - -INCLUDE_ASM("asm/nonmatchings/800", S_SCA_OBJ_6C); - -INCLUDE_ASM("asm/nonmatchings/800", S_SCA_OBJ_74); - -INCLUDE_ASM("asm/nonmatchings/800", S_SCA_OBJ_7C); - -INCLUDE_ASM("asm/nonmatchings/800", S_SCA_OBJ_84); - -INCLUDE_ASM("asm/nonmatchings/800", S_SCA_OBJ_8C); - -INCLUDE_ASM("asm/nonmatchings/800", S_SCA_OBJ_94); - -INCLUDE_ASM("asm/nonmatchings/800", S_SCA_OBJ_9C); - -INCLUDE_ASM("asm/nonmatchings/800", S_SCA_OBJ_CC); - -INCLUDE_ASM("asm/nonmatchings/800", S_SCA_OBJ_124); - -INCLUDE_ASM("asm/nonmatchings/800", S_SCA_OBJ_12C); - -INCLUDE_ASM("asm/nonmatchings/800", S_SCA_OBJ_134); - -INCLUDE_ASM("asm/nonmatchings/800", S_SCA_OBJ_13C); - -INCLUDE_ASM("asm/nonmatchings/800", S_SCA_OBJ_144); - -INCLUDE_ASM("asm/nonmatchings/800", S_SCA_OBJ_14C); - -INCLUDE_ASM("asm/nonmatchings/800", S_SCA_OBJ_154); - -INCLUDE_ASM("asm/nonmatchings/800", S_SCA_OBJ_15C); - -INCLUDE_ASM("asm/nonmatchings/800", S_SCA_OBJ_164); - -INCLUDE_ASM("asm/nonmatchings/800", S_SCA_OBJ_194); - -INCLUDE_ASM("asm/nonmatchings/800", S_SCA_OBJ_288); - -INCLUDE_ASM("asm/nonmatchings/800", S_SCA_OBJ_2DC); - -INCLUDE_ASM("asm/nonmatchings/800", S_SCA_OBJ_330); - -INCLUDE_ASM("asm/nonmatchings/800", S_SCA_OBJ_384); - -INCLUDE_ASM("asm/nonmatchings/800", func_8003C92C); - -INCLUDE_ASM("asm/nonmatchings/800", SR_SV_OBJ_1EC); - -INCLUDE_ASM("asm/nonmatchings/800", SR_SV_OBJ_1F4); - -INCLUDE_ASM("asm/nonmatchings/800", SR_SV_OBJ_1FC); - -INCLUDE_ASM("asm/nonmatchings/800", SR_SV_OBJ_204); - -INCLUDE_ASM("asm/nonmatchings/800", SR_SV_OBJ_20C); - -INCLUDE_ASM("asm/nonmatchings/800", SR_SV_OBJ_214); - -INCLUDE_ASM("asm/nonmatchings/800", SR_SV_OBJ_21C); - -INCLUDE_ASM("asm/nonmatchings/800", SR_SV_OBJ_224); - -INCLUDE_ASM("asm/nonmatchings/800", SR_SV_OBJ_22C); - -INCLUDE_ASM("asm/nonmatchings/800", SR_SV_OBJ_25C); - -INCLUDE_ASM("asm/nonmatchings/800", SR_SV_OBJ_2BC); - -INCLUDE_ASM("asm/nonmatchings/800", SR_SV_OBJ_2C4); - -INCLUDE_ASM("asm/nonmatchings/800", SR_SV_OBJ_2CC); - -INCLUDE_ASM("asm/nonmatchings/800", SR_SV_OBJ_2D4); - -INCLUDE_ASM("asm/nonmatchings/800", SR_SV_OBJ_2DC); - -INCLUDE_ASM("asm/nonmatchings/800", SR_SV_OBJ_2E4); - -INCLUDE_ASM("asm/nonmatchings/800", SR_SV_OBJ_2EC); - -INCLUDE_ASM("asm/nonmatchings/800", SR_SV_OBJ_2F4); - -INCLUDE_ASM("asm/nonmatchings/800", SR_SV_OBJ_2FC); - -INCLUDE_ASM("asm/nonmatchings/800", SR_SV_OBJ_32C); - -INCLUDE_ASM("asm/nonmatchings/800", SR_SV_OBJ_3C0); - -INCLUDE_ASM("asm/nonmatchings/800", SR_SV_OBJ_514); - -INCLUDE_ASM("asm/nonmatchings/800", SR_SV_OBJ_598); - -INCLUDE_ASM("asm/nonmatchings/800", SR_SV_OBJ_608); - -INCLUDE_ASM("asm/nonmatchings/800", _spu_2pitch); - -INCLUDE_ASM("asm/nonmatchings/800", func_8003CFF8); - -INCLUDE_ASM("asm/nonmatchings/800", S_N2P_OBJ_11C); - -INCLUDE_ASM("asm/nonmatchings/800", _spu_pitch2note); - -INCLUDE_ASM("asm/nonmatchings/800", S_N2P_OBJ_208); - -INCLUDE_ASM("asm/nonmatchings/800", func_8003D25C); - -INCLUDE_ASM("asm/nonmatchings/800", SR_GAKS_OBJ_B4); - -void SR_GAKS_OBJ_C8(void) { -} - -INCLUDE_ASM("asm/nonmatchings/800", SpuGetAllKeysStatus); - -INCLUDE_ASM("asm/nonmatchings/800", SR_GAKS_OBJ_140); - -INCLUDE_ASM("asm/nonmatchings/800", func_8003D3B4); - -INCLUDE_ASM("asm/nonmatchings/800", func_8003D3F8); - -INCLUDE_ASM("asm/nonmatchings/800", func_8003D424); - -INCLUDE_ASM("asm/nonmatchings/800", func_8003D434); - -INCLUDE_ASM("asm/nonmatchings/800", SsEnd); - -INCLUDE_ASM("asm/nonmatchings/800", SSEND_OBJ_A0); - -INCLUDE_ASM("asm/nonmatchings/800", func_8003D518); - -INCLUDE_ASM("asm/nonmatchings/800", func_8003D548); - -INCLUDE_ASM("asm/nonmatchings/800", func_8003D630); - -INCLUDE_ASM("asm/nonmatchings/800", func_8003D650); - -INCLUDE_ASM("asm/nonmatchings/800", _SsStart); - -INCLUDE_ASM("asm/nonmatchings/800", SSSTART_OBJ_DC); - -INCLUDE_ASM("asm/nonmatchings/800", SSSTART_OBJ_18C); - -INCLUDE_ASM("asm/nonmatchings/800", SSSTART_OBJ_240); - -INCLUDE_ASM("asm/nonmatchings/800", SSSTART_OBJ_248); - -INCLUDE_ASM("asm/nonmatchings/800", SSSTART_OBJ_250); - -INCLUDE_ASM("asm/nonmatchings/800", SsStart); - -INCLUDE_ASM("asm/nonmatchings/800", SsStart2); - -INCLUDE_ASM("asm/nonmatchings/800", _SsTrapIntrVSync); - -INCLUDE_ASM("asm/nonmatchings/800", _SsSeqCalledTbyT_1per2); - -INCLUDE_ASM("asm/nonmatchings/800", SSSTART_OBJ_328); - -INCLUDE_ASM("asm/nonmatchings/800", SsSeqCalledTbyT); - -INCLUDE_ASM("asm/nonmatchings/800", func_8003DC90); - -INCLUDE_ASM("asm/nonmatchings/800", func_8003DF8C); - -INCLUDE_ASM("asm/nonmatchings/800", _SsSndPause); - -INCLUDE_ASM("asm/nonmatchings/800", _SsSndPlay); - -INCLUDE_ASM("asm/nonmatchings/800", _SsSeqPlay); - -INCLUDE_ASM("asm/nonmatchings/800", MIDIREAD_OBJ_E4); - -INCLUDE_ASM("asm/nonmatchings/800", MIDIREAD_OBJ_E8); - -INCLUDE_ASM("asm/nonmatchings/800", _SsSeqGetEof); - -INCLUDE_ASM("asm/nonmatchings/800", MIDIREAD_OBJ_20C); - -INCLUDE_ASM("asm/nonmatchings/800", MIDIREAD_OBJ_2DC); - -INCLUDE_ASM("asm/nonmatchings/800", MIDIREAD_OBJ_330); - -INCLUDE_ASM("asm/nonmatchings/800", _SsGetSeqData); - -INCLUDE_ASM("asm/nonmatchings/800", MIDIREAD_OBJ_600); - -INCLUDE_ASM("asm/nonmatchings/800", MIDIREAD_OBJ_65C); - -INCLUDE_ASM("asm/nonmatchings/800", MIDIREAD_OBJ_6AC); - -INCLUDE_ASM("asm/nonmatchings/800", MIDIREAD_OBJ_6BC); - -INCLUDE_ASM("asm/nonmatchings/800", MIDIREAD_OBJ_6C0); - -INCLUDE_ASM("asm/nonmatchings/800", MIDIREAD_OBJ_6CC); - -INCLUDE_ASM("asm/nonmatchings/800", _SsReadDeltaValue); - -void MIDITIME_OBJ_A8(void) { -} - -INCLUDE_ASM("asm/nonmatchings/800", _SsSndNextSep); - -INCLUDE_ASM("asm/nonmatchings/800", _SsSndReplay); - -INCLUDE_ASM("asm/nonmatchings/800", func_8003EC10); - -INCLUDE_ASM("asm/nonmatchings/800", func_8003ED94); - -INCLUDE_ASM("asm/nonmatchings/800", func_8003EDBC); - -INCLUDE_ASM("asm/nonmatchings/800", func_8003EDE8); - -INCLUDE_ASM("asm/nonmatchings/800", _SsSndTempo); - -INCLUDE_ASM("asm/nonmatchings/800", TEMPO_OBJ_128); - -INCLUDE_ASM("asm/nonmatchings/800", TEMPO_OBJ_134); - -INCLUDE_ASM("asm/nonmatchings/800", TEMPO_OBJ_208); - -INCLUDE_ASM("asm/nonmatchings/800", SsGetCurrentPoint); - -INCLUDE_ASM("asm/nonmatchings/800", func_8003F144); - -INCLUDE_ASM("asm/nonmatchings/800", UT_GVA_OBJ_224); - -INCLUDE_ASM("asm/nonmatchings/800", func_8003F380); - -INCLUDE_ASM("asm/nonmatchings/800", UT_GVAD_OBJ_A0); - -INCLUDE_ASM("asm/nonmatchings/800", SsUtKeyOnV); - -INCLUDE_ASM("asm/nonmatchings/800", UT_KEYV_OBJ_174); - -INCLUDE_ASM("asm/nonmatchings/800", UT_KEYV_OBJ_180); - -INCLUDE_ASM("asm/nonmatchings/800", UT_KEYV_OBJ_350); - -INCLUDE_ASM("asm/nonmatchings/800", UT_KEYV_OBJ_360); - -INCLUDE_ASM("asm/nonmatchings/800", SsUtKeyOffV); - -INCLUDE_ASM("asm/nonmatchings/800", UT_KEYV_OBJ_3FC); - -INCLUDE_ASM("asm/nonmatchings/800", _SsVmDoAllocate); - -INCLUDE_ASM("asm/nonmatchings/800", VM_ALOC2_OBJ_120); - -INCLUDE_ASM("asm/nonmatchings/800", func_8003FA54); - -INCLUDE_ASM("asm/nonmatchings/800", func_8003FA64); - -INCLUDE_ASM("asm/nonmatchings/800", func_8003FE18); - -INCLUDE_ASM("asm/nonmatchings/800", func_8003FE3C); - -INCLUDE_ASM("asm/nonmatchings/800", VM_INIT_OBJ_E4); - -INCLUDE_ASM("asm/nonmatchings/800", func_8004014C); - -void S_M_INIT_OBJ_4C(void) { -} - -INCLUDE_ASM("asm/nonmatchings/800", func_800401A0); - -INCLUDE_ASM("asm/nonmatchings/800", func_800401CC); - -INCLUDE_ASM("asm/nonmatchings/800", note2pitch); - -INCLUDE_ASM("asm/nonmatchings/800", VM_N2P_OBJ_BC); - -INCLUDE_ASM("asm/nonmatchings/800", note2pitch2); - -INCLUDE_ASM("asm/nonmatchings/800", VM_N2P_OBJ_1B8); - -INCLUDE_ASM("asm/nonmatchings/800", vmNoiseOn); - -INCLUDE_ASM("asm/nonmatchings/800", VM_NO1_OBJ_184); - -INCLUDE_ASM("asm/nonmatchings/800", VM_NO1_OBJ_1F4); - -INCLUDE_ASM("asm/nonmatchings/800", VM_NO1_OBJ_264); - -INCLUDE_ASM("asm/nonmatchings/800", VM_NO1_OBJ_28C); - -INCLUDE_ASM("asm/nonmatchings/800", VM_NO1_OBJ_31C); - -INCLUDE_ASM("asm/nonmatchings/800", VM_NO1_OBJ_4A4); - -INCLUDE_ASM("asm/nonmatchings/800", func_80040868); - -INCLUDE_ASM("asm/nonmatchings/800", VM_NOWOF_OBJ_38); - -INCLUDE_ASM("asm/nonmatchings/800", _SsVmKeyOnNow); - -INCLUDE_ASM("asm/nonmatchings/800", VM_NOWON_OBJ_1C0); - -INCLUDE_ASM("asm/nonmatchings/800", VM_NOWON_OBJ_230); - -INCLUDE_ASM("asm/nonmatchings/800", VM_NOWON_OBJ_2A0); - -INCLUDE_ASM("asm/nonmatchings/800", VM_NOWON_OBJ_2C8); - -INCLUDE_ASM("asm/nonmatchings/800", VM_NOWON_OBJ_3D4); - -INCLUDE_ASM("asm/nonmatchings/800", VM_NOWON_OBJ_44C); - -INCLUDE_ASM("asm/nonmatchings/800", func_80040DE8); - -INCLUDE_ASM("asm/nonmatchings/800", func_80041354); - -INCLUDE_ASM("asm/nonmatchings/800", func_800413B8); - -INCLUDE_ASM("asm/nonmatchings/800", func_80041400); - -INCLUDE_ASM("asm/nonmatchings/800", func_80041448); - -INCLUDE_ASM("asm/nonmatchings/800", func_800414E4); - -void VM_VSU_OBJ_BC(void) { -} - -INCLUDE_ASM("asm/nonmatchings/800", func_800415A8); - -INCLUDE_ASM("asm/nonmatchings/800", func_8004162C); - -INCLUDE_ASM("asm/nonmatchings/800", S_M_F_OBJ_64); - -INCLUDE_ASM("asm/nonmatchings/800", func_800416A8); - -INCLUDE_ASM("asm/nonmatchings/800", S_M_INT_OBJ_50); - -INCLUDE_ASM("asm/nonmatchings/800", S_M_INT_OBJ_C0); - -INCLUDE_ASM("asm/nonmatchings/800", S_M_INT_OBJ_278); - -INCLUDE_ASM("asm/nonmatchings/800", func_800419B0); - -INCLUDE_ASM("asm/nonmatchings/800", VS_VFB_OBJ_5C); - -INCLUDE_ASM("asm/nonmatchings/800", SsVabOpenHead); - -INCLUDE_ASM("asm/nonmatchings/800", SsVabOpenHeadSticky); - -INCLUDE_ASM("asm/nonmatchings/800", func_80041A80); - -INCLUDE_ASM("asm/nonmatchings/800", func_80041AB0); - -INCLUDE_ASM("asm/nonmatchings/800", VS_VH_OBJ_180); - -INCLUDE_ASM("asm/nonmatchings/800", VS_VH_OBJ_190); - -INCLUDE_ASM("asm/nonmatchings/800", VS_VH_OBJ_350); - -INCLUDE_ASM("asm/nonmatchings/800", VS_VH_OBJ_364); - -INCLUDE_ASM("asm/nonmatchings/800", VS_VH_OBJ_40C); - -INCLUDE_ASM("asm/nonmatchings/800", VS_VH_OBJ_444); - -INCLUDE_ASM("asm/nonmatchings/800", func_80041E8C); - -INCLUDE_ASM("asm/nonmatchings/800", S_M_M_OBJ_54); - -INCLUDE_ASM("asm/nonmatchings/800", S_M_M_OBJ_12C); - -INCLUDE_ASM("asm/nonmatchings/800", S_M_M_OBJ_2A8); - -INCLUDE_ASM("asm/nonmatchings/800", func_80042154); - -INCLUDE_ASM("asm/nonmatchings/800", VS_VTBP_OBJ_13C); - -INCLUDE_ASM("asm/nonmatchings/800", func_800422B4); - -INCLUDE_ASM("asm/nonmatchings/800", S_STM_OBJ_1C); - -INCLUDE_ASM("asm/nonmatchings/800", func_800422E8); - -INCLUDE_ASM("asm/nonmatchings/800", func_80042374); diff --git a/src/sgap.c b/src/sgap.c new file mode 100644 index 0000000000..bc81f6740b --- /dev/null +++ b/src/sgap.c @@ -0,0 +1,3 @@ +#include "common.h" + +INCLUDE_ASM("asm/nonmatchings/sgap", func_8003C438); diff --git a/src/sgap_2.c b/src/sgap_2.c new file mode 100644 index 0000000000..38534dcb09 --- /dev/null +++ b/src/sgap_2.c @@ -0,0 +1,3 @@ +#include "common.h" + +INCLUDE_ASM("asm/nonmatchings/sgap_2", func_8003D424); diff --git a/src/sgap_3.c b/src/sgap_3.c new file mode 100644 index 0000000000..ce1413fa37 --- /dev/null +++ b/src/sgap_3.c @@ -0,0 +1,3 @@ +#include "common.h" + +INCLUDE_ASM("asm/nonmatchings/sgap_3", func_8003D630); diff --git a/src/sgap_4.c b/src/sgap_4.c new file mode 100644 index 0000000000..11ee526372 --- /dev/null +++ b/src/sgap_4.c @@ -0,0 +1,5 @@ +#include "common.h" + +INCLUDE_ASM("asm/nonmatchings/sgap_4", func_8003DC90); + +INCLUDE_ASM("asm/nonmatchings/sgap_4", func_8003DF8C); diff --git a/src/sgap_5.c b/src/sgap_5.c new file mode 100644 index 0000000000..1c46e0ffea --- /dev/null +++ b/src/sgap_5.c @@ -0,0 +1,3 @@ +#include "common.h" + +INCLUDE_ASM("asm/nonmatchings/sgap_5", _SsSndPlay); diff --git a/src/sgap_6.c b/src/sgap_6.c new file mode 100644 index 0000000000..74b9f52347 --- /dev/null +++ b/src/sgap_6.c @@ -0,0 +1,5 @@ +#include "common.h" + +INCLUDE_ASM("asm/nonmatchings/sgap_6", func_8003FA54); + +INCLUDE_ASM("asm/nonmatchings/sgap_6", func_8003FA64); diff --git a/src/sgap_7.c b/src/sgap_7.c new file mode 100644 index 0000000000..2cc302242c --- /dev/null +++ b/src/sgap_7.c @@ -0,0 +1,15 @@ +#include "common.h" + +INCLUDE_ASM("asm/nonmatchings/sgap_7", vmNoiseOn); + +INCLUDE_ASM("asm/nonmatchings/sgap_7", VM_NO1_OBJ_184); + +INCLUDE_ASM("asm/nonmatchings/sgap_7", VM_NO1_OBJ_1F4); + +INCLUDE_ASM("asm/nonmatchings/sgap_7", VM_NO1_OBJ_264); + +INCLUDE_ASM("asm/nonmatchings/sgap_7", VM_NO1_OBJ_28C); + +INCLUDE_ASM("asm/nonmatchings/sgap_7", VM_NO1_OBJ_31C); + +INCLUDE_ASM("asm/nonmatchings/sgap_7", VM_NO1_OBJ_4A4); diff --git a/src/sgap_8.c b/src/sgap_8.c new file mode 100644 index 0000000000..0b89fa7569 --- /dev/null +++ b/src/sgap_8.c @@ -0,0 +1,25 @@ +#include "common.h" + +INCLUDE_ASM("asm/nonmatchings/sgap_8", _SsVmKeyOnNow); + +INCLUDE_ASM("asm/nonmatchings/sgap_8", VM_NOWON_OBJ_1C0); + +INCLUDE_ASM("asm/nonmatchings/sgap_8", VM_NOWON_OBJ_230); + +INCLUDE_ASM("asm/nonmatchings/sgap_8", VM_NOWON_OBJ_2A0); + +INCLUDE_ASM("asm/nonmatchings/sgap_8", VM_NOWON_OBJ_2C8); + +INCLUDE_ASM("asm/nonmatchings/sgap_8", VM_NOWON_OBJ_3D4); + +INCLUDE_ASM("asm/nonmatchings/sgap_8", VM_NOWON_OBJ_44C); + +INCLUDE_ASM("asm/nonmatchings/sgap_8", func_80040DE8); + +INCLUDE_ASM("asm/nonmatchings/sgap_8", func_80041354); + +INCLUDE_ASM("asm/nonmatchings/sgap_8", func_800413B8); + +INCLUDE_ASM("asm/nonmatchings/sgap_8", func_80041400); + +INCLUDE_ASM("asm/nonmatchings/sgap_8", func_80041448); diff --git a/src/snd1.c b/src/snd1.c new file mode 100644 index 0000000000..5b121074c2 --- /dev/null +++ b/src/snd1.c @@ -0,0 +1,140 @@ +#include "common.h" + +INCLUDE_ASM("asm/nonmatchings/snd1", func_8003A444); + +INCLUDE_ASM("asm/nonmatchings/snd1", func_8003A53C); + +INCLUDE_ASM("asm/nonmatchings/snd1", func_8003A5B8); + +INCLUDE_ASM("asm/nonmatchings/snd1", SPU_OBJ_DC); + +INCLUDE_ASM("asm/nonmatchings/snd1", func_8003A84C); + +INCLUDE_ASM("asm/nonmatchings/snd1", SPU_OBJ_3AC); + +INCLUDE_ASM("asm/nonmatchings/snd1", SPU_OBJ_440); + +INCLUDE_ASM("asm/nonmatchings/snd1", _spu_FiDMA); + +INCLUDE_ASM("asm/nonmatchings/snd1", SPU_OBJ_510); + +INCLUDE_ASM("asm/nonmatchings/snd1", _spu_Fr_); + +INCLUDE_ASM("asm/nonmatchings/snd1", func_8003AB84); + +INCLUDE_ASM("asm/nonmatchings/snd1", SPU_OBJ_7C0); + +INCLUDE_ASM("asm/nonmatchings/snd1", SPU_OBJ_848); + +INCLUDE_ASM("asm/nonmatchings/snd1", func_8003AE14); + +INCLUDE_ASM("asm/nonmatchings/snd1", SPU_OBJ_8CC); + +INCLUDE_ASM("asm/nonmatchings/snd1", _spu_Fr); + +INCLUDE_ASM("asm/nonmatchings/snd1", func_8003AF04); + +void SPU_OBJ_98C(void) { +} + +INCLUDE_ASM("asm/nonmatchings/snd1", func_8003AF4C); + +void SPU_OBJ_A30(void) { +} + +INCLUDE_ASM("asm/nonmatchings/snd1", _spu_FgetRXXa); + +void SPU_OBJ_A6C(void) { +} + +INCLUDE_ASM("asm/nonmatchings/snd1", _spu_FsetPCR); + +INCLUDE_ASM("asm/nonmatchings/snd1", SPU_OBJ_AC4); + +INCLUDE_ASM("asm/nonmatchings/snd1", func_8003B08C); + +INCLUDE_ASM("asm/nonmatchings/snd1", func_8003B0B8); + +INCLUDE_ASM("asm/nonmatchings/snd1", func_8003B0E4); + +INCLUDE_ASM("asm/nonmatchings/snd1", func_8003B0FC); + +INCLUDE_ASM("asm/nonmatchings/snd1", SPU_OBJ_B74); + +INCLUDE_ASM("asm/nonmatchings/snd1", func_8003B14C); + +INCLUDE_ASM("asm/nonmatchings/snd1", func_8003B170); + +INCLUDE_ASM("asm/nonmatchings/snd1", func_8003B1EC); + +void S_SE_OBJ_5C(void) { +} + +INCLUDE_ASM("asm/nonmatchings/snd1", func_8003B250); + +INCLUDE_ASM("asm/nonmatchings/snd1", func_8003B280); + +INCLUDE_ASM("asm/nonmatchings/snd1", S_SR_OBJ_B0); + +INCLUDE_ASM("asm/nonmatchings/snd1", S_SR_OBJ_B4); + +INCLUDE_ASM("asm/nonmatchings/snd1", _SpuIsInAllocateArea); + +INCLUDE_ASM("asm/nonmatchings/snd1", S_M_UTIL_OBJ_2C); + +void S_M_UTIL_OBJ_78(void) { +} + +INCLUDE_ASM("asm/nonmatchings/snd1", func_8003B3D0); + +INCLUDE_ASM("asm/nonmatchings/snd1", S_M_UTIL_OBJ_B8); + +void S_M_UTIL_OBJ_104(void) { +} + +INCLUDE_ASM("asm/nonmatchings/snd1", func_8003B45C); + +INCLUDE_ASM("asm/nonmatchings/snd1", S_SRMP_OBJ_170); + +INCLUDE_ASM("asm/nonmatchings/snd1", S_SRMP_OBJ_180); + +INCLUDE_ASM("asm/nonmatchings/snd1", S_SRMP_OBJ_334); + +INCLUDE_ASM("asm/nonmatchings/snd1", S_SRMP_OBJ_420); + +INCLUDE_ASM("asm/nonmatchings/snd1", S_SRMP_OBJ_444); + +INCLUDE_ASM("asm/nonmatchings/snd1", S_SRMP_OBJ_4C4); + +INCLUDE_ASM("asm/nonmatchings/snd1", func_8003B954); + +INCLUDE_ASM("asm/nonmatchings/snd1", func_8003BE24); + +INCLUDE_ASM("asm/nonmatchings/snd1", S_RRWA_OBJ_40); + +INCLUDE_ASM("asm/nonmatchings/snd1", func_8003BE74); + +INCLUDE_ASM("asm/nonmatchings/snd1", func_8003BE98); + +INCLUDE_ASM("asm/nonmatchings/snd1", S_SAV_OBJ_38); + +INCLUDE_ASM("asm/nonmatchings/snd1", S_SAV_OBJ_114); + +INCLUDE_ASM("asm/nonmatchings/snd1", S_SAV_OBJ_1E8); + +INCLUDE_ASM("asm/nonmatchings/snd1", S_SAV_OBJ_1F8); + +INCLUDE_ASM("asm/nonmatchings/snd1", func_8003C0A0); + +INCLUDE_ASM("asm/nonmatchings/snd1", S_CRWA_OBJ_9C); + +INCLUDE_ASM("asm/nonmatchings/snd1", S_CRWA_OBJ_100); + +INCLUDE_ASM("asm/nonmatchings/snd1", S_CRWA_OBJ_174); + +INCLUDE_ASM("asm/nonmatchings/snd1", func_8003C23C); + +INCLUDE_ASM("asm/nonmatchings/snd1", S_SK_OBJ_1EC); + +void S_SK_OBJ_1F4(void) { +} diff --git a/src/snd2.c b/src/snd2.c new file mode 100644 index 0000000000..c5d6bcc6ba --- /dev/null +++ b/src/snd2.c @@ -0,0 +1,136 @@ +#include "common.h" + +INCLUDE_ASM("asm/nonmatchings/snd2", func_8003C498); + +INCLUDE_ASM("asm/nonmatchings/snd2", S_STSA_OBJ_48); + +INCLUDE_ASM("asm/nonmatchings/snd2", func_8003C4F0); + +INCLUDE_ASM("asm/nonmatchings/snd2", S_ITC_OBJ_88); + +INCLUDE_ASM("asm/nonmatchings/snd2", S_ITC_OBJ_90); + +INCLUDE_ASM("asm/nonmatchings/snd2", func_8003C598); + +INCLUDE_ASM("asm/nonmatchings/snd2", S_SCA_OBJ_5C); + +INCLUDE_ASM("asm/nonmatchings/snd2", S_SCA_OBJ_64); + +INCLUDE_ASM("asm/nonmatchings/snd2", S_SCA_OBJ_6C); + +INCLUDE_ASM("asm/nonmatchings/snd2", S_SCA_OBJ_74); + +INCLUDE_ASM("asm/nonmatchings/snd2", S_SCA_OBJ_7C); + +INCLUDE_ASM("asm/nonmatchings/snd2", S_SCA_OBJ_84); + +INCLUDE_ASM("asm/nonmatchings/snd2", S_SCA_OBJ_8C); + +INCLUDE_ASM("asm/nonmatchings/snd2", S_SCA_OBJ_94); + +INCLUDE_ASM("asm/nonmatchings/snd2", S_SCA_OBJ_9C); + +INCLUDE_ASM("asm/nonmatchings/snd2", S_SCA_OBJ_CC); + +INCLUDE_ASM("asm/nonmatchings/snd2", S_SCA_OBJ_124); + +INCLUDE_ASM("asm/nonmatchings/snd2", S_SCA_OBJ_12C); + +INCLUDE_ASM("asm/nonmatchings/snd2", S_SCA_OBJ_134); + +INCLUDE_ASM("asm/nonmatchings/snd2", S_SCA_OBJ_13C); + +INCLUDE_ASM("asm/nonmatchings/snd2", S_SCA_OBJ_144); + +INCLUDE_ASM("asm/nonmatchings/snd2", S_SCA_OBJ_14C); + +INCLUDE_ASM("asm/nonmatchings/snd2", S_SCA_OBJ_154); + +INCLUDE_ASM("asm/nonmatchings/snd2", S_SCA_OBJ_15C); + +INCLUDE_ASM("asm/nonmatchings/snd2", S_SCA_OBJ_164); + +INCLUDE_ASM("asm/nonmatchings/snd2", S_SCA_OBJ_194); + +INCLUDE_ASM("asm/nonmatchings/snd2", S_SCA_OBJ_288); + +INCLUDE_ASM("asm/nonmatchings/snd2", S_SCA_OBJ_2DC); + +INCLUDE_ASM("asm/nonmatchings/snd2", S_SCA_OBJ_330); + +INCLUDE_ASM("asm/nonmatchings/snd2", S_SCA_OBJ_384); + +INCLUDE_ASM("asm/nonmatchings/snd2", func_8003C92C); + +INCLUDE_ASM("asm/nonmatchings/snd2", SR_SV_OBJ_1EC); + +INCLUDE_ASM("asm/nonmatchings/snd2", SR_SV_OBJ_1F4); + +INCLUDE_ASM("asm/nonmatchings/snd2", SR_SV_OBJ_1FC); + +INCLUDE_ASM("asm/nonmatchings/snd2", SR_SV_OBJ_204); + +INCLUDE_ASM("asm/nonmatchings/snd2", SR_SV_OBJ_20C); + +INCLUDE_ASM("asm/nonmatchings/snd2", SR_SV_OBJ_214); + +INCLUDE_ASM("asm/nonmatchings/snd2", SR_SV_OBJ_21C); + +INCLUDE_ASM("asm/nonmatchings/snd2", SR_SV_OBJ_224); + +INCLUDE_ASM("asm/nonmatchings/snd2", SR_SV_OBJ_22C); + +INCLUDE_ASM("asm/nonmatchings/snd2", SR_SV_OBJ_25C); + +INCLUDE_ASM("asm/nonmatchings/snd2", SR_SV_OBJ_2BC); + +INCLUDE_ASM("asm/nonmatchings/snd2", SR_SV_OBJ_2C4); + +INCLUDE_ASM("asm/nonmatchings/snd2", SR_SV_OBJ_2CC); + +INCLUDE_ASM("asm/nonmatchings/snd2", SR_SV_OBJ_2D4); + +INCLUDE_ASM("asm/nonmatchings/snd2", SR_SV_OBJ_2DC); + +INCLUDE_ASM("asm/nonmatchings/snd2", SR_SV_OBJ_2E4); + +INCLUDE_ASM("asm/nonmatchings/snd2", SR_SV_OBJ_2EC); + +INCLUDE_ASM("asm/nonmatchings/snd2", SR_SV_OBJ_2F4); + +INCLUDE_ASM("asm/nonmatchings/snd2", SR_SV_OBJ_2FC); + +INCLUDE_ASM("asm/nonmatchings/snd2", SR_SV_OBJ_32C); + +INCLUDE_ASM("asm/nonmatchings/snd2", SR_SV_OBJ_3C0); + +INCLUDE_ASM("asm/nonmatchings/snd2", SR_SV_OBJ_514); + +INCLUDE_ASM("asm/nonmatchings/snd2", SR_SV_OBJ_598); + +INCLUDE_ASM("asm/nonmatchings/snd2", SR_SV_OBJ_608); + +INCLUDE_ASM("asm/nonmatchings/snd2", _spu_2pitch); + +INCLUDE_ASM("asm/nonmatchings/snd2", func_8003CFF8); + +INCLUDE_ASM("asm/nonmatchings/snd2", S_N2P_OBJ_11C); + +INCLUDE_ASM("asm/nonmatchings/snd2", _spu_pitch2note); + +INCLUDE_ASM("asm/nonmatchings/snd2", S_N2P_OBJ_208); + +INCLUDE_ASM("asm/nonmatchings/snd2", func_8003D25C); + +INCLUDE_ASM("asm/nonmatchings/snd2", SR_GAKS_OBJ_B4); + +void SR_GAKS_OBJ_C8(void) { +} + +INCLUDE_ASM("asm/nonmatchings/snd2", SpuGetAllKeysStatus); + +INCLUDE_ASM("asm/nonmatchings/snd2", SR_GAKS_OBJ_140); + +INCLUDE_ASM("asm/nonmatchings/snd2", func_8003D3B4); + +INCLUDE_ASM("asm/nonmatchings/snd2", func_8003D3F8); diff --git a/src/snd3.c b/src/snd3.c new file mode 100644 index 0000000000..c7df5c6d67 --- /dev/null +++ b/src/snd3.c @@ -0,0 +1,11 @@ +#include "common.h" + +INCLUDE_ASM("asm/nonmatchings/snd3", func_8003D434); + +INCLUDE_ASM("asm/nonmatchings/snd3", SsEnd); + +INCLUDE_ASM("asm/nonmatchings/snd3", SSEND_OBJ_A0); + +INCLUDE_ASM("asm/nonmatchings/snd3", func_8003D518); + +INCLUDE_ASM("asm/nonmatchings/snd3", func_8003D548); diff --git a/src/snd4.c b/src/snd4.c new file mode 100644 index 0000000000..5a0d15f758 --- /dev/null +++ b/src/snd4.c @@ -0,0 +1,27 @@ +#include "common.h" + +INCLUDE_ASM("asm/nonmatchings/snd4", func_8003D650); + +INCLUDE_ASM("asm/nonmatchings/snd4", _SsStart); + +INCLUDE_ASM("asm/nonmatchings/snd4", SSSTART_OBJ_DC); + +INCLUDE_ASM("asm/nonmatchings/snd4", SSSTART_OBJ_18C); + +INCLUDE_ASM("asm/nonmatchings/snd4", SSSTART_OBJ_240); + +INCLUDE_ASM("asm/nonmatchings/snd4", SSSTART_OBJ_248); + +INCLUDE_ASM("asm/nonmatchings/snd4", SSSTART_OBJ_250); + +INCLUDE_ASM("asm/nonmatchings/snd4", SsStart); + +INCLUDE_ASM("asm/nonmatchings/snd4", SsStart2); + +INCLUDE_ASM("asm/nonmatchings/snd4", _SsTrapIntrVSync); + +INCLUDE_ASM("asm/nonmatchings/snd4", _SsSeqCalledTbyT_1per2); + +INCLUDE_ASM("asm/nonmatchings/snd4", SSSTART_OBJ_328); + +INCLUDE_ASM("asm/nonmatchings/snd4", SsSeqCalledTbyT); diff --git a/src/snd5.c b/src/snd5.c new file mode 100644 index 0000000000..74a86f97c2 --- /dev/null +++ b/src/snd5.c @@ -0,0 +1,3 @@ +#include "common.h" + +INCLUDE_ASM("asm/nonmatchings/snd5", _SsSndPause); diff --git a/src/snd6.c b/src/snd6.c new file mode 100644 index 0000000000..61999b9b85 --- /dev/null +++ b/src/snd6.c @@ -0,0 +1,82 @@ +#include "common.h" + +INCLUDE_ASM("asm/nonmatchings/snd6", _SsSeqPlay); + +INCLUDE_ASM("asm/nonmatchings/snd6", MIDIREAD_OBJ_E4); + +INCLUDE_ASM("asm/nonmatchings/snd6", MIDIREAD_OBJ_E8); + +INCLUDE_ASM("asm/nonmatchings/snd6", _SsSeqGetEof); + +INCLUDE_ASM("asm/nonmatchings/snd6", MIDIREAD_OBJ_20C); + +INCLUDE_ASM("asm/nonmatchings/snd6", MIDIREAD_OBJ_2DC); + +INCLUDE_ASM("asm/nonmatchings/snd6", MIDIREAD_OBJ_330); + +INCLUDE_ASM("asm/nonmatchings/snd6", _SsGetSeqData); + +INCLUDE_ASM("asm/nonmatchings/snd6", MIDIREAD_OBJ_600); + +INCLUDE_ASM("asm/nonmatchings/snd6", MIDIREAD_OBJ_65C); + +INCLUDE_ASM("asm/nonmatchings/snd6", MIDIREAD_OBJ_6AC); + +INCLUDE_ASM("asm/nonmatchings/snd6", MIDIREAD_OBJ_6BC); + +INCLUDE_ASM("asm/nonmatchings/snd6", MIDIREAD_OBJ_6C0); + +INCLUDE_ASM("asm/nonmatchings/snd6", MIDIREAD_OBJ_6CC); + +INCLUDE_ASM("asm/nonmatchings/snd6", _SsReadDeltaValue); + +void MIDITIME_OBJ_A8(void) { +} + +INCLUDE_ASM("asm/nonmatchings/snd6", _SsSndNextSep); + +INCLUDE_ASM("asm/nonmatchings/snd6", _SsSndReplay); + +INCLUDE_ASM("asm/nonmatchings/snd6", func_8003EC10); + +INCLUDE_ASM("asm/nonmatchings/snd6", func_8003ED94); + +INCLUDE_ASM("asm/nonmatchings/snd6", func_8003EDBC); + +INCLUDE_ASM("asm/nonmatchings/snd6", func_8003EDE8); + +INCLUDE_ASM("asm/nonmatchings/snd6", _SsSndTempo); + +INCLUDE_ASM("asm/nonmatchings/snd6", TEMPO_OBJ_128); + +INCLUDE_ASM("asm/nonmatchings/snd6", TEMPO_OBJ_134); + +INCLUDE_ASM("asm/nonmatchings/snd6", TEMPO_OBJ_208); + +INCLUDE_ASM("asm/nonmatchings/snd6", SsGetCurrentPoint); + +INCLUDE_ASM("asm/nonmatchings/snd6", func_8003F144); + +INCLUDE_ASM("asm/nonmatchings/snd6", UT_GVA_OBJ_224); + +INCLUDE_ASM("asm/nonmatchings/snd6", func_8003F380); + +INCLUDE_ASM("asm/nonmatchings/snd6", UT_GVAD_OBJ_A0); + +INCLUDE_ASM("asm/nonmatchings/snd6", SsUtKeyOnV); + +INCLUDE_ASM("asm/nonmatchings/snd6", UT_KEYV_OBJ_174); + +INCLUDE_ASM("asm/nonmatchings/snd6", UT_KEYV_OBJ_180); + +INCLUDE_ASM("asm/nonmatchings/snd6", UT_KEYV_OBJ_350); + +INCLUDE_ASM("asm/nonmatchings/snd6", UT_KEYV_OBJ_360); + +INCLUDE_ASM("asm/nonmatchings/snd6", SsUtKeyOffV); + +INCLUDE_ASM("asm/nonmatchings/snd6", UT_KEYV_OBJ_3FC); + +INCLUDE_ASM("asm/nonmatchings/snd6", _SsVmDoAllocate); + +INCLUDE_ASM("asm/nonmatchings/snd6", VM_ALOC2_OBJ_120); diff --git a/src/snd7.c b/src/snd7.c new file mode 100644 index 0000000000..00759b53f9 --- /dev/null +++ b/src/snd7.c @@ -0,0 +1,24 @@ +#include "common.h" + +INCLUDE_ASM("asm/nonmatchings/snd7", func_8003FE18); + +INCLUDE_ASM("asm/nonmatchings/snd7", func_8003FE3C); + +INCLUDE_ASM("asm/nonmatchings/snd7", VM_INIT_OBJ_E4); + +INCLUDE_ASM("asm/nonmatchings/snd7", func_8004014C); + +void S_M_INIT_OBJ_4C(void) { +} + +INCLUDE_ASM("asm/nonmatchings/snd7", func_800401A0); + +INCLUDE_ASM("asm/nonmatchings/snd7", func_800401CC); + +INCLUDE_ASM("asm/nonmatchings/snd7", note2pitch); + +INCLUDE_ASM("asm/nonmatchings/snd7", VM_N2P_OBJ_BC); + +INCLUDE_ASM("asm/nonmatchings/snd7", note2pitch2); + +INCLUDE_ASM("asm/nonmatchings/snd7", VM_N2P_OBJ_1B8); diff --git a/src/snd8.c b/src/snd8.c new file mode 100644 index 0000000000..e127522fcb --- /dev/null +++ b/src/snd8.c @@ -0,0 +1,5 @@ +#include "common.h" + +INCLUDE_ASM("asm/nonmatchings/snd8", func_80040868); + +INCLUDE_ASM("asm/nonmatchings/snd8", VM_NOWOF_OBJ_38); diff --git a/src/snd9.c b/src/snd9.c new file mode 100644 index 0000000000..cd2954c03d --- /dev/null +++ b/src/snd9.c @@ -0,0 +1,64 @@ +#include "common.h" + +INCLUDE_ASM("asm/nonmatchings/snd9", func_800414E4); + +void VM_VSU_OBJ_BC(void) { +} + +INCLUDE_ASM("asm/nonmatchings/snd9", func_800415A8); + +INCLUDE_ASM("asm/nonmatchings/snd9", func_8004162C); + +INCLUDE_ASM("asm/nonmatchings/snd9", S_M_F_OBJ_64); + +INCLUDE_ASM("asm/nonmatchings/snd9", func_800416A8); + +INCLUDE_ASM("asm/nonmatchings/snd9", S_M_INT_OBJ_50); + +INCLUDE_ASM("asm/nonmatchings/snd9", S_M_INT_OBJ_C0); + +INCLUDE_ASM("asm/nonmatchings/snd9", S_M_INT_OBJ_278); + +INCLUDE_ASM("asm/nonmatchings/snd9", func_800419B0); + +INCLUDE_ASM("asm/nonmatchings/snd9", VS_VFB_OBJ_5C); + +INCLUDE_ASM("asm/nonmatchings/snd9", SsVabOpenHead); + +INCLUDE_ASM("asm/nonmatchings/snd9", SsVabOpenHeadSticky); + +INCLUDE_ASM("asm/nonmatchings/snd9", func_80041A80); + +INCLUDE_ASM("asm/nonmatchings/snd9", func_80041AB0); + +INCLUDE_ASM("asm/nonmatchings/snd9", VS_VH_OBJ_180); + +INCLUDE_ASM("asm/nonmatchings/snd9", VS_VH_OBJ_190); + +INCLUDE_ASM("asm/nonmatchings/snd9", VS_VH_OBJ_350); + +INCLUDE_ASM("asm/nonmatchings/snd9", VS_VH_OBJ_364); + +INCLUDE_ASM("asm/nonmatchings/snd9", VS_VH_OBJ_40C); + +INCLUDE_ASM("asm/nonmatchings/snd9", VS_VH_OBJ_444); + +INCLUDE_ASM("asm/nonmatchings/snd9", func_80041E8C); + +INCLUDE_ASM("asm/nonmatchings/snd9", S_M_M_OBJ_54); + +INCLUDE_ASM("asm/nonmatchings/snd9", S_M_M_OBJ_12C); + +INCLUDE_ASM("asm/nonmatchings/snd9", S_M_M_OBJ_2A8); + +INCLUDE_ASM("asm/nonmatchings/snd9", func_80042154); + +INCLUDE_ASM("asm/nonmatchings/snd9", VS_VTBP_OBJ_13C); + +INCLUDE_ASM("asm/nonmatchings/snd9", func_800422B4); + +INCLUDE_ASM("asm/nonmatchings/snd9", S_STM_OBJ_1C); + +INCLUDE_ASM("asm/nonmatchings/snd9", func_800422E8); + +INCLUDE_ASM("asm/nonmatchings/snd9", func_80042374); diff --git a/tools/make_snd_used.py b/tools/make_snd_used.py new file mode 100644 index 0000000000..747817fa21 --- /dev/null +++ b/tools/make_snd_used.py @@ -0,0 +1,66 @@ +#!/usr/bin/env python3 +"""Build the curated .run/obj40/snd_used dir = the combined libspu+libsnd sound region (Phase 8). + +libspu and libsnd are tightly interleaved in 0x8003A444..0x8004239C (the tail of the 800 subseg), so +they are linked as ONE combined region rather than two passes. This: + - places both libraries' objects (psyq_identify) and merges them by vram, + - for an aliased address (>1 object, same masked .text) picks the object whose linked .text + byte-matches the EXE (psyq_link.link_object) — the real one, + - EXCLUDES 4 ADDRESSES that don't reconcile in the combined region (ALL candidates there stay + byte-identical stubs — excluding by address, not name, since the alias twin fails identically): + 0x3C438 (S_R/S_W), 0x3D424 (S_GRMDT/FB/T) — scattered-.bss commons referenced at a minority + address the region's single defsym can't satisfy (cookbook §9.1, cross-object form), + 0x3D94C (S_IH/UT_RON) — false placement: 0x3D94C is INSIDE libsnd SSSTART.o, + 0x3FA64 (VM_F.o, 237 ins) — scattered-.bss commons (the one real value loss). + - copies the survivors into .run/obj40/snd_used. + +The build is byte-identical with OR without snd_used (stub fallback), so a fresh clone need not run +this unless it wants the SDK objects linked. Regenerate: tools/psyq_build_libs.sh LIBSPU LIBSND first. +""" +import os, re, shutil, subprocess, sys +from collections import defaultdict +sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) +from psyq_link import link_object # noqa: E402 + +EXE = "extracted/retail/SLUS_007.26" +RLO, RHI = 0x8003A444, 0x8004239C +EXCLUDE_ADDR = {0x8003C438, 0x8003D424, 0x8003D94C, 0x8003FA64} # see module docstring + + +def place(lib): + out = subprocess.check_output(["python3", "tools/psyq_identify.py", f".run/obj40/{lib}"], text=True) + d = {} + for ln in out.splitlines(): + m = re.match(r"\s+0x([0-9A-Fa-f]+)\s+(\S+\.o)\s+\((\d+) ins\)", ln) + if m: + d[m.group(2)] = int(m.group(1), 16) + return d + + +def main(): + exe = open(EXE, "rb").read() + byaddr = defaultdict(list) + for lib in ("libspu", "libsnd"): + for nm, a in place(lib).items(): + byaddr[a].append((lib, nm)) + + dst = ".run/obj40/snd_used" + shutil.rmtree(dst, ignore_errors=True) + os.makedirs(dst) + n = 0 + for a in sorted(byaddr): + if not (RLO <= a < RHI) or a in EXCLUDE_ADDR: + continue + cands = byaddr[a] + pick = next(((lib, nm) for lib, nm in cands + if link_object(f".run/obj40/{lib}/{nm}", a, name=nm, exe_bytes=exe)["ok"]), + cands[0]) + lib, nm = pick + shutil.copy(f".run/obj40/{lib}/{nm}", f"{dst}/{nm}") + n += 1 + print(f"snd_used: {n} objects (libspu+libsnd combined; {len(EXCLUDE_ADDR)} addresses excluded: " + f"{[hex(x) for x in sorted(EXCLUDE_ADDR)]})") + + +if __name__ == "__main__": + main()