mirror of
https://github.com/WerWolv/ImHex-Patterns.git
synced 2026-03-27 23:37:04 -05:00
patterns: Added Icon/Cursor image pattern
This commit is contained in:
@@ -23,6 +23,7 @@ Hex patterns, include patterns and magic files for the use with the ImHex Hex Ed
|
||||
| NRO | | `patterns/nro.hexpat` | Nintendo Switch NRO files |
|
||||
| Java Class | `application/x-java-applet` | `patterns/java_class.hexpat` | Java Class files |
|
||||
| ARM VTOR | | `patterns/arm_cm_vtor.hexpat` | ARM Cortex M Vector Table Layout |
|
||||
| ICO | | `patterns/ico.hexpat` | Icon (.ico) or Cursor (.cur) files |
|
||||
|
||||
### Pattern Libraries
|
||||
|
||||
|
||||
45
patterns/ico.hexpat
Normal file
45
patterns/ico.hexpat
Normal file
@@ -0,0 +1,45 @@
|
||||
#pragma endian little
|
||||
|
||||
#pragma MIME image/vnd.microsoft.icon
|
||||
#pragma MIME image/x-icon
|
||||
#pragma MIME image/icon
|
||||
#pragma MIME image/ico
|
||||
#pragma MIME text/ico
|
||||
#pragma MIME application/ico
|
||||
|
||||
enum ImageType : u16 {
|
||||
Icon = 1,
|
||||
Cursor = 2
|
||||
};
|
||||
|
||||
struct ICONDIR {
|
||||
u16 reserved [[hidden]];
|
||||
ImageType type;
|
||||
u16 num_images;
|
||||
};
|
||||
|
||||
struct ImageData {
|
||||
u8 data[parent.image_data_size] [[inline]];
|
||||
};
|
||||
|
||||
struct ICONDIRENTRY {
|
||||
u8 width, height;
|
||||
u8 num_colors;
|
||||
u8 reserved [[hidden]];
|
||||
|
||||
if (header.type == ImageType::Icon) {
|
||||
u16 color_planes;
|
||||
u16 bits_per_pixel;
|
||||
} else if (header.type == ImageType::Cursor) {
|
||||
u16 horizontal_hotspot_coordinate;
|
||||
u16 vertical_hotspot_coordinate;
|
||||
}
|
||||
|
||||
u32 image_data_size;
|
||||
ImageData *image_data : u32;
|
||||
};
|
||||
|
||||
ICONDIR header @ 0x00;
|
||||
ICONDIRENTRY images[header.num_images] @ $;
|
||||
|
||||
std::assert(header.reserved == 0x00, "Invalid ICO header");
|
||||
Reference in New Issue
Block a user