From 69f0b6e5c722c01d76aab5d340901a4813357275 Mon Sep 17 00:00:00 2001 From: Morph <39850852+Morph1984@users.noreply.github.com> Date: Sun, 27 Oct 2019 03:07:13 -0400 Subject: [PATCH] Create accessor methods and deglobalize variables --- src/core/hle/service/am/am.cpp | 8 ++++++++ src/core/hle/service/am/am.h | 15 ++++++++------- src/yuzu/configuration/configure_input.cpp | 3 ++- src/yuzu/main.cpp | 3 ++- 4 files changed, 20 insertions(+), 9 deletions(-) diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp index 38d8b415eb..cdb9d094ea 100644 --- a/src/core/hle/service/am/am.cpp +++ b/src/core/hle/service/am/am.cpp @@ -549,6 +549,14 @@ void ISelfController::SetAlbumImageTakenNotificationEnabled(Kernel::HLERequestCo rb.Push(RESULT_SUCCESS); } +bool ISelfController::GetOperationModeChangedNotification() const { + return operation_mode_changed_notification; +} + +bool ISelfController::GetAlbumImageTakenNotificationEnabled() const { + return album_image_taken_notification_enabled; +} + AppletMessageQueue::AppletMessageQueue(Kernel::KernelCore& kernel) { on_new_message = Kernel::WritableEvent::CreateEventPair(kernel, "AMMessageQueue:OnMessageReceived"); diff --git a/src/core/hle/service/am/am.h b/src/core/hle/service/am/am.h index 68797ab740..6cb6abaf22 100644 --- a/src/core/hle/service/am/am.h +++ b/src/core/hle/service/am/am.h @@ -41,13 +41,6 @@ enum SystemLanguage { TraditionalChinese = 16, }; -// Notification flags -bool operation_mode_changed_notification = false; -bool performance_mode_changed_notification = false; -bool restart_message_enabled = false; -bool out_of_focus_suspending_enabled = false; -bool album_image_taken_notification_enabled = false; - class AppletMessageQueue { public: enum class AppletMessage : u32 { @@ -133,6 +126,9 @@ public: std::shared_ptr nvflinger_); ~ISelfController() override; + bool GetOperationModeChangedNotification() const; + bool GetAlbumImageTakenNotificationEnabled() const; + private: void Exit(Kernel::HLERequestContext& ctx); void LockExit(Kernel::HLERequestContext& ctx); @@ -164,6 +160,11 @@ private: u32 idle_time_detection_extension = 0; u64 num_fatal_sections_entered = 0; + bool operation_mode_changed_notification = false; + bool performance_mode_changed_notification = false; + bool restart_message_enabled = false; + bool out_of_focus_suspending_enabled = false; + bool album_image_taken_notification_enabled = false; bool is_auto_sleep_disabled = false; }; diff --git a/src/yuzu/configuration/configure_input.cpp b/src/yuzu/configuration/configure_input.cpp index 61f642b7fe..781e4719af 100644 --- a/src/yuzu/configuration/configure_input.cpp +++ b/src/yuzu/configuration/configure_input.cpp @@ -36,7 +36,8 @@ void OnDockedModeChanged(bool last_state, bool new_state) { // change to one and it will handle both automatically auto applet_oe = sm.GetService("appletOE"); auto applet_ae = sm.GetService("appletAE"); - bool is_notification_enabled = Service::AM::operation_mode_changed_notification; + bool is_notification_enabled = + Service::AM::ISelfController::GetOperationModeChangedNotification(); bool has_signalled = false; if (applet_oe != nullptr && is_notification_enabled) { diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index b3395cf51b..9d34063494 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -1914,7 +1914,8 @@ void GMainWindow::OnCaptureScreenshot() { auto& sm{Core::System::GetInstance().ServiceManager()}; auto applet_oe = sm.GetService("appletOE"); auto applet_ae = sm.GetService("appletAE"); - bool is_notification_enabled = Service::AM::album_image_taken_notification_enabled; + bool is_notification_enabled = + Service::AM::ISelfController::GetAlbumImageTakenNotificationEnabled(); bool has_signalled = false; if (applet_oe != nullptr && is_notification_enabled) { applet_oe->GetMessageQueue()->ScreenshotTaken();