System: Add IsUsingPS2BIOS()

This commit is contained in:
Stenzek 2024-12-31 14:58:31 +10:00
parent 69826f2101
commit e0877c1922
No known key found for this signature in database
3 changed files with 5 additions and 12 deletions

View File

@ -1638,8 +1638,7 @@ template<MemoryAccessSize size>
u32 Bus::SIO2ReadHandler(PhysicalMemoryAddress address)
{
// Stub for using PS2 BIOS.
if (const BIOS::ImageInfo* ii = System::GetBIOSImageInfo();
!ii || ii->fastboot_patch != BIOS::ImageInfo::FastBootPatch::Type2) [[unlikely]]
if (!System::IsUsingPS2BIOS()) [[unlikely]]
{
// Throw exception when not using PS2 BIOS.
return UnmappedReadHandler<size>(address);
@ -1653,8 +1652,7 @@ template<MemoryAccessSize size>
void Bus::SIO2WriteHandler(PhysicalMemoryAddress address, u32 value)
{
// Stub for using PS2 BIOS.
if (const BIOS::ImageInfo* ii = System::GetBIOSImageInfo();
!ii || ii->fastboot_patch != BIOS::ImageInfo::FastBootPatch::Type2) [[unlikely]]
if (!System::IsUsingPS2BIOS()) [[unlikely]]
{
// Throw exception when not using PS2 BIOS.
UnmappedWriteHandler<size>(address, value);

View File

@ -775,9 +775,9 @@ System::BootMode System::GetBootMode()
return s_state.boot_mode;
}
const BIOS::ImageInfo* System::GetBIOSImageInfo()
bool System::IsUsingPS2BIOS()
{
return s_state.bios_image_info;
return (s_state.bios_image_info && s_state.bios_image_info->fastboot_patch == BIOS::ImageInfo::FastBootPatch::Type2);
}
bool System::IsExePath(std::string_view path)

View File

@ -31,10 +31,6 @@ class GPUTexture;
class INISettingsInterface;
class MediaCapture;
namespace BIOS {
struct ImageInfo;
} // namespace BIOS
namespace GameDatabase {
struct Entry;
}
@ -225,13 +221,12 @@ const std::string& GetExeOverride();
const GameDatabase::Entry* GetGameDatabaseEntry();
GameHash GetGameHash();
bool IsRunningUnknownGame();
bool IsUsingPS2BIOS();
BootMode GetBootMode();
/// Returns the time elapsed in the current play session.
u64 GetSessionPlayedTime();
const BIOS::ImageInfo* GetBIOSImageInfo();
void FormatLatencyStats(SmallStringBase& str);
/// Loads global settings (i.e. EmuConfig).