mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-02-11 23:18:57 +01:00
![Lioncash](/assets/img/avatar_default.png)
Makes the enum values strongly-typed and prevents the identifiers from polluting the PowerPC namespace. This also cleans up the parameters of some functions where we were accepting an ambiguous int type and expecting the correct values to be passed in. Now those parameters accept a PowerPC::CPUCore type only, making it immediately obvious which values should be passed in. It also turns out we were storing these core types into other structures as plain ints, which have also been corrected. As this type is used directly with the configuration code, we need to provide our own overloaded insertion (<<) and extraction (>>) operators in order to make it compatible with it. These are fairly trivial to implement, so there's no issue here. A minor adjustment to TryParse() was required, as our generic function was doing the following: N tmp = 0; which is problematic, as custom types may not be able to have that assignment performed (e.g. strongly-typed enums), so we change this to: N tmp; which is sufficient, as the value is attempted to be initialized immediately under that statement.
112 lines
2.6 KiB
C++
112 lines
2.6 KiB
C++
// Copyright 2008 Dolphin Emulator Project
|
|
// Licensed under GPLv2+
|
|
// Refer to the license.txt file included.
|
|
|
|
#include "Core/HW/HW.h"
|
|
|
|
#include "Common/ChunkFile.h"
|
|
#include "Common/CommonTypes.h"
|
|
|
|
#include "Core/ConfigManager.h"
|
|
#include "Core/Core.h"
|
|
#include "Core/CoreTiming.h"
|
|
#include "Core/HW/AudioInterface.h"
|
|
#include "Core/HW/CPU.h"
|
|
#include "Core/HW/DSP.h"
|
|
#include "Core/HW/DVD/DVDInterface.h"
|
|
#include "Core/HW/EXI/EXI.h"
|
|
#include "Core/HW/GPFifo.h"
|
|
#include "Core/HW/Memmap.h"
|
|
#include "Core/HW/ProcessorInterface.h"
|
|
#include "Core/HW/SI/SI.h"
|
|
#include "Core/HW/SystemTimers.h"
|
|
#include "Core/HW/VideoInterface.h"
|
|
#include "Core/HW/WII_IPC.h"
|
|
#include "Core/IOS/IOS.h"
|
|
#include "Core/State.h"
|
|
#include "Core/WiiRoot.h"
|
|
|
|
namespace HW
|
|
{
|
|
void Init()
|
|
{
|
|
CoreTiming::Init();
|
|
SystemTimers::PreInit();
|
|
|
|
State::Init();
|
|
|
|
// Init the whole Hardware
|
|
AudioInterface::Init();
|
|
VideoInterface::Init();
|
|
SerialInterface::Init();
|
|
ProcessorInterface::Init();
|
|
ExpansionInterface::Init(); // Needs to be initialized before Memory
|
|
Memory::Init();
|
|
DSP::Init(SConfig::GetInstance().bDSPHLE);
|
|
DVDInterface::Init();
|
|
GPFifo::Init();
|
|
CPU::Init(SConfig::GetInstance().cpu_core);
|
|
SystemTimers::Init();
|
|
|
|
if (SConfig::GetInstance().bWii)
|
|
{
|
|
// The NAND should only be initialised once per emulation session.
|
|
Core::InitializeWiiRoot(Core::WantsDeterminism());
|
|
IOS::Init();
|
|
IOS::HLE::Init(); // Depends on Memory
|
|
}
|
|
}
|
|
|
|
void Shutdown()
|
|
{
|
|
// IOS should always be shut down regardless of bWii because it can be running in GC mode (MIOS).
|
|
IOS::HLE::Shutdown(); // Depends on Memory
|
|
IOS::Shutdown();
|
|
Core::ShutdownWiiRoot();
|
|
|
|
SystemTimers::Shutdown();
|
|
CPU::Shutdown();
|
|
DVDInterface::Shutdown();
|
|
DSP::Shutdown();
|
|
Memory::Shutdown();
|
|
ExpansionInterface::Shutdown();
|
|
SerialInterface::Shutdown();
|
|
AudioInterface::Shutdown();
|
|
|
|
State::Shutdown();
|
|
CoreTiming::Shutdown();
|
|
}
|
|
|
|
void DoState(PointerWrap& p)
|
|
{
|
|
Memory::DoState(p);
|
|
p.DoMarker("Memory");
|
|
VideoInterface::DoState(p);
|
|
p.DoMarker("VideoInterface");
|
|
SerialInterface::DoState(p);
|
|
p.DoMarker("SerialInterface");
|
|
ProcessorInterface::DoState(p);
|
|
p.DoMarker("ProcessorInterface");
|
|
DSP::DoState(p);
|
|
p.DoMarker("DSP");
|
|
DVDInterface::DoState(p);
|
|
p.DoMarker("DVDInterface");
|
|
GPFifo::DoState(p);
|
|
p.DoMarker("GPFifo");
|
|
ExpansionInterface::DoState(p);
|
|
p.DoMarker("ExpansionInterface");
|
|
AudioInterface::DoState(p);
|
|
p.DoMarker("AudioInterface");
|
|
|
|
if (SConfig::GetInstance().bWii)
|
|
{
|
|
IOS::DoState(p);
|
|
p.DoMarker("IOS");
|
|
IOS::HLE::GetIOS()->DoState(p);
|
|
p.DoMarker("IOS::HLE");
|
|
}
|
|
|
|
p.DoMarker("WIIHW");
|
|
}
|
|
}
|