From b4937ef271330ee952087e7d78e4b38e66aa60ab Mon Sep 17 00:00:00 2001 From: Flyinghead Date: Mon, 14 Oct 2024 16:31:23 +0200 Subject: [PATCH] f355: pass full BIOS path to slaves if the bios file is located relative to the rom location, slaves won't be able to find it. Pass the full bios path to avoid the issue. --- core/hw/naomi/multiboard.cpp | 7 ++++++- core/hw/naomi/naomi_cart.cpp | 28 +++++++++++++++++++++++----- 2 files changed, 29 insertions(+), 6 deletions(-) diff --git a/core/hw/naomi/multiboard.cpp b/core/hw/naomi/multiboard.cpp index 9ce8f9cfd..344f1cb01 100644 --- a/core/hw/naomi/multiboard.cpp +++ b/core/hw/naomi/multiboard.cpp @@ -127,6 +127,11 @@ void Multiboard::startSlave() int x = cfgLoadInt("window", "left", (1920 - 640) / 2); int y = cfgLoadInt("window", "top", (1080 - 480) / 2); int width = cfgLoadInt("window", "width", 640); + std::string biosFile = CurrentCartridge->game->bios == nullptr ? "naomi" : CurrentCartridge->game->bios; + std::string biosPath = hostfs::findNaomiBios(biosFile + ".zip"); + if (biosPath.empty()) + biosPath = hostfs::findNaomiBios(biosFile + ".7z"); + for (int i = 0; i < slaves; i++) { std::string region = "config:Dreamcast.Region=" + std::to_string(config::Region); @@ -143,7 +148,7 @@ void Multiboard::startSlave() "-config", region.c_str(), "-config", left.c_str(), "-config", top.c_str(), - CurrentCartridge->game->bios == nullptr ? "naomi" : CurrentCartridge->game->bios + biosPath.c_str() }; os_RunInstance(std::size(args), args); } diff --git a/core/hw/naomi/naomi_cart.cpp b/core/hw/naomi/naomi_cart.cpp index 24ec3a441..2cc79cb43 100644 --- a/core/hw/naomi/naomi_cart.cpp +++ b/core/hw/naomi/naomi_cart.cpp @@ -56,22 +56,40 @@ bool atomiswaveForceFeedback; static bool loadBios(const char *filename, Archive *child_archive, Archive *parent_archive, int region) { + std::string path; + std::string biosName; + if (settings.naomi.slave) + { + // extract basename of bios + biosName = get_file_basename(filename); + size_t idx = get_last_slash_pos(biosName); + if (idx != std::string::npos) + biosName = biosName.substr(idx + 1); + path = filename; + } + else + { + biosName = filename; + } int biosid = 0; for (; BIOS[biosid].name != nullptr; biosid++) - if (!stricmp(BIOS[biosid].name, filename)) + if (!stricmp(BIOS[biosid].name, biosName.c_str())) break; if (BIOS[biosid].name == nullptr) { - WARN_LOG(NAOMI, "Unknown BIOS %s", filename); + WARN_LOG(NAOMI, "Unknown BIOS %s", biosName.c_str()); return false; } const BIOS_t *bios = &BIOS[biosid]; - std::string arch_name(bios->filename != nullptr ? bios->filename : filename); - std::string path = hostfs::findNaomiBios(arch_name + ".zip"); if (path.empty()) - path = hostfs::findNaomiBios(arch_name + ".7z"); + { + std::string arch_name(bios->filename != nullptr ? bios->filename : filename); + path = hostfs::findNaomiBios(arch_name + ".zip"); + if (path.empty()) + path = hostfs::findNaomiBios(arch_name + ".7z"); + } DEBUG_LOG(NAOMI, "Loading BIOS from %s", path.c_str()); std::unique_ptr bios_archive(OpenArchive(path));