From 41d1e22522bd8892d709849801ae36ea0b078352 Mon Sep 17 00:00:00 2001 From: Hermes Agent Date: Thu, 28 May 2026 15:46:36 +0200 Subject: [PATCH] Fix platform detection: LE (DOS/4GW extender) is DOS, not Windows MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Many classic DOS games (Blood, DOOM, Duke Nukem 3D, Quake) use DOS/4GW or DOS/32A — 32-bit DOS extenders with Linear Executable (LE) format. My code was detecting LE as 'windows', causing these games to be incorrectly flagged as unplayable. Only PE (Portable Executable / Win32) and NE (New Executable / Windows 3.x) are actually Windows. --- src/main/java/com/dostalgia/UploadResource.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/dostalgia/UploadResource.java b/src/main/java/com/dostalgia/UploadResource.java index 58feb76..71ae61d 100644 --- a/src/main/java/com/dostalgia/UploadResource.java +++ b/src/main/java/com/dostalgia/UploadResource.java @@ -447,10 +447,13 @@ public class UploadResource { /** * Detect whether an executable targets DOS or Windows by reading its PE/NE header. * + * Note: LE (Linear Executable) is used by DOS/4GW, DOS/32A, PMODE/W + * — all 32-bit DOS extenders for games like DOOM, Blood, Duke Nukem 3D. + * Only PE (Portable Executable) and NE (New Executable) are Windows. */ static String detectPlatform(Path exePath) { String name = exePath.getFileName().toString().toLowerCase(); @@ -487,12 +490,10 @@ public class UploadResource { // PE = Portable Executable (Win32) // NE = New Executable (Windows 3.x) - // LE = Linear Executable (VxD, OS/2) + // LE = Linear Executable (DOS/4GW, DOS/32A — 32-bit DOS extenders) // LX = Extended Linear Executable (OS/2 2.x) if ((sig1 == 0x50 && sig2 == 0x45) // PE - || (sig1 == 0x4E && sig2 == 0x45) // NE - || (sig1 == 0x4C && sig2 == 0x45) // LE - || (sig1 == 0x4C && sig2 == 0x58)) // LX + || (sig1 == 0x4E && sig2 == 0x45)) // NE return "windows"; return "dos"; // Plain MZ without known Windows signature