15 releases (9 breaking)
| new 0.15.0 | Dec 17, 2025 |
|---|---|
| 0.14.0 | Aug 15, 2025 |
| 0.13.4 | Aug 10, 2025 |
| 0.12.1 | Jul 23, 2025 |
#156 in Games
1MB
2.5K
SLoC
Contains (DOS exe, 795KB) assets/armips.exe, (ELF exe/lib, 1KB) use_item_fix.o
Pokemon Gen 4 Code Injection Patcher
This is a small thing ive written up to easily distribute .asm patches for code injecting things such as EV+IV-checking and Portable PC routines, because i was tired of explaining and writing out every patch separately.
This program is purely cli. It prompts you to select an unpacked ROM folder (such as one generated by DSPRE), then one of the included patches, then checks for:
- Is the patch compatible with your game? (by comparing game header with patch name, so if you want to contribute your own patches, make sure to label your patches corrrectly)
- Can you even inject the patch, i.e. is your arm9 expanded?
- Is there free space in the synthOverlay and where is said space
After checking these things, it adjusts the patch file with the corrected injection address and runs the patch through armips.
An armips binary is bundled into the release, so no need to install anything!
Please credit me (Kalaay) and the people behind the research for the patches if you use them in your own projects. Credits for research can always be found in the patch files themselves, as well as in the wiki
1. Usage:
- Download the latest release
- Run G4Patcher
- Select your unpacked ROM folder
- Select the patch
- If everything is fine, youll get a confirmation message, if not, you'll get a message telling you what the issue is
- Press Enter to close
2. Limitations:
- The program doesn't check if the patch is already applied, so if you apply a patch twice, it will duplicate the previous one. The patch will still work, but more space in your synthOverlay will be used up.
- The program doesnt check compression either (yet), so make sure that the hook overlay required by the patch is not compressed.
3. Included patches:
can now be found in the wiki
4. Build Instructions:
- Install Rust and Cargo: Follow the instructions at https://www.rust-lang.org/tools/install
- Clone the repository:
git clone https://github.com/KalaayPT/G4Patcher.git
cd G4Patcher
- Build the project:
cargo build
- Find the executable in target/release/g4patcher
- Run G4Patcher
5. Contributing:
If you want to contribute your own patches, you can use the included ones as templates as to what yours are supposed to look like.
Make sure that:
- The patch name is clearly labeled with the ROM it is to be applied to (such as "_HG" or "_PLAT")
- The patch includes this type of structure (only for code injection patches):
INJECT_ADDR equ 0x023C8000
...
.ifdef PATCH
// hook here
.endif
...
.ifdef PREASSEMBLE
.create "temp.bin", 0x023C8000
.elseifdef PATCH
.open "unpacked/synthOverlay/0000", 0x023C8000 // 0000 for hg, 0009 for plat
.endif
.org INJECT_ADDR
so that the script is able to adjust the injection address and preassemble to calculate patch size.
Dependencies
~9–35MB
~538K SLoC