https://github.com/bates64/star-rod-c
Compile C code for Paper Mario mods
https://github.com/bates64/star-rod-c
paper-mario-64
Last synced: 8 months ago
JSON representation
Compile C code for Paper Mario mods
- Host: GitHub
- URL: https://github.com/bates64/star-rod-c
- Owner: bates64
- Created: 2020-08-18T21:48:49.000Z (almost 6 years ago)
- Default Branch: main
- Last Pushed: 2022-04-21T15:17:26.000Z (about 4 years ago)
- Last Synced: 2025-07-19T16:06:04.051Z (11 months ago)
- Topics: paper-mario-64
- Language: Python
- Homepage:
- Size: 24.4 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Star Rod C
Star Rod C is a tool that lets you compile C code to patch files using tools and headers from the [Paper Mario decompilation](https://github.com/ethteck/papermario). [Star Rod](https://github.com/nanaian/star-rod) is used as the assembler and linker.
Supported platforms include [anything the decompilation compiles on](https://github.com/pmret/papermario/blob/master/install.sh). This includes a number of Linux distros, macOS, and WSL2.
### Installation
You'll need:
* A [Star Rod](https://github.com/nanaian/star-rod) mod folder
* git
`cd` to your mod folder and run the following commands:
```sh
$ git init
$ git submodule add https://github.com/nanaian/star-rod-c.git
$ git submodule add https://github.com/pmret/papermario.git
$ make -C star-rod-c setup
```
### Usage
Create a `globals/patch/foo.c` file in your mod folder:
```c
#include "common.h"
ApiStatus ExampleFunction(ScriptInstance* script, s32 isInitialCall) {
// Increment *Var[0] by 10
script->varTable[0] += 10;
return ApiStatus_DONE2;
}
```
Run Star Rod C: `make -C star-rod-c`
This should produce a `globals/patch/foo.patch` file. All functions are `#export`ed unless their name begins with `_`.
You can then use the global patch as usual, in any script. For example:
```starrod
% kmr_20.mpat
#new:Script {
Set *Var[0] 5
Call $ExampleFunction ()
% *Var[0] == 15`
Return
End
}
```
Running `make -C star-rod-c` will compile all `globals/patch/*.c` files to a `*.patch` file in the same directory. `make` won't recompile files that haven't been modified since the last time it was run.
### Known issues
* You may not name a function `main`.