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

44 lines
1.3 KiB
C++
Raw Normal View History

2022-04-23 22:49:07 +04:00
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
2020-12-28 19:15:37 +04: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"
namespace Service::NFP {
2022-09-09 03:05:23 +04:00
2022-10-01 04:41:15 +04: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-09-09 03:05:23 +04:00
};
2022-10-01 04:41:15 +04:00
// clang-format on
2022-09-09 03:05:23 +04:00
2022-10-01 04:41:15 +04:00
RegisterHandlers(functions);
2022-09-09 03:05:23 +04:00
}
2022-10-01 04:41:15 +04:00
private:
void CreateUserInterface(Kernel::HLERequestContext& ctx) {
LOG_DEBUG(Service_NFP, "called");
2022-02-10 22:04:38 +04:00
2022-10-01 04:41:15 +04:00
if (user_interface == nullptr) {
user_interface = std::make_shared<IUser>(system);
2022-09-09 03:05:23 +04:00
}
2022-10-01 04:41:15 +04:00
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(ResultSuccess);
rb.PushIpcInterface<IUser>(user_interface);
2022-09-09 03:05:23 +04:00
}
2022-10-01 04:41:15 +04:00
std::shared_ptr<IUser> user_interface;
};
2020-12-28 19:15:37 +04:00
void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system) {
2022-10-01 04:41:15 +04:00
std::make_shared<IUserManager>(system)->InstallAsService(service_manager);
2020-12-28 19:15:37 +04:00
}
} // namespace Service::NFP