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,6 +10,9 @@ 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)}}
|
|
13
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}
|
|
14
17
|
`;
|
|
15
18
|
|
|
@@ -25,36 +28,91 @@ function resolveAssetUrl(baseUrl: string | undefined, path: string): string {
|
|
|
25
28
|
return `${base.replace(/\/+$/, '')}/${path.replace(/^\/+/, '')}`;
|
|
26
29
|
}
|
|
27
30
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
['
|
|
31
|
-
['
|
|
32
|
-
['
|
|
33
|
-
['
|
|
31
|
+
/** Help dialog controls guide: [label, keys]. Rendered as a compact two-column grid. */
|
|
32
|
+
const CONTROLS: ReadonlyArray<readonly [string, readonly string[]]> = [
|
|
33
|
+
['Joystick', ['↑', '↓', '←', '→']],
|
|
34
|
+
['Fire', ['Z', 'Left Ctrl']],
|
|
35
|
+
['Fast-forward', ['Alt +', 'Alt −']],
|
|
36
|
+
['Normal speed', ['Alt ⌫']],
|
|
37
|
+
['Run/Stop', ['Esc']],
|
|
38
|
+
['Inst/Del', ['⌫', 'Del']],
|
|
39
|
+
['Clr/Home', ['Home']],
|
|
40
|
+
['Commodore', ['Ctrl', 'Caps Lock']],
|
|
41
|
+
['Control', ['Tab']],
|
|
42
|
+
['£', ['\\']],
|
|
43
|
+
['← / ↑ glyphs', ['`', '^']],
|
|
44
|
+
['F1–F8', ['F1–F8']],
|
|
34
45
|
];
|
|
35
46
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
[
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
[
|
|
49
|
-
|
|
50
|
-
|
|
47
|
+
type KeymapEntry = readonly [label: string, keys: readonly string[], note?: string];
|
|
48
|
+
|
|
49
|
+
/** Full keyboard map, linked from the help dialog: [section title, entries]. */
|
|
50
|
+
const FULL_KEYMAP: ReadonlyArray<readonly [string, readonly KeymapEntry[]]> = [
|
|
51
|
+
[
|
|
52
|
+
'Joystick',
|
|
53
|
+
[
|
|
54
|
+
['Up / Down', ['↑', '↓']],
|
|
55
|
+
['Left / Right', ['←', '→']],
|
|
56
|
+
['Fire', ['Z', 'Left Ctrl']],
|
|
57
|
+
],
|
|
58
|
+
],
|
|
59
|
+
[
|
|
60
|
+
'Emulator',
|
|
61
|
+
[
|
|
62
|
+
['Faster', ['Alt +']],
|
|
63
|
+
['Slower', ['Alt −']],
|
|
64
|
+
['Normal speed', ['Alt ⌫']],
|
|
65
|
+
],
|
|
66
|
+
],
|
|
67
|
+
[
|
|
68
|
+
'C64 keyboard',
|
|
69
|
+
[
|
|
70
|
+
['Run/Stop', ['Esc']],
|
|
71
|
+
['Restore', [], 'not supported yet'],
|
|
72
|
+
['Return', ['Enter']],
|
|
73
|
+
['Shift', ['Shift']],
|
|
74
|
+
['Inst/Del', ['⌫', 'Del']],
|
|
75
|
+
['Clr/Home', ['Home']],
|
|
76
|
+
['Commodore', ['Ctrl', 'Caps Lock']],
|
|
77
|
+
['Control', ['Tab']],
|
|
78
|
+
['F1–F8', ['F1–F8']],
|
|
79
|
+
['← (arrow left)', ['`']],
|
|
80
|
+
['↑ (arrow up)', ['^', '~']],
|
|
81
|
+
['£ (pound)', ['\\']],
|
|
82
|
+
['Colon / Semicolon', [':', ';', '[', ']']],
|
|
83
|
+
['Slash', ['/', '?']],
|
|
84
|
+
['Comma / Period', [',', '.', '<', '>']],
|
|
85
|
+
['Letters, numbers, + − * = @', [], 'as typed'],
|
|
86
|
+
],
|
|
87
|
+
],
|
|
51
88
|
];
|
|
52
89
|
|
|
90
|
+
function renderKeymapItem([label, keys, note]: KeymapEntry): string {
|
|
91
|
+
const chips = keys.map((key) => `<kbd class="c64-help-key">${key}</kbd>`).join('');
|
|
92
|
+
const extra = note ? `<span class="c64-help-key-note">${note}</span>` : '';
|
|
93
|
+
return `<li><span>${label}</span><span class="c64-help-keys">${chips}${extra}</span></li>`;
|
|
94
|
+
}
|
|
95
|
+
|
|
53
96
|
import type { C64Player } from './c64-player';
|
|
54
97
|
import type { JoystickPort } from '../emulator/constants';
|
|
55
98
|
import { chooseAndStoreCheevosRom, storeCheevosRomFile } from './local-rom-store';
|
|
56
99
|
import { toViteFsUrl } from './startup-params';
|
|
57
100
|
import UltimatePanel from './ultimate-panel';
|
|
101
|
+
import {
|
|
102
|
+
DISPLAY_MODE_STORAGE_KEY,
|
|
103
|
+
FULLSCREEN_ENTER_ICON,
|
|
104
|
+
FULLSCREEN_EXIT_ICON,
|
|
105
|
+
PORTRAIT_QUERY,
|
|
106
|
+
TOUCH_DEVICE_QUERY,
|
|
107
|
+
displayLayoutCss,
|
|
108
|
+
isDisplayMode,
|
|
109
|
+
isFillLayout,
|
|
110
|
+
isFullscreenActive,
|
|
111
|
+
isFullscreenSupported,
|
|
112
|
+
resolveDisplayLayout,
|
|
113
|
+
toggleFullscreen,
|
|
114
|
+
} from './display-layout';
|
|
115
|
+
import type { DisplayMode } from './display-layout';
|
|
58
116
|
import {
|
|
59
117
|
LOAD_FORMAT_OPTIONS,
|
|
60
118
|
getAcceptForLoadTypeSelection,
|
|
@@ -238,8 +296,11 @@ export default class UIController {
|
|
|
238
296
|
this.applyCheatAction(cheat);
|
|
239
297
|
};
|
|
240
298
|
// Save previous overflow styles so we can restore them when exiting full/stretch
|
|
241
|
-
private
|
|
242
|
-
private
|
|
299
|
+
private displayMode: DisplayMode = 'standard';
|
|
300
|
+
private fullscreenBtn: HTMLButtonElement | null = null;
|
|
301
|
+
private keymapOverlay: HTMLElement | null = null;
|
|
302
|
+
private touchQuery: MediaQueryList | null = null;
|
|
303
|
+
private portraitQuery: MediaQueryList | null = null;
|
|
243
304
|
private connectedGamepads = new Map<number, ConnectedGamepad>();
|
|
244
305
|
private readonly handleControllerConnected = (event: Event): void => {
|
|
245
306
|
const detail = (event as CustomEvent<{ name?: string; index?: number }>).detail;
|
|
@@ -271,6 +332,8 @@ export default class UIController {
|
|
|
271
332
|
this.createHamburger();
|
|
272
333
|
this.createMenu();
|
|
273
334
|
this.createUnmuteButton();
|
|
335
|
+
this.createFullscreenButton();
|
|
336
|
+
this.initDisplayLayout();
|
|
274
337
|
window.addEventListener('keydown', this.handleCheatKeyDown, true);
|
|
275
338
|
window.addEventListener('c64-controller-connected', this.handleControllerConnected);
|
|
276
339
|
window.addEventListener('c64-controller-disconnected', this.handleControllerDisconnected);
|
|
@@ -701,7 +764,7 @@ export default class UIController {
|
|
|
701
764
|
if (document.querySelector('style[data-c64-help]')) return;
|
|
702
765
|
const style = document.createElement('style');
|
|
703
766
|
style.setAttribute('data-c64-help', '');
|
|
704
|
-
style.textContent = css;
|
|
767
|
+
style.textContent = css + displayLayoutCss;
|
|
705
768
|
document.head.appendChild(style);
|
|
706
769
|
}
|
|
707
770
|
|
|
@@ -727,13 +790,9 @@ export default class UIController {
|
|
|
727
790
|
if (e.target === overlay) this.close();
|
|
728
791
|
});
|
|
729
792
|
|
|
730
|
-
const controlItems = CONTROLS.map(
|
|
731
|
-
|
|
732
|
-
)
|
|
733
|
-
|
|
734
|
-
const specialItems = SPECIAL_KEYS.map(
|
|
735
|
-
([action, key]) => `<li><span>${action}</span><span class="c64-help-key">${key}</span></li>`,
|
|
736
|
-
).join('');
|
|
793
|
+
const controlItems = CONTROLS.map(([action, keys]) => renderKeymapItem([action, keys])).join(
|
|
794
|
+
'',
|
|
795
|
+
);
|
|
737
796
|
|
|
738
797
|
overlay.innerHTML = `
|
|
739
798
|
<div class="c64-help-dialog">
|
|
@@ -743,8 +802,7 @@ export default class UIController {
|
|
|
743
802
|
<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>
|
|
744
803
|
<h2>CONTROLS</h2>
|
|
745
804
|
<ul class="c64-help-controls">${controlItems}</ul>
|
|
746
|
-
<
|
|
747
|
-
<ul class="c64-help-special">${specialItems}</ul>
|
|
805
|
+
<p class="c64-help-note">Other keys type as on your keyboard. <a href="#" id="c64-view-keymap">Full keyboard map →</a></p>
|
|
748
806
|
<div class="c64-version">${this.getVersionLabel()}</div>
|
|
749
807
|
</div>
|
|
750
808
|
`;
|
|
@@ -777,6 +835,36 @@ export default class UIController {
|
|
|
777
835
|
this.loadAndShowChangelog(changelogOverlay);
|
|
778
836
|
});
|
|
779
837
|
}
|
|
838
|
+
|
|
839
|
+
// Full keyboard map modal (hidden by default)
|
|
840
|
+
const keymapSections = FULL_KEYMAP.map(
|
|
841
|
+
([title, entries]) =>
|
|
842
|
+
`<h3>${title}</h3><ul class="c64-help-controls">${entries.map(renderKeymapItem).join('')}</ul>`,
|
|
843
|
+
).join('');
|
|
844
|
+
const keymapOverlay = document.createElement('div');
|
|
845
|
+
keymapOverlay.className = 'c64-help-overlay c64-keymap-overlay';
|
|
846
|
+
keymapOverlay.style.zIndex = '1003';
|
|
847
|
+
keymapOverlay.innerHTML = `
|
|
848
|
+
<div class="c64-help-dialog c64-keymap-dialog">
|
|
849
|
+
<button class="c64-help-close" aria-label="Close">×</button>
|
|
850
|
+
<h2>KEYBOARD MAP</h2>
|
|
851
|
+
<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>
|
|
852
|
+
${keymapSections}
|
|
853
|
+
</div>
|
|
854
|
+
`;
|
|
855
|
+
const closeKeymap = () => keymapOverlay.classList.remove('visible');
|
|
856
|
+
keymapOverlay.addEventListener('click', (e) => {
|
|
857
|
+
if (e.target === keymapOverlay) closeKeymap();
|
|
858
|
+
});
|
|
859
|
+
keymapOverlay.querySelector('.c64-help-close')!.addEventListener('click', closeKeymap);
|
|
860
|
+
document.body.appendChild(keymapOverlay);
|
|
861
|
+
this.keymapOverlay = keymapOverlay;
|
|
862
|
+
overlay.querySelector('#c64-view-keymap')!.addEventListener('click', (ev) => {
|
|
863
|
+
ev.preventDefault();
|
|
864
|
+
const dialog = keymapOverlay.querySelector('.c64-help-dialog');
|
|
865
|
+
if (dialog) dialog.scrollTop = 0;
|
|
866
|
+
keymapOverlay.classList.add('visible');
|
|
867
|
+
});
|
|
780
868
|
}
|
|
781
869
|
|
|
782
870
|
private async loadAndShowChangelog(container: HTMLElement) {
|
|
@@ -813,6 +901,96 @@ export default class UIController {
|
|
|
813
901
|
}
|
|
814
902
|
}
|
|
815
903
|
|
|
904
|
+
// ── Display layout & fullscreen ─────────────────────────────────────────
|
|
905
|
+
|
|
906
|
+
private initDisplayLayout(): void {
|
|
907
|
+
let stored: string | null = null;
|
|
908
|
+
try {
|
|
909
|
+
stored = window.localStorage.getItem(DISPLAY_MODE_STORAGE_KEY);
|
|
910
|
+
} catch {
|
|
911
|
+
// storage unavailable (private mode / blocked) — use the default
|
|
912
|
+
}
|
|
913
|
+
this.displayMode = isDisplayMode(stored) ? stored : 'standard';
|
|
914
|
+
|
|
915
|
+
if (typeof window.matchMedia === 'function') {
|
|
916
|
+
this.touchQuery = window.matchMedia(TOUCH_DEVICE_QUERY);
|
|
917
|
+
this.portraitQuery = window.matchMedia(PORTRAIT_QUERY);
|
|
918
|
+
this.touchQuery.addEventListener?.('change', this.applyDisplayLayout);
|
|
919
|
+
this.portraitQuery.addEventListener?.('change', this.applyDisplayLayout);
|
|
920
|
+
}
|
|
921
|
+
document.addEventListener('fullscreenchange', this.applyDisplayLayout);
|
|
922
|
+
document.addEventListener('webkitfullscreenchange', this.applyDisplayLayout);
|
|
923
|
+
|
|
924
|
+
this.setDisplayMode(this.displayMode, { persist: false });
|
|
925
|
+
}
|
|
926
|
+
|
|
927
|
+
/** Change the user-selected display mode (Settings → Display). */
|
|
928
|
+
setDisplayMode(mode: DisplayMode, { persist = true }: { persist?: boolean } = {}): void {
|
|
929
|
+
this.displayMode = mode;
|
|
930
|
+
if (persist) {
|
|
931
|
+
try {
|
|
932
|
+
window.localStorage.setItem(DISPLAY_MODE_STORAGE_KEY, mode);
|
|
933
|
+
} catch {
|
|
934
|
+
// ignore — preference just won't survive a reload
|
|
935
|
+
}
|
|
936
|
+
}
|
|
937
|
+
const radio = document.querySelector<HTMLInputElement>(
|
|
938
|
+
`input[name="c64-display-mode"][value="${mode}"]`,
|
|
939
|
+
);
|
|
940
|
+
if (radio) radio.checked = true;
|
|
941
|
+
|
|
942
|
+
const canvas = document.getElementById('c64-screen');
|
|
943
|
+
canvas?.setAttribute('data-display-mode', mode);
|
|
944
|
+
this.applyDisplayLayout();
|
|
945
|
+
window.dispatchEvent(new CustomEvent('c64-display-mode-changed', { detail: { mode } }));
|
|
946
|
+
}
|
|
947
|
+
|
|
948
|
+
getDisplayMode(): DisplayMode {
|
|
949
|
+
return this.displayMode;
|
|
950
|
+
}
|
|
951
|
+
|
|
952
|
+
private readonly applyDisplayLayout = (): void => {
|
|
953
|
+
const fullscreen = isFullscreenActive();
|
|
954
|
+
const layout = resolveDisplayLayout(this.displayMode, {
|
|
955
|
+
fullscreen,
|
|
956
|
+
touch: this.touchQuery?.matches ?? false,
|
|
957
|
+
portrait: this.portraitQuery?.matches ?? false,
|
|
958
|
+
});
|
|
959
|
+
const root = document.documentElement;
|
|
960
|
+
root.setAttribute('data-c64-layout', layout);
|
|
961
|
+
root.toggleAttribute('data-c64-fill', isFillLayout(layout));
|
|
962
|
+
root.toggleAttribute('data-c64-fullscreen', fullscreen);
|
|
963
|
+
if (this.fullscreenBtn) {
|
|
964
|
+
this.fullscreenBtn.innerHTML = fullscreen ? FULLSCREEN_EXIT_ICON : FULLSCREEN_ENTER_ICON;
|
|
965
|
+
this.fullscreenBtn.title = fullscreen ? 'Exit fullscreen' : 'Fullscreen';
|
|
966
|
+
this.fullscreenBtn.setAttribute('aria-label', this.fullscreenBtn.title);
|
|
967
|
+
}
|
|
968
|
+
};
|
|
969
|
+
|
|
970
|
+
async toggleFullscreen(): Promise<void> {
|
|
971
|
+
try {
|
|
972
|
+
await toggleFullscreen();
|
|
973
|
+
} catch (error) {
|
|
974
|
+
console.warn('[c64-ready] fullscreen request failed:', error);
|
|
975
|
+
}
|
|
976
|
+
}
|
|
977
|
+
|
|
978
|
+
private createFullscreenButton(): void {
|
|
979
|
+
if (!isFullscreenSupported()) return;
|
|
980
|
+
const btn = document.createElement('button');
|
|
981
|
+
btn.className = 'c64-fullscreen-btn';
|
|
982
|
+
btn.type = 'button';
|
|
983
|
+
btn.innerHTML = FULLSCREEN_ENTER_ICON;
|
|
984
|
+
btn.title = 'Fullscreen';
|
|
985
|
+
btn.setAttribute('aria-label', 'Fullscreen');
|
|
986
|
+
btn.addEventListener('click', () => {
|
|
987
|
+
btn.blur(); // keep keyboard focus off the button so Space etc. reach the C64
|
|
988
|
+
void this.toggleFullscreen();
|
|
989
|
+
});
|
|
990
|
+
document.body.appendChild(btn);
|
|
991
|
+
this.fullscreenBtn = btn;
|
|
992
|
+
}
|
|
993
|
+
|
|
816
994
|
private createHamburger(): void {
|
|
817
995
|
const btn = document.createElement('button');
|
|
818
996
|
btn.className = 'c64-hamburger';
|
|
@@ -928,6 +1106,10 @@ export default class UIController {
|
|
|
928
1106
|
<label><input type="radio" name="c64-display-mode" value="full" /> Full</label>
|
|
929
1107
|
<label><input type="radio" name="c64-display-mode" value="stretch" /> Stretch</label>
|
|
930
1108
|
</div>
|
|
1109
|
+
<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>
|
|
1110
|
+
<div class="c64-menu-actions">
|
|
1111
|
+
<button class="c64-btn" id="c64-fullscreen-toggle" type="button">Toggle Fullscreen</button>
|
|
1112
|
+
</div>
|
|
931
1113
|
</section>
|
|
932
1114
|
|
|
933
1115
|
<section class="c64-settings-section" data-settings-section="audio" hidden>
|
|
@@ -1498,70 +1680,20 @@ export default class UIController {
|
|
|
1498
1680
|
const displayRadios = panel.querySelectorAll(
|
|
1499
1681
|
'input[name="c64-display-mode"]',
|
|
1500
1682
|
) as NodeListOf<HTMLInputElement>;
|
|
1501
|
-
const canvas = document.getElementById('c64-screen') as HTMLCanvasElement | null;
|
|
1502
|
-
const applyDisplayMode = (mode: string) => {
|
|
1503
|
-
if (!canvas) return;
|
|
1504
|
-
// Reset to defaults first
|
|
1505
|
-
canvas.style.width = '';
|
|
1506
|
-
canvas.style.height = '';
|
|
1507
|
-
canvas.style.objectFit = '';
|
|
1508
|
-
canvas.removeAttribute('data-display-mode');
|
|
1509
|
-
|
|
1510
|
-
if (mode === 'standard') {
|
|
1511
|
-
// Use the default CSS size (no change)
|
|
1512
|
-
canvas.style.width = '';
|
|
1513
|
-
canvas.style.height = '';
|
|
1514
|
-
// Restore the default border from CSS
|
|
1515
|
-
canvas.style.border = '';
|
|
1516
|
-
// Restore any previously-saved page overflow styles so scrollbars reappear
|
|
1517
|
-
if (this.savedHtmlOverflow !== null) {
|
|
1518
|
-
document.documentElement.style.overflow = this.savedHtmlOverflow;
|
|
1519
|
-
this.savedHtmlOverflow = null;
|
|
1520
|
-
} else {
|
|
1521
|
-
document.documentElement.style.overflow = '';
|
|
1522
|
-
}
|
|
1523
|
-
if (this.savedBodyOverflow !== null) {
|
|
1524
|
-
document.body.style.overflow = this.savedBodyOverflow;
|
|
1525
|
-
this.savedBodyOverflow = null;
|
|
1526
|
-
} else {
|
|
1527
|
-
document.body.style.overflow = '';
|
|
1528
|
-
}
|
|
1529
|
-
} else if (mode === 'full') {
|
|
1530
|
-
// Maintain aspect ratio, make canvas fill the full height of the browser
|
|
1531
|
-
canvas.style.height = '100vh';
|
|
1532
|
-
canvas.style.width = 'auto';
|
|
1533
|
-
canvas.style.objectFit = 'contain';
|
|
1534
|
-
// Remove canvas border in full-screen-like modes
|
|
1535
|
-
canvas.style.border = 'none';
|
|
1536
|
-
// Hide page scrollbars (prevent overflow when canvas touches edges)
|
|
1537
|
-
if (this.savedHtmlOverflow === null)
|
|
1538
|
-
this.savedHtmlOverflow = document.documentElement.style.overflow;
|
|
1539
|
-
if (this.savedBodyOverflow === null) this.savedBodyOverflow = document.body.style.overflow;
|
|
1540
|
-
document.documentElement.style.overflow = 'hidden';
|
|
1541
|
-
document.body.style.overflow = 'hidden';
|
|
1542
|
-
} else if (mode === 'stretch') {
|
|
1543
|
-
// Stretch to full width and height (may alter aspect ratio)
|
|
1544
|
-
canvas.style.width = '100vw';
|
|
1545
|
-
canvas.style.height = '100vh';
|
|
1546
|
-
canvas.style.objectFit = 'fill';
|
|
1547
|
-
// Remove canvas border in full-screen-like modes
|
|
1548
|
-
canvas.style.border = 'none';
|
|
1549
|
-
// Hide page scrollbars (prevent overflow when canvas touches edges)
|
|
1550
|
-
if (this.savedHtmlOverflow === null)
|
|
1551
|
-
this.savedHtmlOverflow = document.documentElement.style.overflow;
|
|
1552
|
-
if (this.savedBodyOverflow === null) this.savedBodyOverflow = document.body.style.overflow;
|
|
1553
|
-
document.documentElement.style.overflow = 'hidden';
|
|
1554
|
-
document.body.style.overflow = 'hidden';
|
|
1555
|
-
}
|
|
1556
|
-
canvas.setAttribute('data-display-mode', mode);
|
|
1557
|
-
window.dispatchEvent(new CustomEvent('c64-display-mode-changed', { detail: { mode } }));
|
|
1558
|
-
};
|
|
1559
|
-
|
|
1560
1683
|
displayRadios.forEach((r) => {
|
|
1561
1684
|
r.addEventListener('change', () => {
|
|
1562
|
-
if (r.checked)
|
|
1685
|
+
if (r.checked && isDisplayMode(r.value)) this.setDisplayMode(r.value);
|
|
1563
1686
|
});
|
|
1564
1687
|
});
|
|
1688
|
+
const fullscreenToggle = panel.querySelector('#c64-fullscreen-toggle') as HTMLButtonElement;
|
|
1689
|
+
if (isFullscreenSupported()) {
|
|
1690
|
+
fullscreenToggle.addEventListener('click', () => {
|
|
1691
|
+
this.closeMenu();
|
|
1692
|
+
void this.toggleFullscreen();
|
|
1693
|
+
});
|
|
1694
|
+
} else {
|
|
1695
|
+
fullscreenToggle.hidden = true;
|
|
1696
|
+
}
|
|
1565
1697
|
|
|
1566
1698
|
window.addEventListener('c64-close-dialog', () => {
|
|
1567
1699
|
this.closeMenu();
|
|
@@ -1679,5 +1811,6 @@ export default class UIController {
|
|
|
1679
1811
|
|
|
1680
1812
|
close(): void {
|
|
1681
1813
|
this.helpOverlay?.classList.remove('visible');
|
|
1814
|
+
this.keymapOverlay?.classList.remove('visible');
|
|
1682
1815
|
}
|
|
1683
1816
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./src-DX0rJQsE.js";import{n as t,t as n}from"./string-utils-CMVABfx0.js";var r=4443,i=4444,a=4445,o=4446,s=4448,c=4454,l=4453,u=255,d=173,f=174,p=6323,m=78,h=79,g=64,_=128,v=1,y=4,b=class{static ultimate={pollIntervalMs:1e3,memoryRanges:[{address:r,length:4,label:`Score`},{address:s,length:1,label:`Lives`},{address:c,length:1,label:`Round`},{address:l,length:1,label:`Island`},{address:d,length:2,label:`DiamondOrder`},{address:p,length:1,label:`Credits`},{address:m,length:2,label:`Powerups`}]};static get ultimateMemoryRanges(){return this.ultimate.memoryRanges}constructor({gameId:t,user:r,cheevosSet:i={cheevos:[]},poppedCheevos:a=[],popCheevo:o=async()=>{},postScore:s=async()=>({})}){this.name=`Rainbow Islands (Twitch Live4)`,console.log(`${this.name} - LIVE`,t),this._popCheevo=o,this.postScore=s,this.user=r,this.gameId=t,this.watcher=e(),this.resetGameVars(),this.cheevosSet=i,this.cheevosMap=i.cheevos.map(e=>{let t=a.some(t=>t.achievement._id===e._id),r;switch(n(e.title)){case`potOfGold`:r=()=>this.score>=25e4;break;case`bigFood`:r=()=>this.score>=5e5;break;case`bigWhoop`:r=()=>this.score>=1e6;break;case`bugSpray`:r=()=>this.islandNumber===1;break;case`helikopterHelikopter`:r=()=>this.islandNumber===2;break;case`doTheMash`:r=()=>this.islandNumber===3;break;case`toyStory`:r=()=>this.islandNumber===4;break;case`revengeOnDoh`:r=()=>this.islandNumber===5;break;case`theDroidsYourLookingFor`:r=()=>this.islandNumber===6;break;case`endOfTheRainbow`:r=()=>this.islandNumber===7;break;case`perfectCollection`:r=()=>this.cpuReadNS(f)===0&&this.cpuReadNS(d)===0&&this.islandNumber===0;break;case`the1cc`:r=()=>this.islandNumber===7&&this.cpuReadNS(p)===0;break;case`needForSpeed`:r=()=>(this.cpuReadNS(h)&g)>=g;break;case`redPotionMastery`:r=()=>(this.cpuReadNS(h)&v)>=v;break;case`yellowPotionMastery`:r=()=>(this.cpuReadNS(h)&y)===y;break;case`bookOfWings`:r=()=>(this.cpuReadNS(h)&_)===_;break;default:break}return{title:e.title,message:e.description,isPopped:t,check:r||(()=>!1),cheevoId:e._id}}),console.log(`CheevosMap::`,this.cheevosMap)}resetGameVars(){this.score=0,this.lives=u,this.isGameOver=!0,this.isGameInProgress=!1,this.scoreSubmitted=!1,this.roundNumber=0,this.islandNumber=0}newGameVars(){this.isGameOver=!1,this.isGameInProgress=!0,this.score=this.getScore(),this.lives=this.getLives(),this.scoreSubmitted=!1,this.roundNumber=0,this.islandNumber=0,console.log(`Started New Game`,this.score,this.lives)}getScore(){let e=t(r,this),n=t(i,this),s=t(a,this),c=t(o,this);return parseInt(e+n+s+c,10)}getIsland(){return this.cpuReadNS(l)}getRound(){return this.cpuReadNS(c)}getLives(){return this.cpuReadNS(s)}newGameCheck(){let e=this.getLives();return this.isGameOver&&e===2&&this.cpuReadNS(d)===6}endGameCheck(){return this.isGameInProgress&&this.getLives()===u}execute(){this.newGameCheck()&&(this.newGameVars(),this.watcher.dispatch(`newGame`,{}));let e=this.getScore();e!==this.score&&!this.isGameOver&&(this.score=e);let t=this.getLives();t!==this.lives&&(this.lives=t,console.log(`${this.name}.lives=`,this.lives));let n=this.getRound();n!==this.roundNumber&&(this.roundNumber=n);let r=this.getIsland();if(r!==this.islandNumber&&(console.log(`New Island .islandNumber=${this.islandNumber}`,this.roundNumber),this.islandNumber=r),this.endGameCheck()){if(this.isGameOver=!0,this.isGameInProgress=!1,this.scoreSubmitted)return;this.scoreSubmitted=!0,this.watcher.dispatch(`gameOver`,{score:this.score}),this.postScore(this.gameId,this.score,this.user.id,this.user.username).then(e=>{console.log(`Score posted successfully`,e),this.watcher.dispatch(`cheevo`,{title:`Score Submit Success`,message:`Your score of ${this.score} has been submitted to the ${this.name} Leaderboard!`})})}this.isGameOver||this.cheevosMap.forEach(e=>{!e.isPopped&&e.check()&&(e.isPopped=!0,console.log(`Pop Cheevo::`,e.title,e.message),this.popCheevo(e.cheevoId))})}async popCheevo(e){let t=await this._popCheevo(this.cheevosSet._id,this.user.id,e);console.log(`res popCheevo`,t),this.watcher.dispatch(`cheevo`,{title:t.achievement.title,message:t.achievement.description,thumbnailUrl:t.thumbnailUrl})}};export{b as default};
|