Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/jamchamb/ac-mod-template

Template for Animal Crossing ACE injected mods
https://github.com/jamchamb/ac-mod-template

animal-crossing modding-games

Last synced: about 2 months ago
JSON representation

Template for Animal Crossing ACE injected mods

Awesome Lists containing this project

README

        

# Animal Crossing Mod Patch Template

This is a template for Animal Crossing mod patches written in C.
Some example mods can be found in the [ac-mods](https://github.com/jamchamb/ac-mods) repo.

This requires the devkitPro tools to build.
See for how to install `devkitpro` and `gamecube-dev`.

## Building

With `gamecube-dev` installed, just run `make`. The output will include a `.patch` file that holds the generated code to patch in.

### Generating the GameCube save file

[`ac-nesrom-gen`](https://github.com/jamchamb/ac-nesrom-save-generator)
can automatically create a GCI file for the mod patches by reading the
`gci_build.yaml` config file. If installed, the GCI file will be generated
when running `make`.

Alternatively, use this command:

```console
$ ac-nesrom-gen --autoheader 80002000 "Mod Name" input.patch output.gci
```

Import the GCI save file to a memory card and use the generic NES Console
item to load the mod.

## Development

### Specifying patch location

Set the start address for the patch in `linker.ld` just before
the `.text` section.

Note that `*(.text.__entry);` must always be the first entry in the `.text`
section of the linker script.

### Calling Animal Crossing functions

Here are a couple of ways to call a function that already exists in
Animal Crossing:

#### Use function pointers

Define the function like this, using its address as the pointer value:

```c
void (*OSReport)(char*, ...) = (void*) 0x8005A750;
```

#### Use the linker script

This uses fewer instructions, resulting in a smaller patch size.

1. Define the function like this:

```
extern void OSReport(char*, ...);
```
2. Define its location in `linker.ld`:

```
SECTIONS
{
. = 0x80002000;
.text . : {
...
}
...
OSReport = 0x8005A750;
}
```