summaryrefslogtreecommitdiffstats
path: root/src/core/hle/service/am/frontend/applets.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/hle/service/am/frontend/applets.h')
-rw-r--r--src/core/hle/service/am/frontend/applets.h89
1 files changed, 15 insertions, 74 deletions
diff --git a/src/core/hle/service/am/frontend/applets.h b/src/core/hle/service/am/frontend/applets.h
index dec1d63b2..1e1fd28b8 100644
--- a/src/core/hle/service/am/frontend/applets.h
+++ b/src/core/hle/service/am/frontend/applets.h
@@ -44,87 +44,19 @@ class IStorage;
namespace Frontend {
-class AppletDataBroker final {
-public:
- explicit AppletDataBroker(Core::System& system_, LibraryAppletMode applet_mode_);
- ~AppletDataBroker();
-
- struct RawChannelData {
- std::vector<std::vector<u8>> normal;
- std::vector<std::vector<u8>> interactive;
- };
-
- // Retrieves but does not pop the data sent to applet.
- RawChannelData PeekDataToAppletForDebug() const;
-
- std::shared_ptr<IStorage> PopNormalDataToGame();
- std::shared_ptr<IStorage> PopNormalDataToApplet();
-
- std::shared_ptr<IStorage> PopInteractiveDataToGame();
- std::shared_ptr<IStorage> PopInteractiveDataToApplet();
-
- void PushNormalDataFromGame(std::shared_ptr<IStorage>&& storage);
- void PushNormalDataFromApplet(std::shared_ptr<IStorage>&& storage);
-
- void PushInteractiveDataFromGame(std::shared_ptr<IStorage>&& storage);
- void PushInteractiveDataFromApplet(std::shared_ptr<IStorage>&& storage);
-
- void SignalStateChanged();
-
- Kernel::KReadableEvent& GetNormalDataEvent();
- Kernel::KReadableEvent& GetInteractiveDataEvent();
- Kernel::KReadableEvent& GetStateChangedEvent();
-
-private:
- Core::System& system;
- LibraryAppletMode applet_mode;
-
- KernelHelpers::ServiceContext service_context;
-
- // Queues are named from applet's perspective
-
- // PopNormalDataToApplet and PushNormalDataFromGame
- std::deque<std::shared_ptr<IStorage>> in_channel;
-
- // PopNormalDataToGame and PushNormalDataFromApplet
- std::deque<std::shared_ptr<IStorage>> out_channel;
-
- // PopInteractiveDataToApplet and PushInteractiveDataFromGame
- std::deque<std::shared_ptr<IStorage>> in_interactive_channel;
-
- // PopInteractiveDataToGame and PushInteractiveDataFromApplet
- std::deque<std::shared_ptr<IStorage>> out_interactive_channel;
-
- Kernel::KEvent* state_changed_event;
-
- // Signaled on PushNormalDataFromApplet
- Kernel::KEvent* pop_out_data_event;
-
- // Signaled on PushInteractiveDataFromApplet
- Kernel::KEvent* pop_interactive_out_data_event;
-};
-
class FrontendApplet {
public:
- explicit FrontendApplet(Core::System& system_, LibraryAppletMode applet_mode_);
+ explicit FrontendApplet(Core::System& system_, std::shared_ptr<Applet> applet_,
+ LibraryAppletMode applet_mode_);
virtual ~FrontendApplet();
virtual void Initialize();
- virtual bool TransactionComplete() const = 0;
virtual Result GetStatus() const = 0;
virtual void ExecuteInteractive() = 0;
virtual void Execute() = 0;
virtual Result RequestExit() = 0;
- AppletDataBroker& GetBroker() {
- return broker;
- }
-
- const AppletDataBroker& GetBroker() const {
- return broker;
- }
-
LibraryAppletMode GetLibraryAppletMode() const {
return applet_mode;
}
@@ -134,10 +66,18 @@ public:
}
protected:
+ std::shared_ptr<IStorage> PopInData();
+ std::shared_ptr<IStorage> PopInteractiveInData();
+ void PushOutData(std::shared_ptr<IStorage> storage);
+ void PushInteractiveOutData(std::shared_ptr<IStorage> storage);
+ void Exit();
+
+protected:
+ Core::System& system;
CommonArguments common_args{};
- AppletDataBroker broker;
- LibraryAppletMode applet_mode;
- bool initialized = false;
+ std::weak_ptr<Applet> applet{};
+ LibraryAppletMode applet_mode{};
+ bool initialized{false};
};
struct FrontendAppletSet {
@@ -191,7 +131,8 @@ public:
void SetDefaultAppletsIfMissing();
void ClearAll();
- std::shared_ptr<FrontendApplet> GetApplet(AppletId id, LibraryAppletMode mode) const;
+ std::shared_ptr<FrontendApplet> GetApplet(std::shared_ptr<Applet> applet, AppletId id,
+ LibraryAppletMode mode) const;
private:
AppletId current_applet_id{};