[Col] Colonization picture viewer

Hi,

colowin uses different Resources (stored in the dlls), that are way easier to extract, but don't have the dos-nostalgic-look :).

Anyway, thanks to the scummvm-project and its support for M4/MADS, we were able to decompress the .ss and .pik files, and I made a simple java-based image viewer.

The link above leads to the commit that actually removed MADS-Support from scummvm, but feel free to take a look at these files, decompression and run-length-decoding of images is all there.

So here's the Image Viewer, extract the .zip and start it with something like:
Code:
java -jar JColoViewer.jar
Of course you would need to install java first :)

It should be pretty self-explanatory, just open a file (.pik or .ss) and there you are.
The left pane is debug-only information about the compressed file structure.
If you are opening a .ss file, try clicking on the prev/next image buttons to see all images in the file.

Please let me know if something does not work, or if there are some features you would like to see implemented.

Regards, Thomas
 

Attachments

  • JColoViewer.jar.zip
    39.4 KB · Views: 415
Thanks for this great tool, thomasd :goodjob:

Its possible to build a version with an export-function (bmp, jpg)?
 
Hi Fankman, thanks for the feedback!

There you go, an export function is added (available after opening a file).
Currently it justs exports to the subdirectory "exported" - tell me if you want to be able to specify the export directory.

The export image type is PNG - do you need other types as well?
 

Attachments

  • JColoViewer.jar.zip
    41.2 KB · Views: 272
Very fast, i am impressed :bowdown:

PNG ist the best way to store the picture, without loosing image-informations. Thanks, you're genius :goodjob:
 
Oh, one more thing... ;)

If you like optimize your program, then you can add the ff-filetype. The ff-files are the fonts in Colonization. And i think these are also bitmaps.

I've found this, maybe it's helpful:
http://scummvm.sourcearchive.com/documentation/1.2.0-1/engines_2m4_2font_8h-source.html

And finally, and this would lift your programm to a higher level, is a Edit-Mode.
A simple 1px-drawing Pen with a 16-color-palette would be great. And then i can begin to mod the graphics :crazyeye:
 
And here we go, it took a bit longer, but I managed to implement a simple edit mode and font display.

The image editor ist a simple 1x1 pixel brush, whose color can be chosen from the palette window (see screenshots).

Please try it out, hope it helps :)

Edit:
Fonts now render correctly, but exporting them is currently disabled.
 

Attachments

  • Screen Shot 2012-06-20 at 14.37.56.png
    Screen Shot 2012-06-20 at 14.37.56.png
    62.1 KB · Views: 721
  • Screen Shot 2012-06-20 at 14.39.43.png
    Screen Shot 2012-06-20 at 14.39.43.png
    34.7 KB · Views: 651
  • JColoViewer.jar.zip
    258.6 KB · Views: 336
Hello guys. I've come across implementation of madspack2.0 fab section decoder on the internet, so i tried it in java and it seems to decode FAB sections from Colonization files well. So I analyzed the decoding algorithm a little and created a little dumb encoding routine that encodes decoded data to something else than the original, but the encoded result decodes to the same as the original. Problem is, that when I try to just replace a FAB section in SS file, it does not work with your viewing programs, so it won't work with the game either. My encoding routine does not perform any compression, just encodes the data, so that decoder decodes it right. That means pictures encoded by my algorithm are bigger than the original ones after encoding. It might be the case, that MADSPACK files contain some information about sizes of fab sections in the header, before the fab sections. Do you know anything about this? I think it would be great, if after 20 years or something we would have picture editor for colonization. I have some ideas... :D

BTW thomasd: I have some issues with your program. are you interested to know?
BTW2 - i have some ideas about how to implement compression as well, but don't want to do it if it won't be worth the effort

Thank you very much for reply.
 
Hi!

I have never gotten around to implement an encoding/compression algorithm in my app, so congrats for your effort!

