From 845f568730e687011640906d23c5f4c4eae4af02 Mon Sep 17 00:00:00 2001 From: Egor Kolesnikov Date: Sun, 22 Nov 2026 23:39:33 +0200 Subject: [PATCH] Convert A8 and ETC2 for a Watch Pro 2 on install fitForWatch now does what Export for Watch Pro 2 does by hand: on the way to a Watch Pro 2, cf 14 and cf 28 resources (the thumbnail included) become cf 5, and an opaque one goes on to cf 4. It does so only while every screen stays within the 1.955 MB tested there; the gate refuses a face too heavy to convert, and says by how much. The editor and the store tell the user how many images were converted. On the 939 published faces, 75 of the 80 with A8 now install on a Watch Pro 2 directly; 6 are still refused (5 too heavy, 1 ETC2). PRO2_FACES_STUB's comment names the planned release: stub 11. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01CQSU8M433m4WAvWEbAKocd --- CLAUDE.md | 7 +-- docs/cmf-protocol.md | 10 ++- src/lib/modules/device/i18n.ts | 10 +++ src/lib/modules/device/messages.ts | 14 +++++ src/lib/modules/device/model/ble.model.ts | 13 +++- .../modules/editor/core/document/support.ts | 3 +- src/lib/modules/editor/core/format/compat.ts | 28 ++++++--- src/lib/modules/editor/core/format/fit.ts | 36 +++++++++-- .../modules/editor/core/format/fit.worker.ts | 6 +- src/lib/modules/editor/i18n.ts | 10 +-- src/lib/modules/editor/pages/editor.svelte | 3 + src/lib/modules/market/pages/watchface.svelte | 3 + tests/face-budget.test.ts | 2 +- tests/face-compat.test.ts | 15 ++++- tests/fit-pro2.test.ts | 62 +++++++++++++++++++ tests/flash-compat.browser.test.ts | 12 ++-- 16 files changed, 193 insertions(+), 41 deletions(-) create mode 100644 tests/fit-pro2.test.ts diff --git a/CLAUDE.md b/CLAUDE.md index 74f1e9c..4334d34 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -111,10 +111,9 @@ Every watchface install ends in `flashFx` (`ble.model`): `fitForWatch`, `assertF `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`. +until the stub release that draws types 4..7 (planned as 11) is out and tried on a real watch, and a Watch Pro 2 gets no cf 14 as it is until that is seen working on one +(`fitForWatch` converts it, with ETC2, to cf 5 on the way). 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 diff --git a/docs/cmf-protocol.md b/docs/cmf-protocol.md index 3c6de20..6d02efb 100644 --- a/docs/cmf-protocol.md +++ b/docs/cmf-protocol.md @@ -247,9 +247,13 @@ The layout is in `core/render/proc-scene.ts`. Where each type may be installed i 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. +A Watch Pro 2 never gets a cf 14 (A8) resource as it is, the thumbnail included, until A8 has been +seen on a real one: the emulator stops on faces that use it. `fitForWatch` re-encodes A8 and ETC2 as +cf 5 on the way to a Pro 2 (and Export for Watch Pro 2 in a file), as long as every screen then stays +within the 1.955 MB tested there; the gate refuses the rest. + +A Watch Pro 2 draws types 4..7 with the stub release planned as 11 (cmf-watch-sdk); until it is out +and tried on a real watch, `PRO2_FACES_STUB` keeps them off every Pro 2. 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 diff --git a/src/lib/modules/device/i18n.ts b/src/lib/modules/device/i18n.ts index 0275f2e..97af7cb 100644 --- a/src/lib/modules/device/i18n.ts +++ b/src/lib/modules/device/i18n.ts @@ -132,6 +132,8 @@ export const t = dict( help: helpEn, backToFaces: "Back to the watchfaces", // after a flash that had to compress images (bleModel.$fitNote) + convertNote: (n: number) => + `${n} ${n === 1 ? "image was" : "images were"} converted to a format the Watch Pro 2 draws — Watch 3 Pro images it can't show as they are.`, fitNote: (n: number) => `${n} ${n === 1 ? "image was" : "images were"} compressed to fit the watch's memory — they can look slightly softer than in the editor.`, }, @@ -252,6 +254,8 @@ export const t = dict( helpTitle: "Перед подключением — FMC", helpDescription: "Что FMC делает с вашими часами CMF, чего он не умеет и как решить конфликт Bluetooth с приложением Nothing X.", + convertNote: (n) => + `${n} ${plural("ru", n, { one: "изображение переведено", few: "изображения переведены", many: "изображений переведено" })} в формат, который рисует Watch Pro 2: в исходном формате Watch 3 Pro эти часы их не показывают.`, fitNote: (n: number) => `${n} ${plural("ru", n, { one: "изображение сжато", few: "изображения сжаты", many: "изображений сжато" })}, чтобы циферблат поместился в память часов — на часах они могут выглядеть чуть мягче, чем в редакторе.`, help: helpRu, @@ -375,6 +379,8 @@ export const t = dict( helpTitle: "Перед підключенням — FMC", helpDescription: "Що FMC робить з вашим годинником CMF, чого він не вміє і як усунути конфлікт Bluetooth із застосунком Nothing X.", + convertNote: (n) => + `${n} ${plural("uk", n, { one: "зображення переведено", few: "зображення переведено", many: "зображень переведено" })} у формат, який малює Watch Pro 2: у вихідному форматі Watch 3 Pro цей годинник їх не показує.`, fitNote: (n: number) => `${n} ${plural("uk", n, { one: "зображення стиснуто", few: "зображення стиснуто", many: "зображень стиснуто" })}, щоб циферблат помістився в пам'ять годинника — на годиннику вони можуть виглядати трохи м'якше, ніж у редакторі.`, help: helpUk, @@ -499,6 +505,8 @@ export const t = dict( helpTitle: "Antes de conectar — FMC", helpDescription: "Qué le hace FMC a tu reloj CMF, qué no puede hacer y cómo resolver el conflicto de Bluetooth con la app Nothing X.", + convertNote: (n) => + `${n} ${plural("es", n, { one: "imagen se convirtió", other: "imágenes se convirtieron" })} a un formato que el Watch Pro 2 dibuja: en el formato original del Watch 3 Pro no las muestra.`, fitNote: (n: number) => `${n} ${plural("es", n, { one: "imagen se comprimió", other: "imágenes se comprimieron" })} para que la esfera quepa en la memoria del reloj — pueden verse algo más suaves que en el editor.`, help: helpEs, @@ -618,6 +626,8 @@ export const t = dict( helpTitle: "कनेक्ट करने से पहले — FMC", helpDescription: "FMC आपकी CMF घड़ी के साथ क्या करता है, क्या नहीं कर सकता, और Nothing X ऐप के साथ Bluetooth की टक्कर कैसे ठीक करें।", + convertNote: (n) => + `${n} इमेज ऐसे फ़ॉर्मेट में बदली गईं जिसे Watch Pro 2 दिखाता है: Watch 3 Pro के मूल फ़ॉर्मेट में यह घड़ी उन्हें नहीं दिखाती।`, fitNote: (n: number) => `घड़ी की मेमोरी में फ़ेस फ़िट करने के लिए ${n} इमेज कंप्रेस की गईं — घड़ी पर वे एडिटर से थोड़ी धुंधली दिख सकती हैं।`, help: helpHi, diff --git a/src/lib/modules/device/messages.ts b/src/lib/modules/device/messages.ts index 429d6f9..df31ca4 100644 --- a/src/lib/modules/device/messages.ts +++ b/src/lib/modules/device/messages.ts @@ -74,6 +74,8 @@ const en = { `this face has a widget of type ${type}, which no supported watch knows — it can restart a watch in a loop. Nothing was sent to the watch.`, widgetUnsupported: (type: string) => `this face has a Watch 3 Pro widget (type ${type}) that this watch's firmware can't draw — the watch would restart in a loop. Nothing was sent to the watch.`, + a8TooHeavy: (need: string, max: string) => + `this face has A8 images (cf 14), and converted for a Watch Pro 2 a screen needs ${need} MB, over the ${max} MB tested there — the watch could restart in a loop. Nothing was sent to the watch.`, a8Untested: "this face has A8 images (cf 14), which haven't been tested on a Watch Pro 2. Open it in the editor, use Export for Watch Pro 2 and install the exported file. Nothing was sent to the watch.", etc2OverTested: (need: string, max: string) => @@ -187,6 +189,8 @@ export const bt = dict(en, { `в этом циферблате виджет типа ${type}, его не знают ни одни поддерживаемые часы — от него часы могут зациклиться на перезагрузке. На часы ничего не отправлено.`, widgetUnsupported: (type) => `в этом циферблате виджет Watch 3 Pro (тип ${type}), который прошивка этих часов не умеет рисовать — часы зациклятся на перезагрузке. На часы ничего не отправлено.`, + a8TooHeavy: (need, max) => + `в этом циферблате изображения A8 (cf 14), и после перевода для Watch Pro 2 экрану нужно ${need} МБ, а проверено только до ${max} МБ — часы могут зациклиться на перезагрузке. На часы ничего не отправлено.`, a8Untested: "в этом циферблате изображения A8 (cf 14), их работа на Watch Pro 2 не проверена. Откройте его в редакторе, выберите «Экспорт для Watch Pro 2» и установите полученный файл. На часы ничего не отправлено.", etc2OverTested: (need, max) => @@ -296,6 +300,8 @@ export const bt = dict(en, { `у цьому циферблаті віджет типу ${type}, його не знає жоден підтримуваний годинник — через нього годинник може циклічно перезавантажуватися. На годинник нічого не надіслано.`, widgetUnsupported: (type) => `у цьому циферблаті віджет Watch 3 Pro (тип ${type}), який прошивка цього годинника не вміє малювати — годинник циклічно перезавантажуватиметься. На годинник нічого не надіслано.`, + a8TooHeavy: (need, max) => + `у цьому циферблаті зображення A8 (cf 14), і після переведення для Watch Pro 2 екрану потрібно ${need} МБ, а перевірено лише до ${max} МБ — годинник може циклічно перезавантажуватися. На годинник нічого не надіслано.`, a8Untested: "у цьому циферблаті зображення A8 (cf 14), їхню роботу на Watch Pro 2 не перевірено. Відкрийте його в редакторі, виберіть «Експорт для Watch Pro 2» і встановіть отриманий файл. На годинник нічого не надіслано.", etc2OverTested: (need, max) => @@ -405,6 +411,8 @@ export const bt = dict(en, { `esta esfera tiene un widget de tipo ${type} que ningún reloj compatible conoce — puede dejar el reloj reiniciándose en bucle. No se envió nada al reloj.`, widgetUnsupported: (type) => `esta esfera tiene un widget del Watch 3 Pro (tipo ${type}) que el firmware de este reloj no sabe dibujar — el reloj se reiniciaría en bucle. No se envió nada al reloj.`, + a8TooHeavy: (need, max) => + `esta esfera tiene imágenes A8 (cf 14) y, convertidas para un Watch Pro 2, una pantalla necesita ${need} MB, más de los ${max} MB probados allí — el reloj podría reiniciarse en bucle. No se envió nada al reloj.`, a8Untested: "esta esfera tiene imágenes A8 (cf 14), que no se han probado en un Watch Pro 2. Ábrela en el editor, usa «Exportar para Watch Pro 2» e instala el archivo exportado. No se envió nada al reloj.", etc2OverTested: (need, max) => @@ -516,6 +524,8 @@ export const bt = dict(en, { `इस फ़ेस में टाइप ${type} का विजेट है, जिसे कोई समर्थित घड़ी नहीं पहचानती — इससे घड़ी बार-बार रीस्टार्ट हो सकती है। घड़ी पर कुछ नहीं भेजा गया।`, widgetUnsupported: (type) => `इस फ़ेस में Watch 3 Pro का विजेट (टाइप ${type}) है, जिसे इस घड़ी का फ़र्मवेयर नहीं दिखा सकता — घड़ी बार-बार रीस्टार्ट होती रहेगी। घड़ी पर कुछ नहीं भेजा गया।`, + a8TooHeavy: (need, max) => + `इस फ़ेस में A8 इमेज (cf 14) हैं, और Watch Pro 2 के लिए बदलने पर स्क्रीन को ${need} MB चाहिए, जो वहाँ जाँची गई ${max} MB सीमा से ज़्यादा है — घड़ी बार-बार रीस्टार्ट हो सकती है। घड़ी पर कुछ नहीं भेजा गया।`, a8Untested: "इस फ़ेस में A8 इमेज (cf 14) हैं, जिन्हें Watch Pro 2 पर जाँचा नहीं गया है। इसे एडिटर में खोलें, “Watch Pro 2 के लिए एक्सपोर्ट” चुनें और एक्सपोर्ट की गई फ़ाइल इंस्टॉल करें। घड़ी पर कुछ नहीं भेजा गया।", etc2OverTested: (need, max) => @@ -631,6 +641,10 @@ const RULES: Rule[] = [ ], [/^this face has a widget of type (\d+), /, (w, m) => w.widgetUnknown(m[1])], [/^this face has a Watch 3 Pro widget \(type (\d+)\)/, (w, m) => w.widgetUnsupported(m[1])], + [ + /^this face has A8 images \(cf 14\), and converted for a Watch Pro 2 a screen needs ([\d.]+) MB, over the ([\d.]+) MB/, + (w, m) => w.a8TooHeavy(m[1], m[2]), + ], lit("a8Untested"), [ /^this face's ETC2 images need ([\d.]+) MB unpacked on a Watch Pro 2, over the ([\d.]+) MB/, diff --git a/src/lib/modules/device/model/ble.model.ts b/src/lib/modules/device/model/ble.model.ts index f93762a..94c503e 100644 --- a/src/lib/modules/device/model/ble.model.ts +++ b/src/lib/modules/device/model/ble.model.ts @@ -64,6 +64,8 @@ export const $sizeWarning = createStore(null); // how many images a flash re-encoded to fit the watch (fitForWatch) — null when none; the UI // words it (device/i18n fitNote) export const $fitNote = createStore(null); +// how many A8/ETC2 images a flash re-encoded for a Watch Pro 2 (fitForWatch) — null when none +export const $convertNote = createStore(null); // the watch a flash went to: $bleInfo resets the moment the link drops, which is before a flash // cut off by that drop fails — so the outcome reads who it was from here, not from $bleInfo const $flashWatch = createStore(null); @@ -125,7 +127,7 @@ export const $connecting = connectFx.pending; const flashFx = createEffect(async ({ bin: file, preview, key, slot, confirmed }: Pending) => { // every install — editor and marketplace — comes through here, so this is the one gate const device = watchDevice(watch!.name); - const { bin, compressed } = await fitForWatchOffThread(file, device); + const { bin, compressed, converted } = await fitForWatchOffThread(file, device); assertFlashable(bin, device); await assertWatchCompat(bin, device, async () => (await watch!.readWp2())?.stub.version ?? null); @@ -140,7 +142,7 @@ const flashFx = createEffect(async ({ bin: file, preview, key, slot, confirmed } rememberDial(id, name, preview, watch!.serial); // …and only now does the merged dial list know about it, so refresh it watch!.mergeDials(); - return { id, compressed }; + return { id, compressed, converted }; }); export const $flashing = flashFx.pending; const removeDialFx = createEffect((id: number) => { @@ -346,7 +348,12 @@ sample({ fn: ({ compressed }) => compressed || null, target: $fitNote, }); -reset({ clock: [flashRequested, disconnected], target: $fitNote }); +sample({ + clock: flashFx.doneData, + fn: ({ converted }) => converted || null, + target: $convertNote, +}); +reset({ clock: [flashRequested, disconnected], target: [$fitNote, $convertNote] }); sample({ clock: flashFx.failData, diff --git a/src/lib/modules/editor/core/document/support.ts b/src/lib/modules/editor/core/document/support.ts index 49f1c90..7b9a82f 100644 --- a/src/lib/modules/editor/core/document/support.ts +++ b/src/lib/modules/editor/core/document/support.ts @@ -3,12 +3,11 @@ // note can't promise what the gate then refuses. import { buildBin } from "../format"; import { drawnFormats, isUnknownWidget, procWidgets, stockSafe } from "../format/compat"; +export { PRO2_CONVERTS } from "../format/compat"; import { toLegacy, type Doc, type Layer } from "./doc"; /** The colour theme's number: a source only a Watch 3 Pro answers. */ export const THEME_SOURCE = 0x99; -/** What the export re-encodes: A8 (not sent to a Watch Pro 2) and ETC2 (stock doesn't show it). */ -export const PRO2_CONVERTS = [14, 28]; /** * `none`: a widget no watch knows. `pro3Only`: one a Watch Pro 2 would boot-loop on. diff --git a/src/lib/modules/editor/core/format/compat.ts b/src/lib/modules/editor/core/format/compat.ts index ddb162e..921a6f5 100644 --- a/src/lib/modules/editor/core/format/compat.ts +++ b/src/lib/modules/editor/core/format/compat.ts @@ -18,8 +18,8 @@ import type { FaceNode, Resource } from "./raw"; import { TAG, u16 } from "./raw"; /** The stub release that draws types 4..7 on a Watch Pro 2, or null while none has shipped: then - * no Pro 2 gets them and nobody asks for its stub. Set it only once the number is reserved in - * cmf-watch-sdk and tried on a real watch — two branches there have both called themselves 9. */ + * no Pro 2 gets them and nobody asks for its stub. Planned as stub 11 (9 is the boot guard, 10 the + * widget templates); set it to 11 only once that release is out and tried on a real watch. */ export const PRO2_FACES_STUB: number | null = null; /** Decoded bytes a screen is known to load on a Watch Pro 2. @@ -119,12 +119,16 @@ export function drawnFormats(screen: FaceNode, resources: Resource[]): Set screenBytes( screen, - resources.map((r) => (r.cf === 28 ? { ...r, cf: 5 } : r)), + resources.map((r) => (PRO2_CONVERTS.includes(r.cf) ? { ...r, cf: 5 } : r)), ); /** @@ -162,13 +166,19 @@ export async function assertWatchCompat( // stock those images don't show at all const { screens, resources } = parseBin(bin); - // unknown on a real watch, and no stub converts it. Every resource counts, the thumbnail (the - // face picker draws it there too) and whatever the tree walk can't place: unknown means refused. + // unknown on a real watch, so it never goes as it is: fitForWatch converts it, and what reaches + // this is a face too heavy to convert. Every resource counts, the thumbnail (the face picker + // draws it there too) and whatever the tree walk can't place: unknown means refused. // ponytail: lift it, or narrow it to the thumbnail, once cf 14 has been seen on a Watch Pro 2. - if (resources.some((r) => r.cf === 14)) + if (resources.some((r) => r.cf === 14)) { + const need = Math.max(...screens.map((s) => unpackedBytes(s, resources))); + throw new Error( - "this face has A8 images (cf 14), which haven't been tested on a Watch Pro 2. Open it in the editor, use Export for Watch Pro 2 and install the exported file. Nothing was sent to the watch.", + need > PRO2_TESTED_BYTES + ? `this face has A8 images (cf 14), and converted for a Watch Pro 2 a screen needs ${(need / 1e6).toFixed(1)} MB, over the ${(PRO2_TESTED_BYTES / 1e6).toFixed(2)} MB tested there — the watch could restart in a loop. Nothing was sent to the watch.` + : "this face has A8 images (cf 14), which haven't been tested on a Watch Pro 2. Open it in the editor, use Export for Watch Pro 2 and install the exported file. Nothing was sent to the watch.", ); + } for (const screen of screens) { const etc2 = drawnFormats(screen, resources).has(28); diff --git a/src/lib/modules/editor/core/format/fit.ts b/src/lib/modules/editor/core/format/fit.ts index bdc215e..3b77c1e 100644 --- a/src/lib/modules/editor/core/format/fit.ts +++ b/src/lib/modules/editor/core/format/fit.ts @@ -3,6 +3,7 @@ import { buildBin, parseBin } from "./bin"; import { decodedBytes, overBudget, shownResources, TO_ETC2 } from "./budget"; +import { PRO2_CONVERTS, PRO2_TESTED_BYTES, unpackedBytes } from "./compat"; import { decodePixels, encodePixels } from "./pixels-codec"; import type { Resource } from "./raw"; @@ -30,6 +31,8 @@ function dropOpaqueAlpha(r: Resource): Resource { export interface Fitted { bin: Uint8Array; compressed: number; + /** Images a Watch Pro 2 gets as cf 4/5 instead of A8 or ETC2. */ + converted: number; } export function fitForWatch(bin: Uint8Array, device: string | null): Fitted { @@ -38,16 +41,30 @@ export function fitForWatch(bin: Uint8Array, device: string | null): Fitted { try { face = parseBin(bin); } catch { - return { bin, compressed: 0 }; + return { bin, compressed: 0, converted: 0 }; } let changed = false, - compressed = 0; + compressed = 0, + converted = 0; const swap = (i: number, r: Resource) => { if (r === face.resources[i]) return; face.resources[i] = r; changed = true; }; + // A Watch Pro 2 gets the Watch 3 Pro's formats as cf 5 — what Export for Watch Pro 2 does by + // hand, the thumbnail included — unless a screen would then need more than it has been tested + // with; the gate refuses that face (compat.ts). First, so an opaque one goes on to cf 4. + if ( + device === "watch_pro_2" && + face.resources.some((r) => PRO2_CONVERTS.includes(r.cf)) && + face.screens.every((s) => unpackedBytes(s, face.resources) <= PRO2_TESTED_BYTES) + ) + face.resources.forEach((r, i) => { + if (!PRO2_CONVERTS.includes(r.cf)) return; + swap(i, encodePixels(decodePixels(r)!, r.w, r.h, 5)); + converted++; + }); face.resources.forEach((r, i) => swap(i, dropOpaqueAlpha(r))); if (device === "watch_3_pro") for (const { screen } of overBudget(face)) { @@ -63,7 +80,7 @@ export function fitForWatch(bin: Uint8Array, device: string | null): Fitted { compressed++; } } - return { bin: changed ? buildBin(face) : bin, compressed }; + return { bin: changed ? buildBin(face) : bin, compressed, converted }; } /** fitForWatch in a worker (fit.worker.ts), so the page stays responsive while a heavy face is @@ -75,10 +92,19 @@ export function fitForWatchOffThread(bin: Uint8Array, device: string | null): Pr return new Promise((resolve, reject) => { worker.onmessage = ({ data, - }: MessageEvent<{ out?: Uint8Array | null; compressed?: number; error?: string }>) => + }: MessageEvent<{ + out?: Uint8Array | null; + compressed?: number; + converted?: number; + error?: string; + }>) => data.error ? reject(new Error(data.error)) - : resolve({ bin: data.out ?? bin, compressed: data.compressed ?? 0 }); + : resolve({ + bin: data.out ?? bin, + compressed: data.compressed ?? 0, + converted: data.converted ?? 0, + }); worker.onerror = (e) => { e.preventDefault(); reject(new Error(e.message || "the face could not be prepared for the watch")); diff --git a/src/lib/modules/editor/core/format/fit.worker.ts b/src/lib/modules/editor/core/format/fit.worker.ts index c868067..692508d 100644 --- a/src/lib/modules/editor/core/format/fit.worker.ts +++ b/src/lib/modules/editor/core/format/fit.worker.ts @@ -4,10 +4,10 @@ import { fitForWatch } from "./fit"; self.onmessage = ({ data }: MessageEvent<{ bin: Uint8Array; device: string | null }>) => { try { - const { bin: out, compressed } = fitForWatch(data.bin, data.device); + const { bin: out, compressed, converted } = fitForWatch(data.bin, data.device); - if (out === data.bin) self.postMessage({ out: null, compressed }); - else self.postMessage({ out, compressed }, { transfer: [out.buffer] }); + if (out === data.bin) self.postMessage({ out: null, compressed, converted }); + else self.postMessage({ out, compressed, converted }, { transfer: [out.buffer] }); } catch (e) { self.postMessage({ error: e instanceof Error ? e.message : String(e) }); } diff --git a/src/lib/modules/editor/i18n.ts b/src/lib/modules/editor/i18n.ts index 9bd0a08..e8e76ea 100644 --- a/src/lib/modules/editor/i18n.ts +++ b/src/lib/modules/editor/i18n.ts @@ -21,7 +21,7 @@ export const t = dict( none: "No supported watch can take this face: it has a widget of an unknown type.", pro3Only: "Watch 3 Pro only: a Watch Pro 2 would restart in a loop on this face.", pro2Converts: - "Uses Watch 3 Pro image formats or data: for a Watch Pro 2, use Export for Watch Pro 2.", + "Uses Watch 3 Pro image formats or data: a Watch Pro 2 gets them converted on install. Export for Watch Pro 2 also fixes the colour theme.", pro2Drops: "Watch 3 Pro. A Watch Pro 2 runs it without the touch widget.", }, exportBin: "Export .bin", @@ -221,7 +221,7 @@ export const t = dict( none: "Ни одни поддерживаемые часы не примут этот циферблат: в нём виджет неизвестного типа.", pro3Only: "Только Watch 3 Pro: Watch Pro 2 на этом циферблате зациклится на перезагрузке.", pro2Converts: - "Использует форматы изображений или данные Watch 3 Pro: для Watch Pro 2 используйте «Экспорт для Watch Pro 2».", + "Использует форматы изображений или данные Watch 3 Pro: при установке на Watch Pro 2 они переводятся сами. «Экспорт для Watch Pro 2» вдобавок закрепляет цветовую тему.", pro2Drops: "Watch 3 Pro. На Watch Pro 2 работает без виджета касания.", }, exportBin: "Экспорт .bin", @@ -404,7 +404,7 @@ export const t = dict( pro3Only: "Лише Watch 3 Pro: Watch Pro 2 на цьому циферблаті циклічно перезавантажуватиметься.", pro2Converts: - "Використовує формати зображень або дані Watch 3 Pro: для Watch Pro 2 скористайтеся «Експорт для Watch Pro 2».", + "Використовує формати зображень або дані Watch 3 Pro: під час встановлення на Watch Pro 2 вони переводяться самі. «Експорт для Watch Pro 2» ще й закріплює колірну тему.", pro2Drops: "Watch 3 Pro. На Watch Pro 2 працює без віджета дотику.", }, exportBin: "Експорт .bin", @@ -586,7 +586,7 @@ export const t = dict( none: "Ningún reloj compatible acepta esta esfera: tiene un widget de tipo desconocido.", pro3Only: "Solo Watch 3 Pro: un Watch Pro 2 se reiniciaría en bucle con esta esfera.", pro2Converts: - "Usa formatos de imagen o datos del Watch 3 Pro: para un Watch Pro 2 usa «Exportar para Watch Pro 2».", + "Usa formatos de imagen o datos del Watch 3 Pro: al instalarla en un Watch Pro 2 se convierten solos. «Exportar para Watch Pro 2» además fija el tema de color.", pro2Drops: "Watch 3 Pro. En un Watch Pro 2 funciona sin el widget táctil.", }, exportBin: "Exportar .bin", @@ -768,7 +768,7 @@ export const t = dict( none: "कोई समर्थित घड़ी यह फ़ेस नहीं ले सकती: इसमें अज्ञात टाइप का विजेट है।", pro3Only: "सिर्फ़ Watch 3 Pro: Watch Pro 2 इस फ़ेस पर बार-बार रीस्टार्ट होगी।", pro2Converts: - "Watch 3 Pro के इमेज फ़ॉर्मेट या डेटा का इस्तेमाल करता है: Watch Pro 2 के लिए “Watch Pro 2 के लिए एक्सपोर्ट” इस्तेमाल करें।", + "Watch 3 Pro के इमेज फ़ॉर्मेट या डेटा का इस्तेमाल करता है: Watch Pro 2 पर इंस्टॉल करते समय वे अपने-आप बदल जाते हैं। “Watch Pro 2 के लिए एक्सपोर्ट” कलर थीम भी तय कर देता है।", pro2Drops: "Watch 3 Pro। Watch Pro 2 पर यह टच विजेट के बिना चलता है।", }, exportBin: ".bin एक्सपोर्ट", diff --git a/src/lib/modules/editor/pages/editor.svelte b/src/lib/modules/editor/pages/editor.svelte index 42098c8..9d472a7 100644 --- a/src/lib/modules/editor/pages/editor.svelte +++ b/src/lib/modules/editor/pages/editor.svelte @@ -63,6 +63,7 @@ flashRequested, $flashing: flashing, $fitNote: fitNote, + $convertNote: convertNote, } = bleModel; const { $openedWf: openedWf, @@ -698,6 +699,8 @@

{:else if $fitNote}

{$deviceT.fitNote($fitNote)}

+ {:else if $convertNote} +

{$deviceT.convertNote($convertNote)}

{/if}
diff --git a/src/lib/modules/market/pages/watchface.svelte b/src/lib/modules/market/pages/watchface.svelte index b36801b..b8d0010 100644 --- a/src/lib/modules/market/pages/watchface.svelte +++ b/src/lib/modules/market/pages/watchface.svelte @@ -51,6 +51,7 @@ $bleStatus: bleStatus, $connecting: connecting, $fitNote: fitNote, + $convertNote: convertNote, connectRequested, } = bleModel; @@ -217,6 +218,8 @@
{#if $installed && $fitNote}

{$deviceT.fitNote($fitNote)}

+ {:else if $installed && $convertNote} +

{$deviceT.convertNote($convertNote)}

{/if}