2026-06-29 08:11:12 +02:00
|
|
|
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
|
|
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
|
2022-04-23 04:59:50 -04:00
|
|
|
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
|
|
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2018-07-31 07:20:42 -04:00
|
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
|
|
|
|
|
|
#include "core/hle/service/fgm/fgm.h"
|
2023-02-19 14:42:12 -05:00
|
|
|
#include "core/hle/service/ipc_helpers.h"
|
2023-02-18 16:26:48 -05:00
|
|
|
#include "core/hle/service/server_manager.h"
|
2018-07-31 07:20:42 -04:00
|
|
|
#include "core/hle/service/service.h"
|
|
|
|
|
#include "core/hle/service/sm/sm.h"
|
|
|
|
|
|
|
|
|
|
namespace Service::FGM {
|
|
|
|
|
|
|
|
|
|
class IRequest final : public ServiceFramework<IRequest> {
|
|
|
|
|
public:
|
2026-09-25 15:57:13 +00:00
|
|
|
explicit IRequest(Core::System& system_) : ServiceFramework{system_, "IRequest"} {}
|
|
|
|
|
|
|
|
|
|
FunctionInfoBase const* FindRequest(u32 key) override {
|
|
|
|
|
return HandlerTableGenerateWithFind(key,
|
2026-09-25 15:53:30 +00:00
|
|
|
FunctionInfo{0, nullptr, "Initialize"},
|
|
|
|
|
FunctionInfo{1, nullptr, "Set"},
|
|
|
|
|
FunctionInfo{2, nullptr, "Get"},
|
|
|
|
|
FunctionInfo{3, nullptr, "Cancel"}
|
2026-09-25 15:57:13 +00:00
|
|
|
);
|
2018-07-31 07:20:42 -04:00
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class FGM final : public ServiceFramework<FGM> {
|
|
|
|
|
public:
|
2026-09-25 15:57:13 +00:00
|
|
|
explicit FGM(Core::System& system_, const char* name) : ServiceFramework{system_, name} {}
|
2018-07-31 07:20:42 -04:00
|
|
|
|
2026-09-25 15:57:13 +00:00
|
|
|
FunctionInfoBase const* FindRequest(u32 key) override {
|
|
|
|
|
return HandlerTableGenerateWithFind(key,
|
|
|
|
|
FunctionInfo{0, &FGM::Initialize, "Initialize"}
|
|
|
|
|
);
|
2018-07-31 07:20:42 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private:
|
2023-02-19 14:42:12 -05:00
|
|
|
void Initialize(HLERequestContext& ctx) {
|
2018-11-26 17:06:13 +11:00
|
|
|
LOG_DEBUG(Service_FGM, "called");
|
|
|
|
|
|
2018-07-31 07:20:42 -04:00
|
|
|
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
2021-05-21 01:05:04 -04:00
|
|
|
rb.Push(ResultSuccess);
|
2026-06-29 08:11:12 +02:00
|
|
|
rb.PushIpcInterface<IRequest>(ctx, system);
|
2018-07-31 07:20:42 -04:00
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class FGM_DBG final : public ServiceFramework<FGM_DBG> {
|
|
|
|
|
public:
|
2026-09-25 15:57:13 +00:00
|
|
|
explicit FGM_DBG(Core::System& system_) : ServiceFramework{system_, "fgm:dbg"} {}
|
|
|
|
|
|
|
|
|
|
FunctionInfoBase const* FindRequest(u32 key) override {
|
|
|
|
|
return HandlerTableGenerateWithFind(key,
|
2026-09-25 15:53:30 +00:00
|
|
|
FunctionInfo{0, nullptr, "Initialize"},
|
|
|
|
|
FunctionInfo{1, nullptr, "Read"},
|
|
|
|
|
FunctionInfo{2, nullptr, "Cancel"}
|
2026-09-25 15:57:13 +00:00
|
|
|
);
|
2018-07-31 07:20:42 -04:00
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2023-02-18 16:26:48 -05:00
|
|
|
void LoopProcess(Core::System& system) {
|
|
|
|
|
auto server_manager = std::make_unique<ServerManager>(system);
|
|
|
|
|
|
|
|
|
|
server_manager->RegisterNamedService("fgm", std::make_shared<FGM>(system, "fgm"));
|
|
|
|
|
server_manager->RegisterNamedService("fgm:0", std::make_shared<FGM>(system, "fgm:0"));
|
|
|
|
|
server_manager->RegisterNamedService("fgm:9", std::make_shared<FGM>(system, "fgm:9"));
|
|
|
|
|
server_manager->RegisterNamedService("fgm:dbg", std::make_shared<FGM_DBG>(system));
|
|
|
|
|
ServerManager::RunServer(std::move(server_manager));
|
2018-07-31 07:20:42 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace Service::FGM
|