From 9ca30f412ebade6e3a6a5329b024f9da00891429 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thea=20Sch=C3=B6bl?= Date: Tue, 29 Jul 2025 16:40:54 +0200 Subject: [PATCH] feat: update compound calculation feat: add "will my compound break" page --- src/lib/serial/chord.ts | 3 + .../will-my-compound-break/+page.svelte | 66 +++++++++++++++++++ 2 files changed, 69 insertions(+) create mode 100644 src/routes/(app)/config/chords/will-my-compound-break/+page.svelte diff --git a/src/lib/serial/chord.ts b/src/lib/serial/chord.ts index 4d52aad1..532e2ca3 100644 --- a/src/lib/serial/chord.ts +++ b/src/lib/serial/chord.ts @@ -69,5 +69,8 @@ export function hashChord(actions: number[]) { for (let i = 0; i < 16; i++) { hash = Math.imul(hash ^ view.getUint8(i), 16777619); } + if ((hash & 0xff) === 0xff) { + hash ^= 0xff; + } return hash & 0x3fff_ffff; } diff --git a/src/routes/(app)/config/chords/will-my-compound-break/+page.svelte b/src/routes/(app)/config/chords/will-my-compound-break/+page.svelte new file mode 100644 index 00000000..a7e5b4a7 --- /dev/null +++ b/src/routes/(app)/config/chords/will-my-compound-break/+page.svelte @@ -0,0 +1,66 @@ + + +

Will my compound break

+

+ Pre-2.2.0 there was a bug where creating a compound with specific chords as a + base could corrupt your library. +

+ +{#if broken.length > 0} +

Chords have been detected.

+

+ If you have ever tried to create a compound chord with any of these as a base, your library might have been corrupted. +

+ {#each broken as chord} + {}} /> + {/each} +{:else} +

No problematic chords found

+{/if} + +