From 725d5eea7879fa152c51f15fd76003d3c6bc44ed Mon Sep 17 00:00:00 2001 From: Subv Date: Wed, 27 May 2015 15:21:06 -0500 Subject: Applets: Reworked how the Applet update event is handled. Applets are now cleaned up in AppletUpdateEvent after calling their respective Update method. --- src/core/hle/applets/swkbd.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'src/core/hle/applets/swkbd.cpp') diff --git a/src/core/hle/applets/swkbd.cpp b/src/core/hle/applets/swkbd.cpp index b800e0eb..7431ebcf 100644 --- a/src/core/hle/applets/swkbd.cpp +++ b/src/core/hle/applets/swkbd.cpp @@ -4,6 +4,7 @@ #include "common/assert.h" #include "common/logging/log.h" +#include "common/string_util.h" #include "core/hle/applets/swkbd.h" #include "core/hle/service/hid/hid.h" @@ -33,7 +34,7 @@ ResultCode SoftwareKeyboard::ReceiveParameter(Service::APT::MessageParameter con Service::APT::MessageParameter result; // The buffer passed in parameter contains the data returned by GSPGPU::ImportDisplayCaptureInfo result.signal = static_cast(Service::APT::SignalType::LibAppFinished); - result.data = nullptr; + result.data = nullptr; result.buffer_size = 0; result.destination_id = static_cast(Service::APT::AppletId::Application); result.sender_id = static_cast(id); @@ -43,7 +44,9 @@ ResultCode SoftwareKeyboard::ReceiveParameter(Service::APT::MessageParameter con return RESULT_SUCCESS; } -ResultCode SoftwareKeyboard::Start(Service::APT::AppletStartupParameter const& parameter) { +ResultCode SoftwareKeyboard::StartImpl(Service::APT::AppletStartupParameter const& parameter) { + ASSERT_MSG(parameter.buffer_size == sizeof(config), "The size of the parameter (SoftwareKeyboardConfig) is wrong"); + memcpy(&config, parameter.data, parameter.buffer_size); text_memory = boost::static_pointer_cast(parameter.object); @@ -52,9 +55,7 @@ ResultCode SoftwareKeyboard::Start(Service::APT::AppletStartupParameter const& p DrawScreenKeyboard(); - // Update the current applet so we can get update events started = true; - g_current_applet = shared_from_this(); return RESULT_SUCCESS; } @@ -72,7 +73,7 @@ void SoftwareKeyboard::Update() { config.text_length = 6; config.text_offset = 0; - // TODO(Subv): We're finalizing the applet immediately after it's started, + // TODO(Subv): We're finalizing the applet immediately after it's started, // but we should defer this call until after all the input has been collected. Finalize(); } @@ -98,8 +99,6 @@ void SoftwareKeyboard::Finalize() { Service::APT::SendParameter(message); started = false; - // Unset the current applet, we are not running anymore - g_current_applet = nullptr; } } -- cgit v1.2.3