A Python utility for applying International Patching System (IPS) patches to ROM files, particularly useful for ROM hacking and homebrew development.
- ✅ Apply IPS patches to ROM files
- ✅ Support for both normal and RLE (Run-Length Encoding) patches
- ✅ Automatic ROM size extension when needed
- ✅ Verbose debugging output
- ✅ Command-line interface with argparse
- ✅ Proper error handling and validation
- ✅ Cross-platform compatibility
Clone this repository:
git clone <repository-url>
cd ips-patcherNo additional dependencies required - uses only Python standard library.
python ips_patcher.py original_rom.gba patch.ips patched_rom.gbapython ips_patcher.py --verbose original_rom.gba patch.ips patched_rom.gbapython ips_patcher.py --helppython ips_patcher.py --version# Apply a Pokemon Emerald ROM hack patch
python ips_patcher.py "Pokemon Emerald.gba" "seaglass_v3.ips" "Pokemon Emerald - Seaglass v3.gba"
# With verbose output to see patch details
python ips_patcher.py -v "Pokemon Emerald.gba" "seaglass_v3.ips" "Pokemon Emerald - Seaglass v3.gba"This tool supports the complete IPS format specification:
- Normal patches: Direct byte replacement at specified addresses
- RLE patches: Run-length encoded patches for efficient large area modifications
- ROM extension: Automatically extends ROM size when patches write beyond current file size
- EOF marker: Proper handling of IPS EOF termination
ips-patcher/
├── ips_patcher.py # Main patcher script
├── README.md # This file
├── requirements.txt # Python dependencies (none currently)
└── tests/ # Unit tests (planned)
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
- GUI interface
- Batch processing support
- UPS patch format support
- Patch creation functionality
- ROM checksum validation
- Unit tests
- CI/CD pipeline
The International Patching System (IPS) is a binary format for describing differences between two files. It consists of:
- Header: 5-byte "PATCH" identifier
- Records: Variable-length records containing:
- 3-byte address (big-endian)
- 2-byte length (big-endian)
- Data bytes (or RLE specification if length = 0)
- EOF: 3-byte "EOF" terminator
When a record has length = 0, it indicates RLE encoding:
- 2-byte RLE length (big-endian)
- 1-byte value to repeat
MIT License - See LICENSE file for details
- Initial release
- Complete IPS format support
- Command-line interface
- Verbose debugging mode
- Cross-platform compatibility
- Developed for ROM hacking workflow
- Tested with Pokemon Emerald Seaglass v3.0 patch
- Thanks to the ROM hacking community for the IPS format specification