diff --git a/README.md b/README.md index 21cd1a5..caebdf2 100644 --- a/README.md +++ b/README.md @@ -48,6 +48,7 @@ Everything will immediately show up in ImHex's Content Store and gets bundled wi | DTA | | [`patterns/max_v104.hexpat`](patterns/max_v104.hexpat) | Mechanized Assault and Exploration v1.04 (strategy game) save file format | | ELF | `application/x-executable` | [`patterns/elf.hexpat`](patterns/elf.hexpat) | ELF header in elf binaries | | EVTX | | [`patterns/evtx.hexpat`](patterns/evtx.hexpat) | MS Windows Vista Event Log | +| FAS | | [`patterns/fas_oskasoftware.hexpat`](patterns/fas_oskasoftware.hexpat) [`patterns/fas_oskasoftware_old.hexpat`](patterns/fas_oskasoftware_old.hexpat) (Old versions of Oska DeskMate) | Oska Software DeskMates FAS (Frames and Sequences) file | | FDT | | [`patterns/fdt.hexpat`](patterns/fdt.hexpat) | Flat Linux Device Tree blob | | File System | | [`patterns/fs.hexpat`](patterns/fs.hexpat) | Drive File System | | FLAC | `audio/flac` | [`patterns/flac.hexpat`](patterns/flac.hexpat) | Free Lossless Audio Codec, FLAC Audio Format | @@ -104,6 +105,7 @@ Everything will immediately show up in ImHex's Content Store and gets bundled wi | VDF | | [`patterns/vdf.hexpat`](patterns/vdf.hexpat) | Binary Value Data Format (.vdf) files | | VHDX | | [`patterns/vhdx.hexpat`](patterns/vhdx.hexpat) | Microsoft Hyper-V Virtual Hard Disk format | | WAV | `audio/x-wav` | [`patterns/wav.hexpat`](patterns/wav.hexpat) | RIFF header, WAVE header, PCM header | +| WAS | | [`patterns\was_oskasoftware.hexpat`](patterns\was_oskasoftware.hexpat) | Oska Software DeskMates WAS/WA3 (WAVE/MP3 Set) file | WAD | | [`patterns/wad.hexpat`](patterns/wad.hexpat) | DOOM WAD Archive | | XBEH | `audio/x-xbox-executable` | [`patterns/xbeh.hexpat`](patterns/xbeh.hexpat) | Xbox executable | | XCI | | [`patterns/xci.hexpat`](patterns/xci.hexpat) | Nintendo Switch XCI cardridge ROM | diff --git a/patterns/fas_oskasoftware.hexpat b/patterns/fas_oskasoftware.hexpat new file mode 100644 index 0000000..617ba4b --- /dev/null +++ b/patterns/fas_oskasoftware.hexpat @@ -0,0 +1,111 @@ +#pragma author DmitriLeon2000 +#pragma description Oska Software DeskMates FAS (Frames and Sequences) file +#pragma endian little + +enum Compression : u32 { + BI_RGB, + BI_RLE8, + BI_RLE4, + BI_BITFIELDS, + BI_JPEG, + BI_PNG, + BI_ALPHABITFIELDS, + BI_CMYK, + BI_CMYKRLE8, + BI_CMYKRLE4, +}; + +struct Colors { + u8 blue; + u8 green; + u8 red; + u8 reserved; +}; + +struct FASHeader { + char name[50]; // name of the pack, may include garbage data + u16 version; // Format version number + s16 frameIDFirst; // assigned ID of the first frame + s16 frameIDLast; // assigned ID of the last frame + s32 width; // width of the animation (in pixels) + s32 height; // height of the animation (in pixels) + u16 frameSize; // size of the animation ((frameWidth * BPP + 31) // 32 * 4 * frameHeight) + u16 DblHeaderCount; // amount of BitmapInfoHeader pairs (one for color, one for masking) +}; + +struct BitmapInfoHeader { // bog-standard BitmapInfoHeaderV1 + u32 biSize; + s32 biWidth; + s32 biHeight; + u16 biPlanes; + u16 biBitCount; + Compression compression; + u32 biSizeImage; + s32 biXPelsPerMeter; + s32 biYPelsPerMeter; + u32 biClrUsed; + u32 biClrImportant; +}; + +struct BitmapInfo { + BitmapInfoHeader header; + Colors colorMap[header.biClrUsed == 0 ? + 1 << header.biBitCount : header.biClrUsed]; +}; + +struct ExtraSprite { + char name[]; +}; + +struct AnimSequence { + char name[]; + char sequence[]; +}; + +struct SeqHeader { + le u32 size; + le u32 count; + le u32 strPointers[count*2]; +}; + +struct Bitmap { + u8 byte[fas.fasHeader.version >= 3 ? fas.fasHeader.frameSize + (fas.frameSizeHigh << 16) : fas.fasHeader.frameSize]; +}; + +struct FramesHeader { + le u32 count; + le s16 frameID[count]; + u8 frameDblHdrID[count]; +}; + +struct FAS { + FASHeader fasHeader; + BitmapInfo dibHeaders[fasHeader.DblHeaderCount * 2]; + if (fasHeader.version >= 1) + u8 charID; + if (fasHeader.version >= 2) + { + u32 extraEndOffset; + u16 extraSpritesCount; + if (extraSpritesCount) + // char extraSpriteList[touchOffset - 6]; + ExtraSprite extraSprites[extraSpritesCount]; + } + if (fasHeader.version >= 3) + le u16 frameSizeHigh; + le u16 touchColors; + if (touchColors) + { + u32 touchColorMap[touchColors]; + u16 touchWidth; + u8 touchBitmap[this.touchWidth * fasHeader.height]; + } + SeqHeader seqHeader; + if (fasHeader.version >= 1) + u8 filenameChecksum; // a checksum for a filename in ASCII + AnimSequence sequences[seqHeader.count]; + FramesHeader framesHeader; +}; + +FAS fas @ 0x00; +Bitmap framesBitmap[fas.framesHeader.count] @ $; \ No newline at end of file diff --git a/patterns/fas_oskasoftware_old.hexpat b/patterns/fas_oskasoftware_old.hexpat new file mode 100644 index 0000000..9c7e790 --- /dev/null +++ b/patterns/fas_oskasoftware_old.hexpat @@ -0,0 +1,87 @@ +#pragma author DmitriLeon2000 +#pragma description Oska Software DeskMates FAS (Frames and Sequences) file (Oska DeskMate versions 1.3 and 2.06) +#pragma endian little + +enum Compression : u32 { + BI_RGB, + BI_RLE8, + BI_RLE4, + BI_BITFIELDS, + BI_JPEG, + BI_PNG, + BI_ALPHABITFIELDS, + BI_CMYK, + BI_CMYKRLE8, + BI_CMYKRLE4, +}; + +struct Colors { + u8 blue; + u8 green; + u8 red; + u8 reserved; +}; + +struct FASHeader { + s32 width; // width of the animation (in pixels) + s32 height; // height of the animation (in pixels) + u16 reserved1; + u16 reserved2; + u16 frameSizeCombined; // a sum of frameSizeColor and frameSizeMask + u16 frameSizeColor; // size of the animation ((frameWidth * 4 + 31) // 32 * 4 * frameHeight) + u16 frameSizeMask; // size of the animation's mask ((frameWidth * 1 + 31) // 32 * 4 * frameHeight) + u16 headerCount; // amount of DIB headers +}; + +struct BitmapInfoHeader { // bog-standard BitmapInfoHeaderV1 + u32 biSize; + s32 biWidth; + s32 biHeight; + u16 biPlanes; + u16 biBitCount; + Compression compression; + u32 biSizeImage; + s32 biXPelsPerMeter; + s32 biYPelsPerMeter; + u32 biClrUsed; + u32 biClrImportant; +}; + +struct BitmapInfo { + BitmapInfoHeader header; + le u32 colorMap[header.biClrUsed == 0 ? + 1 << header.biBitCount : header.biClrUsed]; +}; + +struct AnimSequence { + char name[]; + char sequence[]; +}; + +struct SeqHeader { + le u32 size; + le u32 count; + le u32 strPointers[count*2]; +}; + +struct Frame { + u8 colorBitmap[fas.fasHeader.frameSizeColor]; + u8 maskBitmap[fas.fasHeader.frameSizeMask]; +}; + +struct FramesHeader { + le u32 count; + le s16 frameID[count]; +}; + +struct FAS { + FASHeader fasHeader; + BitmapInfo dibHeaders[fasHeader.headerCount]; + SeqHeader seqHeader; + AnimSequence sequences[seqHeader.count]; + FramesHeader framesHeader; +}; + + +FAS fas @ 0x00; +Frame frames[fas.framesHeader.count] @ $; diff --git a/patterns/was_oskasoftware.hexpat b/patterns/was_oskasoftware.hexpat new file mode 100644 index 0000000..976adce --- /dev/null +++ b/patterns/was_oskasoftware.hexpat @@ -0,0 +1,24 @@ +#pragma author DmitriLeon2000 +#pragma description Oska Software DeskMates WAS/WA3 (WAVE/MP3 Set) file +#pragma endian little + +#include + +struct Sound { + char name[]; + u32 length; + u8 data[length]; +}; + +struct Header { + type::Size size; + u32 count; + u32 pointers[count * 2]; +}; + +struct WAS { + Header header; + Sound sounds[header.count]; +}; + +WAS was @ 0x00; \ No newline at end of file diff --git a/tests/patterns/test_data/was_oskasoftware.hexpat.was b/tests/patterns/test_data/was_oskasoftware.hexpat.was new file mode 100644 index 0000000..66d9332 Binary files /dev/null and b/tests/patterns/test_data/was_oskasoftware.hexpat.was differ