System: Add an option to preload CD image to RAM

This commit is contained in:
Connor McLaughlin 2020-07-22 00:03:22 +10:00
parent 3187d07d03
commit 9496c992f7
8 changed files with 23 additions and 0 deletions

View File

@ -362,6 +362,7 @@ void HostInterface::SetDefaultSettings(SettingsInterface& si)
si.SetBoolValue("CDROM", "ReadThread", true);
si.SetBoolValue("CDROM", "RegionCheck", true);
si.SetBoolValue("CDROM", "LoadImageToRAM", false);
si.SetStringValue("Audio", "Backend", Settings::GetAudioBackendName(Settings::DEFAULT_AUDIO_BACKEND));
si.SetIntValue("Audio", "OutputVolume", 100);

View File

@ -118,6 +118,7 @@ void Settings::Load(SettingsInterface& si)
cdrom_read_thread = si.GetBoolValue("CDROM", "ReadThread", true);
cdrom_region_check = si.GetBoolValue("CDROM", "RegionCheck", true);
cdrom_load_image_to_ram = si.GetBoolValue("CDROM", "LoadImageToRAM", false);
audio_backend =
ParseAudioBackend(si.GetStringValue("Audio", "Backend", GetAudioBackendName(DEFAULT_AUDIO_BACKEND)).c_str())
@ -213,6 +214,7 @@ void Settings::Save(SettingsInterface& si) const
si.SetBoolValue("CDROM", "ReadThread", cdrom_read_thread);
si.SetBoolValue("CDROM", "RegionCheck", cdrom_region_check);
si.SetBoolValue("CDROM", "LoadImageToRAM", cdrom_load_image_to_ram);
si.SetStringValue("Audio", "Backend", GetAudioBackendName(audio_backend));
si.SetIntValue("Audio", "OutputVolume", audio_output_volume);

View File

@ -100,6 +100,7 @@ struct Settings
bool cdrom_read_thread = true;
bool cdrom_region_check = true;
bool cdrom_load_image_to_ram = false;
AudioBackend audio_backend = AudioBackend::Cubeb;
s32 audio_output_volume = 100;

View File

@ -14,6 +14,7 @@
#include "gpu.h"
#include "host_display.h"
#include "host_interface.h"
#include "host_interface_progress_callback.h"
#include "interrupt_controller.h"
#include "mdec.h"
#include "memory_card.h"
@ -163,6 +164,14 @@ bool System::Boot(const SystemBootParameters& params)
return false;
}
if (params.override_load_image_to_ram.value_or(GetSettings().cdrom_load_image_to_ram))
{
HostInterfaceProgressCallback callback(m_host_interface);
std::unique_ptr<CDImage> memory_image = CDImage::CreateMemoryImage(media.get(), &callback);
if (memory_image)
media = std::move(memory_image);
}
if (m_region == ConsoleRegion::Auto)
{
const DiscRegion disc_region = GameList::GetRegionForImage(media.get());

View File

@ -38,6 +38,7 @@ struct SystemBootParameters
std::string filename;
std::optional<bool> override_fast_boot;
std::optional<bool> override_fullscreen;
std::optional<bool> override_load_image_to_ram;
std::unique_ptr<ByteStream> state_stream;
bool force_software_renderer = false;
};

View File

@ -26,6 +26,7 @@ ConsoleSettingsWidget::ConsoleSettingsWidget(QtHostInterface* host_interface, QW
Settings::DEFAULT_CPU_EXECUTION_MODE);
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.cdromReadThread, "CDROM", "ReadThread");
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.cdromRegionCheck, "CDROM", "RegionCheck");
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.cdromLoadImageToRAM, "CDROM", "LoadImageToRAM", false);
connect(m_ui.biosPathBrowse, &QPushButton::pressed, this, &ConsoleSettingsWidget::onBrowseBIOSPathButtonClicked);
}

View File

@ -119,6 +119,13 @@
</property>
</widget>
</item>
<item row="2" column="0" colspan="2">
<widget class="QCheckBox" name="cdromLoadImageToRAM">
<property name="text">
<string>Preload Image To RAM</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>

View File

@ -1109,6 +1109,7 @@ void SDLHostInterface::DrawSettingsWindow()
{
settings_changed |= ImGui::Checkbox("Use Read Thread (Asynchronous)", &m_settings_copy.cdrom_read_thread);
settings_changed |= ImGui::Checkbox("Enable Region Check", &m_settings_copy.cdrom_region_check);
settings_changed |= ImGui::Checkbox("Preload Image To RAM", &m_settings_copy.cdrom_load_image_to_ram);
}
ImGui::NewLine();