feat: companion app improvements and intro overlay
All checks were successful
Build Archipelago ISO (dev) / build-iso (push) Successful in 39m1s

Android: NES controller/keyboard enhancements, WebSocket reconnect,
portrait mode. Backend: remote input handler updates. UI: companion
intro overlay on dashboard, relay improvements.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Dorian
2026-04-11 20:00:05 +01:00
parent 9d013dbcb5
commit 1807ceeebd
10 changed files with 251 additions and 33 deletions

View File

@@ -99,7 +99,7 @@ function mapKey(xdotoolKey: string): string {
}
function handleMessage(data: string) {
let msg: { t: string; k?: string; x?: number; y?: number; b?: number }
let msg: { t: string; k?: string; x?: number; y?: number; b?: number; p?: number }
try {
msg = JSON.parse(data)
} catch {
@@ -114,6 +114,18 @@ function handleMessage(data: string) {
case 'k': {
if (!msg.k) break
const key = mapKey(msg.k)
// Dispatch player-tagged event for arcade/game apps (iframe postMessage or direct listeners)
const player = msg.p ?? 0 // 0 = untagged/broadcast, 1 = P1, 2 = P2
document.dispatchEvent(new CustomEvent('arcade-input', {
detail: { key, player, type: 'down' },
bubbles: true,
}))
// Also post to any iframe that might be listening (containerized apps like BotFights)
const iframe = document.querySelector('iframe') as HTMLIFrameElement | null
if (iframe?.contentWindow) {
iframe.contentWindow.postMessage({ type: 'arcade-input', key, player, action: 'down' }, '*')
}
// Keep existing keydown/keyup for backward compat with non-arcade UI navigation
document.dispatchEvent(new KeyboardEvent('keydown', { key, bubbles: true }))
document.dispatchEvent(new KeyboardEvent('keyup', { key, bubbles: true }))
break