Merge pull request #1056 from ggrtk/exp-access

Add support for PS2/PS3-type PS1 BIOSes
This commit is contained in:
Connor McLaughlin 2020-11-11 01:02:22 +10:00 committed by GitHub
commit e3c07b562c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 52 additions and 4 deletions

View File

@ -37,7 +37,7 @@ std::string Hash::ToString() const
return str;
}
static constexpr std::array<ImageInfo, 27> s_image_infos = {{
static constexpr std::array<ImageInfo, 26> s_image_infos = {{
{"SCPH-1000, DTL-H1000 (v1.0)", ConsoleRegion::NTSC_J, MakeHashFromString("239665b1a3dade1b5a52c06338011044")},
{"SCPH-1001, 5003, DTL-H1201, H3001 (v2.2 12-04-95 A)", ConsoleRegion::NTSC_U,
MakeHashFromString("924e392ed05558ffdb115408c263dccf")},
@ -75,8 +75,7 @@ static constexpr std::array<ImageInfo, 27> s_image_infos = {{
{"SCPH-102 (v4.5 05-25-00 E)", ConsoleRegion::PAL, MakeHashFromString("de93caec13d1a141a40a79f5c86168d6")},
{"PSP, SCPH-1000R (v4.5 05-25-00 J)", ConsoleRegion::Auto, MakeHashFromString("c53ca5908936d412331790f4426c6c33")},
{"SCPH-1000R (v4.5 05-25-00 J)", ConsoleRegion::NTSC_J, MakeHashFromString("476d68a94ccec3b9c8303bbd1daf2810")},
{"PS3 (v5.0 06/23/03 A)", ConsoleRegion::Auto, MakeHashFromString("fbb5f59ec332451debccf1e377017237")},
{"PS3 (v5.0 06/23/03 A)", ConsoleRegion::Auto, MakeHashFromString("81bbe60ba7a3d1cea1d48c14cbcc647b")},
{"PS3 (v5.0 06-23-03 A)", ConsoleRegion::Auto, MakeHashFromString("81bbe60ba7a3d1cea1d48c14cbcc647b")}
}};
Hash GetHash(const Image& image)

View File

@ -625,10 +625,14 @@ ALWAYS_INLINE static TickCount DoEXP2Access(u32 offset, u32& value)
m_tty_line_buffer += static_cast<char>(Truncate8(value));
}
}
else if (offset == 0x41)
else if (offset == 0x41 || offset == 0x42)
{
Log_WarningPrintf("BIOS POST status: %02X", value & UINT32_C(0x0F));
}
else if (offset == 0x70)
{
Log_WarningPrintf("BIOS POST2 status: %02X", value & UINT32_C(0x0F));
}
else
{
Log_WarningPrintf("EXP2 write: 0x%08X <- 0x%08X", EXP2_BASE | offset, value);
@ -638,6 +642,40 @@ ALWAYS_INLINE static TickCount DoEXP2Access(u32 offset, u32& value)
}
}
template<MemoryAccessType type>
ALWAYS_INLINE static TickCount DoEXP3Access(u32 offset, u32& value)
{
if constexpr (type == MemoryAccessType::Read)
{
Log_WarningPrintf("EXP3 read: 0x%08X -> 0x%08X", EXP3_BASE | offset);
value = UINT32_C(0xFFFFFFFF);
return 0;
}
else
{
if (offset == 0)
Log_WarningPrintf("BIOS POST3 status: %02X", value & UINT32_C(0x0F));
return 0;
}
}
template<MemoryAccessType type>
ALWAYS_INLINE static TickCount DoUnknownEXPAccess(u32 address, u32& value)
{
if constexpr (type == MemoryAccessType::Read)
{
Log_ErrorPrintf("Unknown EXP read: 0x%08X", address);
return -1;
}
else
{
Log_WarningPrintf("Unknown EXP write: 0x%08X <- 0x%08X", address, value);
return 0;
}
}
template<MemoryAccessType type, MemoryAccessSize size>
ALWAYS_INLINE static TickCount DoMemoryControlAccess(u32 offset, u32& value)
{
@ -1289,6 +1327,14 @@ static ALWAYS_INLINE TickCount DoMemoryAccess(VirtualMemoryAddress address, u32&
{
return DoEXP2Access<type, size>(address & EXP2_MASK, value);
}
else if (address < EXP3_BASE)
{
return DoUnknownEXPAccess<type>(address, value);
}
else if (address < (EXP3_BASE + EXP3_SIZE))
{
return DoEXP3Access<type>(address & EXP3_MASK, value);
}
else
{
return DoInvalidAccess(type, size, address, value);

View File

@ -56,6 +56,9 @@ enum : u32
EXP2_BASE = 0x1F802000,
EXP2_SIZE = 0x2000,
EXP2_MASK = EXP2_SIZE - 1,
EXP3_BASE = 0x1FA00000,
EXP3_SIZE = 0x1,
EXP3_MASK = EXP3_SIZE - 1,
BIOS_BASE = 0x1FC00000,
BIOS_SIZE = 0x80000,
BIOS_MASK = 0x7FFFF,