diff --git a/README.md b/README.md index f148ad9d22..f1aa3786ce 100644 --- a/README.md +++ b/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 `. #### Clone the repository @@ -76,6 +76,29 @@ 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 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 path/to/mips_to_c +``` + +Here's a starter function you can use: +```sh +# don't forget to replace /path/to/mips_to_c with your path +function mipstoc() { + if [ "$#" -gt 1 ]; then + /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 \033[0;31marg1 - the nonmatching asm file\033[0m \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 \033[0;34mfunc_8003B3D0\033[0m \033[0;33m--flag1 --flag2 --flagN\033[0m\n"; + /path/to/mips_to_c/mips_to_c.py; + fi +} +export -f mipstoc +``` + Open up the relevant `.c` file and replace the function's `INCLUDE_ASM` macro with the output from mips_to_c. Run the following command to attempt to compile, replacing `function_name` with the name of the function you're working with: ```sh diff --git a/tools/windows_terminal.bat b/tools/windows_terminal.bat new file mode 100644 index 0000000000..9dd5cda1cc --- /dev/null +++ b/tools/windows_terminal.bat @@ -0,0 +1,3 @@ +REM first set your default distro using: wsl --set-default +ehco "first set your default distro using: wsl --set-default " +wt --title "diff.py" -d "../" ; split-pane -d "../" -V ; new-tab --title "mips_to_c.py" -d "../" ; focus-tab -t 0