diff options
| author | 2015-05-27 15:21:06 -0500 | |
|---|---|---|
| committer | 2015-07-11 22:32:12 -0500 | |
| commit | 725d5eea7879fa152c51f15fd76003d3c6bc44ed (patch) | |
| tree | c260c6e094467c5d6b4694283573381310c2c96c /src/core/hle/applets/applet.h | |
| parent | Applets: Add infrastructure to allow custom drawing and input handling in App... (diff) | |
| download | yuzu-725d5eea7879fa152c51f15fd76003d3c6bc44ed.tar.gz yuzu-725d5eea7879fa152c51f15fd76003d3c6bc44ed.tar.xz yuzu-725d5eea7879fa152c51f15fd76003d3c6bc44ed.zip | |
Applets: Reworked how the Applet update event is handled.
Applets are now cleaned up in AppletUpdateEvent after calling their respective Update method.
Diffstat (limited to 'src/core/hle/applets/applet.h')
| -rw-r--r-- | src/core/hle/applets/applet.h | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/src/core/hle/applets/applet.h b/src/core/hle/applets/applet.h index f50f7d604..fe537e70d 100644 --- a/src/core/hle/applets/applet.h +++ b/src/core/hle/applets/applet.h | |||
| @@ -12,10 +12,10 @@ | |||
| 12 | namespace HLE { | 12 | namespace HLE { |
| 13 | namespace Applets { | 13 | namespace Applets { |
| 14 | 14 | ||
| 15 | class Applet : public std::enable_shared_from_this<Applet> { | 15 | class Applet { |
| 16 | public: | 16 | public: |
| 17 | virtual ~Applet() {}; | 17 | virtual ~Applet() { } |
| 18 | Applet(Service::APT::AppletId id) : id(id) {}; | 18 | Applet(Service::APT::AppletId id) : id(id) { } |
| 19 | 19 | ||
| 20 | /** | 20 | /** |
| 21 | * Creates an instance of the Applet subclass identified by the parameter. | 21 | * Creates an instance of the Applet subclass identified by the parameter. |
| @@ -37,25 +37,33 @@ public: | |||
| 37 | * @param parameter Parameter data to handle. | 37 | * @param parameter Parameter data to handle. |
| 38 | * @returns ResultCode Whether the operation was successful or not. | 38 | * @returns ResultCode Whether the operation was successful or not. |
| 39 | */ | 39 | */ |
| 40 | virtual ResultCode ReceiveParameter(Service::APT::MessageParameter const& parameter) = 0; | 40 | virtual ResultCode ReceiveParameter(const Service::APT::MessageParameter& parameter) = 0; |
| 41 | 41 | ||
| 42 | /** | 42 | /** |
| 43 | * Handles the Applet start event, triggered from the application. | 43 | * Handles the Applet start event, triggered from the application. |
| 44 | * @param parameter Parameter data to handle. | 44 | * @param parameter Parameter data to handle. |
| 45 | * @returns ResultCode Whether the operation was successful or not. | 45 | * @returns ResultCode Whether the operation was successful or not. |
| 46 | */ | 46 | */ |
| 47 | virtual ResultCode Start(Service::APT::AppletStartupParameter const& parameter) = 0; | 47 | ResultCode Start(const Service::APT::AppletStartupParameter& parameter); |
| 48 | 48 | ||
| 49 | /** | 49 | /** |
| 50 | * Whether the applet is currently executing instead of the host application or not. | 50 | * Whether the applet is currently executing instead of the host application or not. |
| 51 | */ | 51 | */ |
| 52 | virtual bool IsRunning() = 0; | 52 | virtual bool IsRunning() const = 0; |
| 53 | 53 | ||
| 54 | /** | 54 | /** |
| 55 | * Handles an update tick for the Applet, lets it update the screen, send commands, etc. | 55 | * Handles an update tick for the Applet, lets it update the screen, send commands, etc. |
| 56 | */ | 56 | */ |
| 57 | virtual void Update() = 0; | 57 | virtual void Update() = 0; |
| 58 | 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 | |||
| 59 | Service::APT::AppletId id; ///< Id of this Applet | 67 | Service::APT::AppletId id; ///< Id of this Applet |
| 60 | }; | 68 | }; |
| 61 | 69 | ||
| @@ -65,6 +73,5 @@ void Init(); | |||
| 65 | /// Shuts down the HLE applets | 73 | /// Shuts down the HLE applets |
| 66 | void Shutdown(); | 74 | void Shutdown(); |
| 67 | 75 | ||
| 68 | extern std::shared_ptr<Applet> g_current_applet; ///< Applet that is currently executing | ||
| 69 | } | 76 | } |
| 70 | } // namespace | 77 | } // namespace |