am: Pass current user UUID to launch parameters

This commit is contained in:
Zach Hilman 2018-10-09 21:49:29 -04:00
parent aeffd4b436
commit d3fbf45705
1 changed files with 9 additions and 7 deletions

View File

@ -26,6 +26,8 @@
namespace Service::AM { namespace Service::AM {
constexpr std::size_t POP_LAUNCH_PARAMETER_BUFFER_SIZE = 0x88;
IWindowController::IWindowController() : ServiceFramework("IWindowController") { IWindowController::IWindowController() : ServiceFramework("IWindowController") {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
@ -724,16 +726,16 @@ void IApplicationFunctions::EndBlockingHomeButton(Kernel::HLERequestContext& ctx
} }
void IApplicationFunctions::PopLaunchParameter(Kernel::HLERequestContext& ctx) { void IApplicationFunctions::PopLaunchParameter(Kernel::HLERequestContext& ctx) {
constexpr std::array<u8, 0x88> data{{ constexpr std::array<u8, 0x8> header_data{
0xca, 0x97, 0x94, 0xc7, // Magic 0xca, 0x97, 0x94, 0xc7, // Magic
1, 0, 0, 0, // IsAccountSelected (bool) 1, 0, 0, 0, // IsAccountSelected (bool)
1, 0, 0, 0, // User Id (word 0) };
0, 0, 0, 0, // User Id (word 1)
0, 0, 0, 0, // User Id (word 2)
0, 0, 0, 0 // User Id (word 3)
}};
std::vector<u8> buffer(data.begin(), data.end()); std::vector<u8> buffer(POP_LAUNCH_PARAMETER_BUFFER_SIZE);
std::memcpy(buffer.data(), header_data.data(), header_data.size());
const auto current_uuid = Settings::values.users[Settings::values.current_user].second.uuid;
std::memcpy(buffer.data() + header_data.size(), current_uuid.data(), sizeof(u128));
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};