summaryrefslogtreecommitdiff
path: root/src/core/hle/applets
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/hle/applets')
-rw-r--r--src/core/hle/applets/applet.cpp6
-rw-r--r--src/core/hle/applets/mii_selector.cpp75
-rw-r--r--src/core/hle/applets/mii_selector.h37
3 files changed, 118 insertions, 0 deletions
diff --git a/src/core/hle/applets/applet.cpp b/src/core/hle/applets/applet.cpp
index bc2a1829e..90e134437 100644
--- a/src/core/hle/applets/applet.cpp
+++ b/src/core/hle/applets/applet.cpp
@@ -12,6 +12,7 @@
12 12
13#include "core/core_timing.h" 13#include "core/core_timing.h"
14#include "core/hle/applets/applet.h" 14#include "core/hle/applets/applet.h"
15#include "core/hle/applets/mii_selector.h"
15#include "core/hle/applets/swkbd.h" 16#include "core/hle/applets/swkbd.h"
16#include "core/hle/result.h" 17#include "core/hle/result.h"
17#include "core/hle/service/apt/apt.h" 18#include "core/hle/service/apt/apt.h"
@@ -47,7 +48,12 @@ ResultCode Applet::Create(Service::APT::AppletId id) {
47 case Service::APT::AppletId::SoftwareKeyboard2: 48 case Service::APT::AppletId::SoftwareKeyboard2:
48 applets[id] = std::make_shared<SoftwareKeyboard>(id); 49 applets[id] = std::make_shared<SoftwareKeyboard>(id);
49 break; 50 break;
51 case Service::APT::AppletId::Ed1:
52 case Service::APT::AppletId::Ed2:
53 applets[id] = std::make_shared<MiiSelector>(id);
54 break;
50 default: 55 default:
56 LOG_ERROR(Service_APT, "Could not create applet %u", id);
51 // TODO(Subv): Find the right error code 57 // TODO(Subv): Find the right error code
52 return ResultCode(ErrorDescription::NotFound, ErrorModule::Applet, ErrorSummary::NotSupported, ErrorLevel::Permanent); 58 return ResultCode(ErrorDescription::NotFound, ErrorModule::Applet, ErrorSummary::NotSupported, ErrorLevel::Permanent);
53 } 59 }
diff --git a/src/core/hle/applets/mii_selector.cpp b/src/core/hle/applets/mii_selector.cpp
new file mode 100644
index 000000000..708d2f630
--- /dev/null
+++ b/src/core/hle/applets/mii_selector.cpp
@@ -0,0 +1,75 @@
1// Copyright 2016 Citra Emulator Project
2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included.
4
5#include <cstring>
6#include <string>
7
8#include "common/assert.h"
9#include "common/logging/log.h"
10#include "common/string_util.h"
11
12#include "core/hle/applets/mii_selector.h"
13#include "core/hle/kernel/kernel.h"
14#include "core/hle/kernel/shared_memory.h"
15#include "core/hle/result.h"
16
17#include "video_core/video_core.h"
18
19////////////////////////////////////////////////////////////////////////////////////////////////////
20
21namespace HLE {
22namespace Applets {
23
24MiiSelector::MiiSelector(Service::APT::AppletId id) : Applet(id), started(false) {
25 // Create the SharedMemory that will hold the framebuffer data
26 // TODO(Subv): What size should we use here?
27 using Kernel::MemoryPermission;
28 framebuffer_memory = Kernel::SharedMemory::Create(0x1000, MemoryPermission::ReadWrite, MemoryPermission::ReadWrite, "MiiSelector Memory");
29}
30
31ResultCode MiiSelector::ReceiveParameter(const Service::APT::MessageParameter& parameter) {
32 if (parameter.signal != static_cast<u32>(Service::APT::SignalType::LibAppJustStarted)) {
33 LOG_ERROR(Service_APT, "unsupported signal %u", parameter.signal);
34 UNIMPLEMENTED();
35 // TODO(Subv): Find the right error code
36 return ResultCode(-1);
37 }
38
39 Service::APT::MessageParameter result;
40 // The buffer passed in parameter contains the data returned by GSPGPU::ImportDisplayCaptureInfo
41 result.signal = static_cast<u32>(Service::APT::SignalType::LibAppFinished);
42 result.data = nullptr;
43 result.buffer_size = 0;
44 result.destination_id = static_cast<u32>(Service::APT::AppletId::Application);
45 result.sender_id = static_cast<u32>(id);
46 result.object = framebuffer_memory;
47
48 Service::APT::SendParameter(result);
49 return RESULT_SUCCESS;
50}
51
52ResultCode MiiSelector::StartImpl(const Service::APT::AppletStartupParameter& parameter) {
53 started = true;
54
55 // TODO(Subv): Set the expected fields in the response buffer before resending it to the application.
56 // TODO(Subv): Reverse the parameter format for the Mii Selector
57
58 // Let the application know that we're closing
59 Service::APT::MessageParameter message;
60 message.buffer_size = parameter.buffer_size;
61 message.data = parameter.data;
62 message.signal = static_cast<u32>(Service::APT::SignalType::LibAppClosed);
63 message.destination_id = static_cast<u32>(Service::APT::AppletId::Application);
64 message.sender_id = static_cast<u32>(id);
65 Service::APT::SendParameter(message);
66
67 started = false;
68 return RESULT_SUCCESS;
69}
70
71void MiiSelector::Update() {
72}
73
74}
75} // namespace
diff --git a/src/core/hle/applets/mii_selector.h b/src/core/hle/applets/mii_selector.h
new file mode 100644
index 000000000..6a3e7c8eb
--- /dev/null
+++ b/src/core/hle/applets/mii_selector.h
@@ -0,0 +1,37 @@
1// Copyright 2016 Citra Emulator Project
2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included.
4
5#pragma once
6
7#include "common/common_types.h"
8#include "common/common_funcs.h"
9
10#include "core/hle/applets/applet.h"
11#include "core/hle/kernel/kernel.h"
12#include "core/hle/kernel/shared_memory.h"
13#include "core/hle/result.h"
14#include "core/hle/service/apt/apt.h"
15
16namespace HLE {
17namespace Applets {
18
19class MiiSelector final : public Applet {
20public:
21 MiiSelector(Service::APT::AppletId id);
22
23 ResultCode ReceiveParameter(const Service::APT::MessageParameter& parameter) override;
24 ResultCode StartImpl(const Service::APT::AppletStartupParameter& parameter) override;
25 void Update() override;
26 bool IsRunning() const override { return started; }
27
28 /// TODO(Subv): Find out what this is actually used for.
29 /// It is believed that the application stores the current screen image here.
30 Kernel::SharedPtr<Kernel::SharedMemory> framebuffer_memory;
31
32 /// Whether this applet is currently running instead of the host application or not.
33 bool started;
34};
35
36}
37} // namespace