if Z64 format:
no divisibility requirements
else if V64 format:
ROM size must be divisible by 2
else if N64 format:
ROM size must be divisible by 4
but in CoreDoCommand we don't have any information regarding file format (magic bytes are read in open_rom, after ParamInt validation). Because of that I just assumed that all ROMs sizes must be divisible by 4. If there are valid ROMs not meeting this criteria then either:
some padding could be added to these ROM files (to make their size divisible by 4), or
emulator utilizing m64p-core (such as RMG) could calculate ROM buffer size like this: buffer_size = (rom_file_size + 3) & -4 (ROM size rounded up to the nearest 32-bit alignment)
Fix for https://github.com/mupen64plus/mupen64plus-core/issues/1049.
Issue 2 could be fixed like this:
but in
CoreDoCommand
we don't have any information regarding file format (magic bytes are read inopen_rom
, afterParamInt
validation). Because of that I just assumed that all ROMs sizes must be divisible by 4. If there are valid ROMs not meeting this criteria then either:buffer_size = (rom_file_size + 3) & -4
(ROM size rounded up to the nearest 32-bit alignment)