⏳ This skill is pending AI review.

Scores will appear once the review pipeline completes.

version unknown

dkc1-tools

elliotttate@elliotttate⭐ 305 stars· last commit 2mo ago· 14 open issues

Working guide to the DKC1Recomp debugging/verification tool suite — builds, hosts, routes, detectors, regression gates, and the code atlas. Use when debugging widescreen/gameplay issues, running evidence captures, or navigating the disassembly knowledge sources.

Choose how to use this skill

You do not need every option. Choose the path your AI client supports. The stable page stays the same; versioned files are immutable.

1. Native installer

This listing has no registered native installer command. Use the complete package or source fallback below, depending on what your client supports.

Do not guess an installer command or replace an existing version without reviewing the diff.

2. Complete package recommended

Download the ZIP when available. It includes SKILL.md plus the references, security notes and version metadata.

No complete ProSkills package is published for this listing yet.

3. Prompt-only

Copy the prompt above when the agent can read the stable page or when you want to adopt the workflow without installing a skill.

Need only the instruction file?

Download SKILL.md only if your client requires a single file. The complete ZIP is safer for a full installation because it preserves the references and release context.

No path installs or executes anything by itself. Your agent still needs access to the project files. Before updating, compare the installed version and review the diff.

—/10

// RATINGS

⭐GitHub Stars
⭐⭐⭐ 305 on GitHubGitHub ↗

Popular

🟢ProSkills Score
—
📍

Not yet listed on ClawHub or SkillsMP

// README

DKC1Recomp

Static recompilation of Donkey Kong Country (SNES, USA v1.0) into a native desktop application, using the project's pinned snesrecomp fork framework — following the working DKC2Recomp project (same Rare engine family) as the template.

Status: playable bring-up. The project has 100% statically generated game code, a headless validation host, playable Windows and native macOS hosts, continuous audio, and an opt-in 342x224 widescreen presentation path. See docs/BRINGUP.md for the chronological bring-up record and docs/WIDESCREEN.md for the widescreen architecture, ported SuperZSNES findings, validation, and limitations.

Windows releases now include the Mac host's graphics, CRT/reconstruction, 16:10/16:9, remapping, Assist, music and mod controls in a dark native menu and settings panel. See Windows build, features and validation.

Windows v0.0.13 adds the optional Mods > Dixie Kong Country variant, including the map sprite fix. Keep both executables and SDL2.dll together; the same verified clean DKC1 ROM supplies either variant. See Dixie setup and tested scope. The accompanying Mac download is the unchanged v0.0.9 build and does not include Dixie or the v0.0.12 save fix.

Starting with v0.0.12 on Windows, Candy's in-game saves persist across launches. See save locations, recovery and validation.

A native iPhone/iPad frontend is available in v0.0.14, with full-screen landscape, transparent touch controls, Y/B thumb rolling and Y hold, Metal upscaling, stereo audio, controller support, ROM import and saves. The signed sideload IPA requires re-signing for the recipient's device. The release also retains the Windows v0.0.13 and Mac v0.0.9 downloads. See iOS build instructions and validated scope.

Why this game is a strong recomp candidate

Unlike most bring-ups, DKC1 does not need blind code discovery: the Yoshifanatic1 DKC1 disassembly (GPL-3) rebuilds the ROM byte-identically, and an IDA-based pipeline over it (in the disassembly repo under Tools/IDA/) provides:

  • the exact start and size of every instruction (53,230 instructions / 126,790 bytes) derived from the asar symbol map — no heuristics;
  • 1,276 function entries with proven entry M/X flag states;
  • complete target lists for the indirect-dispatch sites, extracted from the disassembly's own dw jump tables (25 sites, 293 targets — including the 460-entry game-mode dispatcher and the animation-command table);
  • ~90 semantically identified engine routines and RAM addresses.

tools/ingest_dkc1_disasm.py distills that into the per-bank CFG files in recomp/. DKC1 executes all code from banks 80-BF (low-RAM-mirror halves of HiROM); the cfg banks follow that layout.

Supported ROM

Headerless Donkey Kong Country USA v1.0:

PropertyExpected value
Size4,194,304 bytes
SHA-256fa8cacf5bbfc39ee6bbaa557adf89133d60d42f6cf9e1db30d5a36a469f74d15

The ROM must remain outside Git. No ROM bytes, extracted assets, or generated game code are committed.

For controlled testing of a data-only ROM produced by a level editor, the runtime can opt into one exact modified 4 MB payload. Set DKC1_ALLOW_ROM_SHA256 to that file's complete SHA-256 digest and pass the same file on the command line. This does not disable verification: a missing, malformed, or non-matching value is rejected, and the clean retail digest remains the only accepted default. Because the native game code was generated from the supported retail ROM, use this development override only for a patch whose changed ranges have been audited as data.

The macOS host also accepts DKC1_STARTUP_SCRIPT=/path/to/route.dks for editor playtests. It runs an input/wait-only deterministic route from clean power-on before showing the first interactive frame; save-state and checkpoint commands are rejected. RainbowZ combines this with an exact modified-ROM hash pin to open its generated Jungle Hijinxs level directly without a reusable save state.

Debugging and validation

The widescreen port is developed from byte-exact, deterministic evidence—not screenshots alone. docs/WIDESCREEN_DEBUG_TOOLS.md defines the native debug-tool roadmap, ordered from per-frame decision traces and replayable snapshots through object-lifecycle analysis and whole-game level sweeps. docs/WIDESCREEN_HANDOFF.md records the current evidence, hashes, open issues, and release gates. docs/HOST_PACING.md documents the Windows compositor clock, audio/save-state recovery, JSONL profiler, measured baselines, and the deterministic stall-recovery test.

Licensing and third-party code

Project-authored host and tooling code is MIT licensed. The pinned snesrecomp framework has its own PolyForm Noncommercial license and third-party notices. DKC structural metadata retains its documented GPL-3 disassembly provenance. See THIRD_PARTY_NOTICES.md.

Generate the recompiled sources

git submodule update --init --recursive
python scripts\generate_snesrecomp.py --rom "C:\private\dkc1.sfc"

