Skip to main content

sm64-binds

Mario 64 binds for Python.

This is the Python version of sm64-binds

To avoid shipping copyrighted ROM data, the WASM module is distributed XOR'd against a US .z64 ROM and recombined at runtime. The ROM is required: a US z64 copy, exactly 8.00 MB.

Install

pip install sm64-binds

Usage

from sm64_binds import GamePad, SM64GameGenerator, buttons

generator = SM64GameGenerator.from_file("baserom.us.z64")
game = generator.create_game()

game.step_game(GamePad(buttons.A_BUTTON, 0, 0))

state = game.get_game_state()
print(state)              # position, level, lives, coins, health, ...
print(state.numStars)

SM64GameGenerator validates the ROM's SHA-1, recombines the payload and compiles the WASM module once. Reuse it: create_game is then cheap.

Cloning a game

Copy an instance to branch off the same state without replaying:

clone = generator.copy(game)

# ... play the clone differently ...
generator.copy_to(game, clone)   # reuse an existing instance instead

A copy captures the two mutable regions of linear memory — the emscripten stack and everything after the game's constant data (generator.read_only, read from the WASM) — so a copied game continues exactly where its source was.

Randomised input

rng_pad returns what the game actually received after RNG, which is what a replay has to match:

from sm64_binds import RngConfig, GamePad

game.set_rng_config(RngConfig(100, 5, 2, 0.5, 0.5, 0.2))
game.set_rng_seed(22)

pad = game.rng_pad(GamePad())

Note the WASM RNG is active from boot with those defaults, even before you call set_rng_config. Passing a zeroed RngConfig makes rng_pad a passthrough.

API

Export Purpose
SM64GameGenerator Validates a ROM, compiles the module, creates games.
SM64Game step_game, get_game_state, rng_pad, set_rng_config, set_rng_seed.
GamePad button, stick_x, stick_y.
GameState numStars, pos, vel, lakituPos, levelNum, lives, coins, health, ...
RngConfig RNG tuning; RngConfig.default().
buttons N64 button masks (A_BUTTON, START_BUTTON, U_JPAD, ...).

Licence

MIT. The game itself is © Nintendo; this package contains no ROM or game data.

Metadata

Release files for sm64-binds 2.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sm64-binds 2.0.0
File Size Uploaded Provenance Actions
sm64_binds-2.0.0.tar.gz 5.9 MB With provenance Details for sm64_binds-2.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for sm64-binds 2.0.0
File Interpreter ABI Platform Actions
sm64_binds-2.0.0-py3-none-any.whl Python 3 none any Details for sm64_binds-2.0.0-py3-none-any.whl

Total release size: 11.7 MB

Release files / sm64_binds-2.0.0.tar.gz

Download URL sm64_binds-2.0.0.tar.gz
Size 5.9 MB
Tags Source
SHA-256 checksum
How to use checksums
a6f96c64c438fd11fc94fda5be4d299645244a2137db9cff9f51d222c25c939d
BLAKE2b-256 checksum
How to use checksums
745bebe4095d6625f43c9e2ca4915f8e33e66a39be6b213a4a7062585e3d0da6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 22, 2026.

Transparency log

Release files / sm64_binds-2.0.0-py3-none-any.whl

Download URL sm64_binds-2.0.0-py3-none-any.whl
Size 5.9 MB
Tags Python 3
SHA-256 checksum
How to use checksums
ea8de1a3f7031d63e78fc03689814cd8730092b13155ce00fe2aff787e5b0896
BLAKE2b-256 checksum
How to use checksums
5756ce3b1c6e90832ec024dd5a82bc64b3a3740e18fb90fde65d230e408217db
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 22, 2026.

Transparency log

Security for sm64-binds 2.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for sm64_binds-2.0.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 22, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page