commit 69e22cfb0671342f1fb32736f4fccfdb7fe8d24c Author: MangaValk Date: Sun Nov 15 15:11:02 2026 +0100 openhmi-nx: decode, encode, render Nextion HMI projects; .tft research Black-box reverse-engineered .HMI format (container, three checksums, pages, all 31 component types, pictures, fonts), readable JSON, page renderer matching Nextion Editor, demo project built from code and a test suite (66 tests). See docs/COVERAGE.md for status. Co-Authored-By: Claude Opus 5.5 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b54b477 --- /dev/null +++ b/.gitignore @@ -0,0 +1,12 @@ +__pycache__/ +*.pyc +*.egg-info/ +build/ +dist/ +# never commit third-party projects or compiled firmware by accident +*.HMI +*.hmi +*.tft +# ...except our own demo and its Editor re-save (test fixture) +!demo/demo.HMI +!tests/fixtures/demo_editor_saved.HMI diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..47fa189 --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,53 @@ +# Working on this repo + +Python package `nxhmi` (in `src/`): read, verify, edit, write and render Nextion Editor `.HMI` +projects, plus research on `.tft` firmware. No runtime dependencies; Pillow for pictures, fonts +and rendering. + +## Layout + +``` +src/nxhmi/ + checksum.py the three CRCs (page, main.HMI, file table) + container.py .HMI file system: tables, entries, Editor-style replace, fresh files + page.py pages, components, attributes, event code + components.py create components from templates_basic/intelligent.json (Editor defaults) + enums.py readable attribute values (names, #rrggbb) + models.py display models (id, series, resolution) + project.py new projects, add page/picture/font, decode to folder / encode back + pictures.py N.i / N.is + fonts.py .zi v6 fonts, generation from TrueType + render.py page renderer matching the Editor canvas + tft.py .tft research helpers (layout table, same-length trailer patch) + cli.py python -m nxhmi ... +examples/make_demo.py builds demo/ (demo.HMI, decoded/, render/) +tests/ unittest suite; fixtures/demo_editor_saved.HMI = the demo re-saved by the Editor +tools/ template generator +docs/ FORMAT.md (spec), RENDER.md, COVERAGE.md, NOTES.md (open points, what was tried) +``` + +## Commands + +``` +python -m unittest discover -s tests # all tests (run from the repo root) +python examples/make_demo.py # rebuild demo/ after changing writers or the renderer +PYTHONPATH=src python -m nxhmi verify demo/demo.HMI +``` + +After rebuilding the demo, `tests/test_project.py::Demo` must still pass: the generated demo has to +stay byte-identical to the Editor's re-save in `tests/fixtures/`. If a deliberate change breaks +that, re-save the demo with Nextion Editor (open, File > Save As) and replace the fixture. + +## Rules + +- **Black-box only.** Formats are worked out by changing projects in Nextion Editor and comparing + files, or by asking the Editor whether a hand-made file loads. Never decompile, decrypt or + patch Nextion software. +- **Never commit Nextion's files**: no `.tft` output (it embeds Nextion firmware), nothing from + the Editor's install folder, no third-party projects. Test data is generated (`examples/`) or + is our own demo re-saved by the Editor. +- Every format claim in `docs/FORMAT.md` needs evidence (byte-identical Editor output, or the + Editor accepting a file we wrote). Mark guesses as **OPEN**. +- Keep `docs/COVERAGE.md` and the README coverage table current when something is added. +- Writers must stay byte-identical to the Editor where we have samples; add a test when a new + rule is learned (see `tests/test_render.py` for the style: one rule, one measured expectation). diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..530e892 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026 nextion-hmi-tools contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..3322759 --- /dev/null +++ b/README.md @@ -0,0 +1,96 @@ +# openhmi-nx + +Open-source tools for **Nextion HMI projects**: decode, edit, encode and render `.HMI` files +without Nextion Editor -- and, as research in progress, compile `.tft` firmware. + +- decode a project into readable JSON + text (diff it, review it, keep it in git) and encode it back +- create projects, pages, components, pictures and fonts (rasterized from any TrueType font) from code +- render pages to PNG, matching the Editor's canvas pixel for pixel for nearly every component +- verify every checksum in a project + +The file format, including its checksums, is documented in [docs/FORMAT.md](docs/FORMAT.md). It +was worked out black-box -- by editing projects in Nextion Editor and comparing the files it +writes; no Nextion software was decompiled. + +> Not affiliated with or endorsed by Nextion / ITEAD. "Nextion" is their trademark. + +![demo home page rendered by nxhmi](demo/render/home.png) + +## Status + +| Area | Coverage | +|---|---| +| `.HMI` read / write / build from scratch | complete for Basic (T) and Intelligent (P) series projects; output byte-identical to Nextion Editor 1.68 | +| Checksums | all three (page, project header, file table) | +| Components | all 31 types, with the Editor's own defaults | +| Readable JSON | enum names and `#rrggbb` colours, still byte-exact on the way back | +| Pictures | Basic series format complete; Intelligent compressed format not yet | +| Fonts | black/white `.zi` v6 complete, incl. generation from TrueType; anti-aliased not yet | +| Rendering | pixel-identical for text, numbers, buttons, sliders, bars, checkboxes, pictures, waveform...; radio ~95 %, QR placeholder ([docs/RENDER.md](docs/RENDER.md)) | +| `.tft` compile | research: layout mapped, partial checksum support; not usable yet | + +Details and the full list of gaps: [docs/COVERAGE.md](docs/COVERAGE.md). + +## Install + +Python 3.9+. Pillow is only needed for pictures, font generation and rendering. + +``` +pip install -e . # or run with PYTHONPATH=src +pip install pillow # optional +``` + +## Command line + +``` +python -m nxhmi info project.HMI # entries, pages, checksum status +python -m nxhmi verify project.HMI # check every checksum +python -m nxhmi decode project.HMI folder/ # -> manifest.json, Program.s, pages/*.json, resources/ +python -m nxhmi encode folder/ new.HMI # folder -> fresh .HMI +python -m nxhmi dump project.HMI --page home # one page as JSON +python -m nxhmi set project.HMI home title txt "Hello" +python -m nxhmi add project.HMI home button x=10 y=60 w=120 h=40 txt=Hi --name bHi +python -m nxhmi new-page project.HMI settings +python -m nxhmi add-picture project.HMI logo.png +python -m nxhmi add-font project.HMI DejaVuSans.ttf 24 +python -m nxhmi render project.HMI pngs/ # one PNG per page +python -m nxhmi kinds # component kinds for `add` +``` + +## Python + +```python +from nxhmi import project, fonts, components as C +from nxhmi.render import Renderer + +h = project.new_project("NX4832T035_011", "home") # no Nextion files needed +font = project.add_font(h, fonts.from_ttf(None, 24)) # None = Pillow's bundled CC0 font +page = project.add_page(h, "settings") +C.add(page, "button", x=10, y=10, w=140, h=40, txt="back", font=font, + events={"codesup": ["page home"]}) +h.write("1.pa", page.pack()) +h.save("my.HMI") # opens in Nextion Editor +Renderer(h).render("settings").save("settings.png") +``` + +## Demo + +`demo/` is generated by [examples/make_demo.py](examples/make_demo.py): a 3-page project +(`demo.HMI`), its decoded form (`decoded/`) and renders (`render/`). Nextion Editor re-saves it +byte for byte unchanged -- that re-save is the test fixture in `tests/fixtures/`. + +## Tests + +``` +python -m unittest discover -s tests +``` + +## Credits + +[Nextion2Text](https://github.com/MMMZZZZ/Nextion2Text) (MPL-2.0) first documented the page record +layout (read-only); [nextion-font-editor](https://github.com/hagronnestad/nextion-font-editor) +documented older font versions. This is an independent implementation. + +## License + +MIT, see [LICENSE](LICENSE). diff --git a/demo/decoded/Program.s b/demo/decoded/Program.s new file mode 100644 index 0000000..517f5e5 --- /dev/null +++ b/demo/decoded/Program.s @@ -0,0 +1,4 @@ +//Program.s runs once at power-on, before the first page is shown. +//Global variables can be declared here: int sys0=0 +baud=115200 +page 0 diff --git a/demo/decoded/main.HMI.json b/demo/decoded/main.HMI.json new file mode 100644 index 0000000..2cbc25a --- /dev/null +++ b/demo/decoded/main.HMI.json @@ -0,0 +1,53 @@ +{ + "crc_ok": true, + "model_id": "0xB23BC018", + "model": "NX4832T035_011", + "model_desc": "Nextion 3.5\" Basic 480x320", + "resources": [ + [ + "i", + "0.i" + ], + [ + "i", + "1.i" + ], + [ + "i", + "2.i" + ], + [ + "i", + "3.i" + ], + [ + "i", + "4.i" + ], + [ + "i", + "5.i" + ], + [ + "zi", + "0.zi" + ], + [ + "zi", + "1.zi" + ], + [ + "pa", + "0.pa" + ], + [ + "pa", + "1.pa" + ], + [ + "pa", + "2.pa" + ] + ], + "raw_hex": "a9664eb5600000000144210001034f0018c03bb200000000600000000b000000000000000200000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000006900000000000000302e6900000000006900000000000000312e6900000000006900000000000000322e6900000000006900000000000000332e6900000000006900000000000000342e6900000000006900000000000000352e6900000000007a69000000000000302e7a69000000007a69000000000000312e7a69000000007061000000000000302e7061000000007061000000000000312e7061000000007061000000000000322e706100000000" +} \ No newline at end of file diff --git a/demo/decoded/manifest.json b/demo/decoded/manifest.json new file mode 100644 index 0000000..64eec0e --- /dev/null +++ b/demo/decoded/manifest.json @@ -0,0 +1,83 @@ +{ + "format": "nxhmi-folder-1", + "encoding": "latin-1", + "entries": [ + { + "name": "Program.s", + "file": "Program.s" + }, + { + "name": "0.zi", + "file": "resources/0.zi" + }, + { + "name": "1.zi", + "file": "resources/1.zi" + }, + { + "name": "0.is", + "file": "resources/0.is" + }, + { + "name": "0.i", + "file": "resources/0.i" + }, + { + "name": "1.is", + "file": "resources/1.is" + }, + { + "name": "1.i", + "file": "resources/1.i" + }, + { + "name": "2.is", + "file": "resources/2.is" + }, + { + "name": "2.i", + "file": "resources/2.i" + }, + { + "name": "3.is", + "file": "resources/3.is" + }, + { + "name": "3.i", + "file": "resources/3.i" + }, + { + "name": "4.is", + "file": "resources/4.is" + }, + { + "name": "4.i", + "file": "resources/4.i" + }, + { + "name": "5.is", + "file": "resources/5.is" + }, + { + "name": "5.i", + "file": "resources/5.i" + }, + { + "name": "0.pa", + "page": "pages/0_home.json" + }, + { + "name": "1.pa", + "page": "pages/1_controls.json" + }, + { + "name": "main.HMI", + "main": "main.HMI.json" + }, + { + "name": "2.pa", + "page": "pages/2_gallery.json" + } + ], + "model": "NX4832T035_011" +} \ No newline at end of file diff --git a/demo/decoded/pages/0_home.json b/demo/decoded/pages/0_home.json new file mode 100644 index 0000000..74e4b5a --- /dev/null +++ b/demo/decoded/pages/0_home.json @@ -0,0 +1,2889 @@ +{ + "file": "0.pa", + "name": "home", + "password": 0, + "locked": 0, + "b21": 79, + "version": 33, + "b23": 0, + "reserved_hex": "00000000000000000000000000000000", + "components": [ + { + "order": [ + "att", + "codesload", + "codesloadend", + "codesdown", + "codesup", + "codesunload" + ], + "att": [ + [ + "type", + "u8", + 121 + ], + [ + "id", + "u8", + 0 + ], + [ + "objname", + "str", + "home" + ], + [ + "vscope", + "u8", + "local" + ], + [ + "drag", + "u8", + 0 + ], + [ + "sendkey", + "u8", + 0 + ], + [ + "aph", + "u8", + 127 + ], + [ + "movex", + "u16", + 0 + ], + [ + "movey", + "u16", + 0 + ], + [ + "x", + "u16", + 0 + ], + [ + "y", + "u16", + 0 + ], + [ + "w", + "u16", + 480 + ], + [ + "h", + "u16", + 320 + ], + [ + "endx", + "u16", + 479 + ], + [ + "endy", + "u16", + 319 + ], + [ + "effect", + "u8", + 0 + ], + [ + "first", + "u8", + 0 + ], + [ + "time", + "u16", + 300 + ], + [ + "lockobj", + "u8", + 0 + ], + [ + "groupid0", + "u32", + 0 + ], + [ + "groupid1", + "u32", + 0 + ], + [ + "up", + "u8", + 255 + ], + [ + "down", + "u8", + 255 + ], + [ + "left", + "u8", + 255 + ], + [ + "right", + "u8", + 255 + ], + [ + "sta", + "u8", + "image" + ], + [ + "bco", + "u16", + "#ffffff" + ], + [ + "pic", + "u16", + 0 + ] + ], + "events": { + "codesload": [], + "codesloadend": [ + "tm0.en=1" + ], + "codesdown": [], + "codesup": [], + "codesunload": [] + } + }, + { + "order": [ + "att", + "codesdown", + "codesup" + ], + "att": [ + [ + "type", + "u8", + 116 + ], + [ + "id", + "u8", + 1 + ], + [ + "objname", + "str", + "title" + ], + [ + "vscope", + "u8", + "local" + ], + [ + "drag", + "u8", + 0 + ], + [ + "sendkey", + "u8", + 0 + ], + [ + "aph", + "u8", + 127 + ], + [ + "movex", + "u16", + 0 + ], + [ + "movey", + "u16", + 0 + ], + [ + "x", + "u16", + 10 + ], + [ + "y", + "u16", + 6 + ], + [ + "w", + "u16", + 460 + ], + [ + "h", + "u16", + 40 + ], + [ + "endx", + "u16", + 469 + ], + [ + "endy", + "u16", + 45 + ], + [ + "effect", + "u8", + 0 + ], + [ + "first", + "u8", + 0 + ], + [ + "time", + "u16", + 300 + ], + [ + "lockobj", + "u8", + 0 + ], + [ + "groupid0", + "u32", + 0 + ], + [ + "groupid1", + "u32", + 0 + ], + [ + "sta", + "u8", + "crop image" + ], + [ + "style", + "u8", + "flat" + ], + [ + "key", + "u8", + 255 + ], + [ + "borderc", + "u16", + "#000000" + ], + [ + "borderw", + "u8", + 2 + ], + [ + "font", + "u8", + 1 + ], + [ + "bco", + "u16", + "#ffffff" + ], + [ + "picc", + "u16", + 0 + ], + [ + "pic", + "u16", + 65535 + ], + [ + "pco", + "u16", + "#ffffff" + ], + [ + "xcen", + "u8", + "left" + ], + [ + "ycen", + "u8", + "center" + ], + [ + "pw", + "u8", + "character" + ], + [ + "txt", + "str", + "nxhmi demo" + ], + [ + "txt_maxl", + "u16", + 10 + ], + [ + "isbr", + "u8", + "false" + ], + [ + "spax", + "u8", + 0 + ], + [ + "spay", + "u8", + 0 + ] + ], + "events": { + "codesdown": [], + "codesup": [] + } + }, + { + "order": [ + "att", + "codesdown", + "codesup" + ], + "att": [ + [ + "type", + "u8", + 98 + ], + [ + "id", + "u8", + 2 + ], + [ + "objname", + "str", + "bControls" + ], + [ + "vscope", + "u8", + "local" + ], + [ + "drag", + "u8", + 0 + ], + [ + "sendkey", + "u8", + 0 + ], + [ + "aph", + "u8", + 127 + ], + [ + "movex", + "u16", + 0 + ], + [ + "movey", + "u16", + 0 + ], + [ + "x", + "u16", + 330 + ], + [ + "y", + "u16", + 60 + ], + [ + "w", + "u16", + 140 + ], + [ + "h", + "u16", + 40 + ], + [ + "endx", + "u16", + 469 + ], + [ + "endy", + "u16", + 99 + ], + [ + "effect", + "u8", + 0 + ], + [ + "first", + "u8", + 0 + ], + [ + "time", + "u16", + 300 + ], + [ + "lockobj", + "u8", + 0 + ], + [ + "groupid0", + "u32", + 0 + ], + [ + "groupid1", + "u32", + 0 + ], + [ + "sta", + "u8", + "solid color" + ], + [ + "style", + "u8", + "3D_Auto" + ], + [ + "borderc", + "u16", + "#000000" + ], + [ + "borderw", + "u8", + 2 + ], + [ + "font", + "u8", + 0 + ], + [ + "pic", + "u16", + 65535 + ], + [ + "picc", + "u16", + 65535 + ], + [ + "bco", + "u16", + "#c6c3c6" + ], + [ + "pic2", + "u16", + 65535 + ], + [ + "picc2", + "u16", + 65535 + ], + [ + "bco2", + "u16", + "#008200" + ], + [ + "pco", + "u16", + "#000000" + ], + [ + "pco2", + "u16", + "#ffffff" + ], + [ + "xcen", + "u8", + "center" + ], + [ + "ycen", + "u8", + "center" + ], + [ + "val", + "u8", + 0 + ], + [ + "txt", + "str", + "controls" + ], + [ + "txt_maxl", + "u16", + 10 + ], + [ + "isbr", + "u8", + "false" + ], + [ + "spax", + "u8", + 0 + ], + [ + "spay", + "u8", + 0 + ] + ], + "events": { + "codesdown": [], + "codesup": [ + "page controls" + ] + } + }, + { + "order": [ + "att", + "codesdown", + "codesup" + ], + "att": [ + [ + "type", + "u8", + 98 + ], + [ + "id", + "u8", + 3 + ], + [ + "objname", + "str", + "bGallery" + ], + [ + "vscope", + "u8", + "local" + ], + [ + "drag", + "u8", + 0 + ], + [ + "sendkey", + "u8", + 0 + ], + [ + "aph", + "u8", + 127 + ], + [ + "movex", + "u16", + 0 + ], + [ + "movey", + "u16", + 0 + ], + [ + "x", + "u16", + 330 + ], + [ + "y", + "u16", + 110 + ], + [ + "w", + "u16", + 140 + ], + [ + "h", + "u16", + 40 + ], + [ + "endx", + "u16", + 469 + ], + [ + "endy", + "u16", + 149 + ], + [ + "effect", + "u8", + 0 + ], + [ + "first", + "u8", + 0 + ], + [ + "time", + "u16", + 300 + ], + [ + "lockobj", + "u8", + 0 + ], + [ + "groupid0", + "u32", + 0 + ], + [ + "groupid1", + "u32", + 0 + ], + [ + "sta", + "u8", + "solid color" + ], + [ + "style", + "u8", + "3D_Auto" + ], + [ + "borderc", + "u16", + "#000000" + ], + [ + "borderw", + "u8", + 2 + ], + [ + "font", + "u8", + 0 + ], + [ + "pic", + "u16", + 65535 + ], + [ + "picc", + "u16", + 65535 + ], + [ + "bco", + "u16", + "#c6c3c6" + ], + [ + "pic2", + "u16", + 65535 + ], + [ + "picc2", + "u16", + 65535 + ], + [ + "bco2", + "u16", + "#008200" + ], + [ + "pco", + "u16", + "#000000" + ], + [ + "pco2", + "u16", + "#ffffff" + ], + [ + "xcen", + "u8", + "center" + ], + [ + "ycen", + "u8", + "center" + ], + [ + "val", + "u8", + 0 + ], + [ + "txt", + "str", + "gallery" + ], + [ + "txt_maxl", + "u16", + 10 + ], + [ + "isbr", + "u8", + "false" + ], + [ + "spax", + "u8", + 0 + ], + [ + "spay", + "u8", + 0 + ] + ], + "events": { + "codesdown": [], + "codesup": [ + "page gallery" + ] + } + }, + { + "order": [ + "att", + "codesdown", + "codesup" + ], + "att": [ + [ + "type", + "u8", + 54 + ], + [ + "id", + "u8", + 4 + ], + [ + "objname", + "str", + "nCount" + ], + [ + "vscope", + "u8", + "local" + ], + [ + "drag", + "u8", + 0 + ], + [ + "sendkey", + "u8", + 0 + ], + [ + "aph", + "u8", + 127 + ], + [ + "movex", + "u16", + 0 + ], + [ + "movey", + "u16", + 0 + ], + [ + "x", + "u16", + 10 + ], + [ + "y", + "u16", + 60 + ], + [ + "w", + "u16", + 150 + ], + [ + "h", + "u16", + 40 + ], + [ + "endx", + "u16", + 159 + ], + [ + "endy", + "u16", + 99 + ], + [ + "effect", + "u8", + 0 + ], + [ + "first", + "u8", + 0 + ], + [ + "time", + "u16", + 300 + ], + [ + "lockobj", + "u8", + 0 + ], + [ + "groupid0", + "u32", + 0 + ], + [ + "groupid1", + "u32", + 0 + ], + [ + "sta", + "u8", + "solid color" + ], + [ + "style", + "u8", + "flat" + ], + [ + "key", + "u8", + 255 + ], + [ + "borderc", + "u16", + "#000000" + ], + [ + "borderw", + "u8", + 2 + ], + [ + "font", + "u8", + 1 + ], + [ + "bco", + "u16", + "#ffffff" + ], + [ + "picc", + "u16", + 65535 + ], + [ + "pic", + "u16", + 65535 + ], + [ + "pco", + "u16", + "#000000" + ], + [ + "xcen", + "u8", + "center" + ], + [ + "ycen", + "u8", + "center" + ], + [ + "val", + "u32", + 1234 + ], + [ + "lenth", + "u8", + 0 + ], + [ + "format", + "u8", + "decimal" + ], + [ + "isbr", + "u8", + "true" + ], + [ + "spax", + "u8", + 0 + ], + [ + "spay", + "u8", + 0 + ] + ], + "events": { + "codesdown": [], + "codesup": [] + } + }, + { + "order": [ + "att", + "codesdown", + "codesup" + ], + "att": [ + [ + "type", + "u8", + 59 + ], + [ + "id", + "u8", + 5 + ], + [ + "objname", + "str", + "xTemp" + ], + [ + "vscope", + "u8", + "local" + ], + [ + "drag", + "u8", + 0 + ], + [ + "sendkey", + "u8", + 0 + ], + [ + "aph", + "u8", + 127 + ], + [ + "movex", + "u16", + 0 + ], + [ + "movey", + "u16", + 0 + ], + [ + "x", + "u16", + 170 + ], + [ + "y", + "u16", + 60 + ], + [ + "w", + "u16", + 150 + ], + [ + "h", + "u16", + 40 + ], + [ + "endx", + "u16", + 319 + ], + [ + "endy", + "u16", + 99 + ], + [ + "effect", + "u8", + 0 + ], + [ + "first", + "u8", + 0 + ], + [ + "time", + "u16", + 300 + ], + [ + "lockobj", + "u8", + 0 + ], + [ + "groupid0", + "u32", + 0 + ], + [ + "groupid1", + "u32", + 0 + ], + [ + "sta", + "u8", + "solid color" + ], + [ + "style", + "u8", + "flat" + ], + [ + "key", + "u8", + 255 + ], + [ + "borderc", + "u16", + "#000000" + ], + [ + "borderw", + "u8", + 2 + ], + [ + "font", + "u8", + 1 + ], + [ + "bco", + "u16", + "#ffffff" + ], + [ + "picc", + "u16", + 65535 + ], + [ + "pic", + "u16", + 65535 + ], + [ + "pco", + "u16", + "#000000" + ], + [ + "xcen", + "u8", + "center" + ], + [ + "ycen", + "u8", + "center" + ], + [ + "val", + "u32", + 2155 + ], + [ + "vvs0", + "u8", + 0 + ], + [ + "vvs1", + "u8", + 2 + ], + [ + "isbr", + "u8", + "true" + ], + [ + "spax", + "u8", + 0 + ], + [ + "spay", + "u8", + 0 + ] + ], + "events": { + "codesdown": [], + "codesup": [] + } + }, + { + "order": [ + "att", + "codesdown", + "codesup" + ], + "att": [ + [ + "type", + "u8", + 106 + ], + [ + "id", + "u8", + 6 + ], + [ + "objname", + "str", + "jLoad" + ], + [ + "vscope", + "u8", + "local" + ], + [ + "drag", + "u8", + 0 + ], + [ + "sendkey", + "u8", + 0 + ], + [ + "aph", + "u8", + 127 + ], + [ + "movex", + "u16", + 0 + ], + [ + "movey", + "u16", + 0 + ], + [ + "x", + "u16", + 10 + ], + [ + "y", + "u16", + 110 + ], + [ + "w", + "u16", + 310 + ], + [ + "h", + "u16", + 24 + ], + [ + "endx", + "u16", + 319 + ], + [ + "endy", + "u16", + 133 + ], + [ + "effect", + "u8", + 0 + ], + [ + "first", + "u8", + 0 + ], + [ + "time", + "u16", + 300 + ], + [ + "lockobj", + "u8", + 0 + ], + [ + "groupid0", + "u32", + 0 + ], + [ + "groupid1", + "u32", + 0 + ], + [ + "sta", + "u8", + "solid color" + ], + [ + "dez", + "u8", + "horizontal" + ], + [ + "val", + "u8", + 65 + ], + [ + "dis", + "u8", + 25 + ], + [ + "bco", + "u16", + "#bdbebd" + ], + [ + "bpic", + "u16", + 65535 + ], + [ + "pco", + "u16", + "#008200" + ], + [ + "ppic", + "u16", + 65535 + ] + ], + "events": { + "codesdown": [], + "codesup": [] + } + }, + { + "order": [ + "att", + "codesdown", + "codesup", + "codesslide" + ], + "att": [ + [ + "type", + "u8", + 1 + ], + [ + "id", + "u8", + 7 + ], + [ + "objname", + "str", + "hLevel" + ], + [ + "vscope", + "u8", + "local" + ], + [ + "drag", + "u8", + 0 + ], + [ + "sendkey", + "u8", + 0 + ], + [ + "aph", + "u8", + 127 + ], + [ + "movex", + "u16", + 0 + ], + [ + "movey", + "u16", + 0 + ], + [ + "x", + "u16", + 10 + ], + [ + "y", + "u16", + 145 + ], + [ + "w", + "u16", + 310 + ], + [ + "h", + "u16", + 30 + ], + [ + "endx", + "u16", + 319 + ], + [ + "endy", + "u16", + 174 + ], + [ + "effect", + "u8", + 0 + ], + [ + "first", + "u8", + 0 + ], + [ + "time", + "u16", + 300 + ], + [ + "lockobj", + "u8", + 0 + ], + [ + "groupid0", + "u32", + 0 + ], + [ + "groupid1", + "u32", + 0 + ], + [ + "mode", + "u8", + "horizontal" + ], + [ + "sta", + "u8", + "solid color" + ], + [ + "psta", + "u8", + "solid" + ], + [ + "wid", + "u8", + 255 + ], + [ + "hig", + "u8", + 255 + ], + [ + "dis", + "u8", + 100 + ], + [ + "pic", + "u16", + 65535 + ], + [ + "picc", + "u16", + 65535 + ], + [ + "bco", + "u16", + "#008200" + ], + [ + "pic1", + "u16", + 65535 + ], + [ + "picc1", + "u16", + 65535 + ], + [ + "bco1", + "u16", + "#ff5d5a" + ], + [ + "pic2", + "u16", + 65535 + ], + [ + "pco", + "u16", + "#420000" + ], + [ + "val", + "u16", + 40 + ], + [ + "maxval", + "u16", + 100 + ], + [ + "minval", + "u16", + 0 + ], + [ + "ch", + "u8", + 25 + ] + ], + "events": { + "codesdown": [], + "codesup": [], + "codesslide": [ + "jLoad.val=hLevel.val" + ] + } + }, + { + "order": [ + "att", + "codesdown", + "codesup" + ], + "att": [ + [ + "type", + "u8", + 56 + ], + [ + "id", + "u8", + 8 + ], + [ + "objname", + "str", + "cOn" + ], + [ + "vscope", + "u8", + "local" + ], + [ + "drag", + "u8", + 0 + ], + [ + "sendkey", + "u8", + 0 + ], + [ + "aph", + "u8", + 127 + ], + [ + "movex", + "u16", + 0 + ], + [ + "movey", + "u16", + 0 + ], + [ + "x", + "u16", + 10 + ], + [ + "y", + "u16", + 190 + ], + [ + "w", + "u16", + 30 + ], + [ + "h", + "u16", + 30 + ], + [ + "endx", + "u16", + 39 + ], + [ + "endy", + "u16", + 219 + ], + [ + "effect", + "u8", + 0 + ], + [ + "first", + "u8", + 0 + ], + [ + "time", + "u16", + 300 + ], + [ + "lockobj", + "u8", + 0 + ], + [ + "groupid0", + "u32", + 0 + ], + [ + "groupid1", + "u32", + 0 + ], + [ + "style", + "u8", + "3D_Down" + ], + [ + "borderw", + "u8", + 2 + ], + [ + "borderc", + "u16", + "#000000" + ], + [ + "bco", + "u16", + "#ffffff" + ], + [ + "pco", + "u16", + "#000000" + ], + [ + "val", + "u8", + 1 + ] + ], + "events": { + "codesdown": [], + "codesup": [] + } + }, + { + "order": [ + "att", + "codesdown", + "codesup" + ], + "att": [ + [ + "type", + "u8", + 116 + ], + [ + "id", + "u8", + 9 + ], + [ + "objname", + "str", + "tOn" + ], + [ + "vscope", + "u8", + "local" + ], + [ + "drag", + "u8", + 0 + ], + [ + "sendkey", + "u8", + 0 + ], + [ + "aph", + "u8", + 127 + ], + [ + "movex", + "u16", + 0 + ], + [ + "movey", + "u16", + 0 + ], + [ + "x", + "u16", + 45 + ], + [ + "y", + "u16", + 190 + ], + [ + "w", + "u16", + 100 + ], + [ + "h", + "u16", + 30 + ], + [ + "endx", + "u16", + 144 + ], + [ + "endy", + "u16", + 219 + ], + [ + "effect", + "u8", + 0 + ], + [ + "first", + "u8", + 0 + ], + [ + "time", + "u16", + 300 + ], + [ + "lockobj", + "u8", + 0 + ], + [ + "groupid0", + "u32", + 0 + ], + [ + "groupid1", + "u32", + 0 + ], + [ + "sta", + "u8", + "crop image" + ], + [ + "style", + "u8", + "flat" + ], + [ + "key", + "u8", + 255 + ], + [ + "borderc", + "u16", + "#000000" + ], + [ + "borderw", + "u8", + 2 + ], + [ + "font", + "u8", + 0 + ], + [ + "bco", + "u16", + "#ffffff" + ], + [ + "picc", + "u16", + 0 + ], + [ + "pic", + "u16", + 65535 + ], + [ + "pco", + "u16", + "#ffffff" + ], + [ + "xcen", + "u8", + "left" + ], + [ + "ycen", + "u8", + "center" + ], + [ + "pw", + "u8", + "character" + ], + [ + "txt", + "str", + "enabled" + ], + [ + "txt_maxl", + "u16", + 10 + ], + [ + "isbr", + "u8", + "false" + ], + [ + "spax", + "u8", + 0 + ], + [ + "spay", + "u8", + 0 + ] + ], + "events": { + "codesdown": [], + "codesup": [] + } + }, + { + "order": [ + "att", + "codesdown", + "codesup" + ], + "att": [ + [ + "type", + "u8", + 57 + ], + [ + "id", + "u8", + 10 + ], + [ + "objname", + "str", + "rA" + ], + [ + "vscope", + "u8", + "local" + ], + [ + "drag", + "u8", + 0 + ], + [ + "sendkey", + "u8", + 0 + ], + [ + "aph", + "u8", + 127 + ], + [ + "movex", + "u16", + 0 + ], + [ + "movey", + "u16", + 0 + ], + [ + "x", + "u16", + 150 + ], + [ + "y", + "u16", + 190 + ], + [ + "w", + "u16", + 30 + ], + [ + "h", + "u16", + 30 + ], + [ + "endx", + "u16", + 179 + ], + [ + "endy", + "u16", + 219 + ], + [ + "effect", + "u8", + 0 + ], + [ + "first", + "u8", + 0 + ], + [ + "time", + "u16", + 300 + ], + [ + "lockobj", + "u8", + 0 + ], + [ + "groupid0", + "u32", + 0 + ], + [ + "groupid1", + "u32", + 0 + ], + [ + "bco", + "u16", + "#ffffff" + ], + [ + "pco", + "u16", + "#000000" + ], + [ + "val", + "u8", + 1 + ] + ], + "events": { + "codesdown": [], + "codesup": [] + } + }, + { + "order": [ + "att", + "codesdown", + "codesup" + ], + "att": [ + [ + "type", + "u8", + 57 + ], + [ + "id", + "u8", + 11 + ], + [ + "objname", + "str", + "rB" + ], + [ + "vscope", + "u8", + "local" + ], + [ + "drag", + "u8", + 0 + ], + [ + "sendkey", + "u8", + 0 + ], + [ + "aph", + "u8", + 127 + ], + [ + "movex", + "u16", + 0 + ], + [ + "movey", + "u16", + 0 + ], + [ + "x", + "u16", + 190 + ], + [ + "y", + "u16", + 190 + ], + [ + "w", + "u16", + 30 + ], + [ + "h", + "u16", + 30 + ], + [ + "endx", + "u16", + 219 + ], + [ + "endy", + "u16", + 219 + ], + [ + "effect", + "u8", + 0 + ], + [ + "first", + "u8", + 0 + ], + [ + "time", + "u16", + 300 + ], + [ + "lockobj", + "u8", + 0 + ], + [ + "groupid0", + "u32", + 0 + ], + [ + "groupid1", + "u32", + 0 + ], + [ + "bco", + "u16", + "#ffffff" + ], + [ + "pco", + "u16", + "#000000" + ], + [ + "val", + "u8", + 0 + ] + ], + "events": { + "codesdown": [], + "codesup": [] + } + }, + { + "order": [ + "att", + "codesdown", + "codesup" + ], + "att": [ + [ + "type", + "u8", + 122 + ], + [ + "id", + "u8", + 12 + ], + [ + "objname", + "str", + "zSpeed" + ], + [ + "vscope", + "u8", + "local" + ], + [ + "drag", + "u8", + 0 + ], + [ + "sendkey", + "u8", + 0 + ], + [ + "aph", + "u8", + 127 + ], + [ + "movex", + "u16", + 0 + ], + [ + "movey", + "u16", + 0 + ], + [ + "x", + "u16", + 10 + ], + [ + "y", + "u16", + 230 + ], + [ + "w", + "u16", + 80 + ], + [ + "h", + "u16", + 80 + ], + [ + "endx", + "u16", + 89 + ], + [ + "endy", + "u16", + 309 + ], + [ + "effect", + "u8", + 0 + ], + [ + "first", + "u8", + 0 + ], + [ + "time", + "u16", + 300 + ], + [ + "lockobj", + "u8", + 0 + ], + [ + "groupid0", + "u32", + 0 + ], + [ + "groupid1", + "u32", + 0 + ], + [ + "sta", + "u8", + "solid color" + ], + [ + "picc", + "u16", + 65535 + ], + [ + "bco", + "u16", + "#ffffff" + ], + [ + "pic", + "u16", + 65535 + ], + [ + "val", + "u16", + 135 + ], + [ + "format", + "u16", + 0 + ], + [ + "up", + "u16", + 32767 + ], + [ + "down", + "u16", + 30 + ], + [ + "left", + "u16", + 0 + ], + [ + "pco", + "u16", + "#008200" + ], + [ + "pco2", + "u16", + "#ff0000" + ], + [ + "hig", + "u8", + 24 + ], + [ + "wid", + "u8", + 3 + ], + [ + "vvs0", + "u8", + 1 + ], + [ + "vvs1", + "u8", + 7 + ], + [ + "vvs2", + "u8", + 2 + ] + ], + "events": { + "codesdown": [], + "codesup": [] + } + }, + { + "order": [ + "att", + "codesdown", + "codesup" + ], + "att": [ + [ + "type", + "u8", + 112 + ], + [ + "id", + "u8", + 13 + ], + [ + "objname", + "str", + "pIcon" + ], + [ + "vscope", + "u8", + "local" + ], + [ + "drag", + "u8", + 0 + ], + [ + "sendkey", + "u8", + 0 + ], + [ + "aph", + "u8", + 127 + ], + [ + "movex", + "u16", + 0 + ], + [ + "movey", + "u16", + 0 + ], + [ + "x", + "u16", + 100 + ], + [ + "y", + "u16", + 240 + ], + [ + "w", + "u16", + 64 + ], + [ + "h", + "u16", + 64 + ], + [ + "endx", + "u16", + 163 + ], + [ + "endy", + "u16", + 303 + ], + [ + "effect", + "u8", + 0 + ], + [ + "first", + "u8", + 0 + ], + [ + "time", + "u16", + 300 + ], + [ + "lockobj", + "u8", + 0 + ], + [ + "groupid0", + "u32", + 0 + ], + [ + "groupid1", + "u32", + 0 + ], + [ + "pic", + "u16", + 1 + ] + ], + "events": { + "codesdown": [], + "codesup": [] + } + }, + { + "order": [ + "att", + "codesdown", + "codesup" + ], + "att": [ + [ + "type", + "u8", + 116 + ], + [ + "id", + "u8", + 14 + ], + [ + "objname", + "str", + "tStatus" + ], + [ + "vscope", + "u8", + "local" + ], + [ + "drag", + "u8", + 0 + ], + [ + "sendkey", + "u8", + 0 + ], + [ + "aph", + "u8", + 127 + ], + [ + "movex", + "u16", + 0 + ], + [ + "movey", + "u16", + 0 + ], + [ + "x", + "u16", + 180 + ], + [ + "y", + "u16", + 270 + ], + [ + "w", + "u16", + 290 + ], + [ + "h", + "u16", + 40 + ], + [ + "endx", + "u16", + 469 + ], + [ + "endy", + "u16", + 309 + ], + [ + "effect", + "u8", + 0 + ], + [ + "first", + "u8", + 0 + ], + [ + "time", + "u16", + 300 + ], + [ + "lockobj", + "u8", + 0 + ], + [ + "groupid0", + "u32", + 0 + ], + [ + "groupid1", + "u32", + 0 + ], + [ + "sta", + "u8", + "solid color" + ], + [ + "style", + "u8", + "border" + ], + [ + "key", + "u8", + 255 + ], + [ + "borderc", + "u16", + "#00ff00" + ], + [ + "borderw", + "u8", + 2 + ], + [ + "font", + "u8", + 0 + ], + [ + "bco", + "u16", + "#000000" + ], + [ + "picc", + "u16", + 65535 + ], + [ + "pic", + "u16", + 65535 + ], + [ + "pco", + "u16", + "#00ff00" + ], + [ + "xcen", + "u8", + "left" + ], + [ + "ycen", + "u8", + "center" + ], + [ + "pw", + "u8", + "character" + ], + [ + "txt", + "str", + "status: ok" + ], + [ + "txt_maxl", + "u16", + 10 + ], + [ + "isbr", + "u8", + "false" + ], + [ + "spax", + "u8", + 0 + ], + [ + "spay", + "u8", + 0 + ] + ], + "events": { + "codesdown": [], + "codesup": [] + } + }, + { + "order": [ + "att", + "codestimer" + ], + "att": [ + [ + "type", + "u8", + 51 + ], + [ + "id", + "u8", + 15 + ], + [ + "objname", + "str", + "tm0" + ], + [ + "vscope", + "u8", + "local" + ], + [ + "lockobj", + "u8", + 0 + ], + [ + "groupid0", + "u32", + 0 + ], + [ + "groupid1", + "u32", + 0 + ], + [ + "tim", + "u16", + 1000 + ], + [ + "en", + "u8", + "disable" + ] + ], + "events": { + "codestimer": [ + "nCount.val++" + ] + } + }, + { + "order": [ + "att" + ], + "att": [ + [ + "type", + "u8", + 52 + ], + [ + "id", + "u8", + 16 + ], + [ + "objname", + "str", + "vaMode" + ], + [ + "vscope", + "u8", + "local" + ], + [ + "lockobj", + "u8", + 0 + ], + [ + "groupid0", + "u32", + 0 + ], + [ + "groupid1", + "u32", + 0 + ], + [ + "sta", + "u8", + "number" + ], + [ + "txt", + "str", + "newtxt" + ], + [ + "txt_maxl", + "u16", + 10 + ], + [ + "val", + "u32", + 1 + ] + ], + "events": {} + } + ] +} \ No newline at end of file diff --git a/demo/decoded/pages/1_controls.json b/demo/decoded/pages/1_controls.json new file mode 100644 index 0000000..8435de4 --- /dev/null +++ b/demo/decoded/pages/1_controls.json @@ -0,0 +1,3242 @@ +{ + "file": "1.pa", + "name": "controls", + "password": 0, + "locked": 0, + "b21": 79, + "version": 33, + "b23": 0, + "reserved_hex": "00000000000000000000000000000000", + "components": [ + { + "order": [ + "att", + "codesload", + "codesloadend", + "codesdown", + "codesup", + "codesunload" + ], + "att": [ + [ + "type", + "u8", + 121 + ], + [ + "id", + "u8", + 0 + ], + [ + "objname", + "str", + "controls" + ], + [ + "vscope", + "u8", + "local" + ], + [ + "drag", + "u8", + 0 + ], + [ + "sendkey", + "u8", + 0 + ], + [ + "aph", + "u8", + 127 + ], + [ + "movex", + "u16", + 0 + ], + [ + "movey", + "u16", + 0 + ], + [ + "x", + "u16", + 0 + ], + [ + "y", + "u16", + 0 + ], + [ + "w", + "u16", + 480 + ], + [ + "h", + "u16", + 320 + ], + [ + "endx", + "u16", + 479 + ], + [ + "endy", + "u16", + 319 + ], + [ + "effect", + "u8", + 0 + ], + [ + "first", + "u8", + 0 + ], + [ + "time", + "u16", + 300 + ], + [ + "lockobj", + "u8", + 0 + ], + [ + "groupid0", + "u32", + 0 + ], + [ + "groupid1", + "u32", + 0 + ], + [ + "up", + "u8", + 255 + ], + [ + "down", + "u8", + 255 + ], + [ + "left", + "u8", + 255 + ], + [ + "right", + "u8", + 255 + ], + [ + "sta", + "u8", + "solid color" + ], + [ + "bco", + "u16", + "#efefef" + ], + [ + "pic", + "u16", + 0 + ] + ], + "events": { + "codesload": [], + "codesloadend": [], + "codesdown": [], + "codesup": [], + "codesunload": [] + } + }, + { + "order": [ + "att", + "codesdown", + "codesup" + ], + "att": [ + [ + "type", + "u8", + 98 + ], + [ + "id", + "u8", + 1 + ], + [ + "objname", + "str", + "bBack" + ], + [ + "vscope", + "u8", + "local" + ], + [ + "drag", + "u8", + 0 + ], + [ + "sendkey", + "u8", + 0 + ], + [ + "aph", + "u8", + 127 + ], + [ + "movex", + "u16", + 0 + ], + [ + "movey", + "u16", + 0 + ], + [ + "x", + "u16", + 10 + ], + [ + "y", + "u16", + 6 + ], + [ + "w", + "u16", + 80 + ], + [ + "h", + "u16", + 34 + ], + [ + "endx", + "u16", + 89 + ], + [ + "endy", + "u16", + 39 + ], + [ + "effect", + "u8", + 0 + ], + [ + "first", + "u8", + 0 + ], + [ + "time", + "u16", + 300 + ], + [ + "lockobj", + "u8", + 0 + ], + [ + "groupid0", + "u32", + 0 + ], + [ + "groupid1", + "u32", + 0 + ], + [ + "sta", + "u8", + "solid color" + ], + [ + "style", + "u8", + "3D_Auto" + ], + [ + "borderc", + "u16", + "#000000" + ], + [ + "borderw", + "u8", + 2 + ], + [ + "font", + "u8", + 0 + ], + [ + "pic", + "u16", + 65535 + ], + [ + "picc", + "u16", + 65535 + ], + [ + "bco", + "u16", + "#c6c3c6" + ], + [ + "pic2", + "u16", + 65535 + ], + [ + "picc2", + "u16", + 65535 + ], + [ + "bco2", + "u16", + "#008200" + ], + [ + "pco", + "u16", + "#000000" + ], + [ + "pco2", + "u16", + "#ffffff" + ], + [ + "xcen", + "u8", + "center" + ], + [ + "ycen", + "u8", + "center" + ], + [ + "val", + "u8", + 0 + ], + [ + "txt", + "str", + "< back" + ], + [ + "txt_maxl", + "u16", + 10 + ], + [ + "isbr", + "u8", + "false" + ], + [ + "spax", + "u8", + 0 + ], + [ + "spay", + "u8", + 0 + ] + ], + "events": { + "codesdown": [], + "codesup": [ + "page home" + ] + } + }, + { + "order": [ + "att", + "codesdown", + "codesup" + ], + "att": [ + [ + "type", + "u8", + 116 + ], + [ + "id", + "u8", + 2 + ], + [ + "objname", + "str", + "tHead" + ], + [ + "vscope", + "u8", + "local" + ], + [ + "drag", + "u8", + 0 + ], + [ + "sendkey", + "u8", + 0 + ], + [ + "aph", + "u8", + 127 + ], + [ + "movex", + "u16", + 0 + ], + [ + "movey", + "u16", + 0 + ], + [ + "x", + "u16", + 100 + ], + [ + "y", + "u16", + 6 + ], + [ + "w", + "u16", + 370 + ], + [ + "h", + "u16", + 34 + ], + [ + "endx", + "u16", + 469 + ], + [ + "endy", + "u16", + 39 + ], + [ + "effect", + "u8", + 0 + ], + [ + "first", + "u8", + 0 + ], + [ + "time", + "u16", + 300 + ], + [ + "lockobj", + "u8", + 0 + ], + [ + "groupid0", + "u32", + 0 + ], + [ + "groupid1", + "u32", + 0 + ], + [ + "sta", + "u8", + "solid color" + ], + [ + "style", + "u8", + "flat" + ], + [ + "key", + "u8", + 255 + ], + [ + "borderc", + "u16", + "#000000" + ], + [ + "borderw", + "u8", + 2 + ], + [ + "font", + "u8", + 1 + ], + [ + "bco", + "u16", + "#efefef" + ], + [ + "picc", + "u16", + 65535 + ], + [ + "pic", + "u16", + 65535 + ], + [ + "pco", + "u16", + "#000000" + ], + [ + "xcen", + "u8", + "right" + ], + [ + "ycen", + "u8", + "center" + ], + [ + "pw", + "u8", + "character" + ], + [ + "txt", + "str", + "controls" + ], + [ + "txt_maxl", + "u16", + 10 + ], + [ + "isbr", + "u8", + "false" + ], + [ + "spax", + "u8", + 0 + ], + [ + "spay", + "u8", + 0 + ] + ], + "events": { + "codesdown": [], + "codesup": [] + } + }, + { + "order": [ + "att", + "codesdown", + "codesup" + ], + "att": [ + [ + "type", + "u8", + 116 + ], + [ + "id", + "u8", + 3 + ], + [ + "objname", + "str", + "tAlign0" + ], + [ + "vscope", + "u8", + "local" + ], + [ + "drag", + "u8", + 0 + ], + [ + "sendkey", + "u8", + 0 + ], + [ + "aph", + "u8", + 127 + ], + [ + "movex", + "u16", + 0 + ], + [ + "movey", + "u16", + 0 + ], + [ + "x", + "u16", + 10 + ], + [ + "y", + "u16", + 50 + ], + [ + "w", + "u16", + 225 + ], + [ + "h", + "u16", + 48 + ], + [ + "endx", + "u16", + 234 + ], + [ + "endy", + "u16", + 97 + ], + [ + "effect", + "u8", + 0 + ], + [ + "first", + "u8", + 0 + ], + [ + "time", + "u16", + 300 + ], + [ + "lockobj", + "u8", + 0 + ], + [ + "groupid0", + "u32", + 0 + ], + [ + "groupid1", + "u32", + 0 + ], + [ + "sta", + "u8", + "solid color" + ], + [ + "style", + "u8", + "flat" + ], + [ + "key", + "u8", + 255 + ], + [ + "borderc", + "u16", + "#0000ff" + ], + [ + "borderw", + "u8", + 2 + ], + [ + "font", + "u8", + 0 + ], + [ + "bco", + "u16", + "#ffffff" + ], + [ + "picc", + "u16", + 65535 + ], + [ + "pic", + "u16", + 65535 + ], + [ + "pco", + "u16", + "#000000" + ], + [ + "xcen", + "u8", + "left" + ], + [ + "ycen", + "u8", + "up" + ], + [ + "pw", + "u8", + "character" + ], + [ + "txt", + "str", + "left/top flat" + ], + [ + "txt_maxl", + "u16", + 10 + ], + [ + "isbr", + "u8", + "false" + ], + [ + "spax", + "u8", + 0 + ], + [ + "spay", + "u8", + 0 + ] + ], + "events": { + "codesdown": [], + "codesup": [] + } + }, + { + "order": [ + "att", + "codesdown", + "codesup" + ], + "att": [ + [ + "type", + "u8", + 116 + ], + [ + "id", + "u8", + 4 + ], + [ + "objname", + "str", + "tAlign1" + ], + [ + "vscope", + "u8", + "local" + ], + [ + "drag", + "u8", + 0 + ], + [ + "sendkey", + "u8", + 0 + ], + [ + "aph", + "u8", + 127 + ], + [ + "movex", + "u16", + 0 + ], + [ + "movey", + "u16", + 0 + ], + [ + "x", + "u16", + 245 + ], + [ + "y", + "u16", + 50 + ], + [ + "w", + "u16", + 225 + ], + [ + "h", + "u16", + 48 + ], + [ + "endx", + "u16", + 469 + ], + [ + "endy", + "u16", + 97 + ], + [ + "effect", + "u8", + 0 + ], + [ + "first", + "u8", + 0 + ], + [ + "time", + "u16", + 300 + ], + [ + "lockobj", + "u8", + 0 + ], + [ + "groupid0", + "u32", + 0 + ], + [ + "groupid1", + "u32", + 0 + ], + [ + "sta", + "u8", + "solid color" + ], + [ + "style", + "u8", + "border" + ], + [ + "key", + "u8", + 255 + ], + [ + "borderc", + "u16", + "#0000ff" + ], + [ + "borderw", + "u8", + 2 + ], + [ + "font", + "u8", + 0 + ], + [ + "bco", + "u16", + "#ffffff" + ], + [ + "picc", + "u16", + 65535 + ], + [ + "pic", + "u16", + 65535 + ], + [ + "pco", + "u16", + "#000000" + ], + [ + "xcen", + "u8", + "center" + ], + [ + "ycen", + "u8", + "center" + ], + [ + "pw", + "u8", + "character" + ], + [ + "txt", + "str", + "center border" + ], + [ + "txt_maxl", + "u16", + 10 + ], + [ + "isbr", + "u8", + "false" + ], + [ + "spax", + "u8", + 0 + ], + [ + "spay", + "u8", + 0 + ] + ], + "events": { + "codesdown": [], + "codesup": [] + } + }, + { + "order": [ + "att", + "codesdown", + "codesup" + ], + "att": [ + [ + "type", + "u8", + 116 + ], + [ + "id", + "u8", + 5 + ], + [ + "objname", + "str", + "tAlign2" + ], + [ + "vscope", + "u8", + "local" + ], + [ + "drag", + "u8", + 0 + ], + [ + "sendkey", + "u8", + 0 + ], + [ + "aph", + "u8", + 127 + ], + [ + "movex", + "u16", + 0 + ], + [ + "movey", + "u16", + 0 + ], + [ + "x", + "u16", + 10 + ], + [ + "y", + "u16", + 105 + ], + [ + "w", + "u16", + 225 + ], + [ + "h", + "u16", + 48 + ], + [ + "endx", + "u16", + 234 + ], + [ + "endy", + "u16", + 152 + ], + [ + "effect", + "u8", + 0 + ], + [ + "first", + "u8", + 0 + ], + [ + "time", + "u16", + 300 + ], + [ + "lockobj", + "u8", + 0 + ], + [ + "groupid0", + "u32", + 0 + ], + [ + "groupid1", + "u32", + 0 + ], + [ + "sta", + "u8", + "solid color" + ], + [ + "style", + "u8", + "3D_Down" + ], + [ + "key", + "u8", + 255 + ], + [ + "borderc", + "u16", + "#0000ff" + ], + [ + "borderw", + "u8", + 2 + ], + [ + "font", + "u8", + 0 + ], + [ + "bco", + "u16", + "#ffffff" + ], + [ + "picc", + "u16", + 65535 + ], + [ + "pic", + "u16", + 65535 + ], + [ + "pco", + "u16", + "#000000" + ], + [ + "xcen", + "u8", + "right" + ], + [ + "ycen", + "u8", + "down" + ], + [ + "pw", + "u8", + "character" + ], + [ + "txt", + "str", + "right 3D down" + ], + [ + "txt_maxl", + "u16", + 10 + ], + [ + "isbr", + "u8", + "false" + ], + [ + "spax", + "u8", + 0 + ], + [ + "spay", + "u8", + 0 + ] + ], + "events": { + "codesdown": [], + "codesup": [] + } + }, + { + "order": [ + "att", + "codesdown", + "codesup" + ], + "att": [ + [ + "type", + "u8", + 116 + ], + [ + "id", + "u8", + 6 + ], + [ + "objname", + "str", + "tAlign3" + ], + [ + "vscope", + "u8", + "local" + ], + [ + "drag", + "u8", + 0 + ], + [ + "sendkey", + "u8", + 0 + ], + [ + "aph", + "u8", + 127 + ], + [ + "movex", + "u16", + 0 + ], + [ + "movey", + "u16", + 0 + ], + [ + "x", + "u16", + 245 + ], + [ + "y", + "u16", + 105 + ], + [ + "w", + "u16", + 225 + ], + [ + "h", + "u16", + 48 + ], + [ + "endx", + "u16", + 469 + ], + [ + "endy", + "u16", + 152 + ], + [ + "effect", + "u8", + 0 + ], + [ + "first", + "u8", + 0 + ], + [ + "time", + "u16", + 300 + ], + [ + "lockobj", + "u8", + 0 + ], + [ + "groupid0", + "u32", + 0 + ], + [ + "groupid1", + "u32", + 0 + ], + [ + "sta", + "u8", + "solid color" + ], + [ + "style", + "u8", + "3D_Up" + ], + [ + "key", + "u8", + 255 + ], + [ + "borderc", + "u16", + "#0000ff" + ], + [ + "borderw", + "u8", + 2 + ], + [ + "font", + "u8", + 0 + ], + [ + "bco", + "u16", + "#ffffff" + ], + [ + "picc", + "u16", + 65535 + ], + [ + "pic", + "u16", + 65535 + ], + [ + "pco", + "u16", + "#000000" + ], + [ + "xcen", + "u8", + "center" + ], + [ + "ycen", + "u8", + "center" + ], + [ + "pw", + "u8", + "character" + ], + [ + "txt", + "str", + "3D up" + ], + [ + "txt_maxl", + "u16", + 10 + ], + [ + "isbr", + "u8", + "false" + ], + [ + "spax", + "u8", + 0 + ], + [ + "spay", + "u8", + 0 + ] + ], + "events": { + "codesdown": [], + "codesup": [] + } + }, + { + "order": [ + "att", + "codesdown", + "codesup" + ], + "att": [ + [ + "type", + "u8", + 116 + ], + [ + "id", + "u8", + 7 + ], + [ + "objname", + "str", + "tWrap" + ], + [ + "vscope", + "u8", + "local" + ], + [ + "drag", + "u8", + 0 + ], + [ + "sendkey", + "u8", + 0 + ], + [ + "aph", + "u8", + 127 + ], + [ + "movex", + "u16", + 0 + ], + [ + "movey", + "u16", + 0 + ], + [ + "x", + "u16", + 10 + ], + [ + "y", + "u16", + 162 + ], + [ + "w", + "u16", + 150 + ], + [ + "h", + "u16", + 60 + ], + [ + "endx", + "u16", + 159 + ], + [ + "endy", + "u16", + 221 + ], + [ + "effect", + "u8", + 0 + ], + [ + "first", + "u8", + 0 + ], + [ + "time", + "u16", + 300 + ], + [ + "lockobj", + "u8", + 0 + ], + [ + "groupid0", + "u32", + 0 + ], + [ + "groupid1", + "u32", + 0 + ], + [ + "sta", + "u8", + "solid color" + ], + [ + "style", + "u8", + "border" + ], + [ + "key", + "u8", + 255 + ], + [ + "borderc", + "u16", + "#000000" + ], + [ + "borderw", + "u8", + 1 + ], + [ + "font", + "u8", + 0 + ], + [ + "bco", + "u16", + "#ffffff" + ], + [ + "picc", + "u16", + 65535 + ], + [ + "pic", + "u16", + 65535 + ], + [ + "pco", + "u16", + "#000000" + ], + [ + "xcen", + "u8", + "center" + ], + [ + "ycen", + "u8", + "center" + ], + [ + "pw", + "u8", + "character" + ], + [ + "txt", + "str", + "word wrap inside a narrow box" + ], + [ + "txt_maxl", + "u16", + 10 + ], + [ + "isbr", + "u8", + "true" + ], + [ + "spax", + "u8", + 0 + ], + [ + "spay", + "u8", + 0 + ] + ], + "events": { + "codesdown": [], + "codesup": [] + } + }, + { + "order": [ + "att", + "codesdown", + "codesup" + ], + "att": [ + [ + "type", + "u8", + 53 + ], + [ + "id", + "u8", + 8 + ], + [ + "objname", + "str", + "btOff" + ], + [ + "vscope", + "u8", + "local" + ], + [ + "drag", + "u8", + 0 + ], + [ + "sendkey", + "u8", + 0 + ], + [ + "aph", + "u8", + 127 + ], + [ + "movex", + "u16", + 0 + ], + [ + "movey", + "u16", + 0 + ], + [ + "x", + "u16", + 170 + ], + [ + "y", + "u16", + 162 + ], + [ + "w", + "u16", + 140 + ], + [ + "h", + "u16", + 28 + ], + [ + "endx", + "u16", + 309 + ], + [ + "endy", + "u16", + 189 + ], + [ + "effect", + "u8", + 0 + ], + [ + "first", + "u8", + 0 + ], + [ + "time", + "u16", + 300 + ], + [ + "lockobj", + "u8", + 0 + ], + [ + "groupid0", + "u32", + 0 + ], + [ + "groupid1", + "u32", + 0 + ], + [ + "sta", + "u8", + "solid color" + ], + [ + "style", + "u8", + "3D_Auto" + ], + [ + "borderc", + "u16", + "#000000" + ], + [ + "borderw", + "u8", + 2 + ], + [ + "font", + "u8", + 0 + ], + [ + "pic", + "u16", + 65535 + ], + [ + "picc", + "u16", + 65535 + ], + [ + "bco", + "u16", + "#c6c3c6" + ], + [ + "pic2", + "u16", + 65535 + ], + [ + "picc2", + "u16", + 65535 + ], + [ + "bco2", + "u16", + "#008200" + ], + [ + "pco", + "u16", + "#000000" + ], + [ + "pco2", + "u16", + "#ffffff" + ], + [ + "xcen", + "u8", + "center" + ], + [ + "ycen", + "u8", + "center" + ], + [ + "val", + "u8", + 0 + ], + [ + "txt", + "str", + "off" + ], + [ + "txt_maxl", + "u16", + 10 + ], + [ + "isbr", + "u8", + "false" + ], + [ + "spax", + "u8", + 0 + ], + [ + "spay", + "u8", + 0 + ] + ], + "events": { + "codesdown": [], + "codesup": [] + } + }, + { + "order": [ + "att", + "codesdown", + "codesup" + ], + "att": [ + [ + "type", + "u8", + 53 + ], + [ + "id", + "u8", + 9 + ], + [ + "objname", + "str", + "btOn" + ], + [ + "vscope", + "u8", + "local" + ], + [ + "drag", + "u8", + 0 + ], + [ + "sendkey", + "u8", + 0 + ], + [ + "aph", + "u8", + 127 + ], + [ + "movex", + "u16", + 0 + ], + [ + "movey", + "u16", + 0 + ], + [ + "x", + "u16", + 170 + ], + [ + "y", + "u16", + 194 + ], + [ + "w", + "u16", + 140 + ], + [ + "h", + "u16", + 28 + ], + [ + "endx", + "u16", + 309 + ], + [ + "endy", + "u16", + 221 + ], + [ + "effect", + "u8", + 0 + ], + [ + "first", + "u8", + 0 + ], + [ + "time", + "u16", + 300 + ], + [ + "lockobj", + "u8", + 0 + ], + [ + "groupid0", + "u32", + 0 + ], + [ + "groupid1", + "u32", + 0 + ], + [ + "sta", + "u8", + "solid color" + ], + [ + "style", + "u8", + "3D_Auto" + ], + [ + "borderc", + "u16", + "#000000" + ], + [ + "borderw", + "u8", + 2 + ], + [ + "font", + "u8", + 0 + ], + [ + "pic", + "u16", + 65535 + ], + [ + "picc", + "u16", + 65535 + ], + [ + "bco", + "u16", + "#c6c3c6" + ], + [ + "pic2", + "u16", + 65535 + ], + [ + "picc2", + "u16", + 65535 + ], + [ + "bco2", + "u16", + "#008200" + ], + [ + "pco", + "u16", + "#000000" + ], + [ + "pco2", + "u16", + "#ffffff" + ], + [ + "xcen", + "u8", + "center" + ], + [ + "ycen", + "u8", + "center" + ], + [ + "val", + "u8", + 1 + ], + [ + "txt", + "str", + "on" + ], + [ + "txt_maxl", + "u16", + 10 + ], + [ + "isbr", + "u8", + "false" + ], + [ + "spax", + "u8", + 0 + ], + [ + "spay", + "u8", + 0 + ] + ], + "events": { + "codesdown": [], + "codesup": [] + } + }, + { + "order": [ + "att", + "codesdown", + "codesup" + ], + "att": [ + [ + "type", + "u8", + 55 + ], + [ + "id", + "u8", + 10 + ], + [ + "objname", + "str", + "gNews" + ], + [ + "vscope", + "u8", + "local" + ], + [ + "drag", + "u8", + 0 + ], + [ + "sendkey", + "u8", + 0 + ], + [ + "aph", + "u8", + 127 + ], + [ + "movex", + "u16", + 0 + ], + [ + "movey", + "u16", + 0 + ], + [ + "x", + "u16", + 320 + ], + [ + "y", + "u16", + 162 + ], + [ + "w", + "u16", + 150 + ], + [ + "h", + "u16", + 28 + ], + [ + "endx", + "u16", + 469 + ], + [ + "endy", + "u16", + 189 + ], + [ + "effect", + "u8", + 0 + ], + [ + "first", + "u8", + 0 + ], + [ + "time", + "u16", + 300 + ], + [ + "lockobj", + "u8", + 0 + ], + [ + "groupid0", + "u32", + 0 + ], + [ + "groupid1", + "u32", + 0 + ], + [ + "sta", + "u8", + "solid color" + ], + [ + "style", + "u8", + "flat" + ], + [ + "key", + "u8", + 255 + ], + [ + "borderc", + "u16", + "#000000" + ], + [ + "borderw", + "u8", + 2 + ], + [ + "font", + "u8", + 0 + ], + [ + "bco", + "u16", + "#ffffff" + ], + [ + "picc", + "u16", + 65535 + ], + [ + "pic", + "u16", + 65535 + ], + [ + "pco", + "u16", + "#000000" + ], + [ + "xcen", + "u8", + "center" + ], + [ + "ycen", + "u8", + "center" + ], + [ + "dir", + "u8", + "right to left" + ], + [ + "dis", + "u8", + 4 + ], + [ + "tim", + "u16", + 150 + ], + [ + "en", + "u8", + "enable" + ], + [ + "txt", + "str", + "scrolling text" + ], + [ + "txt_maxl", + "u16", + 10 + ], + [ + "isbr", + "u8", + "false" + ], + [ + "spax", + "u8", + 0 + ], + [ + "spay", + "u8", + 0 + ], + [ + "vvs0", + "u16", + 0 + ], + [ + "vvs1", + "u16", + 0 + ], + [ + "vvs2", + "u16", + 0 + ], + [ + "vvs3", + "u16", + 0 + ] + ], + "events": { + "codesdown": [], + "codesup": [] + } + }, + { + "order": [ + "att", + "codesdown", + "codesup" + ], + "att": [ + [ + "type", + "u8", + 54 + ], + [ + "id", + "u8", + 11 + ], + [ + "objname", + "str", + "nHex" + ], + [ + "vscope", + "u8", + "local" + ], + [ + "drag", + "u8", + 0 + ], + [ + "sendkey", + "u8", + 0 + ], + [ + "aph", + "u8", + 127 + ], + [ + "movex", + "u16", + 0 + ], + [ + "movey", + "u16", + 0 + ], + [ + "x", + "u16", + 320 + ], + [ + "y", + "u16", + 194 + ], + [ + "w", + "u16", + 150 + ], + [ + "h", + "u16", + 28 + ], + [ + "endx", + "u16", + 469 + ], + [ + "endy", + "u16", + 221 + ], + [ + "effect", + "u8", + 0 + ], + [ + "first", + "u8", + 0 + ], + [ + "time", + "u16", + 300 + ], + [ + "lockobj", + "u8", + 0 + ], + [ + "groupid0", + "u32", + 0 + ], + [ + "groupid1", + "u32", + 0 + ], + [ + "sta", + "u8", + "solid color" + ], + [ + "style", + "u8", + "flat" + ], + [ + "key", + "u8", + 255 + ], + [ + "borderc", + "u16", + "#000000" + ], + [ + "borderw", + "u8", + 2 + ], + [ + "font", + "u8", + 0 + ], + [ + "bco", + "u16", + "#ffffff" + ], + [ + "picc", + "u16", + 65535 + ], + [ + "pic", + "u16", + 65535 + ], + [ + "pco", + "u16", + "#000000" + ], + [ + "xcen", + "u8", + "center" + ], + [ + "ycen", + "u8", + "center" + ], + [ + "val", + "u32", + 48879 + ], + [ + "lenth", + "u8", + 0 + ], + [ + "format", + "u8", + "hex" + ], + [ + "isbr", + "u8", + "true" + ], + [ + "spax", + "u8", + 0 + ], + [ + "spay", + "u8", + 0 + ] + ], + "events": { + "codesdown": [], + "codesup": [] + } + }, + { + "order": [ + "att", + "codesdown", + "codesup" + ], + "att": [ + [ + "type", + "u8", + 0 + ], + [ + "id", + "u8", + 12 + ], + [ + "objname", + "str", + "sWave" + ], + [ + "vscope", + "u8", + "local" + ], + [ + "drag", + "u8", + 0 + ], + [ + "sendkey", + "u8", + 0 + ], + [ + "aph", + "u8", + 127 + ], + [ + "movex", + "u16", + 0 + ], + [ + "movey", + "u16", + 0 + ], + [ + "x", + "u16", + 10 + ], + [ + "y", + "u16", + 230 + ], + [ + "w", + "u16", + 300 + ], + [ + "h", + "u16", + 80 + ], + [ + "endx", + "u16", + 309 + ], + [ + "endy", + "u16", + 309 + ], + [ + "effect", + "u8", + 0 + ], + [ + "first", + "u8", + 0 + ], + [ + "time", + "u16", + 300 + ], + [ + "lockobj", + "u8", + 0 + ], + [ + "groupid0", + "u32", + 0 + ], + [ + "groupid1", + "u32", + 0 + ], + [ + "sta", + "u8", + "solid color" + ], + [ + "dir", + "u8", + "left to right" + ], + [ + "ch", + "u8", + 1 + ], + [ + "bco", + "u16", + "#000000" + ], + [ + "picc", + "u16", + 65535 + ], + [ + "pic", + "u16", + 65535 + ], + [ + "gdc", + "u16", + "#008200" + ], + [ + "gdw", + "u8", + 40 + ], + [ + "gdh", + "u8", + 40 + ], + [ + "objWid", + "u16", + 0 + ], + [ + "objHig", + "u16", + 0 + ], + [ + "pco0", + "u16", + "#ff7d7b" + ], + [ + "pco1", + "u16", + "#ffff7b" + ], + [ + "pco2", + "u16", + "#ff0000" + ], + [ + "pco3", + "u16", + "#00ff00" + ], + [ + "inittrue", + "u8", + 0 + ], + [ + "dis", + "u16", + 100 + ], + [ + "molloc_s", + "u32", + 0 + ], + [ + "molloc", + "u32", + 0 + ] + ], + "events": { + "codesdown": [], + "codesup": [] + } + }, + { + "order": [ + "att", + "codesdown", + "codesup" + ], + "att": [ + [ + "type", + "u8", + 106 + ], + [ + "id", + "u8", + 13 + ], + [ + "objname", + "str", + "jVert" + ], + [ + "vscope", + "u8", + "local" + ], + [ + "drag", + "u8", + 0 + ], + [ + "sendkey", + "u8", + 0 + ], + [ + "aph", + "u8", + 127 + ], + [ + "movex", + "u16", + 0 + ], + [ + "movey", + "u16", + 0 + ], + [ + "x", + "u16", + 320 + ], + [ + "y", + "u16", + 230 + ], + [ + "w", + "u16", + 30 + ], + [ + "h", + "u16", + 80 + ], + [ + "endx", + "u16", + 349 + ], + [ + "endy", + "u16", + 309 + ], + [ + "effect", + "u8", + 0 + ], + [ + "first", + "u8", + 0 + ], + [ + "time", + "u16", + 300 + ], + [ + "lockobj", + "u8", + 0 + ], + [ + "groupid0", + "u32", + 0 + ], + [ + "groupid1", + "u32", + 0 + ], + [ + "sta", + "u8", + "solid color" + ], + [ + "dez", + "u8", + "vertical" + ], + [ + "val", + "u8", + 70 + ], + [ + "dis", + "u8", + 25 + ], + [ + "bco", + "u16", + "#bdbebd" + ], + [ + "bpic", + "u16", + 65535 + ], + [ + "pco", + "u16", + "#008200" + ], + [ + "ppic", + "u16", + 65535 + ] + ], + "events": { + "codesdown": [], + "codesup": [] + } + }, + { + "order": [ + "att", + "codesdown", + "codesup", + "codesslide" + ], + "att": [ + [ + "type", + "u8", + 1 + ], + [ + "id", + "u8", + 14 + ], + [ + "objname", + "str", + "hVert" + ], + [ + "vscope", + "u8", + "local" + ], + [ + "drag", + "u8", + 0 + ], + [ + "sendkey", + "u8", + 0 + ], + [ + "aph", + "u8", + 127 + ], + [ + "movex", + "u16", + 0 + ], + [ + "movey", + "u16", + 0 + ], + [ + "x", + "u16", + 360 + ], + [ + "y", + "u16", + 230 + ], + [ + "w", + "u16", + 30 + ], + [ + "h", + "u16", + 80 + ], + [ + "endx", + "u16", + 389 + ], + [ + "endy", + "u16", + 309 + ], + [ + "effect", + "u8", + 0 + ], + [ + "first", + "u8", + 0 + ], + [ + "time", + "u16", + 300 + ], + [ + "lockobj", + "u8", + 0 + ], + [ + "groupid0", + "u32", + 0 + ], + [ + "groupid1", + "u32", + 0 + ], + [ + "mode", + "u8", + "vertical" + ], + [ + "sta", + "u8", + "solid color" + ], + [ + "psta", + "u8", + "solid" + ], + [ + "wid", + "u8", + 255 + ], + [ + "hig", + "u8", + 255 + ], + [ + "dis", + "u8", + 100 + ], + [ + "pic", + "u16", + 65535 + ], + [ + "picc", + "u16", + 65535 + ], + [ + "bco", + "u16", + "#008200" + ], + [ + "pic1", + "u16", + 65535 + ], + [ + "picc1", + "u16", + 65535 + ], + [ + "bco1", + "u16", + "#ff5d5a" + ], + [ + "pic2", + "u16", + 65535 + ], + [ + "pco", + "u16", + "#420000" + ], + [ + "val", + "u16", + 30 + ], + [ + "maxval", + "u16", + 100 + ], + [ + "minval", + "u16", + 0 + ], + [ + "ch", + "u8", + 25 + ] + ], + "events": { + "codesdown": [], + "codesup": [], + "codesslide": [] + } + }, + { + "order": [ + "att", + "codesdown", + "codesup" + ], + "att": [ + [ + "type", + "u8", + 109 + ], + [ + "id", + "u8", + 15 + ], + [ + "objname", + "str", + "mHot" + ], + [ + "vscope", + "u8", + "local" + ], + [ + "drag", + "u8", + 0 + ], + [ + "sendkey", + "u8", + 0 + ], + [ + "aph", + "u8", + 127 + ], + [ + "movex", + "u16", + 0 + ], + [ + "movey", + "u16", + 0 + ], + [ + "x", + "u16", + 400 + ], + [ + "y", + "u16", + 230 + ], + [ + "w", + "u16", + 70 + ], + [ + "h", + "u16", + 80 + ], + [ + "endx", + "u16", + 469 + ], + [ + "endy", + "u16", + 309 + ], + [ + "effect", + "u8", + 0 + ], + [ + "first", + "u8", + 0 + ], + [ + "time", + "u16", + 300 + ], + [ + "lockobj", + "u8", + 0 + ], + [ + "groupid0", + "u32", + 0 + ], + [ + "groupid1", + "u32", + 0 + ] + ], + "events": { + "codesdown": [], + "codesup": [ + "page home" + ] + } + } + ] +} \ No newline at end of file diff --git a/demo/decoded/pages/2_gallery.json b/demo/decoded/pages/2_gallery.json new file mode 100644 index 0000000..175070a --- /dev/null +++ b/demo/decoded/pages/2_gallery.json @@ -0,0 +1,1672 @@ +{ + "file": "2.pa", + "name": "gallery", + "password": 0, + "locked": 0, + "b21": 79, + "version": 33, + "b23": 0, + "reserved_hex": "00000000000000000000000000000000", + "components": [ + { + "order": [ + "att", + "codesload", + "codesloadend", + "codesdown", + "codesup", + "codesunload" + ], + "att": [ + [ + "type", + "u8", + 121 + ], + [ + "id", + "u8", + 0 + ], + [ + "objname", + "str", + "gallery" + ], + [ + "vscope", + "u8", + "local" + ], + [ + "drag", + "u8", + 0 + ], + [ + "sendkey", + "u8", + 0 + ], + [ + "aph", + "u8", + 127 + ], + [ + "movex", + "u16", + 0 + ], + [ + "movey", + "u16", + 0 + ], + [ + "x", + "u16", + 0 + ], + [ + "y", + "u16", + 0 + ], + [ + "w", + "u16", + 480 + ], + [ + "h", + "u16", + 320 + ], + [ + "endx", + "u16", + 479 + ], + [ + "endy", + "u16", + 319 + ], + [ + "effect", + "u8", + 0 + ], + [ + "first", + "u8", + 0 + ], + [ + "time", + "u16", + 300 + ], + [ + "lockobj", + "u8", + 0 + ], + [ + "groupid0", + "u32", + 0 + ], + [ + "groupid1", + "u32", + 0 + ], + [ + "up", + "u8", + 255 + ], + [ + "down", + "u8", + 255 + ], + [ + "left", + "u8", + 255 + ], + [ + "right", + "u8", + 255 + ], + [ + "sta", + "u8", + "solid color" + ], + [ + "bco", + "u16", + "#ffffff" + ], + [ + "pic", + "u16", + 0 + ] + ], + "events": { + "codesload": [], + "codesloadend": [], + "codesdown": [], + "codesup": [], + "codesunload": [] + } + }, + { + "order": [ + "att", + "codesdown", + "codesup" + ], + "att": [ + [ + "type", + "u8", + 98 + ], + [ + "id", + "u8", + 1 + ], + [ + "objname", + "str", + "bBack" + ], + [ + "vscope", + "u8", + "local" + ], + [ + "drag", + "u8", + 0 + ], + [ + "sendkey", + "u8", + 0 + ], + [ + "aph", + "u8", + 127 + ], + [ + "movex", + "u16", + 0 + ], + [ + "movey", + "u16", + 0 + ], + [ + "x", + "u16", + 10 + ], + [ + "y", + "u16", + 6 + ], + [ + "w", + "u16", + 80 + ], + [ + "h", + "u16", + 34 + ], + [ + "endx", + "u16", + 89 + ], + [ + "endy", + "u16", + 39 + ], + [ + "effect", + "u8", + 0 + ], + [ + "first", + "u8", + 0 + ], + [ + "time", + "u16", + 300 + ], + [ + "lockobj", + "u8", + 0 + ], + [ + "groupid0", + "u32", + 0 + ], + [ + "groupid1", + "u32", + 0 + ], + [ + "sta", + "u8", + "solid color" + ], + [ + "style", + "u8", + "3D_Auto" + ], + [ + "borderc", + "u16", + "#000000" + ], + [ + "borderw", + "u8", + 2 + ], + [ + "font", + "u8", + 0 + ], + [ + "pic", + "u16", + 65535 + ], + [ + "picc", + "u16", + 65535 + ], + [ + "bco", + "u16", + "#c6c3c6" + ], + [ + "pic2", + "u16", + 65535 + ], + [ + "picc2", + "u16", + 65535 + ], + [ + "bco2", + "u16", + "#008200" + ], + [ + "pco", + "u16", + "#000000" + ], + [ + "pco2", + "u16", + "#ffffff" + ], + [ + "xcen", + "u8", + "center" + ], + [ + "ycen", + "u8", + "center" + ], + [ + "val", + "u8", + 0 + ], + [ + "txt", + "str", + "< back" + ], + [ + "txt_maxl", + "u16", + 10 + ], + [ + "isbr", + "u8", + "false" + ], + [ + "spax", + "u8", + 0 + ], + [ + "spay", + "u8", + 0 + ] + ], + "events": { + "codesdown": [], + "codesup": [ + "page home" + ] + } + }, + { + "order": [ + "att", + "codesdown", + "codesup" + ], + "att": [ + [ + "type", + "u8", + 113 + ], + [ + "id", + "u8", + 2 + ], + [ + "objname", + "str", + "qBg" + ], + [ + "vscope", + "u8", + "local" + ], + [ + "drag", + "u8", + 0 + ], + [ + "sendkey", + "u8", + 0 + ], + [ + "aph", + "u8", + 127 + ], + [ + "movex", + "u16", + 0 + ], + [ + "movey", + "u16", + 0 + ], + [ + "x", + "u16", + 100 + ], + [ + "y", + "u16", + 6 + ], + [ + "w", + "u16", + 370 + ], + [ + "h", + "u16", + 34 + ], + [ + "endx", + "u16", + 469 + ], + [ + "endy", + "u16", + 39 + ], + [ + "effect", + "u8", + 0 + ], + [ + "first", + "u8", + 0 + ], + [ + "time", + "u16", + 300 + ], + [ + "lockobj", + "u8", + 0 + ], + [ + "groupid0", + "u32", + 0 + ], + [ + "groupid1", + "u32", + 0 + ], + [ + "picc", + "u16", + 0 + ], + [ + "vvs0", + "u16", + 0 + ], + [ + "vvs1", + "u16", + 0 + ] + ], + "events": { + "codesdown": [], + "codesup": [] + } + }, + { + "order": [ + "att", + "codesdown", + "codesup" + ], + "att": [ + [ + "type", + "u8", + 112 + ], + [ + "id", + "u8", + 3 + ], + [ + "objname", + "str", + "pIcon" + ], + [ + "vscope", + "u8", + "local" + ], + [ + "drag", + "u8", + 0 + ], + [ + "sendkey", + "u8", + 0 + ], + [ + "aph", + "u8", + 127 + ], + [ + "movex", + "u16", + 0 + ], + [ + "movey", + "u16", + 0 + ], + [ + "x", + "u16", + 10 + ], + [ + "y", + "u16", + 50 + ], + [ + "w", + "u16", + 64 + ], + [ + "h", + "u16", + 64 + ], + [ + "endx", + "u16", + 73 + ], + [ + "endy", + "u16", + 113 + ], + [ + "effect", + "u8", + 0 + ], + [ + "first", + "u8", + 0 + ], + [ + "time", + "u16", + 300 + ], + [ + "lockobj", + "u8", + 0 + ], + [ + "groupid0", + "u32", + 0 + ], + [ + "groupid1", + "u32", + 0 + ], + [ + "pic", + "u16", + 1 + ] + ], + "events": { + "codesdown": [], + "codesup": [] + } + }, + { + "order": [ + "att", + "codesdown", + "codesup" + ], + "att": [ + [ + "type", + "u8", + 98 + ], + [ + "id", + "u8", + 4 + ], + [ + "objname", + "str", + "bSkin" + ], + [ + "vscope", + "u8", + "local" + ], + [ + "drag", + "u8", + 0 + ], + [ + "sendkey", + "u8", + 0 + ], + [ + "aph", + "u8", + 127 + ], + [ + "movex", + "u16", + 0 + ], + [ + "movey", + "u16", + 0 + ], + [ + "x", + "u16", + 90 + ], + [ + "y", + "u16", + 50 + ], + [ + "w", + "u16", + 140 + ], + [ + "h", + "u16", + 40 + ], + [ + "endx", + "u16", + 229 + ], + [ + "endy", + "u16", + 89 + ], + [ + "effect", + "u8", + 0 + ], + [ + "first", + "u8", + 0 + ], + [ + "time", + "u16", + 300 + ], + [ + "lockobj", + "u8", + 0 + ], + [ + "groupid0", + "u32", + 0 + ], + [ + "groupid1", + "u32", + 0 + ], + [ + "sta", + "u8", + "image" + ], + [ + "style", + "u8", + "3D_Auto" + ], + [ + "borderc", + "u16", + "#000000" + ], + [ + "borderw", + "u8", + 2 + ], + [ + "font", + "u8", + 0 + ], + [ + "pic", + "u16", + 2 + ], + [ + "picc", + "u16", + 65535 + ], + [ + "bco", + "u16", + "#c6c3c6" + ], + [ + "pic2", + "u16", + 3 + ], + [ + "picc2", + "u16", + 65535 + ], + [ + "bco2", + "u16", + "#008200" + ], + [ + "pco", + "u16", + "#ffffff" + ], + [ + "pco2", + "u16", + "#ffffff" + ], + [ + "xcen", + "u8", + "center" + ], + [ + "ycen", + "u8", + "center" + ], + [ + "val", + "u8", + 0 + ], + [ + "txt", + "str", + "skinned" + ], + [ + "txt_maxl", + "u16", + 10 + ], + [ + "isbr", + "u8", + "false" + ], + [ + "spax", + "u8", + 0 + ], + [ + "spay", + "u8", + 0 + ] + ], + "events": { + "codesdown": [], + "codesup": [] + } + }, + { + "order": [ + "att", + "codesdown", + "codesup" + ], + "att": [ + [ + "type", + "u8", + 53 + ], + [ + "id", + "u8", + 5 + ], + [ + "objname", + "str", + "btSkin" + ], + [ + "vscope", + "u8", + "local" + ], + [ + "drag", + "u8", + 0 + ], + [ + "sendkey", + "u8", + 0 + ], + [ + "aph", + "u8", + 127 + ], + [ + "movex", + "u16", + 0 + ], + [ + "movey", + "u16", + 0 + ], + [ + "x", + "u16", + 240 + ], + [ + "y", + "u16", + 50 + ], + [ + "w", + "u16", + 140 + ], + [ + "h", + "u16", + 40 + ], + [ + "endx", + "u16", + 379 + ], + [ + "endy", + "u16", + 89 + ], + [ + "effect", + "u8", + 0 + ], + [ + "first", + "u8", + 0 + ], + [ + "time", + "u16", + 300 + ], + [ + "lockobj", + "u8", + 0 + ], + [ + "groupid0", + "u32", + 0 + ], + [ + "groupid1", + "u32", + 0 + ], + [ + "sta", + "u8", + "image" + ], + [ + "style", + "u8", + "3D_Auto" + ], + [ + "borderc", + "u16", + "#000000" + ], + [ + "borderw", + "u8", + 2 + ], + [ + "font", + "u8", + 0 + ], + [ + "pic", + "u16", + 2 + ], + [ + "picc", + "u16", + 65535 + ], + [ + "bco", + "u16", + "#c6c3c6" + ], + [ + "pic2", + "u16", + 3 + ], + [ + "picc2", + "u16", + 65535 + ], + [ + "bco2", + "u16", + "#008200" + ], + [ + "pco", + "u16", + "#ffffff" + ], + [ + "pco2", + "u16", + "#ffffff" + ], + [ + "xcen", + "u8", + "center" + ], + [ + "ycen", + "u8", + "center" + ], + [ + "val", + "u8", + 1 + ], + [ + "txt", + "str", + "dual on" + ], + [ + "txt_maxl", + "u16", + 10 + ], + [ + "isbr", + "u8", + "false" + ], + [ + "spax", + "u8", + 0 + ], + [ + "spay", + "u8", + 0 + ] + ], + "events": { + "codesdown": [], + "codesup": [] + } + }, + { + "order": [ + "att", + "codesdown", + "codesup" + ], + "att": [ + [ + "type", + "u8", + 106 + ], + [ + "id", + "u8", + 6 + ], + [ + "objname", + "str", + "jSkin" + ], + [ + "vscope", + "u8", + "local" + ], + [ + "drag", + "u8", + 0 + ], + [ + "sendkey", + "u8", + 0 + ], + [ + "aph", + "u8", + 127 + ], + [ + "movex", + "u16", + 0 + ], + [ + "movey", + "u16", + 0 + ], + [ + "x", + "u16", + 90 + ], + [ + "y", + "u16", + 100 + ], + [ + "w", + "u16", + 200 + ], + [ + "h", + "u16", + 24 + ], + [ + "endx", + "u16", + 289 + ], + [ + "endy", + "u16", + 123 + ], + [ + "effect", + "u8", + 0 + ], + [ + "first", + "u8", + 0 + ], + [ + "time", + "u16", + 300 + ], + [ + "lockobj", + "u8", + 0 + ], + [ + "groupid0", + "u32", + 0 + ], + [ + "groupid1", + "u32", + 0 + ], + [ + "sta", + "u8", + "image" + ], + [ + "dez", + "u8", + "horizontal" + ], + [ + "val", + "u8", + 55 + ], + [ + "dis", + "u8", + 25 + ], + [ + "bco", + "u16", + "#bdbebd" + ], + [ + "bpic", + "u16", + 4 + ], + [ + "pco", + "u16", + "#008200" + ], + [ + "ppic", + "u16", + 5 + ] + ], + "events": { + "codesdown": [], + "codesup": [] + } + }, + { + "order": [ + "att", + "codesdown", + "codesup" + ], + "att": [ + [ + "type", + "u8", + 116 + ], + [ + "id", + "u8", + 7 + ], + [ + "objname", + "str", + "tCrop" + ], + [ + "vscope", + "u8", + "local" + ], + [ + "drag", + "u8", + 0 + ], + [ + "sendkey", + "u8", + 0 + ], + [ + "aph", + "u8", + 127 + ], + [ + "movex", + "u16", + 0 + ], + [ + "movey", + "u16", + 0 + ], + [ + "x", + "u16", + 10 + ], + [ + "y", + "u16", + 140 + ], + [ + "w", + "u16", + 460 + ], + [ + "h", + "u16", + 60 + ], + [ + "endx", + "u16", + 469 + ], + [ + "endy", + "u16", + 199 + ], + [ + "effect", + "u8", + 0 + ], + [ + "first", + "u8", + 0 + ], + [ + "time", + "u16", + 300 + ], + [ + "lockobj", + "u8", + 0 + ], + [ + "groupid0", + "u32", + 0 + ], + [ + "groupid1", + "u32", + 0 + ], + [ + "sta", + "u8", + "crop image" + ], + [ + "style", + "u8", + "flat" + ], + [ + "key", + "u8", + 255 + ], + [ + "borderc", + "u16", + "#000000" + ], + [ + "borderw", + "u8", + 2 + ], + [ + "font", + "u8", + 1 + ], + [ + "bco", + "u16", + "#ffffff" + ], + [ + "picc", + "u16", + 0 + ], + [ + "pic", + "u16", + 65535 + ], + [ + "pco", + "u16", + "#ffffff" + ], + [ + "xcen", + "u8", + "center" + ], + [ + "ycen", + "u8", + "center" + ], + [ + "pw", + "u8", + "character" + ], + [ + "txt", + "str", + "text on a cropped background" + ], + [ + "txt_maxl", + "u16", + 10 + ], + [ + "isbr", + "u8", + "false" + ], + [ + "spax", + "u8", + 0 + ], + [ + "spay", + "u8", + 0 + ] + ], + "events": { + "codesdown": [], + "codesup": [] + } + }, + { + "order": [ + "att", + "codesdown", + "codesup" + ], + "att": [ + [ + "type", + "u8", + 116 + ], + [ + "id", + "u8", + 8 + ], + [ + "objname", + "str", + "tImg" + ], + [ + "vscope", + "u8", + "local" + ], + [ + "drag", + "u8", + 0 + ], + [ + "sendkey", + "u8", + 0 + ], + [ + "aph", + "u8", + 127 + ], + [ + "movex", + "u16", + 0 + ], + [ + "movey", + "u16", + 0 + ], + [ + "x", + "u16", + 10 + ], + [ + "y", + "u16", + 210 + ], + [ + "w", + "u16", + 200 + ], + [ + "h", + "u16", + 40 + ], + [ + "endx", + "u16", + 209 + ], + [ + "endy", + "u16", + 249 + ], + [ + "effect", + "u8", + 0 + ], + [ + "first", + "u8", + 0 + ], + [ + "time", + "u16", + 300 + ], + [ + "lockobj", + "u8", + 0 + ], + [ + "groupid0", + "u32", + 0 + ], + [ + "groupid1", + "u32", + 0 + ], + [ + "sta", + "u8", + "image" + ], + [ + "style", + "u8", + "flat" + ], + [ + "key", + "u8", + 255 + ], + [ + "borderc", + "u16", + "#000000" + ], + [ + "borderw", + "u8", + 2 + ], + [ + "font", + "u8", + 0 + ], + [ + "bco", + "u16", + "#ffffff" + ], + [ + "picc", + "u16", + 65535 + ], + [ + "pic", + "u16", + 3 + ], + [ + "pco", + "u16", + "#000000" + ], + [ + "xcen", + "u8", + "center" + ], + [ + "ycen", + "u8", + "center" + ], + [ + "pw", + "u8", + "character" + ], + [ + "txt", + "str", + "image bg" + ], + [ + "txt_maxl", + "u16", + 10 + ], + [ + "isbr", + "u8", + "false" + ], + [ + "spax", + "u8", + 0 + ], + [ + "spay", + "u8", + 0 + ] + ], + "events": { + "codesdown": [], + "codesup": [] + } + } + ] +} \ No newline at end of file diff --git a/demo/decoded/resources/0.i b/demo/decoded/resources/0.i new file mode 100644 index 0000000..7c5139e Binary files /dev/null and b/demo/decoded/resources/0.i differ diff --git a/demo/decoded/resources/0.is b/demo/decoded/resources/0.is new file mode 100644 index 0000000..e12f83a Binary files /dev/null and b/demo/decoded/resources/0.is differ diff --git a/demo/decoded/resources/0.is.png b/demo/decoded/resources/0.is.png new file mode 100644 index 0000000..25d3dd1 Binary files /dev/null and b/demo/decoded/resources/0.is.png differ diff --git a/demo/decoded/resources/0.zi b/demo/decoded/resources/0.zi new file mode 100644 index 0000000..4cce2aa Binary files /dev/null and b/demo/decoded/resources/0.zi differ diff --git a/demo/decoded/resources/0.zi.txt b/demo/decoded/resources/0.zi.txt new file mode 100644 index 0000000..d615644 --- /dev/null +++ b/demo/decoded/resources/0.zi.txt @@ -0,0 +1,1711 @@ +font 'Aileron-16ascii' 12x16 encoding 1 chars 0x20-0x7E + +char 0x20 ' ' width 3 +... +... +... +... +... +... +... +... +... +... +... +... +... +... +... +... + +char 0x21 '!' width 3 +... +... +... +... +.#. +.#. +.#. +.#. +.#. +.#. +.#. +.#. +.#. +... +... +... + +char 0x22 '"' width 5 +..... +..... +..... +..... +.#.#. +.#.#. +.#.#. +..... +..... +..... +..... +..... +..... +..... +..... +..... + +char 0x23 '#' width 8 +........ +........ +........ +........ +...#.#.. +...#.#.. +...#.#.. +.#####.. +..#.#... +.#####.. +..#.#... +..#..... +........ +........ +........ +........ + +char 0x24 '$' width 8 +........ +........ +........ +...#.... +..####.. +.#.#.##. +.#.#.... +.###.... +..####.. +...#.##. +...#..#. +.#.#.##. +.#####.. +...#.... +........ +........ + +char 0x25 '%' width 10 +.......... +.......... +.......... +.......... +..##...#.. +.#..#.#... +.#..#.#... +..##.#.... +.....#.... +....#.##.. +...#..#.#. +...#..#.#. +..#...##.. +.......... +.......... +.......... + +char 0x26 '&' width 9 +......... +......... +......... +......... +..####... +.#....... +.#....... +.#....#.. +..######. +.##...#.. +.#....#.. +.#....#.. +..#####.. +......... +......... +......... + +char 0x27 "'" width 3 +... +... +... +... +.#. +.#. +.#. +... +... +... +... +... +... +... +... +... + +char 0x28 '(' width 4 +.... +.... +.... +..#. +..#. +.#.. +.#.. +.#.. +.#.. +.#.. +.#.. +.#.. +..#. +..#. +.... +.... + +char 0x29 ')' width 4 +.... +.... +.... +.... +.#.. +.#.. +..#. +..#. +..#. +..#. +..#. +.#.. +.#.. +.... +.... +.... + +char 0x2A '*' width 7 +....... +....... +....... +....... +....... +....... +....... +...#... +...#... +.####.. +..#.#.. +.#..... +....... +....... +....... +....... + +char 0x2B '+' width 8 +........ +........ +........ +........ +........ +........ +....#... +....#... +....#... +..#####. +....#... +....#... +........ +........ +........ +........ + +char 0x2C ',' width 3 +... +... +... +... +... +... +... +... +... +... +... +... +.#. +#.. +#.. +... + +char 0x2D '-' width 4 +.... +.... +.... +.... +.... +.... +.... +.... +.... +.##. +.... +.... +.... +.... +.... +.... + +char 0x2E '.' width 3 +... +... +... +... +... +... +... +... +... +... +... +.#. +.#. +... +... +... + +char 0x2F '/' width 4 +.... +.... +.... +.... +...# +.... +..#. +..#. +.... +.#.. +.#.. +.... +#... +.... +.... +.... + +char 0x30 '0' width 8 +........ +........ +........ +........ +..####.. +.##..#.. +.#....#. +.#....#. +.#....#. +.#....#. +.#....#. +.##..#.. +..####.. +........ +........ +........ + +char 0x31 '1' width 8 +........ +........ +........ +........ +...##... +.####... +....#... +....#... +....#... +....#... +....#... +....#... +....#... +........ +........ +........ + +char 0x32 '2' width 8 +........ +........ +........ +........ +..####.. +.##..##. +.#....#. +.....##. +.....#.. +....#... +...#.... +..#..... +.######. +........ +........ +........ + +char 0x33 '3' width 8 +........ +........ +........ +........ +..####.. +.##..##. +.#....#. +.....#.. +....##.. +.....##. +.#....#. +.#...##. +..####.. +........ +........ +........ + +char 0x34 '4' width 8 +........ +........ +........ +........ +....##.. +....##.. +...#.#.. +..##.#.. +..#..#.. +.#...#.. +#######. +.....#.. +.....#.. +........ +........ +........ + +char 0x35 '5' width 8 +........ +........ +........ +........ +..#####. +.#...... +.#...... +.#####.. +.##..##. +......#. +.#....#. +.#...##. +..####.. +........ +........ +........ + +char 0x36 '6' width 8 +........ +........ +........ +........ +...###.. +..#..##. +.#...... +.#.###.. +.##..##. +.#....#. +.#....#. +.##..##. +..####.. +........ +........ +........ + +char 0x37 '7' width 8 +........ +........ +........ +........ +.######. +.....#.. +.....#.. +....#... +....#... +...#.... +...#.... +..#..... +..#..... +........ +........ +........ + +char 0x38 '8' width 8 +........ +........ +........ +........ +..####.. +.#...##. +.#....#. +.#...##. +..####.. +.#...##. +.#....#. +.#...##. +..####.. +........ +........ +........ + +char 0x39 '9' width 8 +........ +........ +........ +........ +..####.. +.##..##. +.#....#. +.#....#. +.##..##. +..###.#. +.#....#. +.#...#.. +..###... +........ +........ +........ + +char 0x3A ':' width 3 +... +... +... +... +... +... +.#. +.#. +... +... +... +.#. +.#. +... +... +... + +char 0x3B ';' width 3 +... +... +... +... +... +... +.#. +.#. +... +... +... +... +.#. +#.. +#.. +... + +char 0x3C '<' width 7 +....... +....... +....... +....... +....... +....... +....... +....##. +..##... +.#..... +..##... +....##. +....... +....... +....... +....... + +char 0x3D '=' width 8 +........ +........ +........ +........ +........ +........ +........ +.#####.. +........ +........ +.#####.. +........ +........ +........ +........ +........ + +char 0x3E '>' width 7 +....... +....... +....... +....... +....... +....... +....... +.##.... +...##.. +.....#. +...##.. +.##.... +....... +....... +....... +....... + +char 0x3F '?' width 7 +....... +....... +....... +....... +..###.. +.#...#. +.#...#. +....##. +....#.. +...#... +....... +...#... +...#... +....... +....... +....... + +char 0x40 '@' width 12 +............ +............ +............ +............ +....#####... +...#....##.. +..#.####.##. +.#.##.##..#. +.#.#...#..#. +.#.#..##..#. +.#.#..##.#.. +.##.##.##... +..##....#... +...#####.... +............ +............ + +char 0x41 'A' width 8 +........ +........ +........ +........ +...##... +...###.. +...#.#.. +..#..#.. +..#..##. +..#####. +.#....#. +.#....## +.#.....# +........ +........ +........ + +char 0x42 'B' width 8 +........ +........ +........ +........ +.#####.. +.#...##. +.#....#. +.#...##. +.#####.. +.#...##. +.#....#. +.#...##. +.#####.. +........ +........ +........ + +char 0x43 'C' width 9 +......... +......... +......... +......... +...####.. +..#....#. +.#.....## +.#....... +.#....... +.#....... +.#.....#. +..#....#. +...####.. +......... +......... +......... + +char 0x44 'D' width 9 +......... +......... +......... +......... +.#####... +.#....#.. +.#....##. +.#.....#. +.#.....#. +.#.....#. +.#....##. +.#....#.. +.#####... +......... +......... +......... + +char 0x45 'E' width 7 +....... +....... +....... +....... +.###### +.#..... +.#..... +.#..... +.#####. +.#..... +.#..... +.#..... +.###### +....... +....... +....... + +char 0x46 'F' width 7 +....... +....... +....... +....... +.###### +.#..... +.#..... +.#..... +.#####. +.#..... +.#..... +.#..... +.#..... +....... +....... +....... + +char 0x47 'G' width 10 +.......... +.......... +.......... +.......... +...#####.. +..#....##. +.##.....#. +.#........ +.#....###. +.#......#. +.##....##. +..#....##. +...####.#. +.......... +.......... +.......... + +char 0x48 'H' width 9 +......... +......... +......... +......... +.#.....#. +.#.....#. +.#.....#. +.#.....#. +.#######. +.#.....#. +.#.....#. +.#.....#. +.#.....#. +......... +......... +......... + +char 0x49 'I' width 3 +... +... +... +... +.#. +.#. +.#. +.#. +.#. +.#. +.#. +.#. +.#. +... +... +... + +char 0x4A 'J' width 7 +....... +....... +....... +....... +.....#. +.....#. +.....#. +.....#. +.....#. +.....#. +.#...#. +.#..##. +..###.. +....... +....... +....... + +char 0x4B 'K' width 8 +........ +........ +........ +........ +.#....#. +.#...#.. +.#..#... +.#.##... +.###.... +.####... +.#..#... +.#...#.. +.#....#. +........ +........ +........ + +char 0x4C 'L' width 7 +....... +....... +....... +....... +.#..... +.#..... +.#..... +.#..... +.#..... +.#..... +.#..... +.#..... +.###### +....... +....... +....... + +char 0x4D 'M' width 11 +........... +........... +........... +........... +.##.....##. +.##.....##. +.###...###. +.#.#...#.#. +.#.#...#.#. +.#.##.#..#. +.#..#.#..#. +.#..###..#. +.#...#...#. +........... +........... +........... + +char 0x4E 'N' width 9 +......... +......... +......... +......... +.##....#. +.##....#. +.#.#...#. +.#.#...#. +.#..#..#. +.#..##.#. +.#...#.#. +.#...###. +.#....##. +......... +......... +......... + +char 0x4F 'O' width 10 +.......... +.......... +.......... +.......... +...####... +..#....#.. +.#.....##. +.#......#. +.#......#. +.#......#. +.#.....##. +..#....#.. +...####... +.......... +.......... +.......... + +char 0x50 'P' width 8 +........ +........ +........ +........ +.#####.. +.#...##. +.#....#. +.#...##. +.#####.. +.#...... +.#...... +.#...... +.#...... +........ +........ +........ + +char 0x51 'Q' width 10 +.......... +.......... +.......... +.......... +...####... +..#....#.. +.#.....##. +.#......#. +.#......#. +.#......#. +.#.....##. +..#....#.. +...#####.. +.......... +.......... +.......... + +char 0x52 'R' width 8 +........ +........ +........ +........ +.#####.. +.#...##. +.#....#. +.#...##. +.#####.. +.#...#.. +.#...##. +.#....#. +.#....#. +........ +........ +........ + +char 0x53 'S' width 8 +........ +........ +........ +........ +..####.. +.#...##. +.#...... +.##..... +..####.. +.....##. +......#. +.#...##. +..####.. +........ +........ +........ + +char 0x54 'T' width 8 +........ +........ +........ +........ +.####### +....#... +....#... +....#... +....#... +....#... +....#... +....#... +....#... +........ +........ +........ + +char 0x55 'U' width 9 +......... +......... +......... +......... +.#.....#. +.#.....#. +.#.....#. +.#.....#. +.#.....#. +.#.....#. +.#.....#. +.##...##. +..#####.. +......... +......... +......... + +char 0x56 'V' width 8 +........ +........ +........ +........ +.#.....# +.#.....# +.#....#. +..#...#. +..#...#. +..#..#.. +...#.#.. +...###.. +...##... +........ +........ +........ + +char 0x57 'W' width 12 +............ +............ +............ +............ +##...##....# +.#...##....# +.#...#.#..## +.#...#.#..#. +..#.#..#..#. +..#.#..#..#. +..#.#...##.. +..###...##.. +...#....##.. +............ +............ +............ + +char 0x58 'X' width 8 +........ +........ +........ +........ +.#....## +..#...#. +..#..#.. +...##... +...##... +...###.. +..#..#.. +.##...#. +.#....## +........ +........ +........ + +char 0x59 'Y' width 8 +........ +........ +........ +........ +.#.....# +.##...#. +..#...#. +...#.#.. +...###.. +....#... +....#... +....#... +....#... +........ +........ +........ + +char 0x5A 'Z' width 8 +........ +........ +........ +........ +.######. +......#. +.....#.. +....##.. +....#... +...#.... +..#..... +.##..... +.######. +........ +........ +........ + +char 0x5B '[' width 4 +.... +.... +.... +.##. +.#.. +.#.. +.#.. +.#.. +.#.. +.#.. +.#.. +.#.. +.#.. +.##. +.... +.... + +char 0x5C '\\' width 4 +.... +.... +.... +.... +#... +#... +.#.. +.#.. +.#.. +..#. +..#. +.... +...# +.... +.... +.... + +char 0x5D ']' width 4 +.... +.... +.... +.##. +..#. +..#. +..#. +..#. +..#. +..#. +..#. +..#. +..#. +.##. +.... +.... + +char 0x5E '^' width 8 +........ +........ +........ +........ +........ +...#.... +....#... +..#..... +..#..#.. +.#...#.. +........ +........ +........ +........ +........ +........ + +char 0x5F '_' width 7 +....... +....... +....... +....... +....... +....... +....... +....... +....... +....... +....... +....... +....... +.#####. +....... +....... + +char 0x60 '`' width 4 +.... +.... +.... +.... +.... +.#.. +.... +.... +.... +.... +.... +.... +.... +.... +.... +.... + +char 0x61 'a' width 7 +....... +....... +....... +....... +....... +....... +..###.. +.#...#. +.....#. +..####. +.#...#. +.#..##. +.#####. +....... +....... +....... + +char 0x62 'b' width 8 +........ +........ +........ +........ +.#...... +.#...... +.#.###.. +.##..##. +.#....#. +.#....#. +.#....#. +.##..#.. +.#####.. +........ +........ +........ + +char 0x63 'c' width 7 +....... +....... +....... +....... +....... +....... +..####. +.##..## +.#..... +.#..... +.#..... +.##..## +..####. +....... +....... +....... + +char 0x64 'd' width 8 +........ +........ +........ +........ +......#. +......#. +..#####. +.##..##. +.#....#. +.#....#. +.#....#. +.##..##. +..###.#. +........ +........ +........ + +char 0x65 'e' width 7 +....... +....... +....... +....... +....... +....... +..###.. +.##..#. +.#....# +.###### +.#..... +.##..#. +..###.. +....... +....... +....... + +char 0x66 'f' width 4 +.... +.... +.... +.... +.#.. +.#.. +###. +.#.. +.#.. +.#.. +.#.. +.#.. +.#.. +.... +.... +.... + +char 0x67 'g' width 8 +........ +........ +........ +........ +........ +........ +..#####. +.##..##. +.#....#. +.#....#. +.#....#. +.##..##. +..###.#. +.#....#. +.##..##. +..####.. + +char 0x68 'h' width 8 +........ +........ +........ +........ +.#...... +.#...... +.#.###.. +.##..##. +.#....#. +.#....#. +.#....#. +.#....#. +.#....#. +........ +........ +........ + +char 0x69 'i' width 3 +... +... +... +... +.#. +... +.#. +.#. +.#. +.#. +.#. +.#. +.#. +... +... +... + +char 0x6A 'j' width 3 +... +... +... +... +.#. +... +.#. +.#. +.#. +.#. +.#. +.#. +.#. +.#. +.#. +##. + +char 0x6B 'k' width 7 +....... +....... +....... +....... +.#..... +.#..... +.#...#. +.#..#.. +.#.#... +.###... +.#.##.. +.#..#.. +.#...#. +....... +....... +....... + +char 0x6C 'l' width 3 +... +... +... +... +.#. +.#. +.#. +.#. +.#. +.#. +.#. +.#. +.## +... +... +... + +char 0x6D 'm' width 11 +........... +........... +........... +........... +........... +........... +.####.###.. +.#...#...#. +.#...#...#. +.#...#...#. +.#...#...#. +.#...#...#. +.#...#...#. +........... +........... +........... + +char 0x6E 'n' width 8 +........ +........ +........ +........ +........ +........ +.#.###.. +.##..##. +.#....#. +.#....#. +.#....#. +.#....#. +.#....#. +........ +........ +........ + +char 0x6F 'o' width 9 +......... +......... +......... +......... +......... +......... +..####... +.##...#.. +.#.....#. +.#.....#. +.#.....#. +.##...#.. +..####... +......... +......... +......... + +char 0x70 'p' width 8 +........ +........ +........ +........ +........ +........ +.#.###.. +.##..##. +.#....#. +.#....#. +.#....#. +.##..#.. +.#####.. +.#...... +.#...... +.#...... + +char 0x71 'q' width 8 +........ +........ +........ +........ +........ +........ +..#####. +.##..##. +.#....#. +.#....#. +.#....#. +.##..##. +..###.#. +......#. +......#. +......#. + +char 0x72 'r' width 4 +.... +.... +.... +.... +.... +.... +.#.# +.##. +.#.. +.#.. +.#.. +.#.. +.#.. +.... +.... +.... + +char 0x73 's' width 7 +....... +....... +....... +....... +....... +....... +..###.. +.#..##. +.#..... +..###.. +....##. +.#...#. +..###.. +....... +....... +....... + +char 0x74 't' width 4 +.... +.... +.... +.... +.#.. +.#.. +###. +.#.. +.#.. +.#.. +.#.. +.#.. +.##. +.... +.... +.... + +char 0x75 'u' width 8 +........ +........ +........ +........ +........ +........ +.#....#. +.#....#. +.#....#. +.#....#. +.#....#. +.#...##. +..###.#. +........ +........ +........ + +char 0x76 'v' width 7 +....... +....... +....... +....... +....... +....... +#....#. +.#...#. +.#...#. +.#..#.. +..#.#.. +..###.. +..##... +....... +....... +....... + +char 0x77 'w' width 10 +.......... +.......... +.......... +.......... +.......... +.......... +#...##...# +##..##...# +.#..##..#. +.#....#.#. +.###..#.#. +..##..##.. +..##..##.. +.......... +.......... +.......... + +char 0x78 'x' width 6 +...... +...... +...... +...... +...... +...... +##..## +.#..#. +..##.. +..##.. +..##.. +.#..#. +##..## +...... +...... +...... + +char 0x79 'y' width 7 +....... +....... +....... +....... +....... +....... +#....#. +.#...#. +.#...#. +.#..#.. +..#.#.. +..#.#.. +..##... +...#... +..#.... +.##.... + +char 0x7A 'z' width 7 +....... +....... +....... +....... +....... +....... +.#####. +.....#. +....#.. +...#... +..##... +..#.... +.#####. +....... +....... +....... + +char 0x7B '{' width 4 +.... +.... +.... +..## +..#. +..#. +..#. +..#. +.#.. +..#. +..#. +..#. +..#. +..## +.... +.... + +char 0x7C '|' width 3 +... +... +... +.#. +.#. +.#. +.#. +.#. +.#. +.#. +.#. +.#. +.#. +.#. +.#. +.#. + +char 0x7D '}' width 4 +.... +.... +.... +##.. +.#.. +.#.. +.#.. +.#.. +.##. +.#.. +.#.. +.#.. +.#.. +##.. +.... +.... + +char 0x7E '~' width 8 +........ +........ +........ +........ +........ +........ +........ +........ +.###.... +.#..##.. +........ +........ +........ +........ +........ +........ diff --git a/demo/decoded/resources/1.i b/demo/decoded/resources/1.i new file mode 100644 index 0000000..c067779 Binary files /dev/null and b/demo/decoded/resources/1.i differ diff --git a/demo/decoded/resources/1.is b/demo/decoded/resources/1.is new file mode 100644 index 0000000..95b2dc6 Binary files /dev/null and b/demo/decoded/resources/1.is differ diff --git a/demo/decoded/resources/1.is.png b/demo/decoded/resources/1.is.png new file mode 100644 index 0000000..be78ed9 Binary files /dev/null and b/demo/decoded/resources/1.is.png differ diff --git a/demo/decoded/resources/1.zi b/demo/decoded/resources/1.zi new file mode 100644 index 0000000..3f5aeae Binary files /dev/null and b/demo/decoded/resources/1.zi differ diff --git a/demo/decoded/resources/1.zi.txt b/demo/decoded/resources/1.zi.txt new file mode 100644 index 0000000..8171423 --- /dev/null +++ b/demo/decoded/resources/1.zi.txt @@ -0,0 +1,3231 @@ +font 'Aileron-32ascii' 25x32 encoding 1 chars 0x20-0x7E + +char 0x20 ' ' width 6 +...... +...... +...... +...... +...... +...... +...... +...... +...... +...... +...... +...... +...... +...... +...... +...... +...... +...... +...... +...... +...... +...... +...... +...... +...... +...... +...... +...... +...... +...... +...... +...... + +char 0x21 '!' width 5 +..... +..... +..... +..... +..... +..... +..... +..... +..##. +..##. +..##. +..##. +..##. +..##. +..##. +..##. +..##. +..##. +..##. +..##. +..##. +..... +..... +.###. +.###. +.###. +..... +..... +..... +..... +..... +..... + +char 0x22 '"' width 9 +......... +......... +......... +......... +......... +......... +......... +..##..##. +..##..##. +..##..##. +..##..##. +..##..##. +..##..##. +......... +......... +......... +......... +......... +......... +......... +......... +......... +......... +......... +......... +......... +......... +......... +......... +......... +......... +......... + +char 0x23 '#' width 16 +................ +................ +................ +................ +................ +................ +................ +................ +.......##..##... +.......#...#.... +.......#...#.... +......##..##.... +......##..##.... +......##..##.... +...###########.. +.....##..##..... +.....##..##..... +.....##..##..... +.....##..#...... +..###########... +..###########... +....##..##...... +....##..##...... +....#...#....... +....#...#....... +...##..##....... +................ +................ +................ +................ +................ +................ + +char 0x24 '$' width 15 +............... +............... +............... +............... +............... +.......#....... +.......##...... +.......##...... +....#######.... +...###.#####... +..###..##.###.. +..###..##..##.. +..##...##..##.. +..###..##...... +..####.##...... +...######...... +....#######.... +......######... +.......##.###.. +.......##..##.. +.......##..##.. +..##...##..##.. +..##...##..##.. +..###..##.###.. +...#########... +....#######.... +.......##...... +.......##...... +............... +............... +............... +............... + +char 0x25 '%' width 20 +.................... +.................... +.................... +.................... +.................... +.................... +.................... +.................... +...####.......##.... +..######......##.... +.###..###....##..... +.##....##...##...... +.##....##...##...... +.###..###..##....... +..######..##........ +...####...##........ +.........##......... +........###......... +........##..#####... +.......##..#######.. +......###..##...##.. +......##...##...##.. +.....##....##...##.. +....###....##...##.. +....##.....#######.. +...##.......#####... +.................... +.................... +.................... +.................... +.................... +.................... + +char 0x26 '&' width 17 +................. +................. +................. +................. +................. +................. +................. +................. +......######..... +....########..... +...###........... +...##............ +...##............ +...##.......##... +...##.......##... +....##......##... +.....############ +....############. +...###......##... +..###.......##... +..###.......##... +..##........##... +..###.......##... +..####......##... +...###########... +.....#########... +................. +................. +................. +................. +................. +................. + +char 0x27 "'" width 5 +..... +..... +..... +..... +..... +..... +..... +.##.. +.##.. +.##.. +.##.. +.##.. +.##.. +..... +..... +..... +..... +..... +..... +..... +..... +..... +..... +..... +..... +..... +..... +..... +..... +..... +..... +..... + +char 0x28 '(' width 9 +......... +......... +......... +......... +......... +......... +......##. +.....##.. +.....##.. +.....#... +....##... +....##... +....#.... +...##.... +...##.... +...##.... +...##.... +...##.... +...##.... +...##.... +...##.... +....#.... +....##... +....##... +.....#... +.....##.. +.....##.. +......##. +......... +......... +......... +......... + +char 0x29 ')' width 9 +......... +......... +......... +......... +......... +......... +.##...... +..#...... +..##..... +...#..... +...##.... +...##.... +...##.... +....#.... +....##... +....##... +....##... +....##... +....##... +....##... +....#.... +...##.... +...##.... +...##.... +...#..... +..##..... +..#...... +.##...... +......... +......... +......... +......... + +char 0x2A '*' width 15 +............... +............... +............... +............... +............... +............... +............... +............... +............... +............... +............... +............... +............... +............... +.......#....... +.......#....... +.......#....... +...#...#...#... +...#########... +......###...... +......###...... +.....##.##..... +....##...##.... +....#....##.... +............... +............... +............... +............... +............... +............... +............... +............... + +char 0x2B '+' width 15 +............... +............... +............... +............... +............... +............... +............... +............... +............... +............... +............... +............... +......##....... +......##....... +......##....... +......##....... +......##....... +..###########.. +..###########.. +......##....... +......##....... +......##....... +......##....... +......##....... +............... +............... +............... +............... +............... +............... +............... +............... + +char 0x2C ',' width 6 +...... +...... +...... +...... +...... +...... +...... +...... +...... +...... +...... +...... +...... +...... +...... +...... +...... +...... +...... +...... +...... +...... +...... +.###.. +.##... +.##... +###... +##.... +##.... +...... +...... +...... + +char 0x2D '-' width 7 +....... +....... +....... +....... +....... +....... +....... +....... +....... +....... +....... +....... +....... +....... +....... +....... +....... +.#####. +.#####. +....... +....... +....... +....... +....... +....... +....... +....... +....... +....... +....... +....... +....... + +char 0x2E '.' width 5 +..... +..... +..... +..... +..... +..... +..... +..... +..... +..... +..... +..... +..... +..... +..... +..... +..... +..... +..... +..... +..... +..... +..... +.###. +.###. +.###. +..... +..... +..... +..... +..... +..... + +char 0x2F '/' width 8 +........ +........ +........ +........ +........ +........ +........ +......## +......## +......#. +.....##. +.....##. +.....#.. +....##.. +....##.. +....#... +...##... +...#.... +...#.... +..##.... +..#..... +..#..... +.##..... +.#...... +.#...... +##...... +........ +........ +........ +........ +........ +........ + +char 0x30 '0' width 15 +............... +............... +............... +............... +............... +............... +............... +............... +.....#####..... +...#########... +..###.....###.. +..###.....###.. +..##.......##.. +.###.......###. +.###.......###. +.##.........##. +.##.........##. +.##.........##. +.##.........##. +.###.......###. +.###.......###. +..##.......##.. +..###.....###.. +..###.....###.. +...#########... +.....#####..... +............... +............... +............... +............... +............... +............... + +char 0x31 '1' width 15 +............... +............... +............... +............... +............... +............... +............... +............... +.......###..... +.....#####..... +....######..... +...###..##..... +...#....##..... +........##..... +........##..... +........##..... +........##..... +........##..... +........##..... +........##..... +........##..... +........##..... +........##..... +........##..... +........##..... +........##..... +............... +............... +............... +............... +............... +............... + +char 0x32 '2' width 15 +............... +............... +............... +............... +............... +............... +............... +............... +......#####.... +....#########.. +...###....###.. +...##......###. +...##......###. +...##.......##. +...........###. +...........##.. +..........###.. +.........###... +........###.... +.......###..... +......###...... +.....###....... +....###........ +...###......... +..############. +..############. +............... +............... +............... +............... +............... +............... + +char 0x33 '3' width 15 +............... +............... +............... +............... +............... +............... +............... +............... +.....######.... +...#########... +...##.....###.. +..##.......##.. +..##.......##.. +...........##.. +..........###.. +.........###... +......#####.... +.......#####... +..........###.. +...........###. +.##.........##. +.##........###. +.###.......###. +..###.....###.. +...#########... +....######..... +............... +............... +............... +............... +............... +............... + +char 0x34 '4' width 15 +............... +............... +............... +............... +............... +............... +............... +............... +.........###... +.........###... +........####... +.......#####... +.......##.##... +......##..##... +.....##...##... +....###...##... +....##....##... +...##.....##... +..###.....##... +..##......##... +.#############. +.#############. +..........##... +..........##... +..........##... +..........##... +............... +............... +............... +............... +............... +............... + +char 0x35 '5' width 15 +............... +............... +............... +............... +............... +............... +............... +............... +..###########.. +..##########... +..##........... +..##........... +..##........... +..##........... +..##.#####..... +..##########... +..###.....###.. +.###......###.. +...........##.. +...........##.. +...........##.. +.##........##.. +.###......###.. +..###....###... +...########.... +....######..... +............... +............... +............... +............... +............... +............... + +char 0x36 '6' width 15 +............... +............... +............... +............... +............... +............... +............... +............... +.....#####..... +....########... +...##.....###.. +..##......###.. +..##.......##.. +..##........... +.###.#####..... +.##.########... +.####.....###.. +.###......###.. +.###.......##.. +.##........##.. +.##........##.. +.###.......##.. +..##......###.. +..###....###... +...########.... +.....#####..... +............... +............... +............... +............... +............... +............... + +char 0x37 '7' width 15 +............... +............... +............... +............... +............... +............... +............... +............... +.#############. +.#############. +...........##.. +..........###.. +..........##... +.........###... +.........##.... +........##..... +........##..... +.......##...... +......###...... +......##....... +.....###....... +.....##........ +....###........ +....##......... +...###......... +...##.......... +............... +............... +............... +............... +............... +............... + +char 0x38 '8' width 15 +............... +............... +............... +............... +............... +............... +............... +............... +.....#####..... +...#########... +..###.....###.. +..##.......##.. +..##.......##.. +..##.......##.. +..###.....###.. +...#########... +...########.... +..###.....##... +..##.......##.. +.###.......###. +.##.........##. +.###.......###. +.###.......###. +..###.....###.. +...#########... +....######..... +............... +............... +............... +............... +............... +............... + +char 0x39 '9' width 15 +............... +............... +............... +............... +............... +............... +............... +............... +.....#####..... +...########.... +..###.....##... +..##......###.. +.###.......##.. +.##........##.. +.###.......##.. +.###.......##.. +.###......###.. +..###....####.. +...#######.##.. +.....###...##.. +...........##.. +.###......###.. +..##......##... +..###....###... +...########.... +....#####...... +............... +............... +............... +............... +............... +............... + +char 0x3A ':' width 5 +..... +..... +..... +..... +..... +..... +..... +..... +..... +..... +..... +..... +.###. +.###. +.###. +..... +..... +..... +..... +..... +..... +..... +..... +.###. +.###. +.###. +..... +..... +..... +..... +..... +..... + +char 0x3B ';' width 5 +..... +..... +..... +..... +..... +..... +..... +..... +..... +..... +..... +..... +.###. +.###. +.###. +..... +..... +..... +..... +..... +..... +..... +..... +.##.. +.##.. +###.. +##... +##... +##... +..... +..... +..... + +char 0x3C '<' width 15 +............... +............... +............... +............... +............... +............... +............... +............... +............... +............... +............... +............... +............... +............... +...........##.. +.........###... +.......###..... +.....###....... +...###......... +...##.......... +....###........ +......###...... +........####... +..........###.. +............#.. +............... +............... +............... +............... +............... +............... +............... + +char 0x3D '=' width 15 +............... +............... +............... +............... +............... +............... +............... +............... +............... +............... +............... +............... +............... +............... +..###########.. +..###########.. +............... +............... +............... +..###########.. +..###########.. +............... +............... +............... +............... +............... +............... +............... +............... +............... +............... +............... + +char 0x3E '>' width 15 +............... +............... +............... +............... +............... +............... +............... +............... +............... +............... +............... +............... +............... +..#............ +..###.......... +...####........ +.....####...... +.......####.... +.........###... +..........###.. +........####... +......####..... +....####....... +..####......... +..#............ +............... +............... +............... +............... +............... +............... +............... + +char 0x3F '?' width 13 +............. +............. +............. +............. +............. +............. +............. +............. +....#####.... +...########.. +..###....##.. +.###.....###. +.###......##. +.........###. +.........###. +.........##.. +........###.. +.......###... +......###.... +......##..... +......##..... +............. +............. +.....###..... +.....###..... +.....###..... +............. +............. +............. +............. +............. +............. + +char 0x40 '@' width 22 +...................... +...................... +...................... +...................... +...................... +...................... +...................... +...................... +...................... +.........######....... +......###########..... +.....###.......###.... +....##..........###... +...##............##... +..##.....####.#...##.. +..##....########..##.. +..#....##....##...##.. +.##...###....##...##.. +.##...##.....##...##.. +.##...##.....##...##.. +.##...##....##....##.. +.##...##....##...##... +.##...###..####.##.... +..##...####..####..... +..##.................. +...##................. +...###........###..... +.....##########....... +.......######......... +...................... +...................... +...................... + +char 0x41 'A' width 17 +................. +................. +................. +................. +................. +................. +................. +................. +.......###....... +.......####...... +......#####...... +......##.##...... +......##..##..... +.....##...##..... +.....##...##..... +.....##...###.... +....##.....##.... +....##.....##.... +...###########... +...###########... +...##.......###.. +..###.......###.. +..##.........##.. +..##.........###. +.###.........###. +.##...........##. +................. +................. +................. +................. +................. +................. + +char 0x42 'B' width 16 +................ +................ +................ +................ +................ +................ +................ +................ +...#########.... +...###########.. +...##.......###. +...##.......###. +...##........##. +...##.......###. +...##.......##.. +...##......###.. +...##########... +...###########.. +...##.......###. +...##........##. +...##........##. +...##........##. +...##........##. +...##.......###. +...###########.. +...#########.... +................ +................ +................ +................ +................ +................ + +char 0x43 'C' width 18 +.................. +.................. +.................. +.................. +.................. +.................. +.................. +.................. +.......######..... +.....#########.... +...###......###... +...##........###.. +..###.........##.. +..##..........###. +.###.............. +.###.............. +.##............... +.##............... +.###.............. +.###.............. +..##..........##.. +..###.........##.. +..###........###.. +...###......###... +....##########.... +......######...... +.................. +.................. +.................. +.................. +.................. +.................. + +char 0x44 'D' width 19 +................... +................... +................... +................... +................... +................... +................... +................... +...##########...... +...############.... +...##........###... +...##.........###.. +...##..........##.. +...##..........###. +...##..........###. +...##..........###. +...##...........##. +...##...........##. +...##..........###. +...##..........###. +...##..........##.. +...##.........###.. +...##.........##... +...##.......####... +...###########..... +...#########....... +................... +................... +................... +................... +................... +................... + +char 0x45 'E' width 16 +................ +................ +................ +................ +................ +................ +................ +................ +...############. +...###########.. +...##........... +...##........... +...##........... +...##........... +...##........... +...##........... +...###########.. +...###########.. +...##........... +...##........... +...##........... +...##........... +...##........... +...##........... +...############. +...############. +................ +................ +................ +................ +................ +................ + +char 0x46 'F' width 15 +............... +............... +............... +............... +............... +............... +............... +............... +...############ +...###########. +...##.......... +...##.......... +...##.......... +...##.......... +...##.......... +...##.......... +...##########.. +...###########. +...##.......... +...##.......... +...##.......... +...##.......... +...##.......... +...##.......... +...##.......... +...##.......... +............... +............... +............... +............... +............... +............... + +char 0x47 'G' width 19 +................... +................... +................... +................... +................... +................... +................... +................... +.......######...... +.....##########.... +....##......####... +...##........####.. +..###.........###.. +..##..........###.. +.###............... +.###............... +.##................ +.##.......#######.. +.###......#######.. +.###..........###.. +..##..........###.. +..###.........###.. +..###........####.. +...###......#####.. +....#########..##.. +......######...##.. +................... +................... +................... +................... +................... +................... + +char 0x48 'H' width 19 +................... +................... +................... +................... +................... +................... +................... +................... +...##..........##.. +...##..........##.. +...##..........##.. +...##..........##.. +...##..........##.. +...##..........##.. +...##..........##.. +...##..........##.. +...##############.. +...##############.. +...##..........##.. +...##..........##.. +...##..........##.. +...##..........##.. +...##..........##.. +...##..........##.. +...##..........##.. +...##..........##.. +................... +................... +................... +................... +................... +................... + +char 0x49 'I' width 7 +....... +....... +....... +....... +....... +....... +....... +....... +...##.. +...##.. +...##.. +...##.. +...##.. +...##.. +...##.. +...##.. +...##.. +...##.. +...##.. +...##.. +...##.. +...##.. +...##.. +...##.. +...##.. +...##.. +....... +....... +....... +....... +....... +....... + +char 0x4A 'J' width 14 +.............. +.............. +.............. +.............. +.............. +.............. +.............. +.............. +..........##.. +..........##.. +..........##.. +..........##.. +..........##.. +..........##.. +..........##.. +..........##.. +..........##.. +..........##.. +..........##.. +..........##.. +.##.......##.. +.###......##.. +.###......##.. +..##.....###.. +..#########... +....#####..... +.............. +.............. +.............. +.............. +.............. +.............. + +char 0x4B 'K' width 16 +................ +................ +................ +................ +................ +................ +................ +................ +...##.........## +...##........### +...##.......###. +...##......###.. +...##.....###... +...##....###.... +...##...###..... +...##..###...... +...##.###....... +...######....... +...#######...... +...###..###..... +...##....###.... +...##.....###... +...##......###.. +...##......###.. +...##.......###. +...##........### +................ +................ +................ +................ +................ +................ + +char 0x4C 'L' width 16 +................ +................ +................ +................ +................ +................ +................ +................ +...##........... +...##........... +...##........... +...##........... +...##........... +...##........... +...##........... +...##........... +...##........... +...##........... +...##........... +...##........... +...##........... +...##........... +...##........... +...##........... +...############. +...############. +................ +................ +................ +................ +................ +................ + +char 0x4D 'M' width 23 +....................... +....................... +....................... +....................... +....................... +....................... +....................... +....................... +...####..........####.. +...####..........####.. +...#####........#####.. +...#####........#####.. +...##.##........##.##.. +...##.###......##..##.. +...##..##......##..##.. +...##..##......##..##.. +...##..###....###..##.. +...##...##....##...##.. +...##...##....##...##.. +...##...###...##...##.. +...##....##..##....##.. +...##....##..##....##.. +...##....###.##....##.. +...##.....####.....##.. +...##.....####.....##.. +...##.....####.....##.. +....................... +....................... +....................... +....................... +....................... +....................... + +char 0x4E 'N' width 19 +................... +................... +................... +................... +................... +................... +................... +................... +...####........##.. +...####........##.. +...#####.......##.. +...##.##.......##.. +...##..##......##.. +...##..##......##.. +...##...##.....##.. +...##...##.....##.. +...##....##....##.. +...##....##....##.. +...##.....##...##.. +...##.....##...##.. +...##......##..##.. +...##......##..##.. +...##.......##.##.. +...##.......#####.. +...##........####.. +...##........####.. +................... +................... +................... +................... +................... +................... + +char 0x4F 'O' width 19 +................... +................... +................... +................... +................... +................... +................... +................... +......#######...... +....###########.... +...###.......###... +..###.........###.. +..##...........##.. +..##...........##.. +.###...........###. +.###...........###. +.##.............##. +.##.............##. +.###...........###. +.###...........###. +..##...........##.. +..##..........###.. +..###.........###.. +...###.......###... +....###########.... +......#######...... +................... +................... +................... +................... +................... +................... + +char 0x50 'P' width 16 +................ +................ +................ +................ +................ +................ +................ +................ +...#########.... +...###########.. +...##.......###. +...##........##. +...##........##. +...##........##. +...##........##. +...##.......###. +...##......###.. +...###########.. +...########..... +...##........... +...##........... +...##........... +...##........... +...##........... +...##........... +...##........... +................ +................ +................ +................ +................ +................ + +char 0x51 'Q' width 19 +................... +................... +................... +................... +................... +................... +................... +................... +......#######...... +....###########.... +...###.......###... +..###.........##... +..##...........##.. +..##...........##.. +.###...........###. +.###...........###. +.##.............##. +.##.............##. +.###...........###. +.###...........###. +..##...........##.. +..##..........###.. +..###.........##... +...###.......##.... +....############... +......############. +................#.. +................... +................... +................... +................... +................... + +char 0x52 'R' width 16 +................ +................ +................ +................ +................ +................ +................ +................ +...##########... +...###########.. +...##.......###. +...##........##. +...##........##. +...##........##. +...##........##. +...##.......##.. +...##########... +...##########... +...##......###.. +...##.......##.. +...##.......##.. +...##.......###. +...##.......###. +...##........##. +...##........##. +...##........##. +................ +................ +................ +................ +................ +................ + +char 0x53 'S' width 15 +............... +............... +............... +............... +............... +............... +............... +............... +.....######.... +....########... +...##.....###.. +..###......##.. +..##.......###. +..###.......... +..###.......... +...#####....... +....#######.... +.......#####... +..........###.. +...........###. +...........###. +.###........##. +..##.......###. +..###.....###.. +...#########... +.....######.... +............... +............... +............... +............... +............... +............... + +char 0x54 'T' width 16 +................ +................ +................ +................ +................ +................ +................ +................ +.############### +.############### +........##...... +........##...... +........##...... +........##...... +........##...... +........##...... +........##...... +........##...... +........##...... +........##...... +........##...... +........##...... +........##...... +........##...... +........##...... +........##...... +................ +................ +................ +................ +................ +................ + +char 0x55 'U' width 17 +................. +................. +................. +................. +................. +................. +................. +................. +..##.........##.. +..##.........##.. +..##.........##.. +..##.........##.. +..##.........##.. +..##.........##.. +..##.........##.. +..##.........##.. +..##.........##.. +..##.........##.. +..##.........##.. +..##.........##.. +..###........##.. +..###........##.. +...##.......###.. +...###.....###... +....#########.... +......######..... +................. +................. +................. +................. +................. +................. + +char 0x56 'V' width 16 +................ +................ +................ +................ +................ +................ +................ +................ +.##...........## +.###..........## +..##.........### +..##.........##. +..###........##. +...##.......###. +...##.......##.. +...###......##.. +....##.....##... +....##.....##... +....###....##... +.....##...##.... +.....##...##.... +.....###..##.... +......##.##..... +......##.##..... +......#####..... +.......###...... +................ +................ +................ +................ +................ +................ + +char 0x57 'W' width 25 +......................... +......................... +......................... +......................... +......................... +......................... +......................... +......................... +.##........###........##. +.###.......####.......##. +.###.......####.......##. +..##......##.##......###. +..##......##.##......##.. +..###.....##.###.....##.. +..###....##...##.....##.. +...##....##...##....##... +...##....##...##....##... +...##....##...###...##... +...###..##.....##...##... +....##..##.....##..##.... +....##..##.....##..##.... +....##..##.....###.##.... +....#####.......##.##.... +.....####.......####..... +.....####.......####..... +.....####........###..... +......................... +......................... +......................... +......................... +......................... +......................... + +char 0x58 'X' width 16 +................ +................ +................ +................ +................ +................ +................ +................ +.###.........### +..###.......###. +...##.......##.. +...###.....##... +....###...###... +.....##...##.... +.....###.##..... +......#####..... +.......###...... +.......###...... +......#####..... +.....###.###.... +.....##...##.... +....##....###... +...###.....###.. +..###.......##.. +..##.........##. +.###.........### +................ +................ +................ +................ +................ +................ + +char 0x59 'Y' width 15 +............... +............... +............... +............... +............... +............... +............... +............... +.###.........## +..##........### +..###.......##. +...##......###. +...###.....##.. +....##....###.. +....###...##... +.....###.##.... +......#####.... +......####..... +.......###..... +.......##...... +.......##...... +.......##...... +.......##...... +.......##...... +.......##...... +.......##...... +............... +............... +............... +............... +............... +............... + +char 0x5A 'Z' width 16 +................ +................ +................ +................ +................ +................ +................ +................ +..#############. +..#############. +............##.. +...........###.. +..........###... +.........###.... +.........##..... +........###..... +.......###...... +......###....... +.....###........ +.....###........ +....###......... +...###.......... +..###........... +..###........... +.##############. +.##############. +................ +................ +................ +................ +................ +................ + +char 0x5B '[' width 9 +......... +......... +......... +......... +......... +......... +...#####. +...####.. +...##.... +...##.... +...##.... +...##.... +...##.... +...##.... +...##.... +...##.... +...##.... +...##.... +...##.... +...##.... +...##.... +...##.... +...##.... +...##.... +...##.... +...##.... +...####.. +...#####. +......... +......... +......... +......... + +char 0x5C '\\' width 8 +........ +........ +........ +........ +........ +........ +........ +##...... +##...... +.#...... +.##..... +.##..... +..#..... +..##.... +..##.... +...#.... +...##... +...##... +....#... +....##.. +....##.. +.....#.. +.....##. +.....##. +......#. +......## +........ +........ +........ +........ +........ +........ + +char 0x5D ']' width 8 +........ +........ +........ +........ +........ +........ +.#####.. +.#####.. +....##.. +....##.. +....##.. +....##.. +....##.. +....##.. +....##.. +....##.. +....##.. +....##.. +....##.. +....##.. +....##.. +....##.. +....##.. +....##.. +....##.. +....##.. +.#####.. +.#####.. +........ +........ +........ +........ + +char 0x5E '^' width 15 +............... +............... +............... +............... +............... +............... +............... +............... +............... +.......#....... +......###...... +......###...... +.....##.##..... +.....##..#..... +....##...##.... +....##...##.... +....#.....#.... +...##.....##... +...##......#... +..##.......##.. +............... +............... +............... +............... +............... +............... +............... +............... +............... +............... +............... +............... + +char 0x5F '_' width 12 +............ +............ +............ +............ +............ +............ +............ +............ +............ +............ +............ +............ +............ +............ +............ +............ +............ +............ +............ +............ +............ +............ +............ +............ +............ +............ +.##########. +.##########. +............ +............ +............ +............ + +char 0x60 '`' width 8 +........ +........ +........ +........ +........ +........ +........ +........ +.##..... +..##.... +...#.... +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ + +char 0x61 'a' width 14 +.............. +.............. +.............. +.............. +.............. +.............. +.............. +.............. +.............. +.............. +.............. +.............. +....######.... +...########... +..###....###.. +..##.....###.. +..........##.. +.........###.. +...#########.. +..####...###.. +.###......##.. +.###.....###.. +.###.....###.. +.###....####.. +..##########.. +...#####..##.. +.............. +.............. +.............. +.............. +.............. +.............. + +char 0x62 'b' width 16 +................ +................ +................ +................ +................ +................ +................ +..##............ +..##............ +..##............ +..##............ +..##............ +..##..#####..... +..##.########... +..####.....###.. +..###.......##.. +..###.......###. +..###.......###. +..##.........##. +..##.........##. +..###.......###. +..###.......###. +..###.......##.. +..####.....###.. +..###########... +..##..#####..... +................ +................ +................ +................ +................ +................ + +char 0x63 'c' width 14 +.............. +.............. +.............. +.............. +.............. +.............. +.............. +.............. +.............. +.............. +.............. +.............. +.....#####.... +...#########.. +..###.....##.. +..##......###. +.###.......##. +.###.......... +.##........... +.##........... +.###.......... +.###.......##. +..##......###. +..###.....##.. +...########... +.....#####.... +.............. +.............. +.............. +.............. +.............. +.............. + +char 0x64 'd' width 16 +................ +................ +................ +................ +................ +................ +................ +............##.. +............##.. +............##.. +............##.. +............##.. +.....#####..##.. +...###########.. +..###.....####.. +..##.......###.. +.###........##.. +.###........##.. +.##.........##.. +.##.........##.. +.###........##.. +.###........##.. +..##.......###.. +..###.....####.. +...########.##.. +.....#####..##.. +................ +................ +................ +................ +................ +................ + +char 0x65 'e' width 15 +............... +............... +............... +............... +............... +............... +............... +............... +............... +............... +............... +............... +.....#####..... +...#########... +..###.....##... +..##.......##.. +.###.......##.. +.###.......##.. +.############.. +.############.. +.##............ +.###.......##.. +..##.......##.. +..###.....##... +...#########... +.....#####..... +............... +............... +............... +............... +............... +............... + +char 0x66 'f' width 9 +......... +......... +......... +......... +......... +......... +......... +....####. +...###... +...##.... +...##.... +...##.... +.#######. +.#######. +...##.... +...##.... +...##.... +...##.... +...##.... +...##.... +...##.... +...##.... +...##.... +...##.... +...##.... +...##.... +......... +......... +......... +......... +......... +......... + +char 0x67 'g' width 16 +................ +................ +................ +................ +................ +................ +................ +................ +................ +................ +................ +................ +.....#####..##.. +...###########.. +..###.....####.. +..##.......###.. +.###.......###.. +.###.......###.. +.##.........##.. +.##.........##.. +.###.......###.. +.###.......###.. +..##.......###.. +..###.....####.. +...########.##.. +.....#####..##.. +..##.......###.. +..##.......###.. +..###.....###... +...#########.... +....######...... +................ + +char 0x68 'h' width 16 +................ +................ +................ +................ +................ +................ +................ +..##............ +..##............ +..##............ +..##............ +..##............ +..##..#####..... +..##.########... +..####.....###.. +..###......###.. +..###......###.. +..###.......##.. +..###.......##.. +..##........##.. +..##........##.. +..##........##.. +..##........##.. +..##........##.. +..##........##.. +..##........##.. +................ +................ +................ +................ +................ +................ + +char 0x69 'i' width 6 +...... +...... +...... +...... +...... +...... +...... +...... +..##.. +..##.. +...#.. +...... +..##.. +..##.. +..##.. +..##.. +..##.. +..##.. +..##.. +..##.. +..##.. +..##.. +..##.. +..##.. +..##.. +..##.. +...... +...... +...... +...... +...... +...... + +char 0x6A 'j' width 6 +...... +...... +...... +...... +...... +...... +...... +...... +..##.. +..##.. +...#.. +...... +..##.. +..##.. +..##.. +..##.. +..##.. +..##.. +..##.. +..##.. +..##.. +..##.. +..##.. +..##.. +..##.. +..##.. +..##.. +..##.. +..##.. +####.. +###... +...... + +char 0x6B 'k' width 14 +.............. +.............. +.............. +.............. +.............. +.............. +.............. +..##.......... +..##.......... +..##.......... +..##.......... +..##.......... +..##......###. +..##.....###.. +..##.....##... +..##....##.... +..##...##..... +..##..##...... +..######...... +..######...... +..###.###..... +..###..###.... +..##....###... +..##.....###.. +..##.....###.. +..##......###. +.............. +.............. +.............. +.............. +.............. +.............. + +char 0x6C 'l' width 7 +....... +....... +....... +....... +....... +....... +....... +..##... +..##... +..##... +..##... +..##... +..##... +..##... +..##... +..##... +..##... +..##... +..##... +..##... +..##... +..##... +..##... +..###.. +..####. +...###. +....... +....... +....... +....... +....... +....... + +char 0x6D 'm' width 22 +...................... +...................... +...................... +...................... +...................... +...................... +...................... +...................... +...................... +...................... +...................... +...................... +..##..####....####.... +..#########..######... +..####...#####...###.. +..###.....###.....##.. +..###.....###.....##.. +..###.....###.....##.. +..##......##......##.. +..##......##......##.. +..##......##......##.. +..##......##......##.. +..##......##......##.. +..##......##......##.. +..##......##......##.. +..##......##......##.. +...................... +...................... +...................... +...................... +...................... +...................... + +char 0x6E 'n' width 16 +................ +................ +................ +................ +................ +................ +................ +................ +................ +................ +................ +................ +..##..#####..... +..##.########... +..####.....###.. +..###......###.. +..###......###.. +..###.......##.. +..###.......##.. +..##........##.. +..##........##.. +..##........##.. +..##........##.. +..##........##.. +..##........##.. +..##........##.. +................ +................ +................ +................ +................ +................ + +char 0x6F 'o' width 15 +............... +............... +............... +............... +............... +............... +............... +............... +............... +............... +............... +............... +.....######.... +...#########... +..###.....###.. +..##.......###. +.###........##. +.###........##. +.##.........##. +.##.........##. +.###........##. +.###........##. +..##.......###. +..###.....###.. +...#########... +.....######.... +............... +............... +............... +............... +............... +............... + +char 0x70 'p' width 16 +................ +................ +................ +................ +................ +................ +................ +................ +................ +................ +................ +................ +..##..#####..... +..##.########... +..####.....###.. +..###.......##.. +..###.......###. +..###.......###. +..##.........##. +..##.........##. +..###.......###. +..###.......###. +..###.......##.. +..####.....###.. +..###########... +..##..#####..... +..##............ +..##............ +..##............ +..##............ +..##............ +................ + +char 0x71 'q' width 16 +................ +................ +................ +................ +................ +................ +................ +................ +................ +................ +................ +................ +.....#####..##.. +...###########.. +..###.....####.. +..##.......###.. +.###........##.. +.###........##.. +.##.........##.. +.##.........##.. +.###........##.. +.###........##.. +..##.......###.. +..###.....####.. +...########.##.. +.....#####..##.. +............##.. +............##.. +............##.. +............##.. +............##.. +................ + +char 0x72 'r' width 9 +......... +......... +......... +......... +......... +......... +......... +......... +......... +......... +......... +......... +..##..### +..######. +..####... +..###.... +..###.... +..##..... +..##..... +..##..... +..##..... +..##..... +..##..... +..##..... +..##..... +..##..... +......... +......... +......... +......... +......... +......... + +char 0x73 's' width 12 +............ +............ +............ +............ +............ +............ +............ +............ +............ +............ +............ +............ +...#####.... +..########.. +.###....##.. +.##.....###. +.###........ +.####....... +..######.... +....######.. +.......####. +........###. +.##......##. +.###....###. +..########.. +...######... +............ +............ +............ +............ +............ +............ + +char 0x74 't' width 9 +......... +......... +......... +......... +......... +......... +......... +......... +......... +...##.... +...##.... +...##.... +.#######. +.#######. +...##.... +...##.... +...##.... +...##.... +...##.... +...##.... +...##.... +...##.... +...##.... +...##.... +...#####. +....####. +......... +......... +......... +......... +......... +......... + +char 0x75 'u' width 16 +................ +................ +................ +................ +................ +................ +................ +................ +................ +................ +................ +................ +..##........##.. +..##........##.. +..##........##.. +..##........##.. +..##........##.. +..##........##.. +..##........##.. +..##.......###.. +..##.......###.. +..###......###.. +..###......###.. +..####....####.. +...########.##.. +.....#####..##.. +................ +................ +................ +................ +................ +................ + +char 0x76 'v' width 13 +............. +............. +............. +............. +............. +............. +............. +............. +............. +............. +............. +............. +###........## +.##.......### +.##.......##. +.###......##. +..##.....###. +..##.....##.. +..###....##.. +...##...##... +...##...##... +....##..##... +....##.##.... +....##.##.... +.....####.... +.....###..... +............. +............. +............. +............. +............. +............. + +char 0x77 'w' width 20 +.................... +.................... +.................... +.................... +.................... +.................... +.................... +.................... +.................... +.................... +.................... +.................... +###......###......## +###.....####.....### +.##.....####.....##. +.###....#####....##. +.###....##.##....##. +..##...##..##...###. +..##...##..##...##.. +..###..##...##..##.. +...##..##...##..##.. +...##.##....##.##... +...##.##....##.##... +....####.....####... +....###......###.... +....###......###.... +.................... +.................... +.................... +.................... +.................... +.................... + +char 0x78 'x' width 13 +............. +............. +............. +............. +............. +............. +............. +............. +............. +............. +............. +............. +###......###. +.###.....##.. +..##....##... +..###..###... +...###.##.... +....####..... +....####..... +....####..... +....####..... +...##..##.... +..###..###... +..##....###.. +.##......##.. +###......###. +............. +............. +............. +............. +............. +............. + +char 0x79 'y' width 13 +............. +............. +............. +............. +............. +............. +............. +............. +............. +............. +............. +............. +.##........## +.###.......## +.###......### +..##......##. +..###.....##. +...##....###. +...##....##.. +...###...##.. +....##..##... +....##..##... +....###.##... +.....####.... +.....####.... +......##..... +......##..... +.....###..... +.....##...... +..####....... +..###........ +............. + +char 0x7A 'z' width 13 +............. +............. +............. +............. +............. +............. +............. +............. +............. +............. +............. +............. +..##########. +..##########. +.........##.. +........###.. +.......###... +......###.... +......##..... +.....###..... +....###...... +...###....... +..###........ +..###........ +.###########. +.###########. +............. +............. +............. +............. +............. +............. + +char 0x7B '{' width 8 +........ +........ +........ +........ +........ +........ +....###. +...###.. +...##... +...##... +...##... +...##... +...##... +...##... +...##... +...##... +..##.... +..##.... +...##... +...##... +...##... +...##... +...##... +...##... +...##... +...##... +...###.. +....###. +........ +........ +........ +........ + +char 0x7C '|' width 6 +...... +...... +...... +...... +...... +..#... +..##.. +..##.. +..##.. +..##.. +..##.. +..##.. +..##.. +..##.. +..##.. +..##.. +..##.. +..##.. +..##.. +..##.. +..##.. +..##.. +..##.. +..##.. +..##.. +..##.. +..##.. +..##.. +..##.. +..##.. +..##.. +...... + +char 0x7D '}' width 8 +........ +........ +........ +........ +........ +........ +.###.... +..###... +...##... +...##... +...##... +...##... +...##... +...##... +...##... +...##... +....##.. +....##.. +...##... +...##... +...##... +...##... +...##... +...##... +...##... +...##... +..###... +.###.... +........ +........ +........ +........ + +char 0x7E '~' width 15 +............... +............... +............... +............... +............... +............... +............... +............... +............... +............... +............... +............... +............... +............... +............... +............... +............... +...####.....#.. +..########.##.. +..#....#####... +............... +............... +............... +............... +............... +............... +............... +............... +............... +............... +............... +............... diff --git a/demo/decoded/resources/2.i b/demo/decoded/resources/2.i new file mode 100644 index 0000000..5bee728 Binary files /dev/null and b/demo/decoded/resources/2.i differ diff --git a/demo/decoded/resources/2.is b/demo/decoded/resources/2.is new file mode 100644 index 0000000..261b00e Binary files /dev/null and b/demo/decoded/resources/2.is differ diff --git a/demo/decoded/resources/2.is.png b/demo/decoded/resources/2.is.png new file mode 100644 index 0000000..7434baf Binary files /dev/null and b/demo/decoded/resources/2.is.png differ diff --git a/demo/decoded/resources/3.i b/demo/decoded/resources/3.i new file mode 100644 index 0000000..1b55cf0 Binary files /dev/null and b/demo/decoded/resources/3.i differ diff --git a/demo/decoded/resources/3.is b/demo/decoded/resources/3.is new file mode 100644 index 0000000..70f7ee1 Binary files /dev/null and b/demo/decoded/resources/3.is differ diff --git a/demo/decoded/resources/3.is.png b/demo/decoded/resources/3.is.png new file mode 100644 index 0000000..23133c5 Binary files /dev/null and b/demo/decoded/resources/3.is.png differ diff --git a/demo/decoded/resources/4.i b/demo/decoded/resources/4.i new file mode 100644 index 0000000..6d3eade Binary files /dev/null and b/demo/decoded/resources/4.i differ diff --git a/demo/decoded/resources/4.is b/demo/decoded/resources/4.is new file mode 100644 index 0000000..a4f9ed1 Binary files /dev/null and b/demo/decoded/resources/4.is differ diff --git a/demo/decoded/resources/4.is.png b/demo/decoded/resources/4.is.png new file mode 100644 index 0000000..1bbe1d5 Binary files /dev/null and b/demo/decoded/resources/4.is.png differ diff --git a/demo/decoded/resources/5.i b/demo/decoded/resources/5.i new file mode 100644 index 0000000..aed1acd Binary files /dev/null and b/demo/decoded/resources/5.i differ diff --git a/demo/decoded/resources/5.is b/demo/decoded/resources/5.is new file mode 100644 index 0000000..077cf5e Binary files /dev/null and b/demo/decoded/resources/5.is differ diff --git a/demo/decoded/resources/5.is.png b/demo/decoded/resources/5.is.png new file mode 100644 index 0000000..a77d354 Binary files /dev/null and b/demo/decoded/resources/5.is.png differ diff --git a/demo/demo.HMI b/demo/demo.HMI new file mode 100644 index 0000000..797d8f3 Binary files /dev/null and b/demo/demo.HMI differ diff --git a/demo/render/controls.png b/demo/render/controls.png new file mode 100644 index 0000000..7edad1c Binary files /dev/null and b/demo/render/controls.png differ diff --git a/demo/render/gallery.png b/demo/render/gallery.png new file mode 100644 index 0000000..1de12dc Binary files /dev/null and b/demo/render/gallery.png differ diff --git a/demo/render/home.png b/demo/render/home.png new file mode 100644 index 0000000..a0a48c7 Binary files /dev/null and b/demo/render/home.png differ diff --git a/docs/COVERAGE.md b/docs/COVERAGE.md new file mode 100644 index 0000000..550a954 --- /dev/null +++ b/docs/COVERAGE.md @@ -0,0 +1,105 @@ +# Coverage report (updated 2026-11-15) + +What nextion-hmi-tools covers today compared with Nextion Editor 1.68, and what is missing. +"Verified" means checked against the real Editor: either the Editor's own output is reproduced +byte for byte, or a file written by nxhmi was opened in the Editor and showed the expected result. + +## Summary + +| Area | Status | +|---|---| +| Reading `.HMI` files | **complete** for everything seen so far | +| Writing `.HMI` files (edit, add, build from scratch) | **complete** for Basic-series projects | +| Checksums (page, project header, file table) | **complete**, verified | +| Components | **31 / 31 types** (20 Basic + 11 Intelligent-only) read/write/create | +| Readable JSON (enum names, colours) | done for every value list the Editor documents | +| Pictures | Basic series **complete**; Intelligent compressed format **missing** | +| Fonts | black/white **complete** incl. generation from TrueType; anti-aliased **missing** | +| Rendering pages like the Editor | **pixel-identical** for most components incl. picture skins; radio ~93-97 %, QR placeholder | +| New projects from scratch | `project.new_project(model)` for 12 Basic/Intelligent models; the generated demo is byte-identical to the Editor's re-save | +| Compiling `.tft` firmware | **research only** -- not possible yet | + +## Covered in detail + +### File container and integrity +- File table + backup table at 0x80000, Editor-style replace (append + delete), fresh compact + files. Verified: 34 sample files re-written byte-identical; from-scratch files open in the Editor. +- All three checksums (CRC-32/0x04C11DB7, STM32-style feeding) -- 276 Editor-written pages verify. + +### Project header (`main.HMI`) +- Model id + series byte, text-encoding index, resource list (pages, pictures, fonts). +- Adding pages, pictures and fonts updates it correctly (verified in the Editor). + +### Pages and components +- Byte-exact round trip of every page tested (204 pages). +- All 31 component types with the Editor's own default attributes (`templates_*.json`): + page, text, scrolling text, number, xfloat, button, dual-state button, progress bar, picture, + crop, hotspot, touch cap, gauge, waveform, slider, timer, variable, checkbox, radio, QR code, + and Intelligent-only video, audio, Gmov, ExPicture, ComboBox, SLText, FileStream, FileBrowser, + DataRecord, Switch, TextSelect. +- Event code (all event groups) as plain text lines. +- Text vs. number attributes detected reliably (length-limit companion rule). +- Signed values (e.g. number `val`) supported. + +### Readable values +- Value names for `vscope`, `sta` (per component type), `style`, `xcen`, `ycen`, `isbr`, `pw`, + `format`, `dir`, `en`, `mode`, `psta`, `dez`, variable type, QR logo -- taken from the Editor's + own attribute notes. Colours as `#rrggbb`. Still round-trips byte for byte. + +### Pictures (Basic series) +- `N.i` (RGB565, panel-native rotated order) and `N.is` (original file) -- encoder output is + byte-identical to the Editor's; adding pictures verified in the Editor. + +### Fonts +- `.zi` version 6, black/white: decode/encode byte-identical to the Editor (224-glyph font). +- New fonts from any TrueType/OpenType file (proportional or fixed width, ascii / iso-8859-1); + verified rendering in the Editor. + +### Rendering +- See [RENDER.md](RENDER.md): a real 6-page project renders pixel-identical; per-component tests + 100 % for text, number, xfloat, buttons, progress bar, slider, checkbox, picture, crop, waveform. + +### Tooling +- CLI: `info verify decode encode set add add-picture add-font new-page kinds render dump`. +- 66 unit tests; the only binary fixture is our own demo re-saved by Nextion Editor (no Nextion files). + +### Demo project +- `examples/make_demo.py` builds a 3-page project from code (fonts from Pillow's CC0 font, generated + pictures). Nextion Editor re-saves it byte for byte unchanged, every entry including `main.HMI`. + +## Missing + +### `.HMI` side +| Item | Notes | +|---|---| +| 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 | +| 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) | +| Editor features beyond the file | simulator/debugger, upload over serial (Nexus covers upload) | + +### Rendering +| Item | Notes | +|---|---| +| Radio circle | ~93-97 %: outline/dot differ by +-1 px at some radii (in progress) | +| QR code | placeholder; needs the Editor's QR settings | +| Pressed / runtime states, Intelligent-only components | not drawn | + +### `.tft` compilation (firmware for the display) +| Item | Status | +|---|---| +| File layout | mapped (header, embedded Nextion files, project section, trailer) | +| Layout table | decoded (fixed XOR key) | +| Trailer checksum | works for same-length edits; **unknown for different lengths** (stuck) | +| 3 header checksums (0x44, 0xC4, 0x18C) | not analysed | +| Compiled page format, event-code tokens | first look only | +| Pictures and fonts inside the TFT | not analysed | +| Licensing | every `.tft` embeds Nextion's firmware files; the repo must never ship them -- a builder would read them from the user's own Editor installation | + +## Suggested next steps +1. Intelligent picture format 4 (needed for Intelligent displays). +2. `.tft`: try the remaining trailer-checksum ideas listed in NOTES.md; then the compiled page format. +3. Sample the other display series to confirm templates and picture order. diff --git a/docs/FORMAT.md b/docs/FORMAT.md new file mode 100644 index 0000000..f9ab99e --- /dev/null +++ b/docs/FORMAT.md @@ -0,0 +1,251 @@ +# The Nextion Editor `.HMI` project format + +Reverse-engineered black-box: by editing projects in Nextion Editor (v1.68), saving, and comparing +files, and by asking the Editor whether hand-made files load ("oracle" tests). The Editor itself was +never decompiled or decrypted. Everything here was checked against real files; open points are +marked **OPEN**. + +All integers are little-endian. + +## 1. Container + +An `.HMI` file is a tiny file system. + +| Offset | Contents | +|---|---| +| `0x000000` | file table: `count` (u32), `count` × 28-byte entries, then the table checksum (u32) | +| `0x080000` | backup copy of the file table (byte-identical, incl. checksum) | +| `0x380000` | u32 `0xFFFFFFFF` | +| `0x6FFFF8` | ASCII `ver21234` | +| `0x700000` | entry data, packed back to back | + +The space between these areas is normally zero (older files can contain stale data, e.g. at +`0x100000`, which is ignored). + +### File table entry (28 bytes) + +| Offset | Size | Field | +|---|---|---| +| 0 | 16 | name, NUL padded (`main.HMI`, `Program.s`, `0.pa`, `0.i`, `0.is`, `0.zi`, ...) | +| 16 | 4 | start offset in the file | +| 20 | 4 | size | +| 24 | 1 | deleted flag | +| 25 | 3 | unknown (looks like uninitialised memory; **is** covered by the table checksum) | + +When the Editor replaces an entry it appends the new data to the end of the file, adds a new +entry, and marks the old entry deleted: deleted flag = 1 **and first byte of the name = 0** +(e.g. `\0ain.HMI`). The Editor finds entries by name, so setting only the flag is not enough. +Deleted entries stay in the table and their data stays in the file. + +If the primary table's checksum fails the Editor silently uses the backup table. If both fail it +reports "Version mismatch". The Editor also rewrites a file when opening it (it repairs the +primary table from the backup, among other things) -- never reuse a test file after opening it. + +### Entry names + +| Name | Contents | +|---|---| +| `main.HMI` | project header (display model, resource list) -- 224 bytes | +| `Program.s` | start-up script, plain text (no checksum) | +| `N.pa` | page N | +| `N.i` | picture N as the display uses it (section 4) | +| `N.is` | picture N's original source file (section 4) | +| `N.zi` | font N (section 5) | + +### `main.HMI` (project header) + +| Offset | Size | Field | +|---|---|---| +| 0 | 4 | checksum (section 2) | +| 4 | 4 | header size = 0x60 = start of the resource list | +| 8 | 1 | 1 (**OPEN**) | +| 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) | +| 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 | +| 28 | 4 | resource count | +| 36 | 4 | 1 or 2 (**OPEN**) | +| 0x41 | 1 | 3 after switching to an Intelligent model (**OPEN**) | +| 0x60 | 16 × count | resource list: type[8] + name[8], e.g. `pa`/`3.pa`, `i`/`0.i`, `zi`/`0.zi` | + +Adding a page = new `N.pa` entry + one resource-list entry + count + 1 + new checksum (verified: +the Editor shows pages added this way). `.is` entries are not listed. + +## 2. Checksums + +All three use CRC-32 with polynomial `0x04C11DB7`, MSB-first (not reflected), initial value +`0xFFFFFFFF`, no final XOR -- the algorithm of the STM32 hardware CRC unit. They differ in how +input is fed. + +### Page checksum (first 4 bytes of every `N.pa`) + +Every input **byte** is zero-extended to a 32-bit word and fed as one word. Input: + +``` +page[4:] # whole page after the checksum field ++ datasize (4 bytes, LE) # = page header offset 4 ++ numberobj (4 bytes, LE) # = page header offset 12 ++ page[20] + page[21] # header bytes 20 and 21 +``` + +Evidence: two saves differing in one bit place that bit's influence at `x^(32·k)` -- adjacent file +bytes are exactly 32 bits apart in the CRC stream; a fixed 10-word tail appears after the page; +the tail contents were solved over pages of different lengths and component counts; then +verified on 276 Editor-written pages (including a 2019 file) and by the Editor accepting pages +built from scratch. + +### `main.HMI` checksum (first 4 bytes) + +Same word-per-byte scheme. Input: `main[4:] + main[16:20] + main[4:8] + main[10] + main[14]`. +**OPEN**: the last two tail bytes were 0x21, 0x4F in every sample; they may be constants (they equal +the page header's "version" bytes) rather than fields. + +### File table checksum (u32 right after the last entry) + +Input read as **little-endian 32-bit words**: the table from `count` through the last entry, then +the constant word `0x43454441` (ASCII "ADEC"). + +## 3. Pages (`N.pa`) + +### Header (56 bytes) + +| Offset | Size | Field | +|---|---|---| +| 0 | 4 | checksum (above) | +| 4 | 4 | datasize = total page length | +| 8 | 4 | infoaddr = 56 (start of component table) | +| 12 | 4 | numberobj = component count | +| 16 | 4 | password | +| 20 | 1 | locked | +| 21 | 1 | 0x4F in every file seen (**OPEN**) | +| 22 | 1 | 0x21 (33) in every file seen -- format version? | +| 23 | 1 | 0 (**OPEN**) | +| 24 | 16 | page name | +| 40 | 16 | reserved (zero) | + +### Component table + +`numberobj` entries of `(u32 offset, u32 size, u32 unknown=0)`. Offset is relative to byte 56. +The page itself is component 0. + +### Component data + +A sequence of records `u32 length + bytes`, ending with an empty record. Records are grouped: +a header record `"-"` is followed by n records. + +* `att-`: attributes. Each record = 16-byte NUL-padded name + value. Integers are unsigned + LE of 1, 2 or 4 bytes (`val` has a different width per component type); `objname`, `txt` + (and other text attributes) are raw text in the project encoding (iso-8859-1 by default). +* `codes-`: event code, one record per line. Seen: `codesload` (preinitialize), + `codesloadend` (postinitialize), `codesdown` (touch press), `codesup` (touch release), + `codesunload` (page exit), `codestimer`, `codesslide` (slider move). + +Attribute names seen so far: `aph bco bco1 bco2 borderc borderw ch dis disup down drag effect en +endx endy first font format groupid0 groupid1 h hig id isbr key left lenth lockobj maxval minval +mode movex movey objname pco pco2 pic pic1 pic2 picc picc1 picc2 psta pw right sendkey spax spay +sta style tim time txt txt_maxl type up val vscope w wid x xcen y ycen`. + +Text attributes are `objname` and every attribute that has a length-limit companion in the same +component (`txt`/`txt_maxl`, `path`/`path_m`, `dir`/`dir_m`, `filter`/`filter_m`, +`format`/`format_m`, `vvs2`/`vvs2_m`). The same name can be a number elsewhere (`dir` is a u8 on +scrolling text, `format` a u8 on number). + +Component `type` values (all placed in Editor 1.68; full default attribute lists in +`src/nxhmi/templates_*.json`): + +| type | component | | type | component | +|---|---|---|---|---| +| 0 | waveform | | 59 | xfloat | +| 1 | slider | | 60 | ExPicture * | +| 2 | Gmov * | | 61 | ComboBox * | +| 3 | Video * | | 62 | SLText * | +| 4 | Audio * | | 63 | FileStream * | +| 5 | TouchCap | | 65 | FileBrowser * | +| 51 | timer | | 66 | DataRecord * | +| 52 | variable | | 67 | Switch * | +| 53 | dual-state button | | 68 | TextSelect * | +| 54 | number | | 98 | button | +| 55 | scrolling text | | 106 | progress bar | +| 56 | checkbox | | 109 | hotspot | +| 57 | radio | | 112 | picture | +| 58 | QRcode | | 113 | crop | +| 116 | text | | 121 | page | +| 122 | gauge | | | | + +\* Intelligent series only. Attribute sets of shared types are identical on Basic and Intelligent +projects. `sta` on pages/texts: 1 = solid colour, 2 = picture. + +## 4. Pictures + +`N.is` = 27-byte header + the original image file, untouched (verified byte-identical with the +PNG that was imported): + +| Offset | Size | Field | +|---|---|---| +| 0 | 4 | `0A 64 01 01` | +| 8 | 4 | data offset = 27 | +| 12 | 2+2 | width, height | +| 16 | 4 | length of the embedded file | +| 24 | 3 | file type, e.g. `png` | + +`N.i` = 24-byte header + pixels: + +| Offset | Size | Field | +|---|---|---| +| 0 | 4 | `0B 64 01 ` -- 0 = raw RGB565 (Basic series), 4 = compressed (Intelligent, **OPEN**) | +| 8 | 4 | data offset = 24 | +| 12 | 2+2 | width, height | +| 16 | 4 | data length (format 0: w × h × 2) | + +Format 0: RGB565 little-endian, converted by plain truncation (`r>>3, g>>2, b>>3`), stored in the +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). + +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: +swapped vs. the header, i.e. panel orientation), ... then a block codec: runs of RGB565 colours +followed by small index bytes (e.g. `18c6 38c6 18c6 38c6 2131 1111`), with a variable number of +bytes per 4x4 block, and full 8-bit alpha (a PNG with 256 alpha levels was imported). A 480x320 +photo compresses to 215,052 bytes at "Q:100". + +Adding a picture = `N.is` + `N.i` + a `i`/`N.i` resource-list entry (kept grouped with the other +`i` entries) -- verified in the Editor. + +## 5. Fonts (`N.zi`, format version 6) + +Header 44 bytes: magic `04 FF 00 0B`, u16 encoding (3 = iso-8859-1), u8 width, u8 height, +multi-byte range (2 bytes), code range first/last, u32 character count, u8 version = 6, +u8 name length (twice) + 0, u32 length of name+map+glyphs, u32 name offset = 0x2C, 16 unknown +bytes. Then the name, the character map, the glyph data. + +Character map: 10 bytes per character: u16 code, u8 glyph width, 2 unknown bytes, +u24 glyph offset (relative to the map start), u16 glyph length. + +Glyph: mode byte (0x01 = black/white), then run-length codes over the pixels in the same +column-by-column, bottom-to-top order as pictures (runs continue across columns): + +| Code | Meaning | +|---|---| +| `00 0xxxxx` | x transparent | +| `00 1xxxxx` | x ink | +| `01 0xxxxx` | x transparent, 1 ink | +| `01 1xxxxx` | x transparent, 2 ink | +| `10 0xxxxx` | x transparent, 3 ink | +| `10 1xxxxx` | x transparent, 4 ink | +| `11 tttiii` | ttt transparent, iii ink | + +The Editor encodes greedily (transparent run + 1..4 ink if possible, else the 3+3-bit form, else a +plain run); our encoder reproduces a 224-glyph Editor font byte for byte. The v3/v5 write-ups in +github.com/hagronnestad/nextion-font-editor were a useful starting point; v6 differs (scan order, +B/W codes `10`/`11`). **OPEN**: anti-aliased glyphs (other mode bytes), multi-byte encodings, +the 16 unknown header bytes. + +## 6. Not yet covered + +See `docs/NOTES.md`. diff --git a/docs/NOTES.md b/docs/NOTES.md new file mode 100644 index 0000000..89a398a --- /dev/null +++ b/docs/NOTES.md @@ -0,0 +1,117 @@ +# Status and open points + +## Done (verified against the real Editor) + +- Container read/write: file table + backup table, table checksum, Editor-style replace + (append + delete), building a fresh compact file from scratch. +- Page checksum, `main.HMI` checksum, table checksum. +- Pages: header, component table, attribute and event-code records -- byte-exact round trip on + every page tested (204 pages in 34 files). +- Decode to a JSON/text folder and encode back; edits made in JSON (text, position, new length) + load correctly in the Editor. +- Component factory (`nxhmi.components`) with the Editor's defaults for **all 31 component types** + (20 Basic + 11 Intelligent-only); `add(page, "button", x=.., txt=.., events=..)`. A page with 7 + tool-added components renders correctly in the Editor. +- `main.HMI` resource list and model/series/encoding fields; adding pages (`project.add_page`, + CLI `new-page`) -- the Editor shows the new page with its components. +- Pictures (Basic series): `N.i` and `N.is` decode/encode, byte-identical to the Editor; adding + pictures (`project.add_picture`, CLI `add-picture`) verified in the Editor. +- Fonts (`.zi` v6, black/white): decode/encode byte-identical to the Editor. +- `decode` also writes the original picture files and a text dump of every font. +- Font generation from TrueType (`fonts.from_ttf`, CLI `add-font`): proportional fonts render + correctly in the Editor. Cosmetic OPEN: the Editor's Fonts panel derives the shown name/encoding + from the name string in a way not yet matched (shows "DejaVuSans-(h:24,encode:24asc..."). +- CLI: `info verify decode encode set add add-picture add-font kinds new-page dump`. + +Full overview of what is covered and missing: [COVERAGE.md](COVERAGE.md). + +- Readable JSON values (enum names, `#rrggbb` colours); page renderer pixel-identical to the + Editor for most components ([RENDER.md](RENDER.md)). + +## Next steps (in order) + +1. Intelligent picture format 4 (block codec with alpha, see FORMAT.md 4 -- first look only); anti-aliased fonts. +3. `.tft` compilation research. + +## Open + +- `main.HMI`: bytes 8, 13, 36, 0x41; series codes other than Basic (0) and Intelligent (3); + whether the last two checksum tail bytes are fields or constants (only one value ever seen). +- Pictures, picture sources, fonts: carried as raw blobs for now. +- Unknown bytes: page header offsets 21/23, entry bytes 25..27, component-table third word. +- Templates come from Editor 1.68 on NX4832T035 (Basic) and NX4827P043 (Intelligent); + Discovery/Enhanced/Edge series not sampled yet. + +## .tft compilation -- first look (2026-11-15), paused for a decision + +How to get one: Compile, then File > "TFT file output" > Output (written to +`%AppData%\Nextion Editor\work\\output\`). Compile also leaves `run.run` there (the simulator +build, much smaller -- pictures are stored differently). + +Observed in a 740,544-byte TFT of a 6-page NX4832T035 project: + +- 0x000-0x0C3: header -- model id (0xB23BC018 at 0x2C), screen size (480/320 at 0x0C), several + sizes/offsets; then FF padding. +- 0x0C4-0x117: a block of 32-bit words that all share the same high bytes (`.. .. AB EB`) -- + i.e. XOR-obfuscated with a fixed key. A 4-byte value at 0x18C, then FF up to ~64 KB. +- The rest: project data, plus **Nextion's own binaries embedded verbatim** from the Editor's + install folder: `input.bin` (all of it), `qr0.bin`, `syscom.bin`. `ApplicationRUN.s0` (the + display runtime, 105 KB) was not found in plain form. + +Consequences for an open-source compiler: + +1. The repo must not ship Nextion's binaries. A compiler would have to read them from the user's + own Editor installation at build time. +2. The XOR-obfuscated parts are a deliberate protection, not just a format. Reproducing them + needs a decision on whether that is acceptable (interoperability research vs. circumvention). +3. Real work beyond that: Nextion script -> bytecode compiler, per-component runtime layout, + pictures/fonts in TFT layout, TFT checksums. + +### Second look: minimal projects (one empty page, no pictures/fonts), NX4832T035 + +Method: build tiny projects with nxhmi that differ in one thing, compile + "TFT file output" via +the Editor, diff. **Compilation is deterministic** (same HMI -> byte-identical TFT). + +Layout of a minimal TFT (328,920 bytes): + +| Range | Contents | +|---|---| +| 0x00000-0x10090 | header (0x00-0xC3), XOR-obfuscated block (0xC4-0x117), value at 0x18C, FF padding, 144 bytes at 0x10000 | +| 0x10090-0x47F7B | Nextion files, verbatim, in this order: `input.bin`, `asp0.dll`, `cd0.dll`, `qr0.bin`, `syscom.bin`, `h0-0.dll`, `h1-0.dll` (the `.dll` files in the Editor folder are display firmware pieces, not Windows DLLs) | +| 0x47F7B-end-4 | project section: ~32 KB of zeros, then the compiled page(s) (~1 KB for an empty page) | +| last 4 bytes | file checksum | + +Header fields (byte offsets, LE): 0x0C u16 480, u16 320, u16 320, u16 480; 0x18 and 0x1E u32 += offset of `cd0.dll`; 0x22 u32 = size of `cd0.dll`; 0x26 u32 = offset of `asp0.dll`; 0x2A u32 += size of `asp0.dll`; 0x2E u32 model id; 0x3C u32 file size; 0x40 u32 0x40000 (0x90000 for the +6-page project); 0x44 u32 hash-like value; 0x58 u32 grows with the project data. + +Compiled page (plain, not obfuscated): contains `0,0,480,320,` (page area), event names +(`down`, `up`, `unload`), attribute values in place (page `bco` as u16 LE). Event code is +**tokenized, not compiled to bytecode**: `dim=50` becomes a 1-byte token for `dim` followed by the +literal text `=50`. + +Obfuscated block 0xC4-0x117: word 0xC4 is a per-file checksum; words 0xC8..0x113 are a +**layout table XORed with the fixed key 0xEBAB2932** (offsets/sizes/counts -- e.g. the project +section start 0x47F7B twice, a size that grows with the code, page/picture counts). Decoder: +`nxhmi.tft.layout_table`. + +Three more per-file values -- 0x44, 0xC4, 0x18C -- do **not** change when only content changes +(page colour, one code character); they depend on layout only (likely header checksums). + +File checksum (last 4 bytes, LE): word-per-byte CRC (same family as the page checksum), stream +ending right before the trailer -- proved on two independent one-change pairs. Consequently +**same-length edits can be re-checksummed** (`nxhmi.tft.patch_trailer`, reproduces the Editor's +output byte for byte for a colour change and for `dim=50` -> `dim=51`). + +**STUCK (2026-11-15):** start offset / seed of the trailer CRC across files of different lengths. +Tried, all without a fit (three minimal files of different lengths + the 6-page project): +every start offset 0..end with a constant seed (solved exactly by GF(2) linear algebra); seeds +taken from header fields 0x44/0xC4/0x18C (raw, inverted, LE/BE); the header checksum fields +zeroed or 0xFF in every combination; the layout table de-obfuscated before checksumming. +Ideas not yet tried: the stream skipping a region whose size varies (e.g. FF padding after the +page data); a seed derived from file size or layout words; the trailer covering only the +project section in a different order (e.g. pages then the zero area). + +Not started: the 3 header checksums, the compiled page format (component records, the token +table for event code), pictures/fonts inside the TFT. diff --git a/docs/RENDER.md b/docs/RENDER.md new file mode 100644 index 0000000..103d029 --- /dev/null +++ b/docs/RENDER.md @@ -0,0 +1,55 @@ +# Page rendering vs. Nextion Editor + +`python -m nxhmi render project.HMI out/` draws every page the way Nextion Editor 1.68 shows it on +its canvas. Verified by capturing the Editor's canvas at 100 % zoom and comparing pixel by pixel +(ignoring the Editor's yellow name tags and its 2-px selection outline). + +## Results + +The demo project (`demo/demo.HMI`, built by `examples/make_demo.py`): + +| Page | Differing pixels | Notes | +|---|---|---| +| home | 94 | all in the two radio buttons and at name-tag edges | +| controls | 5 | name-tag edges | +| gallery | 1 | name-tag edge | + +A real 6-page user project (pictures, 32-px bitmap font, texts, 3D buttons, sliders): every page +pixel-identical apart from 0-5 px at name-tag edges. + +Per component (dedicated test pages): + +| Component | Match | Notes | +|---|---|---| +| text (all xcen/ycen, solid / crop / image background, border, 3D up/down) | 100 % | | +| text with word wrap | 100 % | the text block is aligned as a whole, lines left-aligned in it | +| number (plain, fixed length, hex, currency, negative), xfloat | 100 % | | +| button, dual-state button (colour and picture skins, on/off) | 100 % | "on" with 3D style is drawn pressed (3D down) | +| scrolling text (static) | 100 % | | +| progress bar (horizontal, vertical, picture mode) | 100 % | | +| slider (horizontal, vertical, auto cursor, picture background and cursor) | 100 % | auto cursor = square as thick as the slider; position truncates | +| checkbox (3D down, border, flat) | 100 % | | +| picture, crop (also smaller than the component) | 100 % | only the picture's real area is drawn | +| waveform (frame + grid) | 100 % | horizontal grid lines count from the bottom | +| gauge | 99.3 - 100 % | needle anti-aliasing differs by a few px | +| radio | ~93 - 97 % | circle outline/dot differ by +-1 px at some radii (work in progress) | +| QR code | placeholder only | | +| hotspot, touch cap, timer, variable | nothing drawn (same as the Editor) | | + +## Rules learned from the Editor + +- Text never starts above/left of its box: centring clamps at 0 (a 32-px font in a 30-px box + starts at the top). +- Text is laid out inside the border: 1 px for 3D styles, `borderw` for style "border". +- 3D colours are fixed: light (230,226,230), dark (65,68,65) -- top/left light for 3D up/auto, + dark for 3D down. +- Buttons with a picture background (`sta` crop or image) get no frame. +- Pictures are pasted at their real size; a smaller picture leaves the rest untouched. +- Checkbox: `bco` fill, `style` frame, checked = `pco` square from w/4 to 3w/4. +- Radio: circle sized by the component *width* (clipped to the height); ring radius + `(w-1)//2`, colour (65,68,65), filled with `bco`; checked = `pco` dot. +- Slider: auto cursor (255) is a square as thick as the slider; position = `int(frac * free)`. +- Waveform: vertical grid lines from the left edge, horizontal ones counted from the bottom. + +Not covered yet: exact radio circles, QR codes, Intelligent-only components (need Intelligent +picture format 4), anti-aliased fonts, pressed/runtime states. diff --git a/examples/make_demo.py b/examples/make_demo.py new file mode 100644 index 0000000..1a742ae --- /dev/null +++ b/examples/make_demo.py @@ -0,0 +1,152 @@ +"""Build the demo project (demo/demo.HMI) entirely from code -- no Nextion files involved. + + python examples/make_demo.py # writes demo/demo.HMI, demo/decoded/, demo/render/ + +Needs Pillow (pictures, the bundled CC0 "Aileron" font, rendering). +""" +import io +import os +import shutil +import sys + +HERE = os.path.dirname(os.path.abspath(__file__)) +ROOT = os.path.dirname(HERE) +sys.path.insert(0, os.path.join(ROOT, "src")) + +from PIL import Image, ImageDraw # noqa: E402 + +from nxhmi import components as C, fonts, project # noqa: E402 +from nxhmi.render import Renderer # noqa: E402 + +W, H = 480, 320 + + +def png(img): + b = io.BytesIO() + img.save(b, "PNG") + return b.getvalue() + + +def background(): + img = Image.new("RGB", (W, H)) + d = ImageDraw.Draw(img) + for y in range(H): + t = y / (H - 1) + d.line([(0, y), (W - 1, y)], fill=(int(20 + 40 * t), int(40 + 80 * t), int(90 + 120 * t))) + for i in range(0, W, 40): + d.line([(i, 0), (i + 120, H)], fill=(60, 110, 170)) + return png(img) + + +def icon(size=64): + img = Image.new("RGB", (size, size), (255, 255, 255)) + d = ImageDraw.Draw(img) + d.ellipse([4, 4, size - 5, size - 5], fill=(255, 170, 0), outline=(120, 60, 0), width=3) + d.rectangle([size // 2 - 4, 12, size // 2 + 3, size - 13], fill=(255, 255, 255)) + return png(img) + + +def skin(w, h, c1, c2): + img = Image.new("RGB", (w, h)) + d = ImageDraw.Draw(img) + for x in range(w): + t = x / max(1, w - 1) + d.line([(x, 0), (x, h - 1)], fill=tuple(int(a + (b - a) * t) for a, b in zip(c1, c2))) + d.rectangle([0, 0, w - 1, h - 1], outline=(255, 255, 255)) + return png(img) + + +def build(): + h = project.new_project("NX4832T035_011", "home") + small = project.add_font(h, fonts.from_ttf(None, 16)) # font 0 + big = project.add_font(h, fonts.from_ttf(None, 32)) # font 1 + bg = project.add_picture(h, background()) + ico = project.add_picture(h, icon()) + sk1 = project.add_picture(h, skin(140, 40, (200, 40, 40), (60, 40, 200))) + sk2 = project.add_picture(h, skin(140, 40, (40, 160, 60), (220, 200, 40))) + bar = project.add_picture(h, skin(200, 24, (40, 40, 40), (110, 110, 110))) + barfg = project.add_picture(h, skin(200, 24, (255, 140, 0), (255, 240, 0))) + + # ---- page 0: home + from nxhmi.page import Page + home = Page.parse(h.read("0.pa")) + home.components[0].set("sta", 2) + home.components[0].set("pic", bg) + home.components[0].set_event("codesloadend", ["tm0.en=1"]) + C.add(home, "text", "title", x=10, y=6, w=460, h=40, txt="nxhmi demo", font=big, sta=0, picc=bg, + pco=0xFFFF, xcen=0) + C.add(home, "button", "bControls", x=330, y=60, w=140, h=40, txt="controls", font=small, + events={"codesup": ["page controls"]}) + C.add(home, "button", "bGallery", x=330, y=110, w=140, h=40, txt="gallery", font=small, + events={"codesup": ["page gallery"]}) + C.add(home, "number", "nCount", x=10, y=60, w=150, h=40, val=1234, font=big, sta=1, bco=0xFFFF) + C.add(home, "xfloat", "xTemp", x=170, y=60, w=150, h=40, val=2155, vvs0=0, vvs1=2, font=big, sta=1, bco=0xFFFF) + C.add(home, "progress_bar", "jLoad", x=10, y=110, w=310, h=24, val=65) + C.add(home, "slider", "hLevel", x=10, y=145, w=310, h=30, val=40, minval=0, maxval=100, + events={"codesslide": ["jLoad.val=hLevel.val"]}) + C.add(home, "checkbox", "cOn", x=10, y=190, w=30, h=30, val=1) + C.add(home, "text", "tOn", x=45, y=190, w=100, h=30, txt="enabled", font=small, sta=0, picc=bg, pco=0xFFFF, xcen=0) + C.add(home, "radio", "rA", x=150, y=190, w=30, h=30, val=1) + C.add(home, "radio", "rB", x=190, y=190, w=30, h=30, val=0) + C.add(home, "gauge", "zSpeed", x=10, y=230, w=80, h=80, val=135, wid=3, sta=1, bco=0xFFFF) + C.add(home, "picture", "pIcon", x=100, y=240, w=64, h=64, pic=ico) + C.add(home, "text", "tStatus", x=180, y=270, w=290, h=40, txt="status: ok", font=small, sta=1, + bco=0x0000, pco=0x07E0, xcen=0, style=1, borderw=2, borderc=0x07E0) + C.add(home, "timer", "tm0", tim=1000, en=0, events={"codestimer": ["nCount.val++"]}) + C.add(home, "variable", "vaMode", val=1) + h.write("0.pa", home.pack()) + + # ---- page 1: controls + ctl = project.add_page(h, "controls", sta=1, bco=0xEF7D) + C.add(ctl, "button", "bBack", x=10, y=6, w=80, h=34, txt="< back", font=small, events={"codesup": ["page home"]}) + C.add(ctl, "text", "tHead", x=100, y=6, w=370, h=34, txt="controls", font=big, sta=1, bco=0xEF7D, xcen=2) + for i, (xc, yc, st, label) in enumerate([(0, 0, 0, "left/top flat"), (1, 1, 1, "center border"), + (2, 2, 2, "right 3D down"), (1, 1, 3, "3D up")]): + C.add(ctl, "text", "tAlign%d" % i, x=10 + (i % 2) * 235, y=50 + (i // 2) * 55, w=225, h=48, + txt=label, font=small, xcen=xc, ycen=yc, style=st, borderw=2, borderc=0x001F, sta=1, bco=0xFFFF) + C.add(ctl, "text", "tWrap", x=10, y=162, w=150, h=60, txt="word wrap inside a narrow box", font=small, + isbr=1, sta=1, bco=0xFFFF, style=1, borderw=1, borderc=0) + C.add(ctl, "dual_state_button", "btOff", x=170, y=162, w=140, h=28, txt="off", font=small, val=0) + C.add(ctl, "dual_state_button", "btOn", x=170, y=194, w=140, h=28, txt="on", font=small, val=1) + C.add(ctl, "scrolling_text", "gNews", x=320, y=162, w=150, h=28, txt="scrolling text", font=small, sta=1, bco=0xFFFF) + C.add(ctl, "number", "nHex", x=320, y=194, w=150, h=28, val=48879, format=2, font=small, sta=1, bco=0xFFFF) + C.add(ctl, "waveform", "sWave", x=10, y=230, w=300, h=80, ch=1) + C.add(ctl, "progress_bar", "jVert", x=320, y=230, w=30, h=80, val=70, dez=1) + C.add(ctl, "slider", "hVert", x=360, y=230, w=30, h=80, val=30, mode=1) + C.add(ctl, "hotspot", "mHot", x=400, y=230, w=70, h=80, events={"codesup": ["page home"]}) + h.write("1.pa", ctl.pack()) + + # ---- page 2: gallery (pictures as backgrounds and skins) + gal = project.add_page(h, "gallery", sta=1, bco=0xFFFF) + C.add(gal, "button", "bBack", x=10, y=6, w=80, h=34, txt="< back", font=small, events={"codesup": ["page home"]}) + C.add(gal, "crop", "qBg", x=100, y=6, w=370, h=34, picc=bg) + C.add(gal, "picture", "pIcon", x=10, y=50, w=64, h=64, pic=ico) + C.add(gal, "button", "bSkin", x=90, y=50, w=140, h=40, txt="skinned", font=small, sta=2, pic=sk1, pic2=sk2, pco=0xFFFF) + C.add(gal, "dual_state_button", "btSkin", x=240, y=50, w=140, h=40, txt="dual on", font=small, sta=2, + pic=sk1, pic2=sk2, pco=0xFFFF, val=1) + C.add(gal, "progress_bar", "jSkin", x=90, y=100, w=200, h=24, sta=1, bpic=bar, ppic=barfg, val=55) + C.add(gal, "text", "tCrop", x=10, y=140, w=460, h=60, txt="text on a cropped background", font=big, + sta=0, picc=bg, pco=0xFFFF) + C.add(gal, "text", "tImg", x=10, y=210, w=200, h=40, txt="image bg", font=small, sta=2, pic=sk2, pco=0) + h.write("2.pa", gal.pack()) + return h + + +def main(): + out = os.path.join(ROOT, "demo") + os.makedirs(out, exist_ok=True) + h = build() + path = os.path.join(out, "demo.HMI") + h.save(path) + dec = os.path.join(out, "decoded") + shutil.rmtree(dec, ignore_errors=True) + project.decode(path, dec) + r = Renderer(h) + os.makedirs(os.path.join(out, "render"), exist_ok=True) + for name in ("home", "controls", "gallery"): + r.render(name).save(os.path.join(out, "render", name + ".png")) + print("wrote", path, "+ decoded/ + render/") + + +if __name__ == "__main__": + main() diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..6b6fa60 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,23 @@ +[build-system] +requires = ["setuptools>=61"] +build-backend = "setuptools.build_meta" + +[project] +name = "openhmi-nx" +version = "0.1.0" +description = "Read, verify and write Nextion Editor .HMI project files without the Editor" +readme = "README.md" +license = {text = "MIT"} +requires-python = ">=3.9" + +[project.scripts] +nxhmi = "nxhmi.cli:main" + +[tool.setuptools.packages.find] +where = ["src"] + +[tool.setuptools.package-data] +nxhmi = ["*.json"] + +[project.optional-dependencies] +images = ["pillow>=10.1"] diff --git a/src/nxhmi/__init__.py b/src/nxhmi/__init__.py new file mode 100644 index 0000000..d5bedc9 --- /dev/null +++ b/src/nxhmi/__init__.py @@ -0,0 +1,7 @@ +"""nxhmi -- read, verify and write Nextion Editor .HMI project files without the Editor.""" +from .checksum import page_crc, main_crc, table_crc +from .container import HMIFile, build +from .page import Page, Component, Attr, Group + +__version__ = "0.1.0" +__all__ = ["page_crc", "main_crc", "table_crc", "HMIFile", "build", "Page", "Component", "Attr", "Group"] diff --git a/src/nxhmi/__main__.py b/src/nxhmi/__main__.py new file mode 100644 index 0000000..dd8a8c9 --- /dev/null +++ b/src/nxhmi/__main__.py @@ -0,0 +1,5 @@ +import sys + +from .cli import main + +sys.exit(main()) diff --git a/src/nxhmi/checksum.py b/src/nxhmi/checksum.py new file mode 100644 index 0000000..3c87980 --- /dev/null +++ b/src/nxhmi/checksum.py @@ -0,0 +1,91 @@ +"""Checksums used inside Nextion Editor .HMI project files. + +All three are CRC-32 with polynomial 0x04C11DB7, processed MSB-first (no bit reflection), +initial value 0xFFFFFFFF and no final XOR -- i.e. the algorithm of the STM32 hardware CRC unit. +They differ only in how the input is fed: + +* ``word_per_byte_crc`` -- every input *byte* is zero-extended and fed as one 32-bit word. + Used for pages (``*.pa``) and the project header (``main.HMI``), each followed by a + 10-byte "tail" (see :func:`page_crc` / :func:`main_crc`). +* ``dword_crc`` -- input is read as little-endian 32-bit words. Used for the file table, + followed by the constant word 0x43454441 (ASCII "ADEC"). + +These were reverse-engineered black-box (by editing projects in the Editor and comparing +saved files); see docs/FORMAT.md for the evidence. +""" +from __future__ import annotations + +import struct + +POLY = 0x04C11DB7 +INIT = 0xFFFFFFFF +TABLE_MAGIC = 0x43454441 # "ADEC" + +_TABLE = [] +for _i in range(256): + _c = _i << 24 + for _ in range(8): + _c = ((_c << 1) ^ POLY) & 0xFFFFFFFF if _c & 0x80000000 else (_c << 1) & 0xFFFFFFFF + _TABLE.append(_c) + + +def _feed_byte(c: int, b: int) -> int: + return ((c << 8) & 0xFFFFFFFF) ^ _TABLE[((c >> 24) ^ b) & 0xFF] + + +def _feed_word(c: int, w: int) -> int: + """Feed one 32-bit word MSB-first (== its 4 big-endian bytes).""" + c = _feed_byte(c, (w >> 24) & 0xFF) + c = _feed_byte(c, (w >> 16) & 0xFF) + c = _feed_byte(c, (w >> 8) & 0xFF) + return _feed_byte(c, w & 0xFF) + + +def _feed_byte_as_word(c: int, b: int) -> int: + # word 0x000000bb: three zero bytes then b + c = _TABLE[(c >> 24) & 0xFF] ^ ((c << 8) & 0xFFFFFFFF) + c = _TABLE[(c >> 24) & 0xFF] ^ ((c << 8) & 0xFFFFFFFF) + c = _TABLE[(c >> 24) & 0xFF] ^ ((c << 8) & 0xFFFFFFFF) + return _feed_byte(c, b) + + +def word_per_byte_crc(data: bytes, crc: int = INIT) -> int: + for b in data: + crc = _feed_byte_as_word(crc, b) + return crc + + +def dword_crc(data: bytes, crc: int = INIT) -> int: + if len(data) % 4: + raise ValueError("dword_crc needs a multiple of 4 bytes") + for (w,) in struct.iter_unpack(" int: + """CRC stored in the first 4 bytes of a page (``N.pa``) blob. + + Input: page[4:], then datasize (LE32, header offset 4), numberobj (LE32, offset 12), + and the header bytes at offsets 20 and 21 -- each byte fed as a word. + """ + datasize, = struct.unpack_from(" int: + """CRC stored in the first 4 bytes of the ``main.HMI`` project header blob. + + Input: main[4:], then main[16:20] (model id), main[4:8], main[10], main[14]. + NOTE: the last two tail bytes were 0x21, 0x4F in every sample seen; they are taken from + offsets 10 and 14 where those values live, but could also be constants (format version). + """ + tail = main[16:20] + main[4:8] + main[10:11] + main[14:15] + return word_per_byte_crc(main[4:] + tail) + + +def table_crc(table: bytes) -> int: + """Checksum stored right after the file table (count + entries).""" + return _feed_word(dword_crc(table), TABLE_MAGIC) diff --git a/src/nxhmi/cli.py b/src/nxhmi/cli.py new file mode 100644 index 0000000..7c81651 --- /dev/null +++ b/src/nxhmi/cli.py @@ -0,0 +1,195 @@ +"""Command line interface: ``python -m nxhmi ...``""" +from __future__ import annotations + +import argparse +import json +import sys + +from . import checksum, project +from .container import HMIFile +from .page import Page + + +def cmd_info(a): + h = HMIFile.load(a.hmi) + t0, t1 = h.table_ok() + print("file table: primary %s, backup %s" % ("ok" if t0 else "BAD", "ok" if t1 else "BAD")) + for e in h.entries: + flag = "deleted" if e.deleted else "" + shown = e.name if not e.deleted else "(%s)" % e.name.encode("latin-1").decode("ascii", "replace").replace("�", "?").replace("\0", "?") + line = "%-16s %8d bytes @0x%07X %s" % (shown, e.size, e.start, flag) + if not e.deleted and e.name.endswith(".pa"): + blob = h.read(e.name) + ok = checksum.page_crc(blob) == int.from_bytes(blob[:4], "little") + p = Page.parse(blob, verify=False) + line += " page %-14s %3d components crc %s" % (p.name, len(p.components), "ok" if ok else "BAD") + print(line) + + +def cmd_verify(a): + bad = 0 + for path in a.hmi: + h = HMIFile.load(path) + for e in h.live(): + blob = h.read(e.name) + stored = int.from_bytes(blob[:4], "little") + if e.name.endswith(".pa") and checksum.page_crc(blob) != stored: + print("%s: %s page checksum BAD" % (path, e.name)); bad += 1 + if e.name == "main.HMI" and checksum.main_crc(blob) != stored: + print("%s: main.HMI checksum BAD" % path); bad += 1 + t0, t1 = h.table_ok() + if not (t0 and t1): + print("%s: file table checksum BAD (primary %s, backup %s)" % (path, t0, t1)); bad += 1 + if not bad: + print("%s: ok" % path) + return 1 if bad else 0 + + +def cmd_decode(a): + m = project.decode(a.hmi, a.out, a.encoding, not a.raw) + print("decoded %d entries into %s" % (len(m["entries"]), a.out)) + + +def cmd_encode(a): + project.encode(a.folder, a.hmi) + print("wrote", a.hmi) + + +def cmd_set(a): + """Set one attribute in place: nxhmi set file.HMI page objname attr value [-o out]""" + h = HMIFile.load(a.hmi) + for e in h.live(): + if not e.name.endswith(".pa"): + continue + p = Page.parse(h.read(e.name)) + if p.name != a.page: + continue + c = p.component(a.component) + if c is None: + sys.exit("no component %r on page %r" % (a.component, a.page)) + kind, _ = c.attr(a.attr).decoded() + c.set(a.attr, a.value if kind in ("str", "hex") else int(a.value, 0)) + h.write(e.name, p.pack()) + h.save(a.out or a.hmi) + print("set %s.%s.%s = %s" % (a.page, a.component, a.attr, a.value)) + return + sys.exit("no page %r" % a.page) + + +def cmd_add(a): + """Add a component: nxhmi add file.HMI page kind [name=value ...] [--name obj] [-o out]""" + from . import components + h = HMIFile.load(a.hmi) + for e in h.live(): + if not e.name.endswith(".pa"): + continue + p = Page.parse(h.read(e.name)) + if p.name != a.page: + continue + kw = {} + for item in a.attrs: + k, _, v = item.partition("=") + try: + kw[k] = int(v, 0) + except ValueError: + kw[k] = v + c = components.add(p, a.kind, a.name, **kw) + h.write(e.name, p.pack()) + h.save(a.out or a.hmi) + print("added %s (%s, id %d) to page %s" % (c.name, a.kind, c.get("id"), p.name)) + return + sys.exit("no page %r" % a.page) + + +def cmd_new_page(a): + from . import project + h = HMIFile.load(a.hmi) + project.add_page(h, a.name) + h.save(a.out or a.hmi) + print("added page", a.name) + + +def cmd_add_font(a): + from . import fonts, project + h = HMIFile.load(a.hmi) + f = fonts.from_ttf(a.ttf, a.height, a.encoding, a.fixed_width) + fid = project.add_font(h, f) + h.save(a.out or a.hmi) + print("added font id %d (%s, %d chars)" % (fid, f.name, len(f.glyphs))) + + +def cmd_add_picture(a): + from . import project + h = HMIFile.load(a.hmi) + with open(a.image, "rb") as f: + pid = project.add_picture(h, f.read()) + h.save(a.out or a.hmi) + print("added picture id", pid) + + +def cmd_render(a): + import os + from .render import Renderer + r = Renderer(HMIFile.load(a.hmi)) + names = [k for k in r.pages if isinstance(k, str)] + todo = names if a.page in (None, "all") else [a.page] + os.makedirs(a.out, exist_ok=True) + for n in todo: + path = os.path.join(a.out, "%s.png" % n) + r.render(n).save(path) + print("wrote", path) + + +def cmd_kinds(a): + from . import components + for k in components.kinds(): + print(k) + + +def cmd_dump(a): + h = HMIFile.load(a.hmi) + for e in h.live(): + if e.name.endswith(".pa"): + p = Page.parse(h.read(e.name)) + if a.page and p.name != a.page: + continue + print(json.dumps(project.page_to_json(e.name, p, a.encoding, not a.raw), indent=1, ensure_ascii=False)) + + +def main(argv=None): + ap = argparse.ArgumentParser(prog="nxhmi", description="Read, verify and write Nextion Editor .HMI projects") + sub = ap.add_subparsers(dest="cmd", required=True) + s = sub.add_parser("info", help="list entries, pages and checksum status"); s.add_argument("hmi"); s.set_defaults(f=cmd_info) + s = sub.add_parser("verify", help="check every checksum"); s.add_argument("hmi", nargs="+"); s.set_defaults(f=cmd_verify) + s = sub.add_parser("decode", help="HMI -> folder of JSON/text"); s.add_argument("hmi"); s.add_argument("out") + s.add_argument("--encoding", default="latin-1"); s.add_argument("--raw", action="store_true", help="numbers instead of names/colours") + s.set_defaults(f=cmd_decode) + s = sub.add_parser("encode", help="folder -> new HMI"); s.add_argument("folder"); s.add_argument("hmi"); s.set_defaults(f=cmd_encode) + s = sub.add_parser("set", help="change one attribute") + for n in ("hmi", "page", "component", "attr", "value"): + s.add_argument(n) + s.add_argument("-o", "--out"); s.set_defaults(f=cmd_set) + s = sub.add_parser("add", help="add a component to a page (kind: see 'kinds')") + s.add_argument("hmi"); s.add_argument("page"); s.add_argument("kind") + s.add_argument("attrs", nargs="*", help="attribute=value, e.g. x=10 y=20 txt=Hi") + s.add_argument("--name"); s.add_argument("-o", "--out"); s.set_defaults(f=cmd_add) + s = sub.add_parser("render", help="render pages to PNG like the Editor's canvas (needs Pillow)") + s.add_argument("hmi"); s.add_argument("out", help="output folder"); s.add_argument("--page", help="page name (default: all)") + s.set_defaults(f=cmd_render) + s = sub.add_parser("kinds", help="list component kinds that can be added"); s.set_defaults(f=cmd_kinds) + s = sub.add_parser("add-font", help="rasterize a .ttf into a new font (needs Pillow)") + s.add_argument("hmi"); s.add_argument("ttf"); s.add_argument("height", type=int) + s.add_argument("--encoding", default="ascii", choices=["ascii", "iso-8859-1"]) + s.add_argument("--fixed-width", type=int); s.add_argument("-o", "--out"); s.set_defaults(f=cmd_add_font) + s = sub.add_parser("add-picture", help="add a picture (png/jpg/bmp; needs Pillow)") + s.add_argument("hmi"); s.add_argument("image"); s.add_argument("-o", "--out"); s.set_defaults(f=cmd_add_picture) + s = sub.add_parser("new-page", help="add an empty page"); s.add_argument("hmi"); s.add_argument("name") + s.add_argument("-o", "--out"); s.set_defaults(f=cmd_new_page) + s = sub.add_parser("dump", help="print pages as JSON"); s.add_argument("hmi"); s.add_argument("--page") + s.add_argument("--encoding", default="latin-1"); s.add_argument("--raw", action="store_true"); s.set_defaults(f=cmd_dump) + a = ap.parse_args(argv) + return a.f(a) or 0 + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/src/nxhmi/components.py b/src/nxhmi/components.py new file mode 100644 index 0000000..758f7e8 --- /dev/null +++ b/src/nxhmi/components.py @@ -0,0 +1,88 @@ +"""Create new components from the Editor's own defaults. + +templates_basic.json / templates_intelligent.json hold, per component type, the full attribute +list (name, kind, default) and event groups exactly as Nextion Editor writes a freshly placed +component (regenerate with tools/make_templates.py). Basic types are available on every series; +the Intelligent file adds the types that only exist there (video, audio, combobox, ...). +""" +from __future__ import annotations + +import json +import os + +from .page import Attr, Component, Group, Page + +_HERE = os.path.dirname(os.path.abspath(__file__)) + + +def _load(fn): + with open(os.path.join(_HERE, fn), encoding="utf-8") as f: + return {int(k): v for k, v in json.load(f)["types"].items()} + + +BASIC = _load("templates_basic.json") +INTELLIGENT = _load("templates_intelligent.json") +TYPES = dict(INTELLIGENT) +TYPES.update(BASIC) # basic defaults win for shared types +KINDS = {v["kind"]: k for k, v in TYPES.items()} +INTELLIGENT_ONLY = sorted(v["kind"] for k, v in INTELLIGENT.items() if k not in BASIC) + + +def kinds() -> list[str]: + return sorted(KINDS) + + +def _type(kind) -> dict: + return TYPES[KINDS[kind] if isinstance(kind, str) else int(kind)] + + +def make(kind, objname: str, id_: int, **attrs) -> Component: + """Build a component of ``kind`` (name like "button" or numeric type) with Editor defaults. + + Keyword arguments set attributes (x=, y=, w=, h=, txt=, ...); endx/endy follow x/y/w/h. + ``events={"codesdown": ["page 1"]}`` sets event code. + """ + t = _type(kind) + events = attrs.pop("events", {}) + comp = Component([Group("att", [Attr.encode(n, k, v) for n, k, v in t["att"]])] + + [Group(g, []) for g in t["events"]]) + comp.set("objname", objname) + comp.set("id", id_) + for k, v in attrs.items(): + comp.set(k, v) + _fix_ends(comp) + for g, lines in events.items(): + comp.set_event(g, lines) + return comp + + +def _fix_ends(c: Component) -> None: + names = {a.name for a in c.attrs()} + if {"x", "w", "endx"} <= names: + c.set("endx", c.get("x") + c.get("w") - 1) + if {"y", "h", "endy"} <= names: + c.set("endy", c.get("y") + c.get("h") - 1) + + +def add(page: Page, kind, objname: str | None = None, **attrs) -> Component: + """Append a new component to ``page`` with the next free id and a unique objname.""" + t = _type(kind) + used = {c.name for c in page.components} + if objname is None: + n = 0 + while "%s%d" % (t["prefix"], n) in used: + n += 1 + objname = "%s%d" % (t["prefix"], n) + elif objname in used: + raise ValueError("objname %r already used on page %r" % (objname, page.name)) + next_id = max((c.get("id") or 0) for c in page.components) + 1 if page.components else 0 + comp = make(kind, objname, next_id, **attrs) + page.components.append(comp) + return comp + + +def new_page(name: str, **attrs) -> Page: + """A page with only its page component (id 0). Defaults to a plain white background.""" + attrs.setdefault("sta", 1) # 1 = solid colour, 2 = picture + attrs.setdefault("bco", 0xFFFF) + return Page(name, [make(121, name, 0, **attrs)]) diff --git a/src/nxhmi/container.py b/src/nxhmi/container.py new file mode 100644 index 0000000..e70b65a --- /dev/null +++ b/src/nxhmi/container.py @@ -0,0 +1,172 @@ +"""The .HMI container: a small file system with a checksummed, duplicated file table. + +Layout (all offsets absolute, little-endian): + + 0x000000 file table: count(u32), count * 28-byte entries, then table checksum (u32) + 0x080000 exact backup copy of the file table (+ checksum) + 0x380000 u32 0xFFFFFFFF marker + 0x6FFFF8 b"ver21234" + 0x700000 entry data, packed back to back + +Entry (28 bytes): name[16] (NUL padded), start(u32), size(u32), deleted(u8), 3 more bytes +(not interpreted by us; kept as-is, written as 0 for new entries). A deleted entry also has +the first byte of its name set to 0 -- the Editor matches entries by name, so the flag alone +is not enough. +""" +from __future__ import annotations + +import struct +from dataclasses import dataclass, field + +from . import checksum + +TABLE_OFFSET = 0x000000 +BACKUP_TABLE_OFFSET = 0x080000 +MARKER_OFFSET = 0x380000 +VERSION_OFFSET = 0x6FFFF8 +VERSION_MAGIC = b"ver21234" +DATA_OFFSET = 0x700000 +ENTRY_SIZE = 28 +MAX_TABLE_BYTES = BACKUP_TABLE_OFFSET - TABLE_OFFSET - 4 + + +class HMIError(Exception): + pass + + +@dataclass +class Entry: + name: str + start: int + size: int + deleted: bool = False + extra: bytes = b"\0\0\0" # the 3 trailing entry bytes + raw_name: bytes = b"" # name exactly as stored (deleted entries are mangled) + + def pack(self) -> bytes: + nm = self.raw_name if self.raw_name else self.name.encode("latin-1") + nm = nm[:16].ljust(16, b"\0") + if self.deleted: + nm = b"\0" + nm[1:] + return nm + struct.pack(" "HMIFile": + with open(path, "rb") as f: + return cls.from_bytes(f.read()) + + @classmethod + def from_bytes(cls, data: bytes) -> "HMIFile": + raw = bytearray(data) + entries = cls._read_table(raw, TABLE_OFFSET) + if entries is None: + entries = cls._read_table(raw, BACKUP_TABLE_OFFSET) + if entries is None: + raise HMIError("both file tables are corrupt (checksum mismatch)") + return cls(raw, entries) + + @staticmethod + def _read_table(raw: bytes, base: int): + if len(raw) < base + 4: + return None + count, = struct.unpack_from(" MAX_TABLE_BYTES // ENTRY_SIZE or end + 4 > len(raw): + return None + stored, = struct.unpack_from(" list[Entry]: + return [e for e in self.entries if not e.deleted] + + def find(self, name: str) -> Entry | None: + for e in self.entries: + if not e.deleted and e.name == name: + return e + return None + + def read(self, name: str) -> bytes: + e = self.find(name) + if e is None: + raise KeyError(name) + return bytes(self.raw[e.start:e.start + e.size]) + + def names(self) -> list[str]: + return [e.name for e in self.live()] + + def table_ok(self) -> tuple[bool, bool]: + return (self._read_table(self.raw, TABLE_OFFSET) is not None, + self._read_table(self.raw, BACKUP_TABLE_OFFSET) is not None) + + # ------------------------------------------------------------------ writing + def write(self, name: str, data: bytes) -> None: + """Replace (or add) an entry the way the Editor does: append the data at the end of the + file, mark the old entry deleted, add a new entry. Call fix_checksums()/save() after.""" + old = self.find(name) + start = len(self.raw) + self.raw += data + if old is not None: + old.deleted = True + self.entries.append(Entry(name, start, len(data))) + + def delete(self, name: str) -> None: + e = self.find(name) + if e is None: + raise KeyError(name) + e.deleted = True + + def _table_bytes(self) -> bytes: + return struct.pack(" None: + tbl = self._table_bytes() + if len(tbl) > MAX_TABLE_BYTES: + raise HMIError("file table too large") + blob = tbl + struct.pack(" bytes: + self._store_tables() + return bytes(self.raw) + + def save(self, path) -> None: + with open(path, "wb") as f: + f.write(self.to_bytes()) + + def compacted(self) -> "HMIFile": + """A fresh file containing only the live entries, packed from DATA_OFFSET.""" + return build([(e.name, self.read(e.name)) for e in self.live()]) + + +def build(items: list[tuple[str, bytes]]) -> HMIFile: + """Create a new .HMI container from (name, data) pairs, in the given order.""" + raw = bytearray(DATA_OFFSET) + struct.pack_into(" {value: label}, valid for every component type unless overridden below +GENERAL = { + "vscope": {0: "local", 1: "global"}, + "sta": {0: "crop image", 1: "solid color", 2: "image"}, + "style": {0: "flat", 1: "border", 2: "3D_Down", 3: "3D_Up"}, + "xcen": {0: "left", 1: "center", 2: "right"}, + "ycen": {0: "up", 1: "center", 2: "down"}, + "isbr": {0: "false", 1: "true"}, + "pw": {0: "character", 1: "password"}, +} + +# component type -> attribute -> {value: label} +BY_TYPE = { + 121: {"sta": {0: "no background", 1: "solid color", 2: "image"}}, # page + 98: {"style": {0: "flat", 1: "border", 2: "3D_Down", 3: "3D_Up", 4: "3D_Auto"}}, # button + 53: {"style": {0: "flat", 1: "border", 2: "3D_Down", 3: "3D_Up", 4: "3D_Auto"}}, # dual-state button + 54: {"format": {0: "decimal", 1: "currency", 2: "hex"}}, # number + 59: {"format": {0: "decimal", 1: "currency", 2: "hex"}}, # xfloat + 55: {"dir": {0: "left to right", 1: "right to left", 2: "up to down", 3: "down to up"}, + "en": {0: "disable", 1: "enable"}}, # scrolling text + 51: {"en": {0: "disable", 1: "enable"}}, # timer + 52: {"sta": {0: "number", 1: "string"}}, # variable + 1: {"mode": {0: "horizontal", 1: "vertical"}, "psta": {0: "solid", 1: "image"}}, # slider + 106: {"sta": {0: "solid color", 1: "image"}, "dez": {0: "horizontal", 1: "vertical"}}, # progress bar + 0: {"dir": {0: "left to right", 1: "right to left", 2: "right align"}}, # waveform + 58: {"sta": {0: "none", 1: "has"}}, # qrcode (logo) +} + +COLOR_ATTRS = {"bco", "bco1", "bco2", "pco", "pco0", "pco1", "pco2", "pco3", "borderc", "gdc"} + + +def table(ctype: int | None, attr: str) -> dict | None: + if ctype is not None and attr in BY_TYPE.get(ctype, {}): + return BY_TYPE[ctype][attr] + return GENERAL.get(attr) + + +def rgb565_to_hex(v: int) -> str: + r, g, b = v >> 11, (v >> 5) & 63, v & 31 + return "#%02x%02x%02x" % (r << 3 | r >> 2, g << 2 | g >> 4, b << 3 | b >> 2) + + +def hex_to_rgb565(s: str) -> int: + s = s.lstrip("#") + r, g, b = int(s[0:2], 16), int(s[2:4], 16), int(s[4:6], 16) + return (r >> 3) << 11 | (g >> 2) << 5 | (b >> 3) + + +def to_label(ctype: int | None, attr: str, kind: str, value): + """int -> readable value (label / '#rrggbb'), or the value unchanged.""" + if kind not in ("u8", "u16", "u32"): + return value + if attr in COLOR_ATTRS and kind == "u16": + return rgb565_to_hex(value) + t = table(ctype, attr) + if t and value in t: + return t[value] + return value + + +def from_label(ctype: int | None, attr: str, kind: str, value): + """Inverse of to_label; accepts plain ints too.""" + if not isinstance(value, str) or kind not in ("u8", "u16", "u32"): + return value + if value.startswith("#") and len(value) == 7: + return hex_to_rgb565(value) + t = table(ctype, attr) + if t: + for k, v in t.items(): + if v.lower() == value.lower(): + return k + try: + return int(value, 0) + except ValueError: + raise ValueError("unknown value %r for attribute %r" % (value, attr)) diff --git a/src/nxhmi/fonts.py b/src/nxhmi/fonts.py new file mode 100644 index 0000000..28b6888 --- /dev/null +++ b/src/nxhmi/fonts.py @@ -0,0 +1,213 @@ +"""Nextion fonts (``N.zi`` entries), file format version 6, black/white glyphs. + +Header (44 bytes, little-endian):: + + 0 4 magic 04 FF 00 0B (byte 3: 0x0B -- 0x0A "vertical" in older docs; OPEN) + 4 2 encoding (1 ascii, 3 iso-8859-1, ...) + 6 1 character width (fixed-width fonts; per-glyph width in the map) + 7 1 character height + 8 1 multi-byte first-byte start 9 1 ... end + 10 1 code range start 11 1 code range end + 12 4 character count + 16 1 format version (6) + 17 1 name length + 18 1 name length (again) + 19 1 0 + 20 4 length of name + map + glyph data + 24 4 start of name (0x2C) + 28 16 unknown (kept as-is) + 44 . name, then character map, then glyph data + +Character map: ``count`` entries of 10 bytes:: + + 0 2 character code 2 1 glyph width 3 1 ? 4 1 ? + 5 3 glyph data offset (relative to the start of the map) + 8 2 glyph data length + +Glyph data: one mode byte (0x01 = black/white), then run-length codes. Pixels are scanned +column by column (x = 0..w-1), each column from the bottom row up -- the same 90-degree panel +rotation as pictures. Codes (top two bits = op):: + + 00 0xxxxx x transparent 00 1xxxxx x ink + 01 0xxxxx x transparent + 1 ink 01 1xxxxx x transparent + 2 ink + 10 0xxxxx x transparent + 3 ink 10 1xxxxx x transparent + 4 ink + 11 tttiii ttt transparent + iii ink + +Runs continue across column boundaries. +""" +from __future__ import annotations + +import struct +from dataclasses import dataclass, field + +HEADER_SIZE = 0x2C +MAP_ENTRY = 10 + + +@dataclass +class Glyph: + code: int + width: int + pixels: list # rows top->bottom of 0/1 (len = height, each len = width) + map_extra: bytes = b"\0\0" # map bytes 3..4 + mode: int = 1 + + +@dataclass +class Font: + name: str + width: int + height: int + encoding: int + first: int + last: int + glyphs: list = field(default_factory=list) + header: bytes = b"" # original 44-byte header, for fields not modelled + + # ------------------------------------------------------------------ decode + @classmethod + def parse(cls, blob: bytes) -> "Font": + if blob[:3] != b"\x04\xff\x00": + raise ValueError("not a .zi font") + if blob[16] != 6: + raise ValueError("unsupported .zi version %d (only 6 is implemented)" % blob[16]) + w, h = blob[6], blob[7] + count, = struct.unpack_from(" bytes: + name = self.name.encode("latin-1") + bodies = [bytes([g.mode]) + encode_glyph(g.pixels, g.width, self.height) for g in self.glyphs] + mp = bytearray() + off = MAP_ENTRY * len(self.glyphs) + for g, b in zip(self.glyphs, bodies): + mp += struct.pack("> 8) & 0xFF, off >> 16]) + struct.pack(" Glyph | None: + code = ord(ch) if isinstance(ch, str) else ch + for g in self.glyphs: + if g.code == code: + return g + return None + + +def _scan_order(w: int, h: int): + for x in range(w): + for y in range(h - 1, -1, -1): + yield x, y + + +def decode_glyph(data: bytes, w: int, h: int) -> list: + stream = [] + for b in data[1:]: + op, bit, x = b >> 6, (b >> 5) & 1, b & 0x1F + if op == 0: + stream += [bit] * x + elif op == 3: + stream += [0] * ((b >> 3) & 7) + [1] * (b & 7) + else: + stream += [0] * x + [1] * (op * 2 - 1 + bit) + rows = [[0] * w for _ in range(h)] + for v, (x, y) in zip(stream, _scan_order(w, h)): + rows[y][x] = v + return rows + + +def encode_glyph(rows: list, w: int, h: int) -> bytes: + """Run-length encode a glyph (rows top->bottom). Greedy, see docs for the code table.""" + s = [rows[y][x] for x, y in _scan_order(w, h)] + out = bytearray() + i, n = 0, len(s) + while i < n: + t = 0 + while i + t < n and s[i + t] == 0: + t += 1 + k = 0 + while i + t + k < n and s[i + t + k] == 1: + k += 1 + if t == 0: # ink run + run = min(k, 31) + out.append(0x20 | run); i += run; continue + if k == 0: # transparent up to end + run = min(t, 31) + out.append(run); i += run; continue + # The Editor's choice (reproduces its output byte for byte): "x transparent + 1..4 ink" when + # it fits, else "ttt transparent + iii ink", else a plain transparent run. + if t <= 31 and 1 <= k <= 4: + op, bit = (k + 1) // 2, (k + 1) % 2 + out.append(op << 6 | bit << 5 | t); i += t + k; continue + if t <= 7 and k <= 7: + out.append(0xC0 | t << 3 | k); i += t + k; continue + run = min(t, 31) + out.append(run); i += run + return bytes(out) + + +ENCODINGS = {"ascii": (1, 0x20, 0x7E), "iso-8859-1": (3, 0x20, 0xFF)} + + +def from_ttf(path: str | None, height: int, encoding: str = "ascii", fixed_width: int | None = None, + name: str | None = None, threshold: int = 128) -> "Font": + """Rasterize a TrueType/OpenType font into a black/white Nextion font (needs Pillow). + + ``path=None`` uses Pillow's bundled default font (Aileron Regular, CC0) -- handy for tests and + demos. The font size is chosen so ascent + descent fills ``height`` pixels. Glyph widths follow + the font's advance widths unless ``fixed_width`` is given. + """ + import os + from PIL import Image, ImageDraw, ImageFont + enc, first, last = ENCODINGS[encoding] + def load(size): + return ImageFont.load_default(size=size) if path is None else ImageFont.truetype(path, size) + + size = height + while size > 4: + f = load(size) + a, d = f.getmetrics() + if a + d <= height: + break + size -= 1 + ascent, descent = f.getmetrics() + top = (height - ascent - descent) // 2 + glyphs = [] + for code in range(first, last + 1): + ch = bytes([code]).decode("latin-1") + adv = fixed_width or max(1, int(round(f.getlength(ch)))) + img = Image.new("L", (adv, height), 0) + ImageDraw.Draw(img).text((0, top), ch, font=f, fill=255) + px = img.load() + rows = [[1 if px[x, y] >= threshold else 0 for x in range(adv)] for y in range(height)] + glyphs.append(Glyph(code, adv, rows)) + width = fixed_width or max(g.width for g in glyphs) + stem = "Aileron" if path is None else os.path.splitext(os.path.basename(path))[0] + base = name or "%s-%d%s" % (stem, height, encoding) + hdr = bytearray(HEADER_SIZE) + hdr[0:4] = b"\x04\xff\x00\x0b" + hdr[0x1C] = last + hdr[0x20] = 0x0B + struct.pack_into("-"`` is followed by n records. +Group ``att`` holds attributes (16-byte NUL padded name + value); the other groups +(``codesload``, ``codesdown``, ``codesup``, ``codestimer``, ...) hold event code lines. +""" +from __future__ import annotations + +import struct +from dataclasses import dataclass, field + +from . import checksum + +HEADER_SIZE = 56 +TABLE_ENTRY = 12 + +# Text attributes: objname, plus every attribute that has a length-limit companion in the same +# component (txt/txt_maxl, path/path_m, dir/dir_m, filter/filter_m, format/format_m, ...). +# The same name can be text in one component and a number in another (e.g. `dir`, `format`). +# Everything else is an unsigned little-endian integer of 1, 2 or 4 bytes. +ALWAYS_STRING = {"objname"} + + +def _string_names(names) -> set: + names = set(names) + return {n for n in names if n in ALWAYS_STRING or n + "_m" in names or n + "_maxl" in names} + + +@dataclass +class Attr: + name: str + value: bytes + string: bool = False + + def decoded(self, encoding: str = "latin-1"): + if self.string: + return ("str", self.value.decode(encoding)) + n = len(self.value) + if n in (1, 2, 4): + return ({1: "u8", 2: "u16", 4: "u32"}[n], int.from_bytes(self.value, "little")) + return ("hex", self.value.hex()) + + @staticmethod + def encode(name: str, kind: str, value, encoding: str = "latin-1") -> "Attr": + if kind == "str": + return Attr(name, value.encode(encoding), True) + if kind in ("u8", "u16", "u32"): + n = {"u8": 1, "u16": 2, "u32": 4}[kind] + v = int(value) + if v < 0: # signed values (e.g. number.val) are stored two's complement + v &= (1 << (8 * n)) - 1 + return Attr(name, v.to_bytes(n, "little")) + if kind == "hex": + return Attr(name, bytes.fromhex(value)) + raise ValueError(kind) + + def pack(self) -> bytes: + return self.name.encode("latin-1")[:16].ljust(16, b"\0") + self.value + + +@dataclass +class Group: + name: str # "att", "codesdown", ... + records: list # list[Attr] for "att", list[bytes] for code groups + + +@dataclass +class Component: + groups: list[Group] = field(default_factory=list) + table_extra: int = 0 # third u32 of the component-table entry + trailing: bytes = b"" # bytes after the terminating empty record (normally none) + + # --- convenience ------------------------------------------------------ + def attrs(self) -> list[Attr]: + for g in self.groups: + if g.name == "att": + return g.records + return [] + + def attr(self, name: str) -> Attr | None: + for a in self.attrs(): + if a.name == name: + return a + return None + + def get(self, name: str, encoding: str = "latin-1"): + a = self.attr(name) + return None if a is None else a.decoded(encoding)[1] + + def set(self, name: str, value, encoding: str = "latin-1") -> None: + a = self.attr(name) + if a is None: + raise KeyError(name) + kind, _ = a.decoded(encoding) + if kind == "hex" and not isinstance(value, (bytes, str)): + raise ValueError("raw attribute; pass hex string") + a.value = Attr.encode(name, kind, value, encoding).value + + def event(self, group: str) -> list[str] | None: + for g in self.groups: + if g.name == group: + return [r.decode("latin-1") for r in g.records] + return None + + def set_event(self, group: str, lines: list[str]) -> None: + for g in self.groups: + if g.name == group: + g.records = [ln.encode("latin-1") for ln in lines] + return + self.groups.append(Group(group, [ln.encode("latin-1") for ln in lines])) + + @property + def name(self) -> str: + return self.get("objname") or "" + + # --- (de)serialization ------------------------------------------------- + @classmethod + def parse(cls, data: bytes, table_extra: int = 0) -> "Component": + recs = [] + p = 0 + while p < len(data): + n, = struct.unpack_from(" bytes: + out = bytearray() + + def rec(b: bytes): + out.extend(struct.pack(" "Page": + if len(blob) < HEADER_SIZE: + raise ValueError("page too short") + crc, datasize, infoaddr, nobj, password = struct.unpack_from(" bytes: + bodies = [c.pack() for c in self.components] + table = bytearray() + off = TABLE_ENTRY * len(bodies) + for c, b in zip(self.components, bodies): + table += struct.pack(" Component | None: + for c in self.components: + if c.name == objname: + return c + return None diff --git a/src/nxhmi/pictures.py b/src/nxhmi/pictures.py new file mode 100644 index 0000000..75e5909 --- /dev/null +++ b/src/nxhmi/pictures.py @@ -0,0 +1,102 @@ +"""Pictures: ``N.i`` (what the display uses) and ``N.is`` (the original source file). + +``N.is`` header (27 bytes) + the original image file, unchanged:: + + 0 4 0A 64 01 01 + 4 4 0 + 8 4 27 (data offset) + 12 2 width 14 2 height + 16 4 length of the embedded file + 20 4 0 + 24 3 file type, e.g. b"png" + 27 . the file + +``N.i`` header (24 bytes) + pixels:: + + 0 4 0B 64 01 format 0 = raw RGB565 (Basic series), 4 = compressed (Intelligent; OPEN) + 4 4 0 + 8 4 24 (data offset) + 12 2 width 14 2 height + 16 4 data length (format 0: width * height * 2) + 20 4 0 + +Format 0 pixels are RGB565 little-endian, converted by plain truncation (r>>3, g>>2, b>>3) and +stored in the panel's native order: rotated 90 degrees, i.e. for each source column x, the rows +from bottom to top -- byte offset 2 * (x * height + (height - 1 - y)). Verified pixel-exact against +Editor output for a 480x320 and a 64x64 picture on a project with display direction 270 (OPEN: +other directions, main.HMI byte 13). + +Pillow is only needed for converting to/from image files. +""" +from __future__ import annotations + +import io +import struct + +IS_MAGIC = b"\x0a\x64\x01\x01" +I_MAGIC = b"\x0b\x64\x01" + + +def source_info(blob: bytes) -> dict: + w, h, n = struct.unpack_from(" bytes: + """The original image file embedded in an ``N.is`` entry.""" + off, = struct.unpack_from(" bytes: + hdr = IS_MAGIC + struct.pack(" dict: + w, h, n = struct.unpack_from(" bytes: + """pixels_rgb: callable (x, y) -> (r, g, b).""" + out = bytearray(width * height * 2) + for x in range(width): + for y in range(height): + r, g, b = pixels_rgb(x, y)[:3] + v = (r >> 3) << 11 | (g >> 2) << 5 | (b >> 3) + struct.pack_into(" bytes: + return I_MAGIC + b"\x00" + struct.pack(" (N.i blob, N.is blob). Needs Pillow.""" + from PIL import Image + img = Image.open(io.BytesIO(data)) + ftype = (img.format or "png").lower()[:3] + rgb = img.convert("RGB") + px = rgb.load() + w, h = rgb.size + return make_picture(to_rgb565(lambda x, y: px[x, y], w, h), w, h), make_source(data, w, h, ftype) + + +def to_image(blob: bytes): + """Decode a format-0 ``N.i`` to a Pillow image.""" + from PIL import Image + d = info(blob) + if d["format"] != 0: + raise NotImplementedError("picture format %d (Intelligent compressed) not supported yet" % d["format"]) + w, h = d["width"], d["height"] + img = Image.new("RGB", (w, h)) + px = img.load() + for x in range(w): + for y in range(h): + v, = struct.unpack_from("> 11, (v >> 5) & 63, v & 31 + px[x, y] = (r << 3 | r >> 2, g << 2 | g >> 4, b << 3 | b >> 2) + return img diff --git a/src/nxhmi/project.py b/src/nxhmi/project.py new file mode 100644 index 0000000..32c1e4d --- /dev/null +++ b/src/nxhmi/project.py @@ -0,0 +1,306 @@ +"""Decode a .HMI into a readable, diffable folder -- and encode such a folder back. + +Folder layout:: + + manifest.json entry order, model info, which file holds what + Program.s the project's start-up script (plain text) + main.HMI.json the project header, parsed where understood (+ raw hex) + pages/_.json one file per page: header fields + components + resources/ every other entry (pictures, fonts, ...) as raw bytes + +Page JSON:: + + {"file": "1.pa", "name": "main", "password": 0, "locked": 0, ..., + "components": [ + {"att": [["type", "u8", 121], ["objname", "str", "main"], ...], + "events": {"codesdown": ["page 2"], ...}, + "order": ["att", "codesload", ...]} # group order, for exact round trips + ]} +""" +from __future__ import annotations + +import json +import os +import struct + +from . import checksum, enums +from .container import HMIFile, build +from .page import Attr, Component, Group, Page + +MODELS = { + # model id (main.HMI offset 16) -> (part number, description). Values observed or taken + # from public lists of Nextion models; extend as needed. + 0xB23BC018: ("NX4832T035_011", 'Nextion 3.5" Basic 480x320'), +} + + +def _safe(name: str) -> str: + return "".join(ch if ch.isalnum() or ch in "-_." else "_" for ch in name) + + +def parse_main(blob: bytes) -> dict: + d = {"crc_ok": checksum.main_crc(blob) == struct.unpack_from(" dict: + out = {"order": [g.name for g in c.groups]} + events = {} + ctype = c.get("type") + for g in c.groups: + if g.name == "att": + out["att"] = [] + for a in g.records: + kind, value = a.decoded(encoding) + if readable: + value = enums.to_label(ctype, a.name, kind, value) + out["att"].append([a.name, kind, value]) + else: + events[g.name] = [r.decode(encoding) for r in g.records] + out["events"] = events + if c.table_extra: + out["table_extra"] = c.table_extra + if c.trailing: + out["trailing_hex"] = c.trailing.hex() + return out + + +def component_from_json(d: dict, encoding: str) -> Component: + groups = [] + ctype = next((v for n, k, v in d.get("att", []) if n == "type"), None) + for gname in d.get("order", ["att"] + list(d.get("events", {}))): + if gname == "att": + groups.append(Group("att", [Attr.encode(n, k, enums.from_label(ctype, n, k, v), encoding) + for n, k, v in d["att"]])) + else: + groups.append(Group(gname, [ln.encode(encoding) for ln in d["events"][gname]])) + return Component(groups, d.get("table_extra", 0), bytes.fromhex(d.get("trailing_hex", ""))) + + +def page_to_json(entry_name: str, p: Page, encoding: str, readable: bool = True) -> dict: + return {"file": entry_name, "name": p.name, "password": p.password, "locked": p.locked, + "b21": p.b21, "version": p.version, "b23": p.b23, "reserved_hex": p.reserved.hex(), + "components": [component_to_json(c, encoding, readable) for c in p.components]} + + +def page_from_json(d: dict, encoding: str) -> Page: + return Page(d["name"], [component_from_json(c, encoding) for c in d["components"]], + d.get("password", 0), d.get("locked", 0), d.get("b21", 0x4F), d.get("version", 0x21), + d.get("b23", 0), bytes.fromhex(d.get("reserved_hex", "00" * 16))) + + +def decode(hmi_path: str, out_dir: str, encoding: str = "latin-1", readable: bool = True) -> dict: + h = HMIFile.load(hmi_path) + os.makedirs(os.path.join(out_dir, "pages"), exist_ok=True) + os.makedirs(os.path.join(out_dir, "resources"), exist_ok=True) + manifest = {"format": "nxhmi-folder-1", "encoding": encoding, "entries": []} + for e in h.live(): + blob = h.read(e.name) + item = {"name": e.name} + if e.name.endswith(".pa"): + p = Page.parse(blob) + fn = "pages/%s_%s.json" % (_safe(e.name[:-3]), _safe(p.name)) + with open(os.path.join(out_dir, fn), "w", encoding="utf-8") as f: + json.dump(page_to_json(e.name, p, encoding, readable), f, indent=1, ensure_ascii=False) + item["page"] = fn + elif e.name == "Program.s": + with open(os.path.join(out_dir, "Program.s"), "wb") as f: + f.write(blob) + item["file"] = "Program.s" + elif e.name == "main.HMI": + info = parse_main(blob) + with open(os.path.join(out_dir, "main.HMI.json"), "w", encoding="utf-8") as f: + json.dump(info, f, indent=1) + item["main"] = "main.HMI.json" + manifest["model"] = info.get("model", info["model_id"]) + else: + fn = "resources/" + _safe(e.name) + with open(os.path.join(out_dir, fn), "wb") as f: + f.write(blob) + item["file"] = fn + _write_preview(out_dir, e.name, blob) + manifest["entries"].append(item) + with open(os.path.join(out_dir, "manifest.json"), "w", encoding="utf-8") as f: + json.dump(manifest, f, indent=1) + return manifest + + +def encode(folder: str, hmi_path: str) -> None: + with open(os.path.join(folder, "manifest.json"), encoding="utf-8") as f: + manifest = json.load(f) + enc = manifest.get("encoding", "latin-1") + items = [] + for it in manifest["entries"]: + if "page" in it: + with open(os.path.join(folder, it["page"]), encoding="utf-8") as f: + items.append((it["name"], page_from_json(json.load(f), enc).pack())) + elif "main" in it: + with open(os.path.join(folder, it["main"]), encoding="utf-8") as f: + blob = bytearray(bytes.fromhex(json.load(f)["raw_hex"])) + struct.pack_into(" bytes: + """Return main.HMI with one more resource-list entry (e.g. "pa", "6.pa") and a new checksum.""" + start, = struct.unpack_from(" Page: + """Add a new empty page to an opened project (next free N.pa) and register it in main.HMI.""" + from .components import new_page + used = {Page.parse(h.read(e.name)).name for e in h.live() if e.name.endswith(".pa")} + if name in used: + raise ValueError("page %r exists" % name) + n = 0 + while h.find("%d.pa" % n): + n += 1 + p = new_page(name, **attrs) + h.write("%d.pa" % n, p.pack()) + h.write("main.HMI", main_add_resource(h.read("main.HMI"), "pa", "%d.pa" % n)) + return p + + +def main_insert_resource(main: bytes, rtype: str, name: str) -> bytes: + """Like main_add_resource, but keeps entries grouped by type (the Editor lists i, zi, pa).""" + start, = struct.unpack_from(" int: + """Add a picture (png/jpg/bmp bytes) to the project; returns its picture id. Basic series only.""" + from . import pictures + n = 0 + while h.find("%d.i" % n): + n += 1 + pic, src = pictures.from_image_file(image_file) + h.write("%d.is" % n, src) + h.write("%d.i" % n, pic) + h.write("main.HMI", main_insert_resource(h.read("main.HMI"), "i", "%d.i" % n)) + return n + + +def _write_preview(out_dir: str, name: str, blob: bytes) -> None: + """Human-readable companions of binary resources (never read back by encode).""" + from . import fonts, pictures + try: + if name.endswith(".is"): + info = pictures.source_info(blob) + with open(os.path.join(out_dir, "resources", _safe(name) + "." + (info["type"] or "bin")), "wb") as f: + f.write(pictures.source_file(blob)) + elif name.endswith(".zi"): + font = fonts.Font.parse(blob) + lines = ["font %r %dx%d encoding %d chars 0x%02X-0x%02X" % (font.name, font.width, font.height, + font.encoding, font.first, font.last)] + for g in font.glyphs: + lines.append("") + lines.append("char 0x%02X %r width %d" % (g.code, chr(g.code), g.width)) + lines += ["".join("#" if v else "." for v in row) for row in g.pixels] + with open(os.path.join(out_dir, "resources", _safe(name) + ".txt"), "w", encoding="utf-8") as f: + f.write("\n".join(lines) + "\n") + except (ValueError, NotImplementedError, struct.error): + pass + + +def add_font(h: HMIFile, font) -> int: + """Add a fonts.Font to the project; returns its font id.""" + n = 0 + while h.find("%d.zi" % n): + n += 1 + h.write("%d.zi" % n, font.pack()) + h.write("main.HMI", main_insert_resource(h.read("main.HMI"), "zi", "%d.zi" % n)) + return n + + +DEFAULT_PROGRAM = ( + "//Program.s runs once at power-on, before the first page is shown.\r\n" + "//Global variables can be declared here: int sys0=0\r\n" + "baud=115200\r\n" + "page 0\r\n" +) + + +def make_main(model: str, resources: list, encoding: str = "iso-8859-1") -> bytes: + """Build a main.HMI project header from scratch. + + Field values follow Nextion Editor 1.68 output (see docs/FORMAT.md); ``resources`` is a list of + (type, name) such as ("pa", "0.pa"). + """ + from . import models + mid, series, _, _ = models.lookup(model) + b = bytearray(0x60) + struct.pack_into(" HMIFile: + """A new, empty project with one page -- no Nextion files needed.""" + from . import models + from .components import new_page + _, _, w, h = models.lookup(model) + page = new_page(first_page, w=w, h=h) + items = [("main.HMI", make_main(model, [("pa", "0.pa")])), + ("Program.s", program.encode("latin-1")), + ("0.pa", page.pack())] + return build(items) + + +def project_size(h: HMIFile): + """(width, height) of the project's display, from main.HMI.""" + from . import models + mid = struct.unpack_from("> 11, (v >> 5) & 63, v & 31 + return (r << 3 | r >> 2, g << 2 | g >> 4, b << 3 | b >> 2) + + +class Renderer: + def __init__(self, hmi: HMIFile): + from PIL import Image # noqa: F401 (fail early if Pillow is missing) + self.h = hmi + self._pics = {} + self._fonts = {} + self.pages = {} + for e in hmi.live(): + if e.name.endswith(".pa"): + p = Page.parse(hmi.read(e.name)) + self.pages[p.name] = p + self.pages[int(e.name[:-3])] = p + + # ------------------------------------------------------------------ resources + def pic(self, n: int): + if n not in self._pics: + try: + self._pics[n] = pictures.to_image(self.h.read("%d.i" % n)) + except (KeyError, NotImplementedError): + self._pics[n] = None + return self._pics[n] + + def font(self, n: int): + if n not in self._fonts: + try: + self._fonts[n] = Font.parse(self.h.read("%d.zi" % n)) + except (KeyError, ValueError): + self._fonts[n] = None + return self._fonts[n] + + # ------------------------------------------------------------------ page + def render(self, page) -> "Image": + from PIL import Image + p = self.pages[page] + pc = p.components[0] + w, h = pc.get("w") or 480, pc.get("h") or 320 + img = Image.new("RGB", (w, h), (255, 255, 255)) + sta = pc.get("sta") + if sta == 1: + img.paste(rgb(pc.get("bco")), (0, 0, w, h)) + elif sta == 2: + pic = self.pic(pc.get("pic")) + if pic: + self._paste(img, pic, 0, 0, w, h, 0, 0) + for c in p.components[1:]: + self.draw(img, c) + return img + + # ------------------------------------------------------------------ components + def draw(self, img, c: Component): + t = c.get("type") + fn = {116: self.text, 55: self.text, 98: self.text, 53: self.dual, 54: self.number, 59: self.xfloat, + 112: self.picture, 113: self.crop, 1: self.slider, 106: self.progress, 56: self.checkbox, + 57: self.radio, 122: self.gauge, 0: self.waveform, 58: self.qrcode}.get(t) + if fn: + fn(img, c) + + @staticmethod + def _paste(img, src, sx, sy, w, h, dx, dy): + """Paste src[sx:sx+w, sy:sy+h] at (dx, dy), clipped to src's real size (no black padding).""" + w = min(w, src.width - sx) + h = min(h, src.height - sy) + if w > 0 and h > 0: + img.paste(src.crop((sx, sy, sx + w, sy + h)), (dx, dy)) + + def _box(self, c): + x, y, w, h = c.get("x"), c.get("y"), c.get("w"), c.get("h") + return x, y, w, h + + def _background(self, img, c, x, y, w, h): + sta = c.get("sta") + if sta == 0: # crop image: same area of picture picc + src = self.pic(c.get("picc")) + if src: + self._paste(img, src, x, y, w, h, x, y) + elif sta == 1: + img.paste(rgb(c.get("bco")), (x, y, x + w, y + h)) + elif sta == 2: + src = self.pic(c.get("pic")) + if src: + self._paste(img, src, 0, 0, w, h, x, y) + + def _border(self, img, c, x, y, w, h, override=None): + from PIL import ImageDraw + d = ImageDraw.Draw(img) + style = c.get("style") if override is None else override + if c.get("sta") in (0, 2) and c.get("type") in (98, 53): + return # picture-skinned buttons have no frame + if style == 1: # border + bw, bc = c.get("borderw") or 0, rgb(c.get("borderc") or 0) + for i in range(bw): + d.rectangle((x + i, y + i, x + w - 1 - i, y + h - 1 - i), outline=bc) + elif style in (2, 3, 4): # 3D down / up / auto(=up when released) + light, dark = (230, 226, 230), (65, 68, 65) # measured in Editor 1.68 + if style == 2: + light, dark = dark, light + d.line((x, y, x + w - 1, y), fill=light); d.line((x, y, x, y + h - 1), fill=light) + d.line((x, y + h - 1, x + w - 1, y + h - 1), fill=dark); d.line((x + w - 1, y, x + w - 1, y + h - 1), fill=dark) + + def _text(self, img, c, s, x, y, w, h, color): + font = self.font(c.get("font") or 0) + if font is None or not s: + return + spax, spay = c.get("spax") or 0, c.get("spay") or 0 + xcen, ycen = c.get("xcen"), c.get("ycen") + wrap = c.get("isbr") + glyphs = {g.code: g for g in font.glyphs} + + def gw(ch): + g = glyphs.get(ord(ch)) + return (g.width if g else font.width) + spax + + lines = [] + for para in s.replace("\r\n", "\n").split("\n"): + cur = "" + for ch in para: + if wrap and cur and sum(gw(k) for k in cur + ch) - spax > w: + lines.append(cur); cur = "" + cur += ch + lines.append(cur) + line_h = font.height + spay + total_h = len(lines) * line_h - spay + if ycen == 1: + ty = y + max(0, (h - total_h) // 2) # never starts above the box + elif ycen == 2: + ty = y + max(0, h - total_h) + else: + ty = y + px = img.load() + W, H = img.size + # the Editor aligns the text *block* (widest line); lines are left-aligned inside it + block_w = max((sum(gw(k) for k in ln) - (spax if ln else 0)) for ln in lines) + for ln in lines: + lw = block_w + if xcen == 1: + tx = x + max(0, (w - lw) // 2) + elif xcen == 2: + tx = x + max(0, w - lw) + else: + tx = x + for ch in ln: + g = glyphs.get(ord(ch)) + if g: + for gy, row in enumerate(g.pixels): + yy = ty + gy + if yy < y or yy >= y + h or yy >= H: + continue + for gx, v in enumerate(row): + xx = tx + gx + if v and x <= xx < x + w and 0 <= xx < W and yy >= 0: + px[xx, yy] = color + tx += gw(ch) + ty += line_h + + def dual(self, img, c): + """Dual-state button: val=1 shows the second skin (bco2 / pic2 / picc2) and pco2.""" + x, y, w, h = self._box(c) + on = bool(c.get("val")) + sta = c.get("sta") + if sta == 1: + img.paste(rgb((c.get("bco2") if on else c.get("bco")) or 0), (x, y, x + w, y + h)) + elif sta == 2: + src = self.pic(c.get("pic2") if on else c.get("pic")) + if src: + self._paste(img, src, 0, 0, w, h, x, y) + elif sta == 0: + src = self.pic(c.get("picc2") if on else c.get("picc")) + if src: + self._paste(img, src, x, y, w, h, x, y) + if on and c.get("style") == 4 and sta == 1: + self._border(img, c, x, y, w, h, override=2) # "on" looks pressed: 3D down + else: + self._border(img, c, x, y, w, h) + self._text(img, c, c.get("txt") or "", *self._inner(c, x, y, w, h), + rgb((c.get("pco2") if on else c.get("pco")) or 0)) + + def _inner(self, c, x, y, w, h): + """Text area inside the border.""" + style = c.get("style") + b = (c.get("borderw") or 0) if style == 1 else (1 if style in (2, 3, 4) else 0) + return x + b, y + b, w - 2 * b, h - 2 * b + + def text(self, img, c): + x, y, w, h = self._box(c) + self._background(img, c, x, y, w, h) + self._border(img, c, x, y, w, h) + self._text(img, c, c.get("txt") or "", *self._inner(c, x, y, w, h), rgb(c.get("pco") or 0)) + + def number(self, img, c): + v = c.get("val") or 0 + if v >= 0x80000000: + v -= 1 << 32 + fmt, length = c.get("format"), c.get("lenth") or 0 + s = ("%X" % (v & 0xFFFFFFFF)) if fmt == 2 else ("{:,}".format(v) if fmt == 1 else str(v)) + if length and fmt != 1: + s = s.zfill(length)[-length:] + x, y, w, h = self._box(c) + self._background(img, c, x, y, w, h) + self._border(img, c, x, y, w, h) + self._text(img, c, s, *self._inner(c, x, y, w, h), rgb(c.get("pco") or 0)) + + def xfloat(self, img, c): + v = c.get("val") or 0 + if v >= 0x80000000: + v -= 1 << 32 + ints, decs = c.get("vvs0") or 0, c.get("vvs1") or 0 + s = str(abs(v)).zfill(decs + 1) + s = (s[:-decs] + "." + s[-decs:]) if decs else s + if ints: + ip, _, dp = s.partition(".") + s = ip.zfill(ints)[-ints:] + ("." + dp if dp else "") + s = ("-" if v < 0 else "") + s + x, y, w, h = self._box(c) + self._background(img, c, x, y, w, h) + self._border(img, c, x, y, w, h) + self._text(img, c, s, *self._inner(c, x, y, w, h), rgb(c.get("pco") or 0)) + + def picture(self, img, c): + src = self.pic(c.get("pic")) + if src: + x, y, w, h = self._box(c) + self._paste(img, src, 0, 0, w, h, x, y) + + def crop(self, img, c): + src = self.pic(c.get("picc")) + if src: + x, y, w, h = self._box(c) + self._paste(img, src, x, y, w, h, x, y) + + def slider(self, img, c): + from PIL import ImageDraw + x, y, w, h = self._box(c) + self._background(img, c, x, y, w, h) + d = ImageDraw.Draw(img) + vmin, vmax, val = c.get("minval") or 0, c.get("maxval") or 100, c.get("val") or 0 + frac = 0 if vmax == vmin else (val - vmin) / (vmax - vmin) + vertical = c.get("mode") == 1 + cw = c.get("wid"); ch = c.get("hig") + if c.get("psta") == 1: # picture cursor (pic2) at its own size + knob = self.pic(c.get("pic2")) + if knob: + kw, kh = knob.size + if vertical: + ky = y + h - kh - int(frac * (h - kh)) + img.paste(knob, (x + (w - kw) // 2, ky)) + else: + kx = x + int(frac * (w - kw)) + img.paste(knob, (kx, y + (h - kh) // 2)) + return + # "auto" (255) cursor = a square as thick as the slider + if vertical: + cw = w if cw in (None, 255) else cw + ch = w if ch in (None, 255) else ch + cy = y + h - ch - int(frac * (h - ch)) # truncates, like the Editor + d.rectangle((x + (w - cw) // 2, cy, x + (w - cw) // 2 + cw - 1, cy + ch - 1), fill=rgb(c.get("pco") or 0)) + else: + ch = h if ch in (None, 255) else ch + cw = h if cw in (None, 255) else cw + cx = x + int(frac * (w - cw)) # truncates, like the Editor + d.rectangle((cx, y + (h - ch) // 2, cx + cw - 1, y + (h - ch) // 2 + ch - 1), fill=rgb(c.get("pco") or 0)) + + def progress(self, img, c): + from PIL import ImageDraw + x, y, w, h = self._box(c) + d = ImageDraw.Draw(img) + val = max(0, min(100, c.get("val") or 0)) + if c.get("sta") == 1: # picture mode: bpic background, ppic foreground + bg, fg = self.pic(c.get("bpic")), self.pic(c.get("ppic")) + if bg: + self._paste(img, bg, 0, 0, w, h, x, y) + if fg: + if c.get("dez") == 1: + fh = h * val // 100 + if fh: + self._paste(img, fg, 0, h - fh, w, fh, x, y + h - fh) + else: + fw = w * val // 100 + if fw: + self._paste(img, fg, 0, 0, fw, h, x, y) + return + d.rectangle((x, y, x + w - 1, y + h - 1), fill=rgb(c.get("bco") or 0)) + if c.get("dez") == 1: + fh = h * val // 100 + if fh: + d.rectangle((x, y + h - fh, x + w - 1, y + h - 1), fill=rgb(c.get("pco") or 0)) + else: + fw = w * val // 100 + if fw: + d.rectangle((x, y, x + fw - 1, y + h - 1), fill=rgb(c.get("pco") or 0)) + + def checkbox(self, img, c): + from PIL import ImageDraw + x, y, w, h = self._box(c) + d = ImageDraw.Draw(img) + d.rectangle((x, y, x + w - 1, y + h - 1), fill=rgb(c.get("bco") or 0)) + self._border(img, c, x, y, w, h) + if c.get("val"): # filled square, half the size, centred + d.rectangle((x + w // 4, y + h // 4, x + 3 * w // 4 - 1, y + 3 * h // 4 - 1), fill=rgb(c.get("pco") or 0)) + + def radio(self, img, c): + from PIL import ImageDraw + x, y, w, h = self._box(c) + d = ImageDraw.Draw(img) + d.ellipse((x, y, x + w - 2, y + h - 2), fill=rgb(c.get("bco") or 0), outline=(65, 68, 65)) + if c.get("val"): + d.ellipse((x + w // 4, y + h // 4, x + 3 * w // 4 - 2, y + 3 * h // 4 - 2), fill=rgb(c.get("pco") or 0)) + + def gauge(self, img, c): + from PIL import ImageDraw + x, y, w, h = self._box(c) + self._background(img, c, x, y, w, h) + d = ImageDraw.Draw(img) + r = min(w, h) // 2 - 1 + cx, cy = x + w // 2, y + h // 2 + a = math.radians(c.get("val") or 0) + d.line((cx, cy, cx - int(r * math.cos(a)), cy - int(r * math.sin(a))), fill=rgb(c.get("pco") or 0), + width=max(1, c.get("wid") or 1)) + + def waveform(self, img, c): + from PIL import ImageDraw + x, y, w, h = self._box(c) + self._background(img, c, x, y, w, h) + d = ImageDraw.Draw(img) + gw, gh, gc = c.get("gdw") or 0, c.get("gdh") or 0, rgb(c.get("gdc") or 0) + if gw: + for xx in range(x, x + w, gw): + d.line((xx, y, xx, y + h - 1), fill=gc) + if gh: # horizontal lines count from the bottom + for yy in range(y + h - 1, y - 1, -gh): + d.line((x, yy, x + w - 1, yy), fill=gc) + + def qrcode(self, img, c): + x, y, w, h = self._box(c) + img.paste(rgb(c.get("bco") or 0xFFFF), (x, y, x + w, y + h)) diff --git a/src/nxhmi/templates_basic.json b/src/nxhmi/templates_basic.json new file mode 100644 index 0000000..9206de0 --- /dev/null +++ b/src/nxhmi/templates_basic.json @@ -0,0 +1,3175 @@ +{ + "source": "Nextion Editor 1.68 defaults, Basic series (NX4832T035)", + "types": { + "0": { + "kind": "waveform", + "prefix": "s", + "att": [ + [ + "type", + "u8", + 0 + ], + [ + "id", + "u8", + 23 + ], + [ + "objname", + "str", + "s0" + ], + [ + "vscope", + "u8", + 0 + ], + [ + "drag", + "u8", + 0 + ], + [ + "sendkey", + "u8", + 0 + ], + [ + "aph", + "u8", + 127 + ], + [ + "movex", + "u16", + 0 + ], + [ + "movey", + "u16", + 0 + ], + [ + "x", + "u16", + 0 + ], + [ + "y", + "u16", + 0 + ], + [ + "w", + "u16", + 200 + ], + [ + "h", + "u16", + 200 + ], + [ + "endx", + "u16", + 199 + ], + [ + "endy", + "u16", + 199 + ], + [ + "effect", + "u8", + 0 + ], + [ + "first", + "u8", + 0 + ], + [ + "time", + "u16", + 300 + ], + [ + "lockobj", + "u8", + 0 + ], + [ + "groupid0", + "u32", + 0 + ], + [ + "groupid1", + "u32", + 0 + ], + [ + "sta", + "u8", + 1 + ], + [ + "dir", + "u8", + 0 + ], + [ + "ch", + "u8", + 1 + ], + [ + "bco", + "u16", + 0 + ], + [ + "picc", + "u16", + 65535 + ], + [ + "pic", + "u16", + 65535 + ], + [ + "gdc", + "u16", + 1024 + ], + [ + "gdw", + "u8", + 40 + ], + [ + "gdh", + "u8", + 40 + ], + [ + "objWid", + "u16", + 0 + ], + [ + "objHig", + "u16", + 0 + ], + [ + "pco0", + "u16", + 64495 + ], + [ + "pco1", + "u16", + 65519 + ], + [ + "pco2", + "u16", + 63488 + ], + [ + "pco3", + "u16", + 2016 + ], + [ + "inittrue", + "u8", + 0 + ], + [ + "dis", + "u16", + 100 + ], + [ + "molloc_s", + "u32", + 0 + ], + [ + "molloc", + "u32", + 0 + ] + ], + "events": [ + "codesdown", + "codesup" + ] + }, + "1": { + "kind": "slider", + "prefix": "h", + "att": [ + [ + "type", + "u8", + 1 + ], + [ + "id", + "u8", + 24 + ], + [ + "objname", + "str", + "h6" + ], + [ + "vscope", + "u8", + 0 + ], + [ + "drag", + "u8", + 0 + ], + [ + "sendkey", + "u8", + 0 + ], + [ + "aph", + "u8", + 127 + ], + [ + "movex", + "u16", + 0 + ], + [ + "movey", + "u16", + 0 + ], + [ + "x", + "u16", + 0 + ], + [ + "y", + "u16", + 0 + ], + [ + "w", + "u16", + 200 + ], + [ + "h", + "u16", + 25 + ], + [ + "endx", + "u16", + 199 + ], + [ + "endy", + "u16", + 24 + ], + [ + "effect", + "u8", + 0 + ], + [ + "first", + "u8", + 0 + ], + [ + "time", + "u16", + 300 + ], + [ + "lockobj", + "u8", + 0 + ], + [ + "groupid0", + "u32", + 0 + ], + [ + "groupid1", + "u32", + 0 + ], + [ + "mode", + "u8", + 0 + ], + [ + "sta", + "u8", + 1 + ], + [ + "psta", + "u8", + 0 + ], + [ + "wid", + "u8", + 255 + ], + [ + "hig", + "u8", + 255 + ], + [ + "dis", + "u8", + 100 + ], + [ + "pic", + "u16", + 65535 + ], + [ + "picc", + "u16", + 65535 + ], + [ + "bco", + "u16", + 1024 + ], + [ + "pic1", + "u16", + 65535 + ], + [ + "picc1", + "u16", + 65535 + ], + [ + "bco1", + "u16", + 64235 + ], + [ + "pic2", + "u16", + 65535 + ], + [ + "pco", + "u16", + 16384 + ], + [ + "val", + "u16", + 50 + ], + [ + "maxval", + "u16", + 100 + ], + [ + "minval", + "u16", + 0 + ], + [ + "ch", + "u8", + 25 + ] + ], + "events": [ + "codesdown", + "codesup", + "codesslide" + ] + }, + "5": { + "kind": "touch_cap", + "prefix": "tc", + "att": [ + [ + "type", + "u8", + 5 + ], + [ + "id", + "u8", + 21 + ], + [ + "objname", + "str", + "tc0" + ], + [ + "vscope", + "u8", + 0 + ], + [ + "lockobj", + "u8", + 0 + ], + [ + "groupid0", + "u32", + 0 + ], + [ + "groupid1", + "u32", + 0 + ], + [ + "val", + "u8", + 0 + ] + ], + "events": [ + "codesdown", + "codesup" + ] + }, + "51": { + "kind": "timer", + "prefix": "tm", + "att": [ + [ + "type", + "u8", + 51 + ], + [ + "id", + "u8", + 25 + ], + [ + "objname", + "str", + "tm0" + ], + [ + "vscope", + "u8", + 0 + ], + [ + "lockobj", + "u8", + 0 + ], + [ + "groupid0", + "u32", + 0 + ], + [ + "groupid1", + "u32", + 0 + ], + [ + "tim", + "u16", + 400 + ], + [ + "en", + "u8", + 1 + ] + ], + "events": [ + "codestimer" + ] + }, + "52": { + "kind": "variable", + "prefix": "va", + "att": [ + [ + "type", + "u8", + 52 + ], + [ + "id", + "u8", + 26 + ], + [ + "objname", + "str", + "va0" + ], + [ + "vscope", + "u8", + 0 + ], + [ + "lockobj", + "u8", + 0 + ], + [ + "groupid0", + "u32", + 0 + ], + [ + "groupid1", + "u32", + 0 + ], + [ + "sta", + "u8", + 0 + ], + [ + "txt", + "str", + "newtxt" + ], + [ + "txt_maxl", + "u16", + 10 + ], + [ + "val", + "u32", + 0 + ] + ], + "events": [] + }, + "53": { + "kind": "dual_state_button", + "prefix": "bt", + "att": [ + [ + "type", + "u8", + 53 + ], + [ + "id", + "u8", + 27 + ], + [ + "objname", + "str", + "bt0" + ], + [ + "vscope", + "u8", + 0 + ], + [ + "drag", + "u8", + 0 + ], + [ + "sendkey", + "u8", + 0 + ], + [ + "aph", + "u8", + 127 + ], + [ + "movex", + "u16", + 0 + ], + [ + "movey", + "u16", + 0 + ], + [ + "x", + "u16", + 0 + ], + [ + "y", + "u16", + 0 + ], + [ + "w", + "u16", + 60 + ], + [ + "h", + "u16", + 60 + ], + [ + "endx", + "u16", + 59 + ], + [ + "endy", + "u16", + 59 + ], + [ + "effect", + "u8", + 0 + ], + [ + "first", + "u8", + 0 + ], + [ + "time", + "u16", + 300 + ], + [ + "lockobj", + "u8", + 0 + ], + [ + "groupid0", + "u32", + 0 + ], + [ + "groupid1", + "u32", + 0 + ], + [ + "sta", + "u8", + 1 + ], + [ + "style", + "u8", + 4 + ], + [ + "borderc", + "u16", + 0 + ], + [ + "borderw", + "u8", + 2 + ], + [ + "font", + "u8", + 0 + ], + [ + "pic", + "u16", + 65535 + ], + [ + "picc", + "u16", + 65535 + ], + [ + "bco", + "u16", + 50712 + ], + [ + "pic2", + "u16", + 65535 + ], + [ + "picc2", + "u16", + 65535 + ], + [ + "bco2", + "u16", + 1024 + ], + [ + "pco", + "u16", + 0 + ], + [ + "pco2", + "u16", + 65535 + ], + [ + "xcen", + "u8", + 1 + ], + [ + "ycen", + "u8", + 1 + ], + [ + "val", + "u8", + 0 + ], + [ + "txt", + "str", + "newtxt" + ], + [ + "txt_maxl", + "u16", + 10 + ], + [ + "isbr", + "u8", + 0 + ], + [ + "spax", + "u8", + 0 + ], + [ + "spay", + "u8", + 0 + ] + ], + "events": [ + "codesdown", + "codesup" + ] + }, + "54": { + "kind": "number", + "prefix": "n", + "att": [ + [ + "type", + "u8", + 54 + ], + [ + "id", + "u8", + 14 + ], + [ + "objname", + "str", + "n0" + ], + [ + "vscope", + "u8", + 0 + ], + [ + "drag", + "u8", + 0 + ], + [ + "sendkey", + "u8", + 0 + ], + [ + "aph", + "u8", + 127 + ], + [ + "movex", + "u16", + 0 + ], + [ + "movey", + "u16", + 0 + ], + [ + "x", + "u16", + 0 + ], + [ + "y", + "u16", + 0 + ], + [ + "w", + "u16", + 100 + ], + [ + "h", + "u16", + 30 + ], + [ + "endx", + "u16", + 99 + ], + [ + "endy", + "u16", + 29 + ], + [ + "effect", + "u8", + 0 + ], + [ + "first", + "u8", + 0 + ], + [ + "time", + "u16", + 300 + ], + [ + "lockobj", + "u8", + 0 + ], + [ + "groupid0", + "u32", + 0 + ], + [ + "groupid1", + "u32", + 0 + ], + [ + "sta", + "u8", + 1 + ], + [ + "style", + "u8", + 0 + ], + [ + "key", + "u8", + 255 + ], + [ + "borderc", + "u16", + 0 + ], + [ + "borderw", + "u8", + 2 + ], + [ + "font", + "u8", + 0 + ], + [ + "bco", + "u16", + 65535 + ], + [ + "picc", + "u16", + 65535 + ], + [ + "pic", + "u16", + 65535 + ], + [ + "pco", + "u16", + 0 + ], + [ + "xcen", + "u8", + 1 + ], + [ + "ycen", + "u8", + 1 + ], + [ + "val", + "u32", + 0 + ], + [ + "lenth", + "u8", + 0 + ], + [ + "format", + "u8", + 0 + ], + [ + "isbr", + "u8", + 1 + ], + [ + "spax", + "u8", + 0 + ], + [ + "spay", + "u8", + 0 + ] + ], + "events": [ + "codesdown", + "codesup" + ] + }, + "55": { + "kind": "scrolling_text", + "prefix": "g", + "att": [ + [ + "type", + "u8", + 55 + ], + [ + "id", + "u8", + 13 + ], + [ + "objname", + "str", + "g0" + ], + [ + "vscope", + "u8", + 0 + ], + [ + "drag", + "u8", + 0 + ], + [ + "sendkey", + "u8", + 0 + ], + [ + "aph", + "u8", + 127 + ], + [ + "movex", + "u16", + 0 + ], + [ + "movey", + "u16", + 0 + ], + [ + "x", + "u16", + 0 + ], + [ + "y", + "u16", + 0 + ], + [ + "w", + "u16", + 240 + ], + [ + "h", + "u16", + 30 + ], + [ + "endx", + "u16", + 239 + ], + [ + "endy", + "u16", + 29 + ], + [ + "effect", + "u8", + 0 + ], + [ + "first", + "u8", + 0 + ], + [ + "time", + "u16", + 300 + ], + [ + "lockobj", + "u8", + 0 + ], + [ + "groupid0", + "u32", + 0 + ], + [ + "groupid1", + "u32", + 0 + ], + [ + "sta", + "u8", + 1 + ], + [ + "style", + "u8", + 0 + ], + [ + "key", + "u8", + 255 + ], + [ + "borderc", + "u16", + 0 + ], + [ + "borderw", + "u8", + 2 + ], + [ + "font", + "u8", + 0 + ], + [ + "bco", + "u16", + 65535 + ], + [ + "picc", + "u16", + 65535 + ], + [ + "pic", + "u16", + 65535 + ], + [ + "pco", + "u16", + 0 + ], + [ + "xcen", + "u8", + 1 + ], + [ + "ycen", + "u8", + 1 + ], + [ + "dir", + "u8", + 1 + ], + [ + "dis", + "u8", + 4 + ], + [ + "tim", + "u16", + 150 + ], + [ + "en", + "u8", + 1 + ], + [ + "txt", + "str", + "newtxt" + ], + [ + "txt_maxl", + "u16", + 10 + ], + [ + "isbr", + "u8", + 0 + ], + [ + "spax", + "u8", + 0 + ], + [ + "spay", + "u8", + 0 + ], + [ + "vvs0", + "u16", + 0 + ], + [ + "vvs1", + "u16", + 0 + ], + [ + "vvs2", + "u16", + 0 + ], + [ + "vvs3", + "u16", + 0 + ] + ], + "events": [ + "codesdown", + "codesup" + ] + }, + "56": { + "kind": "checkbox", + "prefix": "c", + "att": [ + [ + "type", + "u8", + 56 + ], + [ + "id", + "u8", + 28 + ], + [ + "objname", + "str", + "c0" + ], + [ + "vscope", + "u8", + 0 + ], + [ + "drag", + "u8", + 0 + ], + [ + "sendkey", + "u8", + 0 + ], + [ + "aph", + "u8", + 127 + ], + [ + "movex", + "u16", + 0 + ], + [ + "movey", + "u16", + 0 + ], + [ + "x", + "u16", + 0 + ], + [ + "y", + "u16", + 0 + ], + [ + "w", + "u16", + 20 + ], + [ + "h", + "u16", + 20 + ], + [ + "endx", + "u16", + 19 + ], + [ + "endy", + "u16", + 19 + ], + [ + "effect", + "u8", + 0 + ], + [ + "first", + "u8", + 0 + ], + [ + "time", + "u16", + 300 + ], + [ + "lockobj", + "u8", + 0 + ], + [ + "groupid0", + "u32", + 0 + ], + [ + "groupid1", + "u32", + 0 + ], + [ + "style", + "u8", + 2 + ], + [ + "borderw", + "u8", + 2 + ], + [ + "borderc", + "u16", + 0 + ], + [ + "bco", + "u16", + 65535 + ], + [ + "pco", + "u16", + 0 + ], + [ + "val", + "u8", + 1 + ] + ], + "events": [ + "codesdown", + "codesup" + ] + }, + "57": { + "kind": "radio", + "prefix": "r", + "att": [ + [ + "type", + "u8", + 57 + ], + [ + "id", + "u8", + 29 + ], + [ + "objname", + "str", + "r0" + ], + [ + "vscope", + "u8", + 0 + ], + [ + "drag", + "u8", + 0 + ], + [ + "sendkey", + "u8", + 0 + ], + [ + "aph", + "u8", + 127 + ], + [ + "movex", + "u16", + 0 + ], + [ + "movey", + "u16", + 0 + ], + [ + "x", + "u16", + 0 + ], + [ + "y", + "u16", + 0 + ], + [ + "w", + "u16", + 20 + ], + [ + "h", + "u16", + 20 + ], + [ + "endx", + "u16", + 19 + ], + [ + "endy", + "u16", + 19 + ], + [ + "effect", + "u8", + 0 + ], + [ + "first", + "u8", + 0 + ], + [ + "time", + "u16", + 300 + ], + [ + "lockobj", + "u8", + 0 + ], + [ + "groupid0", + "u32", + 0 + ], + [ + "groupid1", + "u32", + 0 + ], + [ + "bco", + "u16", + 65535 + ], + [ + "pco", + "u16", + 0 + ], + [ + "val", + "u8", + 1 + ] + ], + "events": [ + "codesdown", + "codesup" + ] + }, + "58": { + "kind": "qrcode", + "prefix": "qr", + "att": [ + [ + "type", + "u8", + 58 + ], + [ + "id", + "u8", + 30 + ], + [ + "objname", + "str", + "qr0" + ], + [ + "vscope", + "u8", + 0 + ], + [ + "drag", + "u8", + 0 + ], + [ + "sendkey", + "u8", + 0 + ], + [ + "aph", + "u8", + 127 + ], + [ + "movex", + "u16", + 0 + ], + [ + "movey", + "u16", + 0 + ], + [ + "x", + "u16", + 0 + ], + [ + "y", + "u16", + 0 + ], + [ + "w", + "u16", + 180 + ], + [ + "h", + "u16", + 180 + ], + [ + "endx", + "u16", + 179 + ], + [ + "endy", + "u16", + 179 + ], + [ + "effect", + "u8", + 0 + ], + [ + "first", + "u8", + 0 + ], + [ + "time", + "u16", + 300 + ], + [ + "lockobj", + "u8", + 0 + ], + [ + "groupid0", + "u32", + 0 + ], + [ + "groupid1", + "u32", + 0 + ], + [ + "sta", + "u8", + 0 + ], + [ + "dis", + "u8", + 8 + ], + [ + "bco", + "u16", + 65535 + ], + [ + "pco", + "u16", + 0 + ], + [ + "pic", + "u16", + 65535 + ], + [ + "txt", + "str", + "https://nextion.itead.cc" + ], + [ + "txt_maxl", + "u16", + 30 + ] + ], + "events": [ + "codesdown", + "codesup" + ] + }, + "59": { + "kind": "xfloat", + "prefix": "x", + "att": [ + [ + "type", + "u8", + 59 + ], + [ + "id", + "u8", + 15 + ], + [ + "objname", + "str", + "x0" + ], + [ + "vscope", + "u8", + 0 + ], + [ + "drag", + "u8", + 0 + ], + [ + "sendkey", + "u8", + 0 + ], + [ + "aph", + "u8", + 127 + ], + [ + "movex", + "u16", + 0 + ], + [ + "movey", + "u16", + 0 + ], + [ + "x", + "u16", + 0 + ], + [ + "y", + "u16", + 0 + ], + [ + "w", + "u16", + 100 + ], + [ + "h", + "u16", + 30 + ], + [ + "endx", + "u16", + 99 + ], + [ + "endy", + "u16", + 29 + ], + [ + "effect", + "u8", + 0 + ], + [ + "first", + "u8", + 0 + ], + [ + "time", + "u16", + 300 + ], + [ + "lockobj", + "u8", + 0 + ], + [ + "groupid0", + "u32", + 0 + ], + [ + "groupid1", + "u32", + 0 + ], + [ + "sta", + "u8", + 1 + ], + [ + "style", + "u8", + 0 + ], + [ + "key", + "u8", + 255 + ], + [ + "borderc", + "u16", + 0 + ], + [ + "borderw", + "u8", + 2 + ], + [ + "font", + "u8", + 0 + ], + [ + "bco", + "u16", + 65535 + ], + [ + "picc", + "u16", + 65535 + ], + [ + "pic", + "u16", + 65535 + ], + [ + "pco", + "u16", + 0 + ], + [ + "xcen", + "u8", + 1 + ], + [ + "ycen", + "u8", + 1 + ], + [ + "val", + "u32", + 0 + ], + [ + "vvs0", + "u8", + 0 + ], + [ + "vvs1", + "u8", + 0 + ], + [ + "isbr", + "u8", + 1 + ], + [ + "spax", + "u8", + 0 + ], + [ + "spay", + "u8", + 0 + ] + ], + "events": [ + "codesdown", + "codesup" + ] + }, + "98": { + "kind": "button", + "prefix": "b", + "att": [ + [ + "type", + "u8", + 98 + ], + [ + "id", + "u8", + 16 + ], + [ + "objname", + "str", + "b2" + ], + [ + "vscope", + "u8", + 0 + ], + [ + "drag", + "u8", + 0 + ], + [ + "sendkey", + "u8", + 0 + ], + [ + "aph", + "u8", + 127 + ], + [ + "movex", + "u16", + 0 + ], + [ + "movey", + "u16", + 0 + ], + [ + "x", + "u16", + 0 + ], + [ + "y", + "u16", + 0 + ], + [ + "w", + "u16", + 100 + ], + [ + "h", + "u16", + 50 + ], + [ + "endx", + "u16", + 99 + ], + [ + "endy", + "u16", + 49 + ], + [ + "effect", + "u8", + 0 + ], + [ + "first", + "u8", + 0 + ], + [ + "time", + "u16", + 300 + ], + [ + "lockobj", + "u8", + 0 + ], + [ + "groupid0", + "u32", + 0 + ], + [ + "groupid1", + "u32", + 0 + ], + [ + "sta", + "u8", + 1 + ], + [ + "style", + "u8", + 4 + ], + [ + "borderc", + "u16", + 0 + ], + [ + "borderw", + "u8", + 2 + ], + [ + "font", + "u8", + 0 + ], + [ + "pic", + "u16", + 65535 + ], + [ + "picc", + "u16", + 65535 + ], + [ + "bco", + "u16", + 50712 + ], + [ + "pic2", + "u16", + 65535 + ], + [ + "picc2", + "u16", + 65535 + ], + [ + "bco2", + "u16", + 1024 + ], + [ + "pco", + "u16", + 0 + ], + [ + "pco2", + "u16", + 65535 + ], + [ + "xcen", + "u8", + 1 + ], + [ + "ycen", + "u8", + 1 + ], + [ + "val", + "u8", + 0 + ], + [ + "txt", + "str", + "newtxt" + ], + [ + "txt_maxl", + "u16", + 10 + ], + [ + "isbr", + "u8", + 0 + ], + [ + "spax", + "u8", + 0 + ], + [ + "spay", + "u8", + 0 + ] + ], + "events": [ + "codesdown", + "codesup" + ] + }, + "106": { + "kind": "progress_bar", + "prefix": "j", + "att": [ + [ + "type", + "u8", + 106 + ], + [ + "id", + "u8", + 17 + ], + [ + "objname", + "str", + "j0" + ], + [ + "vscope", + "u8", + 0 + ], + [ + "drag", + "u8", + 0 + ], + [ + "sendkey", + "u8", + 0 + ], + [ + "aph", + "u8", + 127 + ], + [ + "movex", + "u16", + 0 + ], + [ + "movey", + "u16", + 0 + ], + [ + "x", + "u16", + 0 + ], + [ + "y", + "u16", + 0 + ], + [ + "w", + "u16", + 128 + ], + [ + "h", + "u16", + 30 + ], + [ + "endx", + "u16", + 127 + ], + [ + "endy", + "u16", + 29 + ], + [ + "effect", + "u8", + 0 + ], + [ + "first", + "u8", + 0 + ], + [ + "time", + "u16", + 300 + ], + [ + "lockobj", + "u8", + 0 + ], + [ + "groupid0", + "u32", + 0 + ], + [ + "groupid1", + "u32", + 0 + ], + [ + "sta", + "u8", + 0 + ], + [ + "dez", + "u8", + 0 + ], + [ + "val", + "u8", + 50 + ], + [ + "dis", + "u8", + 25 + ], + [ + "bco", + "u16", + 48631 + ], + [ + "bpic", + "u16", + 65535 + ], + [ + "pco", + "u16", + 1024 + ], + [ + "ppic", + "u16", + 65535 + ] + ], + "events": [ + "codesdown", + "codesup" + ] + }, + "109": { + "kind": "hotspot", + "prefix": "m", + "att": [ + [ + "type", + "u8", + 109 + ], + [ + "id", + "u8", + 20 + ], + [ + "objname", + "str", + "m0" + ], + [ + "vscope", + "u8", + 0 + ], + [ + "drag", + "u8", + 0 + ], + [ + "sendkey", + "u8", + 0 + ], + [ + "aph", + "u8", + 127 + ], + [ + "movex", + "u16", + 0 + ], + [ + "movey", + "u16", + 0 + ], + [ + "x", + "u16", + 0 + ], + [ + "y", + "u16", + 0 + ], + [ + "w", + "u16", + 60 + ], + [ + "h", + "u16", + 60 + ], + [ + "endx", + "u16", + 59 + ], + [ + "endy", + "u16", + 59 + ], + [ + "effect", + "u8", + 0 + ], + [ + "first", + "u8", + 0 + ], + [ + "time", + "u16", + 300 + ], + [ + "lockobj", + "u8", + 0 + ], + [ + "groupid0", + "u32", + 0 + ], + [ + "groupid1", + "u32", + 0 + ] + ], + "events": [ + "codesdown", + "codesup" + ] + }, + "112": { + "kind": "picture", + "prefix": "p", + "att": [ + [ + "type", + "u8", + 112 + ], + [ + "id", + "u8", + 18 + ], + [ + "objname", + "str", + "p0" + ], + [ + "vscope", + "u8", + 0 + ], + [ + "drag", + "u8", + 0 + ], + [ + "sendkey", + "u8", + 0 + ], + [ + "aph", + "u8", + 127 + ], + [ + "movex", + "u16", + 0 + ], + [ + "movey", + "u16", + 0 + ], + [ + "x", + "u16", + 0 + ], + [ + "y", + "u16", + 0 + ], + [ + "w", + "u16", + 60 + ], + [ + "h", + "u16", + 60 + ], + [ + "endx", + "u16", + 59 + ], + [ + "endy", + "u16", + 59 + ], + [ + "effect", + "u8", + 0 + ], + [ + "first", + "u8", + 0 + ], + [ + "time", + "u16", + 300 + ], + [ + "lockobj", + "u8", + 0 + ], + [ + "groupid0", + "u32", + 0 + ], + [ + "groupid1", + "u32", + 0 + ], + [ + "pic", + "u16", + 65535 + ] + ], + "events": [ + "codesdown", + "codesup" + ] + }, + "113": { + "kind": "crop", + "prefix": "q", + "att": [ + [ + "type", + "u8", + 113 + ], + [ + "id", + "u8", + 19 + ], + [ + "objname", + "str", + "q0" + ], + [ + "vscope", + "u8", + 0 + ], + [ + "drag", + "u8", + 0 + ], + [ + "sendkey", + "u8", + 0 + ], + [ + "aph", + "u8", + 127 + ], + [ + "movex", + "u16", + 0 + ], + [ + "movey", + "u16", + 0 + ], + [ + "x", + "u16", + 0 + ], + [ + "y", + "u16", + 0 + ], + [ + "w", + "u16", + 60 + ], + [ + "h", + "u16", + 60 + ], + [ + "endx", + "u16", + 59 + ], + [ + "endy", + "u16", + 59 + ], + [ + "effect", + "u8", + 0 + ], + [ + "first", + "u8", + 0 + ], + [ + "time", + "u16", + 300 + ], + [ + "lockobj", + "u8", + 0 + ], + [ + "groupid0", + "u32", + 0 + ], + [ + "groupid1", + "u32", + 0 + ], + [ + "picc", + "u16", + 65535 + ], + [ + "vvs0", + "u16", + 0 + ], + [ + "vvs1", + "u16", + 0 + ] + ], + "events": [ + "codesdown", + "codesup" + ] + }, + "116": { + "kind": "text", + "prefix": "t", + "att": [ + [ + "type", + "u8", + 116 + ], + [ + "id", + "u8", + 12 + ], + [ + "objname", + "str", + "t2" + ], + [ + "vscope", + "u8", + 0 + ], + [ + "drag", + "u8", + 0 + ], + [ + "sendkey", + "u8", + 0 + ], + [ + "aph", + "u8", + 127 + ], + [ + "movex", + "u16", + 0 + ], + [ + "movey", + "u16", + 0 + ], + [ + "x", + "u16", + 0 + ], + [ + "y", + "u16", + 0 + ], + [ + "w", + "u16", + 100 + ], + [ + "h", + "u16", + 30 + ], + [ + "endx", + "u16", + 99 + ], + [ + "endy", + "u16", + 29 + ], + [ + "effect", + "u8", + 0 + ], + [ + "first", + "u8", + 0 + ], + [ + "time", + "u16", + 300 + ], + [ + "lockobj", + "u8", + 0 + ], + [ + "groupid0", + "u32", + 0 + ], + [ + "groupid1", + "u32", + 0 + ], + [ + "sta", + "u8", + 1 + ], + [ + "style", + "u8", + 0 + ], + [ + "key", + "u8", + 255 + ], + [ + "borderc", + "u16", + 0 + ], + [ + "borderw", + "u8", + 2 + ], + [ + "font", + "u8", + 0 + ], + [ + "bco", + "u16", + 65535 + ], + [ + "picc", + "u16", + 65535 + ], + [ + "pic", + "u16", + 65535 + ], + [ + "pco", + "u16", + 0 + ], + [ + "xcen", + "u8", + 1 + ], + [ + "ycen", + "u8", + 1 + ], + [ + "pw", + "u8", + 0 + ], + [ + "txt", + "str", + "newtxt" + ], + [ + "txt_maxl", + "u16", + 10 + ], + [ + "isbr", + "u8", + 0 + ], + [ + "spax", + "u8", + 0 + ], + [ + "spay", + "u8", + 0 + ] + ], + "events": [ + "codesdown", + "codesup" + ] + }, + "121": { + "kind": "page", + "prefix": "page", + "att": [ + [ + "type", + "u8", + 121 + ], + [ + "id", + "u8", + 0 + ], + [ + "objname", + "str", + "page0" + ], + [ + "vscope", + "u8", + 0 + ], + [ + "drag", + "u8", + 0 + ], + [ + "sendkey", + "u8", + 0 + ], + [ + "aph", + "u8", + 127 + ], + [ + "movex", + "u16", + 0 + ], + [ + "movey", + "u16", + 0 + ], + [ + "x", + "u16", + 0 + ], + [ + "y", + "u16", + 0 + ], + [ + "w", + "u16", + 480 + ], + [ + "h", + "u16", + 320 + ], + [ + "endx", + "u16", + 479 + ], + [ + "endy", + "u16", + 319 + ], + [ + "effect", + "u8", + 0 + ], + [ + "first", + "u8", + 0 + ], + [ + "time", + "u16", + 300 + ], + [ + "lockobj", + "u8", + 0 + ], + [ + "groupid0", + "u32", + 0 + ], + [ + "groupid1", + "u32", + 0 + ], + [ + "up", + "u8", + 255 + ], + [ + "down", + "u8", + 255 + ], + [ + "left", + "u8", + 255 + ], + [ + "right", + "u8", + 255 + ], + [ + "sta", + "u8", + 1 + ], + [ + "bco", + "u16", + 65535 + ], + [ + "pic", + "u16", + 0 + ] + ], + "events": [ + "codesload", + "codesloadend", + "codesdown", + "codesup", + "codesunload" + ] + }, + "122": { + "kind": "gauge", + "prefix": "z", + "att": [ + [ + "type", + "u8", + 122 + ], + [ + "id", + "u8", + 22 + ], + [ + "objname", + "str", + "z0" + ], + [ + "vscope", + "u8", + 0 + ], + [ + "drag", + "u8", + 0 + ], + [ + "sendkey", + "u8", + 0 + ], + [ + "aph", + "u8", + 127 + ], + [ + "movex", + "u16", + 0 + ], + [ + "movey", + "u16", + 0 + ], + [ + "x", + "u16", + 0 + ], + [ + "y", + "u16", + 0 + ], + [ + "w", + "u16", + 220 + ], + [ + "h", + "u16", + 220 + ], + [ + "endx", + "u16", + 219 + ], + [ + "endy", + "u16", + 219 + ], + [ + "effect", + "u8", + 0 + ], + [ + "first", + "u8", + 0 + ], + [ + "time", + "u16", + 300 + ], + [ + "lockobj", + "u8", + 0 + ], + [ + "groupid0", + "u32", + 0 + ], + [ + "groupid1", + "u32", + 0 + ], + [ + "sta", + "u8", + 1 + ], + [ + "picc", + "u16", + 65535 + ], + [ + "bco", + "u16", + 65535 + ], + [ + "pic", + "u16", + 65535 + ], + [ + "val", + "u16", + 0 + ], + [ + "format", + "u16", + 0 + ], + [ + "up", + "u16", + 32767 + ], + [ + "down", + "u16", + 30 + ], + [ + "left", + "u16", + 0 + ], + [ + "pco", + "u16", + 1024 + ], + [ + "pco2", + "u16", + 63488 + ], + [ + "hig", + "u8", + 24 + ], + [ + "wid", + "u8", + 2 + ], + [ + "vvs0", + "u8", + 1 + ], + [ + "vvs1", + "u8", + 7 + ], + [ + "vvs2", + "u8", + 2 + ] + ], + "events": [ + "codesdown", + "codesup" + ] + } + } +} \ No newline at end of file diff --git a/src/nxhmi/templates_intelligent.json b/src/nxhmi/templates_intelligent.json new file mode 100644 index 0000000..a462228 --- /dev/null +++ b/src/nxhmi/templates_intelligent.json @@ -0,0 +1,5428 @@ +{ + "source": "Nextion Editor 1.68 defaults, Intelligent series (NX4827P043)", + "types": { + "0": { + "kind": "waveform", + "prefix": "s", + "att": [ + [ + "type", + "u8", + 0 + ], + [ + "id", + "u8", + 40 + ], + [ + "objname", + "str", + "s0" + ], + [ + "vscope", + "u8", + 0 + ], + [ + "drag", + "u8", + 0 + ], + [ + "sendkey", + "u8", + 0 + ], + [ + "aph", + "u8", + 127 + ], + [ + "movex", + "u16", + 0 + ], + [ + "movey", + "u16", + 0 + ], + [ + "x", + "u16", + 0 + ], + [ + "y", + "u16", + 0 + ], + [ + "w", + "u16", + 200 + ], + [ + "h", + "u16", + 200 + ], + [ + "endx", + "u16", + 199 + ], + [ + "endy", + "u16", + 199 + ], + [ + "effect", + "u8", + 0 + ], + [ + "first", + "u8", + 0 + ], + [ + "time", + "u16", + 300 + ], + [ + "lockobj", + "u8", + 0 + ], + [ + "groupid0", + "u32", + 0 + ], + [ + "groupid1", + "u32", + 0 + ], + [ + "sta", + "u8", + 1 + ], + [ + "dir", + "u8", + 0 + ], + [ + "ch", + "u8", + 1 + ], + [ + "bco", + "u16", + 0 + ], + [ + "picc", + "u16", + 65535 + ], + [ + "pic", + "u16", + 65535 + ], + [ + "gdc", + "u16", + 1024 + ], + [ + "gdw", + "u8", + 40 + ], + [ + "gdh", + "u8", + 40 + ], + [ + "objWid", + "u16", + 0 + ], + [ + "objHig", + "u16", + 0 + ], + [ + "pco0", + "u16", + 64495 + ], + [ + "pco1", + "u16", + 65519 + ], + [ + "pco2", + "u16", + 63488 + ], + [ + "pco3", + "u16", + 2016 + ], + [ + "inittrue", + "u8", + 0 + ], + [ + "dis", + "u16", + 100 + ], + [ + "molloc_s", + "u32", + 0 + ], + [ + "molloc", + "u32", + 0 + ] + ], + "events": [ + "codesdown", + "codesup" + ] + }, + "1": { + "kind": "slider", + "prefix": "h", + "att": [ + [ + "type", + "u8", + 1 + ], + [ + "id", + "u8", + 41 + ], + [ + "objname", + "str", + "h6" + ], + [ + "vscope", + "u8", + 0 + ], + [ + "drag", + "u8", + 0 + ], + [ + "sendkey", + "u8", + 0 + ], + [ + "aph", + "u8", + 127 + ], + [ + "movex", + "u16", + 0 + ], + [ + "movey", + "u16", + 0 + ], + [ + "x", + "u16", + 0 + ], + [ + "y", + "u16", + 0 + ], + [ + "w", + "u16", + 200 + ], + [ + "h", + "u16", + 25 + ], + [ + "endx", + "u16", + 199 + ], + [ + "endy", + "u16", + 24 + ], + [ + "effect", + "u8", + 0 + ], + [ + "first", + "u8", + 0 + ], + [ + "time", + "u16", + 300 + ], + [ + "lockobj", + "u8", + 0 + ], + [ + "groupid0", + "u32", + 0 + ], + [ + "groupid1", + "u32", + 0 + ], + [ + "mode", + "u8", + 0 + ], + [ + "sta", + "u8", + 1 + ], + [ + "psta", + "u8", + 0 + ], + [ + "wid", + "u8", + 255 + ], + [ + "hig", + "u8", + 255 + ], + [ + "dis", + "u8", + 100 + ], + [ + "pic", + "u16", + 65535 + ], + [ + "picc", + "u16", + 65535 + ], + [ + "bco", + "u16", + 1024 + ], + [ + "pic1", + "u16", + 65535 + ], + [ + "picc1", + "u16", + 65535 + ], + [ + "bco1", + "u16", + 64235 + ], + [ + "pic2", + "u16", + 65535 + ], + [ + "pco", + "u16", + 16384 + ], + [ + "val", + "u16", + 50 + ], + [ + "maxval", + "u16", + 100 + ], + [ + "minval", + "u16", + 0 + ], + [ + "ch", + "u8", + 25 + ] + ], + "events": [ + "codesdown", + "codesup", + "codesslide" + ] + }, + "2": { + "kind": "gmov", + "prefix": "gm", + "att": [ + [ + "type", + "u8", + 2 + ], + [ + "id", + "u8", + 19 + ], + [ + "objname", + "str", + "gm0" + ], + [ + "vscope", + "u8", + 0 + ], + [ + "drag", + "u8", + 0 + ], + [ + "sendkey", + "u8", + 0 + ], + [ + "aph", + "u8", + 127 + ], + [ + "movex", + "u16", + 0 + ], + [ + "movey", + "u16", + 0 + ], + [ + "x", + "u16", + 0 + ], + [ + "y", + "u16", + 0 + ], + [ + "w", + "u16", + 128 + ], + [ + "h", + "u16", + 128 + ], + [ + "endx", + "u16", + 127 + ], + [ + "endy", + "u16", + 127 + ], + [ + "effect", + "u8", + 0 + ], + [ + "first", + "u8", + 0 + ], + [ + "time", + "u16", + 300 + ], + [ + "lockobj", + "u8", + 0 + ], + [ + "groupid0", + "u32", + 0 + ], + [ + "groupid1", + "u32", + 0 + ], + [ + "from", + "u8", + 0 + ], + [ + "vid", + "u16", + 65535 + ], + [ + "path", + "str", + "" + ], + [ + "path_m", + "u16", + 255 + ], + [ + "en", + "u8", + 1 + ], + [ + "loop", + "u8", + 1 + ], + [ + "dis", + "u16", + 100 + ], + [ + "tim", + "u32", + 0 + ], + [ + "stim", + "u32", + 0 + ], + [ + "qty", + "u32", + 0 + ], + [ + "molloc_s", + "u32", + 12000 + ], + [ + "molloc", + "u32", + 12000 + ] + ], + "events": [ + "codesdown", + "codesup", + "codesplayend" + ] + }, + "3": { + "kind": "video", + "prefix": "v", + "att": [ + [ + "type", + "u8", + 3 + ], + [ + "id", + "u8", + 20 + ], + [ + "objname", + "str", + "v0" + ], + [ + "vscope", + "u8", + 0 + ], + [ + "drag", + "u8", + 0 + ], + [ + "sendkey", + "u8", + 0 + ], + [ + "aph", + "u8", + 127 + ], + [ + "movex", + "u16", + 0 + ], + [ + "movey", + "u16", + 0 + ], + [ + "x", + "u16", + 0 + ], + [ + "y", + "u16", + 0 + ], + [ + "w", + "u16", + 128 + ], + [ + "h", + "u16", + 128 + ], + [ + "endx", + "u16", + 127 + ], + [ + "endy", + "u16", + 127 + ], + [ + "effect", + "u8", + 0 + ], + [ + "first", + "u8", + 0 + ], + [ + "time", + "u16", + 300 + ], + [ + "lockobj", + "u8", + 0 + ], + [ + "groupid0", + "u32", + 0 + ], + [ + "groupid1", + "u32", + 0 + ], + [ + "from", + "u8", + 0 + ], + [ + "vid", + "u16", + 65535 + ], + [ + "path", + "str", + "" + ], + [ + "path_m", + "u16", + 255 + ], + [ + "en", + "u8", + 1 + ], + [ + "loop", + "u8", + 1 + ], + [ + "fps", + "u8", + 1 + ], + [ + "dis", + "u16", + 100 + ], + [ + "tim", + "u32", + 0 + ], + [ + "stim", + "u32", + 0 + ], + [ + "qty", + "u32", + 0 + ], + [ + "molloc_s", + "u32", + 64000 + ], + [ + "molloc", + "u32", + 64000 + ] + ], + "events": [ + "codesdown", + "codesup", + "codesplayend" + ] + }, + "4": { + "kind": "audio", + "prefix": "wav", + "att": [ + [ + "type", + "u8", + 4 + ], + [ + "id", + "u8", + 21 + ], + [ + "objname", + "str", + "wav0" + ], + [ + "vscope", + "u8", + 0 + ], + [ + "lockobj", + "u8", + 0 + ], + [ + "groupid0", + "u32", + 0 + ], + [ + "groupid1", + "u32", + 0 + ], + [ + "from", + "u8", + 0 + ], + [ + "vid", + "u16", + 65535 + ], + [ + "path", + "str", + "" + ], + [ + "path_m", + "u16", + 255 + ], + [ + "en", + "u8", + 1 + ], + [ + "loop", + "u8", + 1 + ], + [ + "fps", + "u8", + 1 + ], + [ + "dis", + "u16", + 100 + ], + [ + "tim", + "u32", + 0 + ], + [ + "stim", + "u32", + 0 + ], + [ + "qty", + "u32", + 0 + ], + [ + "molloc_s", + "u32", + 64000 + ], + [ + "molloc", + "u32", + 64000 + ] + ], + "events": [ + "codesplayend" + ] + }, + "5": { + "kind": "touch_cap", + "prefix": "tc", + "att": [ + [ + "type", + "u8", + 5 + ], + [ + "id", + "u8", + 38 + ], + [ + "objname", + "str", + "tc0" + ], + [ + "vscope", + "u8", + 0 + ], + [ + "lockobj", + "u8", + 0 + ], + [ + "groupid0", + "u32", + 0 + ], + [ + "groupid1", + "u32", + 0 + ], + [ + "val", + "u8", + 0 + ] + ], + "events": [ + "codesdown", + "codesup" + ] + }, + "51": { + "kind": "timer", + "prefix": "tm", + "att": [ + [ + "type", + "u8", + 51 + ], + [ + "id", + "u8", + 23 + ], + [ + "objname", + "str", + "tm0" + ], + [ + "vscope", + "u8", + 0 + ], + [ + "lockobj", + "u8", + 0 + ], + [ + "groupid0", + "u32", + 0 + ], + [ + "groupid1", + "u32", + 0 + ], + [ + "tim", + "u16", + 400 + ], + [ + "en", + "u8", + 1 + ] + ], + "events": [ + "codestimer" + ] + }, + "52": { + "kind": "variable", + "prefix": "va", + "att": [ + [ + "type", + "u8", + 52 + ], + [ + "id", + "u8", + 24 + ], + [ + "objname", + "str", + "va0" + ], + [ + "vscope", + "u8", + 0 + ], + [ + "lockobj", + "u8", + 0 + ], + [ + "groupid0", + "u32", + 0 + ], + [ + "groupid1", + "u32", + 0 + ], + [ + "sta", + "u8", + 0 + ], + [ + "txt", + "str", + "newtxt" + ], + [ + "txt_maxl", + "u16", + 10 + ], + [ + "val", + "u32", + 0 + ] + ], + "events": [] + }, + "53": { + "kind": "dual_state_button", + "prefix": "bt", + "att": [ + [ + "type", + "u8", + 53 + ], + [ + "id", + "u8", + 25 + ], + [ + "objname", + "str", + "bt0" + ], + [ + "vscope", + "u8", + 0 + ], + [ + "drag", + "u8", + 0 + ], + [ + "sendkey", + "u8", + 0 + ], + [ + "aph", + "u8", + 127 + ], + [ + "movex", + "u16", + 0 + ], + [ + "movey", + "u16", + 0 + ], + [ + "x", + "u16", + 0 + ], + [ + "y", + "u16", + 0 + ], + [ + "w", + "u16", + 60 + ], + [ + "h", + "u16", + 60 + ], + [ + "endx", + "u16", + 59 + ], + [ + "endy", + "u16", + 59 + ], + [ + "effect", + "u8", + 0 + ], + [ + "first", + "u8", + 0 + ], + [ + "time", + "u16", + 300 + ], + [ + "lockobj", + "u8", + 0 + ], + [ + "groupid0", + "u32", + 0 + ], + [ + "groupid1", + "u32", + 0 + ], + [ + "sta", + "u8", + 1 + ], + [ + "style", + "u8", + 4 + ], + [ + "borderc", + "u16", + 0 + ], + [ + "borderw", + "u8", + 2 + ], + [ + "font", + "u8", + 0 + ], + [ + "pic", + "u16", + 65535 + ], + [ + "picc", + "u16", + 65535 + ], + [ + "bco", + "u16", + 50712 + ], + [ + "pic2", + "u16", + 65535 + ], + [ + "picc2", + "u16", + 65535 + ], + [ + "bco2", + "u16", + 1024 + ], + [ + "pco", + "u16", + 0 + ], + [ + "pco2", + "u16", + 65535 + ], + [ + "xcen", + "u8", + 1 + ], + [ + "ycen", + "u8", + 1 + ], + [ + "val", + "u8", + 0 + ], + [ + "txt", + "str", + "newtxt" + ], + [ + "txt_maxl", + "u16", + 10 + ], + [ + "isbr", + "u8", + 0 + ], + [ + "spax", + "u8", + 0 + ], + [ + "spay", + "u8", + 0 + ] + ], + "events": [ + "codesdown", + "codesup" + ] + }, + "54": { + "kind": "number", + "prefix": "n", + "att": [ + [ + "type", + "u8", + 54 + ], + [ + "id", + "u8", + 31 + ], + [ + "objname", + "str", + "n0" + ], + [ + "vscope", + "u8", + 0 + ], + [ + "drag", + "u8", + 0 + ], + [ + "sendkey", + "u8", + 0 + ], + [ + "aph", + "u8", + 127 + ], + [ + "movex", + "u16", + 0 + ], + [ + "movey", + "u16", + 0 + ], + [ + "x", + "u16", + 0 + ], + [ + "y", + "u16", + 0 + ], + [ + "w", + "u16", + 100 + ], + [ + "h", + "u16", + 30 + ], + [ + "endx", + "u16", + 99 + ], + [ + "endy", + "u16", + 29 + ], + [ + "effect", + "u8", + 0 + ], + [ + "first", + "u8", + 0 + ], + [ + "time", + "u16", + 300 + ], + [ + "lockobj", + "u8", + 0 + ], + [ + "groupid0", + "u32", + 0 + ], + [ + "groupid1", + "u32", + 0 + ], + [ + "sta", + "u8", + 1 + ], + [ + "style", + "u8", + 0 + ], + [ + "key", + "u8", + 255 + ], + [ + "borderc", + "u16", + 0 + ], + [ + "borderw", + "u8", + 2 + ], + [ + "font", + "u8", + 0 + ], + [ + "bco", + "u16", + 65535 + ], + [ + "picc", + "u16", + 65535 + ], + [ + "pic", + "u16", + 65535 + ], + [ + "pco", + "u16", + 0 + ], + [ + "xcen", + "u8", + 1 + ], + [ + "ycen", + "u8", + 1 + ], + [ + "val", + "u32", + 0 + ], + [ + "lenth", + "u8", + 0 + ], + [ + "format", + "u8", + 0 + ], + [ + "isbr", + "u8", + 1 + ], + [ + "spax", + "u8", + 0 + ], + [ + "spay", + "u8", + 0 + ] + ], + "events": [ + "codesdown", + "codesup" + ] + }, + "55": { + "kind": "scrolling_text", + "prefix": "g", + "att": [ + [ + "type", + "u8", + 55 + ], + [ + "id", + "u8", + 30 + ], + [ + "objname", + "str", + "g0" + ], + [ + "vscope", + "u8", + 0 + ], + [ + "drag", + "u8", + 0 + ], + [ + "sendkey", + "u8", + 0 + ], + [ + "aph", + "u8", + 127 + ], + [ + "movex", + "u16", + 0 + ], + [ + "movey", + "u16", + 0 + ], + [ + "x", + "u16", + 0 + ], + [ + "y", + "u16", + 0 + ], + [ + "w", + "u16", + 240 + ], + [ + "h", + "u16", + 30 + ], + [ + "endx", + "u16", + 239 + ], + [ + "endy", + "u16", + 29 + ], + [ + "effect", + "u8", + 0 + ], + [ + "first", + "u8", + 0 + ], + [ + "time", + "u16", + 300 + ], + [ + "lockobj", + "u8", + 0 + ], + [ + "groupid0", + "u32", + 0 + ], + [ + "groupid1", + "u32", + 0 + ], + [ + "sta", + "u8", + 1 + ], + [ + "style", + "u8", + 0 + ], + [ + "key", + "u8", + 255 + ], + [ + "borderc", + "u16", + 0 + ], + [ + "borderw", + "u8", + 2 + ], + [ + "font", + "u8", + 0 + ], + [ + "bco", + "u16", + 65535 + ], + [ + "picc", + "u16", + 65535 + ], + [ + "pic", + "u16", + 65535 + ], + [ + "pco", + "u16", + 0 + ], + [ + "xcen", + "u8", + 1 + ], + [ + "ycen", + "u8", + 1 + ], + [ + "dir", + "u8", + 1 + ], + [ + "dis", + "u8", + 4 + ], + [ + "tim", + "u16", + 150 + ], + [ + "en", + "u8", + 1 + ], + [ + "txt", + "str", + "newtxt" + ], + [ + "txt_maxl", + "u16", + 10 + ], + [ + "isbr", + "u8", + 0 + ], + [ + "spax", + "u8", + 0 + ], + [ + "spay", + "u8", + 0 + ], + [ + "vvs0", + "u16", + 0 + ], + [ + "vvs1", + "u16", + 0 + ], + [ + "vvs2", + "u16", + 0 + ], + [ + "vvs3", + "u16", + 0 + ] + ], + "events": [ + "codesdown", + "codesup" + ] + }, + "56": { + "kind": "checkbox", + "prefix": "c", + "att": [ + [ + "type", + "u8", + 56 + ], + [ + "id", + "u8", + 26 + ], + [ + "objname", + "str", + "c0" + ], + [ + "vscope", + "u8", + 0 + ], + [ + "drag", + "u8", + 0 + ], + [ + "sendkey", + "u8", + 0 + ], + [ + "aph", + "u8", + 127 + ], + [ + "movex", + "u16", + 0 + ], + [ + "movey", + "u16", + 0 + ], + [ + "x", + "u16", + 0 + ], + [ + "y", + "u16", + 0 + ], + [ + "w", + "u16", + 20 + ], + [ + "h", + "u16", + 20 + ], + [ + "endx", + "u16", + 19 + ], + [ + "endy", + "u16", + 19 + ], + [ + "effect", + "u8", + 0 + ], + [ + "first", + "u8", + 0 + ], + [ + "time", + "u16", + 300 + ], + [ + "lockobj", + "u8", + 0 + ], + [ + "groupid0", + "u32", + 0 + ], + [ + "groupid1", + "u32", + 0 + ], + [ + "style", + "u8", + 2 + ], + [ + "borderw", + "u8", + 2 + ], + [ + "borderc", + "u16", + 0 + ], + [ + "bco", + "u16", + 65535 + ], + [ + "pco", + "u16", + 0 + ], + [ + "val", + "u8", + 1 + ] + ], + "events": [ + "codesdown", + "codesup" + ] + }, + "57": { + "kind": "radio", + "prefix": "r", + "att": [ + [ + "type", + "u8", + 57 + ], + [ + "id", + "u8", + 27 + ], + [ + "objname", + "str", + "r0" + ], + [ + "vscope", + "u8", + 0 + ], + [ + "drag", + "u8", + 0 + ], + [ + "sendkey", + "u8", + 0 + ], + [ + "aph", + "u8", + 127 + ], + [ + "movex", + "u16", + 0 + ], + [ + "movey", + "u16", + 0 + ], + [ + "x", + "u16", + 0 + ], + [ + "y", + "u16", + 0 + ], + [ + "w", + "u16", + 20 + ], + [ + "h", + "u16", + 20 + ], + [ + "endx", + "u16", + 19 + ], + [ + "endy", + "u16", + 19 + ], + [ + "effect", + "u8", + 0 + ], + [ + "first", + "u8", + 0 + ], + [ + "time", + "u16", + 300 + ], + [ + "lockobj", + "u8", + 0 + ], + [ + "groupid0", + "u32", + 0 + ], + [ + "groupid1", + "u32", + 0 + ], + [ + "bco", + "u16", + 65535 + ], + [ + "pco", + "u16", + 0 + ], + [ + "val", + "u8", + 1 + ] + ], + "events": [ + "codesdown", + "codesup" + ] + }, + "58": { + "kind": "qrcode", + "prefix": "qr", + "att": [ + [ + "type", + "u8", + 58 + ], + [ + "id", + "u8", + 28 + ], + [ + "objname", + "str", + "qr0" + ], + [ + "vscope", + "u8", + 0 + ], + [ + "drag", + "u8", + 0 + ], + [ + "sendkey", + "u8", + 0 + ], + [ + "aph", + "u8", + 127 + ], + [ + "movex", + "u16", + 0 + ], + [ + "movey", + "u16", + 0 + ], + [ + "x", + "u16", + 0 + ], + [ + "y", + "u16", + 0 + ], + [ + "w", + "u16", + 180 + ], + [ + "h", + "u16", + 180 + ], + [ + "endx", + "u16", + 179 + ], + [ + "endy", + "u16", + 179 + ], + [ + "effect", + "u8", + 0 + ], + [ + "first", + "u8", + 0 + ], + [ + "time", + "u16", + 300 + ], + [ + "lockobj", + "u8", + 0 + ], + [ + "groupid0", + "u32", + 0 + ], + [ + "groupid1", + "u32", + 0 + ], + [ + "sta", + "u8", + 0 + ], + [ + "dis", + "u8", + 8 + ], + [ + "bco", + "u16", + 65535 + ], + [ + "pco", + "u16", + 0 + ], + [ + "pic", + "u16", + 65535 + ], + [ + "txt", + "str", + "https://nextion.itead.cc" + ], + [ + "txt_maxl", + "u16", + 30 + ] + ], + "events": [ + "codesdown", + "codesup" + ] + }, + "59": { + "kind": "xfloat", + "prefix": "x", + "att": [ + [ + "type", + "u8", + 59 + ], + [ + "id", + "u8", + 32 + ], + [ + "objname", + "str", + "x0" + ], + [ + "vscope", + "u8", + 0 + ], + [ + "drag", + "u8", + 0 + ], + [ + "sendkey", + "u8", + 0 + ], + [ + "aph", + "u8", + 127 + ], + [ + "movex", + "u16", + 0 + ], + [ + "movey", + "u16", + 0 + ], + [ + "x", + "u16", + 0 + ], + [ + "y", + "u16", + 0 + ], + [ + "w", + "u16", + 100 + ], + [ + "h", + "u16", + 30 + ], + [ + "endx", + "u16", + 99 + ], + [ + "endy", + "u16", + 29 + ], + [ + "effect", + "u8", + 0 + ], + [ + "first", + "u8", + 0 + ], + [ + "time", + "u16", + 300 + ], + [ + "lockobj", + "u8", + 0 + ], + [ + "groupid0", + "u32", + 0 + ], + [ + "groupid1", + "u32", + 0 + ], + [ + "sta", + "u8", + 1 + ], + [ + "style", + "u8", + 0 + ], + [ + "key", + "u8", + 255 + ], + [ + "borderc", + "u16", + 0 + ], + [ + "borderw", + "u8", + 2 + ], + [ + "font", + "u8", + 0 + ], + [ + "bco", + "u16", + 65535 + ], + [ + "picc", + "u16", + 65535 + ], + [ + "pic", + "u16", + 65535 + ], + [ + "pco", + "u16", + 0 + ], + [ + "xcen", + "u8", + 1 + ], + [ + "ycen", + "u8", + 1 + ], + [ + "val", + "u32", + 0 + ], + [ + "vvs0", + "u8", + 0 + ], + [ + "vvs1", + "u8", + 0 + ], + [ + "isbr", + "u8", + 1 + ], + [ + "spax", + "u8", + 0 + ], + [ + "spay", + "u8", + 0 + ] + ], + "events": [ + "codesdown", + "codesup" + ] + }, + "60": { + "kind": "ex_picture", + "prefix": "exp", + "att": [ + [ + "type", + "u8", + 60 + ], + [ + "id", + "u8", + 22 + ], + [ + "objname", + "str", + "exp0" + ], + [ + "vscope", + "u8", + 0 + ], + [ + "drag", + "u8", + 0 + ], + [ + "sendkey", + "u8", + 0 + ], + [ + "aph", + "u8", + 127 + ], + [ + "movex", + "u16", + 0 + ], + [ + "movey", + "u16", + 0 + ], + [ + "x", + "u16", + 0 + ], + [ + "y", + "u16", + 0 + ], + [ + "w", + "u16", + 120 + ], + [ + "h", + "u16", + 120 + ], + [ + "endx", + "u16", + 119 + ], + [ + "endy", + "u16", + 119 + ], + [ + "effect", + "u8", + 0 + ], + [ + "first", + "u8", + 0 + ], + [ + "time", + "u16", + 300 + ], + [ + "lockobj", + "u8", + 0 + ], + [ + "groupid0", + "u32", + 0 + ], + [ + "groupid1", + "u32", + 0 + ], + [ + "path", + "str", + "" + ], + [ + "path_m", + "u16", + 255 + ] + ], + "events": [ + "codesdown", + "codesup" + ] + }, + "61": { + "kind": "combobox", + "prefix": "cb", + "att": [ + [ + "type", + "u8", + 61 + ], + [ + "id", + "u8", + 13 + ], + [ + "objname", + "str", + "cb0" + ], + [ + "vscope", + "u8", + 0 + ], + [ + "drag", + "u8", + 0 + ], + [ + "sendkey", + "u8", + 0 + ], + [ + "aph", + "u8", + 127 + ], + [ + "movex", + "u16", + 0 + ], + [ + "movey", + "u16", + 0 + ], + [ + "x", + "u16", + 0 + ], + [ + "y", + "u16", + 0 + ], + [ + "w", + "u16", + 100 + ], + [ + "h", + "u16", + 42 + ], + [ + "endx", + "u16", + 99 + ], + [ + "endy", + "u16", + 41 + ], + [ + "effect", + "u8", + 0 + ], + [ + "first", + "u8", + 0 + ], + [ + "time", + "u16", + 300 + ], + [ + "lockobj", + "u8", + 0 + ], + [ + "groupid0", + "u32", + 0 + ], + [ + "groupid1", + "u32", + 0 + ], + [ + "sta", + "u8", + 1 + ], + [ + "style", + "u8", + 0 + ], + [ + "borderc", + "u16", + 0 + ], + [ + "borderw", + "u8", + 2 + ], + [ + "font", + "u8", + 0 + ], + [ + "bco", + "u16", + 65535 + ], + [ + "picc", + "u16", + 65535 + ], + [ + "pic", + "u16", + 65535 + ], + [ + "pco", + "u16", + 0 + ], + [ + "xcen", + "u8", + 1 + ], + [ + "ycen", + "u8", + 1 + ], + [ + "spax", + "u8", + 0 + ], + [ + "dis", + "u8", + 25 + ], + [ + "txt", + "str", + "40V" + ], + [ + "txt_maxl", + "u16", + 32 + ], + [ + "up", + "u8", + 1 + ], + [ + "pco3", + "u16", + 42292 + ], + [ + "bco1", + "u16", + 65535 + ], + [ + "pco1", + "u16", + 0 + ], + [ + "path", + "str", + "40V\r\n60V\r\n80V\r\n100V\r\n120V\r\n140V" + ], + [ + "path_m", + "u16", + 256 + ], + [ + "dir", + "u8", + 1 + ], + [ + "qty", + "u8", + 4 + ], + [ + "vvs0", + "u8", + 8 + ], + [ + "val", + "u8", + 0 + ], + [ + "bco2", + "u16", + 31 + ], + [ + "pco2", + "u16", + 65535 + ], + [ + "hig", + "u8", + 42 + ], + [ + "down", + "u8", + 0 + ], + [ + "mode", + "u8", + 2 + ], + [ + "wid", + "u8", + 12 + ], + [ + "vvs1", + "u8", + 2 + ], + [ + "ch", + "u8", + 8 + ], + [ + "drastate", + "u8", + 0 + ] + ], + "events": [ + "codesdown", + "codesup" + ] + }, + "62": { + "kind": "sl_text", + "prefix": "slt", + "att": [ + [ + "type", + "u8", + 62 + ], + [ + "id", + "u8", + 15 + ], + [ + "objname", + "str", + "slt0" + ], + [ + "vscope", + "u8", + 0 + ], + [ + "drag", + "u8", + 0 + ], + [ + "sendkey", + "u8", + 0 + ], + [ + "aph", + "u8", + 127 + ], + [ + "movex", + "u16", + 0 + ], + [ + "movey", + "u16", + 0 + ], + [ + "x", + "u16", + 0 + ], + [ + "y", + "u16", + 0 + ], + [ + "w", + "u16", + 120 + ], + [ + "h", + "u16", + 120 + ], + [ + "endx", + "u16", + 119 + ], + [ + "endy", + "u16", + 119 + ], + [ + "effect", + "u8", + 0 + ], + [ + "first", + "u8", + 0 + ], + [ + "time", + "u16", + 300 + ], + [ + "lockobj", + "u8", + 0 + ], + [ + "groupid0", + "u32", + 0 + ], + [ + "groupid1", + "u32", + 0 + ], + [ + "sta", + "u8", + 1 + ], + [ + "style", + "u8", + 0 + ], + [ + "key", + "u8", + 255 + ], + [ + "borderc", + "u16", + 0 + ], + [ + "borderw", + "u8", + 2 + ], + [ + "font", + "u8", + 0 + ], + [ + "bco", + "u16", + 65535 + ], + [ + "picc", + "u16", + 65535 + ], + [ + "pic", + "u16", + 65535 + ], + [ + "pco", + "u16", + 0 + ], + [ + "xcen", + "u8", + 0 + ], + [ + "leftshow", + "u8", + 0 + ], + [ + "left", + "u8", + 1 + ], + [ + "ch", + "u8", + 8 + ], + [ + "txt", + "str", + "000\r\n111\r\n222\r\n333\r\n444\r\n666\r\n777\r\n777\r\n888\r\n999" + ], + [ + "txt_maxl", + "u16", + 256 + ], + [ + "isbr", + "u8", + 1 + ], + [ + "spax", + "u8", + 0 + ], + [ + "spay", + "u8", + 0 + ], + [ + "path", + "str", + "" + ], + [ + "path_m", + "u16", + 0 + ], + [ + "maxval_y", + "u32", + 0 + ], + [ + "val_y", + "u32", + 0 + ] + ], + "events": [ + "codesdown", + "codesup" + ] + }, + "63": { + "kind": "file_stream", + "prefix": "fs", + "att": [ + [ + "type", + "u8", + 63 + ], + [ + "id", + "u8", + 18 + ], + [ + "objname", + "str", + "fs0" + ], + [ + "vscope", + "u8", + 0 + ], + [ + "lockobj", + "u8", + 0 + ], + [ + "groupid0", + "u32", + 0 + ], + [ + "groupid1", + "u32", + 0 + ], + [ + "val", + "u32", + 0 + ], + [ + "qty", + "u32", + 0 + ], + [ + "en", + "u8", + 0 + ], + [ + "open", + "u32", + 357 + ], + [ + "read", + "u32", + 869 + ], + [ + "write", + "u32", + 869 + ], + [ + "close", + "u32", + 101 + ], + [ + "find", + "u32", + 357 + ], + [ + "molloc_s", + "u32", + 10752 + ], + [ + "molloc", + "u32", + 10752 + ] + ], + "events": [] + }, + "65": { + "kind": "file_browser", + "prefix": "fbrowser", + "att": [ + [ + "type", + "u8", + 65 + ], + [ + "id", + "u8", + 17 + ], + [ + "objname", + "str", + "fbrowser0" + ], + [ + "vscope", + "u8", + 0 + ], + [ + "drag", + "u8", + 0 + ], + [ + "sendkey", + "u8", + 0 + ], + [ + "aph", + "u8", + 127 + ], + [ + "movex", + "u16", + 0 + ], + [ + "movey", + "u16", + 0 + ], + [ + "x", + "u16", + 0 + ], + [ + "y", + "u16", + 0 + ], + [ + "w", + "u16", + 240 + ], + [ + "h", + "u16", + 240 + ], + [ + "endx", + "u16", + 239 + ], + [ + "endy", + "u16", + 239 + ], + [ + "effect", + "u8", + 0 + ], + [ + "first", + "u8", + 0 + ], + [ + "time", + "u16", + 300 + ], + [ + "lockobj", + "u8", + 0 + ], + [ + "groupid0", + "u32", + 0 + ], + [ + "groupid1", + "u32", + 0 + ], + [ + "sta", + "u8", + 1 + ], + [ + "style", + "u8", + 2 + ], + [ + "borderc", + "u16", + 0 + ], + [ + "borderw", + "u8", + 2 + ], + [ + "font", + "u8", + 0 + ], + [ + "bco", + "u16", + 65535 + ], + [ + "picc", + "u16", + 65535 + ], + [ + "pic", + "u16", + 65535 + ], + [ + "pco", + "u16", + 0 + ], + [ + "pco2", + "u16", + 65535 + ], + [ + "bco2", + "u16", + 31 + ], + [ + "xcen", + "u8", + 1 + ], + [ + "autoleft", + "u8", + 0 + ], + [ + "left", + "u8", + 1 + ], + [ + "ch", + "u8", + 8 + ], + [ + "dir", + "str", + "sd0/" + ], + [ + "dir_m", + "u16", + 255 + ], + [ + "filter", + "str", + "*.*" + ], + [ + "filter_m", + "u16", + 64 + ], + [ + "val", + "u32", + 4294967295 + ], + [ + "txt", + "str", + "" + ], + [ + "txt_m", + "u16", + 255 + ], + [ + "qty", + "u32", + 0 + ], + [ + "dis", + "u8", + 3 + ], + [ + "spax", + "u8", + 24 + ], + [ + "spay", + "u8", + 8 + ], + [ + "maxval_y", + "u32", + 0 + ], + [ + "val_y", + "u32", + 0 + ], + [ + "psta", + "u8", + 1 + ], + [ + "pic1", + "u16", + 1 + ], + [ + "pic2", + "u16", + 2 + ], + [ + "vvs2", + "str", + "" + ], + [ + "vvs2_m", + "u16", + 64 + ], + [ + "buffsize", + "u32", + 32000 + ], + [ + "buff", + "u32", + 0 + ], + [ + "up", + "u32", + 0 + ], + [ + "fwarning", + "u8", + 1 + ] + ], + "events": [ + "codesdown", + "codesup" + ] + }, + "66": { + "kind": "data_record", + "prefix": "data", + "att": [ + [ + "type", + "u8", + 66 + ], + [ + "id", + "u8", + 16 + ], + [ + "objname", + "str", + "data0" + ], + [ + "vscope", + "u8", + 1 + ], + [ + "drag", + "u8", + 0 + ], + [ + "sendkey", + "u8", + 0 + ], + [ + "aph", + "u8", + 127 + ], + [ + "movex", + "u16", + 0 + ], + [ + "movey", + "u16", + 0 + ], + [ + "x", + "u16", + 0 + ], + [ + "y", + "u16", + 0 + ], + [ + "w", + "u16", + 240 + ], + [ + "h", + "u16", + 240 + ], + [ + "endx", + "u16", + 239 + ], + [ + "endy", + "u16", + 239 + ], + [ + "effect", + "u8", + 0 + ], + [ + "first", + "u8", + 0 + ], + [ + "time", + "u16", + 300 + ], + [ + "lockobj", + "u8", + 0 + ], + [ + "groupid0", + "u32", + 0 + ], + [ + "groupid1", + "u32", + 0 + ], + [ + "sta", + "u8", + 1 + ], + [ + "style", + "u8", + 2 + ], + [ + "borderc", + "u16", + 0 + ], + [ + "borderw", + "u8", + 2 + ], + [ + "font", + "u8", + 0 + ], + [ + "bco", + "u16", + 65535 + ], + [ + "picc", + "u16", + 65535 + ], + [ + "pic", + "u16", + 65535 + ], + [ + "pco", + "u16", + 0 + ], + [ + "xcen", + "u8", + 0 + ], + [ + "init", + "u8", + 0 + ], + [ + "path", + "str", + "sd0/1.data" + ], + [ + "path_m", + "u16", + 255 + ], + [ + "lenth", + "u32", + 63 + ], + [ + "maxval", + "u32", + 1000 + ], + [ + "dez", + "u16", + 3 + ], + [ + "format", + "str", + "" + ], + [ + "format_m", + "u16", + 256 + ], + [ + "dir", + "str", + "head0^head1^head2" + ], + [ + "dir_m", + "u16", + 255 + ], + [ + "mode", + "u8", + 1 + ], + [ + "dis", + "u8", + 1 + ], + [ + "order", + "u8", + 0 + ], + [ + "qty", + "u32", + 0 + ], + [ + "spax", + "u8", + 0 + ], + [ + "hig", + "u8", + 32 + ], + [ + "autoleft", + "u8", + 0 + ], + [ + "left", + "u8", + 1 + ], + [ + "gdc", + "u16", + 50712 + ], + [ + "gdw", + "u8", + 1 + ], + [ + "gdh", + "u8", + 1 + ], + [ + "bco1", + "u16", + 23765 + ], + [ + "pco1", + "u16", + 65535 + ], + [ + "bco2", + "u16", + 31 + ], + [ + "pco2", + "u16", + 65535 + ], + [ + "filter", + "str", + "" + ], + [ + "filter_m", + "u16", + 31 + ], + [ + "val", + "u32", + 4294967295 + ], + [ + "txt", + "str", + "" + ], + [ + "txt_m", + "u16", + 255 + ], + [ + "insert", + "u32", + 357 + ], + [ + "delete", + "u32", + 512 + ], + [ + "up", + "u32", + 613 + ], + [ + "clear", + "u32", + 101 + ], + [ + "ch", + "u8", + 8 + ], + [ + "maxval_y", + "u32", + 0 + ], + [ + "val_y", + "u32", + 0 + ], + [ + "maxval_x", + "u32", + 0 + ], + [ + "val_x", + "u32", + 0 + ], + [ + "molloc_s", + "u32", + 10752 + ], + [ + "molloc", + "u32", + 10752 + ] + ], + "events": [ + "codesdown", + "codesup" + ] + }, + "67": { + "kind": "switch", + "prefix": "sw", + "att": [ + [ + "type", + "u8", + 67 + ], + [ + "id", + "u8", + 12 + ], + [ + "objname", + "str", + "sw0" + ], + [ + "vscope", + "u8", + 0 + ], + [ + "drag", + "u8", + 0 + ], + [ + "sendkey", + "u8", + 0 + ], + [ + "aph", + "u8", + 127 + ], + [ + "movex", + "u16", + 0 + ], + [ + "movey", + "u16", + 0 + ], + [ + "x", + "u16", + 0 + ], + [ + "y", + "u16", + 0 + ], + [ + "w", + "u16", + 80 + ], + [ + "h", + "u16", + 30 + ], + [ + "endx", + "u16", + 79 + ], + [ + "endy", + "u16", + 29 + ], + [ + "effect", + "u8", + 0 + ], + [ + "first", + "u8", + 0 + ], + [ + "time", + "u16", + 300 + ], + [ + "lockobj", + "u8", + 0 + ], + [ + "groupid0", + "u32", + 0 + ], + [ + "groupid1", + "u32", + 0 + ], + [ + "dez", + "u8", + 0 + ], + [ + "val", + "u8", + 0 + ], + [ + "bco", + "u16", + 50712 + ], + [ + "pco", + "u16", + 65535 + ], + [ + "bco2", + "u16", + 1024 + ], + [ + "pco2", + "u16", + 65535 + ], + [ + "pco1", + "u16", + 0 + ], + [ + "font", + "u8", + 0 + ], + [ + "dis", + "u8", + 100 + ], + [ + "txt", + "str", + "False/True" + ], + [ + "txt_maxl", + "u16", + 24 + ] + ], + "events": [ + "codesdown", + "codesup" + ] + }, + "68": { + "kind": "text_select", + "prefix": "select", + "att": [ + [ + "type", + "u8", + 68 + ], + [ + "id", + "u8", + 14 + ], + [ + "objname", + "str", + "select0" + ], + [ + "vscope", + "u8", + 0 + ], + [ + "drag", + "u8", + 0 + ], + [ + "sendkey", + "u8", + 0 + ], + [ + "aph", + "u8", + 127 + ], + [ + "movex", + "u16", + 0 + ], + [ + "movey", + "u16", + 0 + ], + [ + "x", + "u16", + 0 + ], + [ + "y", + "u16", + 0 + ], + [ + "w", + "u16", + 90 + ], + [ + "h", + "u16", + 200 + ], + [ + "endx", + "u16", + 89 + ], + [ + "endy", + "u16", + 199 + ], + [ + "effect", + "u8", + 0 + ], + [ + "first", + "u8", + 0 + ], + [ + "time", + "u16", + 300 + ], + [ + "lockobj", + "u8", + 0 + ], + [ + "groupid0", + "u32", + 0 + ], + [ + "groupid1", + "u32", + 0 + ], + [ + "sta", + "u8", + 1 + ], + [ + "style", + "u8", + 0 + ], + [ + "borderc", + "u16", + 0 + ], + [ + "borderw", + "u8", + 2 + ], + [ + "font", + "u8", + 0 + ], + [ + "bco", + "u16", + 65535 + ], + [ + "picc", + "u16", + 65535 + ], + [ + "pic", + "u16", + 65535 + ], + [ + "pco", + "u16", + 0 + ], + [ + "pco2", + "u16", + 31 + ], + [ + "spax", + "u8", + 0 + ], + [ + "hig", + "u8", + 42 + ], + [ + "dis", + "u8", + 1 + ], + [ + "pco1", + "u16", + 31 + ], + [ + "txt", + "str", + "" + ], + [ + "txt_maxl", + "u16", + 255 + ], + [ + "val", + "u32", + 0 + ], + [ + "ch", + "u8", + 8 + ], + [ + "path", + "str", + "01\r\n02\r\n03\r\n04\r\n05\r\n06\r\n07\r\n08\r\n09\r\n10\r\n11\r\n12" + ], + [ + "path_m", + "u16", + 1024 + ] + ], + "events": [ + "codesdown", + "codesup" + ] + }, + "98": { + "kind": "button", + "prefix": "b", + "att": [ + [ + "type", + "u8", + 98 + ], + [ + "id", + "u8", + 33 + ], + [ + "objname", + "str", + "b2" + ], + [ + "vscope", + "u8", + 0 + ], + [ + "drag", + "u8", + 0 + ], + [ + "sendkey", + "u8", + 0 + ], + [ + "aph", + "u8", + 127 + ], + [ + "movex", + "u16", + 0 + ], + [ + "movey", + "u16", + 0 + ], + [ + "x", + "u16", + 0 + ], + [ + "y", + "u16", + 0 + ], + [ + "w", + "u16", + 100 + ], + [ + "h", + "u16", + 50 + ], + [ + "endx", + "u16", + 99 + ], + [ + "endy", + "u16", + 49 + ], + [ + "effect", + "u8", + 0 + ], + [ + "first", + "u8", + 0 + ], + [ + "time", + "u16", + 300 + ], + [ + "lockobj", + "u8", + 0 + ], + [ + "groupid0", + "u32", + 0 + ], + [ + "groupid1", + "u32", + 0 + ], + [ + "sta", + "u8", + 1 + ], + [ + "style", + "u8", + 4 + ], + [ + "borderc", + "u16", + 0 + ], + [ + "borderw", + "u8", + 2 + ], + [ + "font", + "u8", + 0 + ], + [ + "pic", + "u16", + 65535 + ], + [ + "picc", + "u16", + 65535 + ], + [ + "bco", + "u16", + 50712 + ], + [ + "pic2", + "u16", + 65535 + ], + [ + "picc2", + "u16", + 65535 + ], + [ + "bco2", + "u16", + 1024 + ], + [ + "pco", + "u16", + 0 + ], + [ + "pco2", + "u16", + 65535 + ], + [ + "xcen", + "u8", + 1 + ], + [ + "ycen", + "u8", + 1 + ], + [ + "val", + "u8", + 0 + ], + [ + "txt", + "str", + "newtxt" + ], + [ + "txt_maxl", + "u16", + 10 + ], + [ + "isbr", + "u8", + 0 + ], + [ + "spax", + "u8", + 0 + ], + [ + "spay", + "u8", + 0 + ] + ], + "events": [ + "codesdown", + "codesup" + ] + }, + "106": { + "kind": "progress_bar", + "prefix": "j", + "att": [ + [ + "type", + "u8", + 106 + ], + [ + "id", + "u8", + 34 + ], + [ + "objname", + "str", + "j0" + ], + [ + "vscope", + "u8", + 0 + ], + [ + "drag", + "u8", + 0 + ], + [ + "sendkey", + "u8", + 0 + ], + [ + "aph", + "u8", + 127 + ], + [ + "movex", + "u16", + 0 + ], + [ + "movey", + "u16", + 0 + ], + [ + "x", + "u16", + 0 + ], + [ + "y", + "u16", + 0 + ], + [ + "w", + "u16", + 128 + ], + [ + "h", + "u16", + 30 + ], + [ + "endx", + "u16", + 127 + ], + [ + "endy", + "u16", + 29 + ], + [ + "effect", + "u8", + 0 + ], + [ + "first", + "u8", + 0 + ], + [ + "time", + "u16", + 300 + ], + [ + "lockobj", + "u8", + 0 + ], + [ + "groupid0", + "u32", + 0 + ], + [ + "groupid1", + "u32", + 0 + ], + [ + "sta", + "u8", + 0 + ], + [ + "dez", + "u8", + 0 + ], + [ + "val", + "u8", + 50 + ], + [ + "dis", + "u8", + 25 + ], + [ + "bco", + "u16", + 48631 + ], + [ + "bpic", + "u16", + 65535 + ], + [ + "pco", + "u16", + 1024 + ], + [ + "ppic", + "u16", + 65535 + ] + ], + "events": [ + "codesdown", + "codesup" + ] + }, + "109": { + "kind": "hotspot", + "prefix": "m", + "att": [ + [ + "type", + "u8", + 109 + ], + [ + "id", + "u8", + 37 + ], + [ + "objname", + "str", + "m0" + ], + [ + "vscope", + "u8", + 0 + ], + [ + "drag", + "u8", + 0 + ], + [ + "sendkey", + "u8", + 0 + ], + [ + "aph", + "u8", + 127 + ], + [ + "movex", + "u16", + 0 + ], + [ + "movey", + "u16", + 0 + ], + [ + "x", + "u16", + 0 + ], + [ + "y", + "u16", + 0 + ], + [ + "w", + "u16", + 60 + ], + [ + "h", + "u16", + 60 + ], + [ + "endx", + "u16", + 59 + ], + [ + "endy", + "u16", + 59 + ], + [ + "effect", + "u8", + 0 + ], + [ + "first", + "u8", + 0 + ], + [ + "time", + "u16", + 300 + ], + [ + "lockobj", + "u8", + 0 + ], + [ + "groupid0", + "u32", + 0 + ], + [ + "groupid1", + "u32", + 0 + ] + ], + "events": [ + "codesdown", + "codesup" + ] + }, + "112": { + "kind": "picture", + "prefix": "p", + "att": [ + [ + "type", + "u8", + 112 + ], + [ + "id", + "u8", + 35 + ], + [ + "objname", + "str", + "p0" + ], + [ + "vscope", + "u8", + 0 + ], + [ + "drag", + "u8", + 0 + ], + [ + "sendkey", + "u8", + 0 + ], + [ + "aph", + "u8", + 127 + ], + [ + "movex", + "u16", + 0 + ], + [ + "movey", + "u16", + 0 + ], + [ + "x", + "u16", + 0 + ], + [ + "y", + "u16", + 0 + ], + [ + "w", + "u16", + 60 + ], + [ + "h", + "u16", + 60 + ], + [ + "endx", + "u16", + 59 + ], + [ + "endy", + "u16", + 59 + ], + [ + "effect", + "u8", + 0 + ], + [ + "first", + "u8", + 0 + ], + [ + "time", + "u16", + 300 + ], + [ + "lockobj", + "u8", + 0 + ], + [ + "groupid0", + "u32", + 0 + ], + [ + "groupid1", + "u32", + 0 + ], + [ + "pic", + "u16", + 65535 + ] + ], + "events": [ + "codesdown", + "codesup" + ] + }, + "113": { + "kind": "crop", + "prefix": "q", + "att": [ + [ + "type", + "u8", + 113 + ], + [ + "id", + "u8", + 36 + ], + [ + "objname", + "str", + "q0" + ], + [ + "vscope", + "u8", + 0 + ], + [ + "drag", + "u8", + 0 + ], + [ + "sendkey", + "u8", + 0 + ], + [ + "aph", + "u8", + 127 + ], + [ + "movex", + "u16", + 0 + ], + [ + "movey", + "u16", + 0 + ], + [ + "x", + "u16", + 0 + ], + [ + "y", + "u16", + 0 + ], + [ + "w", + "u16", + 60 + ], + [ + "h", + "u16", + 60 + ], + [ + "endx", + "u16", + 59 + ], + [ + "endy", + "u16", + 59 + ], + [ + "effect", + "u8", + 0 + ], + [ + "first", + "u8", + 0 + ], + [ + "time", + "u16", + 300 + ], + [ + "lockobj", + "u8", + 0 + ], + [ + "groupid0", + "u32", + 0 + ], + [ + "groupid1", + "u32", + 0 + ], + [ + "picc", + "u16", + 65535 + ], + [ + "vvs0", + "u16", + 0 + ], + [ + "vvs1", + "u16", + 0 + ] + ], + "events": [ + "codesdown", + "codesup" + ] + }, + "116": { + "kind": "text", + "prefix": "t", + "att": [ + [ + "type", + "u8", + 116 + ], + [ + "id", + "u8", + 29 + ], + [ + "objname", + "str", + "t2" + ], + [ + "vscope", + "u8", + 0 + ], + [ + "drag", + "u8", + 0 + ], + [ + "sendkey", + "u8", + 0 + ], + [ + "aph", + "u8", + 127 + ], + [ + "movex", + "u16", + 0 + ], + [ + "movey", + "u16", + 0 + ], + [ + "x", + "u16", + 0 + ], + [ + "y", + "u16", + 0 + ], + [ + "w", + "u16", + 100 + ], + [ + "h", + "u16", + 30 + ], + [ + "endx", + "u16", + 99 + ], + [ + "endy", + "u16", + 29 + ], + [ + "effect", + "u8", + 0 + ], + [ + "first", + "u8", + 0 + ], + [ + "time", + "u16", + 300 + ], + [ + "lockobj", + "u8", + 0 + ], + [ + "groupid0", + "u32", + 0 + ], + [ + "groupid1", + "u32", + 0 + ], + [ + "sta", + "u8", + 1 + ], + [ + "style", + "u8", + 0 + ], + [ + "key", + "u8", + 255 + ], + [ + "borderc", + "u16", + 0 + ], + [ + "borderw", + "u8", + 2 + ], + [ + "font", + "u8", + 0 + ], + [ + "bco", + "u16", + 65535 + ], + [ + "picc", + "u16", + 65535 + ], + [ + "pic", + "u16", + 65535 + ], + [ + "pco", + "u16", + 0 + ], + [ + "xcen", + "u8", + 1 + ], + [ + "ycen", + "u8", + 1 + ], + [ + "pw", + "u8", + 0 + ], + [ + "txt", + "str", + "newtxt" + ], + [ + "txt_maxl", + "u16", + 10 + ], + [ + "isbr", + "u8", + 0 + ], + [ + "spax", + "u8", + 0 + ], + [ + "spay", + "u8", + 0 + ] + ], + "events": [ + "codesdown", + "codesup" + ] + }, + "121": { + "kind": "page", + "prefix": "page", + "att": [ + [ + "type", + "u8", + 121 + ], + [ + "id", + "u8", + 0 + ], + [ + "objname", + "str", + "page0" + ], + [ + "vscope", + "u8", + 0 + ], + [ + "drag", + "u8", + 0 + ], + [ + "sendkey", + "u8", + 0 + ], + [ + "aph", + "u8", + 127 + ], + [ + "movex", + "u16", + 0 + ], + [ + "movey", + "u16", + 0 + ], + [ + "x", + "u16", + 0 + ], + [ + "y", + "u16", + 0 + ], + [ + "w", + "u16", + 272 + ], + [ + "h", + "u16", + 480 + ], + [ + "endx", + "u16", + 271 + ], + [ + "endy", + "u16", + 479 + ], + [ + "effect", + "u8", + 0 + ], + [ + "first", + "u8", + 0 + ], + [ + "time", + "u16", + 300 + ], + [ + "lockobj", + "u8", + 0 + ], + [ + "groupid0", + "u32", + 0 + ], + [ + "groupid1", + "u32", + 0 + ], + [ + "up", + "u8", + 255 + ], + [ + "down", + "u8", + 255 + ], + [ + "left", + "u8", + 255 + ], + [ + "right", + "u8", + 255 + ], + [ + "sta", + "u8", + 1 + ], + [ + "bco", + "u16", + 65535 + ], + [ + "pic", + "u16", + 0 + ] + ], + "events": [ + "codesload", + "codesloadend", + "codesdown", + "codesup", + "codesunload" + ] + }, + "122": { + "kind": "gauge", + "prefix": "z", + "att": [ + [ + "type", + "u8", + 122 + ], + [ + "id", + "u8", + 39 + ], + [ + "objname", + "str", + "z0" + ], + [ + "vscope", + "u8", + 0 + ], + [ + "drag", + "u8", + 0 + ], + [ + "sendkey", + "u8", + 0 + ], + [ + "aph", + "u8", + 127 + ], + [ + "movex", + "u16", + 0 + ], + [ + "movey", + "u16", + 0 + ], + [ + "x", + "u16", + 0 + ], + [ + "y", + "u16", + 0 + ], + [ + "w", + "u16", + 220 + ], + [ + "h", + "u16", + 220 + ], + [ + "endx", + "u16", + 219 + ], + [ + "endy", + "u16", + 219 + ], + [ + "effect", + "u8", + 0 + ], + [ + "first", + "u8", + 0 + ], + [ + "time", + "u16", + 300 + ], + [ + "lockobj", + "u8", + 0 + ], + [ + "groupid0", + "u32", + 0 + ], + [ + "groupid1", + "u32", + 0 + ], + [ + "sta", + "u8", + 3 + ], + [ + "picc", + "u16", + 65535 + ], + [ + "bco", + "u16", + 65535 + ], + [ + "pic", + "u16", + 65535 + ], + [ + "val", + "u16", + 0 + ], + [ + "format", + "u16", + 0 + ], + [ + "up", + "u16", + 32767 + ], + [ + "down", + "u16", + 30 + ], + [ + "left", + "u16", + 0 + ], + [ + "pco", + "u16", + 1024 + ], + [ + "pco2", + "u16", + 63488 + ], + [ + "hig", + "u8", + 24 + ], + [ + "wid", + "u8", + 2 + ], + [ + "vvs0", + "u8", + 1 + ], + [ + "vvs1", + "u8", + 7 + ], + [ + "vvs2", + "u8", + 2 + ] + ], + "events": [ + "codesdown", + "codesup" + ] + } + } +} \ No newline at end of file diff --git a/src/nxhmi/tft.py b/src/nxhmi/tft.py new file mode 100644 index 0000000..c8c24e6 --- /dev/null +++ b/src/nxhmi/tft.py @@ -0,0 +1,54 @@ +"""Nextion .tft (compiled firmware) -- research-stage helpers. See docs/NOTES.md. + +Only what is verified is implemented here: + +* the obfuscated layout table at 0xC8..0x113 is XOR 0xEBAB2932 per 32-bit word; +* the trailer (last 4 bytes, LE) is a word-per-byte CRC whose stream ends at the trailer -- so + for edits that keep the file length, the trailer can be updated by linearity + (:func:`patch_trailer`). Building a .tft from scratch is not possible yet: the trailer's start + offset / seed are unknown, and every .tft embeds Nextion's own firmware files, which this + project does not and must not distribute. +""" +from __future__ import annotations + +import struct + +from .checksum import _feed_byte_as_word, _feed_word + +LAYOUT_KEY = 0xEBAB2932 +LAYOUT_START, LAYOUT_END = 0xC8, 0x114 + + +def layout_table(tft: bytes) -> list[int]: + """De-obfuscated words of the layout table (offsets/sizes/counts).""" + return [struct.unpack_from(" dict: + return { + "width": struct.unpack_from(" int: + for _ in range(n): + c = _feed_word(c, 0) + return c + + +def patch_trailer(old: bytes, new: bytes) -> bytes: + """Return ``new`` with its trailer CRC updated, given the Editor-made ``old`` of the same length.""" + if len(old) != len(new): + raise ValueError("only same-length edits are supported") + n = len(new) - 4 + delta = 0 + for j in range(n): + d = old[j] ^ new[j] + if d: + delta ^= _zero_words(n - 1 - j, _feed_byte_as_word(0, d)) + crc = struct.unpack_from("> 3, r >> 3) + + def test_editor_pictures_decode(self): + h = HMIFile.load(FIXTURE) + for n in h.names(): + if n.endswith(".i"): + self.assertEqual(pictures.info(h.read(n))["format"], 0) + + +class Fonts(unittest.TestCase): + def test_rle_roundtrip_random(self): + random.seed(3) + for _ in range(60): + w, h = random.choice([(8, 16), (16, 32), (12, 24), (5, 7)]) + rows = [[1 if random.random() < 0.35 else 0 for _ in range(w)] for _ in range(h)] + self.assertEqual(fonts.decode_glyph(b"\x01" + fonts.encode_glyph(rows, w, h), w, h), rows) + + def test_codes(self): + # pixels are scanned per column from the bottom row up; rows are returned top -> bottom + col = [r[0] for r in fonts.decode_glyph(b"\x01\x7e", 1, 32)] # 01 1 11110: 30 transparent, 2 ink + self.assertEqual(col, [1, 1] + [0] * 30) + self.assertEqual(fonts.decode_glyph(b"\x01\x22", 1, 2), [[1], [1]]) # 00 1 00010: 2 ink + self.assertEqual(fonts.decode_glyph(b"\x01\x02\x41", 1, 4), [[1], [0], [0], [0]]) # 2 t, then 01 0: 1 t + 1 ink + self.assertEqual(fonts.decode_glyph(b"\x01\xca", 1, 4), [[0], [1], [1], [0]]) # 11 001 010: 1 t + 2 ink + self.assertEqual(fonts.decode_glyph(b"\x01\x84", 1, 7), [[1], [1], [1], [0], [0], [0], [0]]) # 10 0: 4 t + 3 ink + + def test_font_pack_parse(self): + f = fonts.Font("T-8", 8, 8, 1, 0x20, 0x21, [fonts.Glyph(0x20, 8, [[0] * 8 for _ in range(8)]), + fonts.Glyph(0x21, 4, [[1, 0, 0, 1] for _ in range(8)])]) + g = fonts.Font.parse(f.pack()) + self.assertEqual((g.name, g.glyph("!").width, g.glyph("!").pixels), ("T-8", 4, f.glyphs[1].pixels)) + + def test_editor_fonts_reencode_identical(self): + h = HMIFile.load(FIXTURE) + for n in h.names(): + if n.endswith(".zi"): + blob = h.read(n) + self.assertEqual(fonts.Font.parse(blob).pack(), blob, n) + + @unittest.skipUnless(HAVE_PIL, "needs Pillow") + def test_from_ttf_default_font(self): + f = fonts.from_ttf(None, 20) + self.assertEqual(len(f.glyphs), 95) + self.assertTrue(any(any(r) for r in f.glyph("A").pixels)) + self.assertFalse(any(any(r) for r in f.glyph(" ").pixels)) + self.assertEqual(fonts.Font.parse(f.pack()).name, "Aileron-20ascii") + + +if __name__ == "__main__": + unittest.main() diff --git a/tests/test_page.py b/tests/test_page.py new file mode 100644 index 0000000..0a9d6a8 --- /dev/null +++ b/tests/test_page.py @@ -0,0 +1,64 @@ +import unittest + +from helpers import FIXTURE + +from nxhmi.container import HMIFile +from nxhmi.page import Attr, Component, Group, Page + + +def small_page(): + pc = Component([Group("att", [Attr.encode("type", "u8", 121), Attr.encode("id", "u8", 0), + Attr.encode("objname", "str", "p0"), Attr.encode("w", "u16", 480)]), + Group("codesload", []), Group("codesdown", [b"page 1"])]) + t = Component([Group("att", [Attr.encode("type", "u8", 116), Attr.encode("id", "u8", 1), + Attr.encode("objname", "str", "t0"), Attr.encode("txt", "str", "hi"), + Attr.encode("txt_maxl", "u16", 10), Attr.encode("dir", "u8", 1)])]) + return Page("p0", [pc, t]) + + +class PageModel(unittest.TestCase): + def test_roundtrip(self): + blob = small_page().pack() + self.assertEqual(Page.parse(blob).pack(), blob) + + def test_checksum_verified_on_parse(self): + blob = bytearray(small_page().pack()) + blob[-5] ^= 1 + with self.assertRaises(ValueError): + Page.parse(bytes(blob)) + Page.parse(bytes(blob), verify=False) + + def test_header_fields(self): + p = Page.parse(small_page().pack()) + self.assertEqual((p.name, p.b21, p.version), ("p0", 0x4F, 0x21)) + self.assertEqual(len(p.components), 2) + + def test_string_detection_by_companion(self): + t = Page.parse(small_page().pack()).component("t0") + self.assertEqual(t.attr("txt").decoded()[0], "str") # has txt_maxl + self.assertEqual(t.attr("dir").decoded(), ("u8", 1)) # no dir_m -> number + self.assertEqual(t.attr("objname").decoded()[0], "str") + + def test_set_get_and_grow(self): + p = Page.parse(small_page().pack()) + t = p.component("t0") + t.set("txt", "a much longer text") + t.set_event("codesdown", ["click t0,1", "page 0"]) + q = Page.parse(p.pack()) + self.assertEqual(q.component("t0").get("txt"), "a much longer text") + self.assertEqual(q.component("t0").event("codesdown"), ["click t0,1", "page 0"]) + + def test_signed_values(self): + a = Attr.encode("val", "u32", -1234567) + self.assertEqual(a.value, (-1234567 & 0xFFFFFFFF).to_bytes(4, "little")) + + def test_editor_pages_roundtrip(self): + h = HMIFile.load(FIXTURE) + for e in h.live(): + if e.name.endswith(".pa"): + blob = h.read(e.name) + self.assertEqual(Page.parse(blob).pack(), blob, e.name) + + +if __name__ == "__main__": + unittest.main() diff --git a/tests/test_project.py b/tests/test_project.py new file mode 100644 index 0000000..fd75d9e --- /dev/null +++ b/tests/test_project.py @@ -0,0 +1,115 @@ +import json +import os +import shutil +import struct +import tempfile +import unittest + +from helpers import FIXTURE, HAVE_PIL, demo_project + +from nxhmi import checksum, models, project +from nxhmi.container import HMIFile +from nxhmi.page import Page + + +class NewProject(unittest.TestCase): + def test_new_project(self): + h = project.new_project("NX4832T035_011", "start") + self.assertEqual(h.names(), ["main.HMI", "Program.s", "0.pa"]) + main = h.read("main.HMI") + self.assertEqual(checksum.main_crc(main), struct.unpack_from(" nothing drawn + img = self.render(p) + self.assertEqual(img.getpixel((10, 0)), (255, 255, 255)) + + def test_waveform_grid_from_bottom(self): + p = C.new_page("p", w=100, h=100) + C.add(p, "waveform", x=0, y=0, w=50, h=50, gdw=20, gdh=20, gdc=0x07E0, sta=1, bco=0) + img = self.render(p) + self.assertEqual(img.getpixel((5, 49)), (0, 255, 0)) # bottom row is a grid line + self.assertEqual(img.getpixel((5, 29)), (0, 255, 0)) + self.assertEqual(img.getpixel((5, 0)), (0, 0, 0)) + + def test_checkbox(self): + p = C.new_page("p", w=100, h=100) + C.add(p, "checkbox", x=0, y=0, w=40, h=40, val=1, bco=0xFFFF, pco=0x001F, style=0) + img = self.render(p) + self.assertEqual(img.getpixel((10, 10)), (0, 0, 255)) + self.assertEqual(img.getpixel((9, 9)), (255, 255, 255)) + self.assertEqual(img.getpixel((29, 29)), (0, 0, 255)) + self.assertEqual(img.getpixel((30, 30)), (255, 255, 255)) + + def test_dual_state_on_is_pressed(self): + p = C.new_page("p", w=60, h=40) + C.add(p, "dual_state_button", x=0, y=0, w=50, h=30, val=1, style=4, sta=1, txt="") + img = self.render(p) + self.assertEqual(img.getpixel((10, 0)), (65, 68, 65)) # dark top edge when on + + def test_demo_pages_render(self): + from nxhmi.render import Renderer + r = Renderer(HMIFile.load(FIXTURE)) + for name in ("home", "controls", "gallery"): + img = r.render(name) + self.assertEqual(img.size, (480, 320)) + self.assertEqual(r.render("home").getpixel((0, 319)), r.pic(0).getpixel((0, 319))) + + def test_text_clamped_inside_box(self): + from nxhmi import fonts, project + from nxhmi.render import Renderer + h = project.new_project() + fid = project.add_font(h, fonts.from_ttf(None, 32)) + from nxhmi.page import Page + p = Page.parse(h.read("0.pa")) + C.add(p, "text", x=0, y=0, w=200, h=20, txt="Hg", font=fid, ycen=1, sta=1, bco=0xFFFF, pco=0) + h.write("0.pa", p.pack()) + img = Renderer(h).render("page0") + ink_rows = [y for y in range(20) if any(img.getpixel((x, y)) == (0, 0, 0) for x in range(200))] + self.assertTrue(ink_rows and ink_rows[0] >= 0) + self.assertEqual(img.getpixel((10, 25)), (255, 255, 255)) # nothing drawn below the box + + +if __name__ == "__main__": + unittest.main() diff --git a/tests/test_tft_cli.py b/tests/test_tft_cli.py new file mode 100644 index 0000000..57c08f3 --- /dev/null +++ b/tests/test_tft_cli.py @@ -0,0 +1,91 @@ +import contextlib +import io +import os +import shutil +import struct +import tempfile +import unittest + +from helpers import FIXTURE, HAVE_PIL, bitwise_word_crc + +from nxhmi import cli, tft + + +def fake_tft(payload: bytes) -> bytes: + """A synthetic .tft-shaped blob: layout table + trailer CRC computed the way the trailer behaves + (word-per-byte CRC whose stream ends at the trailer). Real .tft files cannot be used in tests: + they contain Nextion's firmware.""" + head = bytearray(0x200) + struct.pack_into(" %s" % (len(types), out)) + + +if __name__ == "__main__": + main(*sys.argv[1:5])