Skip to content

About

Super Mario Kart for the Super Nintendo using snesrecomp

Resources

Stars

2 stars

Watchers

0 watching

Forks

Repository files navigation

SuperMarioKartRecomp

Build Status Platform Language License

Native C static recompilation of Super Mario Kart (SNES, USA) into standalone, native PC executable using the snesrecomp framework.


What "static recompilation" means here

The 65816 CPU assembly code from the original ROM is statically translated to pure native C — every function the game executes on the main SNES CPU is compiled as real C translation units located in src/game/.

The rest of the SNES is not recompiled — it is hardware:

  • PPU (Picture Processing Unit), Mode 7 matrix transforms, HDMA raster effects, and sprite rendering run through an optimized C hardware implementation in snesrecomp/runner/src/snes/.
  • APU (Audio Processing Unit) and the SPC700 audio coprocessor run asynchronously with native sample resampling and anti-starvation buffers.
  • DSP-1 Coprocessor uses firmware-free high-level emulation (HLE) to execute perspective projection and trigonometric track matrix operations.

This follows the established architecture of modern static recompilation projects: recompile the CPU, emulate the silicon.


Current Status & Features

  • Native recomp-ui Launcher: Integrated graphical launcher with Game, Controls, Video, and Audio tabs, responsive UI, and persistent configuration.
  • Fully Playable: Tested and verified end-to-end across Grand Prix cups and Battle mode.
  • Native 60 FPS: Exact 60.0988 Hz hardware pacing using sub-millisecond precision accumulators.
  • Mode 7 Split-Screen Graphics: Full resolution Mode 7 rendering with hardware raster interrupt at scanline 112 (upper 3D cockpit perspective, lower 2D aerial course map).
  • DSP-1 Mathematical Coprocessor: Integrated HLE for high-performance track projection and coordinate transformations.
  • Controller Support & Hotplugging: Full plug-and-play support for Xbox, PlayStation, Switch Pro, and standard USB/Bluetooth gamepads via SDL2 GameController.
  • Independent 2-Player Controls: Complete simultaneous keyboard mapping (WASD + Arrow Keys for P1, Numpad for P2), multi-gamepad routing, independent deadzones, and keybinds.ini persistence.
  • Strict ROM Verification: Automatic SHA-256 and CRC32 identity verification with support for both raw headerless (.sfc) and 512-byte headered (.smc) ROMs.
  • Ultra-Low Latency Audio: Dedicated background audio pull callback at 44.1 kHz with APU mutex synchronization.

Quick Start (ROM Requirement)

Important

Legal Notice: This repository does NOT contain any copyrighted ROM data, game assets, or proprietary Nintendo code. You must provide your own legally obtained ROM dump to run the game.

Verified ROM Information

  • Game: Super Mario Kart (USA)
  • File Name: Super Mario Kart (USA).sfc
  • File Size: 524,288 bytes (Headerless .sfc) or 524,800 bytes (512-byte headered .smc)
  • SHA-256: 2ada8919688087be60a6a48cace8f877add60c45d2e5d09e2442faa55be62a49
  • CRC32: CD80DB86 (Standard IEEE 802.3; legacy documentation occasionally referenced C7880A64, both are accepted)

Place your ROM in the game root folder or use the launcher's Browse button. Both .sfc and copier-headered .smc files are automatically verified.


Graphical Launcher & Options

Double-clicking SuperMarioKartRecomp.exe presents the native configuration launcher:

  • Game Tab: ROM status indicator, game details, and the Play button.
  • Controls Tab: Independent input device selection (Keyboard or specific Gamepad) for Player 1 and Player 2, deadzone calibration, and keyboard mapping hints.
  • Video Tab:
    • Aspect Ratio: 4:3 (CRT TV), 8:7 (Square Pixels), or 1:1 (Square Frame).
    • Window Scale: 1x through 6x resolution multiplier.
    • Display: Fullscreen toggle and bilinear filtering option.
  • Audio Tab: Master volume slider and sound output toggling.
  • Skip Launcher: Check this box to boot directly into the game on future launches. You can always reopen the launcher with the --launcher command-line switch.

Controls

Player 1 (Keyboard & Gamepad)

Action Keyboard Xbox Gamepad PS Gamepad SNES Original
Steer / Menu Navigation W / A / S / D or Arrow Keys D-Pad / Left Stick D-Pad / Left Stick D-Pad
Accelerate / Confirm J or Space A Button Cross (X) B Button
Use Item / Cancel K B Button Circle (O) A Button
Hop / Drift U X Button Square Y Button
Rearview Mirror I Y Button Triangle X Button
Hop / Drift (Shoulder) Q / E LB / RB / Triggers L1 / R1 / Triggers L / R Buttons
Start / Pause Enter Start Options START
Select Tab Back Share SELECT
Toggle Fullscreen F11 or Alt+Enter - - -
Quit Game Esc - - -

