Completed TODO: Core::GetStartupParameter is dead

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5019 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Glenn Rice 2010-02-06 05:22:53 +00:00
parent d979532c00
commit a9db66a41a
15 changed files with 43 additions and 54 deletions

View File

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

View File

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

View File

@ -56,7 +56,6 @@ namespace Core
void ScreenShot();
// Get core parameters kill use SConfig instead
const SCoreStartupParameter& GetStartupParameter();
extern SCoreStartupParameter g_CoreStartupParameter;
void* GetWindowHandle();

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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