| 256 | } |
| 257 | |
| 258 | static std::string FindBiosImage() |
| 259 | { |
| 260 | Console.WriteLn("Searching for a BIOS image in '%s'...", EmuFolders::Bios.c_str()); |
| 261 | |
| 262 | FileSystem::FindResultsArray results; |
| 263 | if (!FileSystem::FindFiles(EmuFolders::Bios.c_str(), "*", FILESYSTEM_FIND_FILES, &results)) |
| 264 | return std::string(); |
| 265 | |
| 266 | u32 version, region; |
| 267 | std::string description, zone; |
| 268 | for (const FILESYSTEM_FIND_DATA& fd : results) |
| 269 | { |
| 270 | if (fd.Size < MIN_BIOS_SIZE || fd.Size > MAX_BIOS_SIZE) |
| 271 | continue; |
| 272 | |
| 273 | if (IsBIOS(fd.FileName.c_str(), version, description, region, zone)) |
| 274 | { |
| 275 | Console.WriteLn("Using BIOS '%s' (%s %s)", fd.FileName.c_str(), description.c_str(), zone.c_str()); |
| 276 | return std::move(fd.FileName); |
| 277 | } |
| 278 | } |
| 279 | |
| 280 | Console.Error("Unable to auto locate a BIOS image"); |
| 281 | return std::string(); |
| 282 | } |
| 283 | |
| 284 | bool IsBIOS(const char* filename, u32& version, std::string& description, u32& region, std::string& zone) |
| 285 | { |