From 1ebec7db82e9cfb19b6d132d1cd55ee3276faeff Mon Sep 17 00:00:00 2001 From: Dima Date: Sat, 26 Nov 2022 17:04:35 +0300 Subject: [PATCH] Stub GetImageSize and LoadImage --- .../cpp/skyline/services/account/IProfile.cpp | 25 +++++++++++++++++++ .../cpp/skyline/services/account/IProfile.h | 14 ++++++++++- 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/app/src/main/cpp/skyline/services/account/IProfile.cpp b/app/src/main/cpp/skyline/services/account/IProfile.cpp index 59c66c3a..13ae1358 100644 --- a/app/src/main/cpp/skyline/services/account/IProfile.cpp +++ b/app/src/main/cpp/skyline/services/account/IProfile.cpp @@ -5,6 +5,19 @@ #include "IProfile.h" namespace skyline::service::account { + // Smallest JPEG file https://github.com/mathiasbynens/small/blob/master/jpeg.jpg + constexpr std::array profileImageIcon{ + 0xFF, 0xD8, 0xFF, 0xDB, 0x00, 0x43, 0x00, 0x03, 0x02, 0x02, 0x02, 0x02, + 0x02, 0x03, 0x02, 0x02, 0x02, 0x03, 0x03, 0x03, 0x03, 0x04, 0x06, 0x04, + 0x04, 0x04, 0x04, 0x04, 0x08, 0x06, 0x06, 0x05, 0x06, 0x09, 0x08, 0x0A, + 0x0A, 0x09, 0x08, 0x09, 0x09, 0x0A, 0x0C, 0x0F, 0x0C, 0x0A, 0x0B, 0x0E, + 0x0B, 0x09, 0x09, 0x0D, 0x11, 0x0D, 0x0E, 0x0F, 0x10, 0x10, 0x11, 0x10, + 0x0A, 0x0C, 0x12, 0x13, 0x12, 0x10, 0x13, 0x0F, 0x10, 0x10, 0x10, 0xFF, + 0xC9, 0x00, 0x0B, 0x08, 0x00, 0x01, 0x00, 0x01, 0x01, 0x01, 0x11, 0x00, + 0xFF, 0xCC, 0x00, 0x06, 0x00, 0x10, 0x10, 0x05, 0xFF, 0xDA, 0x00, 0x08, + 0x01, 0x01, 0x00, 0x00, 0x3F, 0x00, 0xD2, 0xCF, 0x20, 0xFF, 0xD9 + }; + IProfile::IProfile(const DeviceState &state, ServiceManager &manager, const UserId &userId) : userId(userId), BaseService(state, manager) {} Result IProfile::Get(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) { @@ -38,4 +51,16 @@ namespace skyline::service::account { return {}; } + + Result IProfile::GetImageSize(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) { + response.Push(profileImageIcon.size()); + return {}; + } + + Result IProfile::LoadImage(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) { + // TODO: load actual profile image + request.outputBuf.at(0).copy_from(profileImageIcon); + response.Push(profileImageIcon.size()); + return {}; + } } diff --git a/app/src/main/cpp/skyline/services/account/IProfile.h b/app/src/main/cpp/skyline/services/account/IProfile.h index 38e7ed3a..006e775b 100644 --- a/app/src/main/cpp/skyline/services/account/IProfile.h +++ b/app/src/main/cpp/skyline/services/account/IProfile.h @@ -28,9 +28,21 @@ namespace skyline::service::account { */ Result GetBase(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response); + /** + * @url https://switchbrew.org/wiki/Account_services#GetImageSize + */ + Result GetImageSize(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response); + + /** + * @url https://switchbrew.org/wiki/Account_services#LoadImage + */ + Result LoadImage(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response); + SERVICE_DECL( SFUNC(0x0, IProfile, Get), - SFUNC(0x1, IProfile, GetBase) + SFUNC(0x1, IProfile, GetBase), + SFUNC(0xA, IProfile, GetImageSize), + SFUNC(0xB, IProfile, LoadImage) ) }; }