MEGA65 / mega65-tools

Tools and Utilities for the MEGA65 Retro Computers
GNU General Public License v3.0
28 stars 31 forks source link

bit2core: core header embed_file_offset behave different on platforms #163

Closed lydon42 closed 1 year ago

lydon42 commented 1 year ago

On linux the unsigned log embed_file_offset is 8 bytes long, with the windows build it occupies only 4 bytes.

Need to make this a better datatype and check what FDISK expects here and what our old core use (probably the 8 byte long number).

lydon42 commented 1 year ago

unsigned long is 8 byte, but a 4 byte uint32_t is expected. As the long in the conversion routine is not initialised, we seem to have 4 bytes of garbage in the header of all the cores that have files attached.

with mingw windows compilation, the unsigned long is only 4 bytes. so this makes some weird stuff.

best way is to fix this and to skip the 4 garbage bytes, or we won't be compatible to older core files.

lydon42 commented 1 year ago

Backward compatible fix, tested on linux and windows. Looks good!