Add platform auto-detection and UI flagging for Windows games
Build & Deploy / build-and-deploy (push) Successful in 49s

- Game.java: add 'platform' field ('dos'/'windows') + 'isPlayable' helper
- UploadResource.java: detect EXE type by reading PE/NE header during upload
- GameResource.java: allow PATCH to update platform
- GameCard.svelte: show 🪟 Win badge for Windows games (blue style)
- GameDetail.svelte: show platform badge, disable Play for Windows with
  'Unplayable' button; add platform dropdown to edit form
- Play.svelte: show blocking overlay for Windows games with 'Try anyway'
  option for users who want to attempt it
This commit is contained in:
Hermes Agent
2026-05-28 13:16:04 +02:00
parent efa0aa5f81
commit 65e098244a
6 changed files with 152 additions and 3 deletions
+29 -1
View File
@@ -12,6 +12,7 @@
let error = $state("");
let booting = $state(false);
let running = $state(false);
let unsupported = $state(false);
let started = false;
let dosContainer;
@@ -23,6 +24,10 @@
isSetup = window.location.hash.includes("setup=1");
try {
game = await getGame(id);
// Windows games can't run in pure DOSBox — flag it
if (game.platform === 'windows') {
unsupported = true;
}
} catch (e) {
error = "Game not found";
}
@@ -76,6 +81,11 @@
window.location.reload();
}
function handleTryAnyway() {
unsupported = false;
startEmulator();
}
function goBack() {
push(`/game/${id}`);
}
@@ -84,7 +94,7 @@
// Auto-start when both game data and the container exist
$effect(() => {
if (game?.ready && dosContainer && !started) {
if (game?.ready && dosContainer && !started && !unsupported) {
startEmulator();
}
});
@@ -121,6 +131,19 @@
<div class="error-box">{error}</div>
{/if}
<!-- Unsupported platform warning -->
{#if unsupported}
<div class="overlay">
<div class="overlay-icon">🪟</div>
<h2>Windows game</h2>
<p><strong>{game.title}</strong> is a Windows application and won't run in the browser DOS emulator without Windows 3.1 installed.</p>
<div class="unsupported-actions">
<button class="btn btn-secondary" onclick={goBack}> Back</button>
<button class="btn" onclick={handleTryAnyway}>Try anyway</button>
</div>
</div>
{/if}
<!-- Loading / booting overlay (covers the canvas while loading) -->
{#if !running}
<div class="overlay">
@@ -256,4 +279,9 @@
border-radius: var(--radius);
z-index: 10;
}
.unsupported-actions {
display: flex;
gap: 12px;
margin-top: 20px;
}
</style>