Page 3 of 5

Re: I.M.Meen (1995 PC/DOS) CMP format

Posted: Tue May 26, 2009 8:29 pm
by Balder
Final structure, for both CMP0 and CMPx formats:

Code: Select all

CMP: Small image, indexed colour

-HEADER-
04 bytes - nnnnnnnn - cmpSize -4
02 bytes - nnnn     - width in pixels of a block (complete image)
02 bytes - nnnn     - height in pixels of a block (complete image)
02 bytes - nnnn     - ?superior margin?
02 bytes - nnnn     - ?image height?
02 bytes - nnnn     - ?left margin?
02 bytes - nnnn     - ?image width?
01 bytes - nn       - numberOfColours

-BODY FOR CMPX-
numberOfColours bytes      
variable            - coded lines

Decoding: 
Lines of 26 pixels
if byte < 80h paint pixel
if byte = 80h end of line
if byte > 80h skip (byte -80h) pixels

-BODY FOR CMP0-
numberOfColours bytes      - {probably from a extern palette}
height*2 bytes        - {line offsets}
height*width bytes    - {table of pixels of each line}
Also attached updated version of CMPViewer adapted to this changes and even with some of the colours of the palette, which I guessed with help of the screenshots. You can see now that half of the image mor or less has good colour. That's the colours of the palette I guessed.

If you don't understand something or need anything else, just tell me over here.

I hope this comes handy to you, bye!

Re: I.M.Meen (1995 PC/DOS) CMP format

Posted: Thu May 28, 2009 1:11 am
by Darkfox
Sorry for being gone for a day, my old router got fried. Here's some comparisons to help that I went through to make:

Image

This is as it appears in the viewer, looking much better might I add!

Image

As it appears ingame, but special note of detail... it is stretched vertically! I notice repeated pixels! I will later painstakingly remove each repeated pixel line (thicker than the rest all the way through), but for now here's a squished version:

Image

Same with the girl:

Image Image Image

Viewer, ingame, and fixed proportions. There will of course be issues between them because I used MSPaint to squish it down, not all repeated lines were removed and some details were lost. I'll give a more accurate image with repeated lines removed.

Point I'm trying to make is, the game stretched the graphics vertically.

P.S.: The numbered entries like GIRLx.CMP are the expressional eyes and mouth used ingame.

Re: I.M.Meen (1995 PC/DOS) CMP format

Posted: Thu May 28, 2009 2:57 am
by Balder
Darkfox wrote:Sorry for being gone for a day, my old router got fried.
No problem, but I admit I missed you a bit hahaha
Darkfox wrote:As it appears ingame, but special note of detail... it is stretched vertically! I notice repeated pixels! I will later painstakingly remove each repeated pixel line (thicker than the rest all the way through), but for now here's a squished version:
Yeah, don't worry I've already noticed that the screenshots were stretched. I thought it was a matter of DOSbox or the capturing program. This didn't affect colours, which is the only thing I need from the images.
DON'T LOOSE TIME CORRECTING THE SCREESHOTS. I've already said it, so you're advised that it's not necessary now... heheh
Balder wrote:P.S.: The numbered entries like GIRLx.CMP are the expressional eyes and mouth used ingame.
It's good to know. Whatever they are, they weren't the same: pixels were coded. I have already decoded them which hasn't been very difficult as there were few codes. The biggest problem was having the screenshots incorrect, so I couldn't go comparing byte per byte.

Anyway, as I've said, the formats are already known.

There's only one task to be acomplished: discover the rest of the colours in the palette. As I've said in older posts, the palette is not in the header, but an index of colours which points to an "standard" palette or external one.

The images are still looking bad because of not discovered colour palette. I've only added a few colours to show you the result. (about the 15% of the image is good, then )

