mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-26 15:49:50 -06:00

Changed several enums from Memmap.h to be static vars and implemented Get functions to query them. This seems to have boosted speed a bit in some titles? The new variables and some previously statically initialized items are now initialized via Memory::Init() and the new AddressSpace::Init(). s_ram_size_real and the new s_exram_size_real in particular are initialized from new OnionConfig values "MAIN_MEM1_SIZE" and "MAIN_MEM2_SIZE", only if "MAIN_RAM_OVERRIDE_ENABLE" is true. GUI features have been added to Config > Advanced to adjust the new OnionConfig values. A check has been added to State::doState to ensure savestates with memory configurations different from the current settings aren't loaded. The STATE_VERSION is now 115. FIFO Files have been updated from version 4 to version 5, now including the MEM1 and MEM2 sizes from the time of DFF creation. FIFO Logs not using the new features (OnionConfig MAIN_RAM_OVERRIDE_ENABLE is false) are still backwards compatible. FIFO Logs that do use the new features have a MIN_LOADER_VERSION of 5. Thanks to the order of function calls, FIFO logs are able to automatically configure the new OnionConfig settings to match what is needed. This is a bit hacky, though, so I also threw in a failsafe for if the conditions that allow this to work ever go away. I took the liberty of adding a log message to explain why the core fails to initialize if the MIN_LOADER_VERSION is too great. Some IOS code has had the function "RAMOverrideForIOSMemoryValues" appended to it to recalculate IOS Memory Values from retail IOSes/apploaders to fit the extended memory sizes. Worry not, if MAIN_RAM_OVERRIDE_ENABLE is false, this function does absolutely nothing. A hotfix in DolphinQt/MenuBar.cpp has been implemented for RAM Override.
114 lines
2.7 KiB
C++
114 lines
2.7 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/AddressSpace.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(); // Needs to be initialized before AddressSpace
|
|
AddressSpace::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");
|
|
}
|
|
} // namespace HW
|