luxalpa / openhexplore

Reverse Engineering Project of the 1998 game Hexplore
5 stars 1 forks source link

Trying to contact you. #1

Open malespiaut opened 6 months ago

malespiaut commented 6 months ago

Hello,

I've stumbled upon your project after looking for some info about Hexplore.

I'm currently trying to reverse engineer the file formats of the game. I've made some progress on the SB0 files which holds the graphics, but I'm stuck because most of them are compressed with an unknown algorithm (RLE? Huffman? LZ77/LZSS? Variant?).

Here's my pattern script for use with the hex editor ImHex, for analysis of the SB0 files:

#pragma author Marc-Alexandre Espiaut
#pragma description Hexplore SB0 image format

struct SB0Header {
  char magic[4];
  u32 unk1; // Always 0x100 (256) number of colors ?
  u32 number_of_images; 
  u32 number_of_weirdtable;
  padding[8];
  u32 offset_table; // Always 0x3C; the header have a fixed size.
  u32 offset_weirdtable;
  u32 offset_graphics;
  // There's NO variation from offset_graphics for the next values
  u32 offset_graphics_1;
  u32 offset_graphics_2;
  padding[8];
  u32 offset_graphics_3;
  u32 offset_graphics_4;
};

// I still don't know what is the true meaning of any of these bits.
// Names shouldn't be taken seriously.
bitfield ImageType {
  used : 1;
  padding : 5;
  compressed1 : 1;
  compressed2 : 1;
  padding : 8;
};

struct SB0Table {
  ImageType type;
  u16 width;
  u16 height;
  padding[2];
  u32 offset;
};

// I don't understand what this structure is all about.
// Not all SB0 files have it.
struct WeirdTable {
  u32 unk1; // Does nothing??????
  u32 unk2; // index?
  u16 unk3; // Does nothing??????
  u16 unk4; // Does nothing??????
  u32 unk5; // Padding?
  u32 unk6; // Padding?
};

SB0Header sb0_header @0x00;
SB0Table sb0_table[sb0_header.number_of_images] @sb0_header.offset_table;

WeirdTable sb0_wt[sb0_header.number_of_weirdtable] @sb0_header.offset_weirdtable;

The color palette is the file clut/gameclut.rgb.

clut/gameclut.rgb Hexplore 256 color palette

If you have any information about that, hit me up!

Best regards.

luxalpa commented 6 months ago

Hey,

I have reverse engineered the file format for SB0 and VB1 files back in 2010, and also did some major progress on the files for the maps as well (including a map viewer). I have some code, but it is really old (like really old), and quality of that code isn't amazing.

I just uploaded it if you want to have a look at it: https://drive.google.com/file/d/1vKzoc57Sgypi1ii0rL2kzImUc45WkzRH/view?usp=sharing

The WeirdTable is metadata associated with the images. I think the game can load the same image multiple times but with different meta data or something like that.

malespiaut commented 6 months ago

Hello,

Thank you very much! I was starting the VB1 reverse engineering just yesterday, only to discover what a mess of pointers it is! 😂

Thank you for the explaination of my WeirdTable, hahaha! I'm going to have a look at your google drive immediatly!