Display direction and character encoding in main.HMI

Byte 12 is the display direction (90-degree steps) and byte 13 the
character encoding -- the docs had them swapped. Basic panels are
portrait at 0 degrees, Intelligent ones landscape, so new Intelligent
projects used to open in portrait. new_project takes portrait= and
encoding=; all 24 Editor encodings are mapped; parse_main reports both.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
mangavalkandClaude Opus 5.5 committed 2026-11-15 16:36:10 +01:00
1 parent 842591a14c
commit a93cb58b96
7 files changed
+77 -21

No files matched your search

+1 -1
View File
@@ -89,7 +89,7 @@ byte for byte, or a file written by nxhmi was opened in the Editor and showed th
| Intelligent picture format 4 | block codec with 8-bit alpha; first findings in FORMAT.md |
| Anti-aliased fonts, multi-byte encodings (GB2312, Big5, ...) | only B/W single-byte fonts seen |
| Other display series | Discovery / Enhanced / Edge not sampled; only Basic + Intelligent templates |
| Display direction | picture/glyph order verified for one direction (main.HMI byte 13 = 3) only |
| Display direction | byte 12 decoded and written (`new_project(portrait=...)`); picture/glyph order verified for one direction (90° Basic) only |
| Some header fields | main.HMI bytes 8, 13, 36, 0x41; page header 21/23; entry bytes 25-27 |
| Font name shown in the Editor's Fonts panel | cosmetic, generated fonts show an odd label |
| Media resources | video / audio / Gmov files themselves (not just the components) |
+3 -3
View File
@@ -62,8 +62,8 @@ primary table from the backup, among other things) -- never reuse a test file af
| 9 | 1 | 0x41 in a 2019 file, 0x44 after saving with Editor 1.68 (Editor/format revision?) |
| 10 | 1 | 0x21 |
| 11 | 1 | display series: 0 = Basic (T), 3 = Intelligent (P); others **OPEN** |
| 12 | 1 | text encoding index (1 = iso-8859-1; an unknown value makes the Editor fail with "'null' is not a supported encoding name") |
| 13 | 1 | 3 (**OPEN**; not the model index) |
| 12 | 1 | display direction in 90° steps (Setting > Display: 0 = 0°, 1 = 90°, 2 = 180°, 3 = 270°). Basic panels are portrait at 0°, so a 480×320 Basic project has 1; Intelligent panels are landscape at 0°. Page sizes follow (the Editor shows a 480×272 Intelligent project with 1 as 272×480). An unsupported value made the Editor fail to load ("'null' is not a supported encoding name") |
| 13 | 1 | character encoding (Setting > Display): 1 ascii, 2 gb2312, 3 iso-8859-1, 4-11 iso-8859-2..9, 12 iso-8859-13, 13 iso-8859-15, 14 iso-8859-11, 15 ks_c_5601-1987, 16 big5, 17-20 windows-1255..1258, 21 windows-874, 22 koi8-r, 23 shift-jis, 24 utf-8 (all measured; `models.ENCODINGS`) |
| 14 | 1 | 0x4F |
| 16 | 4 | model id (e.g. 0xB23BC018 NX4832T035_011, 0x181169DA NX4827P043_011); must match the series byte, otherwise the Editor falls back to its first model |
| 24 | 4 | 0x60 |
@@ -205,7 +205,7 @@ Format 0: RGB565 little-endian, converted by plain truncation (`r>>3, g>>2, b>>3
panel's native scan order -- column by column, each column bottom-to-top:
`offset = 2 * (x * height + (height - 1 - y))`. Verified pixel-exact (480×320 and 64×64, Editor
output byte-identical to ours). **OPEN**: whether the order changes with the project's display
direction (all samples: main.HMI byte 13 = 3).
direction (all samples: main.HMI byte 12 = 1, i.e. 90° on a Basic panel).
Format 4 (Intelligent series, **OPEN**): header field at 20 is non-zero for small pictures
(e.g. 2640 for a 3307-byte payload); payload starts with u32 1, u32 height, u32 width (note: