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.
This commit is contained in:
Flyinghead 2024-10-14 16:31:23 +02:00
parent a50164a91b
commit b4937ef271
2 changed files with 29 additions and 6 deletions

View File

@ -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);
}

View File

@ -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<Archive> bios_archive(OpenArchive(path));