Files
JIANT/web/index_pkg.html
Claude da1b1dd2c1 Copyright headers: name Juan Jiant on JIANT's own files, add him on the modified Felucca ones
Comment-only change (the built image is byte-identical: felucca.bin 583936 B, felucca.fwsc 684736 B, same SHA-256).

- 37 files written new for JIANT FM after the fork (no Felucca text in them: checked against ac6bfcbd by literal
  code lines, runs of consecutive lines, same-named functions and moves in their creating commit) carried Leo
  Kuroshita's copyright line copied from a template: it is now Juan Jiant's (SPDX GPL-3.0-only kept). Among them
  sing.c, eng_animal.c, eng_input.c, eng_string.c, pfx.c, seq_live.c, ui_engvis.c, ui_lens.c, ui_lz*.c, ui_being.c,
  ui_organic.c, ui_tech.c, ui_dx.c, ui_live.c, tools/lyrics/*.txt, gen_drum_maps.py, gen_px_font.py and 14 tests.
- 140 files that hold Felucca's code (Felucca 1.1.5.1 files changed since, imports of Felucca 1.5.x, the SLOOP-based
  song_main/song_play, and new files that carry copied Felucca helpers: drumx_voice.c dv_exp2/dv_kb, gen_lyrics.py's
  Huffman, test harness helpers) keep Leo's notice and add "Portions Copyright (C) 2026 Juan Ignacio Antonucci
  (Juan Jiant)". Files unchanged since the fork are left as they were.
- LICENSING.md and README.md name both copyright holders.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KMHk6yH4XbP1xxHYKCo9Mh
2026-11-11 18:04:53 +00:00

429 lines
36 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!doctype html>
<!-- SPDX-License-Identifier: GPL-3.0-only
Copyright (C) 2026 Leo Kuroshita (@kurogedelic), Hügelton Instruments
Portions Copyright (C) 2026 Juan Ignacio Antonucci (Juan Jiant) -->
<html lang="ja">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>JIANT FM</title>
<style>
:root { --bg: #fff; --fg: #000; --dim: #777; }
@media (prefers-color-scheme: dark) {
:root:not([data-theme="light"]) { --bg: #000; --fg: #fff; --dim: #888; }
}
:root[data-theme="dark"] { --bg: #000; --fg: #fff; --dim: #888; }
body { margin: 0; background: var(--bg); color: var(--fg);
font: 16px/1.6 -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif; }
main { max-width: 520px; margin: 0 auto; padding: 48px 16px; }
h1 { font-size: 24px; font-weight: 600; margin: 0 0 24px; }
.lang { float: right; font-size: 13px; color: var(--dim); cursor: pointer; text-decoration: underline; background: none; padding: 0; color: var(--dim); }
p { margin: 0 0 16px; }
button { font: inherit; background: var(--fg); color: var(--bg); border: 0; padding: 8px 20px; cursor: pointer; }
button:disabled { opacity: .3; cursor: default; }
#status { margin-top: 16px; min-height: 1.6em; }
.small { color: var(--dim); font-size: 13px; }
progress { width: 100%; height: 4px; margin-top: 16px; }
pre { color: var(--dim); font-size: 12px; white-space: pre-wrap; margin-top: 16px; }
</style>
</head>
<body>
<main>
<button class="lang" id="lang"></button>
<h1>JIANT FM</h1>
<p data-t="intro"></p>
<p data-t="warn"></p>
<p data-t="samples" style="color:#ec6e50"></p>
<p data-t="dual" style="border-left:3px solid #ec6e50;padding:4px 0 4px 12px"></p>
<p class="small" data-t="direct"></p>
<p class="small" data-t="beta"></p>
<p class="small"><span data-t="brick"></span>
<a href="https://github.com/kurogedelic/FM-1-transporter" target="_blank" rel="noopener" style="color:inherit">FM-1-transporter</a></p>
<div style="border:2px solid #ec6e50;padding:12px 14px;margin:0 0 16px">
<p style="margin:0 0 8px;font-weight:600" data-t="firstTitle"></p>
<p class="small" style="margin:0 0 10px" data-t="firstText"></p>
<p style="margin:0 0 10px"><button id="first-stock" data-t="firstStock"></button></p>
<p class="small" style="margin:0" data-t="firstOk"></p>
</div>
<p class="small"><label><span data-t="verLabel"></span> <select id="ver" style="font:inherit"></select></label>
<br><span data-t="verOld"></span></p>
<!-- (0.8.5) the release's notice, before 0.8.5 is written (releaseNotice) -->
<div id="notice" hidden style="border:2px solid #ec6e50;padding:12px 14px;margin:0 0 16px">
<p style="margin:0 0 8px;font-weight:600" data-t="n085Title"></p>
<p class="small" style="margin:0 0 8px" data-t="n085What"></p>
<p class="small" style="margin:0 0 8px" data-t="n085Risk"></p>
<p class="small" style="margin:0 0 8px" data-t="n085Keep"></p>
<div lang="es" style="border-top:1px solid var(--dim);padding-top:8px">
<p style="margin:0 0 8px;font-weight:600">Aviso antes de instalar 0.8.5</p>
<p class="small" style="margin:0 0 8px">Nuevo en 0.8.5, las octavas de DRUM-X: en la octava central (OCT 0) el kit suena como siempre. Una octava más arriba los mismos sonidos suenan en ratchet a tempo (+1 x2, +2 x4, +3 x8); más abajo, con otro toque: −1 SHORT (la mitad del decay), −2 GHOST (corto, más suave y oscuro: notas fantasma), −3 FLAM (un golpe suave ~20 ms antes del golpe). Cada sonido del kit lleva su propia variación: un hi-hat en ratchet no repite el bombo del mismo paso.</p>
<p class="small" style="margin:0 0 8px">Puede cambiar canciones existentes: las notas MIDI fuera del mapa GM (35–81) que hoy una pista DRUM toca como su octava (por ejemplo 24, o 84 y más) ahora suenan como esas variantes; las teclas con OCT movido ya no cambian de sonido sino que hacen ratchet / SHORT / GHOST / FLAM. Las notas guardadas en los pasos suenan igual que antes.</p>
<p class="small" style="margin:0">Para conservar el sonido de antes, mové esas notas a la octava central (36–47, o el mapa GM 35–81) en tu DAW o secuenciador. Antes de instalar, guardá un backup completo de tus proyectos con el editor (Backup) o con «Volver al V15 oficial» abajo.</p>
</div>
</div>
<!-- (V10.6p) 6 songs, 8 before: a backup first (backupFirst), or an explicit go without one -->
<div id="six" style="border:2px solid #ec6e50;padding:12px 14px;margin:0 0 16px">
<p style="margin:0 0 8px;font-weight:600" data-t="sixTitle"></p>
<p class="small" style="margin:0 0 8px" data-t="sixText"></p>
<div lang="es" style="border-top:1px solid var(--dim);padding-top:8px;margin:0 0 10px">
<p style="margin:0 0 8px;font-weight:600">Esta versión guarda 6 canciones (antes 8). Hacé un backup de tus proyectos antes de actualizar.</p>
<p class="small" style="margin:0">Las canciones 7 y 8 ya no se abren (esa memoria queda para un banco de samples de batería). Antes de instalar, pasalas a una canción libre entre 1 y 6, o guardalas con el botón de abajo: el backup las conserva todas. Al restaurarlo después se recuperan las canciones 1–6; el editor avisa que 7 y 8 no se restauraron.</p>
</div>
<p style="margin:0 0 8px"><button id="backup-go" data-t="sixBackup"></button></p>
<p class="small" style="margin:0" id="backup-state" data-t="sixNone"></p>
</div>
<p><button id="go" disabled data-t="install"></button></p>
<details id="stock" style="margin-top:24px">
<summary data-t="stockTitle"></summary>
<p class="small" data-t="back"></p>
<p class="small"><a href="https://www.m-vave.com/download" target="_blank" rel="noopener" style="color:inherit">M-VAVE Downloads</a></p>
<p><label><span data-t="stockFile"></span><br><input id="stock-file" type="file" accept=".fwsc"></label></p>
<p><button id="stock-go" disabled data-t="stockGo"></button></p>
<p class="small" data-t="stockBackup"></p>
<p class="small"><label><input id="stock-recovery" type="checkbox"> <span data-t="stockRecovery"></span></label></p>
</details>
<progress id="bar" max="100" value="0"></progress>
<p id="status"></p>
<pre id="log"></pre>
<p><a href="../editor/" style="color:inherit" data-t="editor"></a></p>
<p><span data-t="manual"></span>
<a href="https://github.com/juanjiant-bit/JIANT/blob/main/docs/MANUAL.md" target="_blank" rel="noopener" style="color:inherit">English</a> ·
<a href="https://github.com/juanjiant-bit/JIANT/blob/main/docs/MANUAL.es.md" target="_blank" rel="noopener" style="color:inherit">Español</a></p>
<p class="kofi" style="border-left:3px solid #ec6e50;padding:4px 0 4px 12px">If you resonate with my work, consider supporting me on <a href="https://ko-fi.com/juanjiant" target="_blank" rel="noopener" style="color:inherit;font-weight:600">Ko-fi</a> (in Argentina: <a href="https://cafecito.app/juanjiant" target="_blank" rel="noopener" style="color:inherit;font-weight:600">Cafecito</a>). Thanks for all the good energy, hope you enjoy this little beast 🫶✨🎹</p>
<p class="small">Credits: Felucca by Leo Kuroshita (@kurogedelic), <a href="https://hugelton.com" target="_blank" rel="noopener" style="color:inherit">Hügelton Instruments</a>, with its CrispyZebra waveforms and Fukiai icons (MIT); the song system after SLOOP by isod89.<br>
Font: Inter Tight (The Inter Project Authors, SIL OFL 1.1).<br>
FM6 engine: msfa from Dexed (Google Inc., Pascal Gauthier, Apache-2.0). The package also holds three JieLi AC79 SDK files, uboot.boot, cfg_tool.bin and eq_cfg_hw.bin (JieLi Technology, Apache-2.0). <a href="../../firmware/LICENSING.md" style="color:inherit">Licences</a>: <a href="../../firmware/LICENSE" style="color:inherit">GPL-3.0</a>, <a href="../../firmware/LICENSES/Apache-2.0.txt" style="color:inherit">Apache-2.0</a>, <a href="../../firmware/LICENSES/" style="color:inherit">all</a>.<br>
M-VAVE and FM-1 are trademarks of their respective owners.<br>
<span data-t="license"></span> <a href="https://github.com/juanjiant-bit/JIANT" target="_blank" rel="noopener" style="color:inherit">github.com/juanjiant-bit/JIANT</a></p>
</main>
<script type="module">
/*LIB*/
const $ = (id) => document.getElementById(id);
const TEXT = {
ja: {
intro: "FM-1 を USB で接続してください。(Chrome か Edge で使えます)",
warn: "書き込み中は USB を抜かないでください。",
samples: "注意: JIANT にはユーザーサンプルがありません。Felucca のユーザーサンプル (USR1–3) はインストールで失われます(その領域は曲の保存に使われます)。元の WAV ファイルは手元に残しておいてください。",
dual: "0.6.71 から JIANT は FM-1 の2つのコアを使います(実験的)。すべての仮想テストには合格していますが、まだ実機では試されていません。FM-1 が固まる・再起動する・以前より音が途切れる場合は、REC を押しながら電源を入れると1コアで動きます。MENU > ABOUT の表示(CORES 2 / CORES 1 と理由)を GitHub で知らせてください。",
install: "インストール", other: "English",
firstTitle: "他のカスタムファームウェアから入れる場合は、先に公式V15へ戻してください",
firstText: "Felucca・baudgirl などの別のカスタムファームウェアが入った FM-1 に直接 JIANT を書き込むと、起動しなくなることがあります。まず下のボタンで公式V15に戻し(全体バックアップも取れます)、それから JIANT をインストールしてください。公式V15 か JIANT がすでに入っている場合はそのままで大丈夫です。",
firstStock: "先に公式V15へ戻す",
firstOk: "インストールの前に、接続された FM-1 のファームウェアを自動で確認します。公式V15 か JIANT のときだけ書き込みます。",
checking: "FM-1 のファームウェアを確認中…",
otherfw: "この FM-1 には公式V15 でも JIANT でもないファームウェアが入っています。書き込みませんでした。下のボタンで先に公式V15に戻してから、もう一度インストールしてください。 ",
editor: "エディタ(インストール後、パソコンから音色やシーケンスを編集)",
verLabel: "バージョン:", verOld: "以前のバージョンにも戻せます(最新が一番上)。新しい版で保存したプロジェクトは古い版で正しく開けないことがあります。先にエディタでバックアップしてください。", latest: "最新", manual: "マニュアル:",
direct: "USB ケーブルはパソコンに直接つないでください。Probe や Transporter などの機材は不要です。",
brick: "万一インストールに失敗して起動しなくなった場合は、復旧に Transporter が必要です:",
beta: "JIANT FM は開発中のテスト版です。不具合は GitHub で知らせてください。このカスタムファームウェアを使ったことで FM-1 が壊れたり不具合が起きたりしても、作者は一切の責任を負いません。自己責任でお使いください。",
back: "M-VAVEから公式FM-1 V15を取得し、未変更のFM-1.fwscを選んでください。ファイルはこのブラウザ内で検証し、サーバーへ送りません。",
stockTitle: "公式V15に戻す", stockFile: "公式FM-1.fwsc", stockGo: "バックアップして公式V15へ戻す",
stockBackup: "現在の曲・保存曲・音色バンク・設定を先に保存します(ユーザーサンプルは含まれません)。全体バックアップ非対応版は、JIANT を更新してから行ってください。復元は JIANT を再インストールしてエディタから行います。",
stockRecovery: "更新中断の再開:全体バックアップはすでにパソコンへ保存済み",
stockValid: "公式V15を確認しました", stockConfirm: "全体バックアップファイルをパソコンに保存できましたか? 続けると公式V15へ戻します。JIANT の曲は公式V15では開けません。",
stockNeedBackup: "書き込みモードからはバックアップできません。保存済みバックアップがある場合だけ、更新中断の再開にチェックしてください。",
stockUnsupported: "このファームウェアは全体バックアップに未対応です。先に最新版をインストールしてください。",
backup: "全体バックアップ保存中 ", stockError: "公式ファイルを確認できません: ",
nomidi: "このブラウザでは使えません。Chrome か Edge で開いてください。", loadfail: "読み込めませんでした: ",
start: "開始します", verify: "確認中", loader: "書き込みモードに切り替え中", write: "書き込み中",
reboot: "再起動中", done: "完了しました", stopped: "途中で止まりました。USB を挿し直してもう一度押してください。",
error: "エラー: ",
denied: "MIDI(SysEx)の使用が許可されませんでした。アドレスバーのサイト設定で MIDI を許可して、もう一度押してください。",
blocked: "このサイトでは MIDI がブロックされています(以前に許可ダイアログを閉じたか拒否した場合、ブラウザーはもう尋ねません)。アドレスバー左のアイコン → 権限(サイトの設定)→ MIDI デバイスの制御 → 許可。ページを再読み込みして、もう一度インストールを押してください。",
notfound: "FM-1 が見つかりません。USB ケーブル(データ通信用か)を確かめ、MIDI を使う他のアプリを閉じてから、もう一度押してください。",
model: "接続されている機器は FM-1 ではありません。",
lost: "USB の接続が切れました。挿し直してもう一度押してください。",
noloader: "書き込みモードの FM-1 が見つかりません。USB を挿し直してもう一度押してください(終わるまで書き込みモードのままです)。",
noreturn: "FM-1 が戻ってきません。電源を入れ直してください。",
mismatch: "書き込みは終わりましたが、FM-1 が別のバージョンを報告しています: ",
badpkg: "インストールするファイルが壊れています。ページを再読み込みしてください。",
leave: "書き込み中です。ページを閉じないでください。",
license: "GPL-3.0、無保証。ソース:",
n085Title: "0.8.5 をインストールする前に",
n085What: "0.8.5 の新機能 DRUM-X のオクターブ: 中央のオクターブ (OCT 0) ではキットはこれまでどおり鳴ります。上のオクターブでは同じ音がテンポに合わせたラチェットに(+1 x2、+2 x4、+3 x8)、下では別のタッチに: −1 SHORT(ディケイ半分)、−2 GHOST(短く、弱く、暗く: ゴーストノート)、−3 FLAM(約 20 ms 前に弱い装飾音)。キットの音ごとに別々: ハイハットのラチェットは同じステップのキックを繰り返しません。",
n085Risk: "既存の曲の鳴り方が変わることがあります: DRUM トラックに GM マップ (35–81) の外の MIDI ノート(例えば 24 や 84 以上)を送る設定では、これまでそのオクターブとして鳴っていた音が、これらのバリエーションで鳴ります。OCT を動かした鍵盤は音が変わる代わりにラチェット / SHORT / GHOST / FLAM になります。ステップに保存されたノートはこれまでどおり鳴ります。",
n085Keep: "以前の音を保つには、それらのノートを DAW やシーケンサーで中央のオクターブ (36–47、または GM マップ 35–81) に移してください。インストールの前に、エディターのバックアップ(または下の「公式 V15 に戻す」)でプロジェクトの完全バックアップを保存してください。",
n085Confirm: "0.8.5 では DRUM-X のオクターブが加わり、中央以外のオクターブのドラムノートはラチェット / SHORT / GHOST / FLAM で鳴ります(既存の曲が変わることがあります)。プロジェクトのバックアップは保存しましたか? OK でインストールします。",
sixTitle: "このバージョンは6曲まで保存します(以前は8曲)。更新の前にプロジェクトをバックアップしてください。",
sixText: "曲 7 と 8 は開けなくなります(その領域はドラムサンプルバンク用に空けます)。インストールの前に 1〜6 の空いた曲へ移すか、下のボタンでバックアップしてください(バックアップには全曲が残ります)。あとで復元すると曲 1〜6 が戻り、7 と 8 は復元されなかったとエディタが知らせます。",
sixBackup: "今すぐバックアップ", sixNone: "まだバックアップしていません。", sixDone: "バックアップを保存しました: ", sixSaved: "バックアップはこのパソコンに保存済みです。インストールできます。",
sixStock: "公式V15 です: JIANT のプロジェクトはないのでバックアップは不要です。",
sixConfirm: "バックアップせずにインストールしますか? 曲 7 と 8 は開けなくなります。OK でバックアップなしで続けます。",
},
en: {
intro: "Connect the FM-1 by USB. (Works in Chrome or Edge.)",
warn: "Do not unplug the USB cable while writing.",
samples: "Note: JIANT has no user samples. Felucca's user samples (USR1–3) are lost when you install it (that flash holds the songs now). Keep your original WAV files.",
dual: "Since 0.6.71 JIANT uses both of the FM-1's cores (experimental). It has passed every virtual test but has not been tried on a real unit yet. If your FM-1 freezes, restarts or clicks more than before, hold REC while switching it on to play on one core, and tell us on GitHub what MENU > ABOUT says (CORES 2, or CORES 1 and why).",
install: "Install", other: "日本語",
firstTitle: "Coming from another custom firmware? Return to official V15 first",
firstText: "Writing JIANT straight over another custom firmware (Felucca, baudgirl or any other) can leave the FM-1 unable to start. First return to official V15 with the button below (it also saves a complete backup), then install JIANT. If the FM-1 already runs official V15 or JIANT, go ahead.",
firstStock: "Return to official V15 first",
firstOk: "Before installing, the installer checks the connected FM-1's firmware by itself: it writes only over official V15 or JIANT.",
checking: "Checking the FM-1's firmware…",
otherfw: "This FM-1 runs a firmware that is neither official V15 nor JIANT: nothing was written. Return to official V15 first with the button below, then install again. Found: ",
editor: "Editor (after installing: edit sounds and sequences from the computer)",
verLabel: "Version:", verOld: "You can go back to an earlier version too (newest on top). Projects saved by a newer version may not open right in an older one: back them up with the editor first.", latest: "latest", manual: "Manual:",
direct: "Connect the USB cable directly to the computer. No probe or Transporter is needed.",
brick: "If an install fails and the FM-1 no longer starts, recovering it needs a Transporter:",
beta: "JIANT FM is a development release; please report problems on GitHub. The author accepts no responsibility if your FM-1 is damaged or misbehaves because of this custom firmware. Use it at your own risk.",
back: "Get official FM-1 V15 from M-VAVE and select the unmodified FM-1.fwsc. The browser validates it locally; it is not sent to a server.",
stockTitle: "Return to official V15", stockFile: "Official FM-1.fwsc", stockGo: "Back up and return to official V15",
stockBackup: "Current music, saved music, sound banks and settings are saved first (not user samples). Older firmware needs an update for complete backups. To restore an archive later, reinstall JIANT and use the editor.",
stockRecovery: "Resume an interrupted update: I already saved a complete backup to this computer",
stockValid: "Official V15 verified", stockConfirm: "Has the complete backup file been saved to this computer? Continue to return to official V15. Official V15 cannot open JIANT music.",
stockNeedBackup: "An update loader cannot export a backup. Only select resume if you already saved a complete backup.",
stockUnsupported: "This firmware does not support complete backups. Install the current JIANT first.",
backup: "Saving complete backup ", stockError: "Cannot validate official firmware: ",
nomidi: "This browser cannot do it. Open the page in Chrome or Edge.", loadfail: "Could not load: ",
start: "Starting", verify: "Verifying", loader: "Switching to update mode", write: "Writing",
reboot: "Restarting", done: "Done", stopped: "Stopped. Replug the USB cable and press Install again.",
error: "Error: ",
denied: "MIDI (SysEx) access was not allowed. Allow MIDI in the site settings (address bar) and press Install again.",
blocked: "MIDI is blocked for this site (once its prompt was dismissed or refused, the browser stops asking). Tap the icon left of the address → Permissions (Site settings) → MIDI device control → Allow. Reload the page and press Install again.",
notfound: "FM-1 not found. Check the USB cable (a data cable), close other apps that use MIDI, and press Install again.",
model: "The connected device is not an FM-1.",
lost: "The USB connection was lost. Replug it and press Install again.",
noloader: "The FM-1 in update mode was not found. Replug the USB cable and press Install again (it stays in update mode until it is finished).",
noreturn: "The FM-1 did not come back. Power-cycle it.",
mismatch: "Written, but the FM-1 reports another version: ",
badpkg: "The file to install is damaged. Reload the page.",
leave: "Writing. Do not close the page.",
license: "GPL-3.0, no warranty. Source:",
n085Title: "Before you install 0.8.5",
n085What: "New in 0.8.5, DRUM-X octaves: in the centre octave (OCT 0) the kit plays as it always did. In the octaves above, the same sounds ratchet in time (+1 x2, +2 x4, +3 x8); below, they play with another touch: −1 SHORT (half the decay), −2 GHOST (short, softer, darker: ghost notes), −3 FLAM (a soft grace hit ~20 ms before the hit). Each sound of the kit keeps its own: a hi-hat ratchet does not repeat the kick on the same step.",
n085Risk: "Existing songs may sound different: MIDI notes outside the GM map (35–81) sent to a DRUM track, which played as their octave until now (for example 24, or 84 and up), now trigger those variations; keys with OCT moved no longer change the sound, they ratchet / play SHORT / GHOST / FLAM. Notes stored in the steps play as before.",
n085Keep: "To keep the old sound, move those notes to the centre octave (36–47, or the GM map 35–81) in your DAW or sequencer. Before installing, save a complete backup of your projects with the editor (Backup) or with Return to official V15 below.",
n085Confirm: "0.8.5 adds the DRUM-X octaves: drum notes outside the centre octave now play as ratchets / SHORT / GHOST / FLAM (existing songs may change). Have you saved a backup of your projects? OK installs it.",
sixTitle: "This version keeps 6 songs (8 before). Back up your projects before updating.",
sixText: "Songs 7 and 8 no longer open (that flash is kept for a drum sample bank). Before installing, move them into a free song among 1–6, or save a backup with the button below: it keeps every song. Restoring it later brings songs 1–6 back; the editor says songs 7 and 8 were not restored.",
sixBackup: "Back up now", sixNone: "No backup saved yet.", sixDone: "Backup saved: ", sixSaved: "Backup saved to this computer. You can install now.",
sixStock: "Official V15: there are no JIANT projects to back up.",
sixConfirm: "Install without a backup? Songs 7 and 8 will no longer open. OK continues without a backup.",
},
};
let lang = (navigator.language || "en").toLowerCase().startsWith("ja") ? "ja" : "en";
const t = (k) => TEXT[lang][k];
let lastKey = null, lastArg = "";
function applyLang() {
document.documentElement.lang = lang;
document.querySelectorAll("[data-t]").forEach((e) => { e.textContent = t(e.dataset.t); });
$("lang").textContent = t("other");
if (lastKey) $("status").textContent = t(lastKey) + lastArg;
}
$("lang").addEventListener("click", () => { lang = lang === "ja" ? "en" : "ja"; applyLang(); });
applyLang();
const sayK = (k, arg = "") => { lastKey = k; lastArg = arg; $("status").textContent = t(k) + arg; };
const say = (txt) => { lastKey = null; $("status").textContent = txt; };
const log = (t) => { $("log").textContent += t + "\n"; };
let image = null;
const meta = /*META*/;
let writing = false, stock = null, stockFileEpoch = 0;
const lockInstaller = (on) => { writing = on; $("ver").disabled = on; $("go").disabled = on || !image; $("stock-go").disabled = on || !stock; $("stock-file").disabled = on; $("stock-recovery").disabled = on; $("backup-go").disabled = on; };
/* (V10.6p) backupFirst: Install asks for a backup saved here (or official V15: nothing to save) or a go without one */
let backedUp = false;
window.addEventListener("beforeunload", (e) => { if (writing) { e.preventDefault(); e.returnValue = t("leave"); } });
/* (0.6.46) the version to install: the current one or one of the last few (make_site.py PREV_DIR) */
const versions = meta.versions && meta.versions.length ? meta.versions : [{ version: meta.version, pkg: meta.pkg }];
let loadEpoch = 0;
function fillVersions() {
const sel = $("ver"), at = sel.selectedIndex;
sel.textContent = "";
versions.forEach((v, i) => { const o = document.createElement("option"); o.value = i;
o.textContent = i ? v.version : `${v.version} (${t("latest")})`; sel.appendChild(o); });
sel.selectedIndex = at > 0 ? at : 0;
}
async function loadVersion(i) {
const v = versions[i] || versions[0], epoch = ++loadEpoch;
image = null; $("go").disabled = true;
try {
const r = await fetch(v.pkg);
if (!r.ok) throw new Error(`${v.pkg}: HTTP ${r.status}`);
const pkg = new Uint8Array(await r.arrayBuffer());
if (epoch !== loadEpoch) return;
if (productOf(pkg) !== meta.product) { sayK("badpkg"); return; }
image = logicalImage(pkg);
say(`JIANT FM ${v.version}`);
$("go").disabled = writing;
} catch (e) { if (epoch === loadEpoch) sayK("loadfail", e.message); }
}
/* (0.8.5) a release's notice before it is written: 0.8.5 (the DRUM-X octaves change how some drum notes sound), on
* either installer (the preview's and web/STABLE's) whenever the version picked is 0.8.5; never on the landing page */
function releaseNotice(version) {
return /^v?0\.8\.5(?![0-9])/.test(String(version)) ? "n085" : "";
}
const noticeOf = () => releaseNotice((versions[+$("ver").value] || versions[0]).version);
const showNotice = () => { $("notice").hidden = !noticeOf(); };
fillVersions();
showNotice();
$("lang").addEventListener("click", fillVersions);
$("ver").addEventListener("change", () => { showNotice(); if (!writing) loadVersion(+$("ver").value); });
(async () => {
if (!navigator.requestMIDIAccess) { sayK("nomidi"); return; }
await loadVersion(0);
})();
/* (0.6.21) a report of a brick from another custom firmware; (0.6.62) the installer checks it itself (fwKind): it
* writes only over official V15 (FM-1_015) or JIANT (FM-1_9xx answering the editor's INFO as JIANT: its tag 0x4A, or
* an older JIANT's six tracks with a v0.x version); anything else is sent to Return to official V15 first */
/* (0.6.70) MIDI refused: blocked for the site (the browser no longer asks: say where to allow it) or just dismissed */
async function midiRefused(e) {
let state = "";
try { state = (await navigator.permissions.query({ name: "midi", sysex: true })).state; } catch (_) {}
log(`midi: ${e && e.name} ${state}`);
sayK(state === "denied" ? "blocked" : "denied");
}
function isJiantInfo(a) {
const z = a.indexOf(0); if (z < 0) return false;
const version = String.fromCharCode(...a.slice(0, z));
if (!/^(FELUCCA|JIANT) /i.test(version)) return false;
let pos = z + 1; const engines = a[pos]; pos += 5;
for (let i = 0; i < engines; i++) { const end = a.indexOf(0, pos); if (end < 0) return false; pos = end + 1; }
const ntrk = a[pos], ext = a.slice(pos + 1);
for (let i = 0; i + 2 < ext.length; i++) if (ext[i] === 0x4A && ext[i + 1] === 1 && ext[i + 2] === 1) return true;
return ntrk === 6 && /^(FELUCCA|JIANT) v0\./i.test(version);
}
async function fwKind(up) {
const dev = await up.find((id) => !/^ota-/i.test(id.model));
if (!dev) return { kind: "none" };
const text = dev.id.text;
if (text === "FM-1_015") { dev.link.close(); return { kind: "stock", text }; }
if (!/^FM-1_9\d\d$/.test(text)) { dev.link.close(); return { kind: "other", text }; }
const input = dev.link.input, output = dev.link.output; dev.link.close();
const link = new BackupConnection(input, output);
try { return isJiantInfo(await link.request([1, []], { timeout: 2000 })) ? { kind: "jiant", text } : { kind: "other", text }; }
catch (e) { return { kind: "other", text: text + " (no answer)" }; }
finally { link.close(); }
}
$("first-stock").addEventListener("click", () => { $("stock").open = true; $("stock").scrollIntoView({ behavior: "smooth" }); });
$("go").addEventListener("click", async () => {
if (writing) return;
const nk = noticeOf();
if (nk && !confirm(t(nk + "Confirm"))) { $("notice").scrollIntoView({ behavior: "smooth" }); return; }
if (!backedUp && !confirm(t("sixConfirm"))) { $("six").scrollIntoView({ behavior: "smooth" }); return; }
lockInstaller(true);
let midi;
try { midi = await navigator.requestMIDIAccess({ sysex: true }); }
catch (e) { await midiRefused(e); lockInstaller(false); return; }
try {
const up = new Updater(midi, log);
const total = 74 + 1167;
const step = (k, a) => {
log(`${k} ${a ?? ""}`);
if (k === "start") sayK("start");
if (k === "verify") { sayK("verify"); $("bar").value = (a / total) * 100; }
if (k === "loader") sayK("loader");
if (k === "write") { sayK("write"); $("bar").value = ((74 + a) / total) * 100; }
if (k === "reboot") sayK("reboot");
if (k === "done") { $("bar").value = 100; sayK("done"); }
};
const ota = await up.find((id) => /^ota-/i.test(id.model));
if (ota) {
ota.link.close();
sayK((await up.resume(image, step, meta.product)) ? "done" : "stopped");
} else {
sayK("checking");
const fw = await fwKind(up);
log(`firmware: ${fw.kind} ${fw.text || ""}`);
if (fw.kind === "none") { sayK("notfound"); lockInstaller(false); return; }
if (fw.kind === "other") { sayK("otherfw", fw.text); $("stock").open = true; lockInstaller(false); return; }
await up.install(image, meta.product, step);
}
} catch (e) {
if (e && e.code && TEXT[lang][e.code]) sayK(e.code, e.detail || "");
else sayK("error", e && e.message);
log(String(e && e.stack || e));
}
lockInstaller(false);
});
$("stock-file").addEventListener("change", async () => {
const epoch = ++stockFileEpoch, file = $("stock-file").files[0]; stock = null; lockInstaller(false);
if (!file) return;
try {
if (file.size !== STOCK_V15_SIZE) throw new Error("FM-1 V15 / FM-1.fwsc");
const verified = await validateStockPackage(new Uint8Array(await file.arrayBuffer()));
if (epoch !== stockFileEpoch) return;
stock = verified; sayK("stockValid"); lockInstaller(false);
} catch (e) { if (epoch === stockFileEpoch) sayK("stockError", e.message); }
});
function saveArchive(archive) {
const url = URL.createObjectURL(new Blob([JSON.stringify(archive)], {type:"application/json"}));
const a = document.createElement("a"); a.href = url; a.download = `JIANT-backup-${new Date().toISOString().slice(0,10)}.json`;
document.body.append(a); a.click(); a.remove(); setTimeout(() => URL.revokeObjectURL(url), 1000);
}
function archiveInfo(a) {
let pos = a.indexOf(0); if (pos < 0) throw new Error("Invalid INFO");
const version = String.fromCharCode(...a.slice(0,pos)); pos++;
const engines = a[pos]; pos += 5;
for (let i = 0; i < engines; i++) { const end = a.indexOf(0,pos); if (end < 0) throw new Error("Invalid INFO"); pos = end + 1; }
const ext = a.slice(pos + 1);
const supported = /^(FELUCCA|JIANT) /i.test(version) && ext[0] === 16 && ext[1] === 0x55 && ext[2] === 1 &&
ext[4] === 0x4d && ext[5] === 1 && ext[8] === 0x42 && ext[9] === 1 && (ext[10] & 1);
return {version,supported};
}
/* (V10.6p) the complete backup, before installing: the FM-1 as it runs now (an older JIANT lists its 8 songs: all kept) */
$("backup-go").addEventListener("click", async () => {
if (writing) return;
lockInstaller(true);
let link = null;
try {
let midi;
try { midi = await navigator.requestMIDIAccess({sysex:true}); } catch (e) { await midiRefused(e); return; }
const up = new Updater(midi, log);
const device = await up.find(id => id.model === "FM-1");
if (!device) { sayK("notfound"); return; }
if (device.id.text === "FM-1_015") { device.link.close(); backedUp = true; $("backup-state").dataset.t = "sixStock"; applyLang(); return; }
const input = device.link.input, output = device.link.output; device.link.close();
link = new BackupConnection(input, output);
const info = archiveInfo(await link.request([1,[]]));
if (!info.supported) { sayK("stockUnsupported"); return; }
const archive = await captureBackup((r,o) => link.request(r,o), info.version,
(done,total) => sayK("backup", `${Math.round(done / Math.max(1,total) * 100)}%`));
saveArchive(archive); backedUp = true;
$("backup-state").dataset.t = "sixSaved"; applyLang();
sayK("sixDone", `${info.version} (${archive.objects.length})`);
} catch (e) {
if (e.code && TEXT[lang][e.code]) sayK(e.code,e.detail || ""); else sayK("error",e.message);
log(String(e.stack || e));
} finally { if (link) link.close(); lockInstaller(false); }
});
$("stock-go").addEventListener("click", async () => {
if (!stock || writing) return;
const selected = stock; lockInstaller(true);
let link = null;
try {
let midi;
try { midi = await navigator.requestMIDIAccess({sysex:true}); } catch (e) { await midiRefused(e); return; }
const up = new Updater(midi, log);
const step = (k, n) => { log(`${k} ${n ?? ""}`); if (["start","verify","loader","write","reboot","done"].includes(k)) sayK(k); if (k === "done") $("bar").value = 100; };
const loader = await up.find(id => id.model === "ota-FM-1");
if (loader) {
loader.link.close();
if (!$("stock-recovery").checked) { sayK("stockNeedBackup"); return; }
if (!confirm(t("stockConfirm"))) return;
sayK(await up.resume(selected.image, step, selected.product) ? "done" : "stopped");
} else {
const device = await up.find(id => id.model === "FM-1");
if (!device) { sayK("notfound"); return; }
const input = device.link.input, output = device.link.output; device.link.close();
link = new BackupConnection(input, output);
const info = archiveInfo(await link.request([1,[]]));
if (!info.supported) { sayK("stockUnsupported"); return; }
const archive = await captureBackup((r,o) => link.request(r,o), info.version,
(done,total) => sayK("backup", `${Math.round(done / Math.max(1,total) * 100)}%`));
saveArchive(archive); link.close(); link = null;
if (!confirm(t("stockConfirm"))) return;
await up.install(selected.image, selected.product, step);
}
} catch (e) {
if (e.code && TEXT[lang][e.code]) sayK(e.code,e.detail || ""); else sayK("error",e.message);
log(String(e.stack || e));
} finally { if (link) link.close(); lockInstaller(false); }
});
</script>
</body>
</html>