Output lands in ignored generated/snesrecomp/. Regenerate recomp/*.cfg from the disassembly pipeline with:

python tools\ingest_dkc1_disasm.py --work "<disassembly>\Tools\IDA\work" --out recomp

Generation automatically runs the fail-closed widescreen override pass. It adapts only source-visible culling, object activation, and direct-OAM packing; logical camera, collision, exits, boss arenas, and tile streaming remain the cartridge program.

Build and run

With a Visual Studio developer environment available:

.\build_host.bat
.\build\dkc1_desktop.exe "C:\private\dkc1.sfc"

The desktop host enables widescreen by default. Set DKC1_WIDESCREEN=0 for the exact 256x224 presentation path. At a level's authored walls the 4:3 edge stays pinned at the wall and the inward view is released gradually over eight margins of travel, so nothing past the level is shown; View > Level Edge on macOS (or DKC1_WIDESCREEN_EDGE=reflect|bars|shift|glide) switches to a view locked to the camera with the terrain mirrored past the wall, black past the wall, or the earlier inward clamp. The headless validator accepts a frame count and supports deterministic input playback and private frame/state captures; its environment variables are documented in docs/BRINGUP.md.

macOS

Install CMake, Ninja, and SDL2, then provide the same verified ROM the first time private generated sources are needed:

brew install cmake ninja sdl2
./build_macos.sh "/path/to/Donkey Kong Country (USA).sfc"
open build/macos/DKC1Recomp.app

The arm64 app targets macOS 26 or newer, includes its SDL2 runtime, and opens a native ROM picker when launched without arguments; the ROM is never copied into the app. Keyboard controls match Windows (arrows, Z/X/S/A, Q/W, Return, Right Shift), and SDL game controllers are supported. F7 pauses, F8 steps, F9 exports an armed flight-recorder bundle, F11/F12 quick-save/load, and Option-Return toggles fullscreen. Native Game and View menus expose those commands plus checked 4:3, 16:10 (308x224), and 16:9 (342x224) aspect-ratio options, layer isolation, and provenance controls. DKC1_ASPECT=16:10 selects the Mac-oriented mode at startup. The Mac host presents SNES pixels at their 7:6 pixel aspect. Fullscreen uses the maximum undistorted fractional fit and offers three persistent host-only samplers: the default Sharp Bilinear keeps flat source-pixel interiors with an approximately one-output-pixel transition, Smooth (Linear) applies conventional bilinear filtering, and `Pixel Sharp (Ne

// HOW IT'S BUILT

// FILES

3 files shipped with this skill. Inline text is the catalog copy. The upstream link is the source repository.

  • .claude/skills/dkc1-tools/SKILL.md7.1 KBdcbdfa403efcupstream ↗
    ---
    name: dkc1-tools
    description: Working guide to the DKC1Recomp debugging/verification tool suite — builds, hosts, routes, detectors, regression gates, and the code atlas. Use when debugging widescreen/gameplay issues, running evidence captures, or navigating the disassembly knowledge sources.
    ---
    
    # DKC1Recomp tool suite
    
    This repo is a **static recompilation** of Donkey Kong Country (SNES, USA
    v1.0) with **host-side widescreen presentation**. Everything here follows
    one contract: game logic stays byte-for-byte stock; widescreen is
    presentation only (margins, camera bias, wider object *visibility* — never
    changed *simulation*). The supported ROM is headerless USA v1.0,
    sha256 `fa8cacf5bbfc39ee6bbaa557adf89133d60d42f6cf9e1db30d5a36a469f74d15`
    (never commit ROMs, save states, captures, or generated game code).
    
    ## ⚠ Do not confuse the two widescreen efforts
    
    There were TWO widescreen projects. Only this repo is current:
    
    | | **This repo (current)** | **Legacy emulator hack (reference only)** |
    |---|---|---|
    | Approach | Host-side presentation over stock logic | ROM patched with asar (game code modified) |
    | Location | `C:\Users\ellio\Documents\GitHub\DKC1Recomp` | in-repo consolidated copy: `reference/legacy-widescreen/` (canonical for reading); originals at `D:\Downloads\DKLR\DKC-Widescreen-358x224\`, `D:\Downloads\DKLR\DKC_Widescreen_358x224*.sfc` (+398 variants, MSU1 builds), `reference/disassembly/DKC1/Custom\Patches\Widescreen_358x224.asm`, `RomMap\ROM_Map_HACK_*` |
    | Use for | All new work | Prior-art reference: its worklog documents bug classes (OAM X-high wrap, exit-boundary coverage, section controllers) that inspired our detectors. **Never copy its code or compare its patched-ROM behavior as "stock".** |
    
    If a file mentions `358x224`, asar patching, or lives under
    `reference/legacy-widescreen/` or under `D:\Downloads\DKLR\` outside the
    disassembly's clean sources, it is the legacy effort. (Careful: the
    RECOMP host renders 342x224 / 398x224 — a `398x224` mention alone does
    not mean legacy; `358x224` always does.)
    
    ## Repo map
    
    - `runner/` — host + adapters (`dkc1_game.c` presentation glue,
      `win32_host.c` visible debugger, `headless_main.c`, detectors)
    - `snesrecomp/` — engine submodule (**fork: elliotttate/snesrecomp**;
      `runner/src/snes/ws_shadow.c` is the widescreen margin cache)
    - `recomp/*.cfg` — recompiler configs incl. **dispatch contracts**
      (runtime-proven indirect-call target sets). Fixes for
      recompilation-correctness bugs go HERE, then regenerate.
    - `generated/` — machine-emitted game C. **Never hand-edit or commit.**
    - `tools/` — the analysis/verification suite (see `TOOLS.md` here)
    - `recipes/*.dks` — deterministic input routes; `contracts/*.json` —
      regression contracts; `docs/KNOWN_ISSUES.json` + `docs/DASHBOARD.md`
    - Build: `build_host_tools.bat` (isolated tool-session build →
      `build/dkc1_headless_tools.exe`, `dkc1_desktop_tools.exe`,
      `dkc1_layer_capture.exe`), `build_host.bat` (primary),
      `build_host_noadapt.bat` (no-widescreen-adapter oracle). All embed build
      identity (git commit shown in window title / state sidecars).
    
    ## Where fixes go (never into decompiled/generated code)
    
    1. **Presentation/widescreen bug** → `ws_shadow.c`, `dkc1_game.c`/
       `dkc1_video.c` adapters, or the hosts.
    2. **Recomp-correctness bug** (wrong dispatch, miscompile) →
       `recomp/*.cfg`, regenerate.
    3. To understand intent, use the knowledge sources via
       **`python tools/atlas.py <addr|7Exxxx|name:term>`** — one query joins
       IDA's curated names/descriptions, disassembly+pseudocode listing, the
       live recompiled variant, dispatch contracts, WRAM labels, and
       known-issue mentions. Debug output (verdicts, click reports, trace PCs)
       pastes straight in.
    
    ## Evidence discipline (non-negotiable)
    
    - Detectors/taps are **default-off** (env-gated); arming one must never
      change emulation (A/B hash-identical).
    - Watch **transitions, not dumps**; match actors by **source record
      ($15FD)**, never by mutable pool slot.
    - Routes are **predicate-driven** (`wait`/`pulse` on WRAM), resolved to
      fixed input schedules before differential comparison.
    - A fix is verified only by **3× byte-identical replays** including
      end-of-run framebuffer/audio hashes (`tools/run_regression.py` enforces
      this plus ratcheted integrity budgets).
    - Event flags like `$1595` are consumed same-frame — end-of-frame WRAM
      dumps cannot see them; watch durable effects (state, timers) instead.
    - WRAM semantics: see `tools/atlas.py wram:<addr>`; key addresses are in
      `TOOLS.md`.
    
    ## Typical workflows
    
    **Widescreen bug of ANY kind:** start at
    **`docs/WIDESCREEN_PLAYBOOK.md`** — the symptom-first decision guide:
    five entry points, the eight-rung localization ladder (pixel →
    provenance → layers → policy → stock-vs-wide → reverse_watch →
    atlas/irview/slice → oracle), the verdict/detector → owner table for
    every invariant-monitor verdict, fix-ownership routing incl.
    DKC1_REPLACE, the full verification ladder, and worked examples from
    docs/KNOWN_ISSUES.json.
    
    **"Something looks wrong on screen" (visible host):** click the pixel —
    the panel reports world coord, tile, provenance, last writer, OAM entries,
    nearest actor. F9 exports a repro bundle (rolling inputs + states + memory
    + auto layer-isolation captures). With `DKC1_AUTO_EXPORT=1` +
    `DKC1_FLIGHT_RECORDER=1`, any integrity detector exports automatically and
    appends a post-failure tail.
    
    **Reproduce + diagnose headlessly:** run a recipe with taps armed, e.g.
    `DKC1_WIDESCREEN=1 DKC1_SCRIPT=recipes/route_jungle.dks DKC1_WS_TRACE=t.jsonl
    build\dkc1_headless_tools.exe <rom> 9000`, then the matching analyzer
    (`analyze_ws_trace.py`, `lifecycle_by_source.py`, `analyze_retrodiction.py`…).
    
    **Gate a fix:** `python tools/run_regression.py contracts/jungle-entry.json
    --exe build/dkc1_headless_tools.exe --rom <rom> --json-out
    build/regression/results.json`, then `python tools/make_dashboard.py`.
    Sweep everything: `python tools/level_sweep.py --rom <rom>`.
    
    **Pin a new bug:** add it to `docs/KNOWN_ISSUES.json` with a repro; ratchet
    its detector count in the contract `budgets`; tighten to 0 when fixed.
    
    Full catalog of all 47 tools, every env var, route DSL, and debug keys:
    **`TOOLS.md` in this folder.**
    
    For battery/in-game saves, use `verify_ingame_saves.py` and
    `docs/INGAME_SAVES.md`. Desktop hosts now persist SRAM: isolate their user
    directory (SDL: `DKC1_USER_DIR`; legacy Win32: working directory). Headless
    tests retain explicit SRAM input and never implicitly update a battery file.
    
    For the native iPhone/iPad frontend, read `docs/IOS.md`. `build_ios.sh` builds
    the app; `tools/verify_ios_simulator.py` compares three runs of the existing
    headless runner inside the simulator app against three desktop runs.
    `DKC1_IOS_DIAGNOSTICS` is a default-off build option. Mobile landscape chooses
    a bounded native source width (418 on the connected phone) with fixed SNES
    pixel proportions. Read `docs/IOS.md` for the limited validated scene scope.
    The same default-off diagnostic build supports `--verify-graphics`, reusing
    the native Metal output/cache oracle, plus paused upscale-preview captures.
    See `TOOLS.md` for source-frame inputs, output hashes and UI probe limits.
    
  • .claude/skills/dkc1-tools/TOOLS.md35 KB36eea39a7f49upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • README.mdupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

Plain-text copy, no login: /skill-bundles/elliotttate-dkc1recomp-claude-skills-dkc1-tools.md

// REPO STATS

305 stars
14 open issues
Last commit: 2mo ago