mirror of
https://github.com/WerWolv/ImHex-Patterns.git
synced 2026-03-27 23:37:04 -05:00
patterns: Add Digital Terrain Elevation Data (DTED) pattern file (#243)
Tested on DTED0 and DTED2, will likely work with DTED1 as well.
This commit is contained in:
committed by
GitHub
parent
0ad6e3abde
commit
ff550bd105
@@ -49,6 +49,7 @@ Everything will immediately show up in ImHex's Content Store and gets bundled wi
|
||||
| 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 |
|
||||
| DTED | | [`patterns/dted.hexpat`](patterns/dted.hexpat) | Digital Terrain Elevation Data (DTED) |
|
||||
| ELF | `application/x-executable` | [`patterns/elf.hexpat`](patterns/elf.hexpat) | ELF header in elf binaries |
|
||||
| EVTX | | [`patterns/evtx.hexpat`](patterns/evtx.hexpat) | MS Windows Vista Event Log |
|
||||
| FAS | | [`patterns/fas_oskasoftware.hexpat`](patterns/fas_oskasoftware.hexpat) [`patterns/fas_oskasoftware_old.hexpat`](patterns/fas_oskasoftware_old.hexpat) (Old versions of Oska DeskMate) | Oska Software DeskMates FAS (Frames and Sequences) file |
|
||||
|
||||
117
patterns/dted.hexpat
Normal file
117
patterns/dted.hexpat
Normal file
@@ -0,0 +1,117 @@
|
||||
#pragma description Digital Terrain Elevation Data
|
||||
#pragma endian big
|
||||
|
||||
import std.core;
|
||||
import std.io;
|
||||
import std.mem;
|
||||
import std.string;
|
||||
|
||||
|
||||
enum Magic:u24 {
|
||||
UHL = 0x55484C,
|
||||
DSI = 0x445349,
|
||||
ACC = 0x414343,
|
||||
};
|
||||
|
||||
struct UHL {
|
||||
Magic magic;
|
||||
char one;
|
||||
char lon[8];
|
||||
char lat[8];
|
||||
char lon_data_interval[4];
|
||||
char lat_data_interval[4];
|
||||
char accuracy[4];
|
||||
char security_code[3];
|
||||
char uniq_ref[12];
|
||||
char lon_lines[4];
|
||||
char lat_points[4];
|
||||
char multi_accuracy;
|
||||
char reserved[24];
|
||||
};
|
||||
|
||||
struct DSI {
|
||||
Magic magic;
|
||||
char classification;
|
||||
char stuff1[29];
|
||||
char stuff2[26];
|
||||
char product_level[5];
|
||||
char uniq_ref[15];
|
||||
char reserved[8];
|
||||
char data_edition[2];
|
||||
char match_version;
|
||||
char maint_date[4];
|
||||
char match_date[4];
|
||||
char main_desc_code[4];
|
||||
char producer_code[8];
|
||||
char reserved2[16];
|
||||
char product_spec[9];
|
||||
char numbers[2];
|
||||
char product_spec_date[4];
|
||||
char vertical_datum[3];
|
||||
char horizontal_datum[5];
|
||||
char digitizing_system[10];
|
||||
char compilation_date[4];
|
||||
char reserved3[22];
|
||||
char lat_origin[9];
|
||||
char lon_origin[10];
|
||||
char lat_sw_corner[7];
|
||||
char lon_sw_corner[8];
|
||||
char lat_nw_corner[7];
|
||||
char lon_nw_corner[8];
|
||||
char lat_ne_corner[7];
|
||||
char lon_ne_corner[8];
|
||||
char lat_se_corner[7];
|
||||
char lon_se_corner[8];
|
||||
char clockwise_orientation[9];
|
||||
char lat_interval[4];
|
||||
char lon_interval[4];
|
||||
char lat_lines[4];
|
||||
char lon_lines[4];
|
||||
char partial_cell[2];
|
||||
char reserved4[101];
|
||||
char reserved5[100];
|
||||
char reserved6[156];
|
||||
};
|
||||
|
||||
struct ACCSub {
|
||||
char abs_vertical_accuracy[4];
|
||||
char abs_horizontal_accuracy[4];
|
||||
char rel_vertical_accuracy[4];
|
||||
char rel_horizontal_accuracy[4];
|
||||
char num_coords[2];
|
||||
char pairs[19*14];
|
||||
};
|
||||
|
||||
struct ACC {
|
||||
Magic magic;
|
||||
char abs_horizontal_accuracy[4];
|
||||
char abs_vertical_accuracy[4];
|
||||
char rel_horizontal_accuracy[4];
|
||||
char rel_vertical_accuracy[4];
|
||||
char reserved1[4];
|
||||
char reserved2[1];
|
||||
char reserved3[31];
|
||||
char multi_accuracy_outline[2]; // determines sub regions
|
||||
ACCSub subs[9];
|
||||
char reserved4[18];
|
||||
char reserved5[69];
|
||||
|
||||
};
|
||||
|
||||
struct DataRecords {
|
||||
char magic;
|
||||
s24 data_block_count;
|
||||
s16 lon_count;
|
||||
s16 lat_count;
|
||||
s16 elevation[std::string::parse_int(parent.dsi.lat_lines, 10)];
|
||||
u32 checksum;
|
||||
};
|
||||
|
||||
struct DTED {
|
||||
UHL uhl;
|
||||
DSI dsi;
|
||||
ACC acc;
|
||||
DataRecords records[std::string::parse_int(this.dsi.lon_lines, 10)];
|
||||
};
|
||||
|
||||
DTED dted @ 0x00;
|
||||
BIN
tests/patterns/test_data/dted.hexpat.dt0
Normal file
BIN
tests/patterns/test_data/dted.hexpat.dt0
Normal file
Binary file not shown.
Reference in New Issue
Block a user