mirror of
https://github.com/pmret/papermario.git
synced 2024-11-08 12:02:30 +01:00
updated mipstoc guidnace for local use
This commit is contained in:
parent
ab48495419
commit
4949824769
28
README.md
28
README.md
@ -8,7 +8,7 @@ Discord: [Paper Mario Modding](https://discord.gg/urUm3VG)
|
||||
|
||||
## Setup
|
||||
|
||||
You'll need Linux, a Linux VM, or Windows 10 (WSL) to work on this project.
|
||||
You'll need Linux, a Linux VM, or Windows 10 (WSL) to work on this project. For WSL, we've included `windows_termainl.bat` under tools that you can use to quickly spin up a terminal for your default distro set using `wsl --set-default <Distro>`.
|
||||
|
||||
#### Clone the repository
|
||||
|
||||
@ -76,16 +76,32 @@ Decide on a function to match. These can be found in the subdirectories of `asm/
|
||||
|
||||
Take the relevant `.s` file and pass it to [mips_to_c](https://github.com/matt-kempster/mips_to_c) ([web version](https://simonsoftware.se/other/mips_to_c.py)).
|
||||
|
||||
You can also use mips_to_c locally by registering `mips_to_c.py` as a global command in your bash PATH:
|
||||
You can also use mips_to_c locally installed to a destination of your choice. Then register a function in `~/.bashrc` that calls `path/to/mips_to_c.py (with args)`:
|
||||
```
|
||||
sudo apt update
|
||||
sudo apt install python3-pip
|
||||
sudo git clone https://github.com/matt-kempster/mips_to_c.git /usr/local/bin/mips_to_c
|
||||
sudo git clone https://github.com/matt-kempster/mips_to_c.git path/to/mips_to_c
|
||||
```
|
||||
|
||||
Then add `PATH="$PATH:/usr/local/bin/mips_to_c"` to the end of your `~/.bashrc` file.
|
||||
You should be able to run `mips_to_c.py` now for any file in `asm/nonmatchings/`. Here's an example `mips_to_c.py ./asm/nonmatchings/code_13870_len_6980/func_8003B3D0.s func_8003B3D0`.
|
||||
`.
|
||||
Here's a starter function you can use:
|
||||
```sh
|
||||
# don't forget to replace /path/to/mips_to_c with you're path
|
||||
function mipstoc() {
|
||||
if [ "$#" -eq 2 ]; then
|
||||
echo "running mips_to_c on file $1 for func $2";
|
||||
/path/to/mips_to_c/mips_to_c.py $1 $2;
|
||||
elif [ "$#" -gt 2 ]; then
|
||||
echo "running mips_to_c on file $1 for func $2 with flags";
|
||||
/path/to/mips_to_c/mips_to_c.py $@;
|
||||
else
|
||||
printf "Please call mipstoc using this format and make sure you're at the repo root:";
|
||||
printf "\nmipstoc\t\033[0;31marg1 - the nonmatching asm file\033[0m \t\t\t\033[0;34marg2 - the target function\033[0m \033[0;33margN - any of the optional mips_to_c.py flags\033[0m";
|
||||
printf "\nmipstoc \033[0;31m./asm/nonmatchings/code_13870_len_6980/func_8003B3D0.s\033[0m \t\033[0;34mfunc_8003B3D0\033[0m \033[0;33m--flag1 --flag2 --flag3\033[0m\n";
|
||||
/path/to/mips_to_c/mips_to_c.py;
|
||||
fi
|
||||
}
|
||||
export -f mipstoc
|
||||
```
|
||||
|
||||
If mips_to_c gives you an error about branch-likely instructions, edit the `.s` file and rename any branch-likely instructions to their unlikely equivalent (i.e. remove the `l` suffix). Add a `nop` after the branches and move the instruction that was originally in the delay slot (directly after the branch instruction) to the start of the target label. Don't commit the edited assembly.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user