summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar mailwl2017-01-31 12:16:58 +0300
committerGravatar Yuri Kunde Schlesner2017-01-31 01:16:58 -0800
commitd0bf7df5ba11f19314b5b08d264de79bce691a45 (patch)
tree2cec2e627b7e510084c3200ddc230cf347d3aa2b /src
parentCommon/x64: remove legacy emitter and abi (#2504) (diff)
downloadyuzu-d0bf7df5ba11f19314b5b08d264de79bce691a45.tar.gz
yuzu-d0bf7df5ba11f19314b5b08d264de79bce691a45.tar.xz
yuzu-d0bf7df5ba11f19314b5b08d264de79bce691a45.zip
HLE/Applets: Stub Mint (eShop) Applet (#2463)
This allows Phoenix Wright - Dual Destinies to boot.
Diffstat (limited to 'src')
-rw-r--r--src/core/CMakeLists.txt2
-rw-r--r--src/core/hle/applets/applet.cpp5
-rw-r--r--src/core/hle/applets/mint.cpp72
-rw-r--r--src/core/hle/applets/mint.h29
4 files changed, 108 insertions, 0 deletions
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt
index bd0e3c595..408d3a0cb 100644
--- a/src/core/CMakeLists.txt
+++ b/src/core/CMakeLists.txt
@@ -40,6 +40,7 @@ set(SRCS
40 hle/applets/applet.cpp 40 hle/applets/applet.cpp
41 hle/applets/erreula.cpp 41 hle/applets/erreula.cpp
42 hle/applets/mii_selector.cpp 42 hle/applets/mii_selector.cpp
43 hle/applets/mint.cpp
43 hle/applets/swkbd.cpp 44 hle/applets/swkbd.cpp
44 hle/kernel/address_arbiter.cpp 45 hle/kernel/address_arbiter.cpp
45 hle/kernel/client_port.cpp 46 hle/kernel/client_port.cpp
@@ -219,6 +220,7 @@ set(HEADERS
219 hle/applets/applet.h 220 hle/applets/applet.h
220 hle/applets/erreula.h 221 hle/applets/erreula.h
221 hle/applets/mii_selector.h 222 hle/applets/mii_selector.h
223 hle/applets/mint.h
222 hle/applets/swkbd.h 224 hle/applets/swkbd.h
223 hle/kernel/address_arbiter.h 225 hle/kernel/address_arbiter.h
224 hle/kernel/client_port.h 226 hle/kernel/client_port.h
diff --git a/src/core/hle/applets/applet.cpp b/src/core/hle/applets/applet.cpp
index 645b2d5fe..9c43ed2fd 100644
--- a/src/core/hle/applets/applet.cpp
+++ b/src/core/hle/applets/applet.cpp
@@ -12,6 +12,7 @@
12#include "core/hle/applets/applet.h" 12#include "core/hle/applets/applet.h"
13#include "core/hle/applets/erreula.h" 13#include "core/hle/applets/erreula.h"
14#include "core/hle/applets/mii_selector.h" 14#include "core/hle/applets/mii_selector.h"
15#include "core/hle/applets/mint.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"
@@ -56,6 +57,10 @@ ResultCode Applet::Create(Service::APT::AppletId id) {
56 case Service::APT::AppletId::Error2: 57 case Service::APT::AppletId::Error2:
57 applets[id] = std::make_shared<ErrEula>(id); 58 applets[id] = std::make_shared<ErrEula>(id);
58 break; 59 break;
60 case Service::APT::AppletId::Mint:
61 case Service::APT::AppletId::Mint2:
62 applets[id] = std::make_shared<Mint>(id);
63 break;
59 default: 64 default:
60 LOG_ERROR(Service_APT, "Could not create applet %u", id); 65 LOG_ERROR(Service_APT, "Could not create applet %u", id);
61 // TODO(Subv): Find the right error code 66 // TODO(Subv): Find the right error code
diff --git a/src/core/hle/applets/mint.cpp b/src/core/hle/applets/mint.cpp
new file mode 100644
index 000000000..31a79ea17
--- /dev/null
+++ b/src/core/hle/applets/mint.cpp
@@ -0,0 +1,72 @@
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 "common/string_util.h"
6#include "core/hle/applets/mint.h"
7#include "core/hle/service/apt/apt.h"
8
9namespace HLE {
10namespace Applets {
11
12ResultCode Mint::ReceiveParameter(const Service::APT::MessageParameter& parameter) {
13 if (parameter.signal != static_cast<u32>(Service::APT::SignalType::Request)) {
14 LOG_ERROR(Service_APT, "unsupported signal %u", parameter.signal);
15 UNIMPLEMENTED();
16 // TODO(Subv): Find the right error code
17 return ResultCode(-1);
18 }
19
20 // The Request message contains a buffer with the size of the framebuffer shared
21 // memory.
22 // Create the SharedMemory that will hold the framebuffer data
23 Service::APT::CaptureBufferInfo capture_info;
24 ASSERT(sizeof(capture_info) == parameter.buffer.size());
25
26 memcpy(&capture_info, parameter.buffer.data(), sizeof(capture_info));
27
28 // TODO: allocated memory never released
29 using Kernel::MemoryPermission;
30 // Allocate a heap block of the required size for this applet.
31 heap_memory = std::make_shared<std::vector<u8>>(capture_info.size);
32 // Create a SharedMemory that directly points to this heap block.
33 framebuffer_memory = Kernel::SharedMemory::CreateForApplet(
34 heap_memory, 0, heap_memory->size(), MemoryPermission::ReadWrite,
35 MemoryPermission::ReadWrite, "Mint Memory");
36
37 // Send the response message with the newly created SharedMemory
38 Service::APT::MessageParameter result;
39 result.signal = static_cast<u32>(Service::APT::SignalType::Response);
40 result.buffer.clear();
41 result.destination_id = static_cast<u32>(Service::APT::AppletId::Application);
42 result.sender_id = static_cast<u32>(id);
43 result.object = framebuffer_memory;
44
45 Service::APT::SendParameter(result);
46 return RESULT_SUCCESS;
47}
48
49ResultCode Mint::StartImpl(const Service::APT::AppletStartupParameter& parameter) {
50 is_running = true;
51
52 // TODO(Subv): Set the expected fields in the response buffer before resending it to the
53 // application.
54 // TODO(Subv): Reverse the parameter format for the Mint applet
55
56 // Let the application know that we're closing
57 Service::APT::MessageParameter message;
58 message.buffer.resize(parameter.buffer.size());
59 std::fill(message.buffer.begin(), message.buffer.end(), 0);
60 message.signal = static_cast<u32>(Service::APT::SignalType::WakeupByExit);
61 message.destination_id = static_cast<u32>(Service::APT::AppletId::Application);
62 message.sender_id = static_cast<u32>(id);
63 Service::APT::SendParameter(message);
64
65 is_running = false;
66 return RESULT_SUCCESS;
67}
68
69void Mint::Update() {}
70
71} // namespace Applets
72} // namespace HLE
diff --git a/src/core/hle/applets/mint.h b/src/core/hle/applets/mint.h
new file mode 100644
index 000000000..d23dc40f9
--- /dev/null
+++ b/src/core/hle/applets/mint.h
@@ -0,0 +1,29 @@
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 "core/hle/applets/applet.h"
8#include "core/hle/kernel/shared_memory.h"
9
10namespace HLE {
11namespace Applets {
12
13class Mint final : public Applet {
14public:
15 explicit Mint(Service::APT::AppletId id) : Applet(id) {}
16
17 ResultCode ReceiveParameter(const Service::APT::MessageParameter& parameter) override;
18 ResultCode StartImpl(const Service::APT::AppletStartupParameter& parameter) override;
19 void Update() override;
20
21private:
22 /// This SharedMemory will be created when we receive the Request message.
23 /// It holds the framebuffer info retrieved by the application with
24 /// GSPGPU::ImportDisplayCaptureInfo
25 Kernel::SharedPtr<Kernel::SharedMemory> framebuffer_memory;
26};
27
28} // namespace Applets
29} // namespace HLE