diff --git a/CLAUDE.md b/CLAUDE.md index d919c35..74f1e9c 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -75,16 +75,22 @@ editor/core/ etc2.ts cf 28 (ETC2 RGBA8) block codec budget.ts what a screen takes in a Watch 3 Pro's RAM (SCREEN_BUDGET) fit.ts fitForWatch: the file shrunk in RAM before it goes to a watch + compat.ts which watch and firmware a face may go to: widgets (raw bytes), A8, ETC2 raw.ts Face/FaceNode/Resource + TAG + byte primitives document/ # the document the editor edits doc.ts Doc/Layer/Screen, meta + condition decoding, fromLegacy/toLegacy edits.ts pure Doc -> Doc edits: add/remove/move/group/patch factory.ts the layers the editor creates from scratch, and a blank document sources.ts data sources: id labels, Sim, idValue, slot/condition helpers + proc.ts the Watch 3 Pro's procedural widgets (0x82 + 0x5c) as layers + support.ts where the open face can go — the editor's note, by compat.ts's rule + pro2.ts the converted copy Export for Watch Pro 2 downloads render/ render.ts draw a screen from a Doc: per-kind draw functions + group auto-layout canvas.ts renderer types (Ctx/Point/Size/LayerHit/ImageStore) arc.ts progress rings: 0x5a/0x5b spec, fill fraction, both draw paths + proc-scene.ts types 4..7's layout, a port of cmf-watch-sdk's wfproc.rs — change them together + proc.ts the simulator's values fed to that layout, and its drawing pixels.ts asset pixels: decode, resize/adjust, accent tint, previews screen.ts screen and panel dimensions overlay.ts editor chrome over a screen: selection boxes, handles, snap guides @@ -101,6 +107,15 @@ device/lib/ wp2.ts # what the App Loader stub reports: its release, the loader, the apps by slot ``` +Every watchface install ends in `flashFx` (`ble.model`): `fitForWatch`, `assertFlashable`, then +`assertWatchCompat` (`core/format/compat.ts`) on the bytes that go out. The last one reads the raw +file as the firmware's parser does, because a wrong verdict is a boot loop: never move it onto +`parseBin`'s tree, and don't add a way to send a face around it. `PRO2_FACES_STUB` stays null +until a stub release that draws types 4..7 has its number reserved in cmf-watch-sdk and is tried +on a real watch, and a Watch Pro 2 gets no cf 14 until that is seen working on one. A procedural +layer's rules (fixed image count, type 4 doesn't move, no rescale) live in `edits.ts` `procPatch` +and `overlay.ts` `resizable`. + `Face`/`FaceNode` are the file's own shape, not the editor's: `parseBin` produces them, `fromLegacy` turns them into a `Doc`, `toLegacy` turns one back, and the importers build them because that is the cheapest target to convert into. Nothing else should touch them — the editor diff --git a/docs/cmf-protocol.md b/docs/cmf-protocol.md index 36ada97..3c6de20 100644 --- a/docs/cmf-protocol.md +++ b/docs/cmf-protocol.md @@ -223,6 +223,42 @@ undocumented beyond this note. If a face is known (from the real device/app) to color but the editor doesn't offer/apply it, check `meta[7]` on the specific widget by hand first — that's the only thing that's mattered so far. +### Watch 3 Pro procedural widgets (0x82 + 0x5c) + +A `0x82` widget's first child is its struct (tag 1); a `0x5c` child holds the type as a u16 at +0 +and, for type 6, the panel as a u8 at +0x14. Both bodies are leaves: never descend into them. + +| type | face | what it draws | images | +| ---- | ---------------- | ------------------------------------------------------------- | --------------------------- | +| 4 | Rainbow Lollipop | the ring under the finger, around the screen's centre | none | +| 5 | Briqbot | clips at 33 ms a frame (0..39, 40..89, 90..158), tap for next | 159 | +| 6 | DataPulse | panel 0 weather, 1 heart rate, 2 SpO2, 3 stress, 4 sleep | 88 for panel 0, 13 for rest | +| 7 | Luminous Beam | percent of the calorie goal, three rotated digits | 10 | + +The layout is in `core/render/proc-scene.ts`. Where each type may be installed is in +`core/format/compat.ts`, and it is a boot-loop matter: + +- both firmwares compare the u16 against a table ending in `0xffff` with a loop that stops at + `0xff`. A Watch Pro 2 (1.0.0.73) has types 0..3, a Watch 3 Pro (1.0.1.77) 0..7. A type past the + table calls whatever matches further on (8 and `0xffff` fault both in the emulator) or, by + chance, nothing (12). Don't rely on the chance. +- the parser looks the first image up at the widget's fixed offset +0x15 from the struct node's + start, whatever that struct's length. A Pro 2 drops a type 4 that has no list there. A short + struct (18 bytes, no 2 bytes of padding) followed by a condition does have one as far as the + firmware is concerned, and boot-loops it: keep the `0000` tail. + +A Watch Pro 2 is also refused any cf 14 (A8) resource, the thumbnail included, until A8 has been +seen on a real one: the emulator stops on faces that use it. Export for Watch Pro 2 re-encodes it as +cf 5. + +Sources only a Watch 3 Pro has run 0x8e..0x9d. Known: `0x93` the minutes of last night's sleep, +`0x99` the number of the face's colour theme. A themed layer (meta[7] = 4) takes the theme the +wearer picked, else the palette entry numbered by meta[4]; the two watches' palettes differ (Pro 2 +0x101FF59C, ten colours; 3 Pro 0x10235316, seven), and FMC renumbers neither. + +Colours in the 3 Pro emulator's frames are no reference for tinted layers: they come out with red +and blue swapped against the palette and the factory thumbnails. + ### Hard resource-packing rule **Every node's `images` array must reference _consecutive_ resource-array indices.** diff --git a/src/lib/modules/device/components/dev-sheet.svelte b/src/lib/modules/device/components/dev-sheet.svelte index 7618130..c493fd4 100644 --- a/src/lib/modules/device/components/dev-sheet.svelte +++ b/src/lib/modules/device/components/dev-sheet.svelte @@ -106,7 +106,7 @@ {#if firmware}
- {$t.firmwareRisk} + {$t.firmwareRisk} {$t.rollbackRisk}