Skip to content

Decomp effect overlays 052, 039 & 036 - #86

Merged
roengstrom merged 5 commits into
mainfrom
decomp-effect_056
Sep 9, 2026
Merged

Decomp effect overlays 052, 039 & 036#86
roengstrom merged 5 commits into
mainfrom
decomp-effect_056

Conversation

@roengstrom

Copy link
Copy Markdown
Owner

No description provided.

X-Potion runs the engine Curaga already carries, so 99 of its 118 functions
are the library: nineteen units, listed in its own link order, and a symbol
file that maps their names onto its addresses. Deriving that map is the whole
of the work -- align unit by unit and position by position, because two
functions of one unit can hash alike when they differ only in which sibling
they call, and pair the relocation streams off against each other. 244
addresses paired with nothing left in conflict.

What is X-Potion's own is the entry, a root dispatcher and seventeen script
functions, and all but one of those are byte-identical to Curaga's or Cure's,
so they came across with the addresses rewritten. Only the bank carve was
written here. Its rings are Curaga's sizes, so its parameter header is the
same two counts; what differs is the pool: X-Potion has no trailing-spark
pool, which is why its entry sets up three where Curaga sets up four and its
dispatcher drains three.

Three things the overlay needed from its config. splat does not carve out a
lone `jr ra` no-op, and three of them sit between script functions, so they
are named in the symbol file or the binary comes out short and every later
address shifts. The asset blob was declared from 0x9BF0, which swallowed the
script dispatch tables; it starts at 0x9C68. And the jump tables carry the
tail pad ASFLAGS suppress, so the pad between particlestep's and list's is
declared.
The port left the entry taking its prototype from effect_028_entry.h, the
overlay it was copied from. Both overlays declare the same signature under
the same name, so it compiled and the binary matched -- nothing but reading
the include would have shown it. X-Potion's entry now owns its declaration,
the way the other three overlays' do.
Drain runs Curaga's engine at Curaga's own offsets: all twenty library units
land where they do there, and 276 addresses pair off the aligned relocation
streams with nothing in conflict. Its script block lines up with Curaga's
function for function, so twenty-eight of its thirty came across by position
with the addresses rewritten.

One function is Drain's own. Its take-model dispatcher spawns a screen tint
at frame 4 as well as frame 20, each from its own step table, where Curaga
spawns one. The bank carve looked new too but is not: it differs only in the
addresses and the emitter bank's size, which its parameter header supplies --
Drain runs thirty-nine emitters where Curaga runs eighty-nine.

That difference found a bug in the library. Both pool allocators bounded
their search with a literal, `n < 0x5A`, which is Curaga's ring size rather
than the ring's, so Drain built one byte wrong at the emitter's wrap test.
The bound is the ring's own size now, and the doc says why it is one more
than the ring holds: the search starts where the last one left off, so the
slot it began on is the last it examines.
…rces

effect_050, effect_051 and effect_056 are byte-identical to effect_001,
effect_025 and effect_039, so each yaml entry names the twin's own source
files at the twin's offsets. They need only a symbol file of their own, and
effect_056 a parameter header. No new C.

effect_036 (Confuse) links the same nineteen library units as effect_039 in
the same order, four bytes along. 99 of its 121 functions come from
src/effect/lib, and 16 of the remaining 21 are bodies already written for
effect_001, effect_025 and effect_028 -- five of them the same handler that
consumes an opcode and does nothing else.

lib/bankclear is 84 bytes here against effect_039's 88 because Confuse's
particle bank fits a 16-bit immediate where Drain's needs lui and ori. Both
ring sizes fall out of those two immediates: 0x1D emitters and 0x31 particles.

func_800C2BD0 had no declaration and one parameter, but its only caller passes
two, and its sibling func_800C2B88 has the same shape with two. An unused
parameter emits no code, so the definition takes the second one and types the
first as the slot it is handed; the pointer the flags hang off is named on
BattleEffectSlot rather than reached at 0x74.
@decomp-dev

