Jump to content

Recommended Posts

Posted

Hello Everyone.

I want to edit fonts from Desperados 2: Cooper's Revenge game.

Apparently game is using some own fonts format saved as .raw files but I cannot find out how to convert the files to some editable graphic format and back.

When I search for data I can see the characters in .raw files, but I do not understand the structure to convert it to dds and back.

The .dat file is font configuration, I believe every character is configured like this:

    class Glyph
    {
        public ushort Id; // Character - " ! @ # ....
        public ushort X;  // Position from left (px)
        public ushort Y;   // Positipn from top (px)
        public byte Width;  // px
        public byte Height;  // px
        public ushort FFEE; // unknown
    }

However when I try to preview the texture it is bigger that coordinates in .dat file. IS this because of transparent layer or some padding?

From. dat configuration it looks like the texture is 1024x256 px, but .raw texture is 2048x512.

 

When I save the font file as .dds the file size is about 628 kB, however the .raw size is 4 MB. The size of characters in picture is correct - the .dat file says each character is about 79 pixels high which match the size in GIMP.

 

Miserable_S079_en_p0.zipimage.thumb.png.6c0a0727ed92fc50f8a4f52c8a1c57af.png

Posted
28 minutes ago, ikskoks said:

If it's BGR565 as you showed, then you can easily preview it in ImageHeat

obraz.thumb.png.cb1bbd9ae6653c115e3ed0a012727742.png

 

Then you can write a short conversion script using ReverseBx directly:
https://github.com/bartlomiejduda/Tools/tree/master/ReverseBox_Demo

 

How to decide which format is correct?

There are multiple format and many of them works: BGRX8888, RGBA8888 and so on.

 

I have this exact texture in .dds format (with transparency) and I want to create the .raw file from .dds.

 

image.thumb.png.b246237547a4bed8c0eade0b8c08b00e.png

  • Moderators
Posted

Not possible without better samples 😄 (like colorful backgrounds, game textures etc.)
You have to guess.


Check out "example 1" from the link I shared above to get the idea how to convert from DDS to RAW.

  • Like 1
Posted

> How to decide which format is correct?

b8g8r8x8 is likely here, as you can see:

  • The alpha channel (4th byte) is always zero padding, and so it's neither BGRA nor RGBA because then all values would be fully transparent.
  • You can see all 3 color channels are identical bytes (grayscale), and so channels are 8-bit.
  • This game runs on Windows which means it's likely using Direct3D, which means it probably defaults to DXGI_FORMAT_B8G8R8X8_UNORM. It could be RGB (notably if using OpenGL, or using D3D with custom pixel shaders), but if using D3D, then there is no such format as DXGI_FORMAT_R8G8B8X8_UNORM, making that less likely. The easiest way to find out would be to overwrite some bytes and see how it changes the colors in-game. Anyway it doesn't much matter since the texture is grayscale.

image.png.3234cffab398ae265cdf03bb4054e4be.png

image.thumb.png.0b7b720a3bf1d81343cd6f005e04b61f.png

  • Like 2

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...