Auto-exclude disk image files (.img .iso .ccd .sub etc.) from .jsdos bundles
Build & Deploy / build-and-deploy (push) Successful in 48s
Build & Deploy / build-and-deploy (push) Successful in 48s
Many DOS game ZIPs include CloneCD backups (.ccd/.img/.sub) or other disk images that are not needed for gameplay — the game data is already extracted in the working directory. These can be 300MB+ and cause WASM memory exhaustion in js-dos. Added a SKIP_EXT set that filters out known disk image extensions during game file pass. The .jsdos config pass is unaffected.
This commit is contained in:
@@ -279,6 +279,13 @@ public class UploadResource {
|
|||||||
|
|
||||||
// ─── Bundle Creation ─────────────────────────────────────────
|
// ─── Bundle Creation ─────────────────────────────────────────
|
||||||
|
|
||||||
|
/** File extensions that are never game data and should be excluded from .jsdos bundles. */
|
||||||
|
private static final java.util.Set<String> SKIP_EXT = java.util.Set.of(
|
||||||
|
".img", ".iso", ".nrg", ".mdf", ".mds", // disk images
|
||||||
|
".ccd", ".sub", ".cue", // CloneCD / CUE sheets
|
||||||
|
".dmg" // Mac disk images
|
||||||
|
);
|
||||||
|
|
||||||
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");
|
||||||
@@ -333,6 +340,11 @@ public class UploadResource {
|
|||||||
try (var walk = Files.walk(extractDir)) {
|
try (var walk = Files.walk(extractDir)) {
|
||||||
walk.filter(Files::isRegularFile)
|
walk.filter(Files::isRegularFile)
|
||||||
.filter(f -> !f.startsWith(jsdos))
|
.filter(f -> !f.startsWith(jsdos))
|
||||||
|
.filter(f -> {
|
||||||
|
String n = f.getFileName().toString().toLowerCase();
|
||||||
|
int dot = n.lastIndexOf('.');
|
||||||
|
return dot < 0 || !SKIP_EXT.contains(n.substring(dot));
|
||||||
|
})
|
||||||
.sorted() // deterministic order
|
.sorted() // deterministic order
|
||||||
.forEach(writeFile);
|
.forEach(writeFile);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user