fix: add jsdos.json to bundle for proper js-dos v8 config
Build & Deploy / build-and-deploy (push) Successful in 1m4s
Build & Deploy / build-and-deploy (push) Successful in 1m4s
The missing piece — dos.zone's bundle has .jsdos/jsdos.json which tells js-dos v8 how to configure the emulator (autoexec command, autolock=true, etc.). Without it, js-dos may apply different defaults that don't match our dosbox.conf. Also simplified dosbox.conf to just the essential sections and removed mapperfile=mapper-jsdos.map (not bundled). Keeps usescancodes=true, autolock=true, SB16 audio.
This commit is contained in:
@@ -91,6 +91,7 @@ public class UploadResource {
|
|||||||
String relExe = Path.of(mainExe).getFileName().toString();
|
String relExe = Path.of(mainExe).getFileName().toString();
|
||||||
String conf = buildDosboxConf(relExe);
|
String conf = buildDosboxConf(relExe);
|
||||||
Files.writeString(jsdos.resolve("dosbox.conf"), conf);
|
Files.writeString(jsdos.resolve("dosbox.conf"), conf);
|
||||||
|
Files.write(jsdos.resolve("jsdos.json"), buildJsdosJson(relExe));
|
||||||
bundleFile = ".jsdos/dosbox.conf";
|
bundleFile = ".jsdos/dosbox.conf";
|
||||||
} else {
|
} else {
|
||||||
// Create .jsdos bundle (flat in games dir)
|
// Create .jsdos bundle (flat in games dir)
|
||||||
@@ -218,6 +219,7 @@ public class UploadResource {
|
|||||||
String relExe = Path.of(mainExe).getFileName().toString();
|
String relExe = Path.of(mainExe).getFileName().toString();
|
||||||
String conf = buildDosboxConf(relExe);
|
String conf = buildDosboxConf(relExe);
|
||||||
Files.writeString(jsdos.resolve("dosbox.conf"), conf);
|
Files.writeString(jsdos.resolve("dosbox.conf"), conf);
|
||||||
|
Files.write(jsdos.resolve("jsdos.json"), buildJsdosJson(relExe));
|
||||||
|
|
||||||
// ZIP it up
|
// ZIP it up
|
||||||
try (var zos = new java.util.zip.ZipOutputStream(Files.newOutputStream(bundlePath))) {
|
try (var zos = new java.util.zip.ZipOutputStream(Files.newOutputStream(bundlePath))) {
|
||||||
@@ -240,95 +242,49 @@ public class UploadResource {
|
|||||||
// ─── File Utilities ──────────────────────────────────────────
|
// ─── File Utilities ──────────────────────────────────────────
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Build a complete dosbox.conf with all sections needed for proper
|
* Build a minimal dosbox.conf with the critical settings for js-dos v8.
|
||||||
* keyboard and hardware emulation in js-dos v8.
|
* The key setting is usescancodes=true — without it DOSBox doesn't
|
||||||
|
* translate physical key presses into game input.
|
||||||
*/
|
*/
|
||||||
|
private byte[] buildJsdosJson(String relExe) {
|
||||||
|
String json = "{"
|
||||||
|
+ "\"autoexec\":{"
|
||||||
|
+ "\"options\":{\"script\":{\"value\":\"" + escapeJson(relExe) + "\"}}"
|
||||||
|
+ "},"
|
||||||
|
+ "\"output\":{"
|
||||||
|
+ "\"options\":{\"autolock\":{\"value\":true}}}"
|
||||||
|
+ "}";
|
||||||
|
return json.getBytes(java.nio.charset.StandardCharsets.UTF_8);
|
||||||
|
}
|
||||||
|
|
||||||
|
private String escapeJson(String s) {
|
||||||
|
return s.replace("\\", "\\\\").replace("\"", "\\\"");
|
||||||
|
}
|
||||||
|
|
||||||
private String buildDosboxConf(String relExe) {
|
private String buildDosboxConf(String relExe) {
|
||||||
return "[sdl]\n"
|
return "[sdl]\n"
|
||||||
+ "autolock=true\n"
|
+ "autolock=true\n"
|
||||||
+ "fullscreen=false\n"
|
|
||||||
+ "fulldouble=false\n"
|
|
||||||
+ "fullresolution=original\n"
|
|
||||||
+ "windowresolution=original\n"
|
|
||||||
+ "output=surface\n"
|
|
||||||
+ "sensitivity=100\n"
|
|
||||||
+ "waitonerror=true\n"
|
|
||||||
+ "priority=higher,normal\n"
|
|
||||||
+ "mapperfile=mapper-jsdos.map\n"
|
|
||||||
+ "usescancodes=true\n"
|
+ "usescancodes=true\n"
|
||||||
+ "\n"
|
+ "output=surface\n"
|
||||||
+ "[dosbox]\n"
|
|
||||||
+ "machine=svga_s3\n"
|
|
||||||
+ "memsize=16\n"
|
|
||||||
+ "\n"
|
+ "\n"
|
||||||
+ "[cpu]\n"
|
+ "[cpu]\n"
|
||||||
+ "core=auto\n"
|
+ "core=auto\n"
|
||||||
+ "cputype=auto\n"
|
|
||||||
+ "cycles=auto\n"
|
+ "cycles=auto\n"
|
||||||
+ "\n"
|
+ "\n"
|
||||||
+ "[mixer]\n"
|
+ "[mixer]\n"
|
||||||
+ "nosound=false\n"
|
+ "nosound=false\n"
|
||||||
+ "rate=44100\n"
|
+ "rate=44100\n"
|
||||||
+ "blocksize=1024\n"
|
|
||||||
+ "prebuffer=20\n"
|
|
||||||
+ "\n"
|
|
||||||
+ "[render]\n"
|
|
||||||
+ "frameskip=0\n"
|
|
||||||
+ "aspect=false\n"
|
|
||||||
+ "scaler=none\n"
|
|
||||||
+ "\n"
|
|
||||||
+ "[midi]\n"
|
|
||||||
+ "mpu401=intelligent\n"
|
|
||||||
+ "mididevice=default\n"
|
|
||||||
+ "midiconfig=\n"
|
|
||||||
+ "\n"
|
+ "\n"
|
||||||
+ "[sblaster]\n"
|
+ "[sblaster]\n"
|
||||||
+ "sbtype=sb16\n"
|
+ "sbtype=sb16\n"
|
||||||
+ "sbbase=220\n"
|
|
||||||
+ "irq=7\n"
|
+ "irq=7\n"
|
||||||
+ "dma=1\n"
|
+ "dma=1\n"
|
||||||
+ "hdma=5\n"
|
+ "hdma=5\n"
|
||||||
+ "sbmixer=true\n"
|
|
||||||
+ "oplmode=auto\n"
|
|
||||||
+ "oplemu=default\n"
|
|
||||||
+ "oplrate=44100\n"
|
|
||||||
+ "\n"
|
|
||||||
+ "[gus]\n"
|
|
||||||
+ "gus=false\n"
|
|
||||||
+ "gusrate=44100\n"
|
|
||||||
+ "gusbase=240\n"
|
|
||||||
+ "gusirq=5\n"
|
|
||||||
+ "gusdma=3\n"
|
|
||||||
+ "ultradir=C:\\ULTRASND\n"
|
|
||||||
+ "\n"
|
|
||||||
+ "[speaker]\n"
|
|
||||||
+ "pcspeaker=true\n"
|
|
||||||
+ "pcrate=44100\n"
|
|
||||||
+ "tandy=auto\n"
|
|
||||||
+ "tandyrate=44100\n"
|
|
||||||
+ "disney=true\n"
|
|
||||||
+ "\n"
|
|
||||||
+ "[joystick]\n"
|
|
||||||
+ "joysticktype=auto\n"
|
|
||||||
+ "timed=true\n"
|
|
||||||
+ "autofire=false\n"
|
|
||||||
+ "swap34=false\n"
|
|
||||||
+ "buttonwrap=false\n"
|
|
||||||
+ "\n"
|
|
||||||
+ "[serial]\n"
|
|
||||||
+ "serial1=dummy\n"
|
|
||||||
+ "serial2=dummy\n"
|
|
||||||
+ "serial3=disabled\n"
|
|
||||||
+ "serial4=disabled\n"
|
|
||||||
+ "\n"
|
+ "\n"
|
||||||
+ "[dos]\n"
|
+ "[dos]\n"
|
||||||
+ "xms=true\n"
|
+ "xms=true\n"
|
||||||
+ "ems=true\n"
|
+ "ems=true\n"
|
||||||
+ "umb=true\n"
|
+ "umb=true\n"
|
||||||
+ "keyboardlayout=auto\n"
|
|
||||||
+ "\n"
|
|
||||||
+ "[ipx]\n"
|
|
||||||
+ "ipx=true\n"
|
|
||||||
+ "\n"
|
+ "\n"
|
||||||
+ "[autoexec]\n"
|
+ "[autoexec]\n"
|
||||||
+ "@echo off\n"
|
+ "@echo off\n"
|
||||||
|
|||||||
Reference in New Issue
Block a user