decomp-dev Bot commented Sep 9, 2026

Copy link
Copy Markdown

Report for SLUS_008.92 (e3acf06 - 1c686e0)

Total code: 1466412 bytes (+213192 bytes)
Total functions: 5506 (+707)
📈 Matched code: 56.68% (+7.37%, +213192 bytes)
Total data: 27592 bytes (+896 bytes)
📈 Matched data: 59.22% (+1.37%, +896 bytes)

✅ 944 new matches
Unit Item Bytes Before After
ovl/effect_050/lib/render effectRenderMesh +3664 0.00% 100.00%
ovl/effect_051/lib/render effectRenderMesh +3664 0.00% 100.00%
ovl/effect_036/lib/spawn effectEmitterSpawn +2716 0.00% 100.00%
ovl/effect_039/lib/spawn effectEmitterSpawn +2716 0.00% 100.00%
ovl/effect_052/lib/spawn effectEmitterSpawn +2716 0.00% 100.00%
ovl/effect_056/lib/spawn effectEmitterSpawn +2716 0.00% 100.00%
ovl/effect_036/lib/spawn effectEmitterSlide +2672 0.00% 100.00%
ovl/effect_039/lib/spawn effectEmitterSlide +2672 0.00% 100.00%
ovl/effect_052/lib/spawn effectEmitterSlide +2672 0.00% 100.00%
ovl/effect_056/lib/spawn effectEmitterSlide +2672 0.00% 100.00%
ovl/effect_036/lib/particlestep effectParticlePose +2368 0.00% 100.00%
ovl/effect_039/lib/particlestep effectParticlePose +2368 0.00% 100.00%
ovl/effect_052/lib/particlestep effectParticlePose +2368 0.00% 100.00%
ovl/effect_056/lib/particlestep effectParticlePose +2368 0.00% 100.00%
ovl/effect_036/lib/particlestep effectParticleAdvance +2056 0.00% 100.00%
ovl/effect_039/lib/particlestep effectParticleAdvance +2056 0.00% 100.00%
ovl/effect_052/lib/particlestep effectParticleAdvance +2056 0.00% 100.00%
ovl/effect_056/lib/particlestep effectParticleAdvance +2056 0.00% 100.00%
ovl/effect_050/effect_001 func_801A2E48 +1748 0.00% 100.00%
ovl/effect_036/lib/draw effectSpriteEmit +1580 0.00% 100.00%
ovl/effect_039/lib/draw effectSpriteEmit +1580 0.00% 100.00%
ovl/effect_052/lib/draw effectSpriteEmit +1580 0.00% 100.00%
ovl/effect_056/lib/draw effectSpriteEmit +1580 0.00% 100.00%
ovl/effect_051/lib/pose effectPoseWalk +1468 0.00% 100.00%
ovl/effect_051/lib/emit_mode effectEmitGouraudTexQuads +1120 0.00% 100.00%
ovl/effect_036/lib/emit effectEmitGouraudTexQuads +1096 0.00% 100.00%
ovl/effect_039/lib/emit effectEmitGouraudTexQuads +1096 0.00% 100.00%
ovl/effect_052/lib/emit effectEmitGouraudTexQuads +1096 0.00% 100.00%
ovl/effect_056/lib/emit effectEmitGouraudTexQuads +1096 0.00% 100.00%
ovl/effect_051/lib/emit_mode effectEmitTexQuads +1016 0.00% 100.00%

...and 914 more new matches

@roengstrom
roengstrom merged commit 763b96a into main Sep 9, 2026
1 check passed
@roengstrom
roengstrom deleted the decomp-effect_056 branch September 9, 2026 20:39
@roengstrom
roengstrom restored the decomp-effect_056 branch September 9, 2026 20:43
@roengstrom
roengstrom deleted the decomp-effect_056 branch September 9, 2026 20:43
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