From 473fb7a21615aa329a457274f9dc16f753bca309 Mon Sep 17 00:00:00 2001 From: Hermes Agent Date: Fri, 29 May 2026 09:41:45 +0200 Subject: [PATCH] Check setup EXE's own platform before creating setup bundle MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously only checked the main game's platform. Fallout's SETUP.EXE is a Windows executable even though FALLOUT.EXE is DOS — creating a .setup.jsdos bundle for it would show 'This program cannot run in DOS mode'. Now detects the setup EXE's own header and skips if it targets Windows. --- src/main/java/com/dostalgia/UploadResource.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/dostalgia/UploadResource.java b/src/main/java/com/dostalgia/UploadResource.java index 2331837..834b89b 100644 --- a/src/main/java/com/dostalgia/UploadResource.java +++ b/src/main/java/com/dostalgia/UploadResource.java @@ -103,11 +103,15 @@ public class UploadResource { // Detect platform (DOS vs Windows) by reading the main EXE header String platform = detectPlatform(Path.of(mainExe)); - // Create setup bundle only if the game is a DOS executable - // (Windows setup bundles are useless — they need Windows to run) - if (setupExe != null && !"windows".equals(platform)) { - Path setupBundlePath = svc.getGamesDir().resolve(gameId + ".setup.jsdos"); - createBundle(extractDir, setupExe, setupBundlePath); + // Create setup bundle only if the setup executable is itself DOS-compatible. + // Some games (e.g. Fallout) ship a Windows SETUP.EXE even though the main + // game is DOS — that setup would fail with "This program cannot run in DOS mode". + if (setupExe != null) { + String setupPlatform = detectPlatform(Path.of(setupExe)); + if (!"windows".equals(setupPlatform)) { + Path setupBundlePath = svc.getGamesDir().resolve(gameId + ".setup.jsdos"); + createBundle(extractDir, setupExe, setupBundlePath); + } } // Save metadata