Claude-skill-registry decomp-fixup
Fix build issues for matched functions in the Melee decompilation project. Use this skill when builds are failing due to header mismatches, signature issues, or caller updates needed after a function has been matched. Invoked with /decomp-fixup [function_name] or automatically when diagnosing build failures.
git clone https://github.com/majiayu000/claude-skill-registry
T=$(mktemp -d) && git clone --depth=1 https://github.com/majiayu000/claude-skill-registry "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/data/decomp-fixup" ~/.claude/skills/majiayu000-claude-skill-registry-decomp-fixup && rm -rf "$T"
skills/data/decomp-fixup/SKILL.mdMelee Build Fixup
You are an expert at fixing build issues in the Melee decompilation project. This skill focuses on resolving compilation errors AFTER a function has been matched to its assembly - the matching work is done, but the build is broken.
When to Use This Skill
Use
/decomp-fixup when:
- A matched function causes build failures
- Headers have
/UNK_RET
that need real signaturesUNK_PARAMS - Callers need updates after signature changes
- Struct definitions are causing type errors
- Build is failing due to missing prototypes
Use
/decomp instead when:
- You need to match assembly (get 100% match)
- You're starting fresh on a function
Finding Functions That Need Fixes
# Check state for functions that may need build fixes melee-agent state status # Look for functions in "committed" state that may have broken builds # Or check functions with known issues melee-agent state status <function_name>
Diagnosing Build Errors
Step 1: Run the Build
cd <worktree> && python configure.py && ninja
The build requires function prototypes by default (same as CI). Common error types:
| Error Pattern | Cause | Solution |
|---|---|---|
| Missing prototype | Add to header |
| Header/impl mismatch | Fix header signature |
| Signature changed | Update callers |
| Signature changed | Update callers |
| Type mismatch | Fix types |
| Missing include/typedef | Add include |
Step 2: Locate the Header
Function headers are typically in:
melee/include/melee/<module>/forward.h # Forward declarations melee/include/melee/<module>/<file>.h # Full declarations
Example paths:
functions:ft_*
ormelee/include/melee/ft/forward.hmelee/include/melee/ft/ftcommon.h
functions:lb*melee/include/melee/lb/forward.h
functions:gr*melee/include/melee/gr/forward.h
Step 3: Find Callers
When you change a function's signature, find and fix all callers:
grep -r "function_name" <worktree>/src/melee/ grep -r "function_name" <worktree>/include/melee/
Common Fixes
Fix 1: Header Signature Mismatch
Problem: Header has stub declaration, implementation has real signature.
// Before (in header - stub declaration): /* 0D7268 */ UNK_RET ftCo_800D7268(UNK_PARAMS); // After (matches implementation): /* 0D7268 */ void ftCo_800D7268(Fighter* fp, s32 arg1);
Steps:
- Find the implementation in
src/melee/ - Copy the exact signature
- Update the header declaration
- Keep the
comment if present/* address */
Fix 2: UNK_RET to Real Return Type
// Before: UNK_RET func(s32 x); // After (if implementation returns void): void func(s32 x); // After (if implementation returns a value): s32 func(s32 x);
Note:
M2C_UNK can be used as a placeholder return type when the actual type is still being determined.
Fix 3: UNK_PARAMS to Real Parameters
// Before: void func(UNK_PARAMS); // After (from implementation): void func(HSD_GObj* gobj, s32 action_id, float frame);
Fix 4: Updating Callers
When a signature changes from
void foo(void) to void foo(s32 arg):
// Before (caller): foo(); // After (caller - must pass argument): foo(0); // Or appropriate value based on context
Finding the right argument:
- Check assembly at call sites
- Look at r3/r4/etc register values before
instructionbl - Check if there's a pattern in similar functions
Fix 5: Missing Parameter Names
Headers need parameter names for documentation, but types must match:
// Before (missing names): void func(s32, float, HSD_GObj*); // After (with names): void func(s32 action, float frame, HSD_GObj* gobj);
Fix 6: Struct/Type Issues
If a struct field type is wrong:
// Workaround in code (temporary fix): #define DMG_X1898(fp) (*(float*)&(fp)->dmg.x1898) // Better: Fix the struct definition in the header // Before: s32 x1898; // After: float x1898;
Workflow
Quick Fix (Single Function)
# 1. Check build error cd <worktree> && ninja 2>&1 | head -50 # 2. Find header location grep -r "function_name" <worktree>/include/ # 3. Find implementation grep -r "function_name" <worktree>/src/melee/ # 4. Compare signatures and fix header # 5. Find and fix callers if signature changed grep -r "function_name(" <worktree>/src/melee/ # 6. Rebuild and verify ninja
Batch Fix (Multiple Issues)
# 1. Get full error list cd <worktree> && python configure.py && ninja 2>&1 | tee build_errors.txt # 2. Categorize errors grep "conflicting types" build_errors.txt grep "implicit declaration" build_errors.txt grep "too few arguments" build_errors.txt # 3. Fix in dependency order (headers first, then callers)
Committing Fixes
After fixing build issues:
# Verify build passes cd <worktree> && python configure.py && ninja # Commit the fix (in the worktree) git add -A git commit -m "Fix build: update <function> signature in header"
Commit message patterns:
Fix build: update ftCo_800D7268 signature in headerFix build: add missing prototype for lbColl_80008440Fix build: update callers for gr_800123AB signature change
Checklist Before Committing
- Build passes
- No merge conflict markers in files
- Header signatures match implementations exactly
- All callers updated if signature changed
- No
/UNK_RET
left for functions you've implementedUNK_PARAMS
Common Mistakes
- Fixing implementation instead of header - If match is 100%, don't touch the .c file
- Forgetting callers - One signature change can break many files
- Wrong worktree - Make sure you're in the right subdirectory worktree
- Partial fixes - Don't commit until ALL errors are resolved
- Changing matched code - Only fix headers/callers, not the matched implementation
Type Reference
Common types in Melee:
,s8
,s16
- signed integerss32
,u8
,u16
- unsigned integersu32
,f32
- floatsf64
- boolean (actually s32)BOOL
- game object pointerHSD_GObj*
- fighter state pointerFighter*
- 3D vector structVec3
- unknown type placeholderM2C_UNK
What NOT to Do
- Don't modify matched code - The .c implementation is correct, fix the header
- Always verify build passes - Prototype requirements are enforced by default
- Don't leave partial fixes - Fix everything or nothing
- Don't guess signatures - Check the actual implementation
- Don't ignore callers - They WILL break if signature changes
Troubleshooting
| Issue | Solution |
|---|---|
| Can't find header | Check |
| Multiple declarations | Search all files, update all of them |
| Caller in different worktree | Note the file, fix when you work on that subdirectory |
| Circular dependency | May need forward declaration |
| Build still fails after fix | Run for full rebuild |