Jump to content


Photo

issues in MOS V2 format description?


6 replies to this topic

#1 K4thos

K4thos
  • Modders
  • 1057 posts
  • Gender:Male

Posted 29 April 2016 - 04:11 PM

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 = 542330701

cnt = 1, PVRZ_page = 0

cnt = 2, PVRZ_page = 0

cnt = 3, PVRZ_page = 1
ERROR: illegal 4-byte read from offset 112 of 108-byte file GMPCARBB.mos
ERROR: [GMPCARBB.mos] -> [test] Patching Failed (COPY) (Failure("GMPCARBB.mos: read out of bounds"))

Edited by K4thos, 29 April 2016 - 04:12 PM.


#2 Mike1072

Mike1072
  • Gibberling Poobah
  • 2384 posts
  • Gender:Male
  • Location:Canada

Posted 29 April 2016 - 05:28 PM

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

 



#3 K4thos

K4thos
  • Modders
  • 1057 posts
  • Gender:Male

Posted 29 April 2016 - 05:56 PM

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.


Edited by K4thos, 29 April 2016 - 05:58 PM.


#4 Mike1072

Mike1072
  • Gibberling Poobah
  • 2384 posts
  • Gender:Male
  • Location:Canada

Posted 29 April 2016 - 06:21 PM

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



#5 argent77

argent77
  • Modders
  • 733 posts
  • Gender:Male

Posted 30 April 2016 - 01:59 AM

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.



#6 K4thos

K4thos
  • Modders
  • 1057 posts
  • Gender:Male

Posted 30 April 2016 - 03:37 AM

thanks, everything works fine with lthe dword instead of word sizes in header.



#7 igi

igi

    IESDP Guardian

  • Gibberlings
  • 1220 posts
  • Gender:Male

Posted 04 September 2017 - 08:25 AM

Moving this topic as the change is already integrated into the IESDP.





Reply to this topic



  


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users