Skip to content

Commit

Permalink
System: Add IsUsingPS2BIOS()
Browse files Browse the repository at this point in the history
  • Loading branch information
stenzek committed Dec 31, 2024
1 parent 69826f2 commit e0877c1
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 12 deletions.
6 changes: 2 additions & 4 deletions src/core/bus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions src/core/system.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
7 changes: 1 addition & 6 deletions src/core/system.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,6 @@ class GPUTexture;
class INISettingsInterface;
class MediaCapture;

namespace BIOS {
struct ImageInfo;
} // namespace BIOS

namespace GameDatabase {
struct Entry;
}
Expand Down Expand Up @@ -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).
Expand Down

0 comments on commit e0877c1

Please sign in to comment.