From 6e6c437a5276f4d60cc511da6bdc8a40f5b3c3e9 Mon Sep 17 00:00:00 2001 From: fearlessTobi Date: Sat, 29 Sep 2018 13:58:51 +0200 Subject: [PATCH] applets: stub mii selector to always return a standard mii To obtain the data, the LLEd mii selector of system version 11.8.0 was used. In AppletManager::GlanceParameter, the following code was added to write the returned buffer data to a file: if (parameter.buffer.size() == 132) { std::u16string name(10, '\0'); std::memcpy(name.data(), parameter.buffer.data() + 0x26, 10 * sizeof(u16)); name = std::u16string(name.data()); FileUtil::IOFile file{fmt::format("{}.mii", Common::UTF16ToUTF8(name)), "wb"}; file.WriteBytes(parameter.buffer.data(), parameter.buffer.size()); } Then "xxd -i" was used on the file to convert it to a hex array. --- src/core/hle/applets/mii_selector.cpp | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/core/hle/applets/mii_selector.cpp b/src/core/hle/applets/mii_selector.cpp index dd57f0efd..594eeb4ab 100644 --- a/src/core/hle/applets/mii_selector.cpp +++ b/src/core/hle/applets/mii_selector.cpp @@ -18,6 +18,19 @@ namespace HLE { namespace Applets { +// This data was obtained by writing the returned buffer in AppletManager::GlanceParameter of the +// LLEd Mii picker of version system version 11.8.0 to a file +static const std::array mii = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x03, 0x00, 0x10, + 0x30, 0xd2, 0x85, 0xb6, 0xb3, 0x00, 0xc8, 0x85, 0x0a, 0x98, 0x39, 0x1e, 0xe4, 0x40, 0xf4, + 0x07, 0xb7, 0x37, 0x10, 0x00, 0x00, 0xa6, 0x00, 0x43, 0x00, 0x69, 0x00, 0x74, 0x00, 0x72, + 0x00, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x40, + 0x00, 0x00, 0x21, 0x01, 0x02, 0x68, 0x44, 0x18, 0x26, 0x34, 0x46, 0x14, 0x81, 0x12, 0x17, + 0x68, 0x0d, 0x00, 0x00, 0x29, 0x00, 0x52, 0x48, 0x50, 0x66, 0x00, 0x6c, 0x00, 0x54, 0x00, + 0x6f, 0x00, 0x62, 0x00, 0x69, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x05, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + ResultCode MiiSelector::ReceiveParameter(const Service::APT::MessageParameter& parameter) { if (parameter.signal != Service::APT::SignalType::Request) { LOG_ERROR(Service_APT, "unsupported signal {}", static_cast(parameter.signal)); @@ -57,17 +70,13 @@ ResultCode MiiSelector::ReceiveParameter(const Service::APT::MessageParameter& p ResultCode MiiSelector::StartImpl(const Service::APT::AppletStartupParameter& parameter) { is_running = true; - // 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 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. + // TODO(Subv): Find more about this structure MiiResult result; - memset(&result, 0, sizeof(result)); - result.return_code = 0; + std::memcpy(&result, mii.data(), mii.size()); // Let the application know that we're closing Service::APT::MessageParameter message;