mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-30 09:35:40 +00:00
System: Add option to force start in software mode
This commit is contained in:
parent
919494079b
commit
936d92dfb8
|
@ -63,12 +63,6 @@ void GPU::UpdateSettings()
|
||||||
UpdateCRTCDisplayParameters();
|
UpdateCRTCDisplayParameters();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GPU::UpdateHardwareType()
|
|
||||||
{
|
|
||||||
m_console_is_pal = m_system->IsPALRegion();
|
|
||||||
UpdateCRTCDisplayParameters();
|
|
||||||
}
|
|
||||||
|
|
||||||
void GPU::Reset()
|
void GPU::Reset()
|
||||||
{
|
{
|
||||||
SoftReset();
|
SoftReset();
|
||||||
|
|
|
@ -173,9 +173,6 @@ public:
|
||||||
// Converts window coordinates into horizontal ticks and scanlines. Returns false if out of range. Used for lightguns.
|
// Converts window coordinates into horizontal ticks and scanlines. Returns false if out of range. Used for lightguns.
|
||||||
bool ConvertScreenCoordinatesToBeamTicksAndLines(s32 window_x, s32 window_y, u32* out_tick, u32* out_line) const;
|
bool ConvertScreenCoordinatesToBeamTicksAndLines(s32 window_x, s32 window_y, u32* out_tick, u32* out_line) const;
|
||||||
|
|
||||||
// Updates hardware type from settings.
|
|
||||||
void UpdateHardwareType();
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
TickCount CRTCTicksToSystemTicks(TickCount crtc_ticks, TickCount fractional_ticks) const;
|
TickCount CRTCTicksToSystemTicks(TickCount crtc_ticks, TickCount fractional_ticks) const;
|
||||||
TickCount SystemTicksToCRTCTicks(TickCount sysclk_ticks, TickCount* fractional_ticks) const;
|
TickCount SystemTicksToCRTCTicks(TickCount sysclk_ticks, TickCount* fractional_ticks) const;
|
||||||
|
|
|
@ -88,11 +88,7 @@ ConsoleRegion System::GetConsoleRegionForDiscRegion(DiscRegion region)
|
||||||
|
|
||||||
std::unique_ptr<System> System::Create(HostInterface* host_interface)
|
std::unique_ptr<System> System::Create(HostInterface* host_interface)
|
||||||
{
|
{
|
||||||
std::unique_ptr<System> system(new System(host_interface));
|
return std::unique_ptr<System>(new System(host_interface));
|
||||||
if (!system->CreateGPU(host_interface->m_settings.gpu_renderer))
|
|
||||||
return {};
|
|
||||||
|
|
||||||
return system;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool System::RecreateGPU(GPURenderer renderer)
|
bool System::RecreateGPU(GPURenderer renderer)
|
||||||
|
@ -138,7 +134,7 @@ void System::SetCPUExecutionMode(CPUExecutionMode mode)
|
||||||
bool System::Boot(const SystemBootParameters& params)
|
bool System::Boot(const SystemBootParameters& params)
|
||||||
{
|
{
|
||||||
if (params.state_stream)
|
if (params.state_stream)
|
||||||
return DoLoadState(params.state_stream.get(), true);
|
return DoLoadState(params.state_stream.get(), true, params.force_software_renderer);
|
||||||
|
|
||||||
// Load CD image up and detect region.
|
// Load CD image up and detect region.
|
||||||
std::unique_ptr<CDImage> media;
|
std::unique_ptr<CDImage> media;
|
||||||
|
@ -201,11 +197,12 @@ bool System::Boot(const SystemBootParameters& params)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Component setup.
|
||||||
|
if (!InitializeComponents(params.force_software_renderer))
|
||||||
|
return false;
|
||||||
|
|
||||||
// Notify change of disc.
|
// Notify change of disc.
|
||||||
UpdateRunningGame(params.filename.c_str(), media.get());
|
UpdateRunningGame(params.filename.c_str(), media.get());
|
||||||
|
|
||||||
// Component setup.
|
|
||||||
InitializeComponents();
|
|
||||||
UpdateControllers();
|
UpdateControllers();
|
||||||
UpdateMemoryCards();
|
UpdateMemoryCards();
|
||||||
Reset();
|
Reset();
|
||||||
|
@ -243,8 +240,11 @@ bool System::Boot(const SystemBootParameters& params)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void System::InitializeComponents()
|
bool System::InitializeComponents(bool force_software_renderer)
|
||||||
{
|
{
|
||||||
|
if (!CreateGPU(force_software_renderer ? GPURenderer::Software : GetSettings().gpu_renderer))
|
||||||
|
return false;
|
||||||
|
|
||||||
m_cpu->Initialize(m_bus.get());
|
m_cpu->Initialize(m_bus.get());
|
||||||
m_cpu_code_cache->Initialize(this, m_cpu.get(), m_bus.get(), m_cpu_execution_mode == CPUExecutionMode::Recompiler);
|
m_cpu_code_cache->Initialize(this, m_cpu.get(), m_bus.get(), m_cpu_execution_mode == CPUExecutionMode::Recompiler);
|
||||||
m_bus->Initialize(m_cpu.get(), m_cpu_code_cache.get(), m_dma.get(), m_interrupt_controller.get(), m_gpu.get(),
|
m_bus->Initialize(m_cpu.get(), m_cpu_code_cache.get(), m_dma.get(), m_interrupt_controller.get(), m_gpu.get(),
|
||||||
|
@ -260,9 +260,9 @@ void System::InitializeComponents()
|
||||||
m_timers->Initialize(this, m_interrupt_controller.get(), m_gpu.get());
|
m_timers->Initialize(this, m_interrupt_controller.get(), m_gpu.get());
|
||||||
m_spu->Initialize(this, m_dma.get(), m_interrupt_controller.get());
|
m_spu->Initialize(this, m_dma.get(), m_interrupt_controller.get());
|
||||||
m_mdec->Initialize(this, m_dma.get());
|
m_mdec->Initialize(this, m_dma.get());
|
||||||
m_gpu->UpdateHardwareType();
|
|
||||||
|
|
||||||
UpdateThrottlePeriod();
|
UpdateThrottlePeriod();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void System::DestroyComponents()
|
void System::DestroyComponents()
|
||||||
|
@ -398,10 +398,10 @@ void System::Reset()
|
||||||
|
|
||||||
bool System::LoadState(ByteStream* state)
|
bool System::LoadState(ByteStream* state)
|
||||||
{
|
{
|
||||||
return DoLoadState(state, false);
|
return DoLoadState(state, false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool System::DoLoadState(ByteStream* state, bool init_components)
|
bool System::DoLoadState(ByteStream* state, bool init_components, bool force_software_renderer)
|
||||||
{
|
{
|
||||||
SAVE_STATE_HEADER header;
|
SAVE_STATE_HEADER header;
|
||||||
if (!state->Read2(&header, sizeof(header)))
|
if (!state->Read2(&header, sizeof(header)))
|
||||||
|
@ -440,7 +440,9 @@ bool System::DoLoadState(ByteStream* state, bool init_components)
|
||||||
|
|
||||||
if (init_components)
|
if (init_components)
|
||||||
{
|
{
|
||||||
InitializeComponents();
|
if (!InitializeComponents(force_software_renderer))
|
||||||
|
return false;
|
||||||
|
|
||||||
UpdateControllers();
|
UpdateControllers();
|
||||||
UpdateMemoryCards();
|
UpdateMemoryCards();
|
||||||
|
|
||||||
|
|
|
@ -39,6 +39,7 @@ struct SystemBootParameters
|
||||||
std::optional<bool> override_fast_boot;
|
std::optional<bool> override_fast_boot;
|
||||||
std::optional<bool> override_fullscreen;
|
std::optional<bool> override_fullscreen;
|
||||||
std::unique_ptr<ByteStream> state_stream;
|
std::unique_ptr<ByteStream> state_stream;
|
||||||
|
bool force_software_renderer = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
class System
|
class System
|
||||||
|
@ -145,11 +146,11 @@ public:
|
||||||
private:
|
private:
|
||||||
System(HostInterface* host_interface);
|
System(HostInterface* host_interface);
|
||||||
|
|
||||||
bool DoLoadState(ByteStream* stream, bool init_components);
|
bool DoLoadState(ByteStream* stream, bool init_components, bool force_software_renderer);
|
||||||
bool DoState(StateWrapper& sw);
|
bool DoState(StateWrapper& sw);
|
||||||
bool CreateGPU(GPURenderer renderer);
|
bool CreateGPU(GPURenderer renderer);
|
||||||
|
|
||||||
void InitializeComponents();
|
bool InitializeComponents(bool force_software_renderer);
|
||||||
void DestroyComponents();
|
void DestroyComponents();
|
||||||
|
|
||||||
// Active event management
|
// Active event management
|
||||||
|
|
Loading…
Reference in a new issue