Share the effect engine across overlays as src/effect/lib - #84
Merged
Conversation
Report for SLUS_008.92 (4f9f2ac - 93dc9a1)Total data: 26696 bytes (-4 bytes) ✅ 329 new matches
...and 299 more new matches 🥀 234 broken matches
...and 204 more broken matches |
Every effect overlay is linked from the same library plus its own code, in its own first-reference order: aligning the built objects of effect_001, effect_025 and effect_028 with the linker-rewritten fields masked shows the shared functions as contiguous runs that move as blocks between overlays, and those runs are the library's members. Each is now one source under src/effect/lib, compiled once per overlay that links it, with one header each and overlay-independent names. Twenty-nine units come out of the three overlays: the entity pool and the model queries every effect uses, the two matrix families, the renderer, the pose engine, two generations of mesh emitter, and Curaga's whole mote engine down to the draw list itself. An overlay's ff8.yaml entry lists its units in its own link order, and config/symbols.effect_NNN.txt maps the library's names to that overlay's addresses; splat names the disassembly from it and still hands the named bss words to the linker through undefined_syms_auto, so nothing else feeds ld. The multi-unit linker script needs .bss in section_order, and splitting the jump tables into their owners' objects needs the tail pad the original build emitted and ASFLAGS suppress -- without that pad line effect_028 came out four bytes short and diffed from its first table onward. Three functions could not be shared as they stood: the two pool allocators and the bank clear differ between effects only in their ring sizes. Those are the effect's two numbers, so each overlay carries include/effect/params/<name> holding them and joining that overlay's include path alone, and lib/particle.h derives the bank byte counts from them beside the records they count -- a bank holds one record more than its ring's highest index, which holds for every overlay that clears one. The names come from what the code does. The draw list carries two record kinds told apart by the tag at 0x08: the small one is never drawn, but moves to a point its source names and creates the big ones where it stands, and the big one carries a model, a pose, a colour and a lifetime and is what reaches the screen. They are an emitter and the particles it spawns, the pools hand out slots so the functions allocate, and the byte that says a slot is busy is inUse in both records.
roengstrom
force-pushed
the
effect-shared-lib
branch
from
September 9, 2026 20:16
14dddec to
93dc9a1
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Split shared functions into a library for the effects overlays.