mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2026-08-07 04:39:26 -05:00
Dolphin now uses the simulated memory size defined in `bi2.bin` to adjust the memory size in the emulated console automatically. If **Enable Emulated Memory Size Override** has been enabled by the user, the fixed memory size specified for **MEM1** and **MEM2** are still used as they were before. Most retail games do not define the simulated memory size (Wii or Triforce games), or define it to a value that matches the default 24 MiB (GameCube games), so, in the general case, there is no behavior change. One game that sets the simulated memory to a non-default value is the debug build of _Mario Kart: Double Dash!!_, where the value is set to 48 MiB. This enhancement is focused mainly to the modding community. Prior to these changes, modded games with extended memory requirements would fail to launch in Dolphin [with no indication of what the problem is] if the user failed to set the emulated memory override to the correct value. Now, modding tools can specify the simulated memory size in the `bi2.bin` file to produce extended games that _just work_ in Dolphin, without cumbersome instructions that can be overlooked by the user.
365 lines
8.8 KiB
C++
365 lines
8.8 KiB
C++
// Copyright 2020 Dolphin Emulator Project
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
#include "Core/System.h"
|
|
|
|
#include <memory>
|
|
|
|
#include "AudioCommon/SoundStream.h"
|
|
#include "Core/Config/MainSettings.h"
|
|
#include "Core/CoreTiming.h"
|
|
#include "Core/FifoPlayer/FifoPlayer.h"
|
|
#include "Core/FifoPlayer/FifoRecorder.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/DVD/DVDThread.h"
|
|
#include "Core/HW/EXI/EXI.h"
|
|
#include "Core/HW/GPFifo.h"
|
|
#include "Core/HW/HSP/HSP.h"
|
|
#include "Core/HW/Memmap.h"
|
|
#include "Core/HW/MemoryInterface.h"
|
|
#include "Core/HW/ProcessorInterface.h"
|
|
#include "Core/HW/SI/SI.h"
|
|
#include "Core/HW/Sram.h"
|
|
#include "Core/HW/SystemTimers.h"
|
|
#include "Core/HW/VideoInterface.h"
|
|
#include "Core/HW/WII_IPC.h"
|
|
#include "Core/Movie.h"
|
|
#include "Core/PowerPC/Interpreter/Interpreter.h"
|
|
#include "Core/PowerPC/JitInterface.h"
|
|
#include "Core/PowerPC/PowerPC.h"
|
|
#include "IOS/USB/Emulated/Infinity.h"
|
|
#include "IOS/USB/Emulated/Skylanders/Skylander.h"
|
|
#include "IOS/USB/USBScanner.h"
|
|
#include "VideoCommon/CommandProcessor.h"
|
|
#include "VideoCommon/Fifo.h"
|
|
#include "VideoCommon/GeometryShaderManager.h"
|
|
#include "VideoCommon/PerformanceMetrics.h"
|
|
#include "VideoCommon/PixelEngine.h"
|
|
#include "VideoCommon/PixelShaderManager.h"
|
|
#include "VideoCommon/Resources/CustomResourceManager.h"
|
|
#include "VideoCommon/VertexShaderManager.h"
|
|
#include "VideoCommon/VideoEvents.h"
|
|
#include "VideoCommon/XFStateManager.h"
|
|
|
|
namespace Core
|
|
{
|
|
struct System::Impl
|
|
{
|
|
explicit Impl(System& system)
|
|
: m_audio_interface(system), m_core_timing(system), m_command_processor{system},
|
|
m_cpu(system), m_dsp(system), m_dvd_interface(system), m_dvd_thread(system),
|
|
m_expansion_interface(system), m_fifo{system}, m_gp_fifo(system), m_wii_ipc(system),
|
|
m_memory(system), m_pixel_engine{system}, m_power_pc(system),
|
|
m_mmu(system, m_memory, m_power_pc), m_processor_interface(system),
|
|
m_serial_interface(system), m_system_timers(system), m_video_interface(system),
|
|
m_interpreter(system, m_power_pc.GetPPCState(), m_mmu, m_power_pc.GetBranchWatch(),
|
|
m_power_pc.GetSymbolDB()),
|
|
m_jit_interface(system), m_fifo_player(system), m_fifo_recorder(system), m_movie(system)
|
|
{
|
|
}
|
|
|
|
// Built first since other constructors may register hooks right away.
|
|
VideoEvents m_video_events;
|
|
|
|
std::unique_ptr<SoundStream> m_sound_stream;
|
|
bool m_sound_stream_running = false;
|
|
bool m_audio_dump_started = false;
|
|
|
|
std::unique_ptr<IOS::HLE::EmulationKernel> m_ios;
|
|
|
|
AudioInterface::AudioInterfaceManager m_audio_interface;
|
|
CoreTiming::CoreTimingManager m_core_timing;
|
|
CommandProcessor::CommandProcessorManager m_command_processor;
|
|
CPU::CPUManager m_cpu;
|
|
DSP::DSPManager m_dsp;
|
|
DVD::DVDInterface m_dvd_interface;
|
|
DVD::DVDThread m_dvd_thread;
|
|
ExpansionInterface::ExpansionInterfaceManager m_expansion_interface;
|
|
Fifo::FifoManager m_fifo;
|
|
GeometryShaderManager m_geometry_shader_manager;
|
|
GPFifo::GPFifoManager m_gp_fifo;
|
|
HSP::HSPManager m_hsp;
|
|
IOS::HLE::USB::InfinityBase m_infinity_base;
|
|
IOS::HLE::USB::SkylanderPortal m_skylander_portal;
|
|
IOS::WiiIPC m_wii_ipc;
|
|
Memory::MemoryManager m_memory;
|
|
MemoryInterface::MemoryInterfaceManager m_memory_interface;
|
|
PerformanceMetrics m_perf_metrics;
|
|
PixelEngine::PixelEngineManager m_pixel_engine;
|
|
PixelShaderManager m_pixel_shader_manager;
|
|
PowerPC::PowerPCManager m_power_pc;
|
|
PowerPC::MMU m_mmu;
|
|
ProcessorInterface::ProcessorInterfaceManager m_processor_interface;
|
|
SerialInterface::SerialInterfaceManager m_serial_interface;
|
|
Sram m_sram;
|
|
SystemTimers::SystemTimersManager m_system_timers;
|
|
IOS::HLE::USBScanner m_usb_scanner;
|
|
VertexShaderManager m_vertex_shader_manager;
|
|
XFStateManager m_xf_state_manager;
|
|
VideoInterface::VideoInterfaceManager m_video_interface;
|
|
Interpreter m_interpreter;
|
|
JitInterface m_jit_interface;
|
|
VideoCommon::CustomResourceManager m_custom_resource_manager;
|
|
FifoPlayer m_fifo_player;
|
|
FifoRecorder m_fifo_recorder;
|
|
Movie::MovieManager m_movie;
|
|
};
|
|
|
|
System::System() : m_impl{std::make_unique<Impl>(*this)}
|
|
{
|
|
}
|
|
|
|
System::~System() = default;
|
|
|
|
void System::Initialize()
|
|
{
|
|
m_separate_cpu_and_gpu_threads = Config::Get(Config::MAIN_CPU_THREAD);
|
|
m_mmu_enabled = Config::Get(Config::MAIN_MMU);
|
|
m_pause_on_panic_enabled = Config::Get(Config::MAIN_PAUSE_ON_PANIC);
|
|
m_simulated_memory_size = SConfig::GetInstance().GetSimulatedMemorySize();
|
|
}
|
|
|
|
SoundStream* System::GetSoundStream() const
|
|
{
|
|
return m_impl->m_sound_stream.get();
|
|
}
|
|
|
|
void System::SetSoundStream(std::unique_ptr<SoundStream> sound_stream)
|
|
{
|
|
m_impl->m_sound_stream = std::move(sound_stream);
|
|
}
|
|
|
|
bool System::IsSoundStreamRunning() const
|
|
{
|
|
return m_impl->m_sound_stream_running;
|
|
}
|
|
|
|
void System::SetSoundStreamRunning(bool running)
|
|
{
|
|
m_impl->m_sound_stream_running = running;
|
|
}
|
|
|
|
bool System::IsAudioDumpStarted() const
|
|
{
|
|
return m_impl->m_audio_dump_started;
|
|
}
|
|
|
|
void System::SetAudioDumpStarted(bool started)
|
|
{
|
|
m_impl->m_audio_dump_started = started;
|
|
}
|
|
|
|
IOS::HLE::EmulationKernel* System::GetIOS() const
|
|
{
|
|
return m_impl->m_ios.get();
|
|
}
|
|
|
|
void System::SetIOS(std::unique_ptr<IOS::HLE::EmulationKernel> ios)
|
|
{
|
|
m_impl->m_ios = std::move(ios);
|
|
}
|
|
|
|
AudioInterface::AudioInterfaceManager& System::GetAudioInterface() const
|
|
{
|
|
return m_impl->m_audio_interface;
|
|
}
|
|
|
|
CPU::CPUManager& System::GetCPU() const
|
|
{
|
|
return m_impl->m_cpu;
|
|
}
|
|
|
|
CoreTiming::CoreTimingManager& System::GetCoreTiming() const
|
|
{
|
|
return m_impl->m_core_timing;
|
|
}
|
|
|
|
CommandProcessor::CommandProcessorManager& System::GetCommandProcessor() const
|
|
{
|
|
return m_impl->m_command_processor;
|
|
}
|
|
|
|
DSP::DSPManager& System::GetDSP() const
|
|
{
|
|
return m_impl->m_dsp;
|
|
}
|
|
|
|
DVD::DVDInterface& System::GetDVDInterface() const
|
|
{
|
|
return m_impl->m_dvd_interface;
|
|
}
|
|
|
|
DVD::DVDThread& System::GetDVDThread() const
|
|
{
|
|
return m_impl->m_dvd_thread;
|
|
}
|
|
|
|
ExpansionInterface::ExpansionInterfaceManager& System::GetExpansionInterface() const
|
|
{
|
|
return m_impl->m_expansion_interface;
|
|
}
|
|
|
|
Fifo::FifoManager& System::GetFifo() const
|
|
{
|
|
return m_impl->m_fifo;
|
|
}
|
|
|
|
FifoPlayer& System::GetFifoPlayer() const
|
|
{
|
|
return m_impl->m_fifo_player;
|
|
}
|
|
|
|
FifoRecorder& System::GetFifoRecorder() const
|
|
{
|
|
return m_impl->m_fifo_recorder;
|
|
}
|
|
|
|
GeometryShaderManager& System::GetGeometryShaderManager() const
|
|
{
|
|
return m_impl->m_geometry_shader_manager;
|
|
}
|
|
|
|
GPFifo::GPFifoManager& System::GetGPFifo() const
|
|
{
|
|
return m_impl->m_gp_fifo;
|
|
}
|
|
|
|
HSP::HSPManager& System::GetHSP() const
|
|
{
|
|
return m_impl->m_hsp;
|
|
}
|
|
|
|
Interpreter& System::GetInterpreter() const
|
|
{
|
|
return m_impl->m_interpreter;
|
|
}
|
|
|
|
JitInterface& System::GetJitInterface() const
|
|
{
|
|
return m_impl->m_jit_interface;
|
|
}
|
|
|
|
IOS::HLE::USB::SkylanderPortal& System::GetSkylanderPortal() const
|
|
{
|
|
return m_impl->m_skylander_portal;
|
|
}
|
|
|
|
IOS::HLE::USB::InfinityBase& System::GetInfinityBase() const
|
|
{
|
|
return m_impl->m_infinity_base;
|
|
}
|
|
|
|
IOS::WiiIPC& System::GetWiiIPC() const
|
|
{
|
|
return m_impl->m_wii_ipc;
|
|
}
|
|
|
|
Memory::MemoryManager& System::GetMemory() const
|
|
{
|
|
return m_impl->m_memory;
|
|
}
|
|
|
|
MemoryInterface::MemoryInterfaceManager& System::GetMemoryInterface() const
|
|
{
|
|
return m_impl->m_memory_interface;
|
|
}
|
|
|
|
PowerPC::MMU& System::GetMMU() const
|
|
{
|
|
return m_impl->m_mmu;
|
|
}
|
|
|
|
Movie::MovieManager& System::GetMovie() const
|
|
{
|
|
return m_impl->m_movie;
|
|
}
|
|
|
|
PerformanceMetrics& System::GetPerfMetrics() const
|
|
{
|
|
return m_impl->m_perf_metrics;
|
|
}
|
|
|
|
PixelEngine::PixelEngineManager& System::GetPixelEngine() const
|
|
{
|
|
return m_impl->m_pixel_engine;
|
|
}
|
|
|
|
PixelShaderManager& System::GetPixelShaderManager() const
|
|
{
|
|
return m_impl->m_pixel_shader_manager;
|
|
}
|
|
|
|
PowerPC::PowerPCManager& System::GetPowerPC() const
|
|
{
|
|
return m_impl->m_power_pc;
|
|
}
|
|
|
|
PowerPC::PowerPCState& System::GetPPCState() const
|
|
{
|
|
return m_impl->m_power_pc.GetPPCState();
|
|
}
|
|
|
|
PPCSymbolDB& System::GetPPCSymbolDB() const
|
|
{
|
|
return m_impl->m_power_pc.GetSymbolDB();
|
|
}
|
|
|
|
ProcessorInterface::ProcessorInterfaceManager& System::GetProcessorInterface() const
|
|
{
|
|
return m_impl->m_processor_interface;
|
|
}
|
|
|
|
SerialInterface::SerialInterfaceManager& System::GetSerialInterface() const
|
|
{
|
|
return m_impl->m_serial_interface;
|
|
}
|
|
|
|
Sram& System::GetSRAM() const
|
|
{
|
|
return m_impl->m_sram;
|
|
}
|
|
|
|
SystemTimers::SystemTimersManager& System::GetSystemTimers() const
|
|
{
|
|
return m_impl->m_system_timers;
|
|
}
|
|
|
|
IOS::HLE::USBScanner& System::GetUSBScanner() const
|
|
{
|
|
return m_impl->m_usb_scanner;
|
|
}
|
|
|
|
VertexShaderManager& System::GetVertexShaderManager() const
|
|
{
|
|
return m_impl->m_vertex_shader_manager;
|
|
}
|
|
|
|
XFStateManager& System::GetXFStateManager() const
|
|
{
|
|
return m_impl->m_xf_state_manager;
|
|
}
|
|
|
|
VideoInterface::VideoInterfaceManager& System::GetVideoInterface() const
|
|
{
|
|
return m_impl->m_video_interface;
|
|
}
|
|
|
|
VideoCommon::CustomResourceManager& System::GetCustomResourceManager() const
|
|
{
|
|
return m_impl->m_custom_resource_manager;
|
|
}
|
|
|
|
VideoEvents& System::GetVideoEvents() const
|
|
{
|
|
return m_impl->m_video_events;
|
|
}
|
|
} // namespace Core
|
|
|
|
VideoEvents& GetVideoEvents()
|
|
{
|
|
return Core::System::GetInstance().GetVideoEvents();
|
|
}
|