K4thos Posted April 30, 2016 Share Posted April 30, 2016 There's got to be an error in MOS V2 format description regarding offsets or length unless I'm missing something. Here is a loop I've coded using values based on IESDP: COPY_EXISTING ~GMPCARBB.mos~ ~override~ READ_SHORT 0xc "blocks_cnt" //Number of data blocks READ_SHORT 0xe "blocks_off" //Offset to data blocks FOR (cnt=0; cnt<"%blocks_cnt%"; cnt=cnt+1) BEGIN READ_LONG ("%blocks_off%"+0x1c*cnt) "PVRZ_page" PATCH_PRINT ~cnt = %cnt%, PVRZ_page = %PVRZ_page%~ END BUT_ONLY And the result: cnt = 0, PVRZ_page = 542330701cnt = 1, PVRZ_page = 0cnt = 2, PVRZ_page = 0cnt = 3, PVRZ_page = 1ERROR: illegal 4-byte read from offset 112 of 108-byte file GMPCARBB.mosERROR: [GMPCARBB.mos] -> [test] Patching Failed (COPY) (Failure("GMPCARBB.mos: read out of bounds")) Link to comment
Mike1072 Posted April 30, 2016 Share Posted April 30, 2016 At the very least, there appear to be some typos on the page regarding offsets, but it looks like you accounted for that. Data Block Offset Size (data type) Description 0x0000 4 (dword) PVRZ page - Refers to MOSxxxx.PVRZ files, where xxxx is a zero-padded four-digits decimal number. 0x0004 4 (dword) Source x coordinate 0x0008 4 (dword) Source y coordinate 0x000a 4 (dword) Width 0x000c 4 (dword) Height 0x000e 4 (dword) Target x coordinate 0x000e 4 (dword) Target y coordinate Should be: Data Block Offset Size (data type) Description 0x0000 4 (dword) PVRZ page - Refers to MOSxxxx.PVRZ files, where xxxx is a zero-padded four-digits decimal number. 0x0004 4 (dword) Source x coordinate 0x0008 4 (dword) Source y coordinate 0x000c 4 (dword) Width 0x0010 4 (dword) Height 0x0014 4 (dword) Target x coordinate 0x0018 4 (dword) Target y coordinate Link to comment
K4thos Posted April 30, 2016 Author Share Posted April 30, 2016 At the very least, there appear to be some typos on the page regarding offsets, but it looks like you accounted for that. Indeed, I've taken it into account with Data Block length. Didn't even notice those unusual offsets since I only need PVRZ page at data block offset 0 and got the 0x1c value by adding up all the dword sizes. Considering the loop doesn't work there have to be more errors in the description. Link to comment
Mike1072 Posted April 30, 2016 Share Posted April 30, 2016 I did some testing, and it looks like some of the sizes in the header are incorrect. MOS V2 Header Offset Size (data type) Description 0x0000 4 (char array) Signature ('MOS ') 0x0004 4 (char array) Version ('V2 ') 0x0008 2 (word) Width (pixels) 0x000a 2 (word) Height (pixels) 0x000c 2 (word) Number of data blocks 0x000e 2 (word) Offset to data blocks Should be: MOS V2 Header Offset Size (data type) Description 0x0000 4 (char array) Signature ('MOS ') 0x0004 4 (char array) Version ('V2 ') 0x0008 4 (dword) Width (pixels) 0x000c 4 (dword) Height (pixels) 0x0010 4 (dword) Number of data blocks 0x0014 4 (dword) Offset to data blocks Link to comment
argent77 Posted April 30, 2016 Share Posted April 30, 2016 Both BAM V2 and MOS V2 format descriptions in IESDP contain errors. I'd use the original forum topics for MOS V2 and BAM V2 instead. Link to comment
K4thos Posted April 30, 2016 Author Share Posted April 30, 2016 thanks, everything works fine with lthe dword instead of word sizes in header. Link to comment
igi Posted September 4, 2017 Share Posted September 4, 2017 Moving this topic as the change is already integrated into the IESDP. Link to comment
Recommended Posts
Archived
This topic is now archived and is closed to further replies.