English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Asm / Hardware

 
 
Thread Tools
Old 15 September 2017, 05:25   #1
Vairn
The Grim-Button

Vairn's Avatar
 
Join Date: Jan 2008
Location: Melbourne Australia
Age: 36
Posts: 390
Send a message via Skype™ to Vairn
Help with understanding a file format.

Hi All,
Not 100% sure if this is the right place for this.

I am looking into the image format for the Old RPG, Might and Magic 2.

I have attached one of the files from the Game.
and a png of what it should look like.
This is what I know about the file.
0x00-0x02 Frames
0x03-0x03 Flag, seen as 0x00 or 0x03
0x04-0x07 width, height
0x08-0x08 always 0x00

next is the palette stored as the standard prgb (Pad:4,Red:4,Green:4,Blue:4) 32 colours

Then there is the data.

Here is where I am confused.
It isn't Standard Compressed IFF data.
It also doesn't look to be RLE encoded.

I did think at one part that it is encoded as stride and data. as in 0x0f, meant 16 0000000, while 0xFF was 16 11111111. but that doesn't work for 0x5f, (unless I am blind lol), it does seem to work for the first one after all the 0x0F's at the start, which is 0x4b. So now I think it maybe some mapped file where it has blocks or shapes, and it builds the images out of those prefabs..

I am sure it is something obvious that I am missing.
I do have some dissembled code I have done via IDA Pro on windows.

I have found the code relating to Character Generation, Events, Spells, Combat etc, for the game. Where it initializes the screen, window, (it calls it's screen "Game About Characters" btw, which is what the main menu's are).

I also have a plugin for IDA Pro that lets me debug with WinUAE's debugger, which is awesome btw.

Look for a lable, LoadImage32, for the code that deals with loading images.
Attached Files
File Type: zip mm2-data.zip (189.7 KB, 11 views)
Vairn is offline  
AdSense AdSense  
Old 15 September 2017, 11:05   #2
meynaf
son of 68k
meynaf's Avatar
 
Join Date: Nov 2007
Location: Lyon / France
Age: 44
Posts: 2,459
It looks like the image is encoded with "commands" indicating how many pixels of what color are to be stored. Many games use that kind of encoding. So maybe nF is repeat pixel of color n 16 times but several different commands, some having parameters that follow, can exist. It may emit direct pixel data, repeat previously emitted data, etc. Some even have commands for transparency pixels.
Perhaps 5F does not work because it's data rather than command.
My advice is to check values ending with '0' as what would be single pixel block is in fact perhaps a very different command.
You can decode the data by hand or with some simple program and check if values match actual pixel colors, then if a diff happens what command triggered it.
meynaf is offline  
Old 27 September 2017, 06:43   #3
Vairn
The Grim-Button

Vairn's Avatar
 
Join Date: Jan 2008
Location: Melbourne Australia
Age: 36
Posts: 390
Send a message via Skype™ to Vairn
Alrighty. It is actually a lot simpler than originally thought.
To sum up the .32 files.
word: frames
word: mask colour index
then it has the dimensions of each frame, with a mask colour for that frame.
followed by the palette (Pad:4,Red:4,Green:4,Blue:4) for 32 Colours.
Then the image data is actually quite simple.
It is a very basic RLE image, where only repeats of 0's or 1's are encoded up to a count from 1 to 16.
so 0x0f, means 16 zero's. 0x05 is 6 zeros, and 0x00 is 1 zero.
and 0xff means 16 ones' 0xf0 is 1 ones.
anything else is just copied as is. into the next 8 bits. but they don't have to start of the 0th bit. of each 4 bit nibble.

Last edited by Vairn; 27 September 2017 at 08:15. Reason: masking info.
Vairn is offline  
Old 27 September 2017, 08:13   #4
Vairn
The Grim-Button

Vairn's Avatar
 
Join Date: Jan 2008
Location: Melbourne Australia
Age: 36
Posts: 390
Send a message via Skype™ to Vairn
Here are all the '.32' files converted into bitmaps, into seperate frames.

The other format used in the game is .anm which is similar, it just has other information at the start of it, which I am still figuring out.
Attached Files
File Type: zip mm2_gfx_32Format.zip (350.1 KB, 11 views)
Vairn is offline  
AdSense AdSense  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
SYX file format description daxb Coders. General 3 28 June 2015 08:25
Amiga Sourcecode File Format MintyTheCat support.Other 12 10 November 2013 18:15
File format absence Coders. General 8 18 July 2012 02:25
Graphics File Format information Nogg request.Other 6 02 April 2010 02:46
DW file format Leto2 request.Modules 2 07 March 2001 19:40

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 22:42.


Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Page generated in 0.18830 seconds with 15 queries