From c5aaac25dd3041e176c1d578ab6c3eb9969106d1 Mon Sep 17 00:00:00 2001 From: applecuckoo <113647417+applecuckoo@users.noreply.github.com> Date: Sat, 3 Aug 2024 20:47:40 +1200 Subject: [PATCH] patterns/uf2: Added Family ID enum to uf2.hexpat, Added missing description pragmas and other minor fixes (#282) * patterns/uf2: add family ID enum * patterns/uf2: Fix enum spacing * patterns: add missing description pragmas and README entries, etc. * patterns/uf2: add reference for Family ID enum --- README.md | 6 ++++ patterns/bplist.hexpat | 2 +- patterns/gguf.hexpat | 4 +-- patterns/gltf.hexpat | 6 ++-- patterns/pbz.hexpat | 3 ++ patterns/pkm.hexpat | 2 +- patterns/ras.hexpat | 4 +-- patterns/uf2.hexpat | 58 +++++++++++++++++++++++++++++++++++++- patterns/usb.hexpat | 2 +- patterns/wintec_tes.hexpat | 2 ++ patterns/xgspak.hexpat | 3 ++ patterns/xgstexture.hexpat | 3 ++ 12 files changed, 85 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 6ee669b..b2baab2 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,7 @@ Everything will immediately show up in ImHex's Content Store and gets bundled wi |------|------|------|-------------| | 3DS | | [`patterns/3ds.hexpat`](patterns/3ds.hexpat) | Autodesk 3DS Max Model file | | 7Z | | [`patterns/7z.hexpat`](patterns/7z.hexpat) | 7z File Format | +| ADTS | | [`patterns/adts.hexpat`(patterns/adts.hexpat) | ADTS/AAC audio files | | AFE2 | | [`patterns/afe2.hexpat`](patterns/afe2.hexpat) | Nintendo Switch Atmosphère CFW Fatal Error log | | ANI | `application/x-navi-animation` | [`patterns/ani.hexpat`](patterns/ani.hexpat) | Windows Animated Cursor file | | AR | `application/x-archive` | [`patterns/ar.hexpat`](patterns/ar.hexpat) | Static library archive files | @@ -32,6 +33,7 @@ Everything will immediately show up in ImHex's Content Store and gets bundled wi | ARM VTOR | | [`patterns/arm_cm_vtor.hexpat`](patterns/arm_cm_vtor.hexpat) | ARM Cortex M Vector Table Layout | | Bastion | | [`patterns/bastion/*`](https://gitlab.com/EvelynTSMG/imhex-bastion-pats) | Various [Bastion](https://en.wikipedia.org/wiki/Bastion_(video_game)) files | | Bencode | `application/x-bittorrent` | [`patterns/bencode.hexpat`](patterns/bencode.hexpat) | Bencode encoding, used by Torrent files | +| Prusa BGCODE | | [`patterns/bgcode.hexpat`](patterns/bgcode.hexpat) | PrusaSlicer Binary G-Code files | | BMP | `image/bmp` | [`patterns/bmp.hexpat`](patterns/bmp.hexpat) | OS2/Windows Bitmap files | | BIN | | [`patterns/selinux.hexpat`](patterns/selinux.pat) | SE Linux modules | | BSON | `application/bson` | [`patterns/bson.hexpat`](patterns/bson.hexpat) | BSON (Binary JSON) format | @@ -47,6 +49,7 @@ Everything will immediately show up in ImHex's Content Store and gets bundled wi | CrashLvl | | [`patterns/Crashlvl.hexpat`](patterns/Crashlvl.hexpat) | Crash Bandicoot - Back in Time (fan game) User created level format | | DDS | `image/vnd-ms.dds` | [`patterns/dds.hexpat`](patterns/dds.hexpat) | DirectDraw Surface | | DEX | | [`patterns/dex.hexpat`](patterns/dex.hexpat) | Dalvik EXecutable Format | +| DICOM | `application/dicom` | [`patterns/dicom.hexpat`](patterns/dicom.hexpat) | DICOM image format | | DMG | | [`patterns/dmg.hexpat`](patterns/dmg.hexpat) | Apple Disk Image Trailer (DMG) | | DS_Store | | [`patterns/dsstore.hexpat`](patterns/dsstore.hexpat) | .DS_Store file format | | DTA | | [`patterns/max_v104.hexpat`](patterns/max_v104.hexpat) | Mechanized Assault and Exploration v1.04 (strategy game) save file format | @@ -62,6 +65,7 @@ Everything will immediately show up in ImHex's Content Store and gets bundled wi | GB | `application/x-gameboy-rom` | [`patterns/gb.hexpat`](patterns/gb.hexpat) | Gameboy ROM | | GGUF | | [`patterns/gguf.hexpat`](patterns/gguf.hexpat) | GGML Inference Models | | GIF | `image/gif` | [`patterns/gif.hexpat`](patterns/gif.hexpat) | GIF image files | +| GLTF | `model/gltf-binary` | [`patterns/gltf.hexpat`](patterns/gltf.hexpat) | GL Transmission Format binary 3D model file | | GZIP | `application/gzip` | [`patterns/gzip.hexpat`](patterns/gzip.hexpat) | GZip compressed data format | | Halo Tag || [`patterns/hinf_tag.hexpat`](patterns/hinf_tag.hexpat) | Halo Infinite Tag Files | | Halo Module || [`patterns/hinf_module.hexpat`](patterns/hinf_module.hexpat) | Halo Infinite Module Archive Files | @@ -117,11 +121,13 @@ Everything will immediately show up in ImHex's Content Store and gets bundled wi | StuffItV5 | `application/x-stuffit` | [`patterns/sit5.hexpat`](patterns/sit5.hexpat) | StuffIt V5 archive | | SWF | |[`patterns/swf.hexpat`](patterns/swf.hexpat) | Shockwave Flash file format | | TAR | `application/x-tar` | [`patterns/tar.hexpat`](patterns/tar.hexpat) | Tar file format | +| TES | | [`patterns/wintec_tes.hexpat`](patterns/wintec_tes.hexpat) | Wintec TES GPS log | | TIFF | `image/tiff` | [`patterns/tiff.hexpat`](patterns/tiff.hexpat) | Tag Image File Format | | TGA | `image/tga` | [`patterns/tga.hexpat`](patterns/tga.hexpat) | Truevision TGA/TARGA image | | TTF | `font/ttf`, `font/otf` | [`patterns/ttf.hexpat`](patterns/ttf.hexpat) | TrueType and OpenType font format | | Ubiquiti | | [`patterns/ubiquiti.hexpat`](patterns/ubiquiti.hexpat) | Ubiquiti Firmware (update) image | | UEFI | | [`patterns/uefi.hexpat`](patterns/uefi.hexpat)` | UEFI structs for parsing efivars | +| UEFI Boot Entry | | [`patterns/uefi_boot_entry.hexpat`](patterns/uefi_boot_entry.hexpat) | UEFI Boot Entry (Load option) | | UF2 | | [`patterns/uf2.hexpat`](patterns/uf2.hexpat) | [USB Flashing Format](https://github.com/microsoft/uf2) | | VBMeta | | [`patterns/vbmeta.hexpat`](patterns/vbmeta.hexpat) | Android VBMeta image | | VDF | | [`patterns/vdf.hexpat`](patterns/vdf.hexpat) | Binary Value Data Format (.vdf) files | diff --git a/patterns/bplist.hexpat b/patterns/bplist.hexpat index f5e3a72..85a8038 100644 --- a/patterns/bplist.hexpat +++ b/patterns/bplist.hexpat @@ -1,4 +1,4 @@ -#pragma description TODO +#pragma description Apple binary property list import std.math; import std.core; diff --git a/patterns/gguf.hexpat b/patterns/gguf.hexpat index 0c62e43..0ca873d 100644 --- a/patterns/gguf.hexpat +++ b/patterns/gguf.hexpat @@ -1,7 +1,7 @@ // https://github.com/ggerganov/ggml/blob/master/docs/gguf.md // https://github.com/openxla/iree/blob/main/runtime/src/iree/io/formats/gguf/gguf_parser.c -#pragma description GGUF v3 File Format Patter +#pragma description GGUF v3 File Format Pattern #pragma authors @leonjza, jessie @ imhex discord #pragma pattern_limit 300000 @@ -212,4 +212,4 @@ struct gguf_file_t { u8 tensor_data[]; }; -gguf_file_t GGUF @ 0x00; \ No newline at end of file +gguf_file_t GGUF @ 0x00; diff --git a/patterns/gltf.hexpat b/patterns/gltf.hexpat index 69205e2..582a5e3 100644 --- a/patterns/gltf.hexpat +++ b/patterns/gltf.hexpat @@ -1,5 +1,5 @@ /** - * @file ImHex Pattern for glTF binary files. + * @file ImHex Pattern for glTF binary files. * * Copyright (c) 2023 H. Utku Maden * @@ -22,7 +22,9 @@ * SOFTWARE. */ -#pragma description TODO +#pragma author H. Utku Maden +#pragma description GL Transmission Format binary 3D model file (.glb) +#pragma MIME model/gltf-binary import std.mem; import std.io; diff --git a/patterns/pbz.hexpat b/patterns/pbz.hexpat index 1578a82..6272c85 100644 --- a/patterns/pbz.hexpat +++ b/patterns/pbz.hexpat @@ -6,6 +6,9 @@ // // SPDX-License-Identifier: GPL-2.0-or-later +#pragma author Nicolás Alvarez +#pragma description Apple pbz compressed file + import std.mem; import type.magic; diff --git a/patterns/pkm.hexpat b/patterns/pkm.hexpat index 2ce2180..7751dc3 100644 --- a/patterns/pkm.hexpat +++ b/patterns/pkm.hexpat @@ -1,5 +1,5 @@ -#pragma description PKM (PacKMan) files containing ETC (Ericsson Texture Compression) #pragma author applecuckoo +#pragma description PKM (PacKMan) files containing ETC (Ericsson Texture Compression) #pragma endian big enum PKMFormat : u16 { diff --git a/patterns/ras.hexpat b/patterns/ras.hexpat index 0c49f6c..e3c54d7 100644 --- a/patterns/ras.hexpat +++ b/patterns/ras.hexpat @@ -1,6 +1,6 @@ #pragma author Fl3ch4 -#pragma description TODO -#pragma MIME image/webp +#pragma description RAS image files +#pragma MIME image/x-sun-raster #pragma endian big diff --git a/patterns/uf2.hexpat b/patterns/uf2.hexpat index cdfce05..90089e9 100644 --- a/patterns/uf2.hexpat +++ b/patterns/uf2.hexpat @@ -39,6 +39,62 @@ enum UF2_TagTypeEnum : u32 { DeviceTypeIdentifier = 0xC8A729 }; +// reference: https://microsoft.github.io/uf2/utils/uf2families.json + +enum UF2_FamilyID : u32 { + ATMEGA32 = 0x16573617, + SAML21 = 0x1851780a, + NRF52 = 0x1b57745f, + ESP32 = 0x1c5f21b0, + STM32L1 = 0x1e1f432d, + STM32L0 = 0x202e3a91, + STM32WL = 0x21460ff0, + LPC55 = 0x2abc77ec, + STM32G0 = 0x300f5633, + GD32F350 = 0x31d228c6, + STM32L5 = 0x04240bdf, + STM32G4 = 0x4c71240a, + MIMXRT10XX = 0x4fb2d5bd, + STM32F7 = 0x53b80f00, + SAMD51 = 0x55114460, + STM32F4 = 0x57755a57, + FX2 = 0x5a18069b, + STM32F2 = 0x5d1a0a2e, + STM32F1 = 0x5ee21072, + NRF52833 = 0x621e937a, + STM32F0 = 0x647824b6, + SAMD21 = 0x68ed2b88, + STM32F3 = 0x6b846188, + STM32F407 = 0x6d0922fa, + STM32H7 = 0x6db66082, + STM32WB = 0x70d16653, + KL32L2 = 0x7f83e793, + STM32F407VG = 0x8fb060fe, + NRF52840 = 0xada52840, + ESP32S2 = 0xbfdd4eee, + ESP32S3 = 0xc47e5767, + ESP32C3 = 0xd42ba06c, + ESP32C2 = 0x2b88d29c, + ESP32H2 = 0x332726f6, + ESP32C6 = 0x540ddf62, + ESP32P4 = 0x3d308e94, + ESP32C5 = 0xf71c0343, + ESP32C61 = 0x77d850c4, + RP2040 = 0xe48bff56, + STM32L4 = 0x00ff6919, + GD32VF103 = 0x9af03e33, + CSK4 = 0x4f6ace52, + CSK6 = 0x6e7348a8, + M0SENSE = 0x11de784a, + MaixPlayU4 = 0x4b684d71, + RZA1LU = 0x9517422f, + STM32F411xE = 0x2dc309c5, + NRF52832xxAA = 0x72721d4e, + NRF52832xxAB = 0x6f752678, + AT32F415 = 0xa0c97b8e, + CH32V = 0x699b62ec, +}; + fn formatTagType(UF2_TagType type) { u32 value = (type.bytes[0] << 16) | (type.bytes[1] << 8) | (type.bytes[2]); @@ -75,7 +131,7 @@ struct UF2_Block { u32 numBlocks; if (flags.FamilyIDPresent) - u32 familyId; + UF2_FamilyID familyId; else u32 fileSize; diff --git a/patterns/usb.hexpat b/patterns/usb.hexpat index 36e1080..8da604f 100644 --- a/patterns/usb.hexpat +++ b/patterns/usb.hexpat @@ -1,4 +1,4 @@ -#pragma description TODO +#pragma description USB Descriptor import std.core; import std.io; diff --git a/patterns/wintec_tes.hexpat b/patterns/wintec_tes.hexpat index 335d786..cc90276 100644 --- a/patterns/wintec_tes.hexpat +++ b/patterns/wintec_tes.hexpat @@ -19,6 +19,8 @@ // Made with help from a (since deleted) GPSBabel definition // https://github.com/GPSBabel/gpsbabel/blob/gpsbabel_1_8_0/wintec_tes.cc +#pragma description Wintec TES GPS log + #include "std/mem.pat" #include "std/string.pat" diff --git a/patterns/xgspak.hexpat b/patterns/xgspak.hexpat index 414358d..bfee0a9 100644 --- a/patterns/xgspak.hexpat +++ b/patterns/xgspak.hexpat @@ -1,3 +1,6 @@ +#pragma author LolHacksRule +#pragma description Exient XGS Engine Pak files + import std.mem; import std.core; import type.time; diff --git a/patterns/xgstexture.hexpat b/patterns/xgstexture.hexpat index b950d81..b176cab 100644 --- a/patterns/xgstexture.hexpat +++ b/patterns/xgstexture.hexpat @@ -1,3 +1,6 @@ +#pragma author LolHacksRule +#pragma description Exient XGS Engine Texture + import type.magic; //By LolHacksRule