Stub GetImageSize and LoadImage

This commit is contained in:
Dima 2022-11-26 17:04:35 +03:00 committed by Billy Laws
parent 52c4228ecf
commit 1ebec7db82
2 changed files with 38 additions and 1 deletions

View File

@ -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<u8, 107> 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<u32>(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<u32>(profileImageIcon.size());
return {};
}
}

View File

@ -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)
)
};
}