Merge pull request #284 from bunnei/docked-config

Add config for "Docked" mode and various settings cleanup
This commit is contained in:
bunnei 2018-03-27 10:22:08 -04:00 committed by GitHub
commit a5e9745380
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 88 additions and 61 deletions

View File

@ -148,19 +148,15 @@ System::ResultStatus System::Init(EmuWindow* emu_window, u32 system_mode) {
current_process = Kernel::Process::Create("main"); current_process = Kernel::Process::Create("main");
switch (Settings::values.cpu_core) { if (Settings::values.use_cpu_jit) {
case Settings::CpuCore::Unicorn:
cpu_core = std::make_shared<ARM_Unicorn>();
break;
case Settings::CpuCore::Dynarmic:
default:
#ifdef ARCHITECTURE_x86_64 #ifdef ARCHITECTURE_x86_64
cpu_core = std::make_shared<ARM_Dynarmic>(); cpu_core = std::make_shared<ARM_Dynarmic>();
#else #else
cpu_core = std::make_shared<ARM_Unicorn>(); cpu_core = std::make_shared<ARM_Unicorn>();
LOG_WARNING(Core, "CPU JIT requested, but Dynarmic not available"); LOG_WARNING(Core, "CPU JIT requested, but Dynarmic not available");
#endif #endif
break; } else {
cpu_core = std::make_shared<ARM_Unicorn>();
} }
gpu_core = std::make_unique<Tegra::GPU>(); gpu_core = std::make_unique<Tegra::GPU>();

View File

@ -12,6 +12,7 @@
#include "core/hle/service/apm/apm.h" #include "core/hle/service/apm/apm.h"
#include "core/hle/service/filesystem/filesystem.h" #include "core/hle/service/filesystem/filesystem.h"
#include "core/hle/service/nvflinger/nvflinger.h" #include "core/hle/service/nvflinger/nvflinger.h"
#include "core/settings.h"
namespace Service { namespace Service {
namespace AM { namespace AM {
@ -241,17 +242,20 @@ void ICommonStateGetter::GetCurrentFocusState(Kernel::HLERequestContext& ctx) {
} }
void ICommonStateGetter::GetOperationMode(Kernel::HLERequestContext& ctx) { void ICommonStateGetter::GetOperationMode(Kernel::HLERequestContext& ctx) {
const bool use_docked_mode{Settings::values.use_docked_mode};
IPC::ResponseBuilder rb{ctx, 3}; IPC::ResponseBuilder rb{ctx, 3};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.Push(static_cast<u8>(OperationMode::Handheld)); rb.Push(static_cast<u8>(use_docked_mode ? OperationMode::Docked : OperationMode::Handheld));
LOG_WARNING(Service_AM, "(STUBBED) called"); LOG_WARNING(Service_AM, "(STUBBED) called");
} }
void ICommonStateGetter::GetPerformanceMode(Kernel::HLERequestContext& ctx) { void ICommonStateGetter::GetPerformanceMode(Kernel::HLERequestContext& ctx) {
const bool use_docked_mode{Settings::values.use_docked_mode};
IPC::ResponseBuilder rb{ctx, 3}; IPC::ResponseBuilder rb{ctx, 3};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.Push(static_cast<u32>(APM::PerformanceMode::Handheld)); rb.Push(static_cast<u32>(use_docked_mode ? APM::PerformanceMode::Docked
: APM::PerformanceMode::Handheld));
LOG_WARNING(Service_AM, "(STUBBED) called"); LOG_WARNING(Service_AM, "(STUBBED) called");
} }

View File

@ -105,12 +105,10 @@ static const std::array<const char*, NumAnalogs> mapping = {{
}}; }};
} // namespace NativeAnalog } // namespace NativeAnalog
enum class CpuCore {
Unicorn,
Dynarmic,
};
struct Values { struct Values {
// System
bool use_docked_mode;
// Controls // Controls
std::array<std::string, NativeButton::NumButtons> buttons; std::array<std::string, NativeButton::NumButtons> buttons;
std::array<std::string, NativeAnalog::NumAnalogs> analogs; std::array<std::string, NativeAnalog::NumAnalogs> analogs;
@ -118,7 +116,7 @@ struct Values {
std::string touch_device; std::string touch_device;
// Core // Core
CpuCore cpu_core; bool use_cpu_jit;
// Data Storage // Data Storage
bool use_virtual_sd; bool use_virtual_sd;

View File

@ -154,12 +154,13 @@ TelemetrySession::TelemetrySession() {
#endif #endif
// Log user configuration information // Log user configuration information
AddField(Telemetry::FieldType::UserConfig, "Core_CpuCore", AddField(Telemetry::FieldType::UserConfig, "Core_UseCpuJit", Settings::values.use_cpu_jit);
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",
Settings::values.toggle_framelimit); Settings::values.toggle_framelimit);
AddField(Telemetry::FieldType::UserConfig, "System_UseDockedMode",
Settings::values.use_docked_mode);
} }
TelemetrySession::~TelemetrySession() { TelemetrySession::~TelemetrySession() {

View File

@ -77,8 +77,7 @@ void Config::ReadValues() {
qt_config->endGroup(); qt_config->endGroup();
qt_config->beginGroup("Core"); qt_config->beginGroup("Core");
Settings::values.cpu_core = Settings::values.use_cpu_jit = qt_config->value("use_cpu_jit", true).toBool();
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");
@ -94,6 +93,10 @@ void Config::ReadValues() {
Settings::values.use_virtual_sd = qt_config->value("use_virtual_sd", true).toBool(); Settings::values.use_virtual_sd = qt_config->value("use_virtual_sd", true).toBool();
qt_config->endGroup(); qt_config->endGroup();
qt_config->beginGroup("System");
Settings::values.use_docked_mode = qt_config->value("use_docked_mode", true).toBool();
qt_config->endGroup();
qt_config->beginGroup("Miscellaneous"); qt_config->beginGroup("Miscellaneous");
Settings::values.log_filter = qt_config->value("log_filter", "*:Info").toString().toStdString(); Settings::values.log_filter = qt_config->value("log_filter", "*:Info").toString().toStdString();
qt_config->endGroup(); qt_config->endGroup();
@ -171,7 +174,7 @@ void Config::SaveValues() {
qt_config->endGroup(); qt_config->endGroup();
qt_config->beginGroup("Core"); qt_config->beginGroup("Core");
qt_config->setValue("cpu_core", static_cast<int>(Settings::values.cpu_core)); qt_config->setValue("use_cpu_jit", Settings::values.use_cpu_jit);
qt_config->endGroup(); qt_config->endGroup();
qt_config->beginGroup("Renderer"); qt_config->beginGroup("Renderer");
@ -188,6 +191,10 @@ void Config::SaveValues() {
qt_config->setValue("use_virtual_sd", Settings::values.use_virtual_sd); qt_config->setValue("use_virtual_sd", Settings::values.use_virtual_sd);
qt_config->endGroup(); qt_config->endGroup();
qt_config->beginGroup("System");
qt_config->setValue("use_docked_mode", Settings::values.use_docked_mode);
qt_config->endGroup();
qt_config->beginGroup("Miscellaneous"); qt_config->beginGroup("Miscellaneous");
qt_config->setValue("log_filter", QString::fromStdString(Settings::values.log_filter)); qt_config->setValue("log_filter", QString::fromStdString(Settings::values.log_filter));
qt_config->endGroup(); qt_config->endGroup();

View File

@ -15,7 +15,8 @@ ConfigureGeneral::ConfigureGeneral(QWidget* parent)
this->setConfiguration(); this->setConfiguration();
ui->cpu_core_combobox->setEnabled(!Core::System::GetInstance().IsPoweredOn()); ui->use_cpu_jit->setEnabled(!Core::System::GetInstance().IsPoweredOn());
ui->use_docked_mode->setEnabled(!Core::System::GetInstance().IsPoweredOn());
} }
ConfigureGeneral::~ConfigureGeneral() {} ConfigureGeneral::~ConfigureGeneral() {}
@ -23,13 +24,14 @@ 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->cpu_core_combobox->setCurrentIndex(static_cast<int>(Settings::values.cpu_core)); ui->use_cpu_jit->setChecked(Settings::values.use_cpu_jit);
ui->use_docked_mode->setChecked(Settings::values.use_docked_mode);
} }
void ConfigureGeneral::applyConfiguration() { void ConfigureGeneral::applyConfiguration() {
UISettings::values.gamedir_deepscan = ui->toggle_deepscan->isChecked(); UISettings::values.gamedir_deepscan = ui->toggle_deepscan->isChecked();
UISettings::values.confirm_before_closing = ui->toggle_check_exit->isChecked(); UISettings::values.confirm_before_closing = ui->toggle_check_exit->isChecked();
Settings::values.cpu_core = Settings::values.use_cpu_jit = ui->use_cpu_jit->isChecked();
static_cast<Settings::CpuCore>(ui->cpu_core_combobox->currentIndex()); Settings::values.use_docked_mode = ui->use_docked_mode->isChecked();
Settings::Apply(); Settings::Apply();
} }

View File

@ -13,17 +13,17 @@
<property name="windowTitle"> <property name="windowTitle">
<string>Form</string> <string>Form</string>
</property> </property>
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="HorizontalLayout">
<item> <item>
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="VerticalLayout">
<item> <item>
<widget class="QGroupBox" name="groupBox"> <widget class="QGroupBox" name="GeneralGroupBox">
<property name="title"> <property name="title">
<string>General</string> <string>General</string>
</property> </property>
<layout class="QHBoxLayout" name="horizontalLayout_3"> <layout class="QHBoxLayout" name="GeneralHorizontalLayout">
<item> <item>
<layout class="QVBoxLayout" name="verticalLayout_2"> <layout class="QVBoxLayout" name="GeneralVerticalLayout">
<item> <item>
<widget class="QCheckBox" name="toggle_deepscan"> <widget class="QCheckBox" name="toggle_deepscan">
<property name="text"> <property name="text">
@ -44,25 +44,18 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QGroupBox" name="groupBox_2"> <widget class="QGroupBox" name="PerformanceGroupBox">
<property name="title"> <property name="title">
<string>CPU Core</string> <string>Performance</string>
</property> </property>
<layout class="QHBoxLayout" name="horizontalLayout_7"> <layout class="QHBoxLayout" name="PerformanceHorizontalLayout">
<item> <item>
<layout class="QVBoxLayout" name="verticalLayout_5"> <layout class="QVBoxLayout" name="PerformanceVerticalLayout">
<item>
<widget class="QComboBox" name="cpu_core_combobox">
<item> <item>
<widget class="QCheckBox" name="use_cpu_jit">
<property name="text"> <property name="text">
<string>Unicorn</string> <string>Enable CPU JIT</string>
</property> </property>
</item>
<item>
<property name="text">
<string>Dynarmic</string>
</property>
</item>
</widget> </widget>
</item> </item>
</layout> </layout>
@ -71,13 +64,33 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QGroupBox" name="groupBox_3"> <widget class="QGroupBox" name="EmulationGroupBox">
<property name="title">
<string>Emulation</string>
</property>
<layout class="QHBoxLayout" name="EmulationHorizontalLayout">
<item>
<layout class="QVBoxLayout" name="EmulationVerticalLayout">
<item>
<widget class="QCheckBox" name="use_docked_mode">
<property name="text">
<string>Enable docked mode</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="HotKeysGroupBox">
<property name="title"> <property name="title">
<string>Hotkeys</string> <string>Hotkeys</string>
</property> </property>
<layout class="QHBoxLayout" name="horizontalLayout_4"> <layout class="QHBoxLayout" name="HotKeysHorizontalLayout">
<item> <item>
<layout class="QVBoxLayout" name="verticalLayout_4"> <layout class="QVBoxLayout" name="HotKeysVerticalLayout">
<item> <item>
<widget class="GHotkeysDialog" name="widget" native="true"/> <widget class="GHotkeysDialog" name="widget" native="true"/>
</item> </item>

View File

@ -90,8 +90,7 @@ 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.cpu_core = Settings::values.use_cpu_jit = sdl2_config->GetBoolean("Core", "use_cpu_jit", true);
static_cast<Settings::CpuCore>(sdl2_config->GetInteger("Core", "cpu_core", 1));
// Renderer // Renderer
Settings::values.resolution_factor = Settings::values.resolution_factor =
@ -107,6 +106,9 @@ void Config::ReadValues() {
Settings::values.use_virtual_sd = Settings::values.use_virtual_sd =
sdl2_config->GetBoolean("Data Storage", "use_virtual_sd", true); sdl2_config->GetBoolean("Data Storage", "use_virtual_sd", true);
// System
Settings::values.use_docked_mode = sdl2_config->GetBoolean("System", "use_docked_mode", true);
// Miscellaneous // Miscellaneous
Settings::values.log_filter = sdl2_config->Get("Miscellaneous", "log_filter", "*:Trace"); Settings::values.log_filter = sdl2_config->Get("Miscellaneous", "log_filter", "*:Trace");

View File

@ -76,9 +76,9 @@ motion_device=
touch_device= touch_device=
[Core] [Core]
# Which CPU core to use for CPU emulation # Whether to use the Just-In-Time (JIT) compiler for CPU emulation
# 0: Unicorn (slow), 1 (default): Dynarmic (faster) # 0: Interpreter (slow), 1 (default): JIT (fast)
cpu_core = use_cpu_jit =
[Renderer] [Renderer]
# Whether to use software or hardware rendering. # Whether to use software or hardware rendering.
@ -154,6 +154,10 @@ output_device =
use_virtual_sd = use_virtual_sd =
[System] [System]
# Whether the system is docked
# 1 (default): Yes, 0: No
use_docked_mode =
# The system region that Citra will use during emulation # The system region that Citra will use during emulation
# -1: Auto-select (default), 0: Japan, 1: USA, 2: Europe, 3: Australia, 4: China, 5: Korea, 6: Taiwan # -1: Auto-select (default), 0: Japan, 1: USA, 2: Europe, 3: Australia, 4: China, 5: Korea, 6: Taiwan
region_value = region_value =