diff options
| author | 2015-07-11 23:56:59 -0400 | |
|---|---|---|
| committer | 2015-07-11 23:56:59 -0400 | |
| commit | f4e1d8ea36fc3f8309234b8a4a8c9f659b171c80 (patch) | |
| tree | 8756cd27489dcb424103e443836b6ea8dba3fccd /src/core/hle/applets/applet.h | |
| parent | Merge pull request #912 from yuriks/process-loading (diff) | |
| parent | Applets: Reworked how the Applet update event is handled. (diff) | |
| download | yuzu-f4e1d8ea36fc3f8309234b8a4a8c9f659b171c80.tar.gz yuzu-f4e1d8ea36fc3f8309234b8a4a8c9f659b171c80.tar.xz yuzu-f4e1d8ea36fc3f8309234b8a4a8c9f659b171c80.zip | |
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.h | 77 |
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 @@ | |||
| 1 | // Copyright 2015 Citra Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #pragma once | ||
| 6 | |||
| 7 | #include "common/common_types.h" | ||
| 8 | #include "core/hle/kernel/kernel.h" | ||
| 9 | #include "core/hle/kernel/shared_memory.h" | ||
| 10 | #include "core/hle/service/apt/apt.h" | ||
| 11 | |||
| 12 | namespace HLE { | ||
| 13 | namespace Applets { | ||
| 14 | |||
| 15 | class Applet { | ||
| 16 | public: | ||
| 17 | virtual ~Applet() { } | ||
| 18 | Applet(Service::APT::AppletId id) : id(id) { } | ||
| 19 | |||
| 20 | /** | ||
| 21 | * Creates an instance of the Applet subclass identified by the parameter. | ||
| 22 | * and stores it in a global map. | ||
| 23 | * @param id Id of the applet to create. | ||
| 24 | * @returns ResultCode Whether the operation was successful or not. | ||
| 25 | */ | ||
| 26 | static ResultCode Create(Service::APT::AppletId id); | ||
| 27 | |||
| 28 | /** | ||
| 29 | * Retrieves the Applet instance identified by the specified id. | ||
| 30 | * @param id Id of the Applet to retrieve. | ||
| 31 | * @returns Requested Applet or nullptr if not found. | ||
| 32 | */ | ||
| 33 | static std::shared_ptr<Applet> Get(Service::APT::AppletId id); | ||
| 34 | |||
| 35 | /** | ||
| 36 | * Handles a parameter from the application. | ||
| 37 | * @param parameter Parameter data to handle. | ||
| 38 | * @returns ResultCode Whether the operation was successful or not. | ||
| 39 | */ | ||
| 40 | virtual ResultCode ReceiveParameter(const Service::APT::MessageParameter& parameter) = 0; | ||
| 41 | |||
| 42 | /** | ||
| 43 | * Handles the Applet start event, triggered from the application. | ||
| 44 | * @param parameter Parameter data to handle. | ||
| 45 | * @returns ResultCode Whether the operation was successful or not. | ||
| 46 | */ | ||
| 47 | ResultCode Start(const Service::APT::AppletStartupParameter& parameter); | ||
| 48 | |||
| 49 | /** | ||
| 50 | * Whether the applet is currently executing instead of the host application or not. | ||
| 51 | */ | ||
| 52 | virtual bool IsRunning() const = 0; | ||
| 53 | |||
| 54 | /** | ||
| 55 | * Handles an update tick for the Applet, lets it update the screen, send commands, etc. | ||
| 56 | */ | ||
| 57 | virtual void Update() = 0; | ||
| 58 | |||
| 59 | protected: | ||
| 60 | /** | ||
| 61 | * Handles the Applet start event, triggered from the application. | ||
| 62 | * @param parameter Parameter data to handle. | ||
| 63 | * @returns ResultCode Whether the operation was successful or not. | ||
| 64 | */ | ||
| 65 | virtual ResultCode StartImpl(const Service::APT::AppletStartupParameter& parameter) = 0; | ||
| 66 | |||
| 67 | Service::APT::AppletId id; ///< Id of this Applet | ||
| 68 | }; | ||
| 69 | |||
| 70 | /// Initializes the HLE applets | ||
| 71 | void Init(); | ||
| 72 | |||
| 73 | /// Shuts down the HLE applets | ||
| 74 | void Shutdown(); | ||
| 75 | |||
| 76 | } | ||
| 77 | } // namespace | ||