2
1
Fork 0
mirror of https://github.com/yuzu-emu/yuzu.git synced 2024-07-04 23:31:19 +01:00

configuration: Add cpu_core configuration option

This commit is contained in:
MerryMage 2018-01-12 16:06:30 +00:00 committed by bunnei
parent d2fbc78320
commit b628192bf2
8 changed files with 40 additions and 16 deletions

View file

@ -82,7 +82,8 @@ void Config::ReadValues() {
sdl2_config->Get("Controls", "touch_device", "engine:emu_window"); sdl2_config->Get("Controls", "touch_device", "engine:emu_window");
// Core // Core
Settings::values.use_cpu_jit = sdl2_config->GetBoolean("Core", "use_cpu_jit", true); Settings::values.cpu_core =
static_cast<Settings::CpuCore>(sdl2_config->GetInteger("Core", "cpu_core", 1));
// Renderer // Renderer
Settings::values.use_hw_renderer = sdl2_config->GetBoolean("Renderer", "use_hw_renderer", true); Settings::values.use_hw_renderer = sdl2_config->GetBoolean("Renderer", "use_hw_renderer", true);

View file

@ -67,9 +67,9 @@ motion_device=
touch_device= touch_device=
[Core] [Core]
# Whether to use the Just-In-Time (JIT) compiler for CPU emulation # Which CPU core to use for CPU emulation
# 0: Interpreter (slow), 1 (default): JIT (fast) # 0: Unicorn (slow), 1 (default): Dynarmic (faster)
use_cpu_jit = cpu_core =
[Renderer] [Renderer]
# Whether to use software or hardware rendering. # Whether to use software or hardware rendering.

View file

@ -67,7 +67,8 @@ void Config::ReadValues() {
qt_config->endGroup(); qt_config->endGroup();
qt_config->beginGroup("Core"); qt_config->beginGroup("Core");
Settings::values.use_cpu_jit = qt_config->value("use_cpu_jit", true).toBool(); Settings::values.cpu_core =
static_cast<Settings::CpuCore>(qt_config->value("cpu_core", 1).toInt());
qt_config->endGroup(); qt_config->endGroup();
qt_config->beginGroup("Renderer"); qt_config->beginGroup("Renderer");
@ -207,7 +208,7 @@ void Config::SaveValues() {
qt_config->endGroup(); qt_config->endGroup();
qt_config->beginGroup("Core"); qt_config->beginGroup("Core");
qt_config->setValue("use_cpu_jit", Settings::values.use_cpu_jit); qt_config->setValue("cpu_core", static_cast<int>(Settings::values.cpu_core));
qt_config->endGroup(); qt_config->endGroup();
qt_config->beginGroup("Renderer"); qt_config->beginGroup("Renderer");

View file

@ -19,7 +19,7 @@ ConfigureGeneral::ConfigureGeneral(QWidget* parent)
this->setConfiguration(); this->setConfiguration();
ui->toggle_cpu_jit->setEnabled(!Core::System::GetInstance().IsPoweredOn()); ui->cpu_core_combobox->setEnabled(!Core::System::GetInstance().IsPoweredOn());
} }
ConfigureGeneral::~ConfigureGeneral() {} ConfigureGeneral::~ConfigureGeneral() {}
@ -27,12 +27,12 @@ ConfigureGeneral::~ConfigureGeneral() {}
void ConfigureGeneral::setConfiguration() { void ConfigureGeneral::setConfiguration() {
ui->toggle_deepscan->setChecked(UISettings::values.gamedir_deepscan); ui->toggle_deepscan->setChecked(UISettings::values.gamedir_deepscan);
ui->toggle_check_exit->setChecked(UISettings::values.confirm_before_closing); ui->toggle_check_exit->setChecked(UISettings::values.confirm_before_closing);
ui->toggle_cpu_jit->setChecked(Settings::values.use_cpu_jit);
// The first item is "auto-select" with actual value -1, so plus one here will do the trick // The first item is "auto-select" with actual value -1, so plus one here will do the trick
ui->region_combobox->setCurrentIndex(Settings::values.region_value + 1); ui->region_combobox->setCurrentIndex(Settings::values.region_value + 1);
ui->theme_combobox->setCurrentIndex(ui->theme_combobox->findData(UISettings::values.theme)); ui->theme_combobox->setCurrentIndex(ui->theme_combobox->findData(UISettings::values.theme));
ui->cpu_core_combobox->setCurrentIndex(static_cast<int>(Settings::values.cpu_core));
} }
void ConfigureGeneral::applyConfiguration() { void ConfigureGeneral::applyConfiguration() {
@ -41,6 +41,7 @@ void ConfigureGeneral::applyConfiguration() {
UISettings::values.theme = UISettings::values.theme =
ui->theme_combobox->itemData(ui->theme_combobox->currentIndex()).toString(); ui->theme_combobox->itemData(ui->theme_combobox->currentIndex()).toString();
Settings::values.region_value = ui->region_combobox->currentIndex() - 1; Settings::values.region_value = ui->region_combobox->currentIndex() - 1;
Settings::values.use_cpu_jit = ui->toggle_cpu_jit->isChecked(); Settings::values.cpu_core =
static_cast<Settings::CpuCore>(ui->cpu_core_combobox->currentIndex());
Settings::Apply(); Settings::Apply();
} }

View file

@ -46,16 +46,23 @@
<item> <item>
<widget class="QGroupBox" name="groupBox_2"> <widget class="QGroupBox" name="groupBox_2">
<property name="title"> <property name="title">
<string>Performance</string> <string>CPU Core</string>
</property> </property>
<layout class="QHBoxLayout" name="horizontalLayout_7"> <layout class="QHBoxLayout" name="horizontalLayout_7">
<item> <item>
<layout class="QVBoxLayout" name="verticalLayout_5"> <layout class="QVBoxLayout" name="verticalLayout_5">
<item> <item>
<widget class="QCheckBox" name="toggle_cpu_jit"> <widget class="QComboBox" name="cpu_core_combobox">
<item>
<property name="text"> <property name="text">
<string>Enable CPU JIT</string> <string>Unicorn</string>
</property> </property>
</item>
<item>
<property name="text">
<string>Dynarmic</string>
</property>
</item>
</widget> </widget>
</item> </item>
</layout> </layout>

View file

@ -140,8 +140,16 @@ void System::Reschedule() {
System::ResultStatus System::Init(EmuWindow* emu_window, u32 system_mode) { System::ResultStatus System::Init(EmuWindow* emu_window, u32 system_mode) {
LOG_DEBUG(HW_Memory, "initialized OK"); LOG_DEBUG(HW_Memory, "initialized OK");
// TODO: Configuration option switch (Settings::values.cpu_core) {
cpu_core = std::make_unique<ARM_Dynarmic>(); case Settings::CpuCore::Unicorn:
cpu_core = std::make_unique<ARM_Unicorn>();
break;
case Settings::CpuCore::Dynarmic:
default:
cpu_core = std::make_unique<ARM_Dynarmic>();
break;
}
telemetry_session = std::make_unique<Core::TelemetrySession>(); telemetry_session = std::make_unique<Core::TelemetrySession>();
CoreTiming::Init(); CoreTiming::Init();

View file

@ -72,6 +72,11 @@ static const std::array<const char*, NumAnalogs> mapping = {{
}}; }};
} // namespace NativeAnalog } // namespace NativeAnalog
enum class CpuCore {
Unicorn,
Dynarmic,
};
struct Values { struct Values {
// CheckNew3DS // CheckNew3DS
bool is_new_3ds; bool is_new_3ds;
@ -83,7 +88,7 @@ struct Values {
std::string touch_device; std::string touch_device;
// Core // Core
bool use_cpu_jit; CpuCore cpu_core;
// Data Storage // Data Storage
bool use_virtual_sd; bool use_virtual_sd;

View file

@ -156,7 +156,8 @@ TelemetrySession::TelemetrySession() {
// Log user configuration information // Log user configuration information
AddField(Telemetry::FieldType::UserConfig, "Audio_EnableAudioStretching", AddField(Telemetry::FieldType::UserConfig, "Audio_EnableAudioStretching",
Settings::values.enable_audio_stretching); Settings::values.enable_audio_stretching);
AddField(Telemetry::FieldType::UserConfig, "Core_UseCpuJit", Settings::values.use_cpu_jit); AddField(Telemetry::FieldType::UserConfig, "Core_CpuCore",
static_cast<int>(Settings::values.cpu_core));
AddField(Telemetry::FieldType::UserConfig, "Renderer_ResolutionFactor", AddField(Telemetry::FieldType::UserConfig, "Renderer_ResolutionFactor",
Settings::values.resolution_factor); Settings::values.resolution_factor);
AddField(Telemetry::FieldType::UserConfig, "Renderer_ToggleFramelimit", AddField(Telemetry::FieldType::UserConfig, "Renderer_ToggleFramelimit",