summaryrefslogtreecommitdiff
path: root/src/core/hle/applets/applet.cpp
diff options
context:
space:
mode:
authorGravatar Subv2015-05-25 23:30:20 -0500
committerGravatar Subv2015-07-11 21:47:22 -0500
commit2a6ebadf66051362cdcf07d722f7e2d3cee14c82 (patch)
treef016b2ee81df95aabccc426762c42073d645803c /src/core/hle/applets/applet.cpp
parentMerge pull request #914 from yuriks/bitfield-mask (diff)
downloadyuzu-2a6ebadf66051362cdcf07d722f7e2d3cee14c82.tar.gz
yuzu-2a6ebadf66051362cdcf07d722f7e2d3cee14c82.tar.xz
yuzu-2a6ebadf66051362cdcf07d722f7e2d3cee14c82.zip
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.cpp40
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 000000000..1f447e5fc
--- /dev/null
+++ b/src/core/hle/applets/applet.cpp
@@ -0,0 +1,40 @@
1// Copyright 2015 Citra Emulator Project
2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included.
4
5#include "common/assert.h"
6#include "common/logging/log.h"
7
8#include "core/hle/applets/applet.h"
9#include "core/hle/applets/swkbd.h"
10
11////////////////////////////////////////////////////////////////////////////////////////////////////
12
13namespace HLE {
14namespace Applets {
15
16static std::unordered_map<Service::APT::AppletId, std::shared_ptr<Applet>> applets;
17
18ResultCode Applet::Create(Service::APT::AppletId id) {
19 switch (id) {
20 case Service::APT::AppletId::SoftwareKeyboard1:
21 case Service::APT::AppletId::SoftwareKeyboard2:
22 applets[id] = std::make_shared<SoftwareKeyboard>(id);
23 break;
24 default:
25 // TODO(Subv): Find the right error code
26 return ResultCode(ErrorDescription::NotFound, ErrorModule::Applet, ErrorSummary::NotSupported, ErrorLevel::Permanent);
27 }
28
29 return RESULT_SUCCESS;
30}
31
32std::shared_ptr<Applet> Applet::Get(Service::APT::AppletId id) {
33 auto itr = applets.find(id);
34 if (itr != applets.end())
35 return itr->second;
36 return nullptr;
37}
38
39}
40} // namespace