summaryrefslogtreecommitdiffstats
path: root/src/core/hle/service/am/applets/applets.h
diff options
context:
space:
mode:
authorZach Hilman <zachhilman@gmail.com>2018-11-19 20:24:36 +0100
committerZach Hilman <zachhilman@gmail.com>2018-11-19 20:24:36 +0100
commit32775125b7af14cf488fdcbc4a61c00507c2d4a5 (patch)
treea63293691dff6b54c8fec47050f435118ed3a17e /src/core/hle/service/am/applets/applets.h
parentsoftware_keyboard: Use correct offset for inital text string (diff)
downloadyuzu-32775125b7af14cf488fdcbc4a61c00507c2d4a5.tar
yuzu-32775125b7af14cf488fdcbc4a61c00507c2d4a5.tar.gz
yuzu-32775125b7af14cf488fdcbc4a61c00507c2d4a5.tar.bz2
yuzu-32775125b7af14cf488fdcbc4a61c00507c2d4a5.tar.lz
yuzu-32775125b7af14cf488fdcbc4a61c00507c2d4a5.tar.xz
yuzu-32775125b7af14cf488fdcbc4a61c00507c2d4a5.tar.zst
yuzu-32775125b7af14cf488fdcbc4a61c00507c2d4a5.zip
Diffstat (limited to '')
-rw-r--r--src/core/hle/service/am/applets/applets.h56
1 files changed, 44 insertions, 12 deletions
diff --git a/src/core/hle/service/am/applets/applets.h b/src/core/hle/service/am/applets/applets.h
index a6a9bf77b..136445649 100644
--- a/src/core/hle/service/am/applets/applets.h
+++ b/src/core/hle/service/am/applets/applets.h
@@ -8,35 +8,67 @@
#include <memory>
#include <queue>
#include "common/swap.h"
+#include "core/hle/kernel/event.h"
union ResultCode;
-namespace Frontend {
-class SoftwareKeyboardApplet;
-}
-
namespace Service::AM {
class IStorage;
namespace Applets {
-using AppletStorageProxyFunction = std::function<void(IStorage)>;
-using AppletStateProxyFunction = std::function<void()>;
+class AppletDataBroker final {
+public:
+ AppletDataBroker();
+ ~AppletDataBroker();
+
+ std::unique_ptr<IStorage> PopNormalDataToGame();
+ std::unique_ptr<IStorage> PopNormalDataToApplet();
+
+ std::unique_ptr<IStorage> PopInteractiveDataToGame();
+ std::unique_ptr<IStorage> PopInteractiveDataToApplet();
+
+ void PushNormalDataFromGame(IStorage storage);
+ void PushNormalDataFromApplet(IStorage storage);
+
+ void PushInteractiveDataFromGame(IStorage storage);
+ void PushInteractiveDataFromApplet(IStorage storage);
+
+ void SignalStateChanged() const;
+
+ Kernel::SharedPtr<Kernel::Event> GetNormalDataEvent() const;
+ Kernel::SharedPtr<Kernel::Event> GetInteractiveDataEvent() const;
+ Kernel::SharedPtr<Kernel::Event> GetStateChangedEvent() const;
+
+private:
+ // Queues are named from applet's perspective
+ std::queue<std::unique_ptr<IStorage>>
+ in_channel; // PopNormalDataToApplet and PushNormalDataFromGame
+ std::queue<std::unique_ptr<IStorage>>
+ out_channel; // PopNormalDataToGame and PushNormalDataFromApplet
+ std::queue<std::unique_ptr<IStorage>>
+ in_interactive_channel; // PopInteractiveDataToApplet and PushInteractiveDataFromGame
+ std::queue<std::unique_ptr<IStorage>>
+ out_interactive_channel; // PopInteractiveDataToGame and PushInteractiveDataFromApplet
+
+ Kernel::SharedPtr<Kernel::Event> state_changed_event;
+ Kernel::SharedPtr<Kernel::Event> pop_out_data_event; // Signaled on PushNormalDataFromApplet
+ Kernel::SharedPtr<Kernel::Event>
+ pop_interactive_out_data_event; // Signaled on PushInteractiveDataFromApplet
+};
class Applet {
public:
Applet();
virtual ~Applet();
- virtual void Initialize(std::queue<std::shared_ptr<IStorage>> storage);
+ virtual void Initialize(std::shared_ptr<AppletDataBroker> broker);
virtual bool TransactionComplete() const = 0;
virtual ResultCode GetStatus() const = 0;
- virtual void ReceiveInteractiveData(std::shared_ptr<IStorage> storage) = 0;
- virtual void Execute(AppletStorageProxyFunction out_data,
- AppletStorageProxyFunction out_interactive_data,
- AppletStateProxyFunction state) = 0;
+ virtual void ExecuteInteractive() = 0;
+ virtual void Execute() = 0;
bool IsInitialized() const {
return initialized;
@@ -54,7 +86,7 @@ protected:
static_assert(sizeof(CommonArguments) == 0x20, "CommonArguments has incorrect size.");
CommonArguments common_args;
- std::queue<std::shared_ptr<IStorage>> storage_stack;
+ std::shared_ptr<AppletDataBroker> broker;
bool initialized = false;
};