Skip to content
decomp-fixup logo

Melee Build Fixup

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 bui...

SKILL.md

Full skill instructions

Melee 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/UNK_PARAMS that need real signatures
  • 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 PatternCauseSolution
implicit declaration of functionMissing prototypeAdd to header
conflicting types for 'func'Header/​impl mismatchFix header signature
too few arguments to functionSignature changedUpdate callers
too many arguments to functionSignature changedUpdate callers
incompatible pointer typeType mismatchFix types
unknown type nameMissing include/​typedefAdd 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:

  • ft_* functions: melee/​include/​melee/​ft/​forward.h or melee/​include/​melee/​ft/​ftcommon.h
  • lb* functions: melee/​include/​melee/​lb/​forward.h
  • gr* functions: 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:

  1. Find the implementation in src/​melee/
  2. Copy the exact signature
  3. Update the header declaration
  4. Keep the /​* address */ comment if present

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 bl instruction
  • 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 header
  • Fix build: add missing prototype for lbColl_80008440
  • Fix build: update callers for gr_800123AB signature change

Checklist Before Committing

  1. Build passes
  2. No merge conflict markers in files
  3. Header signatures match implementations exactly
  4. All callers updated if signature changed
  5. No UNK_RET/UNK_PARAMS left for functions you've implemented

Common Mistakes

  1. Fixing implementation instead of header - If match is 100%, don't touch the .c file
  2. Forgetting callers - One signature change can break many files
  3. Wrong worktree - Make sure you're in the right subdirectory worktree
  4. Partial fixes - Don't commit until ALL errors are resolved
  5. Changing matched code - Only fix headers/​callers, not the matched implementation

Type Reference

Common types in Melee:

  • s8, s16, s32 - signed integers
  • u8, u16, u32 - unsigned integers
  • f32, f64 - floats
  • BOOL - boolean (actually s32)
  • HSD_GObj* - game object pointer
  • Fighter* - fighter state pointer
  • Vec3 - 3D vector struct
  • M2C_UNK - unknown type placeholder

What NOT to Do

  1. Don't modify matched code - The .c implementation is correct, fix the header
  2. Always verify build passes - Prototype requirements are enforced by default
  3. Don't leave partial fixes - Fix everything or nothing
  4. Don't guess signatures - Check the actual implementation
  5. Don't ignore callers - They WILL break if signature changes

Troubleshooting

IssueSolution
Can't find headerCheck include/​melee/<module>/​forward.h
Multiple declarationsSearch all .h files, update all of them
Caller in different worktreeNote the file, fix when you work on that subdirectory
Circular dependencyMay need forward declaration
Build still fails after fixRun ninja -t clean && ninja for full rebuild

More skills from majiayu000

xiaohongshu logo
majiayu000/claude-arsenal

xiaohongshu

xiaohongshu

286 148
View
agent-task-conductor logo
majiayu000/claude-skill-registry

agent-task-conductor

Conduct multi-agent task orchestration and workflow coordination.

663 1
View
conductor-setup logo
majiayu000/claude-skill-registry

conductor-setup

Initialize project with Conductor artifacts (product definition,

663 1
View
animation-designer logo
majiayu000/claude-skill-registry

animation-designer

Expert in web animations, transitions, and motion design using Framer Motion and CSS

663 1
View
diagramming logo
majiayu000/claude-skill-registry

diagramming

Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...

663 1
View
h3-pg logo
majiayu000/claude-skill-registry-data

h3-pg

PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.

23 1
View
conductor-development logo
majiayu000/claude-skill-registry

conductor-development

Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...

663 1
View
conductor-status logo
majiayu000/claude-skill-registry

conductor-status

Display project status, active tracks, and next actions

663 1
View
dockerization logo
majiayu000/claude-skill-registry

dockerization

Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.

663 1
View

Popular AI tools

Kaiber logo
Video

Kaiber

Generate, edit, and beat-sync AI video with leading models in one workspace.

Paid
View
Vimcal logo
Productivity

Vimcal

The world's fastest calendar for remote work

Free
View

Transform Your Design with AI Designer by ImgCreator.ai

Freemium
View
Akool AI logo
Content & writing

Akool AI

Revolutionizing Video Production with AI-Powered Creativity

Paid
View

Extend an image past the frame and let AI fill the new aspect ratio.

Freemium
View
StarByFace logo
Security

StarByFace

Discover your celebrity doppelgänger with StarByFace!

Free
View
C

ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.

Freemium
View
Opus Clip logo
Coding & apps

Opus Clip

Opus.ai: Revolutionize Your Web Experience

Free
View