mirror of
https://github.com/WerWolv/ImHex-Patterns.git
synced 2026-03-27 23:37:04 -05:00
patterns: Add Windows animated cursor (#242)
* patterns: Add Windows animated cursor * Added readme entry * Added mime type to readme --------- Co-authored-by: Nik <werwolv98@gmail.com>
This commit is contained in:
66
patterns/ani.hexpat
Normal file
66
patterns/ani.hexpat
Normal file
@@ -0,0 +1,66 @@
|
||||
#pragma description Windows animated cursor
|
||||
#pragma MIME application/x-navi-animation
|
||||
#pragma endian little
|
||||
|
||||
import std.io;
|
||||
import std.mem;
|
||||
|
||||
bitfield HeaderFlags {
|
||||
icon : 1;
|
||||
sequence : 1;
|
||||
padding: 30;
|
||||
};
|
||||
|
||||
struct anih {
|
||||
u32 struct_size;
|
||||
u32 stored_frames;
|
||||
u32 animation_steps;
|
||||
u32 w;
|
||||
u32 h;
|
||||
u32 bits;
|
||||
u32 planes;
|
||||
u32 default_jiffies;
|
||||
HeaderFlags flags;
|
||||
};
|
||||
|
||||
struct rate {
|
||||
u32 jiffies[parent.size / 4];
|
||||
};
|
||||
|
||||
struct seq {
|
||||
u32 index[parent.size / 4];
|
||||
};
|
||||
|
||||
struct RiffChunk {
|
||||
char signature[4];
|
||||
u32 size;
|
||||
if (signature == "RIFF" || signature == "LIST") {
|
||||
char type[4];
|
||||
RiffChunk chunks[while($ - addressof(type) < size)];
|
||||
} else if (signature[0] == 'I' && parent.type == "INFO") {
|
||||
char info[size];
|
||||
} else if (signature == "anih") {
|
||||
anih anih [[inline]];
|
||||
} else if (signature == "rate") {
|
||||
rate rate [[inline]];
|
||||
} else if (signature == "seq ") {
|
||||
seq seq [[inline]];
|
||||
} else {
|
||||
std::mem::Bytes<size> data;
|
||||
}
|
||||
padding[size % 2];
|
||||
} [[format_read("read_chunk")]];
|
||||
|
||||
fn read_chunk(RiffChunk chunk) {
|
||||
if (chunk.signature == "RIFF" || chunk.signature == "LIST") {
|
||||
return std::format("{}<{}> ({})", chunk.signature, chunk.type, chunk.size);
|
||||
} else {
|
||||
str ret = std::format("{} ({})", chunk.signature, chunk.size);
|
||||
try {
|
||||
ret += std::format(" \"{}\"", chunk.info);
|
||||
} catch {}
|
||||
return ret;
|
||||
}
|
||||
};
|
||||
|
||||
RiffChunk riff @ 0;
|
||||
Reference in New Issue
Block a user