mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-14 21:37:52 -07:00
Migrate SConfig::bWii to System.
This commit is contained in:
parent
8d515d407c
commit
9a3e770c23
@ -760,7 +760,7 @@ JNIEXPORT jboolean JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_IsGameMe
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_org_dolphinemu_dolphinemu_NativeLibrary_IsEmulatingWiiUnchecked(JNIEnv*, jclass)
|
||||
{
|
||||
return SConfig::GetInstance().bWii;
|
||||
return Core::System::GetInstance().IsWii();
|
||||
}
|
||||
|
||||
JNIEXPORT jstring JNICALL
|
||||
|
@ -522,7 +522,7 @@ bool CBoot::BootUp(Core::System& system, const Core::CPUThreadGuard& guard,
|
||||
|
||||
// PAL Wii uses NTSC framerate and linecount in 60Hz modes
|
||||
system.GetVideoInterface().Preset(DiscIO::IsNTSC(config.m_region) ||
|
||||
(config.bWii && Config::Get(Config::SYSCONF_PAL60)));
|
||||
(system.IsWii() && Config::Get(Config::SYSCONF_PAL60)));
|
||||
|
||||
struct BootTitle
|
||||
{
|
||||
@ -541,7 +541,7 @@ bool CBoot::BootUp(Core::System& system, const Core::CPUThreadGuard& guard,
|
||||
if (!volume)
|
||||
return false;
|
||||
|
||||
if (!EmulatedBS2(system, guard, config.bWii, *volume, riivolution_patches))
|
||||
if (!EmulatedBS2(system, guard, system.IsWii(), *volume, riivolution_patches))
|
||||
return false;
|
||||
|
||||
SConfig::OnNewTitleLoad(guard);
|
||||
@ -560,11 +560,11 @@ bool CBoot::BootUp(Core::System& system, const Core::CPUThreadGuard& guard,
|
||||
auto& ppc_state = system.GetPPCState();
|
||||
|
||||
SetupMSR(ppc_state);
|
||||
SetupHID(ppc_state, config.bWii);
|
||||
SetupBAT(system, config.bWii);
|
||||
SetupHID(ppc_state, system.IsWii());
|
||||
SetupBAT(system, system.IsWii());
|
||||
CopyDefaultExceptionHandlers(system);
|
||||
|
||||
if (config.bWii)
|
||||
if (system.IsWii())
|
||||
{
|
||||
// Set a value for the SP. It doesn't matter where this points to,
|
||||
// as long as it is a valid location. This value is taken from a homebrew binary.
|
||||
|
@ -72,7 +72,7 @@ bool BootCore(std::unique_ptr<BootParameters> boot, const WindowSystemInfo& wsi)
|
||||
{
|
||||
for (ExpansionInterface::Slot slot : ExpansionInterface::MEMCARD_SLOTS)
|
||||
{
|
||||
if (movie.IsUsingMemcard(slot) && movie.IsStartingFromClearSave() && !StartUp.bWii)
|
||||
if (movie.IsUsingMemcard(slot) && movie.IsStartingFromClearSave() && !system.IsWii())
|
||||
{
|
||||
const auto raw_path =
|
||||
File::GetUserPath(D_GCUSER_IDX) +
|
||||
@ -104,7 +104,7 @@ bool BootCore(std::unique_ptr<BootParameters> boot, const WindowSystemInfo& wsi)
|
||||
Config::MAIN_GC_LANGUAGE,
|
||||
DiscIO::ToGameCubeLanguage(StartUp.GetLanguageAdjustedForRegion(false, StartUp.m_region)));
|
||||
|
||||
if (StartUp.bWii)
|
||||
if (system.IsWii())
|
||||
{
|
||||
const u32 wii_language =
|
||||
static_cast<u32>(StartUp.GetLanguageAdjustedForRegion(true, StartUp.m_region));
|
||||
@ -137,7 +137,7 @@ bool BootCore(std::unique_ptr<BootParameters> boot, const WindowSystemInfo& wsi)
|
||||
|
||||
// Some NTSC Wii games such as Doc Louis's Punch-Out!! and
|
||||
// 1942 (Virtual Console) crash if the PAL60 option is enabled
|
||||
if (StartUp.bWii && DiscIO::IsNTSC(StartUp.m_region) && Config::Get(Config::SYSCONF_PAL60))
|
||||
if (system.IsWii() && DiscIO::IsNTSC(StartUp.m_region) && Config::Get(Config::SYSCONF_PAL60))
|
||||
Config::SetCurrent(Config::SYSCONF_PAL60, false);
|
||||
|
||||
// Disable loading time emulation for Riivolution-patched games until we have proper emulation.
|
||||
@ -148,7 +148,7 @@ bool BootCore(std::unique_ptr<BootParameters> boot, const WindowSystemInfo& wsi)
|
||||
|
||||
Core::UpdateWantDeterminism(/*initial*/ true);
|
||||
|
||||
if (StartUp.bWii)
|
||||
if (system.IsWii())
|
||||
{
|
||||
Core::InitializeWiiRoot(Core::WantsDeterminism());
|
||||
|
||||
@ -170,7 +170,7 @@ bool BootCore(std::unique_ptr<BootParameters> boot, const WindowSystemInfo& wsi)
|
||||
AchievementManager::GetInstance().SetDisabled(false);
|
||||
#endif // USE_RETRO_ACHIEVEMENTS
|
||||
|
||||
const bool load_ipl = !StartUp.bWii && !Config::Get(Config::MAIN_SKIP_IPL) &&
|
||||
const bool load_ipl = !system.IsWii() && !Config::Get(Config::MAIN_SKIP_IPL) &&
|
||||
std::holds_alternative<BootParameters::Disc>(boot->parameters);
|
||||
if (load_ipl)
|
||||
{
|
||||
|
@ -181,7 +181,8 @@ void SConfig::SetRunningGameMetadata(const std::string& game_id, const std::stri
|
||||
}
|
||||
|
||||
const Core::TitleDatabase title_database;
|
||||
const DiscIO::Language language = GetLanguageAdjustedForRegion(bWii, region);
|
||||
auto& system = Core::System::GetInstance();
|
||||
const DiscIO::Language language = GetLanguageAdjustedForRegion(system.IsWii(), region);
|
||||
m_title_name = title_database.GetTitleName(m_gametdb_id, language);
|
||||
m_title_description = title_database.Describe(m_gametdb_id, language);
|
||||
NOTICE_LOG_FMT(CORE, "Active title: {}", m_title_description);
|
||||
@ -221,7 +222,8 @@ void SConfig::LoadDefaults()
|
||||
bAutomaticStart = false;
|
||||
bBootToPause = false;
|
||||
|
||||
bWii = false;
|
||||
auto& system = Core::System::GetInstance();
|
||||
system.SetIsWii(false);
|
||||
|
||||
ResetRunningGameMetadata();
|
||||
}
|
||||
@ -237,11 +239,14 @@ std::string SConfig::MakeGameID(std::string_view file_name)
|
||||
|
||||
struct SetGameMetadata
|
||||
{
|
||||
SetGameMetadata(SConfig* config_, DiscIO::Region* region_) : config(config_), region(region_) {}
|
||||
SetGameMetadata(SConfig* config_, Core::System& system_, DiscIO::Region* region_)
|
||||
: config(config_), system(system_), region(region_)
|
||||
{
|
||||
}
|
||||
bool operator()(const BootParameters::Disc& disc) const
|
||||
{
|
||||
*region = disc.volume->GetRegion();
|
||||
config->bWii = disc.volume->GetVolumeType() == DiscIO::Platform::WiiDisc;
|
||||
system.SetIsWii(disc.volume->GetVolumeType() == DiscIO::Platform::WiiDisc);
|
||||
config->m_disc_booted_from_game_list = true;
|
||||
config->SetRunningGameMetadata(*disc.volume, disc.volume->GetGamePartition());
|
||||
return true;
|
||||
@ -253,7 +258,7 @@ struct SetGameMetadata
|
||||
return false;
|
||||
|
||||
*region = DiscIO::Region::Unknown;
|
||||
config->bWii = executable.reader->IsWii();
|
||||
system.SetIsWii(executable.reader->IsWii());
|
||||
|
||||
// Strip the .elf/.dol file extension and directories before the name
|
||||
SplitPath(executable.path, nullptr, &config->m_debugger_game_id, nullptr);
|
||||
@ -285,7 +290,7 @@ struct SetGameMetadata
|
||||
|
||||
const IOS::ES::TMDReader& tmd = wad.GetTMD();
|
||||
*region = tmd.GetRegion();
|
||||
config->bWii = true;
|
||||
system.SetIsWii(true);
|
||||
config->SetRunningGameMetadata(tmd, DiscIO::Platform::WiiWAD);
|
||||
|
||||
return true;
|
||||
@ -302,7 +307,7 @@ struct SetGameMetadata
|
||||
}
|
||||
|
||||
*region = tmd.GetRegion();
|
||||
config->bWii = true;
|
||||
system.SetIsWii(false);
|
||||
config->SetRunningGameMetadata(tmd, DiscIO::Platform::WiiWAD);
|
||||
|
||||
return true;
|
||||
@ -311,7 +316,7 @@ struct SetGameMetadata
|
||||
bool operator()(const BootParameters::IPL& ipl) const
|
||||
{
|
||||
*region = ipl.region;
|
||||
config->bWii = false;
|
||||
system.SetIsWii(false);
|
||||
Host_TitleChanged();
|
||||
|
||||
return true;
|
||||
@ -324,7 +329,7 @@ struct SetGameMetadata
|
||||
return false;
|
||||
|
||||
*region = DiscIO::Region::NTSC_U;
|
||||
config->bWii = dff_file->GetIsWii();
|
||||
system.SetIsWii(dff_file->GetIsWii());
|
||||
Host_TitleChanged();
|
||||
|
||||
return true;
|
||||
@ -332,6 +337,7 @@ struct SetGameMetadata
|
||||
|
||||
private:
|
||||
SConfig* config;
|
||||
Core::System& system;
|
||||
DiscIO::Region* region;
|
||||
};
|
||||
|
||||
@ -339,7 +345,7 @@ bool SConfig::SetPathsAndGameMetadata(Core::System& system, const BootParameters
|
||||
{
|
||||
system.SetIsMIOS(false);
|
||||
m_disc_booted_from_game_list = false;
|
||||
if (!std::visit(SetGameMetadata(this, &m_region), boot.parameters))
|
||||
if (!std::visit(SetGameMetadata(this, system, &m_region), boot.parameters))
|
||||
return false;
|
||||
|
||||
if (m_region == DiscIO::Region::Unknown)
|
||||
|
@ -52,8 +52,6 @@ struct SConfig
|
||||
|
||||
bool bCopyWiiSaveNetplay = true;
|
||||
|
||||
bool bWii = false;
|
||||
|
||||
DiscIO::Region m_region;
|
||||
|
||||
// files
|
||||
|
@ -254,7 +254,7 @@ bool Init(Core::System& system, std::unique_ptr<BootParameters> boot, const Wind
|
||||
// Drain any left over jobs
|
||||
HostDispatchJobs();
|
||||
|
||||
INFO_LOG_FMT(BOOT, "Starting core = {} mode", SConfig::GetInstance().bWii ? "Wii" : "GameCube");
|
||||
INFO_LOG_FMT(BOOT, "Starting core = {} mode", system.IsWii() ? "Wii" : "GameCube");
|
||||
INFO_LOG_FMT(BOOT, "CPU Thread separate = {}", system.IsDualCoreMode() ? "Yes" : "No");
|
||||
|
||||
Host_UpdateMainFrame(); // Disable any menus or buttons at boot
|
||||
@ -483,7 +483,6 @@ static void FifoPlayerThread(Core::System& system, const std::optional<std::stri
|
||||
static void EmuThread(Core::System& system, std::unique_ptr<BootParameters> boot,
|
||||
WindowSystemInfo wsi)
|
||||
{
|
||||
const SConfig& core_parameter = SConfig::GetInstance();
|
||||
CallOnStateChangedCallbacks(State::Starting);
|
||||
Common::ScopeGuard flag_guard{[] {
|
||||
s_is_booting.Clear();
|
||||
@ -521,7 +520,7 @@ static void EmuThread(Core::System& system, std::unique_ptr<BootParameters> boot
|
||||
const bool delete_savestate =
|
||||
boot_session_data.GetDeleteSavestate() == DeleteSavestateAfterBoot::Yes;
|
||||
|
||||
bool sync_sd_folder = core_parameter.bWii && Config::Get(Config::MAIN_WII_SD_CARD) &&
|
||||
bool sync_sd_folder = system.IsWii() && Config::Get(Config::MAIN_WII_SD_CARD) &&
|
||||
Config::Get(Config::MAIN_WII_SD_CARD_ENABLE_FOLDER_SYNC);
|
||||
if (sync_sd_folder)
|
||||
{
|
||||
@ -544,7 +543,7 @@ static void EmuThread(Core::System& system, std::unique_ptr<BootParameters> boot
|
||||
}};
|
||||
|
||||
// Load Wiimotes - only if we are booting in Wii mode
|
||||
if (core_parameter.bWii && !Config::Get(Config::MAIN_BLUETOOTH_PASSTHROUGH_ENABLED))
|
||||
if (system.IsWii() && !Config::Get(Config::MAIN_BLUETOOTH_PASSTHROUGH_ENABLED))
|
||||
{
|
||||
Wiimote::LoadConfig();
|
||||
}
|
||||
@ -600,7 +599,7 @@ static void EmuThread(Core::System& system, std::unique_ptr<BootParameters> boot
|
||||
else
|
||||
Config::SetBaseOrCurrent(Config::MAIN_DSP_THREAD, cpu_info.num_cores > 2);
|
||||
|
||||
if (!system.GetDSP().GetDSPEmulator()->Initialize(core_parameter.bWii,
|
||||
if (!system.GetDSP().GetDSPEmulator()->Initialize(system.IsWii(),
|
||||
Config::Get(Config::MAIN_DSP_THREAD)))
|
||||
{
|
||||
PanicAlertFmt("Failed to initialize DSP emulation!");
|
||||
@ -628,7 +627,7 @@ static void EmuThread(Core::System& system, std::unique_ptr<BootParameters> boot
|
||||
cpuThreadFunc = CpuThread;
|
||||
|
||||
std::optional<DiscIO::Riivolution::SavegameRedirect> savegame_redirect = std::nullopt;
|
||||
if (SConfig::GetInstance().bWii)
|
||||
if (system.IsWii())
|
||||
savegame_redirect = DiscIO::Riivolution::ExtractSavegameRedirect(boot->riivolution_patches);
|
||||
|
||||
{
|
||||
@ -645,7 +644,7 @@ static void EmuThread(Core::System& system, std::unique_ptr<BootParameters> boot
|
||||
Core::CleanUpWiiFileSystemContents(boot_session_data);
|
||||
boot_session_data.InvokeWiiSyncCleanup();
|
||||
}};
|
||||
if (SConfig::GetInstance().bWii)
|
||||
if (system.IsWii())
|
||||
Core::InitializeWiiFileSystemContents(savegame_redirect, boot_session_data);
|
||||
else
|
||||
wiifs_guard.Dismiss();
|
||||
|
@ -10,7 +10,6 @@
|
||||
#include "Common/MsgHandler.h"
|
||||
#include "Common/Thread.h"
|
||||
|
||||
#include "Core/ConfigManager.h"
|
||||
#include "Core/HW/Memmap.h"
|
||||
#include "Core/System.h"
|
||||
|
||||
@ -244,7 +243,7 @@ void FifoRecorder::StartRecording(s32 numFrames, CallbackFunc finishedCb)
|
||||
std::fill(m_Ram.begin(), m_Ram.end(), 0);
|
||||
std::fill(m_ExRam.begin(), m_ExRam.end(), 0);
|
||||
|
||||
m_File->SetIsWii(SConfig::GetInstance().bWii);
|
||||
m_File->SetIsWii(m_system.IsWii());
|
||||
|
||||
if (!m_IsRecording)
|
||||
{
|
||||
|
@ -16,7 +16,6 @@
|
||||
#include "Common/FileUtil.h"
|
||||
|
||||
#include "Core/Config/MainSettings.h"
|
||||
#include "Core/ConfigManager.h"
|
||||
#include "Core/Core.h"
|
||||
#include "Core/PowerPC/MMU.h"
|
||||
#include "Core/PowerPC/PowerPC.h"
|
||||
@ -136,7 +135,7 @@ static Installation InstallCodeHandlerLocked(const Core::CPUThreadGuard& guard)
|
||||
}
|
||||
|
||||
u8 mmio_addr = 0xCC;
|
||||
if (SConfig::GetInstance().bWii)
|
||||
if (guard.GetSystem().IsWii())
|
||||
{
|
||||
mmio_addr = 0xCD;
|
||||
}
|
||||
|
@ -6,7 +6,6 @@
|
||||
#include <algorithm>
|
||||
|
||||
#include "Common/BitUtils.h"
|
||||
#include "Core/ConfigManager.h"
|
||||
#include "Core/Core.h"
|
||||
#include "Core/HW/DSP.h"
|
||||
#include "Core/HW/Memmap.h"
|
||||
@ -209,7 +208,7 @@ struct AuxiliaryAddressSpaceAccessors : Accessors
|
||||
static constexpr u32 aram_base_address = 0;
|
||||
bool IsValidAddress(const Core::CPUThreadGuard& guard, u32 address) const override
|
||||
{
|
||||
return !SConfig::GetInstance().bWii && (address - aram_base_address) < GetSize();
|
||||
return !guard.GetSystem().IsWii() && (address - aram_base_address) < GetSize();
|
||||
}
|
||||
u8 ReadU8(const Core::CPUThreadGuard& guard, u32 address) const override
|
||||
{
|
||||
@ -442,7 +441,7 @@ Accessors* GetAccessors(Type address_space)
|
||||
case Type::Effective:
|
||||
return &s_effective_address_space_accessors;
|
||||
case Type::Physical:
|
||||
if (SConfig::GetInstance().bWii)
|
||||
if (Core::System::GetInstance().IsWii())
|
||||
{
|
||||
return &s_physical_address_space_accessors_wii;
|
||||
}
|
||||
@ -453,13 +452,13 @@ Accessors* GetAccessors(Type address_space)
|
||||
case Type::Mem1:
|
||||
return &s_mem1_address_space_accessors;
|
||||
case Type::Mem2:
|
||||
if (SConfig::GetInstance().bWii)
|
||||
if (Core::System::GetInstance().IsWii())
|
||||
{
|
||||
return &s_mem2_address_space_accessors;
|
||||
}
|
||||
break;
|
||||
case Type::Auxiliary:
|
||||
if (!SConfig::GetInstance().bWii)
|
||||
if (!Core::System::GetInstance().IsWii())
|
||||
{
|
||||
return &s_auxiliary_address_space_accessors;
|
||||
}
|
||||
|
@ -352,6 +352,6 @@ u32 AudioInterfaceManager::Get32KHzSampleRateDivisor() const
|
||||
|
||||
u32 AudioInterfaceManager::Get48KHzSampleRateDivisor() const
|
||||
{
|
||||
return (SConfig::GetInstance().bWii ? 1125 : 1124) * 2;
|
||||
return (m_system.IsWii() ? 1125 : 1124) * 2;
|
||||
}
|
||||
} // namespace AudioInterface
|
||||
|
@ -31,7 +31,6 @@
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Common/MemoryUtil.h"
|
||||
|
||||
#include "Core/ConfigManager.h"
|
||||
#include "Core/CoreTiming.h"
|
||||
#include "Core/DSPEmulator.h"
|
||||
#include "Core/HW/HSP/HSP.h"
|
||||
@ -122,7 +121,7 @@ void DSPManager::Reinit(bool hle)
|
||||
m_dsp_emulator = CreateDSPEmulator(m_system, hle);
|
||||
m_is_lle = m_dsp_emulator->IsLLE();
|
||||
|
||||
if (SConfig::GetInstance().bWii)
|
||||
if (m_system.IsWii())
|
||||
{
|
||||
auto& memory = m_system.GetMemory();
|
||||
m_aram.wii_mode = true;
|
||||
@ -317,8 +316,8 @@ void DSPManager::RegisterMMIO(MMIO::Mapping* mmio, u32 base)
|
||||
MMIO::ComplexWrite<u16>([](Core::System& system, u32, u16 val) {
|
||||
auto& dsp = system.GetDSP();
|
||||
*MMIO::Utils::HighPart(&dsp.m_audio_dma.SourceAddress) =
|
||||
val & (SConfig::GetInstance().bWii ? WMASK_AUDIO_HI_RESTRICT_WII :
|
||||
WMASK_AUDIO_HI_RESTRICT_GCN);
|
||||
val &
|
||||
(system.IsWii() ? WMASK_AUDIO_HI_RESTRICT_WII : WMASK_AUDIO_HI_RESTRICT_GCN);
|
||||
}));
|
||||
|
||||
// Audio DMA MMIO controlling the DMA start.
|
||||
|
@ -11,7 +11,6 @@
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Common/Logging/Log.h"
|
||||
#include "Common/Swap.h"
|
||||
#include "Core/ConfigManager.h"
|
||||
#include "Core/HW/DSP.h"
|
||||
#include "Core/HW/DSPHLE/DSPHLE.h"
|
||||
#include "Core/HW/DSPHLE/MailHandler.h"
|
||||
@ -1549,7 +1548,7 @@ void ZeldaAudioRenderer::Resample(VPB* vpb, const s16* src, MixingBuffer* dst)
|
||||
|
||||
void* ZeldaAudioRenderer::GetARAMPtr(u32 offset) const
|
||||
{
|
||||
if (SConfig::GetInstance().bWii)
|
||||
if (m_system.IsWii())
|
||||
return HLEMemory_Get_Pointer(m_system.GetMemory(), m_aram_base_addr + offset);
|
||||
else
|
||||
return reinterpret_cast<u8*>(m_system.GetDSP().GetARAMPtr()) + offset;
|
||||
|
@ -9,7 +9,6 @@
|
||||
#include "Common/Hash.h"
|
||||
#include "Common/Logging/Log.h"
|
||||
#include "Core/Config/MainSettings.h"
|
||||
#include "Core/ConfigManager.h"
|
||||
#include "Core/DSP/DSPAnalyzer.h"
|
||||
#include "Core/DSP/DSPCodeUtil.h"
|
||||
#include "Core/DSP/DSPCore.h"
|
||||
@ -64,7 +63,7 @@ bool OnThread()
|
||||
|
||||
bool IsWiiHost()
|
||||
{
|
||||
return SConfig::GetInstance().bWii;
|
||||
return Core::System::GetInstance().IsWii();
|
||||
}
|
||||
|
||||
void InterruptRequest()
|
||||
|
@ -377,7 +377,7 @@ void DVDInterface::SetDisc(std::unique_ptr<DiscIO::VolumeDisc> disc,
|
||||
// Wii disc, which triggers Error #001. In those cases we manually make the check succeed to
|
||||
// avoid problems.
|
||||
const bool should_fake_error_001 =
|
||||
SConfig::GetInstance().bWii && blob.GetBlobType() == DiscIO::BlobType::DIRECTORY;
|
||||
m_system.IsWii() && blob.GetBlobType() == DiscIO::BlobType::DIRECTORY;
|
||||
Config::SetCurrent(Config::SESSION_SHOULD_FAKE_ERROR_001, should_fake_error_001);
|
||||
|
||||
if (!blob.HasFastRandomAccessInBlock() && blob.GetBlockSize() > 0x200000)
|
||||
|
@ -106,7 +106,7 @@ CEXIIPL::CEXIIPL(Core::System& system) : IEXIDevice(system)
|
||||
|
||||
// Load whole ROM dump
|
||||
// Note: The Wii doesn't have a copy of the IPL, only fonts.
|
||||
if (!SConfig::GetInstance().bWii && Config::Get(Config::SESSION_LOAD_IPL_DUMP) &&
|
||||
if (!system.IsWii() && Config::Get(Config::SESSION_LOAD_IPL_DUMP) &&
|
||||
LoadFileToIPL(SConfig::GetInstance().m_strBootROM, 0))
|
||||
{
|
||||
// Descramble the encrypted section (contains BS1 and BS2)
|
||||
|
@ -7,7 +7,6 @@
|
||||
#include "Common/CommonTypes.h"
|
||||
|
||||
#include "Core/Config/MainSettings.h"
|
||||
#include "Core/ConfigManager.h"
|
||||
#include "Core/Core.h"
|
||||
#include "Core/CoreTiming.h"
|
||||
#include "Core/HW/AddressSpace.h"
|
||||
@ -54,7 +53,7 @@ void Init(Core::System& system, const Sram* override_sram)
|
||||
system.GetCPU().Init(Config::Get(Config::MAIN_CPU_CORE));
|
||||
system.GetSystemTimers().Init();
|
||||
|
||||
if (SConfig::GetInstance().bWii)
|
||||
if (system.IsWii())
|
||||
{
|
||||
system.GetWiiIPC().Init();
|
||||
IOS::HLE::Init(system); // Depends on Memory
|
||||
@ -63,7 +62,7 @@ void Init(Core::System& system, const Sram* override_sram)
|
||||
|
||||
void Shutdown(Core::System& system)
|
||||
{
|
||||
// IOS should always be shut down regardless of bWii because it can be running in GC mode (MIOS).
|
||||
// IOS should always be shut down regardless of IsWii because it can be running in GC mode (MIOS).
|
||||
IOS::HLE::Shutdown(); // Depends on Memory
|
||||
system.GetWiiIPC().Shutdown();
|
||||
|
||||
@ -108,7 +107,7 @@ void DoState(Core::System& system, PointerWrap& p)
|
||||
system.GetHSP().DoState(p);
|
||||
p.DoMarker("HSP");
|
||||
|
||||
if (SConfig::GetInstance().bWii)
|
||||
if (system.IsWii())
|
||||
{
|
||||
system.GetWiiIPC().DoState(p);
|
||||
p.DoMarker("IOS");
|
||||
|
@ -12,7 +12,6 @@
|
||||
#include "Common/Assert.h"
|
||||
#include "Common/BitUtils.h"
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Core/ConfigManager.h"
|
||||
#include "Core/HW/GPFifo.h"
|
||||
#include "Core/HW/MMIOHandlers.h"
|
||||
|
||||
@ -47,14 +46,14 @@ const u32 NUM_MMIOS = NUM_BLOCKS * BLOCK_SIZE;
|
||||
// We have a special exception here for FIFO writes: these are handled via a
|
||||
// different mechanism and should not go through the normal MMIO access
|
||||
// interface.
|
||||
inline bool IsMMIOAddress(u32 address)
|
||||
inline bool IsMMIOAddress(u32 address, bool is_wii)
|
||||
{
|
||||
if (address == GPFifo::GATHER_PIPE_PHYSICAL_ADDRESS)
|
||||
return false; // WG Pipe
|
||||
if ((address & 0xFFFF0000) == 0x0C000000)
|
||||
return true; // GameCube MMIOs
|
||||
|
||||
if (SConfig::GetInstance().bWii)
|
||||
if (is_wii)
|
||||
{
|
||||
return ((address & 0xFFFF0000) == 0x0D000000) || // Wii MMIOs
|
||||
((address & 0xFFFF0000) == 0x0D800000); // Mirror of Wii MMIOs
|
||||
|
@ -21,7 +21,6 @@
|
||||
#include "Common/MsgHandler.h"
|
||||
#include "Common/Swap.h"
|
||||
#include "Core/Config/MainSettings.h"
|
||||
#include "Core/ConfigManager.h"
|
||||
#include "Core/Core.h"
|
||||
#include "Core/HW/AudioInterface.h"
|
||||
#include "Core/HW/DSP.h"
|
||||
@ -103,7 +102,7 @@ void MemoryManager::Init()
|
||||
m_physical_regions[3] = PhysicalMemoryRegion{
|
||||
&m_exram, 0x10000000, GetExRamSize(), PhysicalMemoryRegion::WII_ONLY, 0, false};
|
||||
|
||||
const bool wii = SConfig::GetInstance().bWii;
|
||||
const bool wii = m_system.IsWii();
|
||||
const bool mmu = m_system.IsMMUMode();
|
||||
|
||||
// If MMU is turned off in GameCube mode, turn on fake VMEM hack.
|
||||
|
@ -124,7 +124,7 @@ void ProcessorInterfaceManager::RegisterMMIO(MMIO::Mapping* mmio, u32 base)
|
||||
processor_interface.m_reset_code = val;
|
||||
INFO_LOG_FMT(PROCESSORINTERFACE, "Wrote PI_RESET_CODE: {:08x}",
|
||||
processor_interface.m_reset_code);
|
||||
if (!SConfig::GetInstance().bWii && ~processor_interface.m_reset_code & 0x4)
|
||||
if (!system.IsWii() && (~processor_interface.m_reset_code & 0x4))
|
||||
{
|
||||
system.GetDVDInterface().ResetDrive(true);
|
||||
}
|
||||
|
@ -54,7 +54,6 @@ IPC_HLE_PERIOD: For the Wii Remote this is the call schedule:
|
||||
#include "Common/Thread.h"
|
||||
#include "Common/Timer.h"
|
||||
#include "Core/Config/MainSettings.h"
|
||||
#include "Core/ConfigManager.h"
|
||||
#include "Core/Core.h"
|
||||
#include "Core/CoreTiming.h"
|
||||
#include "Core/DSPEmulator.h"
|
||||
@ -102,7 +101,7 @@ void SystemTimersManager::AudioDMACallback(Core::System& system, u64 userdata, s
|
||||
void SystemTimersManager::IPC_HLE_UpdateCallback(Core::System& system, u64 userdata,
|
||||
s64 cycles_late)
|
||||
{
|
||||
if (SConfig::GetInstance().bWii)
|
||||
if (system.IsWii())
|
||||
{
|
||||
IOS::HLE::GetIOS()->UpdateDevices();
|
||||
auto& system_timers = system.GetSystemTimers();
|
||||
@ -241,7 +240,7 @@ double SystemTimersManager::GetEstimatedEmulationPerformance() const
|
||||
// SystemTimers::Init
|
||||
void SystemTimersManager::PreInit()
|
||||
{
|
||||
ChangePPCClock(SConfig::GetInstance().bWii ? Mode::Wii : Mode::GC);
|
||||
ChangePPCClock(m_system.IsWii() ? Mode::Wii : Mode::GC);
|
||||
}
|
||||
|
||||
void SystemTimersManager::ChangePPCClock(Mode mode)
|
||||
@ -256,7 +255,7 @@ void SystemTimersManager::ChangePPCClock(Mode mode)
|
||||
|
||||
void SystemTimersManager::Init()
|
||||
{
|
||||
if (SConfig::GetInstance().bWii)
|
||||
if (m_system.IsWii())
|
||||
{
|
||||
// AyuanX: TO BE TWEAKED
|
||||
// Now the 1500 is a pure assumption
|
||||
@ -306,7 +305,7 @@ void SystemTimersManager::Init()
|
||||
|
||||
core_timing.ScheduleEvent(vi.GetTicksPerField(), m_event_type_patch_engine);
|
||||
|
||||
if (SConfig::GetInstance().bWii)
|
||||
if (m_system.IsWii())
|
||||
core_timing.ScheduleEvent(m_ipc_hle_period, m_event_type_ipc_hle);
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,6 @@
|
||||
|
||||
#include "Core/Config/MainSettings.h"
|
||||
#include "Core/Config/WiimoteSettings.h"
|
||||
#include "Core/ConfigManager.h"
|
||||
#include "Core/Core.h"
|
||||
#include "Core/HW/Wiimote.h"
|
||||
#include "Core/HW/WiimoteCommon/DataReport.h"
|
||||
@ -28,6 +27,7 @@
|
||||
#include "Core/HW/WiimoteReal/IOLinux.h"
|
||||
#include "Core/HW/WiimoteReal/IOWin.h"
|
||||
#include "Core/HW/WiimoteReal/IOhidapi.h"
|
||||
#include "Core/System.h"
|
||||
|
||||
#include "InputCommon/ControllerInterface/Wiimote/WiimoteController.h"
|
||||
#include "InputCommon/InputConfig.h"
|
||||
@ -723,7 +723,7 @@ void WiimoteScanner::ThreadFunc()
|
||||
// We don't want any remotes in passthrough mode or running in GC mode.
|
||||
const bool core_running = Core::GetState() != Core::State::Uninitialized;
|
||||
if (Config::Get(Config::MAIN_BLUETOOTH_PASSTHROUGH_ENABLED) ||
|
||||
(core_running && !SConfig::GetInstance().bWii))
|
||||
(core_running && !Core::System::GetInstance().IsWii()))
|
||||
continue;
|
||||
|
||||
// We don't want any remotes if we already connected everything we need.
|
||||
|
@ -32,7 +32,7 @@ namespace IOS::HLE::MIOS
|
||||
{
|
||||
static void ReinitHardware(Core::System& system)
|
||||
{
|
||||
SConfig::GetInstance().bWii = false;
|
||||
system.SetIsWii(false);
|
||||
|
||||
// IOS clears mem2 and overwrites it with pseudo-random data (for security).
|
||||
auto& memory = system.GetMemory();
|
||||
@ -47,8 +47,7 @@ static void ReinitHardware(Core::System& system)
|
||||
// Note: this is specific to Dolphin and is required because we initialised it in Wii mode.
|
||||
auto& dsp = system.GetDSP();
|
||||
dsp.Reinit(Config::Get(Config::MAIN_DSP_HLE));
|
||||
dsp.GetDSPEmulator()->Initialize(SConfig::GetInstance().bWii,
|
||||
Config::Get(Config::MAIN_DSP_THREAD));
|
||||
dsp.GetDSPEmulator()->Initialize(system.IsWii(), Config::Get(Config::MAIN_DSP_THREAD));
|
||||
|
||||
system.GetSystemTimers().ChangePPCClock(SystemTimers::Mode::GC);
|
||||
}
|
||||
|
@ -1035,7 +1035,7 @@ void MovieManager::LoadInput(const std::string& movie_path)
|
||||
}
|
||||
|
||||
ChangePads();
|
||||
if (SConfig::GetInstance().bWii)
|
||||
if (m_system.IsWii())
|
||||
ChangeWiiPads(true);
|
||||
|
||||
u64 totalSavedBytes = t_record.GetSize() - 256;
|
||||
@ -1377,7 +1377,7 @@ void MovieManager::SaveRecording(const std::string& filename)
|
||||
header.filetype[2] = 'M';
|
||||
header.filetype[3] = 0x1A;
|
||||
strncpy(header.gameID.data(), SConfig::GetInstance().GetGameID().c_str(), 6);
|
||||
header.bWii = SConfig::GetInstance().bWii;
|
||||
header.bWii = m_system.IsWii();
|
||||
header.controllers = 0;
|
||||
header.GBAControllers = 0;
|
||||
for (int i = 0; i < 4; ++i)
|
||||
@ -1386,7 +1386,7 @@ void MovieManager::SaveRecording(const std::string& filename)
|
||||
header.GBAControllers |= 1 << i;
|
||||
if (IsUsingPad(i))
|
||||
header.controllers |= 1 << i;
|
||||
if (IsUsingWiimote(i) && SConfig::GetInstance().bWii)
|
||||
if (IsUsingWiimote(i) && m_system.IsWii())
|
||||
header.controllers |= 1 << (i + 4);
|
||||
}
|
||||
|
||||
@ -1454,7 +1454,7 @@ void MovieManager::GetSettings()
|
||||
|
||||
m_save_config = true;
|
||||
m_net_play = NetPlay::IsNetPlayRunning();
|
||||
if (SConfig::GetInstance().bWii)
|
||||
if (m_system.IsWii())
|
||||
{
|
||||
u64 title_id = SConfig::GetInstance().GetTitleID();
|
||||
m_clear_save = !File::Exists(
|
||||
|
@ -36,7 +36,6 @@
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Common/Logging/Log.h"
|
||||
|
||||
#include "Core/ConfigManager.h"
|
||||
#include "Core/Core.h"
|
||||
#include "Core/HW/CPU.h"
|
||||
#include "Core/HW/GPFifo.h"
|
||||
@ -1241,7 +1240,7 @@ u32 MMU::IsOptimizableMMIOAccess(u32 address, u32 access_size) const
|
||||
|
||||
// Check whether the address is an aligned address of an MMIO register.
|
||||
const bool aligned = (address & ((access_size >> 3) - 1)) == 0;
|
||||
if (!aligned || !MMIO::IsMMIOAddress(address))
|
||||
if (!aligned || !MMIO::IsMMIOAddress(address, m_system.IsWii()))
|
||||
return 0;
|
||||
|
||||
return address;
|
||||
@ -1641,7 +1640,7 @@ void MMU::DBATUpdated()
|
||||
{
|
||||
m_dbat_table = {};
|
||||
UpdateBATs(m_dbat_table, SPR_DBAT0U);
|
||||
bool extended_bats = SConfig::GetInstance().bWii && HID4(m_ppc_state).SBE;
|
||||
bool extended_bats = m_system.IsWii() && HID4(m_ppc_state).SBE;
|
||||
if (extended_bats)
|
||||
UpdateBATs(m_dbat_table, SPR_DBAT4U);
|
||||
if (m_memory.GetFakeVMEM())
|
||||
@ -1663,7 +1662,7 @@ void MMU::IBATUpdated()
|
||||
{
|
||||
m_ibat_table = {};
|
||||
UpdateBATs(m_ibat_table, SPR_IBAT0U);
|
||||
bool extended_bats = SConfig::GetInstance().bWii && HID4(m_ppc_state).SBE;
|
||||
bool extended_bats = m_system.IsWii() && HID4(m_ppc_state).SBE;
|
||||
if (extended_bats)
|
||||
UpdateBATs(m_ibat_table, SPR_IBAT4U);
|
||||
if (m_memory.GetFakeVMEM())
|
||||
|
@ -20,7 +20,6 @@
|
||||
|
||||
#include "Core/CPUThreadConfigCallback.h"
|
||||
#include "Core/Config/MainSettings.h"
|
||||
#include "Core/ConfigManager.h"
|
||||
#include "Core/Core.h"
|
||||
#include "Core/CoreTiming.h"
|
||||
#include "Core/HW/CPU.h"
|
||||
@ -168,7 +167,7 @@ void PowerPCManager::ResetRegisters()
|
||||
// 0x00083214 = gekko 2.4e (8SE) - retail HW2
|
||||
// Wii:
|
||||
// 0x00087102 = broadway retail hw
|
||||
if (SConfig::GetInstance().bWii)
|
||||
if (m_system.IsWii())
|
||||
{
|
||||
m_ppc_state.spr[SPR_PVR] = 0x00087102;
|
||||
}
|
||||
|
@ -141,7 +141,7 @@ static void DoState(PointerWrap& p)
|
||||
{
|
||||
auto& system = Core::System::GetInstance();
|
||||
|
||||
bool is_wii = SConfig::GetInstance().bWii || system.IsMIOS();
|
||||
bool is_wii = system.IsWii() || system.IsMIOS();
|
||||
const bool is_wii_currently = is_wii;
|
||||
p.Do(is_wii);
|
||||
if (is_wii != is_wii_currently)
|
||||
@ -194,7 +194,7 @@ static void DoState(PointerWrap& p)
|
||||
system.GetPowerPC().DoState(p);
|
||||
p.DoMarker("PowerPC");
|
||||
|
||||
if (SConfig::GetInstance().bWii)
|
||||
if (system.IsWii())
|
||||
Wiimote::DoState(p);
|
||||
p.DoMarker("Wiimote");
|
||||
Gecko::DoState(p);
|
||||
|
@ -136,8 +136,10 @@ public:
|
||||
bool IsMMUMode() const { return m_mmu_enabled; }
|
||||
bool IsPauseOnPanicMode() const { return m_pause_on_panic_enabled; }
|
||||
bool IsMIOS() const { return m_is_mios; }
|
||||
bool IsWii() const { return m_is_wii; }
|
||||
|
||||
void SetIsMIOS(bool is_mios) { m_is_mios = is_mios; }
|
||||
void SetIsWii(bool is_wii) { m_is_wii = is_wii; }
|
||||
|
||||
SoundStream* GetSoundStream() const;
|
||||
void SetSoundStream(std::unique_ptr<SoundStream> sound_stream);
|
||||
@ -192,5 +194,6 @@ private:
|
||||
bool m_mmu_enabled = false;
|
||||
bool m_pause_on_panic_enabled = false;
|
||||
bool m_is_mios = false;
|
||||
bool m_is_wii = false;
|
||||
};
|
||||
} // namespace Core
|
||||
|
@ -19,7 +19,6 @@
|
||||
#include "Common/StringUtil.h"
|
||||
#include "Core/CheatSearch.h"
|
||||
#include "Core/Config/MainSettings.h"
|
||||
#include "Core/ConfigManager.h"
|
||||
#include "Core/Core.h"
|
||||
#include "Core/HW/Memmap.h"
|
||||
#include "Core/PowerPC/MMU.h"
|
||||
@ -170,7 +169,7 @@ void CheatSearchFactoryWidget::OnNewSearchClicked()
|
||||
auto& system = Core::System::GetInstance();
|
||||
auto& memory = system.GetMemory();
|
||||
memory_ranges.emplace_back(0x80000000, memory.GetRamSizeReal());
|
||||
if (SConfig::GetInstance().bWii)
|
||||
if (system.IsWii())
|
||||
memory_ranges.emplace_back(0x90000000, memory.GetExRamSizeReal());
|
||||
address_space = PowerPC::RequestedAddressSpace::Virtual;
|
||||
}
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include "Core/IOS/IOS.h"
|
||||
#include "Core/IOS/USB/Bluetooth/BTReal.h"
|
||||
#include "Core/NetPlayProto.h"
|
||||
#include "Core/System.h"
|
||||
#include "Core/WiiUtils.h"
|
||||
|
||||
#include "DolphinQt/Config/Mapping/MappingWindow.h"
|
||||
@ -295,7 +296,7 @@ void WiimoteControllersWidget::LoadSettings(Core::State state)
|
||||
m_wiimote_emu->setEnabled(!running);
|
||||
m_wiimote_passthrough->setEnabled(!running);
|
||||
|
||||
const bool running_gc = running && !SConfig::GetInstance().bWii;
|
||||
const bool running_gc = running && !Core::System::GetInstance().IsWii();
|
||||
const bool enable_passthrough = m_wiimote_passthrough->isChecked() && !running_gc;
|
||||
const bool enable_emu_bt = !m_wiimote_passthrough->isChecked() && !running_gc;
|
||||
const bool is_netplay = NetPlay::IsNetPlayRunning();
|
||||
|
@ -46,7 +46,6 @@
|
||||
#include "Common/FileUtil.h"
|
||||
|
||||
#include "Core/Config/MainSettings.h"
|
||||
#include "Core/ConfigManager.h"
|
||||
#include "Core/Core.h"
|
||||
#include "Core/HW/DVD/DVDInterface.h"
|
||||
#include "Core/HW/EXI/EXI.h"
|
||||
@ -437,7 +436,7 @@ void GameList::ShowContextMenu(const QPoint&)
|
||||
// system menu, trigger a refresh.
|
||||
Settings::Instance().NANDRefresh();
|
||||
});
|
||||
perform_disc_update->setEnabled(!Core::IsRunning() || !SConfig::GetInstance().bWii);
|
||||
perform_disc_update->setEnabled(!Core::IsRunning() || !Core::System::GetInstance().IsWii());
|
||||
}
|
||||
|
||||
if (!is_mod_descriptor && platform == DiscIO::Platform::WiiWAD)
|
||||
|
@ -23,7 +23,6 @@
|
||||
#include "Core/Config/GraphicsSettings.h"
|
||||
#include "Core/Config/MainSettings.h"
|
||||
#include "Core/Config/UISettings.h"
|
||||
#include "Core/ConfigManager.h"
|
||||
#include "Core/Core.h"
|
||||
#include "Core/FreeLookManager.h"
|
||||
#include "Core/Host.h"
|
||||
@ -266,7 +265,7 @@ void HotkeyScheduler::Run()
|
||||
|
||||
// TODO: HK_MBP_ADD
|
||||
|
||||
if (SConfig::GetInstance().bWii)
|
||||
if (Core::System::GetInstance().IsWii())
|
||||
{
|
||||
int wiimote_id = -1;
|
||||
if (IsHotkey(HK_WIIMOTE1_CONNECT))
|
||||
|
@ -46,7 +46,6 @@
|
||||
#include "Core/Config/MainSettings.h"
|
||||
#include "Core/Config/NetplaySettings.h"
|
||||
#include "Core/Config/WiimoteSettings.h"
|
||||
#include "Core/ConfigManager.h"
|
||||
#include "Core/Core.h"
|
||||
#include "Core/FreeLookManager.h"
|
||||
#include "Core/HW/DVD/DVDInterface.h"
|
||||
@ -1970,7 +1969,7 @@ void MainWindow::ShowTASInput()
|
||||
for (int i = 0; i < num_wii_controllers; i++)
|
||||
{
|
||||
if (Config::Get(Config::GetInfoForWiimoteSource(i)) == WiimoteSource::Emulated &&
|
||||
(!Core::IsRunning() || SConfig::GetInstance().bWii))
|
||||
(!Core::IsRunning() || Core::System::GetInstance().IsWii()))
|
||||
{
|
||||
SetQWidgetWindowDecorations(m_wii_tas_input_windows[i]);
|
||||
m_wii_tas_input_windows[i]->show();
|
||||
|
@ -21,6 +21,8 @@
|
||||
#include "Common/HttpRequest.h"
|
||||
#include "Common/StringUtil.h"
|
||||
|
||||
#include "Core/System.h"
|
||||
|
||||
#endif
|
||||
|
||||
namespace Discord
|
||||
@ -95,7 +97,7 @@ void HandleDiscordJoin(const char* join_secret)
|
||||
std::string ArtworkForGameId()
|
||||
{
|
||||
const DiscIO::Region region = SConfig::GetInstance().m_region;
|
||||
const bool is_wii = SConfig::GetInstance().bWii;
|
||||
const bool is_wii = Core::System::GetInstance().IsWii();
|
||||
const std::string region_code = SConfig::GetInstance().GetGameTDBImageRegionCode(is_wii, region);
|
||||
|
||||
static constexpr char cover_url[] = "https://discord.dolphin-emu.org/cover-art/{}/{}.png";
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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:
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -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();
|
||||
|
@ -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
|
||||
|
@ -4,16 +4,12 @@
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <unordered_set>
|
||||
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Common/Config/Config.h"
|
||||
#include "Common/FileUtil.h"
|
||||
#include "Core/HW/GPFifo.h"
|
||||
#include "Core/HW/MMIO.h"
|
||||
#include "Core/System.h"
|
||||
#include "UICommon/UICommon.h"
|
||||
|
||||
// Tests that the UniqueID function returns a "unique enough" identifier
|
||||
// number: that is, it is unique in the address ranges we care about.
|
||||
@ -36,34 +32,25 @@ TEST(UniqueID, UniqueEnough)
|
||||
|
||||
TEST(IsMMIOAddress, SpecialAddresses)
|
||||
{
|
||||
const std::string profile_path = File::CreateTempDir();
|
||||
ASSERT_FALSE(profile_path.empty());
|
||||
UICommon::SetUserDirectory(profile_path);
|
||||
Config::Init();
|
||||
SConfig::Init();
|
||||
SConfig::GetInstance().bWii = true;
|
||||
constexpr bool is_wii = true;
|
||||
|
||||
// WG Pipe address, should not be handled by MMIO.
|
||||
EXPECT_FALSE(MMIO::IsMMIOAddress(GPFifo::GATHER_PIPE_PHYSICAL_ADDRESS));
|
||||
EXPECT_FALSE(MMIO::IsMMIOAddress(GPFifo::GATHER_PIPE_PHYSICAL_ADDRESS, is_wii));
|
||||
|
||||
// Locked L1 cache allocation.
|
||||
EXPECT_FALSE(MMIO::IsMMIOAddress(0xE0000000));
|
||||
EXPECT_FALSE(MMIO::IsMMIOAddress(0xE0000000, is_wii));
|
||||
|
||||
// Uncached mirror of MEM1, shouldn't be handled by MMIO
|
||||
EXPECT_FALSE(MMIO::IsMMIOAddress(0xC0000000));
|
||||
EXPECT_FALSE(MMIO::IsMMIOAddress(0xC0000000, is_wii));
|
||||
|
||||
// Effective address of an MMIO register; MMIO only deals with physical
|
||||
// addresses.
|
||||
EXPECT_FALSE(MMIO::IsMMIOAddress(0xCC0000E0));
|
||||
EXPECT_FALSE(MMIO::IsMMIOAddress(0xCC0000E0, is_wii));
|
||||
|
||||
// And let's check some valid addresses too
|
||||
EXPECT_TRUE(MMIO::IsMMIOAddress(0x0C0000E0)); // GameCube MMIOs
|
||||
EXPECT_TRUE(MMIO::IsMMIOAddress(0x0D00008C)); // Wii MMIOs
|
||||
EXPECT_TRUE(MMIO::IsMMIOAddress(0x0D800F10)); // Mirror of Wii MMIOs
|
||||
|
||||
SConfig::Shutdown();
|
||||
Config::Shutdown();
|
||||
File::DeleteDirRecursively(profile_path);
|
||||
EXPECT_TRUE(MMIO::IsMMIOAddress(0x0C0000E0, is_wii)); // GameCube MMIOs
|
||||
EXPECT_TRUE(MMIO::IsMMIOAddress(0x0D00008C, is_wii)); // Wii MMIOs
|
||||
EXPECT_TRUE(MMIO::IsMMIOAddress(0x0D800F10, is_wii)); // Mirror of Wii MMIOs
|
||||
}
|
||||
|
||||
class MappingTest : public testing::Test
|
||||
|
Loading…
Reference in New Issue
Block a user