mirror of
https://github.com/skyline-emu/skyline.git
synced 2025-01-09 20:49:24 +01:00
Extend account services to support BAAS and some user operations
These are needed by Super Mario Odyssey and several other games.
This commit is contained in:
parent
80270637c1
commit
ff5dddbd5b
@ -114,6 +114,7 @@ add_library(skyline SHARED
|
||||
${source_DIR}/skyline/services/lm/ILogService.cpp
|
||||
${source_DIR}/skyline/services/lm/ILogger.cpp
|
||||
${source_DIR}/skyline/services/account/IAccountServiceForApplication.cpp
|
||||
${source_DIR}/skyline/services/account/IManagerForApplication.cpp
|
||||
${source_DIR}/skyline/vfs/partition_filesystem.cpp
|
||||
${source_DIR}/skyline/vfs/rom_filesystem.cpp
|
||||
${source_DIR}/skyline/vfs/os_backing.cpp
|
||||
|
@ -1,12 +1,30 @@
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
// Copyright © 2020 Skyline Team and Contributors (https://github.com/skyline-emu/)
|
||||
|
||||
#include "IManagerForApplication.h"
|
||||
#include "IAccountServiceForApplication.h"
|
||||
|
||||
namespace skyline::service::account {
|
||||
IAccountServiceForApplication::IAccountServiceForApplication(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, Service::account_IAccountServiceForApplication, "account:IAccountServiceForApplication", {
|
||||
{0x64, SFUNC(IAccountServiceForApplication::InitializeApplicationInfoV0)}
|
||||
{0x1, SFUNC(IAccountServiceForApplication::GetUserExistence)},
|
||||
{0x4, SFUNC(IAccountServiceForApplication::GetLastOpenedUser)},
|
||||
{0x64, SFUNC(IAccountServiceForApplication::InitializeApplicationInfoV0)},
|
||||
{0x65, SFUNC(IAccountServiceForApplication::GetBaasAccountManagerForApplication)}
|
||||
}) {}
|
||||
|
||||
void IAccountServiceForApplication::GetUserExistence(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
auto id = request.Pop<UserId>();
|
||||
|
||||
response.Push<u32>(id == constant::DefaultUserId);
|
||||
}
|
||||
|
||||
void IAccountServiceForApplication::GetLastOpenedUser(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
response.Push(constant::DefaultUserId);
|
||||
}
|
||||
|
||||
void IAccountServiceForApplication::InitializeApplicationInfoV0(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {}
|
||||
|
||||
void IAccountServiceForApplication::GetBaasAccountManagerForApplication(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
manager.RegisterService(SRVREG(IManagerForApplication), session, response);
|
||||
}
|
||||
}
|
||||
|
@ -14,6 +14,14 @@ namespace skyline {
|
||||
struct UserId {
|
||||
u64 upper; //!< The upper 64 bits of the user ID
|
||||
u64 lower; //!< The lower 64 bits of the user ID
|
||||
|
||||
/**
|
||||
* @param userId The user ID to compare with
|
||||
* @return Whether this user ID matches the one given as a parameter
|
||||
*/
|
||||
inline constexpr bool operator==(const UserId& userId) {
|
||||
return upper == userId.upper && lower == userId.lower;
|
||||
}
|
||||
};
|
||||
/**
|
||||
* @brief IAccountServiceForApplication or acc:u0 provides functions for reading user information (https://switchbrew.org/wiki/Account_services#acc:u0)
|
||||
@ -22,10 +30,25 @@ namespace skyline {
|
||||
public:
|
||||
IAccountServiceForApplication(const DeviceState &state, ServiceManager &manager);
|
||||
|
||||
/**
|
||||
* @brief This checks if the given user ID exists
|
||||
*/
|
||||
void GetUserExistence(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||
|
||||
/**
|
||||
* @brief This returns the user ID of the last active user on the console
|
||||
*/
|
||||
void GetLastOpenedUser(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||
|
||||
/**
|
||||
* @brief This provides information about the running application for account services to use (https://switchbrew.org/wiki/Account_services#InitializeApplicationInfoV0)
|
||||
*/
|
||||
void InitializeApplicationInfoV0(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||
|
||||
/**
|
||||
* @brief This returns a handle to an IManagerForApplication which can be used for reading Nintendo Online info
|
||||
*/
|
||||
void GetBaasAccountManagerForApplication(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,9 @@
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
// Copyright © 2020 Skyline Team and Contributors (https://github.com/skyline-emu/)
|
||||
|
||||
#include "IManagerForApplication.h"
|
||||
|
||||
namespace skyline::service::account {
|
||||
IManagerForApplication::IManagerForApplication(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, Service::account_IManagerForApplication, "account:IManagerForApplication", {
|
||||
}) {}
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
// Copyright © 2020 Skyline Team and Contributors (https://github.com/skyline-emu/)
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <services/base_service.h>
|
||||
#include <services/serviceman.h>
|
||||
|
||||
namespace skyline::service::account {
|
||||
/**
|
||||
* @brief IManagerForApplication provides functions for reading Nintendo Online user information (https://switchbrew.org/wiki/Account_services#IManagerForApplication)
|
||||
*/
|
||||
class IManagerForApplication : public BaseService {
|
||||
public:
|
||||
IManagerForApplication(const DeviceState &state, ServiceManager &manager);
|
||||
};
|
||||
}
|
@ -70,6 +70,7 @@ namespace skyline::service {
|
||||
lm_ILogService,
|
||||
lm_ILogger,
|
||||
account_IAccountServiceForApplication,
|
||||
account_IManagerForApplication,
|
||||
};
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user