Add platform auto-detection and UI flagging for Windows games
Build & Deploy / build-and-deploy (push) Successful in 49s
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:
@@ -29,7 +29,13 @@
|
||||
{/if}
|
||||
</div>
|
||||
{#if game.ready}
|
||||
<div class="badge">Ready</div>
|
||||
<div class="badge" class:badge-windows={game.platform === 'windows'}>
|
||||
{#if game.platform === 'windows'}
|
||||
🪟 Win
|
||||
{:else}
|
||||
Ready
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
</button>
|
||||
|
||||
@@ -111,4 +117,8 @@
|
||||
font-weight: 600;
|
||||
letter-spacing: 0.05em;
|
||||
}
|
||||
.badge-windows {
|
||||
background: #1a3a5c;
|
||||
color: #6ab0ff;
|
||||
}
|
||||
</style>
|
||||
@@ -16,6 +16,7 @@
|
||||
let editDeveloper = $state("");
|
||||
let editPublisher = $state("");
|
||||
let editDescription = $state("");
|
||||
let editPlatform = $state("");
|
||||
|
||||
// IGDB scrape state
|
||||
let scraping = $state(false);
|
||||
@@ -63,6 +64,7 @@
|
||||
editDeveloper = game.developer || "";
|
||||
editPublisher = game.publisher || "";
|
||||
editDescription = game.description || "";
|
||||
editPlatform = game.platform || "";
|
||||
editing = true;
|
||||
}
|
||||
|
||||
@@ -76,6 +78,7 @@
|
||||
developer: editDeveloper || undefined,
|
||||
publisher: editPublisher || undefined,
|
||||
description: editDescription || undefined,
|
||||
platform: editPlatform || undefined,
|
||||
});
|
||||
editing = false;
|
||||
} catch (e) {
|
||||
@@ -193,6 +196,13 @@
|
||||
<input type="text" bind:value={editPublisher} placeholder="Publisher" style="flex:1" />
|
||||
</div>
|
||||
<textarea bind:value={editDescription} placeholder="Description" rows="4"></textarea>
|
||||
<div class="edit-row">
|
||||
<select bind:value={editPlatform} style="flex:1">
|
||||
<option value="">Auto (unknown)</option>
|
||||
<option value="dos">DOS</option>
|
||||
<option value="windows">Windows</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="edit-actions">
|
||||
<button class="btn btn-primary" onclick={saveEdit} disabled={saving}>
|
||||
{saving ? "Saving..." : "Save"}
|
||||
@@ -201,13 +211,26 @@
|
||||
</div>
|
||||
{:else}
|
||||
<h1>{game.title}</h1>
|
||||
{#if game.platform}
|
||||
<div class="platform-badge" class:platform-win={game.platform === 'windows'}>
|
||||
{#if game.platform === 'windows'}
|
||||
🪟 Requires Windows 3.1 — may not work in browser
|
||||
{:else}
|
||||
💾 DOS
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
{#if game.description}
|
||||
<p class="description">{game.description}</p>
|
||||
{/if}
|
||||
|
||||
<div class="actions">
|
||||
{#if game.ready}
|
||||
{#if game.ready && (game.platform !== 'windows')}
|
||||
<button class="btn btn-primary" onclick={handlePlay}>▶ Play</button>
|
||||
{:else if game.ready && game.platform === 'windows'}
|
||||
<button class="btn btn-primary btn-disabled" disabled title="Windows games need Windows 3.1 emulation (not yet supported)">
|
||||
▶ Unplayable
|
||||
</button>
|
||||
{/if}
|
||||
{#if game.has_setup}
|
||||
<button class="btn btn-setup" onclick={handleSetup}>🛠 Setup</button>
|
||||
@@ -347,6 +370,20 @@
|
||||
.cover-img { width: 100%; border-radius: var(--radius); }
|
||||
.cover-placeholder { aspect-ratio: 3/4; background: var(--surface); display: flex; align-items: center; justify-content: center; font-size: 4rem; border-radius: var(--radius); }
|
||||
.info-section h1 { color: var(--phosphor); font-family: var(--font-mono); margin-bottom: 8px; word-break: break-word; }
|
||||
.platform-badge {
|
||||
display: inline-block;
|
||||
font-size: 0.8rem;
|
||||
padding: 3px 10px;
|
||||
border-radius: 10px;
|
||||
font-weight: 600;
|
||||
margin-bottom: 8px;
|
||||
background: var(--phosphor-dark);
|
||||
color: var(--phosphor);
|
||||
}
|
||||
.platform-badge.platform-win {
|
||||
background: #1a3a5c;
|
||||
color: #6ab0ff;
|
||||
}
|
||||
.meta { display: flex; gap: 8px; margin-bottom: 8px; }
|
||||
.meta-item { background: var(--surface-hover); color: var(--phosphor-dim); padding: 4px 12px; border-radius: 12px; font-size: 0.85rem; }
|
||||
.dev { color: var(--text-dim); margin-bottom: 16px; }
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user