c64-ready 3.2.0 → 3.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -1
- package/bin/serve.mjs +41 -133
- package/dist/assets/ActionBiker-CWiKt9dn.js +1 -0
- package/dist/assets/Panther-D558qV3B.js +1 -0
- package/dist/assets/RainbowIslands-CgoxK_qP.js +1 -0
- package/dist/assets/RoadRunner-DR_cGZ-h.js +1 -0
- package/dist/assets/RocnRope-DrUGJ0pW.js +1 -0
- package/dist/assets/Thrust-rDKv3Thu.js +1 -0
- package/dist/assets/index-C84W-vN0.js +318 -0
- package/dist/assets/src-CNh6UV6R.js +2 -0
- package/dist/index.html +19 -4
- package/dist-ts/player/c64-player.d.ts +8 -0
- package/dist-ts/player/c64-player.d.ts.map +1 -1
- package/dist-ts/player/c64-player.js +14 -1
- package/dist-ts/player/c64-player.js.map +1 -1
- package/dist-ts/player/canvas-renderer.js +1 -1
- package/dist-ts/player/display-layout.d.ts +40 -0
- package/dist-ts/player/display-layout.d.ts.map +1 -0
- package/dist-ts/player/display-layout.js +76 -0
- package/dist-ts/player/display-layout.js.map +1 -0
- package/dist-ts/player/ui-controller.d.ts +15 -2
- package/dist-ts/player/ui-controller.d.ts.map +1 -1
- package/dist-ts/player/ui-controller.js +209 -93
- package/dist-ts/player/ui-controller.js.map +1 -1
- package/dist-ts/player/ultimate-bridge.d.ts +41 -0
- package/dist-ts/player/ultimate-bridge.d.ts.map +1 -0
- package/dist-ts/player/ultimate-bridge.js +117 -0
- package/dist-ts/player/ultimate-bridge.js.map +1 -0
- package/dist-ts/player/ultimate-panel.d.ts +32 -0
- package/dist-ts/player/ultimate-panel.d.ts.map +1 -0
- package/dist-ts/player/ultimate-panel.js +258 -0
- package/dist-ts/player/ultimate-panel.js.map +1 -0
- package/package.json +1 -1
- package/src/headless/agent-cli.mjs +7 -0
- package/src/headless/player-server.mjs +197 -0
- package/src/main.ts +5 -1
- package/src/player/canvas-renderer.ts +1 -1
- package/src/player/display-layout.ts +109 -0
- package/src/player/ui-controller.ts +226 -93
- package/dist/assets/RainbowIslands-BjfmJB8z.js +0 -1
- package/dist/assets/index-B8DSjPqI.js +0 -243
- package/dist/assets/src-_trgwTvp.js +0 -2
- /package/dist/assets/{BeachHead-CuSwFD4k.js → BeachHead-BLcSLEEh.js} +0 -0
- /package/dist/assets/{ChuckieEgg-CPqBnAOF.js → ChuckieEgg-Bv2nxhYv.js} +0 -0
- /package/dist/assets/{ForbiddenForest-DsQ9jsc8.js → ForbiddenForest-CWEFgjVq.js} +0 -0
- /package/dist/assets/{Galaga-Cutc3p9s.js → Galaga-DknmKlo5.js} +0 -0
- /package/dist/assets/{Gribbly-DdZ_hHFt.js → Gribbly-nFVwULpF.js} +0 -0
- /package/dist/assets/{Hercules-vZYKm7GG.js → Hercules-Dbx_KaEi.js} +0 -0
- /package/dist/assets/{LegendOfWilf-CxSMOjsj.js → LegendOfWilf-BBW1Y7LQ.js} +0 -0
- /package/dist/assets/{MariosCementFactory-z0IZ0q30.js → MariosCementFactory-DtpgUfFO.js} +0 -0
- /package/dist/assets/{MoleAttack-buC6ChYy.js → MoleAttack-D_2aAX2V.js} +0 -0
- /package/dist/assets/{MunchyWorm-D2Zv7i0Q.js → MunchyWorm-BqWD5x4j.js} +0 -0
- /package/dist/assets/{ParkPatrol-CVj7hyoB.js → ParkPatrol-9pwc_jcb.js} +0 -0
- /package/dist/assets/{PottyPigeon-0SYpIUBa.js → PottyPigeon-CZnjIrGr.js} +0 -0
- /package/dist/assets/{Stix-BU-qUCeC.js → Stix-o2hS_Ekr.js} +0 -0
- /package/dist/assets/{Tilt-C5KtKisF.js → Tilt-BKb_k_R2.js} +0 -0
- /package/dist/assets/{UpNDown-CATRO7Mz.js → UpNDown-BQXEmKfk.js} +0 -0
- /package/dist/assets/{Uridium-DanS2KoH.js → Uridium-9u86vh1V.js} +0 -0
- /package/dist/assets/{VegetablesDeluxe-C41ViimS.js → VegetablesDeluxe-DbmngV50.js} +0 -0
- /package/dist/assets/{marked.esm-fTuuvbcB.js → marked.esm-DhpYx7TE.js} +0 -0
- /package/dist/assets/{purify.es-CRM-GE0Y.js → purify.es-CWuqV7zK.js} +0 -0
|
@@ -10,36 +10,79 @@ const css = `
|
|
|
10
10
|
.c64-dragarea{border:1px dashed #555;border-radius:6px;background:#111827;color:#aaa;padding:18px;margin:0 0 12px;text-align:center}.c64-dragarea.dragover{border-color:#7b71d5;background:#1f1b38;color:#fff}.c64-cart-preview,.c64-tools-section{background:#151527;border:1px solid #2a2a3e;border-radius:6px;padding:12px;margin:12px 0}.c64-section-hint{color:#888;font-size:12px;line-height:1.4;margin:4px 0 12px}.c64-checkbox-row{display:flex;align-items:center;gap:8px;color:#ccc;font-size:13px;margin:14px 0 4px}
|
|
11
11
|
.c64-text-input,.c64-textarea{background:#111827;border:1px solid #444;border-radius:3px;color:#ddd;font:inherit;font-size:13px;padding:5px 8px}.c64-text-input{min-width:180px}.c64-textarea{box-sizing:border-box;width:100%;min-height:120px;resize:vertical}.c64-cheevos-json-file{display:none}.c64-inline-status{color:#888;font-size:12px}
|
|
12
12
|
.c64-cheat-list{display:grid;gap:12px;margin:0 0 12px}.c64-cheat-card{background:#151527;border:1px solid #2a2a3e;border-radius:6px;padding:12px}.c64-cheat-card-header{display:flex;align-items:center;justify-content:space-between;gap:12px;margin:0 0 10px;color:#ddd;font-size:13px}.c64-cheat-remove{background:none;border:0;color:#ff9a9a;cursor:pointer;font:inherit;font-size:12px}.c64-cheat-grid{display:grid;grid-template-columns:max-content minmax(0,1fr);gap:8px 10px;align-items:center}.c64-cheat-input{background:#111827;border:1px solid #444;border-radius:3px;color:#ddd;font:inherit;font-size:13px;min-width:0;padding:5px 8px}.c64-cheat-error{color:#ff9a9a;font-size:12px;margin:8px 0 0}.c64-cheat-status{color:#aaa;font-size:12px;line-height:1.4;margin:8px 0 0}.c64-cheat-actions{display:flex;gap:8px;flex-wrap:wrap;margin-top:10px}@media (max-width:600px){.c64-cheat-grid{grid-template-columns:1fr}.c64-cheat-grid label{margin-top:4px}}
|
|
13
|
+
.c64-help-dialog,.c64-menu-panel{box-sizing:border-box;max-height:calc(100vh - 32px);max-height:calc(100dvh - 32px);overflow-y:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch}.c64-menu-panel{max-height:min(82vh,calc(100dvh - 32px))}.c64-changelog-dialog{max-height:min(70vh,calc(100dvh - 32px))}
|
|
14
|
+
.c64-help-controls{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));column-gap:24px;margin:0 0 8px}.c64-help-controls li{align-items:center;gap:8px;padding:3px 0}.c64-help-keys{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:4px}.c64-help-key{font-family:inherit;white-space:nowrap}.c64-help-dialog p.c64-help-note{margin:4px 0 0;font-size:12px;color:#888}.c64-help-dialog .c64-version{margin-top:16px}.c64-help-dialog h3{margin:16px 0 6px;font-size:13px;color:#a8a8ff;letter-spacing:1px;text-transform:uppercase}.c64-help-key-note{font-size:12px;color:#888;font-style:italic}.c64-keymap-dialog .c64-help-close{position:sticky;top:0;float:right;margin:-12px -18px 0 0}
|
|
15
|
+
@media (max-width:560px){.c64-help-controls{grid-template-columns:1fr}.c64-help-dialog,.c64-menu-panel{padding:20px 16px;width:calc(100% - 24px)}}
|
|
16
|
+
.c64-cheat-status[data-mode=ok]{color:#8fd694}.c64-cheat-status[data-mode=error]{color:#f77}#c64-ultimate-device[data-connected]{color:#8fd694}.c64-settings-section .c64-section-hint a{color:#a8a8ff;text-decoration:none}
|
|
13
17
|
`;
|
|
14
18
|
function resolveAssetUrl(baseUrl, path) {
|
|
15
19
|
const base = baseUrl ?? '/';
|
|
16
20
|
return `${base.replace(/\/+$/, '')}/${path.replace(/^\/+/, '')}`;
|
|
17
21
|
}
|
|
22
|
+
/** Help dialog controls guide: [label, keys]. Rendered as a compact two-column grid. */
|
|
18
23
|
const CONTROLS = [
|
|
19
|
-
['
|
|
20
|
-
['
|
|
21
|
-
['
|
|
22
|
-
['
|
|
23
|
-
['
|
|
24
|
+
['Joystick', ['↑', '↓', '←', '→']],
|
|
25
|
+
['Fire', ['Z', 'Left Ctrl']],
|
|
26
|
+
['Fast-forward', ['Alt +', 'Alt −']],
|
|
27
|
+
['Normal speed', ['Alt ⌫']],
|
|
28
|
+
['Run/Stop', ['Esc']],
|
|
29
|
+
['Inst/Del', ['⌫', 'Del']],
|
|
30
|
+
['Clr/Home', ['Home']],
|
|
31
|
+
['Commodore', ['Ctrl', 'Caps Lock']],
|
|
32
|
+
['Control', ['Tab']],
|
|
33
|
+
['£', ['\\']],
|
|
34
|
+
['← / ↑ glyphs', ['`', '^']],
|
|
35
|
+
['F1–F8', ['F1–F8']],
|
|
24
36
|
];
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
[
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
[
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
/** Full keyboard map, linked from the help dialog: [section title, entries]. */
|
|
38
|
+
const FULL_KEYMAP = [
|
|
39
|
+
[
|
|
40
|
+
'Joystick',
|
|
41
|
+
[
|
|
42
|
+
['Up / Down', ['↑', '↓']],
|
|
43
|
+
['Left / Right', ['←', '→']],
|
|
44
|
+
['Fire', ['Z', 'Left Ctrl']],
|
|
45
|
+
],
|
|
46
|
+
],
|
|
47
|
+
[
|
|
48
|
+
'Emulator',
|
|
49
|
+
[
|
|
50
|
+
['Faster', ['Alt +']],
|
|
51
|
+
['Slower', ['Alt −']],
|
|
52
|
+
['Normal speed', ['Alt ⌫']],
|
|
53
|
+
],
|
|
54
|
+
],
|
|
55
|
+
[
|
|
56
|
+
'C64 keyboard',
|
|
57
|
+
[
|
|
58
|
+
['Run/Stop', ['Esc']],
|
|
59
|
+
['Restore', [], 'not supported yet'],
|
|
60
|
+
['Return', ['Enter']],
|
|
61
|
+
['Shift', ['Shift']],
|
|
62
|
+
['Inst/Del', ['⌫', 'Del']],
|
|
63
|
+
['Clr/Home', ['Home']],
|
|
64
|
+
['Commodore', ['Ctrl', 'Caps Lock']],
|
|
65
|
+
['Control', ['Tab']],
|
|
66
|
+
['F1–F8', ['F1–F8']],
|
|
67
|
+
['← (arrow left)', ['`']],
|
|
68
|
+
['↑ (arrow up)', ['^', '~']],
|
|
69
|
+
['£ (pound)', ['\\']],
|
|
70
|
+
['Colon / Semicolon', [':', ';', '[', ']']],
|
|
71
|
+
['Slash', ['/', '?']],
|
|
72
|
+
['Comma / Period', [',', '.', '<', '>']],
|
|
73
|
+
['Letters, numbers, + − * = @', [], 'as typed'],
|
|
74
|
+
],
|
|
75
|
+
],
|
|
40
76
|
];
|
|
77
|
+
function renderKeymapItem([label, keys, note]) {
|
|
78
|
+
const chips = keys.map((key) => `<kbd class="c64-help-key">${key}</kbd>`).join('');
|
|
79
|
+
const extra = note ? `<span class="c64-help-key-note">${note}</span>` : '';
|
|
80
|
+
return `<li><span>${label}</span><span class="c64-help-keys">${chips}${extra}</span></li>`;
|
|
81
|
+
}
|
|
41
82
|
import { chooseAndStoreCheevosRom, storeCheevosRomFile } from './local-rom-store.js';
|
|
42
83
|
import { toViteFsUrl } from './startup-params.js';
|
|
84
|
+
import UltimatePanel from './ultimate-panel.js';
|
|
85
|
+
import { DISPLAY_MODE_STORAGE_KEY, FULLSCREEN_ENTER_ICON, FULLSCREEN_EXIT_ICON, PORTRAIT_QUERY, TOUCH_DEVICE_QUERY, displayLayoutCss, isDisplayMode, isFillLayout, isFullscreenActive, isFullscreenSupported, resolveDisplayLayout, toggleFullscreen, } from './display-layout.js';
|
|
43
86
|
import { LOAD_FORMAT_OPTIONS, getAcceptForLoadTypeSelection, getLoadTypeLabel, inferLoadTypeFromFilename, isSupportedLoadType, resolveLoadTypeSelection, } from './load-formats.js';
|
|
44
87
|
const CRT_PRELOAD_CHECKS_STORAGE_KEY = 'c64-disable-crt-preload-checks';
|
|
45
88
|
const CHEEVOS_DETECTOR_STORAGE_KEY = 'c64-cheevos-dev-detector';
|
|
@@ -196,8 +239,11 @@ export default class UIController {
|
|
|
196
239
|
this.applyCheatAction(cheat);
|
|
197
240
|
};
|
|
198
241
|
// Save previous overflow styles so we can restore them when exiting full/stretch
|
|
199
|
-
|
|
200
|
-
|
|
242
|
+
displayMode = 'standard';
|
|
243
|
+
fullscreenBtn = null;
|
|
244
|
+
keymapOverlay = null;
|
|
245
|
+
touchQuery = null;
|
|
246
|
+
portraitQuery = null;
|
|
201
247
|
connectedGamepads = new Map();
|
|
202
248
|
handleControllerConnected = (event) => {
|
|
203
249
|
const detail = event.detail;
|
|
@@ -229,6 +275,8 @@ export default class UIController {
|
|
|
229
275
|
this.createHamburger();
|
|
230
276
|
this.createMenu();
|
|
231
277
|
this.createUnmuteButton();
|
|
278
|
+
this.createFullscreenButton();
|
|
279
|
+
this.initDisplayLayout();
|
|
232
280
|
window.addEventListener('keydown', this.handleCheatKeyDown, true);
|
|
233
281
|
window.addEventListener('c64-controller-connected', this.handleControllerConnected);
|
|
234
282
|
window.addEventListener('c64-controller-disconnected', this.handleControllerDisconnected);
|
|
@@ -606,7 +654,7 @@ export default class UIController {
|
|
|
606
654
|
return;
|
|
607
655
|
const style = document.createElement('style');
|
|
608
656
|
style.setAttribute('data-c64-help', '');
|
|
609
|
-
style.textContent = css;
|
|
657
|
+
style.textContent = css + displayLayoutCss;
|
|
610
658
|
document.head.appendChild(style);
|
|
611
659
|
}
|
|
612
660
|
getVersionLabel() {
|
|
@@ -629,8 +677,7 @@ export default class UIController {
|
|
|
629
677
|
if (e.target === overlay)
|
|
630
678
|
this.close();
|
|
631
679
|
});
|
|
632
|
-
const controlItems = CONTROLS.map(([action,
|
|
633
|
-
const specialItems = SPECIAL_KEYS.map(([action, key]) => `<li><span>${action}</span><span class="c64-help-key">${key}</span></li>`).join('');
|
|
680
|
+
const controlItems = CONTROLS.map(([action, keys]) => renderKeymapItem([action, keys])).join('');
|
|
634
681
|
overlay.innerHTML = `
|
|
635
682
|
<div class="c64-help-dialog">
|
|
636
683
|
<button class="c64-help-close">×</button>
|
|
@@ -639,8 +686,7 @@ export default class UIController {
|
|
|
639
686
|
<p><a href="https://github.com/hayesmaker/c64-ready" target="_blank" rel="noopener">Source code on GitHub</a> · <a href="#" id="c64-view-changelog">View changelog</a></p>
|
|
640
687
|
<h2>CONTROLS</h2>
|
|
641
688
|
<ul class="c64-help-controls">${controlItems}</ul>
|
|
642
|
-
<
|
|
643
|
-
<ul class="c64-help-special">${specialItems}</ul>
|
|
689
|
+
<p class="c64-help-note">Other keys type as on your keyboard. <a href="#" id="c64-view-keymap">Full keyboard map →</a></p>
|
|
644
690
|
<div class="c64-version">${this.getVersionLabel()}</div>
|
|
645
691
|
</div>
|
|
646
692
|
`;
|
|
@@ -671,6 +717,34 @@ export default class UIController {
|
|
|
671
717
|
this.loadAndShowChangelog(changelogOverlay);
|
|
672
718
|
});
|
|
673
719
|
}
|
|
720
|
+
// Full keyboard map modal (hidden by default)
|
|
721
|
+
const keymapSections = FULL_KEYMAP.map(([title, entries]) => `<h3>${title}</h3><ul class="c64-help-controls">${entries.map(renderKeymapItem).join('')}</ul>`).join('');
|
|
722
|
+
const keymapOverlay = document.createElement('div');
|
|
723
|
+
keymapOverlay.className = 'c64-help-overlay c64-keymap-overlay';
|
|
724
|
+
keymapOverlay.style.zIndex = '1003';
|
|
725
|
+
keymapOverlay.innerHTML = `
|
|
726
|
+
<div class="c64-help-dialog c64-keymap-dialog">
|
|
727
|
+
<button class="c64-help-close" aria-label="Close">×</button>
|
|
728
|
+
<h2>KEYBOARD MAP</h2>
|
|
729
|
+
<p class="c64-help-note">Mixed input mode (the default): arrows and Z / Left Ctrl drive the joystick, every other key goes to the C64 keyboard. Change it under Settings → Input.</p>
|
|
730
|
+
${keymapSections}
|
|
731
|
+
</div>
|
|
732
|
+
`;
|
|
733
|
+
const closeKeymap = () => keymapOverlay.classList.remove('visible');
|
|
734
|
+
keymapOverlay.addEventListener('click', (e) => {
|
|
735
|
+
if (e.target === keymapOverlay)
|
|
736
|
+
closeKeymap();
|
|
737
|
+
});
|
|
738
|
+
keymapOverlay.querySelector('.c64-help-close').addEventListener('click', closeKeymap);
|
|
739
|
+
document.body.appendChild(keymapOverlay);
|
|
740
|
+
this.keymapOverlay = keymapOverlay;
|
|
741
|
+
overlay.querySelector('#c64-view-keymap').addEventListener('click', (ev) => {
|
|
742
|
+
ev.preventDefault();
|
|
743
|
+
const dialog = keymapOverlay.querySelector('.c64-help-dialog');
|
|
744
|
+
if (dialog)
|
|
745
|
+
dialog.scrollTop = 0;
|
|
746
|
+
keymapOverlay.classList.add('visible');
|
|
747
|
+
});
|
|
674
748
|
}
|
|
675
749
|
async loadAndShowChangelog(container) {
|
|
676
750
|
container.classList.add('visible');
|
|
@@ -703,6 +777,89 @@ export default class UIController {
|
|
|
703
777
|
el.innerHTML = '<p>No changelog found.</p>';
|
|
704
778
|
}
|
|
705
779
|
}
|
|
780
|
+
// ── Display layout & fullscreen ─────────────────────────────────────────
|
|
781
|
+
initDisplayLayout() {
|
|
782
|
+
let stored = null;
|
|
783
|
+
try {
|
|
784
|
+
stored = window.localStorage.getItem(DISPLAY_MODE_STORAGE_KEY);
|
|
785
|
+
}
|
|
786
|
+
catch {
|
|
787
|
+
// storage unavailable (private mode / blocked) — use the default
|
|
788
|
+
}
|
|
789
|
+
this.displayMode = isDisplayMode(stored) ? stored : 'standard';
|
|
790
|
+
if (typeof window.matchMedia === 'function') {
|
|
791
|
+
this.touchQuery = window.matchMedia(TOUCH_DEVICE_QUERY);
|
|
792
|
+
this.portraitQuery = window.matchMedia(PORTRAIT_QUERY);
|
|
793
|
+
this.touchQuery.addEventListener?.('change', this.applyDisplayLayout);
|
|
794
|
+
this.portraitQuery.addEventListener?.('change', this.applyDisplayLayout);
|
|
795
|
+
}
|
|
796
|
+
document.addEventListener('fullscreenchange', this.applyDisplayLayout);
|
|
797
|
+
document.addEventListener('webkitfullscreenchange', this.applyDisplayLayout);
|
|
798
|
+
this.setDisplayMode(this.displayMode, { persist: false });
|
|
799
|
+
}
|
|
800
|
+
/** Change the user-selected display mode (Settings → Display). */
|
|
801
|
+
setDisplayMode(mode, { persist = true } = {}) {
|
|
802
|
+
this.displayMode = mode;
|
|
803
|
+
if (persist) {
|
|
804
|
+
try {
|
|
805
|
+
window.localStorage.setItem(DISPLAY_MODE_STORAGE_KEY, mode);
|
|
806
|
+
}
|
|
807
|
+
catch {
|
|
808
|
+
// ignore — preference just won't survive a reload
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
const radio = document.querySelector(`input[name="c64-display-mode"][value="${mode}"]`);
|
|
812
|
+
if (radio)
|
|
813
|
+
radio.checked = true;
|
|
814
|
+
const canvas = document.getElementById('c64-screen');
|
|
815
|
+
canvas?.setAttribute('data-display-mode', mode);
|
|
816
|
+
this.applyDisplayLayout();
|
|
817
|
+
window.dispatchEvent(new CustomEvent('c64-display-mode-changed', { detail: { mode } }));
|
|
818
|
+
}
|
|
819
|
+
getDisplayMode() {
|
|
820
|
+
return this.displayMode;
|
|
821
|
+
}
|
|
822
|
+
applyDisplayLayout = () => {
|
|
823
|
+
const fullscreen = isFullscreenActive();
|
|
824
|
+
const layout = resolveDisplayLayout(this.displayMode, {
|
|
825
|
+
fullscreen,
|
|
826
|
+
touch: this.touchQuery?.matches ?? false,
|
|
827
|
+
portrait: this.portraitQuery?.matches ?? false,
|
|
828
|
+
});
|
|
829
|
+
const root = document.documentElement;
|
|
830
|
+
root.setAttribute('data-c64-layout', layout);
|
|
831
|
+
root.toggleAttribute('data-c64-fill', isFillLayout(layout));
|
|
832
|
+
root.toggleAttribute('data-c64-fullscreen', fullscreen);
|
|
833
|
+
if (this.fullscreenBtn) {
|
|
834
|
+
this.fullscreenBtn.innerHTML = fullscreen ? FULLSCREEN_EXIT_ICON : FULLSCREEN_ENTER_ICON;
|
|
835
|
+
this.fullscreenBtn.title = fullscreen ? 'Exit fullscreen' : 'Fullscreen';
|
|
836
|
+
this.fullscreenBtn.setAttribute('aria-label', this.fullscreenBtn.title);
|
|
837
|
+
}
|
|
838
|
+
};
|
|
839
|
+
async toggleFullscreen() {
|
|
840
|
+
try {
|
|
841
|
+
await toggleFullscreen();
|
|
842
|
+
}
|
|
843
|
+
catch (error) {
|
|
844
|
+
console.warn('[c64-ready] fullscreen request failed:', error);
|
|
845
|
+
}
|
|
846
|
+
}
|
|
847
|
+
createFullscreenButton() {
|
|
848
|
+
if (!isFullscreenSupported())
|
|
849
|
+
return;
|
|
850
|
+
const btn = document.createElement('button');
|
|
851
|
+
btn.className = 'c64-fullscreen-btn';
|
|
852
|
+
btn.type = 'button';
|
|
853
|
+
btn.innerHTML = FULLSCREEN_ENTER_ICON;
|
|
854
|
+
btn.title = 'Fullscreen';
|
|
855
|
+
btn.setAttribute('aria-label', 'Fullscreen');
|
|
856
|
+
btn.addEventListener('click', () => {
|
|
857
|
+
btn.blur(); // keep keyboard focus off the button so Space etc. reach the C64
|
|
858
|
+
void this.toggleFullscreen();
|
|
859
|
+
});
|
|
860
|
+
document.body.appendChild(btn);
|
|
861
|
+
this.fullscreenBtn = btn;
|
|
862
|
+
}
|
|
706
863
|
createHamburger() {
|
|
707
864
|
const btn = document.createElement('button');
|
|
708
865
|
btn.className = 'c64-hamburger';
|
|
@@ -725,6 +882,7 @@ export default class UIController {
|
|
|
725
882
|
{ id: 'audio', label: 'Audio' },
|
|
726
883
|
{ id: 'cheevos', label: 'Cheevos' },
|
|
727
884
|
{ id: 'cheats', label: 'Cheats' },
|
|
885
|
+
{ id: 'ultimate', label: 'Ultimate' },
|
|
728
886
|
{ id: 'system', label: 'System' },
|
|
729
887
|
];
|
|
730
888
|
const loadTypeOptions = LOAD_FORMAT_OPTIONS.map((format) => `<option value="${format.type}">${format.label}</option>`).join('');
|
|
@@ -807,6 +965,10 @@ export default class UIController {
|
|
|
807
965
|
<label><input type="radio" name="c64-display-mode" value="full" /> Full</label>
|
|
808
966
|
<label><input type="radio" name="c64-display-mode" value="stretch" /> Stretch</label>
|
|
809
967
|
</div>
|
|
968
|
+
<div class="c64-section-hint">Standard: 2x size on desktop; fills the screen width on phones in portrait and the screen height in landscape. Full: as large as the window allows. Stretch: fills the window, ignoring the aspect ratio.</div>
|
|
969
|
+
<div class="c64-menu-actions">
|
|
970
|
+
<button class="c64-btn" id="c64-fullscreen-toggle" type="button">Toggle Fullscreen</button>
|
|
971
|
+
</div>
|
|
810
972
|
</section>
|
|
811
973
|
|
|
812
974
|
<section class="c64-settings-section" data-settings-section="audio" hidden>
|
|
@@ -859,6 +1021,10 @@ export default class UIController {
|
|
|
859
1021
|
</div>
|
|
860
1022
|
</section>
|
|
861
1023
|
|
|
1024
|
+
<section class="c64-settings-section" data-settings-section="ultimate" hidden>
|
|
1025
|
+
<div id="c64-ultimate-section-anchor"></div>
|
|
1026
|
+
</section>
|
|
1027
|
+
|
|
862
1028
|
<section class="c64-settings-section" data-settings-section="system" hidden>
|
|
863
1029
|
<label class="c64-section-label">System Actions</label>
|
|
864
1030
|
<div class="c64-system-actions">
|
|
@@ -1286,6 +1452,9 @@ export default class UIController {
|
|
|
1286
1452
|
// ── Audio section ─────────────────────────────────────────────────────
|
|
1287
1453
|
const audioContainer = panel.querySelector('#c64-audio-section-anchor');
|
|
1288
1454
|
this.createAudioSection(audioContainer);
|
|
1455
|
+
// ── Ultimate section ──────────────────────────────────────────────────
|
|
1456
|
+
const ultimateContainer = panel.querySelector('#c64-ultimate-section-anchor');
|
|
1457
|
+
new UltimatePanel(ultimateContainer, () => this.player).init();
|
|
1289
1458
|
// ── Input section wiring ───────────────────────────────────────────────
|
|
1290
1459
|
const joyRadios = panel.querySelectorAll('input[name="c64-joy-port"]');
|
|
1291
1460
|
const setJoyPort = (port) => {
|
|
@@ -1337,76 +1506,22 @@ export default class UIController {
|
|
|
1337
1506
|
this.renderGamepadButtons();
|
|
1338
1507
|
// ── Display section wiring ─────────────────────────────────────────────
|
|
1339
1508
|
const displayRadios = panel.querySelectorAll('input[name="c64-display-mode"]');
|
|
1340
|
-
const canvas = document.getElementById('c64-screen');
|
|
1341
|
-
const applyDisplayMode = (mode) => {
|
|
1342
|
-
if (!canvas)
|
|
1343
|
-
return;
|
|
1344
|
-
// Reset to defaults first
|
|
1345
|
-
canvas.style.width = '';
|
|
1346
|
-
canvas.style.height = '';
|
|
1347
|
-
canvas.style.objectFit = '';
|
|
1348
|
-
canvas.removeAttribute('data-display-mode');
|
|
1349
|
-
if (mode === 'standard') {
|
|
1350
|
-
// Use the default CSS size (no change)
|
|
1351
|
-
canvas.style.width = '';
|
|
1352
|
-
canvas.style.height = '';
|
|
1353
|
-
// Restore the default border from CSS
|
|
1354
|
-
canvas.style.border = '';
|
|
1355
|
-
// Restore any previously-saved page overflow styles so scrollbars reappear
|
|
1356
|
-
if (this.savedHtmlOverflow !== null) {
|
|
1357
|
-
document.documentElement.style.overflow = this.savedHtmlOverflow;
|
|
1358
|
-
this.savedHtmlOverflow = null;
|
|
1359
|
-
}
|
|
1360
|
-
else {
|
|
1361
|
-
document.documentElement.style.overflow = '';
|
|
1362
|
-
}
|
|
1363
|
-
if (this.savedBodyOverflow !== null) {
|
|
1364
|
-
document.body.style.overflow = this.savedBodyOverflow;
|
|
1365
|
-
this.savedBodyOverflow = null;
|
|
1366
|
-
}
|
|
1367
|
-
else {
|
|
1368
|
-
document.body.style.overflow = '';
|
|
1369
|
-
}
|
|
1370
|
-
}
|
|
1371
|
-
else if (mode === 'full') {
|
|
1372
|
-
// Maintain aspect ratio, make canvas fill the full height of the browser
|
|
1373
|
-
canvas.style.height = '100vh';
|
|
1374
|
-
canvas.style.width = 'auto';
|
|
1375
|
-
canvas.style.objectFit = 'contain';
|
|
1376
|
-
// Remove canvas border in full-screen-like modes
|
|
1377
|
-
canvas.style.border = 'none';
|
|
1378
|
-
// Hide page scrollbars (prevent overflow when canvas touches edges)
|
|
1379
|
-
if (this.savedHtmlOverflow === null)
|
|
1380
|
-
this.savedHtmlOverflow = document.documentElement.style.overflow;
|
|
1381
|
-
if (this.savedBodyOverflow === null)
|
|
1382
|
-
this.savedBodyOverflow = document.body.style.overflow;
|
|
1383
|
-
document.documentElement.style.overflow = 'hidden';
|
|
1384
|
-
document.body.style.overflow = 'hidden';
|
|
1385
|
-
}
|
|
1386
|
-
else if (mode === 'stretch') {
|
|
1387
|
-
// Stretch to full width and height (may alter aspect ratio)
|
|
1388
|
-
canvas.style.width = '100vw';
|
|
1389
|
-
canvas.style.height = '100vh';
|
|
1390
|
-
canvas.style.objectFit = 'fill';
|
|
1391
|
-
// Remove canvas border in full-screen-like modes
|
|
1392
|
-
canvas.style.border = 'none';
|
|
1393
|
-
// Hide page scrollbars (prevent overflow when canvas touches edges)
|
|
1394
|
-
if (this.savedHtmlOverflow === null)
|
|
1395
|
-
this.savedHtmlOverflow = document.documentElement.style.overflow;
|
|
1396
|
-
if (this.savedBodyOverflow === null)
|
|
1397
|
-
this.savedBodyOverflow = document.body.style.overflow;
|
|
1398
|
-
document.documentElement.style.overflow = 'hidden';
|
|
1399
|
-
document.body.style.overflow = 'hidden';
|
|
1400
|
-
}
|
|
1401
|
-
canvas.setAttribute('data-display-mode', mode);
|
|
1402
|
-
window.dispatchEvent(new CustomEvent('c64-display-mode-changed', { detail: { mode } }));
|
|
1403
|
-
};
|
|
1404
1509
|
displayRadios.forEach((r) => {
|
|
1405
1510
|
r.addEventListener('change', () => {
|
|
1406
|
-
if (r.checked)
|
|
1407
|
-
|
|
1511
|
+
if (r.checked && isDisplayMode(r.value))
|
|
1512
|
+
this.setDisplayMode(r.value);
|
|
1408
1513
|
});
|
|
1409
1514
|
});
|
|
1515
|
+
const fullscreenToggle = panel.querySelector('#c64-fullscreen-toggle');
|
|
1516
|
+
if (isFullscreenSupported()) {
|
|
1517
|
+
fullscreenToggle.addEventListener('click', () => {
|
|
1518
|
+
this.closeMenu();
|
|
1519
|
+
void this.toggleFullscreen();
|
|
1520
|
+
});
|
|
1521
|
+
}
|
|
1522
|
+
else {
|
|
1523
|
+
fullscreenToggle.hidden = true;
|
|
1524
|
+
}
|
|
1410
1525
|
window.addEventListener('c64-close-dialog', () => {
|
|
1411
1526
|
this.closeMenu();
|
|
1412
1527
|
});
|
|
@@ -1511,6 +1626,7 @@ export default class UIController {
|
|
|
1511
1626
|
}
|
|
1512
1627
|
close() {
|
|
1513
1628
|
this.helpOverlay?.classList.remove('visible');
|
|
1629
|
+
this.keymapOverlay?.classList.remove('visible');
|
|
1514
1630
|
}
|
|
1515
1631
|
}
|
|
1516
1632
|
//# sourceMappingURL=ui-controller.js.map
|