fix(player): keep the CD-i BIOS archive whole for same_cdi (#5440)

EmulatorJS 4.2.3 unpacks the BIOS archive and writes its members loose at
the content root, so same_cdi (MAME-based) never finds cdimono1.zip or a
cdimono1/ folder on its rompath and reports cdi200.rom as missing. Route
the same_cdi core through keepArcadeBiosWhole so cdimono1.zip lands whole
at the root, which is the first rompath entry the core searches.

Fixes #5215

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Georges-Antoine Assi
2026-11-01 19:28:21 -05:00
committed by GitHub
parent 4393b70973
commit 2a3cefb9e8
2 changed files with 17 additions and 2 deletions

View File

@@ -174,6 +174,20 @@ describe("keepArcadeBiosWhole", () => {
});
});
it("writes the CD-i BIOS archive whole for same_cdi", () => {
const instance = emulator(
"same_cdi",
"/api/firmware/4/content/cdimono1.zip",
);
keepArcadeBiosWhole(instance);
expect(instance.config).toEqual({
biosUrl: "",
externalFiles: {
"/cdimono1.zip": "/api/firmware/4/content/cdimono1.zip",
},
});
});
it("leaves the BIOS to EmulatorJS on a build that keeps it whole", () => {
const instance = emulator("fbneo", "/api/firmware/9/content/neogeo.zip", {
nightly: true,

View File

@@ -78,14 +78,15 @@ export function keepArcadeBiosWhole(emulator: ArcadeBiosEmulator): void {
// EmulatorJS 4.2.3 (the build with downloadGameFile) unpacks every BIOS
// archive, but these cores only find a romset like neogeo.zip as a zip.
if (typeof emulator.downloadGameFile !== "function") return;
if (!["arcade", "mame"].includes(emulator.getCore(true))) return;
// same_cdi is MAME-based and looks for cdimono1.zip the same way.
if (!["arcade", "mame", "same_cdi"].includes(emulator.getCore(true))) return;
const { biosUrl } = emulator.config;
const name = biosUrl?.split("/").pop()?.split(/[?#]/)[0];
if (!biosUrl || !name || !ARCHIVE_EXTENSION.test(name)) return;
// EJS_externalFiles writes an archive raw on 4.2.3. The root is the content
// directory the game zip sits in, which both cores search.
// directory the game sits in, which these cores search.
emulator.config.externalFiles = {
...emulator.config.externalFiles,
[`/${name}`]: biosUrl,