2022-04-23 01:59:50 -07:00
|
|
|
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
|
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2018-03-29 18:06:51 -07:00
|
|
|
|
|
|
|
#include "common/logging/log.h"
|
|
|
|
#include "core/hle/ipc_helpers.h"
|
|
|
|
#include "core/hle/service/nfp/nfp.h"
|
|
|
|
#include "core/hle/service/nfp/nfp_user.h"
|
|
|
|
|
2018-04-19 18:41:44 -07:00
|
|
|
namespace Service::NFP {
|
2022-02-13 09:54:39 -08:00
|
|
|
|
2022-09-24 19:28:06 -07:00
|
|
|
class IUserManager final : public ServiceFramework<IUserManager> {
|
|
|
|
public:
|
|
|
|
explicit IUserManager(Core::System& system_) : ServiceFramework{system_, "nfp:user"} {
|
|
|
|
// clang-format off
|
|
|
|
static const FunctionInfo functions[] = {
|
|
|
|
{0, &IUserManager::CreateUserInterface, "CreateUserInterface"},
|
2022-02-13 09:54:39 -08:00
|
|
|
};
|
2022-09-24 19:28:06 -07:00
|
|
|
// clang-format on
|
2022-02-13 09:54:39 -08:00
|
|
|
|
2022-09-24 19:28:06 -07:00
|
|
|
RegisterHandlers(functions);
|
2022-02-13 09:54:39 -08:00
|
|
|
}
|
2021-06-16 20:09:38 -07:00
|
|
|
|
2022-09-24 19:28:06 -07:00
|
|
|
private:
|
|
|
|
void CreateUserInterface(Kernel::HLERequestContext& ctx) {
|
|
|
|
LOG_DEBUG(Service_NFP, "called");
|
2021-06-16 20:09:38 -07:00
|
|
|
|
2022-09-24 19:28:06 -07:00
|
|
|
if (user_interface == nullptr) {
|
|
|
|
user_interface = std::make_shared<IUser>(system);
|
2022-08-29 22:33:47 -07:00
|
|
|
}
|
2022-02-13 09:54:39 -08:00
|
|
|
|
2022-09-24 19:28:06 -07:00
|
|
|
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
|
|
|
rb.Push(ResultSuccess);
|
|
|
|
rb.PushIpcInterface<IUser>(user_interface);
|
2022-08-30 17:28:37 -07:00
|
|
|
}
|
|
|
|
|
2022-09-24 19:28:06 -07:00
|
|
|
std::shared_ptr<IUser> user_interface;
|
|
|
|
};
|
2022-08-30 17:28:37 -07:00
|
|
|
|
2019-09-21 02:03:20 -07:00
|
|
|
void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system) {
|
2022-09-24 19:28:06 -07:00
|
|
|
std::make_shared<IUserManager>(system)->InstallAsService(service_manager);
|
2018-03-29 18:06:51 -07:00
|
|
|
}
|
|
|
|
|
2018-04-19 18:41:44 -07:00
|
|
|
} // namespace Service::NFP
|