diff --git a/README.md b/README.md index 55e004aa..44d79040 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,7 @@ Everything will immediately show up in ImHex's Content Store and gets bundled wi | ARC | | [`patterns/arc.hexpat`](patterns/arc.hexpat) | Minecraft Legacy Console Edition ARC files | | ARIA2 | | [`patterns/aria2.hexpat`](patterns/aria2.hexpat) | ARIA2 Download Manager Control files | | ARM VTOR | | [`patterns/arm_cm_vtor.hexpat`](patterns/arm_cm_vtor.hexpat) | ARM Cortex M Vector Table Layout | +| Assassin's Creed: Unity | | [`patterns/Assassin's Creed: Unity`](patterns/Assassin's Creed: Unity) | Assassin's Creed: Unity archive files -- .forge & .data (compressed and decompressed) -- | | Bastion | | [`patterns/bastion/*`](https://gitlab.com/EvelynTSMG/imhex-bastion-pats) | Various [Bastion](https://en.wikipedia.org/wiki/Bastion_(video_game)) files | | BeyondCompare BCSS | | [`patterns/bcss.hexpat`](patterns/bcss.hexpat) | BeyondCompare Snapshot (BCSS) file | | Bencode | `application/x-bittorrent` | [`patterns/bencode.hexpat`](patterns/bencode.hexpat) | Bencode encoding, used by Torrent files | @@ -57,6 +58,7 @@ Everything will immediately show up in ImHex's Content Store and gets bundled wi | CREDHIST | | [`patterns/credhist.hexpat`](patterns/credhist.hexpat) | CREDHIST Format | | DDS | `image/vnd-ms.dds` | [`patterns/dds.hexpat`](patterns/dds.hexpat) | DirectDraw Surface | | DEX | | [`patterns/dex.hexpat`](patterns/dex.hexpat) | Dalvik EXecutable Format | +| Devil May Cry HD Collection | | [`patterns/Devil May Cry HD Collection`](patterns/Devil May Cry HD Collection) | 3D Model files used in Devil May Cry 3 HD Collection | | DICOM | `application/dicom` | [`patterns/dicom.hexpat`](patterns/dicom.hexpat) | DICOM image format | | DMG | | [`patterns/dmg.hexpat`](patterns/dmg.hexpat) | Apple Disk Image Trailer (DMG) | | DMP | | [`patterns/dmp64.hexpat`](patterns/dmp64.hexpat) | Windows Kernel Dump(DMP64) | @@ -198,6 +200,8 @@ Everything will immediately show up in ImHex's Content Store and gets bundled wi | ZLIB | `application/zlib` | [`patterns/zlib.hexpat`](patterns/zlib.hexpat) | ZLIB compressed data format | | ZSTD | `application/zstd` | [`patterns/zstd.hexpat`](patterns/zstd.hexpat) | Zstandard compressed data format | + + ### Scripts | Name | Path | Description | diff --git a/patterns/Assassin's Creed: Unity/acu_data_compressed.hexpat b/patterns/Assassin's Creed: Unity/acu_data_compressed.hexpat new file mode 100644 index 00000000..cab12712 --- /dev/null +++ b/patterns/Assassin's Creed: Unity/acu_data_compressed.hexpat @@ -0,0 +1,47 @@ +#pragma description Assassin's Creed: Unity's Compressed .data file +#pragma author haru233 + +// many thanks to AxCut +// ImHex Hex Pattern File for Assassin's Creed: Unity's Compressed .data files + + +import std.core; +import std.mem; + +enum CompressionType : u8 { + LZO1X_ = 0x00, // Both 0x00 and 0x01 mean LZO1X + LZO1X = 0x01, + LZO2A = 0x02, + xmemdecompress = 0x03, + LZO1C = 0x05 +}; + +struct CHUNK { + u16 Uncompressed_Size; + u16 Compressed_Size; +}; + +struct CHUNK_Data { + u32 Hash; + + u64 i = std::core::array_index(); + u8 data[parent.chunk[i].Compressed_Size]; +}; + +struct PACK { + u64 ID; + padding[2]; + CompressionType Compression_Type; + padding[3]; + u8 Version; + u16 CHUNK_Count; + + CHUNK chunk[CHUNK_Count]; + CHUNK_Data data[CHUNK_Count]; + + +}; + + + +PACK pack[while(!std::mem::eof())] @0x00; diff --git a/patterns/Assassin's Creed: Unity/acu_data_decompressed.hexpat b/patterns/Assassin's Creed: Unity/acu_data_decompressed.hexpat new file mode 100644 index 00000000..84e34e78 --- /dev/null +++ b/patterns/Assassin's Creed: Unity/acu_data_decompressed.hexpat @@ -0,0 +1,93 @@ +#pragma description Assassin's Creed: Unity's Decompressed .data file +#pragma author haru233 + +// Thanks to yretenai on GitHub for helping with the Block Allocator part + +import std.core; +import std.mem; + +struct Block_Allocator_Type0 { + padding[4]; + u32 Class_ID; + u32 Size; +}; + +struct Block_Allocator_Type1 { + padding[4]; + u32 Type_ID; + u32 Size; +}; + +struct Block_Allocator { + u16 Version; + + if (Version == 0) { + u32 Block_Allocator_Number; + Block_Allocator_Type0 block_allocator_type0[Block_Allocator_Number]; + } + + else if (Version == 1) { + u32 Block_Allocator_Number; + Block_Allocator_Type1 block_allocator_type1_[Block_Allocator_Number]; + } + + else if (Version == 2) { + bool Has_Secondary_Block_Allocator; + u32 Main_Block_Allocator_Number; + + Block_Allocator_Type1 block_allocator_type1__[Main_Block_Allocator_Number]; + + if (Has_Secondary_Block_Allocator) { + u32 Secondary_Block_Allocator_Number; + Block_Allocator_Type1 block_allocator_type1___[Secondary_Block_Allocator_Number+1]; + } + } + + +}; + +struct File { + u32 Object_Hash; + u32 File_Size; + u32 Filename_Length; + + if (File_Size > 0) { + if (Filename_Length == 0) { + bool HasBlockAllocator; + + if (HasBlockAllocator) { + Block_Allocator block_allocator; + u8 File_Data[File_Size]; + } + + else + u8 File_Data[File_Size]; + } + + else { + char Filename[Filename_Length]; + + bool HasBlockAllocator; + + if (HasBlockAllocator) { + Block_Allocator block_allocator; + u8 File_Data[File_Size]; + } + + else + u8 File_Data[File_Size]; + + + } + + } + + else + continue; + + + +}; + + +File file[while(!std::mem::eof())] @0x00; diff --git a/patterns/Assassin's Creed: Unity/acu_forge.hexpat b/patterns/Assassin's Creed: Unity/acu_forge.hexpat new file mode 100644 index 00000000..e000a492 --- /dev/null +++ b/patterns/Assassin's Creed: Unity/acu_forge.hexpat @@ -0,0 +1,64 @@ +#pragma description Assassin's Creed: Unity's .forge archive file +#pragma author haru233 + +// many thanks to AxCut +// ImHex Hex Pattern File for Assassin's Creed: Unity's .forge files + +import std.core; + +struct Forge_Header { + char MAGIC[8]; + padding[1]; + u32 Version; + u32 File_Data_Header_Offset; +}; + +struct File_Data_Header { + u32 File_Count; + padding[32]; + u64 File_Data_Header2_Offset; +}; + +struct File_Data_Header2 { + u32 File_Count2; + padding[4]; + u64 File_Table_Offset; + padding[12]; + u32 File_Count3; + u64 File_Name_Table_Offset; + padding[8]; +}; + + +struct File_Table { + u64 Raw_Data_Offset; + u64 File_ID; + u32 Raw_Data_Size; +}; + +struct File_Name_Table { + u32 Raw_Data_Size; + padding[40]; + char Filename[128]; + padding[20]; +}; + + +Forge_Header forge_header @0x00; + +File_Data_Header file_data_header @(forge_header.File_Data_Header_Offset); + +File_Data_Header2 file_data_header2 @(file_data_header.File_Data_Header2_Offset); + +File_Table file_table[file_data_header.File_Count] @(file_data_header2.File_Table_Offset); + +File_Name_Table file_name_table[file_data_header.File_Count] @(file_data_header2.File_Name_Table_Offset); + + +struct Raw_Data_Table { + u64 i = std::core::array_index(); + u8 Raw_Data[file_table[i].Raw_Data_Size] @ file_table[i].Raw_Data_Offset; +}; + + +Raw_Data_Table raw_data_table[file_data_header.File_Count] @0x00; diff --git a/patterns/Devil May Cry HD Collection/dmc3_hd_mod.hexpat b/patterns/Devil May Cry HD Collection/dmc3_hd_mod.hexpat new file mode 100644 index 00000000..67a4ebac --- /dev/null +++ b/patterns/Devil May Cry HD Collection/dmc3_hd_mod.hexpat @@ -0,0 +1,165 @@ +#pragma description Devil May Cry 3 HD .mod 3D model file +#pragma author haru233 + +// many thanks to AxCut +// ImHex Hex Pattern File for Capcom's Devil May Cry 3 HD .mod files + + +import std.core; + + +struct ModelHeader { + char ID[4]; + float Version; + padding[8]; + u8 objectCount; + u8 boneCount; + u8 numberTextures; + u8; + u32; + u64; + u64 skeletonOffset; + padding[24]; +}; + +struct ObjectInfo { + u8 meshCount; + u8; + u16 numberVertices; + padding[4]; + u64 meshOffset; + u32 flags; + padding[28]; + float X, Y, Z; + float radius; +}; + +struct Positions { + float positions[3]; +}; + + +struct Normals { + float normal[3]; +}; + + +struct UVs { + s16 uv[2]; +}; + +struct BoneIndices { + u8 boneindex[4]; +}; + +struct Weights { + u16 weight[1]; +}; + +struct MeshSCM { + u16 numberVertices; + u16 textureIndex; + padding[12]; + u64 VerticesPositionsOffset; + u64 NormalsPositionsOffset; + u64 UVsPositionsOffset; + + padding[16]; + u64 unknownOffset; + + u64; + padding[8]; + + Positions positions[numberVertices] @VerticesPositionsOffset; + Normals normals[numberVertices] @NormalsPositionsOffset; + UVs uvs[numberVertices] @UVsPositionsOffset; + + +}; + +struct Mesh { + u16 numberVertices; + u16 textureIndex; + padding[12]; + u64 VerticesPositionsOffset; + u64 NormalsPositionsOffset; + u64 UVsPositionsOffset; + + u64 BoneIndicesOffset; + u64 WeightsOffset; + padding[8]; + + u64; + padding[8]; + + Positions positions[numberVertices] @VerticesPositionsOffset; + Normals normals[numberVertices] @NormalsPositionsOffset; + UVs uvs[numberVertices] @UVsPositionsOffset; + + BoneIndices b_index[numberVertices] @BoneIndicesOffset; + Weights weights[numberVertices] @WeightsOffset; + + +}; + + +struct Hierarchy { + u8 hierarchy; +}; + +struct HierarchyOrder { + u8 hierarchyorder; +}; + +struct Unknown { + u8; +}; + +struct Transform { + float x; + float y; + float z; + float length; // sqrt(x*x + y*y + z*z) + padding[16]; +}; + +struct Skeleton{ + u32 hierarchyOffset; + u32 hierarchyOrderOffset; + u32 unknownOffset; + u32 transformsOffset; +}; + + + + + +ModelHeader modelheader @ 0x00; +ObjectInfo objects_info[modelheader.objectCount] @ 0x40; + +u32 objectOffset; + +struct Object { + u64 i = std::core::array_index(); + if (modelheader.ID == "SCM ") { + objectOffset = objects_info[0].meshOffset; + MeshSCM meshscm[objects_info[i].meshCount] @ objects_info[i].meshOffset; + + + } else { + objectOffset = objects_info[0].meshOffset; + Mesh mesh[objects_info[i].meshCount] @ objects_info[i].meshOffset; + } +}; + +Object objects[modelheader.objectCount] @objectOffset; + +Skeleton skeleton @modelheader.skeletonOffset; + +Hierarchy hierarchy[modelheader.boneCount] @(modelheader.skeletonOffset + skeleton.hierarchyOffset); + +HierarchyOrder hierarchyorder[modelheader.boneCount] @(modelheader.skeletonOffset + skeleton.hierarchyOrderOffset); + +Unknown unknown[modelheader.boneCount] @(modelheader.skeletonOffset + skeleton.unknownOffset); + +Transform transform[modelheader.boneCount] @(modelheader.skeletonOffset + skeleton.transformsOffset);