mirror of
https://github.com/skyline-emu/skyline.git
synced 2024-12-28 22:55:31 +03:00
Implement nfp services
This commit is contained in:
parent
4cf7f9288e
commit
7102fa910e
@ -117,6 +117,8 @@ add_library(skyline SHARED
|
|||||||
${source_DIR}/skyline/services/account/IManagerForApplication.cpp
|
${source_DIR}/skyline/services/account/IManagerForApplication.cpp
|
||||||
${source_DIR}/skyline/services/friends/IServiceCreator.cpp
|
${source_DIR}/skyline/services/friends/IServiceCreator.cpp
|
||||||
${source_DIR}/skyline/services/friends/IFriendService.cpp
|
${source_DIR}/skyline/services/friends/IFriendService.cpp
|
||||||
|
${source_DIR}/skyline/services/nfp/IUserManager.cpp
|
||||||
|
${source_DIR}/skyline/services/nfp/IUser.cpp
|
||||||
${source_DIR}/skyline/vfs/partition_filesystem.cpp
|
${source_DIR}/skyline/vfs/partition_filesystem.cpp
|
||||||
${source_DIR}/skyline/vfs/rom_filesystem.cpp
|
${source_DIR}/skyline/vfs/rom_filesystem.cpp
|
||||||
${source_DIR}/skyline/vfs/os_backing.cpp
|
${source_DIR}/skyline/vfs/os_backing.cpp
|
||||||
|
@ -73,6 +73,8 @@ namespace skyline::service {
|
|||||||
account_IManagerForApplication,
|
account_IManagerForApplication,
|
||||||
friends_IServiceCreator,
|
friends_IServiceCreator,
|
||||||
friends_IFriendService,
|
friends_IFriendService,
|
||||||
|
nfp_IUserManager,
|
||||||
|
nfp_IUser,
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -108,6 +110,7 @@ namespace skyline::service {
|
|||||||
{"lm", Service::lm_ILogService},
|
{"lm", Service::lm_ILogService},
|
||||||
{"acc:u0", Service::account_IAccountServiceForApplication},
|
{"acc:u0", Service::account_IAccountServiceForApplication},
|
||||||
{"friend:u", Service::friends_IServiceCreator},
|
{"friend:u", Service::friends_IServiceCreator},
|
||||||
|
{"nfp:user", Service::nfp_IUserManager},
|
||||||
};
|
};
|
||||||
|
|
||||||
class ServiceManager;
|
class ServiceManager;
|
||||||
|
13
app/src/main/cpp/skyline/services/nfp/IUser.cpp
Normal file
13
app/src/main/cpp/skyline/services/nfp/IUser.cpp
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
// SPDX-License-Identifier: MPL-2.0
|
||||||
|
// Copyright © 2020 Skyline Team and Contributors (https://github.com/skyline-emu/)
|
||||||
|
|
||||||
|
#include "IUser.h"
|
||||||
|
#include "IUserManager.h"
|
||||||
|
|
||||||
|
namespace skyline::service::nfp {
|
||||||
|
IUser::IUser(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, Service::nfp_IUser, "nfp:IUser", {
|
||||||
|
{0x0, SFUNC(IUser::Initialize)}
|
||||||
|
}) {}
|
||||||
|
|
||||||
|
void IUser::Initialize(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {}
|
||||||
|
}
|
22
app/src/main/cpp/skyline/services/nfp/IUser.h
Normal file
22
app/src/main/cpp/skyline/services/nfp/IUser.h
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
// 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::nfp {
|
||||||
|
/**
|
||||||
|
* @brief IUser is used by applications to access NFC devices (https://switchbrew.org/wiki/NFC_services#IUser)
|
||||||
|
*/
|
||||||
|
class IUser : public BaseService {
|
||||||
|
public:
|
||||||
|
IUser(const DeviceState &state, ServiceManager &manager);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This initializes an NFP session
|
||||||
|
*/
|
||||||
|
void Initialize(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||||
|
};
|
||||||
|
}
|
15
app/src/main/cpp/skyline/services/nfp/IUserManager.cpp
Normal file
15
app/src/main/cpp/skyline/services/nfp/IUserManager.cpp
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
// SPDX-License-Identifier: MPL-2.0
|
||||||
|
// Copyright © 2020 Skyline Team and Contributors (https://github.com/skyline-emu/)
|
||||||
|
|
||||||
|
#include "IUser.h"
|
||||||
|
#include "IUserManager.h"
|
||||||
|
|
||||||
|
namespace skyline::service::nfp {
|
||||||
|
IUserManager::IUserManager(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, Service::nfp_IUserManager, "nfp:IUserManager", {
|
||||||
|
{0x0, SFUNC(IUserManager::CreateUserInterface)}
|
||||||
|
}) {}
|
||||||
|
|
||||||
|
void IUserManager::CreateUserInterface(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||||
|
manager.RegisterService(SRVREG(IUser), session, response);
|
||||||
|
}
|
||||||
|
}
|
22
app/src/main/cpp/skyline/services/nfp/IUserManager.h
Normal file
22
app/src/main/cpp/skyline/services/nfp/IUserManager.h
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
// 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::nfp {
|
||||||
|
/**
|
||||||
|
* @brief IUserManager or nfp:user is used by applications to open an IUser instance for accessing NFC devices (https://switchbrew.org/wiki/NFC_services#nfp:user)
|
||||||
|
*/
|
||||||
|
class IUserManager : public BaseService {
|
||||||
|
public:
|
||||||
|
IUserManager(const DeviceState &state, ServiceManager &manager);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This opens an IUser that can be used by applications to access NFC devices
|
||||||
|
*/
|
||||||
|
void CreateUserInterface(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||||
|
};
|
||||||
|
}
|
@ -22,6 +22,7 @@
|
|||||||
#include "lm/ILogService.h"
|
#include "lm/ILogService.h"
|
||||||
#include "account/IAccountServiceForApplication.h"
|
#include "account/IAccountServiceForApplication.h"
|
||||||
#include "friends/IServiceCreator.h"
|
#include "friends/IServiceCreator.h"
|
||||||
|
#include "nfp/IUserManager.h"
|
||||||
#include "serviceman.h"
|
#include "serviceman.h"
|
||||||
|
|
||||||
namespace skyline::service {
|
namespace skyline::service {
|
||||||
@ -94,6 +95,9 @@ namespace skyline::service {
|
|||||||
case Service::friends_IServiceCreator:
|
case Service::friends_IServiceCreator:
|
||||||
serviceObj = std::make_shared<friends::IServiceCreator>(state, *this);
|
serviceObj = std::make_shared<friends::IServiceCreator>(state, *this);
|
||||||
break;
|
break;
|
||||||
|
case Service::nfp_IUserManager:
|
||||||
|
serviceObj = std::make_shared<nfp::IUserManager>(state, *this);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
throw exception("CreateService called on missing object, type: {}", serviceType);
|
throw exception("CreateService called on missing object, type: {}", serviceType);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user