libretro: Fix breakage with new BIOS detection

This commit is contained in:
Connor McLaughlin
2020-09-23 02:11:30 +10:00
parent df98bfbf04
commit 78f06fb711
4 changed files with 46 additions and 39 deletions

View File

@ -199,6 +199,11 @@ void HostInterface::AddFormattedOSDMessage(float duration, const char* format, .
AddOSDMessage(std::move(message), duration);
}
std::string HostInterface::GetBIOSDirectory() const
{
return GetUserDirectoryRelativePath("bios");
}
std::optional<std::vector<u8>> HostInterface::GetBIOSImage(ConsoleRegion region)
{
const std::string* bios_path;
@ -221,12 +226,13 @@ std::optional<std::vector<u8>> HostInterface::GetBIOSImage(ConsoleRegion region)
if (bios_path->empty())
{
// auto-detect
return FindBIOSImageInDirectory(region, GetUserDirectoryRelativePath("bios").c_str());
return FindBIOSImageInDirectory(region, GetBIOSDirectory().c_str());
}
// try the configured path
std::optional<BIOS::Image> image = BIOS::LoadImageFromFile(
GetUserDirectoryRelativePath("bios" FS_OSPATH_SEPARATOR_STR "%s", bios_path->c_str()).c_str());
StringUtil::StdStringFromFormat("%s" FS_OSPATH_SEPARATOR_STR "%s", GetBIOSDirectory().c_str(), bios_path->c_str())
.c_str());
if (!image.has_value())
{
g_host_interface->ReportFormattedError(

View File

@ -118,6 +118,9 @@ public:
virtual TinyString TranslateString(const char* context, const char* str) const;
virtual std::string TranslateStdString(const char* context, const char* str) const;
/// Returns the path to the directory to search for BIOS images.
virtual std::string GetBIOSDirectory() const;
/// Loads the BIOS image for the specified region.
std::optional<std::vector<u8>> GetBIOSImage(ConsoleRegion region);