aboutsummaryrefslogtreecommitdiff
path: root/src/core/hle/applets/applet.h
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2015-07-11 23:56:59 -0400
committerbunnei <bunneidev@gmail.com>2015-07-11 23:56:59 -0400
commitf4e1d8ea36fc3f8309234b8a4a8c9f659b171c80 (patch)
tree8756cd27489dcb424103e443836b6ea8dba3fccd /src/core/hle/applets/applet.h
parent4e900d56f3dd2b5c9871b523689322028123d891 (diff)
parent725d5eea7879fa152c51f15fd76003d3c6bc44ed (diff)
Merge pull request #823 from Subv/applets_drawing
Library applet support (swkbd for now)
Diffstat (limited to 'src/core/hle/applets/applet.h')
-rw-r--r--src/core/hle/applets/applet.h77
1 files changed, 77 insertions, 0 deletions
diff --git a/src/core/hle/applets/applet.h b/src/core/hle/applets/applet.h
new file mode 100644
index 000000000..fe537e70d
--- /dev/null
+++ b/src/core/hle/applets/applet.h
@@ -0,0 +1,77 @@
+// Copyright 2015 Citra Emulator Project
+// Licensed under GPLv2 or any later version
+// Refer to the license.txt file included.
+
+#pragma once
+
+#include "common/common_types.h"
+#include "core/hle/kernel/kernel.h"
+#include "core/hle/kernel/shared_memory.h"
+#include "core/hle/service/apt/apt.h"
+
+namespace HLE {
+namespace Applets {
+
+class Applet {
+public:
+ virtual ~Applet() { }
+ Applet(Service::APT::AppletId id) : id(id) { }
+
+ /**
+ * Creates an instance of the Applet subclass identified by the parameter.
+ * and stores it in a global map.
+ * @param id Id of the applet to create.
+ * @returns ResultCode Whether the operation was successful or not.
+ */
+ static ResultCode Create(Service::APT::AppletId id);
+
+ /**
+ * Retrieves the Applet instance identified by the specified id.
+ * @param id Id of the Applet to retrieve.
+ * @returns Requested Applet or nullptr if not found.
+ */
+ static std::shared_ptr<Applet> Get(Service::APT::AppletId id);
+
+ /**
+ * Handles a parameter from the application.
+ * @param parameter Parameter data to handle.
+ * @returns ResultCode Whether the operation was successful or not.
+ */
+ virtual ResultCode ReceiveParameter(const Service::APT::MessageParameter& parameter) = 0;
+
+ /**
+ * Handles the Applet start event, triggered from the application.
+ * @param parameter Parameter data to handle.
+ * @returns ResultCode Whether the operation was successful or not.
+ */
+ ResultCode Start(const Service::APT::AppletStartupParameter& parameter);
+
+ /**
+ * Whether the applet is currently executing instead of the host application or not.
+ */
+ virtual bool IsRunning() const = 0;
+
+ /**
+ * Handles an update tick for the Applet, lets it update the screen, send commands, etc.
+ */
+ virtual void Update() = 0;
+
+protected:
+ /**
+ * Handles the Applet start event, triggered from the application.
+ * @param parameter Parameter data to handle.
+ * @returns ResultCode Whether the operation was successful or not.
+ */
+ virtual ResultCode StartImpl(const Service::APT::AppletStartupParameter& parameter) = 0;
+
+ Service::APT::AppletId id; ///< Id of this Applet
+};
+
+/// Initializes the HLE applets
+void Init();
+
+/// Shuts down the HLE applets
+void Shutdown();
+
+}
+} // namespace