SpeedBall 2 SPR

Talk about everything related to general reverse engineering of computer games!

Moderator: Kroah

SpeedBall 2 SPR

Postby norb » 12 Nov 2013, 01:28

Hello,

First thanks for your share quality of your code is amazing, not so much readable from time to time but I guess that come from the way you reversing the apps.

Then my question :)

I'm playing with your the speed ball source code and try to play with the dump data but I do not understand one thing.

With your source you generate the PNG and a SPR file but it look like that the SPR is just a raw data of the dump am I wrong ? and can't be read from SPR viewers.

I would like to be able to find a way to regenerate an SPR file from the PNG that sound stupidly simple but I do not succed, :(
So I have tried several ways but none working if you can help me I would appreciate

Thanks.
norb
 
Posts: 2
Joined: 12 Nov 2013, 00:45

Re: SpeedBall 2 SPR

Postby Kroah » 12 Nov 2013, 02:32

Welcome Norb,

Thanks for your feedbacks.

I would like to be able to find a way to regenerate an SPR file from the PNG that sound stupidly simple but I do not succed, :(
So I have tried several ways but none working if you can help me I would appreciate

I don't know the reason you want to regenerate SPR files from the PGN, only the PC version uses the SPR files.
The Atari and Amiga disks don't have a file system.

You are right when you say SPR files are raw format (without palette): interleaved for Atari & PC, planar for Amiga.
The best tool to read this kind of files is for example GfxRip (you can find some tutorials with google).

I needed to create custom SPR files from the Atari disk to compare them with the PC sprites (and so be sure the PC version don't have extra sprites). That's all.

If your objective is to update some sprites of the PC version you need to encode the sprites to SPR files (interleaved format).
If your objective is to update some sprites of the Atari or Amiga version, it's a bit harder because you need to:
- encode back the sprites in interleaved (Atari) or planar (Amiga) format
- inject the sprites directly to the disk at the correct offset

Or maybe you want to do something else ?
Before going deeper in the explanation, can you tell me me what you want to do ?
Kroah
Site Admin
 
Posts: 414
Joined: 07 Feb 2006, 01:01
Location: France

Re: SpeedBall 2 SPR

Postby norb » 12 Nov 2013, 22:44

Thanks for your reply.

I wanted to mod the game (christmas edition :) and perhaps more)

Since I didn't want to use standard SPR format and find out all change needed to use them ( yes lazy reason :) ) I wanted to :
-Load the PNG
-create SPR
-inject it in the DUMP // or just change the loading of ressource to use the SPR (not that difficult)

but I failed in creating the SPR because during the conversion the BMP header are kept (at least I think that is the mistake I do :))

here the method I'm using :
Image img = Image.FromFile(@".\Amiga\sprites\players_blue_spr\000.png");
MemoryStream ms = new MemoryStream();
img.Save(ms, ImageFormat.Bmp);
byte[] bitmapData = ms.ToArray();
img = Image.FromFile(@".\Amiga\sprites\players_blue_spr\001.png");
ms = new MemoryStream();
img.Save(ms, ImageFormat.Bmp);
bitmapData = bitmapData.Concat(ms.ToArray());
bitmapData.WriteToFile("t.spr");


Thanks.
norb
 
Posts: 2
Joined: 12 Nov 2013, 00:45

Re: SpeedBall 2 SPR

Postby Kroah » 13 Nov 2013, 23:54

Hello,

The raw format "interleaved" or "planar" isn't compatible at all with the bmp format (with or without header) :
Atari: interleaved on 4 bitplanes (=16 colors)
Amiga: planar on 5 bitplanes (=32 colors)

Interleaved and planar use indexed color (on 4 or 5 bitplanes) which refer to a color inside a color map table (usually called palette).
BMP uses (mainly) direct color encoding (something like RGB, ARGB, etc.), and don't use a palette.

The source code contains the algorithm: "raw (interleaved and planar for 4 or 5 bitplanes) => bmp (ARGB)".
You need an algorithm which do the opposite: "bmp (ARGB) => raw (interleaved or planar)" (depending of the target system).
This is not easy because "indexed color => direct color" is trivial, but "direct color => indexed color" isn't.

Imho, it will be easier to extract the sprites (from the dump, not the PNG) to an indexed color format (4 or 5 bitplanes, depending of the system), edit them with a tool compatible with the indexed color format, then convert them back.

On which platform do you want to do the mod ? (atari, amiga, pc ?)

PS: you can read :
- http://en.wikipedia.org/wiki/Color_depth if you need some explanation about indexed/direct color format.
- http://en.wikipedia.org/wiki/Indexed_color#Image_file_formats_supporting_indexed_color for some (not exhaustive) file formats supporting indexed color.
Kroah
Site Admin
 
Posts: 414
Joined: 07 Feb 2006, 01:01
Location: France


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 1 guest

cron