fix(grab): Euler-extract gimbal-lock tolerance — actual fix for the reported grab inversion#205
Merged
Merged
Conversation
… reported grab inversion Bumps the decomp pointer to pull a one-line tolerance change in func_ovl2_800EDA0C that's the actual fix for the "victim upside-down during grab hold" symptom several Windows/Linux reporters hit (and which JR confirmed reproducible on macOS with Pikachu→Samus on Dreamland after PR #204 landed but did NOT correct the visual). PR #204's stale-FTParts-transform-cache work landed earlier today based on the TC fork handoff doc's diagnosis. Live tracing in the grab path with PR #204 active showed root_cache_pre=0 and hand_cache_pre=0 on every one of 975 traced frames — the invalidate had nothing to clear. Looking at the actual matrix the Euler-extract function received gave 0.9999923 for dst[0][2] (X-axis row's Z component), missing the exact-equality gimbal-lock branch by ~8e-6 of float noise. atan2 on the remaining tiny components extracted ~50° of garbage roll → tilted, "upside-down" victim. Full investigation, repro trace methodology, and audit-hook for similar precision-sensitive matched-decomp patterns in docs/bugs/grab_pose_eulerextract_gimbal_2026-05-23.md. The preceding stale-cache fix is kept (defensive, harmless) but marked "PARTIALLY APPLIES (defensive); not the offline-bug fix" in the bug index so future readers don't chase the same wrong tree. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 tasks
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.
Summary
Real fix for the "victim upside-down with torso clipped into ground" grab-hold bug. Supersedes PR #204 (which landed earlier today based on the TC fork's stale-FTParts-transform-cache diagnosis and turned out to be a no-op for the offline reproducer — kept as defensive coverage).
JR reproduced the bug after PR #204 merged: Pikachu → Samus on Dreamland, ~50° tilt visible on the held victim. Live trace under `SSB64_GRAB_TRACE=1`:
The check was always fragile; IDO/MIPS rounding lands at exact `1.0F` often enough that vanilla N64 works; modern toolchains' float math doesn't.
Fix
One-line tolerance under `#ifdef PORT` in `func_ovl2_800EDA0C`:
```c
#ifdef PORT
if ((dst[0][2] <= -0.9999F) || (dst[0][2] >= 0.9999F))
#else
if ((dst[0][2] == -1.0F) || (dst[0][2] == 1.0F))
#endif
```
`0.9999F` ≈ within 0.81° of pure ±90° yaw — narrow gimbal-lock window, doesn't trip for real rotations. After fix, trace shows `victim_out_rot.z = 0.000000` across the entire hold. Visual repro confirmed corrected by JR.
Also covers `scSubsysFighterOpeningProcUpdate` (Master Hand opening movie) which uses the same extraction pattern.
Files
Decomp commit `055659e35` on `JRickey/ssb-decomp-re#port-patches`.
Test plan
🤖 Generated with Claude Code