sm64tools

repository·master·Indexed 41 days ago

https://github.com/queueram/sm64tools

A suite of utilities for modifying Super Mario 64 ROMs. Includes n64split for splitting ROMs into assets, sm64extend for extending ROMs and decompressing MIO0 blocks, and sm64compress for ROM alignment and compression. The toolkit also provides utilities for applying assembly patches, swapping textures, and specialized tools like f3d, n64cksum, and n64graphics.

Tokens
2K
Snippets
10
Records
11
Agent score
2%

What's inside sm64tools

  1. List of other SM64 hacking tools

    master

    The sm64tools repository includes several specialized utility tools:

    • f3d: Decodes Fast3D display lists.
    • mio0: Standalone MIO0 compressor/decompressor.
    • n64cksum: Standalone N64 checksum generator (supports in-place or new file output).
    • n64graphics: Converts PNG files into RGBA or IA N64 graphics data.
    • mipsdisasm: Standalone recursive MIPS disassembler.
    • sm64geo: Standalone SM64 geometry layout decoder.
  2. Skip startup and intro screens

    master

    To skip various screens (Title, Mario, Menu, Peach, and Lakitu intros), apply the following sequence of patches using patch -p0:

    1. patch -p0 < skip_mario.patch
    2. patch -p0 < skip_title.patch
    3. patch -p0 < skip_menu.patch
    4. patch -p0 < skip_peach.patch
    5. patch -p0 < skip_lakitu.patch
    patch -p0 < skip_mario.patch
    patch -p0 < skip_title.patch
    patch -p0 < skip_menu.patch
    patch -p0 < skip_peach.patch
    patch -p0 < skip_lakitu.patch
  3. Swap textures in a split ROM

    master

    Texture swapping is performed by copying specific image files into the sm64.split/textures/ directory. Supported formats include RGBA, IA8, and .skybox files.

    Examples:

    • Castle grounds: Copy texture_swap/castle_grounds_textures.0x01000.png to sm64.split/textures/.
    • Peach's signature (IA8): Copy texture_swap/castle_grounds_segment7.0x0EAE8.ia8.png to sm64.split/textures/.
    • Transition (IA8): Copy texture_swap/font_graphics.0x122B8.ia8.png to sm64.split/textures/.
    • Skybox: Copy texture_swap/water_skybox.0x00000.skybox.png to sm64.split/textures/.
    copy texture_swap/castle_grounds_textures.0x01000.png to sm64.split/textures/
  4. Apply assembly patches using patch

    master

    To apply assembly source modifications (such as hooking behaviors, overriding functions, or modifying game logic), use the patch command with the -p0 flag. This is used for examples like 'Hello World', 'HUD toggle', 'Behavior' (rotating sign posts), and 'Skip Screens'.

    patch -p0 < <patch_file.patch
  5. Modify coin colors and vertex colors

    master

    To change coin colors and textures, you must perform two steps:

    1. Copy the PNG files from the coin_colors/ directory to sm64.split/textures/.
    2. Apply the coin_colors.ips IPS patch to the binary file located at sm64.split/bin/doors_trees_coins.bin.
    copy the png files from coin_colors/ to sm64.split/textures/
    apply coin_colors.ips IPS patch to sm64.split/bin/doors_trees_coins.bin
  6. Reference n64split CLI options

    master

    The following options are available for the n64split command:

    • -c CONFIG: ROM configuration file (default: auto-detect)
    • -k: keep going as much as possible after error
    • -m: merge related instructions into pseudoinstructions
    • -o OUTPUT_DIR: output directory (default: {CONFIG.basename}.split)
    • -s SCALE: amount to scale models by (default: 1024.0)
    • -t: generate large texture for MIO0 blocks
    • -v: verbose output
    • -V: print version information
    Options:
     - -c CONFIG ROM configuration file (default: auto-detect)
     - -k keep going as much as possible after error
     - -m merge related instructions in to pseudoinstructions
     - -o OUTPUT_DIR output directory (default: {CONFIG.basename}.split)
     - -s SCALE amount to scale models by (default: 1024.0)
     - -t generate large texture for MIO0 blocks
     - -v verbose output
     - -V print version information
  7. Reference sm64extend CLI options

    master

    The following options are available for the sm64extend command:

    • -a ALIGNMENT: Byte boundary to align MIO0 blocks (default: 1).
    • -p PADDING: Padding to insert between MIO0 blocks in KB (default: 32).
    • -s SIZE: Size of the extended ROM in MB (default: 64).
    • -d: Dump MIO0 blocks to files in a mio0 directory.
    • -f: Fill old MIO0 blocks with 0x01.
    • -v: verbose output.

    Examples

    Create a 64 MB extended ROM (bit compatible with M64ROMExtender1.3b):

    sm64extend sm64.z64

    Create a 24 MB extended ROM:

    sm64extend -s 24 sm64.z64

    Enable verbose output and specify a custom output filename:

    sm64extend -v sm64.z64 sm64_output.ext.z64

    Pad 64 KB between blocks, align to 16-byte boundaries, and fill old MIO0 blocks with 0x01:

    sm64extend -p 64 -a 16 -f sm64.z64
    sm64extend [-a ALIGNMENT] [-p PADDING] [-s SIZE] [-d] [-f] [-v] FILE [OUT_FILE]
    
    Options:
     - -a ALIGNMENT Byte boundary to align MIO0 blocks (default = 1).
     - -p PADDING Padding to insert between MIO0 blocks in KB (default = 32).
     - -s SIZE Size of the extended ROM in MB (default: 64).
     - -d Dump MIO0 blocks to files in mio0 directory.
     - -f Fill old MIO0 blocks with 0x01.
     - -v verbose output.
  8. Reference sm64compress CLI options

    master

    The following options are available for the sm64compress command:

    • -a ALIGNMENT: Byte boundary to align MIO0 blocks (default: 16).
    • -c: Compress all blocks using MIO0.
    • -d: Dump MIO0 blocks to files in a mio0 directory.
    • -v: verbose output.
    Options:
     - -a alignment Byte boundary to align MIO0 blocks (default = 16).
     - -c compress all blocks using MIO0.
     - -d dump MIO0 blocks to files in mio0 directory.
     - -v verbose output.
  9. Use sm64compress to pack and compress ROM MIO0 blocks

    master

    sm64compress is an experimental tool for ROM alignment and compression. It packs all MIO0 blocks together to reduce unused space and can optionally compress them (which converts 0x17 commands to 0x18). It reduces the output ROM size to a 4 MB boundary and updates assembly references and checksums.

    If no output file is specified, the output is named by replacing the input extension with .out.z64.

    CLI Usage

    sm64compress [-a ALIGNMENT] [-c] [-d] [-v] FILE [OUT_FILE]
  10. Use n64split to split ROMs into assets

    master

    n64split is an N64 ROM Splitter and Build System that acts as an intelligent recursive disassembler. It splits a ROM into various assets including asm, textures, models, levels, and behavior data, and generates build files required to rebuild the ROM. It uses a generic configuration file system to support multiple games.

    CLI Usage

    n64split [-c CONFIG] [-k] [-m] [-o OUTPUT_DIR] [-s SCALE] [-t] [-v] [-V] ROM
  11. Use sm64extend to extend Super Mario 64 ROMs

    master

    sm64extend is a ROM extender that accepts Z64 (BE), V64 (byte-swapped), or N64 (little-endian) ROMs. It works with US, European, Japanese, and Shindou ROMs.

    Key features include:

    • Decompressing all MIO0 blocks to an extended area.
    • Changing all 0x18 level commands to 0x17 and creating MIO0 headers for 0x1A level commands.
    • Updating assembly references to MIO0 blocks and recalculating ROM header checksums.
    • Configurable extended ROM size, padding, and alignment.

    If no output file is specified, the output is named by replacing the input extension with .ext.z64.

    CLI Usage

    sm64extend [-a ALIGNMENT] [-p PADDING] [-s SIZE] [-d] [-f] [-v] FILE [OUT_FILE]