Are you setting the header sizes correctly? Specifically each FAB entry has a compressed size and uncompressed size, if they are the same, my application treats them as uncompressed (and the game hopefully as well, but I didn't test that).

Sure I'm interested in the issues - what's not working for you?

PS: Compression support would be awesome, then we could turn this in to a real Colonization file editor!
 
Fast reply, great. Let's start with your program:

I have issues with some SS/PIK files - certain pictures are not displayed correctly. For example image 13 in building.ss - it probably should be college, but the picture does not change when i'm on 12 and press the down key. then when i press down key again, i get university, and when i press up again, nothing changes. also the list does not show which row is selected correctly, when this happens. I have the same issue in many other ss files on certain pictures. these pictures were ok for angryfire's program (but other were problematic). Also for colony.pik it says succesfully loaded 2 entries, but nothing changes in the picture or the list.

The second problem is that the scaling bar is too much to the right, so i can see only two options: 1 or 2.

The last problem is that I can edit picture even with edit mode off, all you have to do is pick a color.

Screenshot is in attachment. I use Ubuntu 10.10 with Java 1.6.0_20


As for my attempts, I just used hex editor to manually copy out some sample fab sections for testing and then tried to manually replace the fab sections with result of my algorithm. I didn't analyze the header of the files at all, neither the content of the decoded data. My algorithm actually inflates the data by about 1/8 plus some constant, so I wonder how the reverse compression is handled by colonize decoder :) let's try it.

So now my task is to analyze the header of ss files, where exactly are the sizes of the sections...
 

Attachments

  • coloviewer_bugs.png
    coloviewer_bugs.png
    188.4 KB · Views: 419
It works!!! :woohoo:

More or less. The problem was in an additional byte that was accidentally added at the gluing place between original parts of ss file and my encoded part. :blush: I also found the size of fab section in header and changed it and it works, even in the game! The only problem is some kind of black noise added. Don't know where it comes from but it's probably just my bug, something I will hopefully cope with. People, I think we're going to have a Colonization graphics editor.
 
And here we go, it took a bit longer, but I managed to implement a simple edit mode and font display.

Sorry for my late answer. this tool is amazing, simple and useful.
Really, a great job :goodjob:

Now, if you have more motivation, you can unlock the font-export-function ;)

And a import-tool would be great. So we can replace the message-images in the game. A large 320x200px-image is impossible to realize, when you must place pixel by pixel :D

It works!!! :woohoo:
People, I think we're going to have a Colonization graphics editor.

Do you have news, Pham Nuwen?
I'm very interested to see a real Colo-Image-Editor before i die :D
 
Hi guys,

here is an updated Version of my picture viewer.

Changelog:
  • Use system look&feel on non-Mac OS X Platforms (fixes UI bugs like the zoom-slider)
  • Display Tooltip with color information when hovering over a pixel (works best in edit mode)

I'm afraid exporting fonts will take a little longer - I will have to read about windows bitmap font formats first...
 

Attachments

  • JColoViewer.jar.zip
    265.1 KB · Views: 378
Sorry for necroing this thread, specially since the last time I posted here was in 2008, but since no one ever posted their source code for viewing colonization files, I'm attaching here both the binary and the source code (made in C#, .NET Framework 4.5) for a colonization viewer that will open .PIK files, .SS files and .FF files.

Basically I followed what ScummVM did, just ported to C# (makes easy to port to other languages rather than C++).

If this does not open for you, try installing .NET Framework 4.5 in your machine.

Hope this helps someone who wants to use the original Colonization files for anything (maybe making a TTF from the colonization fonts???)

-Roger-
 

Attachments

  • MADSPackViewer.zip
    12.4 KB · Views: 348
  • MADSPackViewerSource.zip
    225.1 KB · Views: 324
Hi Zharramadar.

I've also (thanks to this thread and ScummVM) made madspack decoder (Python and C++ versions). However, it lacks .FF support.

So probably I will use your version to extract fonts when I go back to work on cc94.
 
