summaryrefslogtreecommitdiffstats
path: root/src/core/hle/applets
diff options
context:
space:
mode:
authorMerryMage <MerryMage@users.noreply.github.com>2016-04-16 12:18:49 +0200
committerSubv <subv2112@gmail.com>2016-05-21 18:14:12 +0200
commitfddd243b17edb0fe03ef1a85c2abdf95353a534d (patch)
treec3e6a15cc40b4516fcf0f0a485261777f7d01f8e /src/core/hle/applets
parentKernel/Thread: Remove use of Memory::GetPointer (diff)
downloadyuzu-fddd243b17edb0fe03ef1a85c2abdf95353a534d.tar
yuzu-fddd243b17edb0fe03ef1a85c2abdf95353a534d.tar.gz
yuzu-fddd243b17edb0fe03ef1a85c2abdf95353a534d.tar.bz2
yuzu-fddd243b17edb0fe03ef1a85c2abdf95353a534d.tar.lz
yuzu-fddd243b17edb0fe03ef1a85c2abdf95353a534d.tar.xz
yuzu-fddd243b17edb0fe03ef1a85c2abdf95353a534d.tar.zst
yuzu-fddd243b17edb0fe03ef1a85c2abdf95353a534d.zip
Diffstat (limited to 'src/core/hle/applets')
-rw-r--r--src/core/hle/applets/mii_selector.cpp21
-rw-r--r--src/core/hle/applets/mii_selector.h4
-rw-r--r--src/core/hle/applets/swkbd.cpp15
3 files changed, 21 insertions, 19 deletions
diff --git a/src/core/hle/applets/mii_selector.cpp b/src/core/hle/applets/mii_selector.cpp
index bf39eca22..77f01d208 100644
--- a/src/core/hle/applets/mii_selector.cpp
+++ b/src/core/hle/applets/mii_selector.cpp
@@ -32,9 +32,9 @@ ResultCode MiiSelector::ReceiveParameter(const Service::APT::MessageParameter& p
// The LibAppJustStarted message contains a buffer with the size of the framebuffer shared memory.
// Create the SharedMemory that will hold the framebuffer data
Service::APT::CaptureBufferInfo capture_info;
- ASSERT(sizeof(capture_info) == parameter.buffer_size);
+ ASSERT(sizeof(capture_info) == parameter.buffer.size());
- memcpy(&capture_info, parameter.data, sizeof(capture_info));
+ memcpy(&capture_info, parameter.buffer.data(), sizeof(capture_info));
using Kernel::MemoryPermission;
// Allocate a heap block of the required size for this applet.
@@ -47,8 +47,7 @@ ResultCode MiiSelector::ReceiveParameter(const Service::APT::MessageParameter& p
// Send the response message with the newly created SharedMemory
Service::APT::MessageParameter result;
result.signal = static_cast<u32>(Service::APT::SignalType::LibAppFinished);
- result.data = nullptr;
- result.buffer_size = 0;
+ result.buffer.clear();
result.destination_id = static_cast<u32>(Service::APT::AppletId::Application);
result.sender_id = static_cast<u32>(id);
result.object = framebuffer_memory;
@@ -63,15 +62,17 @@ ResultCode MiiSelector::StartImpl(const Service::APT::AppletStartupParameter& pa
// TODO(Subv): Set the expected fields in the response buffer before resending it to the application.
// TODO(Subv): Reverse the parameter format for the Mii Selector
- if(parameter.buffer_size >= sizeof(u32)) {
- // TODO: defaults return no error, but garbage in other unknown fields
- memset(parameter.data, 0, sizeof(u32));
- }
+ memcpy(&config, parameter.buffer.data(), parameter.buffer.size());
+
+ // TODO(Subv): Find more about this structure, result code 0 is enough to let most games continue.
+ MiiResult result;
+ memset(&result, 0, sizeof(result));
+ result.result_code = 0;
// Let the application know that we're closing
Service::APT::MessageParameter message;
- message.buffer_size = parameter.buffer_size;
- message.data = parameter.data;
+ message.buffer.resize(sizeof(MiiResult));
+ std::memcpy(message.buffer.data(), &result, message.buffer.size());
message.signal = static_cast<u32>(Service::APT::SignalType::LibAppClosed);
message.destination_id = static_cast<u32>(Service::APT::AppletId::Application);
message.sender_id = static_cast<u32>(id);
diff --git a/src/core/hle/applets/mii_selector.h b/src/core/hle/applets/mii_selector.h
index be6b04642..24e8e721d 100644
--- a/src/core/hle/applets/mii_selector.h
+++ b/src/core/hle/applets/mii_selector.h
@@ -24,7 +24,7 @@ struct MiiConfig {
u8 unk_004;
INSERT_PADDING_BYTES(3);
u16 unk_008;
- INSERT_PADDING_BYTES(0x8C - 0xA);
+ INSERT_PADDING_BYTES(0x82);
u8 unk_08C;
INSERT_PADDING_BYTES(3);
u16 unk_090;
@@ -75,6 +75,8 @@ public:
/// Whether this applet is currently running instead of the host application or not.
bool started;
+
+ MiiConfig config;
};
}
diff --git a/src/core/hle/applets/swkbd.cpp b/src/core/hle/applets/swkbd.cpp
index 3ad950692..d87bf3d57 100644
--- a/src/core/hle/applets/swkbd.cpp
+++ b/src/core/hle/applets/swkbd.cpp
@@ -35,9 +35,9 @@ ResultCode SoftwareKeyboard::ReceiveParameter(Service::APT::MessageParameter con
// The LibAppJustStarted message contains a buffer with the size of the framebuffer shared memory.
// Create the SharedMemory that will hold the framebuffer data
Service::APT::CaptureBufferInfo capture_info;
- ASSERT(sizeof(capture_info) == parameter.buffer_size);
+ ASSERT(sizeof(capture_info) == parameter.buffer.size());
- memcpy(&capture_info, parameter.data, sizeof(capture_info));
+ memcpy(&capture_info, parameter.buffer.data(), sizeof(capture_info));
using Kernel::MemoryPermission;
// Allocate a heap block of the required size for this applet.
@@ -50,8 +50,7 @@ ResultCode SoftwareKeyboard::ReceiveParameter(Service::APT::MessageParameter con
// Send the response message with the newly created SharedMemory
Service::APT::MessageParameter result;
result.signal = static_cast<u32>(Service::APT::SignalType::LibAppFinished);
- result.data = nullptr;
- result.buffer_size = 0;
+ result.buffer.clear();
result.destination_id = static_cast<u32>(Service::APT::AppletId::Application);
result.sender_id = static_cast<u32>(id);
result.object = framebuffer_memory;
@@ -61,9 +60,9 @@ ResultCode SoftwareKeyboard::ReceiveParameter(Service::APT::MessageParameter con
}
ResultCode SoftwareKeyboard::StartImpl(Service::APT::AppletStartupParameter const& parameter) {
- ASSERT_MSG(parameter.buffer_size == sizeof(config), "The size of the parameter (SoftwareKeyboardConfig) is wrong");
+ ASSERT_MSG(parameter.buffer.size() == sizeof(config), "The size of the parameter (SoftwareKeyboardConfig) is wrong");
- memcpy(&config, parameter.data, parameter.buffer_size);
+ memcpy(&config, parameter.buffer.data(), parameter.buffer.size());
text_memory = boost::static_pointer_cast<Kernel::SharedMemory, Kernel::Object>(parameter.object);
// TODO(Subv): Verify if this is the correct behavior
@@ -107,8 +106,8 @@ void SoftwareKeyboard::DrawScreenKeyboard() {
void SoftwareKeyboard::Finalize() {
// Let the application know that we're closing
Service::APT::MessageParameter message;
- message.buffer_size = sizeof(SoftwareKeyboardConfig);
- message.data = reinterpret_cast<u8*>(&config);
+ message.buffer.resize(sizeof(SoftwareKeyboardConfig));
+ std::memcpy(message.buffer.data(), &config, message.buffer.size());
message.signal = static_cast<u32>(Service::APT::SignalType::LibAppClosed);
message.destination_id = static_cast<u32>(Service::APT::AppletId::Application);
message.sender_id = static_cast<u32>(id);