yuzu/src/core/hle/service/nfp/nfp.cpp

48 lines
1.4 KiB
C++
Raw Normal View History

// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#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"
#include "core/hle/service/server_manager.h"
namespace Service::NFP {
2022-02-13 17:54:39 +00: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 17:54:39 +00:00
};
// clang-format on
2022-02-13 17:54:39 +00:00
RegisterHandlers(functions);
2022-02-13 17:54:39 +00:00
}
2021-06-17 03:09:38 +00:00
private:
void CreateUserInterface(Kernel::HLERequestContext& ctx) {
LOG_DEBUG(Service_NFP, "called");
2021-06-17 03:09:38 +00:00
if (user_interface == nullptr) {
user_interface = std::make_shared<IUser>(system);
}
2022-02-13 17:54:39 +00:00
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(ResultSuccess);
rb.PushIpcInterface<IUser>(user_interface);
}
std::shared_ptr<IUser> user_interface;
};
void LoopProcess(Core::System& system) {
auto server_manager = std::make_unique<ServerManager>(system);
server_manager->RegisterNamedService("nfp:user", std::make_shared<IUserManager>(system));
ServerManager::RunServer(std::move(server_manager));
}
} // namespace Service::NFP