From dc74b4dbe40b817c613c4d4e076f5663add6a9ab Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 30 Nov 2026 21:14:12 +0000 Subject: [PATCH] Editor: the SOUND page's modules again on V10.8.7x (G_COUNT 77), not the plain list; appended parameters tolerated; a test in the site deploy A user (via JIANT Studio): "the sound editor used to show modules, for a few updates now it is a vertical list". knownLayout knew G_COUNT up to 73; the firmware has 77 since the OTT / GATE globals, so the editor fell back to the plain list. Now any G_COUNT from 73 up and any P_COUNT from 123 up with the engine block last (P_E0 = P_COUNT - 8) is known: the firmware appends, the ids the layout names stay. web/editor_layout_test.mjs compiles P_COUNT, G_COUNT, P_E0 from core.h of web/STABLE and web/PREVIEW and checks them (fails on the old editor: 32099fe and b983fbb both 123 / 77 / 115); emulator.yml runs it before the site is deployed. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01KMHk6yH4XbP1xxHYKCo9Mh --- .github/workflows/emulator.yml | 4 ++++ web/editor.html | 8 +++++-- web/editor_layout_test.mjs | 41 ++++++++++++++++++++++++++++++++++ 3 files changed, 51 insertions(+), 2 deletions(-) create mode 100644 web/editor_layout_test.mjs diff --git a/.github/workflows/emulator.yml b/.github/workflows/emulator.yml index ef98f961..b42e8cac 100644 --- a/.github/workflows/emulator.yml +++ b/.github/workflows/emulator.yml @@ -33,6 +33,10 @@ jobs: run: python3 -c "import sys; sys.path.insert(0, 'tools'); import build; build.generate()" - name: Installer quarantine and edition ordering run: python3 tests/test_installer_channels.py + # (V10.8.77, a user: the sound editor showed a plain list) the editor knows the firmware's layout (P_COUNT, G_COUNT) + # of the public release and the beta, so its SOUND page shows the modules + - name: Editor layout against the firmware + run: node web/editor_layout_test.mjs - uses: mymindstorm/setup-emsdk@v14 with: version: 6.0.11 # (the version the emulator is tested with) diff --git a/web/editor.html b/web/editor.html index 64c4ac28..b1ca049f 100644 --- a/web/editor.html +++ b/web/editor.html @@ -4419,8 +4419,12 @@ const stepEdit = new Map(); /* index -> time of the last edit */ const EXPECT = { pcount: 91, gcount: 27, pe0: 83 }; /* the same layout without the chord keys (P_COUNT 89, P_E0 81), the FM operator ENVs too (69, 61) or the matrix (firmware 1.0: 57, 49) */ -const knownLayout = (info) => [EXPECT.gcount, 32, 36, 37, 66, 67, 69, 71, 73].includes(info.gcount) && /* (JIANT FUNB: 5, 9, then 10 more globals; 0.6.3: the SLICER's 29) */ - [[123, 115], [120, 112], [99, 91], [91, 83], [89, 81], [69, 61], [57, 49]].some(([c, e]) => info.pcount === c && info.pe0 === e); +/* (V10.8.77, a user: "the sound editor's modules became a vertical list") the firmware appends: globals past 73 (77 since + the OTT, GATE, ...) and track parameters past 123 keep every id the layout names, so a newer firmware is known too: any + G_COUNT from 73 up, any P_COUNT from 123 up with its 8 engine slots last (P_E0 = P_COUNT - 8); web/editor_layout_test.mjs */ +const knownLayout = (info) => ([EXPECT.gcount, 32, 36, 37, 66, 67, 69, 71].includes(info.gcount) || info.gcount >= 73) && /* (JIANT FUNB: 5, 9, then 10 more globals; 0.6.3: the SLICER's 29) */ + ([[120, 112], [99, 91], [91, 83], [89, 81], [69, 61], [57, 49]].some(([c, e]) => info.pcount === c && info.pe0 === e) || + (info.pcount >= 123 && info.pcount < 128 && info.pe0 === info.pcount - 8)); const P = { LEVEL: 0, SLEN: 29 }; const LAYOUT = (pe0) => [ { t: "ENV", pages: [["ENV", 0, [1, 2, 3, 4]], ["ENV DEST", 0, [5, 6, 7, 8]]] }, diff --git a/web/editor_layout_test.mjs b/web/editor_layout_test.mjs new file mode 100644 index 00000000..d5919505 --- /dev/null +++ b/web/editor_layout_test.mjs @@ -0,0 +1,41 @@ +// SPDX-License-Identifier: GPL-3.0-only +// Copyright (C) 2026 Juan Ignacio Antonucci (Juan Jiant) +// (V10.8.77, a user: "the sound editor used to show modules, for a few updates now it is a vertical list") editor.html's +// knownLayout against the firmware's own counts: P_COUNT, G_COUNT and P_E0 compiled from core.h of each commit named +// (default: web/STABLE and web/PREVIEW), each must be a known layout, so the SOUND page shows its modules, not the plain +// list. Also: every older layout still known, a firmware with parameters appended at the end still known. +// node web/editor_layout_test.mjs [ ...] +// Needs git (the commits fetched) and a C compiler. Run by emulator.yml before the site is deployed. +import fs from "fs"; +import os from "os"; +import path from "path"; +import { execFileSync } from "child_process"; + +const HERE = path.dirname(new URL(import.meta.url).pathname); +const html = fs.readFileSync(path.join(HERE, "editor.html"), "utf8"); +const a = html.indexOf("const EXPECT = "), b = html.indexOf("const P = {", a); +const knownLayout = new Function(html.slice(a, b) + "; return knownLayout;")(); +let fails = 0; +const ok = (c, what) => { console.log(`${what.padEnd(96)} ${c ? "ok" : "FAIL"}`); if (!c) fails++; }; + +for (const [pcount, gcount, pe0] of [[123, 73, 115], [120, 66, 112], [99, 36, 91], [91, 27, 83], [57, 27, 49]]) + ok(knownLayout({ pcount, gcount, pe0 }), `an older layout still known: P_COUNT ${pcount} G_COUNT ${gcount} P_E0 ${pe0}`); +ok(knownLayout({ pcount: 125, gcount: 80, pe0: 117 }), "parameters appended at the end (P_COUNT 125, G_COUNT 80): still known"); +ok(!knownLayout({ pcount: 123, gcount: 77, pe0: 100 }), "an engine block not last (P_E0 100 of 123): the plain list"); + +const commits = process.argv.slice(2).length ? process.argv.slice(2) + : ["STABLE", "PREVIEW"].map((f) => fs.readFileSync(path.join(HERE, f), "utf8").trim()); +const tmp = fs.mkdtempSync(path.join(os.tmpdir(), "edlay-")); +fs.writeFileSync(path.join(tmp, "pc.c"), '#include "core.h"\n#include \nint main(void){printf("%d %d %d\\n",(int)P_COUNT,(int)G_COUNT,(int)P_E0);return 0;}\n'); +for (const c of [...new Set(commits)]) { + const src = path.join(tmp, c); + fs.mkdirSync(src); + for (const f of execFileSync("git", ["ls-tree", "--name-only", c, "firmware/src/"], { encoding: "utf8" }).split("\n")) + if (f.endsWith(".h")) fs.writeFileSync(path.join(src, path.basename(f)), execFileSync("git", ["show", `${c}:${f}`], { maxBuffer: 1 << 26 })); + execFileSync("cc", ["-w", "-I" + src, path.join(tmp, "pc.c"), "-o", path.join(src, "pc")]); + const [pcount, gcount, pe0] = execFileSync(path.join(src, "pc"), { encoding: "utf8" }).trim().split(" ").map(Number); + ok(knownLayout({ pcount, gcount, pe0 }), `firmware ${c.slice(0, 7)} (P_COUNT ${pcount} G_COUNT ${gcount} P_E0 ${pe0}): the modules, not the plain list`); +} +fs.rmSync(tmp, { recursive: true, force: true }); +console.log(fails ? `editor-layout: ${fails} FAILED` : "editor-layout: all ok"); +process.exit(fails ? 1 : 0);