Skip to content

Improve particle command interpreter matching - #3080

Draft
g-guthrie wants to merge 19 commits into
doldecomp:masterfrom
g-guthrie:agent/improve-particle-8039930c
Draft

Improve particle command interpreter matching#3080
g-guthrie wants to merge 19 commits into
doldecomp:masterfrom
g-guthrie:agent/improve-particle-8039930c

Conversation

@g-guthrie

@g-guthrie g-guthrie commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

What changed

  • recover post-increment bytecode reads across particle commands
  • align command operand width and pointer walks with the original interpreter
  • improve size, rotation, aim, random-pose, and velocity-normalization code generation
  • preserve the size-interpolation count cursor through variable-width operands
  • preserve decoded velocity-scale and trail values across particle writes
  • split big-endian spawn indices to recover the original instruction scheduling
  • separate per-channel color-random lifetimes to recover the original FPR allocation
  • lower the aim-distance square root in place to match the original refinement sequence
  • recover tornado-physics constant loads and register allocation
  • reuse the translation unit existing volatile zero constant
  • align repeated JObj attachment loads and translation updates

Why

hsd_8039930C is a 15,264-byte particle command interpreter and one of the largest unmatched functions in the project. The remaining differences are primarily expression ordering, pointer-update shapes, constant lifetimes, and register allocation rather than behavioral gaps.

These source-equivalent changes preserve particle behavior while moving the generated PowerPC code closer to the original. The local exact-compiler comparison improves from 93.83255% on the base revision to 96.82888%. The current generated function is 15,260 bytes, four bytes short of the target, while the candidate .sdata2 section matches the target 96-byte size. Authoritative PR CI reports 492 additional matched bytes and improves hsd_8039930C from 94.44% to 97.67%.

Validation

  • exact MWCC 1.2.5n translation-unit compile
  • function extraction and objdiff comparison
  • clang-format --dry-run --Werror src/sysdolphin/baselib/particle.c
  • python3 tools/check/main.py --quiet src/sysdolphin/baselib/particle.c
  • git diff --check origin/master...HEAD

The full local Ninja build requires orig/GALE01/sys/main.dol, which is not present in this checkout. The authoritative link, test, and decomp.dev results are expected from the PR checks.

@decomp-dev

decomp-dev Bot commented Aug 14, 2026

Copy link
Copy Markdown

Report for GALE01 (e0c83a9 - 7097580)

📈 2 improvements in unmatched items
Unit Item Bytes Before After
main/sysdolphin/baselib/particle hsd_8039930C +492 94.44% 97.67%
main/sysdolphin/baselib/particle extabindex 0 97.44% 98.08%

@g-guthrie
g-guthrie force-pushed the agent/improve-particle-8039930c branch from 32407cd to a0be742 Compare August 14, 2026 17:37
@g-guthrie g-guthrie changed the title Improve hsd_8039930C match to 95.43% Improve particle command interpreter matching Aug 14, 2026
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