diff --git a/README.md b/README.md index bfe02ab..a538f2d 100644 --- a/README.md +++ b/README.md @@ -65,6 +65,10 @@ Hex patterns, include patterns and magic files for the use with the ImHex Hex Ed | CHM | | [`patterns/chm.hexpat`](patterns/chm.hexpat) | Windows HtmlHelp Data (ITSF / CHM) | | DMG | | [`patterns/dmg.hexpat`](patterns/dmg.hexpat) | Apple Disk Image Trailer (DMG) | | XBEH | `audio/x-xbox-executable` | [`patterns/xbeh.hexpat`](patterns/xbeh.hexpat) | Xbox executable | +| QBCL | | [`patterns/qbcl.hexpat`](patterns/qbcl.hexpat) | Qubicle voxel scene project file | +| CCHVA | | [`patterns/cchva.hexpat`](patterns/cchva.hexpat) | Command and Conquer Voxel Animation | +| CCVXL | | [`patterns/ccvxl.hexpat`](patterns/ccvxl.hexpat) | Command and Conquer Voxel Model | +| CCPAL | | [`patterns/ccpal.hexpat`](patterns/ccpal.hexpat) | Command and Conquer Voxel Palette | ### Scripts diff --git a/patterns/cchva.hexpat b/patterns/cchva.hexpat new file mode 100644 index 0000000..971009c --- /dev/null +++ b/patterns/cchva.hexpat @@ -0,0 +1,30 @@ +// Command and conquer voxel animation format + +struct vec4_s { + float x [[color("FF0000")]]; + float y [[color("00FF00")]]; + float z [[color("0000FF")]]; + float w [[color("FFFF00")]]; +}; + +struct mat3x4_s { + vec4_s row[3]; +}; + +struct name_s { + char buffer[16] [[color("EECCCC")]]; +}; + +struct hva_s { + name_s name; + u32 numFrames; + u32 numNodes; + name_s nodeNames[numNodes]; +}; + +struct frame_s { + mat3x4_s mat[hva.numNodes]; +}; + +hva_s hva @0x00; +frame_s frames[hva.numFrames] @sizeof(hva); diff --git a/patterns/ccpal.hexpat b/patterns/ccpal.hexpat new file mode 100644 index 0000000..c7d7c13 --- /dev/null +++ b/patterns/ccpal.hexpat @@ -0,0 +1,13 @@ +// Command and conquer palette format + +struct Color { + u8 r; + u8 g; + u8 b; +}; + +struct Palette { + Color colors[256]; +}; + +Palette pal @0x00; diff --git a/patterns/ccvxl.hexpat b/patterns/ccvxl.hexpat new file mode 100644 index 0000000..dcda5c3 --- /dev/null +++ b/patterns/ccvxl.hexpat @@ -0,0 +1,69 @@ +// Command and Conquer voxel model format + +struct vec4_s { + float x [[color("FF0000")]]; + float y [[color("00FF00")]]; + float z [[color("0000FF")]]; + float w [[color("FFFF00")]]; +}; + +struct vec3_s { + float x [[color("FF0000")]]; + float y [[color("00FF00")]]; + float z [[color("0000FF")]]; +}; + +struct mat3x4_s { + vec4_s row[3]; +}; + +struct name_s { + char buffer[16] [[color("EECCCC")]]; +}; + +struct color_s { + u8 r; + u8 g; + u8 b; +}; + +struct vxl_limb_header_s { + name_s name; + s32 limb_number; + u32 _reserved1; + u32 _reserved2; +}; + +struct vxl_limb_tailer_s { + u32 span_start_offset; + u32 span_end_offset; + u32 span_data_offset; + float scale; + mat3x4_s matrix; + vec3_s min_bounds; + vec3_s max_bounds; + u8 xsize; + u8 ysize; + u8 zsize; + u8 normal_type; +}; + +struct vxl_s { + name_s name; + u32 palette_count; + u32 limb_count; + u32 tailer_count; + u32 body_size; + u8 remap_start_index; + u8 remap_end_index; + color_s internal_palette[256]; + vxl_limb_header_s _headers[limb_count]; + u8 body[body_size]; + vxl_limb_tailer_s _tailers[limb_count]; +}; + +struct frame_s { + mat3x4_s mat[hva.numNodes]; +}; + +vxl_s vxl @0x00; diff --git a/patterns/qbcl.hexpat b/patterns/qbcl.hexpat new file mode 100644 index 0000000..04e8b30 --- /dev/null +++ b/patterns/qbcl.hexpat @@ -0,0 +1,80 @@ +// Qubicle QBCL format + +struct String { + u32 len; + char string[len]; +}; + +struct Matrix { + u32 sizex; + u32 sizey; + u32 sizez; + s32 tx; + s32 ty; + s32 tz; + float pivotx; + float pivoty; + float pivotz; + u32 compressedDataSize; + u8 zip[compressedDataSize]; +}; + +// Rotation matrix according to wikipedia +// https://en.wikipedia.org/wiki/Rotation_matrix#Basic_rotations +struct Matrices { + float row1[3]; + float row2[3]; + float row3[3]; +}; + +using Node; + +struct Model { + Matrices rotation; + u32 childCount; + Node nodes[childCount]; +}; + +struct Compound { + Matrix matrix; + u32 childCount; + Node nodes[childCount]; +}; + +struct Node { + u32 type; + u32 unknown; + String name; + u8 visible; + u8 unknown2; + u8 locked; + if (type == 0) { + Matrix matrix; + } else if (type == 1) { + Model model; + } else if (type == 2) { + Compound compound; + } +}; + +struct Header { + u32 magic; + u32 version; + u32 fileversion; + u32 thumbwidth; + u32 thumbheight; + char bgra[thumbwidth * thumbheight * 4]; + String title; + String desc; + String metadata; + String author; + String company; + String website; + String copyright; + // Maybe change and creation time? + double time1; + double time2; + Node node; +}; + +Header hdr @0x00; diff --git a/tests/patterns/ccvxl.hexpat.vxl b/tests/patterns/ccvxl.hexpat.vxl new file mode 100644 index 0000000..7c62535 Binary files /dev/null and b/tests/patterns/ccvxl.hexpat.vxl differ