Migrate SConfig::bWii to System.

This commit is contained in:
Admiral H. Curtiss
2024-01-31 02:56:56 +01:00
parent 8d515d407c
commit 9a3e770c23
40 changed files with 110 additions and 133 deletions

View File

@ -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);

View File

@ -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:

View File

@ -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
{

View File

@ -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
{

View File

@ -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();

View File

@ -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