Merge pull request #47 from sonicspiral/tools-starter-windows-terminal

Starter WSL terminal double click to run file
This commit is contained in:
Ethan Roseman 2020-10-01 14:14:09 -04:00 committed by GitHub
commit 750312a87c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 27 additions and 1 deletions

View File

@ -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,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

View File

@ -0,0 +1,3 @@
REM first set your default distro using: wsl --set-default <Distro>
ehco "first set your default distro using: wsl --set-default <Distro>"
wt --title "diff.py" -d "../" ; split-pane -d "../" -V ; new-tab --title "mips_to_c.py" -d "../" ; focus-tab -t 0