diff options
author | Subv <subv2112@gmail.com> | 2015-05-27 15:21:06 -0500 |
---|---|---|
committer | Subv <subv2112@gmail.com> | 2015-07-11 22:32:12 -0500 |
commit | 725d5eea7879fa152c51f15fd76003d3c6bc44ed (patch) | |
tree | c260c6e094467c5d6b4694283573381310c2c96c /src/core/hle/applets/applet.h | |
parent | 621ee10eae0546d4ec3f9e911e113aa9ee609c22 (diff) |
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 f50f7d60..fe537e70 100644 --- a/src/core/hle/applets/applet.h +++ b/src/core/hle/applets/applet.h @@ -12,10 +12,10 @@ namespace HLE { namespace Applets { -class Applet : public std::enable_shared_from_this<Applet> { +class Applet { public: - virtual ~Applet() {}; - Applet(Service::APT::AppletId id) : id(id) {}; + virtual ~Applet() { } + Applet(Service::APT::AppletId id) : id(id) { } /** * Creates an instance of the Applet subclass identified by the parameter. @@ -37,25 +37,33 @@ public: * @param parameter Parameter data to handle. * @returns ResultCode Whether the operation was successful or not. */ - virtual ResultCode ReceiveParameter(Service::APT::MessageParameter const& parameter) = 0; + 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. */ - virtual ResultCode Start(Service::APT::AppletStartupParameter const& parameter) = 0; + ResultCode Start(const Service::APT::AppletStartupParameter& parameter); /** * Whether the applet is currently executing instead of the host application or not. */ - virtual bool IsRunning() = 0; + 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 }; @@ -65,6 +73,5 @@ void Init(); /// Shuts down the HLE applets void Shutdown(); -extern std::shared_ptr<Applet> g_current_applet; ///< Applet that is currently executing } } // namespace |