diff options
| author | Admiral H. Curtiss <pikachu025@gmail.com> | 2024-01-31 02:56:56 +0100 |
|---|---|---|
| committer | Admiral H. Curtiss <pikachu025@gmail.com> | 2024-01-31 12:54:07 +0100 |
| commit | 9a3e770c23312f61848adefc7202cb1b800cadff (patch) | |
| tree | 601445f63b85a19940e72f12df130076bb6315cc /Source/Core/VideoCommon | |
| parent | 8d515d407c8b51c8887e2766fb2494aad3f91a1e (diff) | |
Migrate SConfig::bWii to System.
Diffstat (limited to 'Source/Core/VideoCommon')
| -rw-r--r-- | Source/Core/VideoCommon/BPStructs.cpp | 5 | ||||
| -rw-r--r-- | Source/Core/VideoCommon/CPMemory.cpp | 3 | ||||
| -rw-r--r-- | Source/Core/VideoCommon/CommandProcessor.cpp | 10 | ||||
| -rw-r--r-- | Source/Core/VideoCommon/CommandProcessor.h | 7 | ||||
| -rw-r--r-- | Source/Core/VideoCommon/VertexManagerBase.cpp | 5 | ||||
| -rw-r--r-- | Source/Core/VideoCommon/Widescreen.cpp | 8 |
6 files changed, 18 insertions, 20 deletions
diff --git a/Source/Core/VideoCommon/BPStructs.cpp b/Source/Core/VideoCommon/BPStructs.cpp index 689570ae55..3da4a1f69a 100644 --- a/Source/Core/VideoCommon/BPStructs.cpp +++ b/Source/Core/VideoCommon/BPStructs.cpp @@ -14,7 +14,6 @@ #include "Common/EnumMap.h" #include "Common/Logging/Log.h" -#include "Core/ConfigManager.h" #include "Core/CoreTiming.h" #include "Core/DolphinAnalytics.h" #include "Core/FifoPlayer/FifoPlayer.h" @@ -389,7 +388,8 @@ static void BPWritten(PixelShaderManager& pixel_shader_manager, XFStateManager& u32 addr = bpmem.tmem_config.tlut_src << 5; // The GameCube ignores the upper bits of this address. Some games (WW, MKDD) set them. - if (!SConfig::GetInstance().bWii) + auto& system = Core::System::GetInstance(); + if (!system.IsWii()) addr = addr & 0x01FFFFFF; // The copy below will always be in bounds as tmem is bigger than the maximum address a TLUT can @@ -400,7 +400,6 @@ static void BPWritten(PixelShaderManager& pixel_shader_manager, XFStateManager& (1 << bpmem.tmem_config.tlut_dest.tmem_line_count.NumBits()) * TMEM_LINE_SIZE; static_assert(MAX_LOADABLE_TMEM_ADDR + MAX_TMEM_LINE_COUNT < TMEM_SIZE); - auto& system = Core::System::GetInstance(); auto& memory = system.GetMemory(); memory.CopyFromEmu(texMem + tmem_addr, addr, tmem_transfer_count); diff --git a/Source/Core/VideoCommon/CPMemory.cpp b/Source/Core/VideoCommon/CPMemory.cpp index 853f0a7841..b3761ddf52 100644 --- a/Source/Core/VideoCommon/CPMemory.cpp +++ b/Source/Core/VideoCommon/CPMemory.cpp @@ -10,6 +10,7 @@ #include "Common/EnumUtils.h" #include "Common/Logging/Log.h" #include "Core/DolphinAnalytics.h" +#include "Core/System.h" #include "VideoCommon/CommandProcessor.h" #include "VideoCommon/VertexLoaderManager.h" @@ -186,7 +187,7 @@ void CPState::LoadCPReg(u8 sub_cmd, u32 value) // Pointers to vertex arrays in GC RAM case ARRAY_BASE: array_bases[static_cast<CPArray>(sub_cmd & CP_ARRAY_MASK)] = - value & CommandProcessor::GetPhysicalAddressMask(); + value & CommandProcessor::GetPhysicalAddressMask(Core::System::GetInstance().IsWii()); break; case ARRAY_STRIDE: diff --git a/Source/Core/VideoCommon/CommandProcessor.cpp b/Source/Core/VideoCommon/CommandProcessor.cpp index be9d3636ee..3f5179a726 100644 --- a/Source/Core/VideoCommon/CommandProcessor.cpp +++ b/Source/Core/VideoCommon/CommandProcessor.cpp @@ -13,7 +13,6 @@ #include "Common/Flag.h" #include "Common/Logging/Log.h" #include "Common/MsgHandler.h" -#include "Core/ConfigManager.h" #include "Core/CoreTiming.h" #include "Core/HW/GPFifo.h" #include "Core/HW/MMIO.h" @@ -137,19 +136,12 @@ void CommandProcessorManager::Init() m_system.GetCoreTiming().RegisterEvent("CPInterrupt", UpdateInterrupts_Wrapper); } -u32 GetPhysicalAddressMask() -{ - // Physical addresses in CP seem to ignore some of the upper bits (depending on platform) - // This can be observed in CP MMIO registers by setting to 0xffffffff and then reading back. - return SConfig::GetInstance().bWii ? 0x1fffffff : 0x03ffffff; -} - void CommandProcessorManager::RegisterMMIO(MMIO::Mapping* mmio, u32 base) { constexpr u16 WMASK_NONE = 0x0000; constexpr u16 WMASK_ALL = 0xffff; constexpr u16 WMASK_LO_ALIGN_32BIT = 0xffe0; - const u16 WMASK_HI_RESTRICT = GetPhysicalAddressMask() >> 16; + const u16 WMASK_HI_RESTRICT = GetPhysicalAddressMask(m_system.IsWii()) >> 16; struct { diff --git a/Source/Core/VideoCommon/CommandProcessor.h b/Source/Core/VideoCommon/CommandProcessor.h index 932c2218ea..b231eaa3dc 100644 --- a/Source/Core/VideoCommon/CommandProcessor.h +++ b/Source/Core/VideoCommon/CommandProcessor.h @@ -155,7 +155,12 @@ union UCPClearReg UCPClearReg(u16 _hex) { Hex = _hex; } }; -u32 GetPhysicalAddressMask(); +constexpr u32 GetPhysicalAddressMask(bool is_wii) +{ + // Physical addresses in CP seem to ignore some of the upper bits (depending on platform) + // This can be observed in CP MMIO registers by setting to 0xffffffff and then reading back. + return is_wii ? 0x1fffffff : 0x03ffffff; +} class CommandProcessorManager { diff --git a/Source/Core/VideoCommon/VertexManagerBase.cpp b/Source/Core/VideoCommon/VertexManagerBase.cpp index 92ff2a861f..1309ea4a47 100644 --- a/Source/Core/VideoCommon/VertexManagerBase.cpp +++ b/Source/Core/VideoCommon/VertexManagerBase.cpp @@ -14,7 +14,6 @@ #include "Common/MathUtil.h" #include "Common/SmallVector.h" -#include "Core/ConfigManager.h" #include "Core/DolphinAnalytics.h" #include "Core/HW/SystemTimers.h" #include "Core/System.h" @@ -511,7 +510,8 @@ void VertexManagerBase::Flush() #endif // Track some stats used elsewhere by the anamorphic widescreen heuristic. - if (!SConfig::GetInstance().bWii) + auto& system = Core::System::GetInstance(); + if (!system.IsWii()) { const bool is_perspective = xfmem.projection.type == ProjectionType::Perspective; @@ -538,7 +538,6 @@ void VertexManagerBase::Flush() } } - auto& system = Core::System::GetInstance(); auto& pixel_shader_manager = system.GetPixelShaderManager(); auto& geometry_shader_manager = system.GetGeometryShaderManager(); auto& vertex_shader_manager = system.GetVertexShaderManager(); diff --git a/Source/Core/VideoCommon/Widescreen.cpp b/Source/Core/VideoCommon/Widescreen.cpp index 8b63082525..1b3f6002c8 100644 --- a/Source/Core/VideoCommon/Widescreen.cpp +++ b/Source/Core/VideoCommon/Widescreen.cpp @@ -5,7 +5,7 @@ #include "Common/ChunkFile.h" #include "Core/Config/SYSCONFSettings.h" -#include "Core/ConfigManager.h" +#include "Core/System.h" #include "VideoCommon/VertexManagerBase.h" @@ -23,7 +23,8 @@ WidescreenManager::WidescreenManager() "Widescreen"); // VertexManager doesn't maintain statistics in Wii mode. - if (!SConfig::GetInstance().bWii) + auto& system = Core::System::GetInstance(); + if (!system.IsWii()) { m_update_widescreen = AfterFrameEvent::Register([this] { UpdateWidescreenHeuristic(); }, "WideScreen Heuristic"); @@ -32,7 +33,8 @@ WidescreenManager::WidescreenManager() void WidescreenManager::Update() { - if (SConfig::GetInstance().bWii) + auto& system = Core::System::GetInstance(); + if (system.IsWii()) m_is_game_widescreen = Config::Get(Config::SYSCONF_WIDESCREEN); // suggested_aspect_mode overrides SYSCONF_WIDESCREEN |