Very nice, very nice. I thought on making a clone of Colonization myself, maybe adding multiplayer over internet to it, but these days, I do not have too much free time to spend to make one, unfortunately I must focus now on things that will give me money =(

Hope you can achieve a very good Colonization clone, would love to play it.

If you have any questions about the FF part of the code, just let me know. PM me might be faster, as I'll get an e-mail about it.
 
Hi,

Sorry for the offtopic.

We are trying to translate the Microprose game Rex Nebular, Dragonsphere and Return of the Phantom. These games work under mad engine.

The global.hag file contains text files, this file can be unpacked and packed with some programs created by users.

The content of global.hag file:

Messages.dat

This file contains texts but not know how to unpack and re-pack it.
Here are some explanations of Alpobemp (http://www.icgag.it/alpobemp/?page_id=189#comment-684) of the file structure.

Quote:
"The compression algorithm which is based Dragonsphere, rex nebular, return of the phantom, is a particular case of LZ, LZEXE of Fabrice Bellard (the string" FAB "at the beginning of each sentence suggests).
In this discussion of a forum is discussed:http://www.abandonware-forums.org/s...on-rex-nebular&p=338779&viewfull=1#post338779.

The code decompression of LZEXE is public (google is easy to find), but must be modified to accommodate the use of the game (LZEXE compressed exe executable files, not just data files).

As for compression, the code is not available, unlike the decompression. I used a "tactical" not have compressed the modified text, using the prefixes "FF" before each 16 characters of text (meaning "takes the following 16 characters are according").


Well, unfortunately Alpobemp no longer have the code, because the theft of your pc and backup a few years ago and we not know how to create the code.

Vocab.dat

Contains texts.

* .ff

Contains fonts, Alpobemp created a program to modify fonts it works perfectly.

http://www.icgag.it/alpobemp/html/EXEC/DrawFontMADS.exe

Possibly also work with civilization.

* .ss

Unknown content.

We have not found pictures of the games and texts of the introduction maybe found in the * .ss , * .int or *.CNV, *.CND

I understand it is very difficult but maybe is possible adapt the code done by institution for these games.

I uploaded the files GLOBAL.HAG of Dragonsphere and Rex Nebular unpacked.

http://www.mediafire.com/download/r2ocr4hm4mc3mbb/GLOBAL.HAG+unpacked.rar

Greetings and thank you for your time.
 
Well, bless this long-living theme. If someone will use awesome tool provided by Zharramadar, you should probably add a bit to decompression function:

Almoste everywhere
if (cmd == 255)
{
newLine = true;
break;
}
should be replaced with
if (cmd == 255)
{
while (x2++ < width)
_outputStream.WriteByte((byte)255);
newLine = true;
break;
}
And you'll got picture with full alpha channel. Then you only need to replace
int a = idx == 255 || idx == 0 ? 0 : 255;
with
int a = idx == 255 ? 0 : 255;
And you will got nice png withoup blackness on right side for *.SS pictures.
 
And you should also fix typo in
MadPacksImage.cs
r = paletteData[idx * 3] * 2;
g = paletteData[(idx * 3) + 1] * 2;
b = paletteData[(idx * 3) + 1] * 2;
to
r = paletteData[idx * 3] * 2;
g = paletteData[(idx * 3) + 1] * 2;
b = paletteData[(idx * 3) + 2] * 2;
and probably even to
r = paletteData[idx * 3] * 4;
g = paletteData[(idx * 3) + 1] * 4;
b = paletteData[(idx * 3) + 2] * 4;
because paletteData is allways lower than 64, so with this you'll take brighter images
 
Hey Folks, I found this thread and it is exactly what i have been looking for. However, I am new to this board so i might be missing something, but when i click the attachment .zip files, nothing downloads. I am using Chrome on a macbook. Am i missing something to make the download happen?
 
I can't help you with this except to say I have the same problem, none of the zip files will download. I am using Internet Explorer and Windows so it's not your system at fault.
 
Top Bottom