BIOS: Add support for loading PS2 BIOSes
This commit is contained in:
parent
4db29f9399
commit
0e2276fc7a
|
@ -101,9 +101,11 @@ std::optional<Image> LoadImageFromFile(const char* filename)
|
||||||
const u32 size = static_cast<u32>(std::ftell(fp.get()));
|
const u32 size = static_cast<u32>(std::ftell(fp.get()));
|
||||||
std::fseek(fp.get(), 0, SEEK_SET);
|
std::fseek(fp.get(), 0, SEEK_SET);
|
||||||
|
|
||||||
if (size != BIOS_SIZE)
|
// Apparently some PS1/PS2 BIOS revisions found on the PS3 are neither 512KB nor 4MB, so just check within this range
|
||||||
|
if (size < BIOS_SIZE || size > BIOS_SIZE_PS2)
|
||||||
{
|
{
|
||||||
Log_ErrorPrintf("BIOS image '%s' mismatch, expecting %u bytes, got %u bytes", filename, BIOS_SIZE, size);
|
Log_ErrorPrintf("BIOS image '%s' mismatch, expecting between %u and %u bytes, got %u bytes", filename, BIOS_SIZE,
|
||||||
|
BIOS_SIZE_PS2, size);
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,8 @@ namespace BIOS {
|
||||||
enum : u32
|
enum : u32
|
||||||
{
|
{
|
||||||
BIOS_BASE = 0x1FC00000,
|
BIOS_BASE = 0x1FC00000,
|
||||||
BIOS_SIZE = 0x80000
|
BIOS_SIZE = 0x80000,
|
||||||
|
BIOS_SIZE_PS2 = 0x400000
|
||||||
};
|
};
|
||||||
|
|
||||||
using Image = std::vector<u8>;
|
using Image = std::vector<u8>;
|
||||||
|
|
|
@ -304,7 +304,7 @@ std::optional<std::vector<u8>> HostInterface::FindBIOSImageInDirectory(ConsoleRe
|
||||||
|
|
||||||
for (const FILESYSTEM_FIND_DATA& fd : results)
|
for (const FILESYSTEM_FIND_DATA& fd : results)
|
||||||
{
|
{
|
||||||
if (fd.Size != BIOS::BIOS_SIZE)
|
if (fd.Size < BIOS::BIOS_SIZE || fd.Size > BIOS::BIOS_SIZE_PS2)
|
||||||
{
|
{
|
||||||
Log_WarningPrintf("Skipping '%s': incorrect size", fd.FileName.c_str());
|
Log_WarningPrintf("Skipping '%s': incorrect size", fd.FileName.c_str());
|
||||||
continue;
|
continue;
|
||||||
|
@ -353,7 +353,7 @@ HostInterface::FindBIOSImagesInDirectory(const char* directory)
|
||||||
|
|
||||||
for (FILESYSTEM_FIND_DATA& fd : files)
|
for (FILESYSTEM_FIND_DATA& fd : files)
|
||||||
{
|
{
|
||||||
if (fd.Size != BIOS::BIOS_SIZE)
|
if (fd.Size < BIOS::BIOS_SIZE || fd.Size > BIOS::BIOS_SIZE_PS2)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
std::string full_path(
|
std::string full_path(
|
||||||
|
|
|
@ -126,7 +126,7 @@ public:
|
||||||
std::optional<std::vector<u8>> GetBIOSImage(ConsoleRegion region);
|
std::optional<std::vector<u8>> GetBIOSImage(ConsoleRegion region);
|
||||||
|
|
||||||
/// Searches for a BIOS image for the specified region in the specified directory. If no match is found, the first
|
/// Searches for a BIOS image for the specified region in the specified directory. If no match is found, the first
|
||||||
/// 512KB BIOS image will be used.
|
/// BIOS image within 512KB and 4MB will be used.
|
||||||
std::optional<std::vector<u8>> FindBIOSImageInDirectory(ConsoleRegion region, const char* directory);
|
std::optional<std::vector<u8>> FindBIOSImageInDirectory(ConsoleRegion region, const char* directory);
|
||||||
|
|
||||||
/// Returns a list of filenames and descriptions for BIOS images in a directory.
|
/// Returns a list of filenames and descriptions for BIOS images in a directory.
|
||||||
|
|
Loading…
Reference in New Issue