From 27a9c180d7b1f0b007e777a411a42526fe9e4118 Mon Sep 17 00:00:00 2001 From: Hermes Agent Date: Fri, 29 May 2026 09:15:23 +0200 Subject: [PATCH] Fix: skip DOS extender executables (DOS4GW etc.) when finding main game exe MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit DOS4GW.EXE is a 32-bit DOS extender that ships with many DOS games (DOOM, Fallout, Duke Nukem 3D, etc.). The findMainExe algorithm was picking it as the main executable because it's typically large and at the ZIP root, causing the autoexec to run 'DOS4GW' with no arguments → 'DOS/4GW fatal error (1004): syntax is DOS/4GW ' Added SKIP_EXE_NAMES set with known DOS extenders, DPMI hosts, debuggers, memory managers, and uninstallers. --- .../java/com/dostalgia/UploadResource.java | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/main/java/com/dostalgia/UploadResource.java b/src/main/java/com/dostalgia/UploadResource.java index fe47fb1..158a155 100644 --- a/src/main/java/com/dostalgia/UploadResource.java +++ b/src/main/java/com/dostalgia/UploadResource.java @@ -245,6 +245,12 @@ public class UploadResource { if (!name.endsWith(".exe") && !name.endsWith(".com") && !name.endsWith(".bat")) return FileVisitResult.CONTINUE; + // Skip known extender / tool executables (DOS4GW, DEBUG, etc.) + int dot = name.lastIndexOf('.'); + String stem = dot >= 0 ? name.substring(0, dot) : name; + if (SKIP_EXE_NAMES.contains(stem)) + return FileVisitResult.CONTINUE; + boolean installer = name.contains("install") || name.contains("setup") || name.contains("config"); int depth = f.getNameCount() - dir.getNameCount(); candidates.add(new Candidate(depth, installer, a.size(), f.toString())); @@ -311,6 +317,21 @@ public class UploadResource { ".dmg" // Mac disk images ); + /** + * Executable filenames (lowercase, stem only, no extension) that should NEVER + * be selected as the main game executable. These are DOS extenders, DPMI hosts, + * debuggers, and other auxiliary tools that ship alongside many DOS games. + */ + private static final java.util.Set SKIP_EXE_NAMES = java.util.Set.of( + "dos4gw", "dos32a", "dos4gw2", // DOS/4GW family (DOS extenders) + "pmode", "pmodew", // Watcom / PMODE extenders + "cwsdpmi", // DPMI host (used by many DJGPP games) + "emm386", // Expanded memory manager + "himem", "himemx", // Extended memory managers + "debug", // Debugger + "uninst", "uninstall", "uninstaller" // Uninstallers + ); + private void createBundle(Path extractDir, String exePath, Path bundlePath) throws IOException { // Write .jsdos config directly into the extract directory Path jsdos = extractDir.resolve(".jsdos");