Create accessor methods and deglobalize variables

This commit is contained in:
Morph
2019-10-27 03:07:13 -04:00
parent 65d89cd553
commit 69f0b6e5c7
4 changed files with 20 additions and 9 deletions

View File

@@ -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");

View File

@@ -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::NVFlinger> 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;
};

View File

@@ -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<Service::AM::AppletOE>("appletOE");
auto applet_ae = sm.GetService<Service::AM::AppletAE>("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) {

View File

@@ -1914,7 +1914,8 @@ void GMainWindow::OnCaptureScreenshot() {
auto& sm{Core::System::GetInstance().ServiceManager()};
auto applet_oe = sm.GetService<Service::AM::AppletOE>("appletOE");
auto applet_ae = sm.GetService<Service::AM::AppletAE>("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();