From 41e99d8880f4946256344d06b732412ca16c9a13 Mon Sep 17 00:00:00 2001 From: David Marcec Date: Wed, 7 Nov 2018 18:01:33 +1100 Subject: Ability to switch between docked and undocked mode in-game Started implementation of the AM message queue mainly used in state getters. Added the ability to switch docked mode whilst in game without stopping emulation. Also removed some things which shouldn't be labelled as stubs as they're implemented correctly --- src/yuzu/configuration/configure_general.cpp | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'src/yuzu/configuration/configure_general.cpp') diff --git a/src/yuzu/configuration/configure_general.cpp b/src/yuzu/configuration/configure_general.cpp index 537d6e576..9b429c346 100644 --- a/src/yuzu/configuration/configure_general.cpp +++ b/src/yuzu/configuration/configure_general.cpp @@ -3,6 +3,10 @@ // Refer to the license.txt file included. #include "core/core.h" +#include "core/hle/service/am/am.h" +#include "core/hle/service/am/applet_ae.h" +#include "core/hle/service/am/applet_oe.h" +#include "core/hle/service/sm/sm.h" #include "core/settings.h" #include "ui_configure_general.h" #include "yuzu/configuration/configure_general.h" @@ -20,7 +24,6 @@ ConfigureGeneral::ConfigureGeneral(QWidget* parent) this->setConfiguration(); ui->use_cpu_jit->setEnabled(!Core::System::GetInstance().IsPoweredOn()); - ui->use_docked_mode->setEnabled(!Core::System::GetInstance().IsPoweredOn()); } ConfigureGeneral::~ConfigureGeneral() = default; @@ -45,6 +48,27 @@ void ConfigureGeneral::applyConfiguration() { ui->theme_combobox->itemData(ui->theme_combobox->currentIndex()).toString(); Settings::values.use_cpu_jit = ui->use_cpu_jit->isChecked(); + const bool pre_docked_mode = Settings::values.use_docked_mode; Settings::values.use_docked_mode = ui->use_docked_mode->isChecked(); + + if (pre_docked_mode != Settings::values.use_docked_mode) { + Core::System& system{Core::System::GetInstance()}; + Service::SM::ServiceManager& sm = system.ServiceManager(); + + // Message queue is shared between these services, we just need to signal an operation + // change to one and it will handle both automatically + auto applet_oe = sm.GetService("appletOE"); + auto applet_ae = sm.GetService("appletAE"); + bool has_signalled = false; + + if (applet_oe != nullptr) { + applet_oe->GetMessageQueue()->OperationModeChanged(); + has_signalled = true; + } + + if (applet_ae != nullptr && !has_signalled) { + applet_ae->GetMessageQueue()->OperationModeChanged(); + } + } Settings::values.enable_nfc = ui->enable_nfc->isChecked(); } -- cgit v1.2.3 From fd1ef2525761109992f05bd24ab7fca4bff4bcc4 Mon Sep 17 00:00:00 2001 From: David Marcec Date: Wed, 7 Nov 2018 20:12:27 +1100 Subject: Fixups --- src/yuzu/configuration/configure_general.cpp | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) (limited to 'src/yuzu/configuration/configure_general.cpp') diff --git a/src/yuzu/configuration/configure_general.cpp b/src/yuzu/configuration/configure_general.cpp index 9b429c346..201d7a4c5 100644 --- a/src/yuzu/configuration/configure_general.cpp +++ b/src/yuzu/configuration/configure_general.cpp @@ -41,17 +41,8 @@ void ConfigureGeneral::PopulateHotkeyList(const HotkeyRegistry& registry) { ui->widget->Populate(registry); } -void ConfigureGeneral::applyConfiguration() { - UISettings::values.gamedir_deepscan = ui->toggle_deepscan->isChecked(); - UISettings::values.confirm_before_closing = ui->toggle_check_exit->isChecked(); - UISettings::values.theme = - ui->theme_combobox->itemData(ui->theme_combobox->currentIndex()).toString(); - - Settings::values.use_cpu_jit = ui->use_cpu_jit->isChecked(); - const bool pre_docked_mode = Settings::values.use_docked_mode; - Settings::values.use_docked_mode = ui->use_docked_mode->isChecked(); - - if (pre_docked_mode != Settings::values.use_docked_mode) { +void ConfigureGeneral::CheckIfOperationChanged(bool last_state, bool new_state) { + if (last_state != new_state) { Core::System& system{Core::System::GetInstance()}; Service::SM::ServiceManager& sm = system.ServiceManager(); @@ -70,5 +61,18 @@ void ConfigureGeneral::applyConfiguration() { applet_ae->GetMessageQueue()->OperationModeChanged(); } } +} + +void ConfigureGeneral::applyConfiguration() { + UISettings::values.gamedir_deepscan = ui->toggle_deepscan->isChecked(); + UISettings::values.confirm_before_closing = ui->toggle_check_exit->isChecked(); + UISettings::values.theme = + ui->theme_combobox->itemData(ui->theme_combobox->currentIndex()).toString(); + + Settings::values.use_cpu_jit = ui->use_cpu_jit->isChecked(); + const bool pre_docked_mode = Settings::values.use_docked_mode; + Settings::values.use_docked_mode = ui->use_docked_mode->isChecked(); + CheckIfOperationChanged(pre_docked_mode, Settings::values.use_docked_mode); + Settings::values.enable_nfc = ui->enable_nfc->isChecked(); } -- cgit v1.2.3 From 40db288a2a08b00eea9339fd61ce5f4a358dae8f Mon Sep 17 00:00:00 2001 From: David Marcec Date: Thu, 8 Nov 2018 12:12:00 +1100 Subject: Renamed CheckIfOperationChanged to OnDockedModeChanged --- src/yuzu/configuration/configure_general.cpp | 42 +++++++++++++++------------- 1 file changed, 22 insertions(+), 20 deletions(-) (limited to 'src/yuzu/configuration/configure_general.cpp') diff --git a/src/yuzu/configuration/configure_general.cpp b/src/yuzu/configuration/configure_general.cpp index 201d7a4c5..b322258a0 100644 --- a/src/yuzu/configuration/configure_general.cpp +++ b/src/yuzu/configuration/configure_general.cpp @@ -41,25 +41,27 @@ void ConfigureGeneral::PopulateHotkeyList(const HotkeyRegistry& registry) { ui->widget->Populate(registry); } -void ConfigureGeneral::CheckIfOperationChanged(bool last_state, bool new_state) { - if (last_state != new_state) { - Core::System& system{Core::System::GetInstance()}; - Service::SM::ServiceManager& sm = system.ServiceManager(); - - // Message queue is shared between these services, we just need to signal an operation - // change to one and it will handle both automatically - auto applet_oe = sm.GetService("appletOE"); - auto applet_ae = sm.GetService("appletAE"); - bool has_signalled = false; - - if (applet_oe != nullptr) { - applet_oe->GetMessageQueue()->OperationModeChanged(); - has_signalled = true; - } - - if (applet_ae != nullptr && !has_signalled) { - applet_ae->GetMessageQueue()->OperationModeChanged(); - } +void ConfigureGeneral::OnDockedModeChanged(bool last_state, bool new_state) { + if (last_state == new_state) { + return; + } + + Core::System& system{Core::System::GetInstance()}; + Service::SM::ServiceManager& sm = system.ServiceManager(); + + // Message queue is shared between these services, we just need to signal an operation + // change to one and it will handle both automatically + auto applet_oe = sm.GetService("appletOE"); + auto applet_ae = sm.GetService("appletAE"); + bool has_signalled = false; + + if (applet_oe != nullptr) { + applet_oe->GetMessageQueue()->OperationModeChanged(); + has_signalled = true; + } + + if (applet_ae != nullptr && !has_signalled) { + applet_ae->GetMessageQueue()->OperationModeChanged(); } } @@ -72,7 +74,7 @@ void ConfigureGeneral::applyConfiguration() { Settings::values.use_cpu_jit = ui->use_cpu_jit->isChecked(); const bool pre_docked_mode = Settings::values.use_docked_mode; Settings::values.use_docked_mode = ui->use_docked_mode->isChecked(); - CheckIfOperationChanged(pre_docked_mode, Settings::values.use_docked_mode); + OnDockedModeChanged(pre_docked_mode, Settings::values.use_docked_mode); Settings::values.enable_nfc = ui->enable_nfc->isChecked(); } -- cgit v1.2.3