MarioMove decompilation (23/68 matching, goto-free)#89
Draft
ryanbevins wants to merge 11 commits intodoldecomp:mainfrom
Draft
MarioMove decompilation (23/68 matching, goto-free)#89ryanbevins wants to merge 11 commits intodoldecomp:mainfrom
ryanbevins wants to merge 11 commits intodoldecomp:mainfrom
Conversation
Decompile TMario movement functions including: - addVelocity, windMove, flowMove, setPlayerVelocity - stateMachine, checkAllMotions, considerRotateJumpStart - changePlayerDropping, canBendBody, dirtyLimitCheck - checkRoofPlane, thinkSand, isForceSlip, isUnderWater - getJumpAccelControl Also includes partial matches for checkPlayerAction, checkPlayerAround, onYoshi, isFrontSlip, isWallInFront, getJumpSlideControl, and others. Header fixes: correct return types for getJumpAccelControl, getJumpSlideControl, getWallAngle, isWallInFront, isForceSlip, checkAllMotions, canBendBody, checkStickRotate, isFrontSlip, checkRoofPlane, isUnderWater, onYoshi, and various jump/swim/wait/move/spec main functions.
Report for GMSJ01 (924dbc4 - 7df9114)📈 Matched code: 27.60% (+0.10%, +3500 bytes) ✅ 27 new matches
📈 47 improvements in unmatched items
...and 17 more improvements in unmatched items 📉 1 regression in an unmatched item
|
Revert TMario::onYoshi() back to BOOL, TYoshi::onYoshi() back to bool, and TMario::isWallInFront() back to bool to match upstream declarations. These changes affected register allocation at call sites in MarioDraw, MarioCollision, WaterGun, and MarioAutodemo.
Add canSquat, thinkDirty, getOffYoshi, checkEnforceJump, checkReturn, getRidingMtx implementations. Fix onYoshi return type (bool), canSquat return type (BOOL), isFrontSlip angle type, startForceJumpSound declaration. Add includes for Watergun, LiveActor, MtxUtil, MSound, MapData.
Changing onYoshi() from BOOL to bool broke SMS_IsMarioOnYoshi (100% → 69.23%) and caused 12 regressions across MarioDraw, MarioCollision, WaterGun, and MarioAutodemo.
…, thinkYoshiHeadCollision 83.5%) - checkGraffitoSlip: signed comparison fix + block reorder → 100% - thinkParams: manual inline getDmgMapCode switch + s32 type fix → 93.3% - thinkYoshiHeadCollision: precompute JMASSin/Cos table index → 83.5% - Revert all goto-based control flow hacks - Clean up checkController goto to if/else
Replace goto-based control flow with structured if/else and flag variables across 12 functions: thinkWaterSurface, thinkSituation, getSlideStopCatch, getSlideStopNormal, canSlipJump, isSlipStart, and checkSink.
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
Decompilation of
src/Player/MarioMove.cpp— Mario's movement, physics, and state machine logic.Matching functions (23 MATCH + 4 at 100.0%)
__sinitgetJumpAccelControlisUnderWaterisWallInFrontgetRidingMtxisForceSlipflowMovewindMoveonYoshi(both)addVelocityconsiderRotateJumpStartcanBendBodysetPlayerVelocitycheckRoofPlanechangePlayerDroppingcheckAllMotionsdirtyLimitCheckstartForceJumpSoundgetDmgMapCodestateMachinecalcGroundMtxthinkSandcheckPlayerAroundcheckGraffitoSlipthinkDirtycheckPlayerActionNear-matching functions (95%+)
Most near-matches are blocked by systemic MWCC stack frame inflation — the original compiler allocates 16-40 extra bytes on the stack from inline virtual destructor expansion. All instructions match perfectly except stack offsets.
getJumpSlideControl99.8%,canSquat99.9%,setNormalAttackArea99.7%,checkThrowObject99.8%,checkStickRotate99.8%,checkGroundPlane99.8%,getOffYoshi99.9%,makeHistory97.7%,checkWallPlane98.7%Goto removal
All goto statements have been replaced with structured control flow using flag variables and nested if/else. Functions affected:
thinkWaterSurface,thinkSituation,getSlideStopCatch,getSlideStopNormal,canSlipJump,isSlipStart,checkSink,changePlayerTriJump,changePlayerJumping,checkController,checkRideMovement,checkCurrentPlane,thinkParams. Some functions dropped a few percentage points from this conversion (e.g. slip functions went from MATCH to ~96%) since the original code used goto-based shared return blocks.Known blockers for remaining functions
TBGCheckData::isMarioThrough()at call sites while the original calls it as a function. BlocksisMarioThrough(0%) andcheckWet(64.7%).Header changes
include/Player/MarioMain.hpp— TMario member access and method declarationsinclude/Player/Watergun.hpp— TWaterGun field typesinclude/Player/Yoshi.hpp— TYoshi method signaturesinclude/Camera/Camera.hpp— Camera method declarationinclude/MSound/MSound.hpp— MSoundSE declarations🤖 Generated with Claude Code