BIOS: Add check for older BIOS from PS3
Same revision number as newer PS3, but different file size and 512KB hash.
This commit is contained in:
parent
e3de44d127
commit
79012d5288
|
@ -37,7 +37,7 @@ std::string Hash::ToString() const
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
static constexpr std::array<ImageInfo, 26> s_image_infos = {
|
static constexpr std::array<ImageInfo, 27> s_image_infos = {
|
||||||
{{"SCPH-1000, DTL-H1000 (v1.0)", ConsoleRegion::NTSC_J, MakeHashFromString("239665b1a3dade1b5a52c06338011044"), true},
|
{{"SCPH-1000, DTL-H1000 (v1.0)", ConsoleRegion::NTSC_J, MakeHashFromString("239665b1a3dade1b5a52c06338011044"), true},
|
||||||
{"SCPH-1001, 5003, DTL-H1201, H3001 (v2.2 12-04-95 A)", ConsoleRegion::NTSC_U,
|
{"SCPH-1001, 5003, DTL-H1201, H3001 (v2.2 12-04-95 A)", ConsoleRegion::NTSC_U,
|
||||||
MakeHashFromString("924e392ed05558ffdb115408c263dccf"), true},
|
MakeHashFromString("924e392ed05558ffdb115408c263dccf"), true},
|
||||||
|
@ -79,6 +79,7 @@ static constexpr std::array<ImageInfo, 26> s_image_infos = {
|
||||||
true},
|
true},
|
||||||
{"SCPH-1000R (v4.5 05-25-00 J)", ConsoleRegion::NTSC_J, MakeHashFromString("476d68a94ccec3b9c8303bbd1daf2810"),
|
{"SCPH-1000R (v4.5 05-25-00 J)", ConsoleRegion::NTSC_J, MakeHashFromString("476d68a94ccec3b9c8303bbd1daf2810"),
|
||||||
true},
|
true},
|
||||||
|
{"PS3 (v5.0 06-23-03 A)", ConsoleRegion::Auto, MakeHashFromString("c02a6fbb1b27359f84e92fae8bc21316"), false},
|
||||||
{"PS3 (v5.0 06-23-03 A)", ConsoleRegion::Auto, MakeHashFromString("81bbe60ba7a3d1cea1d48c14cbcc647b"), false}}};
|
{"PS3 (v5.0 06-23-03 A)", ConsoleRegion::Auto, MakeHashFromString("81bbe60ba7a3d1cea1d48c14cbcc647b"), false}}};
|
||||||
|
|
||||||
Hash GetHash(const Image& image)
|
Hash GetHash(const Image& image)
|
||||||
|
@ -104,11 +105,10 @@ 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);
|
||||||
|
|
||||||
// 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 && size != BIOS_SIZE_PS3)
|
||||||
if (size < BIOS_SIZE || size > BIOS_SIZE_PS2)
|
|
||||||
{
|
{
|
||||||
Log_ErrorPrintf("BIOS image '%s' mismatch, expecting between %u and %u bytes, got %u bytes", filename, BIOS_SIZE,
|
Log_ErrorPrintf("BIOS image '%s' size mismatch, expecting either %u or %u or %u bytes but got %u bytes", filename,
|
||||||
BIOS_SIZE_PS2, size);
|
BIOS_SIZE, BIOS_SIZE_PS2, BIOS_SIZE_PS3, size);
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,8 @@ enum : u32
|
||||||
{
|
{
|
||||||
BIOS_BASE = 0x1FC00000,
|
BIOS_BASE = 0x1FC00000,
|
||||||
BIOS_SIZE = 0x80000,
|
BIOS_SIZE = 0x80000,
|
||||||
BIOS_SIZE_PS2 = 0x400000
|
BIOS_SIZE_PS2 = 0x400000,
|
||||||
|
BIOS_SIZE_PS3 = 0x3E66F0
|
||||||
};
|
};
|
||||||
|
|
||||||
using Image = std::vector<u8>;
|
using Image = std::vector<u8>;
|
||||||
|
|
|
@ -305,7 +305,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 && fd.Size != BIOS::BIOS_SIZE_PS2)
|
if (fd.Size != BIOS::BIOS_SIZE && fd.Size != BIOS::BIOS_SIZE_PS2 && fd.Size != BIOS::BIOS_SIZE_PS3)
|
||||||
{
|
{
|
||||||
Log_WarningPrintf("Skipping '%s': incorrect size", fd.FileName.c_str());
|
Log_WarningPrintf("Skipping '%s': incorrect size", fd.FileName.c_str());
|
||||||
continue;
|
continue;
|
||||||
|
@ -370,7 +370,7 @@ HostInterface::FindBIOSImagesInDirectory(const char* directory)
|
||||||
|
|
||||||
for (FILESYSTEM_FIND_DATA& fd : files)
|
for (FILESYSTEM_FIND_DATA& fd : files)
|
||||||
{
|
{
|
||||||
if (fd.Size < BIOS::BIOS_SIZE || fd.Size > BIOS::BIOS_SIZE_PS2)
|
if (fd.Size != BIOS::BIOS_SIZE && fd.Size != BIOS::BIOS_SIZE_PS2 && fd.Size != BIOS::BIOS_SIZE_PS3)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
std::string full_path(
|
std::string full_path(
|
||||||
|
|
Loading…
Reference in New Issue