Implement GetBase in IProfile

This commit is contained in:
Billy Laws 2020-08-09 14:48:03 +01:00 committed by ◱ PixelyIon
parent dc6da8303e
commit 9e39cbaf7b
2 changed files with 14 additions and 4 deletions

View File

@ -6,7 +6,8 @@
namespace skyline::service::account { namespace skyline::service::account {
IProfile::IProfile(const DeviceState &state, ServiceManager &manager, const UserId &userId) : userId(userId), BaseService(state, manager, Service::account_IProfile, "account:IProfile", { IProfile::IProfile(const DeviceState &state, ServiceManager &manager, const UserId &userId) : userId(userId), BaseService(state, manager, Service::account_IProfile, "account:IProfile", {
{0x0, SFUNC(IProfile::Get)} {0x0, SFUNC(IProfile::Get)},
{0x1, SFUNC(IProfile::GetBase)}
}) {} }) {}
void IProfile::Get(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) { void IProfile::Get(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
@ -19,6 +20,13 @@ namespace skyline::service::account {
u8 _unk2_[0x60]; u8 _unk2_[0x60];
}; };
auto userData = state.process->GetPointer<AccountUserData>(request.outputBuf.at(0).address);
userData->iconBackgroundColorID = 0x1; // Color indexing starts at 0x1
GetBase(session, request, response);
}
void IProfile::GetBase(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
struct { struct {
UserId uid; //!< The UID of the corresponding account UserId uid; //!< The UID of the corresponding account
u64 lastEditTimestamp; //!< A POSIX UTC timestamp denoting the last account edit u64 lastEditTimestamp; //!< A POSIX UTC timestamp denoting the last account edit
@ -31,9 +39,6 @@ namespace skyline::service::account {
size_t usernameSize = std::min(accountProfileBase.nickname.size() - 1, username.size()); size_t usernameSize = std::min(accountProfileBase.nickname.size() - 1, username.size());
std::memcpy(accountProfileBase.nickname.data(), username.c_str(), usernameSize); std::memcpy(accountProfileBase.nickname.data(), username.c_str(), usernameSize);
auto userData = state.process->GetPointer<AccountUserData>(request.outputBuf.at(0).address);
userData->iconBackgroundColorID = 0x1; // Color indexing starts at 0x1
response.Push(accountProfileBase); response.Push(accountProfileBase);
} }
} }

View File

@ -22,5 +22,10 @@ namespace skyline::service::account {
* @brief This returns AccountUserData and AccountProfileBase objects that describe the user's information * @brief This returns AccountUserData and AccountProfileBase objects that describe the user's information
*/ */
void Get(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response); void Get(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
/**
* @brief This returns an AccountProfileBase object that describe the user's information
*/
void GetBase(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
}; };
} }