NeoGF/doltool
2022-06-12 07:18:33 +02:00
..
doltest.py Added test for 00 arcode 1 byte write 2022-06-12 07:09:48 +02:00
doltool.py Added 00 arcode 1 byte patch processing 2022-06-12 07:10:44 +02:00
README.md Added 00 opcode support. 2022-06-12 07:18:33 +02:00

doltool.py

Tests on -sr command and sections remapping has to be done.

Python3 script for manipulating dol file format. This tool can stats with all informations from dol header and patch dol .text and .data using a list of write Action Replay code in an formated .ini file. MIT License.

User manual

Translate a virtual address into a dol offset if this was originaly mapped from data or text. virtual_address has to be in hexadecimal: 80003100

doltool.py --virtual2image virtual_address

Translate a dol offset to a virtual address mapped from data or text. dol_offset has to be in hexadecimal: 2000

doltool.py --image2virtual dol_offset

Extract a section_index between 0 to 17 from the dol file source.dol with the name source.dol_sectiontypeN. sectiontype = data or text and N is the index from 0 to 17.

doltool.py --extract source.dol section_index [-o output_file]

Print stats about the dol file. This stats contains informations about full header information formated (with sections used or not), empty spaces informations splited .bss and entry point.

doltool.py --stats source.dol

Analyse action_replay_list.ini and the dol. Overlapping arcodes are printed and then unmapped memory address spaces splited by sections will be displayed. This memory ranges will be added in the dol if the -sr command is used when patching using -par command.

doltool.py --analyse-action-replay source.dol -ini action_replay_list.ini

Patch the dol data and text section using an action_replay.ini file containing write instructions (00/02/04 implemented yet). If the virtual address of the ARCode doesn't match existing mapped data or text sections it raise an Exception. To avoid this exception use the -sr argument to auto remap dol offsets and create news data sections reserved for the patching process.

doltool.py --patch-action-replay source.dol -ini action_replay_list.ini [-sr] -o patched.dol

Action Replay ini file format

All ARCodes present in the ini will be enabled without taking care of [ActionReplay_Enabled] section Raise an Exception if lines are in invalid format:

  • empty lines are removed
  • lines beginning with $ are considered as comments and are removed
  • lines beginning with [ are considered as comments and are removed
  • others lines have to be in format: "0AXXXXXX XXXXXXXX" with (A in 0,1,2,3,4,5) and X in [0-9a-fA-F]