NearInfinityBrowser / NearInfinity

An Infinity Engine Browser and Editor
https://github.com/NearInfinityBrowser/NearInfinity/wiki
GNU Lesser General Public License v2.1
88 stars 37 forks source link

New file type variant: MOS #19

Closed Argent77 closed 11 years ago

Argent77 commented 11 years ago

Unreadable MOS files (e.g. GUI*.MOS, WORLDMAP.MOS) Cause: new MOS V2 format

FredrikLindgren commented 11 years ago

This issue can be closed when NI no longer throws an exception on MOS V2 files. If there remains work to be done, please open a new issue.

Argent77 commented 11 years ago

Some information about the new MOS V2 format (update):

Header:

Offset    Size    Description
0x0000    4       Signature ('MOS ')
0x0004    4       Version ('V2  ')
0x0008    4       Width
0x000C    4       Height
0x0010    4       Number of data blocks
0x0014    4       Start offset of data blocks

Data block:

Offset    Size    Description
0x0000    4       PVRZ page
0x0004    4       Source (PVRZ) x coordinate
0x0008    4       Source (PVRZ) y coordinate
0x000C    4       Width
0x0010    4       Height
0x0014    4       Target (MOS) x coordinate
0x0018    4       Target (MOS) y coordinate

MOS V2 resources refer to MOSxxxx.PVRZ files, where xxxx is a four-digits decimal number (PVRZ page).

Argent77 commented 11 years ago

MOS viewer updated. It now supports the MOS V2 format. As with the TIS viewer, I had to outsource the old MOS decoding routines into a separate class. As a result, infinity.resource.graphics.MosResource2 handles MOS resources from now on.

Commit: https://github.com/Argent77/NearInfinity/commit/8a876f9afee8ba0ca0724ef34bab5e2d756cc021

NB: I have removed my own BMP export routines from the PVRZ/MOS/TIS decoders in favor of Java's ImageIO class. It's safer that way.

FredrikLindgren commented 11 years ago

The new MOS code seems to have a problem with certain water colours. Like with the old green-water bug, they appear bright green (ar1200.mos, for example). The same NI build displays the BG1 MOS with the correct colours.

Argent77 commented 11 years ago

The problem lies in the BGEE MOS files themselves. I could add a hack to "black out" the respective palette entry, but that might cause other problems.

Edit: Blacking out the palette entry doesn't really help, as the color value depends on the surrounding colors in the MOS. I'll leave it unchanged for the time being.