summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2021-04-17 20:37:17 +0200
committerGitHub <noreply@github.com>2021-04-17 20:37:17 +0200
commitce921e0f2619fc52a70e5545711e284b320328d4 (patch)
treed5874637e6426893df41b7080ae9287836cc9edc
parentMerge pull request #6125 from ogniK5377/nvdec-close-dev (diff)
parentapplets: Send focus state change message on applet state change (diff)
downloadyuzu-ce921e0f2619fc52a70e5545711e284b320328d4.tar
yuzu-ce921e0f2619fc52a70e5545711e284b320328d4.tar.gz
yuzu-ce921e0f2619fc52a70e5545711e284b320328d4.tar.bz2
yuzu-ce921e0f2619fc52a70e5545711e284b320328d4.tar.lz
yuzu-ce921e0f2619fc52a70e5545711e284b320328d4.tar.xz
yuzu-ce921e0f2619fc52a70e5545711e284b320328d4.tar.zst
yuzu-ce921e0f2619fc52a70e5545711e284b320328d4.zip
-rw-r--r--src/core/hle/service/am/am.cpp12
-rw-r--r--src/core/hle/service/am/am.h3
-rw-r--r--src/core/hle/service/am/applets/applets.cpp39
-rw-r--r--src/core/hle/service/am/applets/applets.h20
-rw-r--r--src/core/hle/service/am/applets/controller.cpp2
-rw-r--r--src/core/hle/service/am/applets/controller.h1
-rw-r--r--src/core/hle/service/am/applets/error.cpp2
-rw-r--r--src/core/hle/service/am/applets/error.h1
-rw-r--r--src/core/hle/service/am/applets/general_backend.cpp6
-rw-r--r--src/core/hle/service/am/applets/general_backend.h3
-rw-r--r--src/core/hle/service/am/applets/profile_select.cpp2
-rw-r--r--src/core/hle/service/am/applets/profile_select.h1
-rw-r--r--src/core/hle/service/am/applets/software_keyboard.cpp2
-rw-r--r--src/core/hle/service/am/applets/software_keyboard.h1
-rw-r--r--src/core/hle/service/am/applets/web_browser.cpp2
-rw-r--r--src/core/hle/service/am/applets/web_browser.h1
16 files changed, 65 insertions, 33 deletions
diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp
index c59054468..4c8216b47 100644
--- a/src/core/hle/service/am/am.cpp
+++ b/src/core/hle/service/am/am.cpp
@@ -619,16 +619,20 @@ std::size_t AppletMessageQueue::GetMessageCount() const {
return messages.size();
}
+void AppletMessageQueue::RequestExit() {
+ PushMessage(AppletMessage::ExitRequested);
+}
+
+void AppletMessageQueue::FocusStateChanged() {
+ PushMessage(AppletMessage::FocusStateChanged);
+}
+
void AppletMessageQueue::OperationModeChanged() {
PushMessage(AppletMessage::OperationModeChanged);
PushMessage(AppletMessage::PerformanceModeChanged);
on_operation_mode_changed->GetWritableEvent()->Signal();
}
-void AppletMessageQueue::RequestExit() {
- PushMessage(AppletMessage::ExitRequested);
-}
-
ICommonStateGetter::ICommonStateGetter(Core::System& system_,
std::shared_ptr<AppletMessageQueue> msg_queue_)
: ServiceFramework{system_, "ICommonStateGetter"}, msg_queue{std::move(msg_queue_)} {
diff --git a/src/core/hle/service/am/am.h b/src/core/hle/service/am/am.h
index aefbdf0d5..756434716 100644
--- a/src/core/hle/service/am/am.h
+++ b/src/core/hle/service/am/am.h
@@ -61,8 +61,9 @@ public:
void PushMessage(AppletMessage msg);
AppletMessage PopMessage();
std::size_t GetMessageCount() const;
- void OperationModeChanged();
void RequestExit();
+ void FocusStateChanged();
+ void OperationModeChanged();
private:
std::queue<AppletMessage> messages;
diff --git a/src/core/hle/service/am/applets/applets.cpp b/src/core/hle/service/am/applets/applets.cpp
index 5ddad851a..a56df6a7e 100644
--- a/src/core/hle/service/am/applets/applets.cpp
+++ b/src/core/hle/service/am/applets/applets.cpp
@@ -17,6 +17,8 @@
#include "core/hle/kernel/k_writable_event.h"
#include "core/hle/kernel/server_session.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/am/applets/applets.h"
#include "core/hle/service/am/applets/controller.h"
#include "core/hle/service/am/applets/error.h"
@@ -24,17 +26,20 @@
#include "core/hle/service/am/applets/profile_select.h"
#include "core/hle/service/am/applets/software_keyboard.h"
#include "core/hle/service/am/applets/web_browser.h"
+#include "core/hle/service/sm/sm.h"
namespace Service::AM::Applets {
-AppletDataBroker::AppletDataBroker(Kernel::KernelCore& kernel) {
+AppletDataBroker::AppletDataBroker(Core::System& system_, LibraryAppletMode applet_mode_)
+ : system{system_}, applet_mode{applet_mode_} {
state_changed_event =
- Kernel::KEvent::Create(kernel, "ILibraryAppletAccessor:StateChangedEvent");
+ Kernel::KEvent::Create(system.Kernel(), "ILibraryAppletAccessor:StateChangedEvent");
state_changed_event->Initialize();
- pop_out_data_event = Kernel::KEvent::Create(kernel, "ILibraryAppletAccessor:PopDataOutEvent");
+ pop_out_data_event =
+ Kernel::KEvent::Create(system.Kernel(), "ILibraryAppletAccessor:PopDataOutEvent");
pop_out_data_event->Initialize();
- pop_interactive_out_data_event =
- Kernel::KEvent::Create(kernel, "ILibraryAppletAccessor:PopInteractiveDataOutEvent");
+ pop_interactive_out_data_event = Kernel::KEvent::Create(
+ system.Kernel(), "ILibraryAppletAccessor:PopInteractiveDataOutEvent");
pop_interactive_out_data_event->Initialize();
}
@@ -114,6 +119,27 @@ void AppletDataBroker::PushInteractiveDataFromApplet(std::shared_ptr<IStorage>&&
void AppletDataBroker::SignalStateChanged() const {
state_changed_event->GetWritableEvent()->Signal();
+
+ switch (applet_mode) {
+ case LibraryAppletMode::AllForeground:
+ case LibraryAppletMode::AllForegroundInitiallyHidden: {
+ auto applet_oe = system.ServiceManager().GetService<AppletOE>("appletOE");
+ auto applet_ae = system.ServiceManager().GetService<AppletAE>("appletAE");
+
+ if (applet_oe) {
+ applet_oe->GetMessageQueue()->FocusStateChanged();
+ break;
+ }
+
+ if (applet_ae) {
+ applet_ae->GetMessageQueue()->FocusStateChanged();
+ break;
+ }
+ break;
+ }
+ default:
+ break;
+ }
}
std::shared_ptr<Kernel::KReadableEvent> AppletDataBroker::GetNormalDataEvent() const {
@@ -128,7 +154,8 @@ std::shared_ptr<Kernel::KReadableEvent> AppletDataBroker::GetStateChangedEvent()
return state_changed_event->GetReadableEvent();
}
-Applet::Applet(Kernel::KernelCore& kernel_) : broker{kernel_} {}
+Applet::Applet(Core::System& system_, LibraryAppletMode applet_mode_)
+ : broker{system_, applet_mode_}, applet_mode{applet_mode_} {}
Applet::~Applet() = default;
diff --git a/src/core/hle/service/am/applets/applets.h b/src/core/hle/service/am/applets/applets.h
index 26b482015..4215d2232 100644
--- a/src/core/hle/service/am/applets/applets.h
+++ b/src/core/hle/service/am/applets/applets.h
@@ -72,7 +72,7 @@ enum class LibraryAppletMode : u32 {
class AppletDataBroker final {
public:
- explicit AppletDataBroker(Kernel::KernelCore& kernel_);
+ explicit AppletDataBroker(Core::System& system_, LibraryAppletMode applet_mode_);
~AppletDataBroker();
struct RawChannelData {
@@ -102,6 +102,9 @@ public:
std::shared_ptr<Kernel::KReadableEvent> GetStateChangedEvent() const;
private:
+ Core::System& system;
+ LibraryAppletMode applet_mode;
+
// Queues are named from applet's perspective
// PopNormalDataToApplet and PushNormalDataFromGame
@@ -127,7 +130,7 @@ private:
class Applet {
public:
- explicit Applet(Kernel::KernelCore& kernel_);
+ explicit Applet(Core::System& system_, LibraryAppletMode applet_mode_);
virtual ~Applet();
virtual void Initialize();
@@ -137,10 +140,6 @@ public:
virtual void ExecuteInteractive() = 0;
virtual void Execute() = 0;
- bool IsInitialized() const {
- return initialized;
- }
-
AppletDataBroker& GetBroker() {
return broker;
}
@@ -149,6 +148,14 @@ public:
return broker;
}
+ LibraryAppletMode GetLibraryAppletMode() const {
+ return applet_mode;
+ }
+
+ bool IsInitialized() const {
+ return initialized;
+ }
+
protected:
struct CommonArguments {
u32_le arguments_version;
@@ -162,6 +169,7 @@ protected:
CommonArguments common_args{};
AppletDataBroker broker;
+ LibraryAppletMode applet_mode;
bool initialized = false;
};
diff --git a/src/core/hle/service/am/applets/controller.cpp b/src/core/hle/service/am/applets/controller.cpp
index a33f05f97..218c8d1e4 100644
--- a/src/core/hle/service/am/applets/controller.cpp
+++ b/src/core/hle/service/am/applets/controller.cpp
@@ -47,7 +47,7 @@ static Core::Frontend::ControllerParameters ConvertToFrontendParameters(
Controller::Controller(Core::System& system_, LibraryAppletMode applet_mode_,
const Core::Frontend::ControllerApplet& frontend_)
- : Applet{system_.Kernel()}, applet_mode{applet_mode_}, frontend{frontend_}, system{system_} {}
+ : Applet{system_, applet_mode_}, frontend{frontend_}, system{system_} {}
Controller::~Controller() = default;
diff --git a/src/core/hle/service/am/applets/controller.h b/src/core/hle/service/am/applets/controller.h
index 07cb92bf9..2d4dae0bd 100644
--- a/src/core/hle/service/am/applets/controller.h
+++ b/src/core/hle/service/am/applets/controller.h
@@ -120,7 +120,6 @@ public:
void ConfigurationComplete();
private:
- LibraryAppletMode applet_mode;
const Core::Frontend::ControllerApplet& frontend;
Core::System& system;
diff --git a/src/core/hle/service/am/applets/error.cpp b/src/core/hle/service/am/applets/error.cpp
index a9f0a9c95..23e30aa45 100644
--- a/src/core/hle/service/am/applets/error.cpp
+++ b/src/core/hle/service/am/applets/error.cpp
@@ -88,7 +88,7 @@ ResultCode Decode64BitError(u64 error) {
Error::Error(Core::System& system_, LibraryAppletMode applet_mode_,
const Core::Frontend::ErrorApplet& frontend_)
- : Applet{system_.Kernel()}, applet_mode{applet_mode_}, frontend{frontend_}, system{system_} {}
+ : Applet{system_, applet_mode_}, frontend{frontend_}, system{system_} {}
Error::~Error() = default;
diff --git a/src/core/hle/service/am/applets/error.h b/src/core/hle/service/am/applets/error.h
index a3e520cd4..e606d12ce 100644
--- a/src/core/hle/service/am/applets/error.h
+++ b/src/core/hle/service/am/applets/error.h
@@ -41,7 +41,6 @@ public:
private:
union ErrorArguments;
- LibraryAppletMode applet_mode;
const Core::Frontend::ErrorApplet& frontend;
ResultCode error_code = RESULT_SUCCESS;
ErrorAppletMode mode = ErrorAppletMode::ShowError;
diff --git a/src/core/hle/service/am/applets/general_backend.cpp b/src/core/hle/service/am/applets/general_backend.cpp
index 71016cce7..b26abad36 100644
--- a/src/core/hle/service/am/applets/general_backend.cpp
+++ b/src/core/hle/service/am/applets/general_backend.cpp
@@ -39,7 +39,7 @@ static void LogCurrentStorage(AppletDataBroker& broker, std::string_view prefix)
Auth::Auth(Core::System& system_, LibraryAppletMode applet_mode_,
Core::Frontend::ParentalControlsApplet& frontend_)
- : Applet{system_.Kernel()}, applet_mode{applet_mode_}, frontend{frontend_}, system{system_} {}
+ : Applet{system_, applet_mode_}, frontend{frontend_}, system{system_} {}
Auth::~Auth() = default;
@@ -155,7 +155,7 @@ void Auth::AuthFinished(bool is_successful) {
PhotoViewer::PhotoViewer(Core::System& system_, LibraryAppletMode applet_mode_,
const Core::Frontend::PhotoViewerApplet& frontend_)
- : Applet{system_.Kernel()}, applet_mode{applet_mode_}, frontend{frontend_}, system{system_} {}
+ : Applet{system_, applet_mode_}, frontend{frontend_}, system{system_} {}
PhotoViewer::~PhotoViewer() = default;
@@ -205,7 +205,7 @@ void PhotoViewer::ViewFinished() {
}
StubApplet::StubApplet(Core::System& system_, AppletId id_, LibraryAppletMode applet_mode_)
- : Applet{system_.Kernel()}, id{id_}, applet_mode{applet_mode_}, system{system_} {}
+ : Applet{system_, applet_mode_}, id{id_}, system{system_} {}
StubApplet::~StubApplet() = default;
diff --git a/src/core/hle/service/am/applets/general_backend.h b/src/core/hle/service/am/applets/general_backend.h
index d9e6d4384..7496ded88 100644
--- a/src/core/hle/service/am/applets/general_backend.h
+++ b/src/core/hle/service/am/applets/general_backend.h
@@ -33,7 +33,6 @@ public:
void AuthFinished(bool is_successful = true);
private:
- LibraryAppletMode applet_mode;
Core::Frontend::ParentalControlsApplet& frontend;
Core::System& system;
bool complete = false;
@@ -65,7 +64,6 @@ public:
void ViewFinished();
private:
- LibraryAppletMode applet_mode;
const Core::Frontend::PhotoViewerApplet& frontend;
bool complete = false;
PhotoViewerAppletMode mode = PhotoViewerAppletMode::CurrentApp;
@@ -86,7 +84,6 @@ public:
private:
AppletId id;
- LibraryAppletMode applet_mode;
Core::System& system;
};
diff --git a/src/core/hle/service/am/applets/profile_select.cpp b/src/core/hle/service/am/applets/profile_select.cpp
index ab8b6fcc5..c91a9776a 100644
--- a/src/core/hle/service/am/applets/profile_select.cpp
+++ b/src/core/hle/service/am/applets/profile_select.cpp
@@ -17,7 +17,7 @@ constexpr ResultCode ERR_USER_CANCELLED_SELECTION{ErrorModule::Account, 1};
ProfileSelect::ProfileSelect(Core::System& system_, LibraryAppletMode applet_mode_,
const Core::Frontend::ProfileSelectApplet& frontend_)
- : Applet{system_.Kernel()}, applet_mode{applet_mode_}, frontend{frontend_}, system{system_} {}
+ : Applet{system_, applet_mode_}, frontend{frontend_}, system{system_} {}
ProfileSelect::~ProfileSelect() = default;
diff --git a/src/core/hle/service/am/applets/profile_select.h b/src/core/hle/service/am/applets/profile_select.h
index 90f054030..f0dd6c1f3 100644
--- a/src/core/hle/service/am/applets/profile_select.h
+++ b/src/core/hle/service/am/applets/profile_select.h
@@ -47,7 +47,6 @@ public:
void SelectionComplete(std::optional<Common::UUID> uuid);
private:
- LibraryAppletMode applet_mode;
const Core::Frontend::ProfileSelectApplet& frontend;
UserSelectionConfig config;
diff --git a/src/core/hle/service/am/applets/software_keyboard.cpp b/src/core/hle/service/am/applets/software_keyboard.cpp
index c3a05de9c..73a06def1 100644
--- a/src/core/hle/service/am/applets/software_keyboard.cpp
+++ b/src/core/hle/service/am/applets/software_keyboard.cpp
@@ -44,7 +44,7 @@ void SetReplyBase(std::vector<u8>& reply, SwkbdState state, SwkbdReplyType reply
SoftwareKeyboard::SoftwareKeyboard(Core::System& system_, LibraryAppletMode applet_mode_,
Core::Frontend::SoftwareKeyboardApplet& frontend_)
- : Applet{system_.Kernel()}, applet_mode{applet_mode_}, frontend{frontend_}, system{system_} {}
+ : Applet{system_, applet_mode_}, frontend{frontend_}, system{system_} {}
SoftwareKeyboard::~SoftwareKeyboard() = default;
diff --git a/src/core/hle/service/am/applets/software_keyboard.h b/src/core/hle/service/am/applets/software_keyboard.h
index 85aeb4eb1..7c67b7574 100644
--- a/src/core/hle/service/am/applets/software_keyboard.h
+++ b/src/core/hle/service/am/applets/software_keyboard.h
@@ -136,7 +136,6 @@ private:
void ReplyChangedStringUtf8V2();
void ReplyMovedCursorUtf8V2();
- LibraryAppletMode applet_mode;
Core::Frontend::SoftwareKeyboardApplet& frontend;
Core::System& system;
diff --git a/src/core/hle/service/am/applets/web_browser.cpp b/src/core/hle/service/am/applets/web_browser.cpp
index b28b849bc..2404921fd 100644
--- a/src/core/hle/service/am/applets/web_browser.cpp
+++ b/src/core/hle/service/am/applets/web_browser.cpp
@@ -210,7 +210,7 @@ void ExtractSharedFonts(Core::System& system) {
WebBrowser::WebBrowser(Core::System& system_, LibraryAppletMode applet_mode_,
const Core::Frontend::WebBrowserApplet& frontend_)
- : Applet{system_.Kernel()}, applet_mode{applet_mode_}, frontend(frontend_), system{system_} {}
+ : Applet{system_, applet_mode_}, frontend(frontend_), system{system_} {}
WebBrowser::~WebBrowser() = default;
diff --git a/src/core/hle/service/am/applets/web_browser.h b/src/core/hle/service/am/applets/web_browser.h
index 5eafbae7b..21fd910c2 100644
--- a/src/core/hle/service/am/applets/web_browser.h
+++ b/src/core/hle/service/am/applets/web_browser.h
@@ -64,7 +64,6 @@ private:
void ExecuteWifi();
void ExecuteLobby();
- LibraryAppletMode applet_mode;
const Core::Frontend::WebBrowserApplet& frontend;
bool complete{false};