diff --git a/Source/Core/Core/Src/ConfigManager.h b/Source/Core/Core/Src/ConfigManager.h index ceca9fad00..6324180933 100644 --- a/Source/Core/Core/Src/ConfigManager.h +++ b/Source/Core/Core/Src/ConfigManager.h @@ -102,12 +102,7 @@ struct SConfig //Special load settings void LoadSettingsHLE(); - /* Return the permanent and somewhat globally used instance of this struct - there is also a Core::GetStartupParameter() instance of it with almost - the same values - - Is this still true or do we only have one now? - */ + // Return the permanent and somewhat globally used instance of this struct static SConfig& GetInstance() {return(m_Instance);} private: diff --git a/Source/Core/Core/Src/Core.cpp b/Source/Core/Core/Src/Core.cpp index 00446ca8c9..1c9ebcd3b2 100644 --- a/Source/Core/Core/Src/Core.cpp +++ b/Source/Core/Core/Src/Core.cpp @@ -529,7 +529,7 @@ static inline std::string GenerateScreenshotName() { int index = 1; std::string tempname, name; - std::string gameId = GetStartupParameter().GetUniqueID(); + std::string gameId = SConfig::GetInstance().m_LocalCoreStartupParameter.GetUniqueID(); tempname = std::string(File::GetUserPath(D_SCREENSHOTS_IDX)) + gameId + DIR_SEP_CHR; if (!File::CreateFullPath(tempname.c_str())) { @@ -748,10 +748,4 @@ void Callback_WiimoteLog(const TCHAR* _szMessage, int _v) GENERIC_LOG(LogTypes::WIIMOTE, (LogTypes::LOG_LEVELS)_v, _szMessage); } -// TODO: Get rid of at some point -const SCoreStartupParameter& GetStartupParameter() -{ - return SConfig::GetInstance().m_LocalCoreStartupParameter; -} - } // Core diff --git a/Source/Core/Core/Src/Core.h b/Source/Core/Core/Src/Core.h index 370486728e..a63aa8c60b 100644 --- a/Source/Core/Core/Src/Core.h +++ b/Source/Core/Core/Src/Core.h @@ -56,7 +56,6 @@ namespace Core void ScreenShot(); // Get core parameters kill use SConfig instead - const SCoreStartupParameter& GetStartupParameter(); extern SCoreStartupParameter g_CoreStartupParameter; void* GetWindowHandle(); diff --git a/Source/Core/Core/Src/HW/EXI_DeviceIPL.cpp b/Source/Core/Core/Src/HW/EXI_DeviceIPL.cpp index da3b0ccf67..6b6420b875 100644 --- a/Source/Core/Core/Src/HW/EXI_DeviceIPL.cpp +++ b/Source/Core/Core/Src/HW/EXI_DeviceIPL.cpp @@ -390,7 +390,7 @@ u32 CEXIIPL::GetGCTime() return ((u32)ltime - cJanuary2000 - Bias); #else u64 ltime = Common::Timer::GetLocalTimeSinceJan1970(); - if (Core::GetStartupParameter().bWii) + if (SConfig::GetInstance().m_LocalCoreStartupParameter.bWii) return ((u32)ltime - cJanuary2000 - cWiiBias); else return ((u32)ltime - cJanuary2000); diff --git a/Source/Core/Core/Src/HW/Memmap.cpp b/Source/Core/Core/Src/HW/Memmap.cpp index c0bdd9952e..eaa2899ed8 100644 --- a/Source/Core/Core/Src/HW/Memmap.cpp +++ b/Source/Core/Core/Src/HW/Memmap.cpp @@ -346,8 +346,8 @@ static const int num_views = sizeof(views) / sizeof(MemoryView); bool Init() { - bool wii = Core::GetStartupParameter().bWii; - bFakeVMEM = Core::GetStartupParameter().iTLBHack == 1; + bool wii = SConfig::GetInstance().m_LocalCoreStartupParameter.bWii; + bFakeVMEM = SConfig::GetInstance().m_LocalCoreStartupParameter.iTLBHack == 1; u32 flags = 0; if (wii) flags |= MV_WII_ONLY; @@ -367,7 +367,7 @@ bool Init() void DoState(PointerWrap &p) { - bool wii = Core::GetStartupParameter().bWii; + bool wii = SConfig::GetInstance().m_LocalCoreStartupParameter.bWii; p.DoArray(m_pPhysicalRAM, RAM_SIZE); // p.DoArray(m_pVirtualEFB, EFB_SIZE); p.DoArray(m_pVirtualL1Cache, L1_CACHE_SIZE); @@ -379,7 +379,7 @@ bool Shutdown() { m_IsInitialized = false; u32 flags = 0; - if (Core::GetStartupParameter().bWii) flags |= MV_WII_ONLY; + if (SConfig::GetInstance().m_LocalCoreStartupParameter.bWii) flags |= MV_WII_ONLY; if (bFakeVMEM) flags |= MV_FAKE_VMEM; MemoryMap_Shutdown(views, num_views, flags, &g_arena); g_arena.ReleaseSpace(); @@ -394,7 +394,7 @@ void Clear() memset(m_pRAM, 0, RAM_SIZE); if (m_pL1Cache) memset(m_pL1Cache, 0, L1_CACHE_SIZE); - if (Core::GetStartupParameter().bWii && m_pEXRAM) + if (SConfig::GetInstance().m_LocalCoreStartupParameter.bWii && m_pEXRAM) memset(m_pEXRAM, 0, EXRAM_SIZE); } @@ -570,7 +570,7 @@ bool ValidMemory(const u32 _Address) case 0xD1: case 0xD2: case 0xD3: - if (Core::GetStartupParameter().bWii) + if (SConfig::GetInstance().m_LocalCoreStartupParameter.bWii) return true; else return false; @@ -763,7 +763,7 @@ u8 *GetPointer(const u32 _Address) case 0xD1: case 0xD2: case 0xD3: - if (Core::GetStartupParameter().bWii) + if (SConfig::GetInstance().m_LocalCoreStartupParameter.bWii) return (u8*)(((char*)m_pPhysicalEXRAM) + (_Address & EXRAM_MASK)); else return 0; diff --git a/Source/Core/Core/Src/HW/SystemTimers.cpp b/Source/Core/Core/Src/HW/SystemTimers.cpp index d284e2ef0c..0a98c8e7f6 100644 --- a/Source/Core/Core/Src/HW/SystemTimers.cpp +++ b/Source/Core/Core/Src/HW/SystemTimers.cpp @@ -68,7 +68,7 @@ IPC_HLE_PERIOD: For the Wiimote this is the call schedule: #include "../HW/EXI_DeviceIPL.h" #include "../PowerPC/PowerPC.h" #include "../CoreTiming.h" -#include "../Core.h" +#include "../ConfigManager.h" #include "../IPC_HLE/WII_IPC_HLE.h" #include "Thread.h" #include "Timer.h" @@ -170,7 +170,7 @@ void AudioDMACallback(u64 userdata, int cyclesLate) void IPC_HLE_UpdateCallback(u64 userdata, int cyclesLate) { - if (Core::GetStartupParameter().bWii) + if (SConfig::GetInstance().m_LocalCoreStartupParameter.bWii) WII_IPC_HLE_Interface::Update(); CoreTiming::ScheduleEvent(IPC_HLE_PERIOD - cyclesLate, et_IPC_HLE); } @@ -239,7 +239,7 @@ void Init() std::string DSPName(DSPType.Name); bool UsingDSPLLE = (DSPName.find("LLE") != std::string::npos) || (DSPName.find("lle") != std::string::npos); - if (Core::GetStartupParameter().bWii) + if (SConfig::GetInstance().m_LocalCoreStartupParameter.bWii) { CPU_CORE_CLOCK = 729000000u; @@ -293,12 +293,12 @@ void Init() CoreTiming::ScheduleEvent(AUDIO_DMA_PERIOD, et_AudioDMA); // For DC watchdog hack - if (Core::GetStartupParameter().bCPUThread) + if (SConfig::GetInstance().m_LocalCoreStartupParameter.bCPUThread) CoreTiming::ScheduleEvent(VideoInterface::GetTicksPerFrame(), et_FakeGPWD); CoreTiming::ScheduleEvent(VideoInterface::GetTicksPerFrame(), et_PatchEngine); - if (Core::GetStartupParameter().bWii) + if (SConfig::GetInstance().m_LocalCoreStartupParameter.bWii) CoreTiming::ScheduleEvent(IPC_HLE_PERIOD, et_IPC_HLE); CoreTiming::RegisterAdvanceCallback(&AdvanceCallback); diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE.cpp b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE.cpp index 32c18c5dcd..bfeca59fc6 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE.cpp +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE.cpp @@ -59,7 +59,7 @@ #include "WII_IPC_HLE_Device_sdio_slot0.h" #include "FileUtil.h" // For Copy -#include "../Core.h" +#include "../ConfigManager.h" #include "../HW/CPU.h" #include "../HW/Memmap.h" #include "../HW/WII_IPC.h" @@ -188,7 +188,7 @@ IWII_IPC_HLE_Device* CreateFileIO(u32 _DeviceID, const std::string& _rDeviceName void CopySettingsFile(std::string& DeviceName) { std::string Source = File::GetSysDirectory() + WII_SYS_DIR + DIR_SEP; - if(Core::GetStartupParameter().bNTSC) + if(SConfig::GetInstance().m_LocalCoreStartupParameter.bNTSC) Source += "setting-usa.txt"; else Source += "setting-eur.txt"; diff --git a/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter.cpp b/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter.cpp index 74e5b2865f..bfae2475ba 100644 --- a/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter.cpp +++ b/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter.cpp @@ -22,7 +22,7 @@ #include "Interpreter.h" #include "../../Debugger/Debugger_SymbolMap.h" #include "../../CoreTiming.h" -#include "../../Core.h" +#include "../../ConfigManager.h" #include "PowerPCDisasm.h" #include "../../IPC_HLE/WII_IPC_HLE.h" @@ -142,7 +142,7 @@ void Run() while (!PowerPC::GetState()) { //we have to check exceptions at branches apparently (or maybe just rfi?) - if (Core::GetStartupParameter().bEnableDebugging) + if (SConfig::GetInstance().m_LocalCoreStartupParameter.bEnableDebugging) { #ifdef SHOW_HISTORY PCBlockVec.push_back(PC); diff --git a/Source/Core/Core/Src/PowerPC/Jit64/Jit.cpp b/Source/Core/Core/Src/PowerPC/Jit64/Jit.cpp index 298cba8287..613c59171d 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64/Jit.cpp +++ b/Source/Core/Core/Src/PowerPC/Jit64/Jit.cpp @@ -177,7 +177,7 @@ void Jit64::Init() debugging window. */ jo.enableBlocklink = true; #ifdef _M_X64 - jo.enableFastMem = Core::GetStartupParameter().bUseFastMem; + jo.enableFastMem = SConfig::GetInstance().m_LocalCoreStartupParameter.bUseFastMem; #else jo.enableFastMem = false; #endif diff --git a/Source/Core/Core/Src/PowerPC/Jit64/Jit_LoadStore.cpp b/Source/Core/Core/Src/PowerPC/Jit64/Jit_LoadStore.cpp index 5d5b905960..83d2888ed8 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64/Jit_LoadStore.cpp +++ b/Source/Core/Core/Src/PowerPC/Jit64/Jit_LoadStore.cpp @@ -23,6 +23,7 @@ #include "../PowerPC.h" #include "../../Core.h" +#include "../../ConfigManager.h" #include "../../HW/GPFifo.h" #include "../../HW/Memmap.h" #include "../PPCTables.h" @@ -125,11 +126,11 @@ void Jit64::lXz(UGeckoInstruction inst) // IMHO those Idles should always be skipped and replaced by a more controllable "native" Idle methode // ... maybe the throttle one already do that :p // if (CommandProcessor::AllowIdleSkipping() && PixelEngine::AllowIdleSkipping()) - if (Core::GetStartupParameter().bSkipIdle && + if (SConfig::GetInstance().m_LocalCoreStartupParameter.bSkipIdle && inst.OPCD == 32 && (inst.hex & 0xFFFF0000) == 0x800D0000 && (Memory::ReadUnchecked_U32(js.compilerPC + 4) == 0x28000000 || - (Core::GetStartupParameter().bWii && Memory::ReadUnchecked_U32(js.compilerPC + 4) == 0x2C000000)) && + (SConfig::GetInstance().m_LocalCoreStartupParameter.bWii && Memory::ReadUnchecked_U32(js.compilerPC + 4) == 0x2C000000)) && Memory::ReadUnchecked_U32(js.compilerPC + 8) == 0x4182fff8) { // TODO(LinesPrower): diff --git a/Source/Core/Core/Src/PowerPC/Jit64IL/IR_X86.cpp b/Source/Core/Core/Src/PowerPC/Jit64IL/IR_X86.cpp index 541b1fcb8c..4431ff361e 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64IL/IR_X86.cpp +++ b/Source/Core/Core/Src/PowerPC/Jit64IL/IR_X86.cpp @@ -45,7 +45,7 @@ The register allocation is just a simple forward greedy allocator. #include "JitILAsm.h" #include "JitIL.h" #include "../../HW/GPFifo.h" -#include "../../Core.h" +#include "../../ConfigManager.h" #include "x64Emitter.h" using namespace IREmitter; @@ -465,7 +465,7 @@ static void regEmitMemLoad(RegInfo& RI, InstLoc I, unsigned Size) { win32 = true; #endif FixupBranch argh; - if (!(win32 && Core::GetStartupParameter().iTLBHack == 1)) + if (!(win32 && SConfig::GetInstance().m_LocalCoreStartupParameter.iTLBHack == 1)) { RI.Jit->TEST(32, R(ECX), Imm32(0x0C000000)); argh = RI.Jit->J_CC(CC_Z); @@ -489,7 +489,7 @@ static void regEmitMemLoad(RegInfo& RI, InstLoc I, unsigned Size) { RI.Jit->POP(32, R(EAX)); #endif } - if (!(win32 && Core::GetStartupParameter().iTLBHack == 1)) + if (!(win32 && SConfig::GetInstance().m_LocalCoreStartupParameter.iTLBHack == 1)) { FixupBranch arg2 = RI.Jit->J(); // Fast unsafe read using memory pointer EBX @@ -1636,7 +1636,7 @@ static void DoWriteCode(IRBuilder* ibuild, JitIL* Jit, bool UseProfile, bool Mak } void JitIL::WriteCode() { - DoWriteCode(&ibuild, this, false, Core::GetStartupParameter().bJITProfiledReJIT); + DoWriteCode(&ibuild, this, false, SConfig::GetInstance().m_LocalCoreStartupParameter.bJITProfiledReJIT); } void ProfiledReJit() { @@ -1644,4 +1644,4 @@ void ProfiledReJit() { DoWriteCode(&((JitIL *)jit)->ibuild, (JitIL *)jit, true, false); jit->js.curBlock->codeSize = (int)(jit->GetCodePtr() - jit->js.rewriteStart); jit->GetBlockCache()->FinalizeBlock(jit->js.curBlock->blockNum, jit->jo.enableBlocklink, jit->js.curBlock->normalEntry); -} \ No newline at end of file +} diff --git a/Source/Core/Core/Src/PowerPC/Jit64IL/JitIL_Branch.cpp b/Source/Core/Core/Src/PowerPC/Jit64IL/JitIL_Branch.cpp index 7ae9309ef7..e022489f9c 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64IL/JitIL_Branch.cpp +++ b/Source/Core/Core/Src/PowerPC/Jit64IL/JitIL_Branch.cpp @@ -17,7 +17,7 @@ #include "Common.h" #include "Thunk.h" -#include "../../Core.h" +#include "../../ConfigManager.h" #include "../PowerPC.h" #include "../../CoreTiming.h" #include "../PPCTables.h" @@ -128,11 +128,11 @@ void JitIL::bcx(UGeckoInstruction inst) else destination = js.compilerPC + SignExt16(inst.BD << 2); - if (Core::GetStartupParameter().bSkipIdle && + if (SConfig::GetInstance().m_LocalCoreStartupParameter.bSkipIdle && inst.hex == 0x4182fff8 && (Memory::ReadUnchecked_U32(js.compilerPC - 8) & 0xFFFF0000) == 0x800D0000 && (Memory::ReadUnchecked_U32(js.compilerPC - 4) == 0x28000000 || - (Core::GetStartupParameter().bWii && Memory::ReadUnchecked_U32(js.compilerPC - 4) == 0x2C000000)) + (SConfig::GetInstance().m_LocalCoreStartupParameter.bWii && Memory::ReadUnchecked_U32(js.compilerPC - 4) == 0x2C000000)) ) { ibuild.EmitIdleBranch(Test, ibuild.EmitIntConst(destination)); diff --git a/Source/Core/Core/Src/State.cpp b/Source/Core/Core/Src/State.cpp index 1cc7b1a867..85920c9e24 100644 --- a/Source/Core/Core/Src/State.cpp +++ b/Source/Core/Core/Src/State.cpp @@ -19,6 +19,7 @@ #include "State.h" #include "Core.h" +#include "ConfigManager.h" #include "StringUtil.h" #include "Thread.h" #include "CoreTiming.h" @@ -172,7 +173,7 @@ THREAD_RETURN CompressAndDumpState(void *pArgs) } // Setting up the header - memcpy(header.gameID, Core::GetStartupParameter().GetUniqueID().c_str(), 6); + memcpy(header.gameID, SConfig::GetInstance().m_LocalCoreStartupParameter.GetUniqueID().c_str(), 6); header.sz = bCompressed ? sz : 0; fwrite(&header, sizeof(state_header), 1, f); @@ -275,7 +276,7 @@ void LoadStateCallback(u64 userdata, int cyclesLate) fread(&header, sizeof(state_header), 1, f); - if (memcmp(Core::GetStartupParameter().GetUniqueID().c_str(), header.gameID, 6)) + if (memcmp(SConfig::GetInstance().m_LocalCoreStartupParameter.GetUniqueID().c_str(), header.gameID, 6)) { char gameID[7] = {0}; memcpy(gameID, header.gameID, 6); @@ -378,7 +379,7 @@ void State_Shutdown() std::string MakeStateFilename(int state_number) { - return StringFromFormat("%s%s.s%02i", File::GetUserPath(D_STATESAVES_IDX), Core::GetStartupParameter().GetUniqueID().c_str(), state_number); + return StringFromFormat("%s%s.s%02i", File::GetUserPath(D_STATESAVES_IDX), SConfig::GetInstance().m_LocalCoreStartupParameter.GetUniqueID().c_str(), state_number); } void State_SaveAs(const std::string &filename) diff --git a/Source/Core/DolphinWX/Src/FrameTools.cpp b/Source/Core/DolphinWX/Src/FrameTools.cpp index 8a449e2327..fe29e18e0d 100644 --- a/Source/Core/DolphinWX/Src/FrameTools.cpp +++ b/Source/Core/DolphinWX/Src/FrameTools.cpp @@ -879,7 +879,7 @@ void CFrame::OnLoadWiiMenu(wxCommandEvent& WXUNUSED (event)) void CFrame::OnConnectWiimote(wxCommandEvent& event) { - if (Core::isRunning() && Core::GetStartupParameter().bWii) + if (Core::isRunning() && SConfig::GetInstance().m_LocalCoreStartupParameter.bWii) { int Id = event.GetId() - IDM_CONNECT_WIIMOTE1; bNoWiimoteMsg = !event.IsChecked(); @@ -1030,11 +1030,11 @@ void CFrame::UpdateGUI() if (DiscIO::CNANDContentManager::Access().GetNANDLoader(std::string(File::GetUserPath(D_WIIMENU_IDX))).IsValid()) GetMenuBar()->FindItem(IDM_LOAD_WII_MENU)->Enable(!Initialized); - GetMenuBar()->FindItem(IDM_CONNECT_WIIMOTE1)->Enable(Initialized && Core::GetStartupParameter().bWii); - GetMenuBar()->FindItem(IDM_CONNECT_WIIMOTE2)->Enable(Initialized && Core::GetStartupParameter().bWii); - GetMenuBar()->FindItem(IDM_CONNECT_WIIMOTE3)->Enable(Initialized && Core::GetStartupParameter().bWii); - GetMenuBar()->FindItem(IDM_CONNECT_WIIMOTE4)->Enable(Initialized && Core::GetStartupParameter().bWii); - if (Initialized && Core::GetStartupParameter().bWii) + GetMenuBar()->FindItem(IDM_CONNECT_WIIMOTE1)->Enable(Initialized && SConfig::GetInstance().m_LocalCoreStartupParameter.bWii); + GetMenuBar()->FindItem(IDM_CONNECT_WIIMOTE2)->Enable(Initialized && SConfig::GetInstance().m_LocalCoreStartupParameter.bWii); + GetMenuBar()->FindItem(IDM_CONNECT_WIIMOTE3)->Enable(Initialized && SConfig::GetInstance().m_LocalCoreStartupParameter.bWii); + GetMenuBar()->FindItem(IDM_CONNECT_WIIMOTE4)->Enable(Initialized && SConfig::GetInstance().m_LocalCoreStartupParameter.bWii); + if (Initialized && SConfig::GetInstance().m_LocalCoreStartupParameter.bWii) { GetMenuBar()->FindItem(IDM_CONNECT_WIIMOTE1)->Check(GetUsbPointer()->AccessWiiMote(0x0100)->IsConnected() == 3); GetMenuBar()->FindItem(IDM_CONNECT_WIIMOTE2)->Check(GetUsbPointer()->AccessWiiMote(0x0101)->IsConnected() == 3); @@ -1068,7 +1068,7 @@ void CFrame::UpdateGUI() if (m_GameListCtrl->IsEnabled()) { // Prepare to load Default ISO, enable play button - if (!Core::GetStartupParameter().m_strDefaultGCM.empty()) + if (!SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDefaultGCM.empty()) { if (m_ToolBar) m_ToolBar->EnableTool(IDM_PLAY, true); diff --git a/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.cpp b/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.cpp index a05754a9b2..9da44d628f 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.cpp @@ -548,8 +548,7 @@ void OpenGL_Update() rcWindow.bottom = GLWin.height; break; case ClientMessage: //TODO: We aren't reading this correctly, It could be anything, highest chance is that it's a close event though - Shutdown(); // Calling from here since returning false does nothing - return; +// Shutdown(); // Calling from here since returning false does nothing break; default: //TODO: Should we put the event back if we don't handle it?