The question is: How to discover a colour? Let's give number to them: The first pixel colour is the first colour, the next new colour (if it's a different one, as the other is already numbered) is colour two, and so on til the last colour. So, I go to paint application, I zoom in the screenshot and I go using the thing which select colours (don't ask me the name) then I go to custom colours an there it shows: Red, Green, Blue componentes of that colour. Now I know that colour 1 is: 00 87 49 (for example). Great, so now I go to the index of colours for that image in the hex editor and I see what value has the first colour. For example 84. So I go to my palette (formed by three arrays of 256 bytes each) and place in position 84 the values 00, 87, 49 for red, green and blue arrays.

This is the only way to find out the palette with the files I have. Obviously, this process has to be repeated for every image which has different colours, so we can complete the 256 colours in the palette. (If there aren't any images which contain all colours the game uses...)

I hope you understand the matter. So I wait for your response for knowing what do you want to do about it.

Re: I.M.Meen (1995 PC/DOS) CMP format

Posted: Thu May 28, 2009 5:17 am
by Darkfox
Time consuming but it does work. However, I have had a theory. If I can't find the palettes in any of the LAB files or in the game folder, I think I can come to another conclusion: They are in the executable itself. I will tell you the outcome of this investigation. It seems only logical though.

I understand what your saying though, it'll be the only option if I can't find the palette even after digging through it so deeply.

Edit: I pulled out part of the executable at the header "RIFF" and the "PAL data" bits. Though I doubt this is it. I have another lead though that is stored within another file.

Re: I.M.Meen (1995 PC/DOS) CMP format

Posted: Thu May 28, 2009 8:54 am
by Balder
I'll test that this evening. If it results not to be the palette you could send .exe to give a try with the dissasembler. But I'm not good at that so don't expect much... at least there's another way to know it! :)

Re: I.M.Meen (1995 PC/DOS) CMP format

Posted: Thu May 28, 2009 3:53 pm
by Balder
It seems there are more than one "RIFF PAL" on that file. Anyway, I din't find any of the already discovered colours in that palette.

I suggest searching with an hex editor in the game's exe some particular colours as:

848484 (54 54 54 in Hex)
or
727272 (48 48 48 H)

(Considering executable not compressed, which is pretty probable in those years)

If there's a match it's pretty secure the palette is in there, and if not... :roll:

Re: I.M.Meen (1995 PC/DOS) CMP format

Posted: Sun Jul 26, 2009 11:19 am
by Darkfox
Some data that relates to the makers of this game and possibly can be translated to decoding I.M.Meen:

Tools that can possibly be used to get an idea
http://paololiistro.e3b.org/cd-i/

The origin topic.
http://cdinteractive.co.uk/forum/viewto ... sc&start=0

Re: I.M.Meen (1995 PC/DOS) CMP format

Posted: Sun Aug 02, 2009 12:37 am
by Darkfox
The palettes I extracted from the executable I showed are RLE compressed. Perhaps decompressing them and trying them will get the palettes?

Re: I.M.Meen (1995 PC/DOS) CMP format

Posted: Thu Oct 22, 2009 10:14 pm
by Darkfox
Just updating to let it be known that I haven't given up on this, I'm still searching for possible palette data to associate with these images as well as the textures.

Thought: The palettes extracted from the EXE may be the actual ingame palettes for sprites and textures respectively.

Re: I.M.Meen (1995 PC/DOS) CMP format

Posted: Fri Nov 20, 2009 6:28 am
by Balder
I'm also still alive althought not specially healthy :D Well I'd like to take another look to these project just as I have some time. (now I'm finnishing a tool to deal with paletized and encoded images from Heroes of Might and Magic 2, being able also to animate, show, convert etc so I make it a reusable class on the HoMM2 remake)

As I remember all format related thing was already figured out, I have that info on my external HD at home. Just we couldn't find the palettes.

As an observation I'd say it would be very strange to see a palette RLE-compressed. Run Lenght Encode works like this: "aaaaah" "5ah" 33,3% of compression achieved. But wen you take something were all near components are differente, as a colour palette, you get: "ahahajasf" "1a1h1a1h1a1j1a1s1f" which means 100% more lenght.

Also it would be very strange to see a palette inside an .exe (not impossible thought), as they are usually small .PAL files, on the game's directory or inside another format bigger file (.dat for example).

We'll continue with this soon. It's almost finnished and wouldn't be nice to leave it now.

A pleasure to see you again Darkfox! (:

Re: I.M.Meen (1995 PC/DOS) CMP format

Posted: Sun Nov 22, 2009 8:57 am
by Darkfox
Glad to see your still active too! Want me to make a running game dump and find the palette in there?

Re: I.M.Meen (1995 PC/DOS) CMP format

Posted: Sun Nov 22, 2009 3:08 pm
by Balder
That would be a good point to start. Try to find strings like "PAL" "colour" etc. We may have luck with that, because as palettes don't have any special signature searching for it as binary would be difficult.

Another idea is to take one of the colours we already had and search for it with an hex editor! That would indicate use were is it placed (at least if the palette colours are not "fixed", in that case we can search RealColour/4 or RealColour/2. :wink:

Re: I.M.Meen (1995 PC/DOS) CMP format

Posted: Tue Dec 01, 2009 11:11 pm
by Darkfox
The contents of this post was deleted because of possible forum rules violation.

Re: I.M.Meen (1995 PC/DOS) CMP format

Posted: Tue Dec 01, 2009 11:48 pm
by Balder
Great :keke:

So if you already find some colour matches, finding where the palette start it's straightforward, remember they are usually 256 bit * 3 = 768 bytes.

I'll take a look to this this weekend, I think I'll have some time.

Just trying to determine which file contains it.

Cheers!

Re: I.M.Meen (1995 PC/DOS) CMP format

Posted: Tue Dec 01, 2009 11:59 pm
by Darkfox
Well, it is a memory dump, so it is a (not very big) single file. I'll need to run a special file search tool to check all files for the color matches.