Files
eden/src/core/hle/service/fgm/fgm.cpp
T
lizzie b14b5e0981 2026-09-26 06:34:09
Signed-off-by: lizzie <lizzie@eden-emu.dev>
2026-10-01 10:36:03 +00:00

81 lines
2.6 KiB
C++

// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#include <memory>
#include "core/hle/service/fgm/fgm.h"
#include "core/hle/service/ipc_helpers.h"
#include "core/hle/service/server_manager.h"
#include "core/hle/service/service.h"
#include "core/hle/service/sm/sm.h"
namespace Service::FGM {
class IRequest final : public ServiceFramework<IRequest> {
public:
explicit IRequest(Core::System& system_) : ServiceFramework{system_, "IRequest"} {}
FunctionInfoBase const* FindRequest(u32 key) override {
return HandlerTableGenerateWithFind(key, functions);
}
static constexpr auto functions = CreateStaticMap(
FunctionInfo{0, nullptr, "Initialize"},
FunctionInfo{1, nullptr, "Set"},
FunctionInfo{2, nullptr, "Get"},
FunctionInfo{3, nullptr, "Cancel"}
);
};
class FGM final : public ServiceFramework<FGM> {
public:
explicit FGM(Core::System& system_, const char* name) : ServiceFramework{system_, name} {}
FunctionInfoBase const* FindRequest(u32 key) override {
return HandlerTableGenerateWithFind(key, functions);
}
private:
void Initialize(HLERequestContext& ctx) {
LOG_DEBUG(Service_FGM, "called");
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(ResultSuccess);
rb.PushIpcInterface<IRequest>(ctx, system);
}
static constexpr auto functions = CreateStaticMap(
FunctionInfo{0, &FGM::Initialize, "Initialize"}
);
};
class FGM_DBG final : public ServiceFramework<FGM_DBG> {
public:
explicit FGM_DBG(Core::System& system_) : ServiceFramework{system_, "fgm:dbg"} {}
FunctionInfoBase const* FindRequest(u32 key) override {
return HandlerTableGenerateWithFind(key, functions);
}
static constexpr auto functions = CreateStaticMap(
FunctionInfo{0, nullptr, "Initialize"},
FunctionInfo{1, nullptr, "Read"},
FunctionInfo{2, nullptr, "Cancel"}
);
};
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));
}
} // namespace Service::FGM