Skip to content

KalaayPT/G4Patcher

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

118 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 provides a GUI for selecting an unpacked ROM folder (such as one generated by DSPRE), then one of the included patches, then checks for:

  1. 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)
  2. Can you even inject the patch, i.e. is your arm9 expanded?
  3. 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.

This tool uses armips via FFI - the armips library is compiled from source and linked directly into the binary.

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:

  1. Download the latest release to install
  2. Run G4Patcher
  3. Select your unpacked ROM folder
  4. Select the patch
  5. If everything is fine, youll get a confirmation message, if not, you'll get a message telling you what the issue is
  6. 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:

Prerequisites

Building

  1. Clone the repository with submodules:
git clone --recursive https://github.com/KalaayPT/G4Patcher.git
cd G4Patcher
  1. Build the project:
cargo build --release
  1. Find the executable in target/release/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:

  1. The patch name is clearly labeled with the ROM it is to be applied to (such as "_HG" or "_PLAT")
  2. 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.

Credits

  • G4Patcher: Kalaay (KalaayPT)
  • armips assembler: Kingcom - The powerful assembler that makes the code injection possible
  • Patch research: Various contributors (credits in individual patch files and wiki)

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages