diff options
author | Subv <subv2112@gmail.com> | 2015-05-25 23:30:20 -0500 |
---|---|---|
committer | Subv <subv2112@gmail.com> | 2015-07-11 21:47:22 -0500 |
commit | 2a6ebadf66051362cdcf07d722f7e2d3cee14c82 (patch) | |
tree | f016b2ee81df95aabccc426762c42073d645803c /src/core/hle/applets/applet.cpp | |
parent | b0d72e3de1ec2350716300c86bc02930893e9e23 (diff) |
HLE/APT: Initial HLE support for applets.
Currently only the SWKBD is emulated, and there's currently no way to ask the user for input, so it always returns "Subv" as the text.
Diffstat (limited to 'src/core/hle/applets/applet.cpp')
-rw-r--r-- | src/core/hle/applets/applet.cpp | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/core/hle/applets/applet.cpp b/src/core/hle/applets/applet.cpp new file mode 100644 index 00000000..1f447e5f --- /dev/null +++ b/src/core/hle/applets/applet.cpp @@ -0,0 +1,40 @@ +// Copyright 2015 Citra Emulator Project +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#include "common/assert.h" +#include "common/logging/log.h" + +#include "core/hle/applets/applet.h" +#include "core/hle/applets/swkbd.h" + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +namespace HLE { +namespace Applets { + +static std::unordered_map<Service::APT::AppletId, std::shared_ptr<Applet>> applets; + +ResultCode Applet::Create(Service::APT::AppletId id) { + switch (id) { + case Service::APT::AppletId::SoftwareKeyboard1: + case Service::APT::AppletId::SoftwareKeyboard2: + applets[id] = std::make_shared<SoftwareKeyboard>(id); + break; + default: + // TODO(Subv): Find the right error code + return ResultCode(ErrorDescription::NotFound, ErrorModule::Applet, ErrorSummary::NotSupported, ErrorLevel::Permanent); + } + + return RESULT_SUCCESS; +} + +std::shared_ptr<Applet> Applet::Get(Service::APT::AppletId id) { + auto itr = applets.find(id); + if (itr != applets.end()) + return itr->second; + return nullptr; +} + +} +} // namespace |