Player 2 (Numpad)

  • Steer: Numpad 8 / 2 / 4 / 6
  • Accelerate (B): Numpad 1 or Numpad 0
  • Item (A): Numpad 3
  • Hop / Drift (Y): Numpad 7
  • Rearview (X): Numpad 9
  • Start: Numpad Enter
  • Select: Numpad +

Tip

Single Player (1P GAME) Tip: On the title screen, press Space or Enter to open the main menu. The menu cursor defaults to 2P GAME. Press W or Up Arrow to move the cursor to 1P GAME, then press Space or Enter to begin your single-player Grand Prix!


Building from Source

Prerequisites

  • CMake (>= 3.20)
  • C Compiler: GCC (MinGW-w64 on Windows), Clang, or MSVC
  • Build System: Ninja (recommended) or Make
  • SDL2: Development library (SDL2-devel)

Windows (Ninja + GCC / Clang)

# Clone the repository
git clone https://github.com/Zaxaerith/SuperMarioKartRecomp.git
cd SuperMarioKartRecomp

# Configure and build using Ninja
mkdir build
cd build
cmake .. -G "Ninja" -DCMAKE_BUILD_TYPE=Release
ninja smk_play

# Run the game (with native launcher GUI)
./SuperMarioKartRecomp.exe

Or simply run the automated build script:

./build.ps1

Linux (Ubuntu / Debian / Fedora / Arch)

# Install dependencies (Ubuntu/Debian)
sudo apt update && sudo apt install -y build-essential cmake ninja-build libsdl2-dev

# Build
mkdir build && cd build
cmake .. -G "Ninja" -DCMAKE_BUILD_TYPE=Release
ninja smk_play

# Run
./SuperMarioKartRecomp

Repository Structure

SuperMarioKartRecomp/
├── CMakeLists.txt              # Unified CMake build configuration with recomp-ui
├── README.md                   # Project documentation & guide (English)
├── README.zh-CN.md             # Project documentation & guide (Chinese)
├── LICENSE                     # PolyForm Noncommercial License 1.0.0
├── config.ini                  # General, video, audio & controller configuration
├── keybinds.ini                # Player 1 & Player 2 independent keyboard bindings
├── rom_identity.txt            # Verified ROM identification manifest
├── build.ps1 / build.sh        # Quick build helpers
├── config/                     # Recompiler function symbols & configuration
├── recomp-ui/                  # Native graphical launcher submodule
├── src/
│   ├── desktop.c               # Interactive SDL2 desktop runner & launcher lifecycle
│   ├── game_rtl.c              # Game runtime bridge (PPU rendering & scanline sync)
│   ├── headless.c             # Diagnostic headless benchmark runner
│   └── game/                   # Recompiled native C source code (by function)
│       ├── bank00_system_core.c       # Reset vector, NMI, IRQ & Core Engine
│       ├── bank01_kart_physics.c      # Kart physics, steering & race state
│       ├── bank04_audio_loader.c      # APU sound driver & music sequence loader
│       ├── bank05_title_menu.c        # Title screen, menu selection & Mode 7 demo
│       ├── bank80_raster_loop.c       # Main game loop, split-screen raster IRQ & DMA
│       ├── bank81_items_ai.c          # Items, weapons & driver AI logic
│       ├── bank83_dsp1_math.c         # DSP-1 coprocessor interface & 3D projection
│       ├── bank84_track_decompress.c  # Track data, tilemap & graphics decompressor
│       ├── bank85_effects_ending.c    # Awards ceremony, ending & special effects
│       ├── recomp_dispatch.c          # LLE/AOT function jump dispatch table
│       ├── unresolved_stubs.c         # Unresolved stubs fallback handler
│       └── program_manifest.json      # Complete recompiler code manifest
├── snesrecomp/                 # SNESRecomp core LLE execution framework
├── tests/
│   └── launcher_contract.c     # Launcher verification and contract tests
└── tools/                      # Validation, regression and profiling scripts

License

This project is a recompiled derivative work based on snesrecomp and is licensed under the PolyForm Noncommercial License 1.0.0.

  • Source-Available / Noncommercial: Any noncommercial purpose (personal use, personal study, research, private entertainment, non-profit community testing) is permitted.
  • Commercial Use Prohibited: Commercial use, monetized distribution, or deriving profit from this software is strictly prohibited under the upstream license terms.
  • Upstream Copyright: Copyright (c) 2026 Matthew Stanley.
  • For the full legal text, see the LICENSE file.

Credits & Acknowledgments

  • Zaxaerith: Project porting, recompilation integration, timing synchronization, and host runtime.
  • Nintendo: Original creators of Super Mario Kart (1992).
  • mstan: Author of the snesrecomp framework and pioneer of SNES static recompilation.
  • LakeSnes & snes9x: Foundation for embedded SNES silicon emulation.
  • All contributors to the Super Mario Kart reverse engineering and recompilation efforts.

About

Super Mario Kart for the Super Nintendo using snesrecomp

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages