Fix: skip DOS extender executables (DOS4GW etc.) when finding main game exe
Build & Deploy / build-and-deploy (push) Successful in 1m35s

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 <executable.xxx>'

Added SKIP_EXE_NAMES set with known DOS extenders, DPMI hosts,
debuggers, memory managers, and uninstallers.
This commit is contained in:
Hermes Agent
2026-05-29 09:15:23 +02:00
parent 3f69820911
commit 27a9c180d7
@@ -245,6 +245,12 @@ public class UploadResource {
if (!name.endsWith(".exe") && !name.endsWith(".com") && !name.endsWith(".bat")) if (!name.endsWith(".exe") && !name.endsWith(".com") && !name.endsWith(".bat"))
return FileVisitResult.CONTINUE; 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"); boolean installer = name.contains("install") || name.contains("setup") || name.contains("config");
int depth = f.getNameCount() - dir.getNameCount(); int depth = f.getNameCount() - dir.getNameCount();
candidates.add(new Candidate(depth, installer, a.size(), f.toString())); candidates.add(new Candidate(depth, installer, a.size(), f.toString()));
@@ -311,6 +317,21 @@ public class UploadResource {
".dmg" // Mac disk images ".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<String> 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 { private void createBundle(Path extractDir, String exePath, Path bundlePath) throws IOException {
// Write .jsdos config directly into the extract directory // Write .jsdos config directly into the extract directory
Path jsdos = extractDir.resolve(".jsdos"); Path jsdos = extractDir.resolve(".jsdos");