mborgerson / pyxbe

Python 3 library to read and write XBE files, the executable file format for the original Xbox game console
http://pyxbe.readthedocs.io/
MIT License
17 stars 10 forks source link

Section sorting order may differ between raw and virtual addresses #35

Open itsybitsypixel opened 3 months ago

itsybitsypixel commented 3 months ago

XBEs where the section order is not the same when sorting by raw vs. virtual addresses will produce Expected $SECTION_RAW_ADDR for $SECTION_NAME, got $RAW_OFF warnings when packing and the resulting XBE will have its sections be arranged differently in file data compared to the original.

While this shouldn't have any effect on the loading or playability of the output XBE, it won't be "faithful" to the original and may have other side effects e.g. large patch files (IPS, BPS, etc.) between original and output if pyxbe is used when creating patches.

In my case (http://redump.org/disc/13503/), changing key of sorted to use each sections' raw_addr instead of virtual_addr when constructing section data fixes this but that could affect user code that e.g. assigns only the virtual address when inserting new section(s) and leaves assigning a raw address for pyxbe to handle.