Skip to content

Match Hitbox::update#2

Open
skijer wants to merge 1 commit intodoldecomp:mainfrom
skijer:match/kart-hitbox-update
Open

Match Hitbox::update#2
skijer wants to merge 1 commit intodoldecomp:mainfrom
skijer:match/kart-hitbox-update

Conversation

@skijer
Copy link
Copy Markdown

@skijer skijer commented Apr 29, 2026

Changes

  • Extract bsp->radius to a local before the multiply in Hitbox::update.
  • Rewrite the scaledPos.y arithmetic as in-place mutations
    (+= hitboxElevation, *= scale.y, += postScaleHitboxElevation)
    instead of sum/summult temporaries.
  • Promote kart/KartHitbox.cpp from NonMatching to Equivalent.

What this fixes

Hitbox::update now produces byte-identical instructions to the target.
Previously it diffed in ~12 instructions due to a float register
allocation cascade where postScaleHitboxElevation landed in f4
instead of f5. Extracting bsp->radius to a named local before
the multiply moves the load earlier in the schedule and shifts the
allocation.

Extract `bsp->radius` to a local and reorder scaledPos.y operations
as in-place mutations to influence float register allocation, so
the function produces identical bytes to the target. Promotes
KartHitbox.cpp from NonMatching to Equivalent.
@em-eight
Copy link
Copy Markdown
Collaborator

em-eight commented May 1, 2026

Looks good! Thank you for the contribution.

Can you also delete the MARK_FLOW_CHECK(0x805b7fbc); macro above the function? This is to signal that the function assembly is not exactly the same but it is functionally equivalent, but with your changes that is not needed

Also now since the whole file is matching now, you should be able to change it to Matching in configure.py!

@decomp-dev
Copy link
Copy Markdown

decomp-dev Bot commented May 1, 2026

Report for RMCP01 (f5142e5 - 3e782da)

📈 Matched code: 5.76% (+0.00%, +236 bytes)

✅ 1 new match
Unit Item Bytes Before After
StaticR/kart/KartHitbox Kart::Hitbox::update(const EGG::Vector3f&, const EGG::Quatf&, const EGG::Vector3f&, float, float) +4 98.73% 100.00%

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.

2 participants