2019-12-31 06:17:17 +00:00
|
|
|
#include "consolesettingswidget.h"
|
2020-08-10 12:40:38 +00:00
|
|
|
#include "settingsdialog.h"
|
2020-01-01 04:01:58 +00:00
|
|
|
#include "settingwidgetbinder.h"
|
2020-01-24 04:51:31 +00:00
|
|
|
#include <QtWidgets/QFileDialog>
|
|
|
|
|
|
|
|
static constexpr char BIOS_IMAGE_FILTER[] = "Binary Images (*.bin);;All Files (*.*)";
|
2019-12-31 06:17:17 +00:00
|
|
|
|
2020-08-10 12:40:38 +00:00
|
|
|
ConsoleSettingsWidget::ConsoleSettingsWidget(QtHostInterface* host_interface, QWidget* parent, SettingsDialog* dialog)
|
2020-01-01 04:01:58 +00:00
|
|
|
: QWidget(parent), m_host_interface(host_interface)
|
2019-12-31 06:17:17 +00:00
|
|
|
{
|
|
|
|
m_ui.setupUi(this);
|
2020-01-01 04:01:58 +00:00
|
|
|
|
2020-02-01 14:22:07 +00:00
|
|
|
for (u32 i = 0; i < static_cast<u32>(ConsoleRegion::Count); i++)
|
|
|
|
m_ui.region->addItem(tr(Settings::GetConsoleRegionDisplayName(static_cast<ConsoleRegion>(i))));
|
|
|
|
|
2020-01-28 14:01:44 +00:00
|
|
|
for (u32 i = 0; i < static_cast<u32>(CPUExecutionMode::Count); i++)
|
|
|
|
m_ui.cpuExecutionMode->addItem(tr(Settings::GetCPUExecutionModeDisplayName(static_cast<CPUExecutionMode>(i))));
|
|
|
|
|
2020-07-21 09:49:04 +00:00
|
|
|
SettingWidgetBinder::BindWidgetToEnumSetting(m_host_interface, m_ui.region, "Console", "Region",
|
|
|
|
&Settings::ParseConsoleRegionName, &Settings::GetConsoleRegionName,
|
|
|
|
Settings::DEFAULT_CONSOLE_REGION);
|
|
|
|
SettingWidgetBinder::BindWidgetToStringSetting(m_host_interface, m_ui.biosPath, "BIOS", "Path");
|
|
|
|
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.enableTTYOutput, "BIOS", "PatchTTYEnable");
|
|
|
|
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.fastBoot, "BIOS", "PatchFastBoot");
|
|
|
|
SettingWidgetBinder::BindWidgetToEnumSetting(m_host_interface, m_ui.cpuExecutionMode, "CPU", "ExecutionMode",
|
|
|
|
&Settings::ParseCPUExecutionMode, &Settings::GetCPUExecutionModeName,
|
|
|
|
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");
|
2020-08-10 12:40:38 +00:00
|
|
|
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.cdromLoadImageToRAM, "CDROM", "LoadImageToRAM",
|
|
|
|
false);
|
2020-01-24 04:51:31 +00:00
|
|
|
|
|
|
|
connect(m_ui.biosPathBrowse, &QPushButton::pressed, this, &ConsoleSettingsWidget::onBrowseBIOSPathButtonClicked);
|
2020-08-10 12:40:38 +00:00
|
|
|
|
|
|
|
dialog->registerWidgetHelp(m_ui.fastBoot, tr("Fast Boot"), tr("Unchecked"),
|
|
|
|
tr("Patches the BIOS to skip the console's boot animation. Does not work with all games, "
|
|
|
|
"but usually safe to enabled."));
|
2020-08-10 19:35:36 +00:00
|
|
|
|
|
|
|
dialog->registerWidgetHelp(m_ui.cdromLoadImageToRAM, tr("Preload Image to RAM"), tr("Unchecked"),
|
|
|
|
tr("Loads the game image into RAM. Useful for network paths that may become unreliable during gameplay."));
|
2019-12-31 06:17:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ConsoleSettingsWidget::~ConsoleSettingsWidget() = default;
|
2020-01-24 04:51:31 +00:00
|
|
|
|
|
|
|
void ConsoleSettingsWidget::onBrowseBIOSPathButtonClicked()
|
|
|
|
{
|
|
|
|
QString path = QFileDialog::getOpenFileName(this, tr("Select BIOS Image"), QString(), tr(BIOS_IMAGE_FILTER));
|
|
|
|
if (path.isEmpty())
|
|
|
|
return;
|
|
|
|
|
|
|
|
m_ui.biosPath->setText(path);
|
|
|
|
|
2020-07-21 09:49:04 +00:00
|
|
|
m_host_interface->SetStringSettingValue("BIOS", "Path", path.toUtf8().constData());
|
2020-01-24 04:51:31 +00:00
|
|
|
m_host_interface->applySettings();
|
|
|
|
}
|