Skip to content

Share the effect engine across overlays as src/effect/lib - #84

Merged
roengstrom merged 1 commit into
mainfrom
effect-shared-lib
Sep 9, 2026
Merged

Share the effect engine across overlays as src/effect/lib#84
roengstrom merged 1 commit into
mainfrom
effect-shared-lib

Conversation

@roengstrom

Copy link
Copy Markdown
Owner

Split shared functions into a library for the effects overlays.

@roengstrom roengstrom self-assigned this Sep 8, 2026
@decomp-dev

decomp-dev Bot commented Sep 8, 2026

Copy link
Copy Markdown

Report for SLUS_008.92 (4f9f2ac - 93dc9a1)

Total data: 26696 bytes (-4 bytes)
📉 Matched data: 57.85% (-0.01%, -4 bytes)

✅ 329 new matches
Unit Item Bytes Before After
ovl/effect_001/lib/render effectRenderMesh +3664 0.00% 100.00%
ovl/effect_025/lib/render effectRenderMesh +3664 0.00% 100.00%
ovl/effect_028/lib/spawn effectEmitterSpawn +2716 0.00% 100.00%
ovl/effect_028/lib/spawn effectEmitterSlide +2672 0.00% 100.00%
ovl/effect_028/lib/particlestep effectParticlePose +2368 0.00% 100.00%
ovl/effect_028/lib/particlestep effectParticleAdvance +2056 0.00% 100.00%
ovl/effect_028/lib/draw effectSpriteEmit +1580 0.00% 100.00%
ovl/effect_025/lib/pose effectPoseWalk +1468 0.00% 100.00%
ovl/effect_025/lib/emit_mode effectEmitGouraudTexQuads +1120 0.00% 100.00%
ovl/effect_028/lib/emit effectEmitGouraudTexQuads +1096 0.00% 100.00%
ovl/effect_025/lib/emit_mode effectEmitTexQuads +1016 0.00% 100.00%
ovl/effect_028/lib/emit effectEmitTexQuads +996 0.00% 100.00%
ovl/effect_025/lib/emit_mode effectEmitGouraudTexTris +980 0.00% 100.00%
ovl/effect_028/lib/emit effectEmitGouraudTexTris +956 0.00% 100.00%
ovl/effect_025/lib/emit_mode effectEmitGouraudQuads +928 0.00% 100.00%
ovl/effect_025/lib/emit_mode effectEmitTexTris +916 0.00% 100.00%
ovl/effect_028/lib/emit effectEmitTexTris +904 0.00% 100.00%
ovl/effect_028/lib/emit effectEmitGouraudQuads +904 0.00% 100.00%
ovl/effect_025/lib/emit_mode effectEmitQuads +824 0.00% 100.00%
ovl/effect_025/lib/emit_mode effectEmitGouraudTris +808 0.00% 100.00%
ovl/effect_028/lib/emit effectEmitQuads +804 0.00% 100.00%
ovl/effect_028/lib/emit effectEmitGouraudTris +776 0.00% 100.00%
ovl/effect_001/lib/render effectRenderFaceCamera +748 0.00% 100.00%
ovl/effect_025/lib/render effectRenderFaceCamera +748 0.00% 100.00%
ovl/effect_025/lib/emit_mode effectEmitTris +736 0.00% 100.00%
ovl/effect_028/lib/tint effectTintPlay +732 0.00% 100.00%
ovl/effect_028/lib/emit effectEmitTris +716 0.00% 100.00%
ovl/effect_028/lib/strands effectStrandsAim +712 0.00% 100.00%
ovl/effect_028/lib/drawscript effectDrawScriptStart +680 0.00% 100.00%
ovl/effect_028/lib/tables effectPoseTablesRelocate +676 0.00% 100.00%

...and 299 more new matches

🥀 234 broken matches
Unit Item Bytes Before After
ovl/effect_001/effect_001 func_801A1EBC -3664 100.00% 0.00%
ovl/effect_025/effect_025 func_801A120C -3664 100.00% 0.00%
ovl/effect_028/effect_028 func_801A631C -2716 100.00% 0.00%
ovl/effect_028/effect_028 func_801A75F8 -2672 100.00% 0.00%
ovl/effect_028/effect_028 func_801A4ADC -2368 100.00% 0.00%
ovl/effect_028/effect_028 func_801A41E0 -2056 100.00% 0.00%
ovl/effect_028/effect_028 func_801A5720 -1580 100.00% 0.00%
ovl/effect_025/effect_025 func_801A6354 -1468 100.00% 0.00%
ovl/effect_025/effect_025 func_801A4548 -1120 100.00% 0.00%
ovl/effect_028/effect_028 func_801A3894 -1096 100.00% 0.00%
ovl/effect_025/effect_025 func_801A36B4 -1016 100.00% 0.00%
ovl/effect_028/effect_028 func_801A2A64 -996 100.00% 0.00%
ovl/effect_025/effect_025 func_801A4174 -980 100.00% 0.00%
ovl/effect_028/effect_028 func_801A34D8 -956 100.00% 0.00%
ovl/effect_025/effect_025 func_801A3DD4 -928 100.00% 0.00%
ovl/effect_025/effect_025 func_801A3320 -916 100.00% 0.00%
ovl/effect_028/effect_028 func_801A26DC -904 100.00% 0.00%
ovl/effect_028/effect_028 func_801A3150 -904 100.00% 0.00%
ovl/effect_025/effect_025 func_801A2FE8 -824 100.00% 0.00%
ovl/effect_025/effect_025 func_801A3AAC -808 100.00% 0.00%
ovl/effect_028/effect_028 func_801A23B8 -804 100.00% 0.00%
ovl/effect_028/effect_028 func_801A2E48 -776 100.00% 0.00%
ovl/effect_001/effect_001 func_801A1A4C -748 100.00% 0.00%
ovl/effect_025/effect_025 func_801A0D9C -748 100.00% 0.00%
ovl/effect_025/effect_025 func_801A2D08 -736 100.00% 0.00%
ovl/effect_028/effect_028 func_801A16A4 -732 100.00% 0.00%
ovl/effect_028/effect_028 func_801A20EC -716 100.00% 0.00%
ovl/effect_028/effect_028 func_801A8A1C -712 100.00% 0.00%
ovl/effect_028/effect_028 func_801A9050 -680 100.00% 0.00%
ovl/effect_028/effect_028 func_801A8CE4 -676 100.00% 0.00%

...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
roengstrom merged commit e3acf06 into main Sep 9, 2026
1 check passed
@roengstrom
roengstrom deleted the effect-shared-lib branch September 9, 2026 20:18
@roengstrom
roengstrom restored the effect-shared-lib branch September 9, 2026 20:29
@roengstrom
roengstrom deleted the effect-shared-lib branch September 9, 2026 20:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant