Giter Club home page Giter Club logo

sm64tools's Introduction

sm64tools

Collection of tools for manipulating the Super Mario 64 ROM

n64split

N64 ROM Splitter and Build System

  • splits ROM into assets: asm, textures, models, levels, behavior data
  • generates build files to rebuild the ROM
  • intelligent recursive disassembler
  • generic config file system to support multiple games

Usage

n64split [-c CONFIG] [-k] [-m] [-o OUTPUT_DIR] [-s SCALE] [-t] [-v] [-V] ROM

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

sm64extend

Super Mario 64 ROM Extender

  • accepts Z64 (BE), V64 (byte-swapped), or N64 (little-endian) ROMs as input
  • works with US, European, Japanese, and Shindou ROMs
  • decompresses all MIO0 blocks from ROM to extended area
  • configurable extended ROM size (default 64 MB)
  • configurable padding between MIO0 blocks (default 32 KB)
  • configurable MIO0 block alignment (default 1 byte)
  • changes all 0x18 level commands to 0x17
  • creates MIO0 headers for all 0x1A level commands
  • optionally fills old MIO0 blocks with 0x01
  • optionally dump compressed and uncompressed MIO0 data to files
  • updates assembly reference to MIO0 blocks
  • recalculates ROM header checksums

Usage

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.

Output file: If unspecified, it is constructed by replacing input file extension with .ext.z64

Examples

64 MB extended ROM that is bit compatible with with generated from the M64ROMExtender1.3b, after extending to 64 MB

sm64extend sm64.z64

24 MB extended ROM that is bit compatible with the ROM generated from the M64ROMExtender1.3b

sm64extend -s 24 sm64.z64

Enable verbose messages and specify output filename:

sm64extend -v sm64.z64 sm64_output.ext.z64

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

sm64extend -p 64 -a 16 -f sm64.z64

sm64compress

Experimental Super Mario 64 ROM alignment and compression tool

  • packs all MIO0 blocks together, reducing unused space
  • optionally compresses MIO0 blocks (and converts 0x17 commands to 0x18)
  • configurable MIO0 block alignment (default 16 byte)
  • reduces output ROM size to 4 MB boundary
  • updates assembly reference to MIO0 blocks
  • recalculates ROM header checksums

Usage

sm64compress [-a ALIGNMENT] [-c] [-d] [-v] FILE [OUT_FILE]

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.

Output file: If unspecified, it is constructed by replacing input file extension with .out.z64

Other Tools

There are many other smaller tools included to help with SM64 hacking. They are:

  • f3d: tool to decode Fast3D display lists
  • mio0: standalone MIO0 compressor/decompressor
  • n64cksum: standalone N64 checksum generator. can either do in place or output to a new file
  • n64graphics: converts graphics data from PNG files into RGBA or IA N64 graphics data
  • mipsdisasm: standalone recursive MIPS disassembler
  • sm64geo: standalone SM64 geometry layout decoder

License

MIT License. Copyright 2015 queueRAM.

sm64tools's People

Contributors

mib-f8sm9c avatar queueram avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sm64tools's Issues

n64split: Support memory overlays

Creating this issue to track support for memory overlays.

Mario Party makes use of overlays. There is a core portion of assembly that persists in RAM for the entire runtime, and an overlay region where different overlays are swapped in depending on the current game scene.

I created a marioparty.u.yaml that attempted to represent this game. All overlays are assembled assuming they are copied to 0x800F65E0, so that is what I had placed for each asm entry in the yaml.

The problem is that all the symbols for all overlays get mixed together. Overlays should have isolation of symbols, such that one overlay cannot see another. However, they do need to see the core code, as they often call into that.

Crashes sm64 compressor when i compress the extended ROM

Simply, i used the extender and it made an 64MB ROM file.
I've tried compressing it directly without changing anything in the ROM and it crashes after the "count : 135" output.
No arguments are used in both extender and compressor.

Missing sfx library in CMakeLists.txt

I noticed that n64split does not compile properly when using CMake on Linux. libsfx needs to be compiled. This diff fixes it.

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2c0e6fe..154e517 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -17,6 +17,7 @@ include_directories("${PROJECT_SOURCE_DIR}/external/include")
 link_directories("${PROJECT_SOURCE_DIR}/external/lib")
 
 add_library(sm64 STATIC libmio0.c libsm64.c utils.c)
+add_library(sfx STATIC libsfx.c utils.c strutils.c)
 
 add_executable(sm64extend sm64extend.c)
 target_link_libraries(sm64extend sm64)
@@ -49,5 +50,5 @@ set_target_properties(n64graphics PROPERTIES COMPILE_DEFINITIONS "N64GRAPHICS_ST
 target_link_libraries(n64graphics png z)
 
 add_executable(n64split blast.c mipsdisasm.c n64split.c n64graphics.c strutils.c yamlconfig.c)
-target_link_libraries(n64split sm64 capstone yaml z)
+target_link_libraries(n64split sm64 sfx capstone yaml z)

n64split: D_* symbols into rodata broken by default

Related to #7, as a workaround, I created a Mario Party config that just specified a single overlay, leaving the rest as plain bin sections. The thought was this would get a good disassembly of the core and a single overlay, which is plenty to start with.

I've been making each overlay two sections, asm and bin, as shown below, thinking that bin was the closest thing that represents rodata.

- [0x2418A0, 0x244B50, "asm", "overlay54_main", 0x800F65E0]
- [0x244B50, 0x2455C0, "bin", "overlay54_rodata"]

n64split generates symbols starting with D_ in the asm that point into the rodata. However, these symbols are never defined, because the rodata is just a binary file, and make results in many errors.

I made a change to say that the overlay is just entirely asm, so that the disassembler would pass over the rodata.

- [0x2418A0, 0x2455C0, "asm", "overlay54_mainandrodata", 0x800F65E0]

The result is much closer to compiling, since the data becomes garbage instructions in the .s file, and those do get symbols. However, some of the instructions are not supported by the architecture (make still fails), and generally, this doesn't really get me much closer to having a working assembly; I'd have to totally rework the data portion still.

All that said, should there be a rodata section in yaml that would instruct n64split to generate something with data + symbols (using writes)? It seems it could really make the ROM rebuildable without any manual changes if this was implemented.

Or am I doing something wrong in my current config setup?

Problem repacking

Hi, thanks for your work!
Even if I unpack cean 8MB USA z64, repacking in windows 10 with binutils-2.25, I obtain a no working 12MB rom :(
Thank you for help

Code before entrypoint

N64Split seems to be unable to disassemble code before the entrypoint of the game. Many games place Main function before the entrypoint, whic makes full disassembly impossible. Is there a way to fix this issue?

n64split: section overlap region 12 (6120 > 6048)

When running n64split on the Shindou and European versions of SM64, I get the error mentioned in the title. I'm not sure how to trace it back to specific lines in the config file though. The U and J versions are fine.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.