mirror of
https://github.com/WerWolv/ImHex-Patterns.git
synced 2026-03-27 23:37:04 -05:00
patterns: Added support for GNU MO files (#383)
This commit is contained in:
@@ -105,6 +105,7 @@ Everything will immediately show up in ImHex's Content Store and gets bundled wi
|
||||
| MBR & GPT | | [`patterns/partition_table.hexpat`](patterns/partition_table.hexpat) | Partition tables with primary focus on GPT |
|
||||
| MIDI | `audio/midi` | [`patterns/midi.hexpat`](patterns/midi.hexpat) | MIDI header, event fields provided |
|
||||
| MiniDump | `application/x-dmp` | [`patterns/minidump.hexpat`](patterns/minidump.hexpat) | Windows MiniDump files |
|
||||
| MO | | [`patterns/mo.hexpat`](patterns/mo.hexpat) | GNU Machine Object (MO) files containing translations for gettext |
|
||||
| mp4 | `video/mp4` | [`patterns/mp4.hexpat`](patterns/mp4.hexpat) | MPEG-4 Part 14 digital multimedia container format |
|
||||
| msgpack | `application/x-msgpack` | [`patterns/msgpack.hexpat`](patterns/msgpack.hexpat) | MessagePack binary serialization format |
|
||||
| MSSCMP | | [`patterns/msscmp.hexpat`](patterns/msscmp.hexpat) | Miles Sound System Compressed Archive |
|
||||
|
||||
37
patterns/mo.hexpat
Normal file
37
patterns/mo.hexpat
Normal file
@@ -0,0 +1,37 @@
|
||||
#pragma author dvob
|
||||
#pragma description GNU Machine Object (MO) files containing translations for gettext
|
||||
|
||||
// https://www.gnu.org/software/gettext/manual/html_node/MO-Files.html
|
||||
|
||||
import std.core;
|
||||
import std.io;
|
||||
|
||||
struct strPtr {
|
||||
u32 length;
|
||||
u32 offset;
|
||||
char string[length] @ offset;
|
||||
};
|
||||
|
||||
struct file {
|
||||
be u32 magic;
|
||||
if ( magic == 0x950412de )
|
||||
std::core::set_endian(std::mem::Endian::Big);
|
||||
else if ( magic == 0xde120495)
|
||||
std::core::set_endian(std::mem::Endian::Little);
|
||||
else
|
||||
std::error("Invalid MO Magic!");
|
||||
|
||||
u16 majorVersion;
|
||||
u16 minorVersion;
|
||||
u32 count;
|
||||
u32 msgIdOffset;
|
||||
u32 msgStrOffset;
|
||||
u32 hashSize;
|
||||
u32 hashOffset;
|
||||
|
||||
u32 hashTable[hashSize] @ hashOffset;
|
||||
strPtr msgIDTable[count] @ msgIdOffset;
|
||||
strPtr msgStrTable[count] @ msgStrOffset;
|
||||
};
|
||||
|
||||
file moFile @ 0x0;
|
||||
BIN
tests/patterns/test_data/mo.hexpat.mo
Normal file
BIN
tests/patterns/test_data/mo.hexpat.mo
Normal file
Binary file not shown.
Reference in New Issue
Block a user