From 2a3cefb9e88c53e63ea0c10141a91f30e6f46dab Mon Sep 17 00:00:00 2001 From: Georges-Antoine Assi <3247106+gantoine@users.noreply.github.com> Date: Sun, 1 Nov 2026 19:28:21 -0500 Subject: [PATCH] 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 --- frontend/src/utils/playerFirmware.test.ts | 14 ++++++++++++++ frontend/src/utils/playerFirmware.ts | 5 +++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/frontend/src/utils/playerFirmware.test.ts b/frontend/src/utils/playerFirmware.test.ts index bc947b4e0..b870709ab 100644 --- a/frontend/src/utils/playerFirmware.test.ts +++ b/frontend/src/utils/playerFirmware.test.ts @@ -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, diff --git a/frontend/src/utils/playerFirmware.ts b/frontend/src/utils/playerFirmware.ts index abbdb99c8..400421715 100644 --- a/frontend/src/utils/playerFirmware.ts +++ b/frontend/src/utils/playerFirmware.ts @@ -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,