WizzardMaker / S4GFX

A tool to extract Settlers 4 assets

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Max 253 colors for a image

WizzardMaker opened this issue · comments

It seems like we are limited to 253 colors for new images.

GFX files use 1 byte offsets to get the palette offset for the needed color -> 255 max offset
0x0 and 0x1 are used to define transparency and shadows respectively.

It's a base limitation of the engine as far as I can see it.

commented

I think this can be easily circumvented by memory hacking the DDPIXELFORMAT structure such that the DirectDrawSurfaces are initialized with true RGB24 data (and not using the paletized images at all).

If the game does weird stuff, we could mark each image in the GFX archive with a 4 byte identifier (ie replace the first 4 pixels of each image and make them represent a unique number). The rest of the gfx image data is irrelevant and we may just provide dummy images/palettes. When ingame we intercept the DirectDrawSurface initialization, find the 4 byte identifier in the gfx image data and then use this to load our high quality RGB24 image data and use it to build a DirectDrawSurface.

Computers these days have plenty of memory so I see no problem in doing this.

The memory hacking is probably necessary anyway if we want to crank up the resolution. We would just have to provide a ddraw proxy dll that does all this.

Could work, but I think that stretches this project a bit to far. @nyfrk

Also, max 253 colors for a JIL collection (connected images), as they share the same palette offset. Tried to remove the DIL/JIL system, but its hardcoded and the game uses it to a greater extend than expected.