Intended as a simple introduction to writing C hax using the FE8U decompilation.
Installing WSL:
- Open powershell and
wsl --install
- Restart computer when ready
- A console window opens and you can set your username and password
Navigate to the folder you will be putting the repository in:
cd /mnt/c/
(replace with /mnt/d/ or whatever drive letter you want)- You are now in your C:\ drive -
cd path/to/your/folder
(use forward slashes not backslashes) - MAKE SURE THERE ARE NO SPACES IN THE PATH
Clone the Simple_C_HAX repository:
git clone --recursive https://github.com/boviex/Simple_C_HAX.git Simple_C_HAX
Install devkitpro for WSL:
sudo apt update
sudo apt install gdebi-core
- open a command prompt in windows and
echo %PROCESSOR_ARCHITECTURE%
to see if you have amd64 - ASSUMING YOU HAVE AMD64 SYSTEM:
wget https://github.com/devkitPro/pacman/releases/download/v1.0.2/devkitpro-pacman.amd64.deb
sudo gdebi devkitpro-pacman.amd64.deb
sudo dkp-pacman -S gba-dev
- Press Enter at the prompt:
Enter a selection (default=all):
- Enter Y at the prompt:
Proceed with installation?
logout
and then open WSL using "OpenTerminal.bat" (this should open WSL with the correct folder already but if not, usecd
to navigate to the Simple_C_HAX folder)
install python3 and pip packages for WSL:
sudo apt install python3 python3-pip python-is-python3
logout
and then run OpenTerminal.batpip install pyinstaller
pip install tmx
build EventAssembler:
sudo apt install \build-essential cmake re2c \ghc cabal-install libghc-vector-dev libghc-juicypixels-dev
cabal update
wget https://packages.microsoft.com/config/ubuntu/21.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
rm packages-microsoft-prod.deb
sudo apt update; \sudo apt install -y apt-transport-https && \sudo apt update && \sudo apt install -y dotnet-sdk-5.0
sudo apt install dos2unix
find . -type f -print0 | xargs -0 dos2unix
(this step fixes windows line endings for all files in all subfolders so make sure you run it from the Simple_C_HAX folder)cd Tools/EventAssembler
./build.sh
- Check inside Tools/EventAssembler/Tools - there should be "Tool Helpers.txt", but if not get it from https://github.com/StanHash/EventAssembler/blob/8aa0709a3be725f9cb2174f08763b59b4f937560/.Sources/Tool%20Helpers.txt
Finally, making the hack:
- Put a clean FE8U rom named "FE8U.gba" in the root folder
- Optional: put a symbol file named "FE8U.sym" in the root folder (here is one, just rename it to FE8U.sym https://cdn.discordapp.com/attachments/179027738454261760/906677647222919188/fe8u-20211009.sym)
- OpenTerminal.bat if WSL is not already open
make hack
- Find the routine you want to replace from https://github.com/FireEmblemUniverse/fireemblem8u
- In the Wizardry/Easy_C folder, open "decomp.c"
- Paste the relevant code into decomp.c and make any edits you need
- Go back up to the Simple_C_HAX folder and
make hack
- Never use spaces in filenames/paths. This breaks
make
horribly. This is one of the main reason I had to modify most of circles tools for them to work with this setup. - Don't use
#incext
/#inctext
unless you really need to. Use#include
/#incbin
with files generated from Makefile rules instead. This speeds up the build process tremendously.
Stan Appreciation Zone