Files
eden/src/core/hle/service/bpc/bpc.cpp
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

122 lines
4.7 KiB
C++
Raw Normal View History

// 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
2018-08-01 15:40:55 -04:00
#include <memory>
#include "core/hle/service/bpc/bpc.h"
2023-02-18 16:26:48 -05:00
#include "core/hle/service/server_manager.h"
2018-08-01 15:40:55 -04:00
#include "core/hle/service/service.h"
namespace Service::BPC {
class BPC final : public ServiceFramework<BPC> {
public:
2026-09-25 15:57:13 +00:00
explicit BPC(Core::System& system_) : ServiceFramework{system_, "bpc"} {}
FunctionInfoBase const* FindRequest(u32 key) override {
return HandlerTableGenerateWithFind(key,
2026-09-25 15:53:30 +00:00
FunctionInfo{0, nullptr, "ShutdownSystem"},
FunctionInfo{1, nullptr, "RebootSystem"},
FunctionInfo{2, nullptr, "GetWakeupReason"},
FunctionInfo{3, nullptr, "GetShutdownReason"},
FunctionInfo{4, nullptr, "GetAcOk"},
FunctionInfo{5, nullptr, "GetBoardPowerControlEvent"},
FunctionInfo{6, nullptr, "GetSleepButtonState"},
FunctionInfo{7, nullptr, "GetPowerEvent"},
FunctionInfo{8, nullptr, "CreateWakeupTimer"},
FunctionInfo{9, nullptr, "CancelWakeupTimer"},
FunctionInfo{10, nullptr, "EnableWakeupTimerOnDevice"},
FunctionInfo{11, nullptr, "CreateWakeupTimerEx"},
FunctionInfo{12, nullptr, "GetLastEnabledWakeupTimerType"},
FunctionInfo{13, nullptr, "CleanAllWakeupTimers"},
FunctionInfo{14, nullptr, "GetPowerButton"},
FunctionInfo{15, nullptr, "SetEnableWakeupTimer"}
2026-09-25 15:57:13 +00:00
);
2018-08-01 15:40:55 -04:00
}
};
class BPC_R final : public ServiceFramework<BPC_R> {
public:
2026-09-25 15:57:13 +00:00
explicit BPC_R(Core::System& system_) : ServiceFramework{system_, "bpc:r"} {}
FunctionInfoBase const* FindRequest(u32 key) override {
return HandlerTableGenerateWithFind(key,
2026-09-25 15:53:30 +00:00
FunctionInfo{0, nullptr, "GetRtcTime"},
FunctionInfo{1, nullptr, "SetRtcTime"},
FunctionInfo{2, nullptr, "GetRtcResetDetected"},
FunctionInfo{3, nullptr, "ClearRtcResetDetected"},
FunctionInfo{4, nullptr, "SetUpRtcResetOnShutdown"}
2026-09-25 15:57:13 +00:00
);
2018-08-01 15:40:55 -04:00
}
};
class BPC_C final : public ServiceFramework<BPC_C> {
public:
2026-09-25 15:57:13 +00:00
explicit BPC_C(Core::System& system_) : ServiceFramework{system_, "bpc:c"} {}
FunctionInfoBase const* FindRequest(u32 key) override {
return HandlerTableGenerateWithFind(key,
2026-09-25 15:53:30 +00:00
FunctionInfo{0, nullptr, "ShutdownSystem"},
FunctionInfo{1, nullptr, "RebootSystem"},
FunctionInfo{2, nullptr, "GetWakeupReason"},
FunctionInfo{3, nullptr, "GetShutdownReason"},
FunctionInfo{4, nullptr, "GetAcOk"},
FunctionInfo{5, nullptr, "GetPowerEvent"}
2026-09-25 15:57:13 +00:00
);
}
};
class BPC_B final : public ServiceFramework<BPC_B> {
public:
2026-09-25 15:57:13 +00:00
explicit BPC_B(Core::System& system_) : ServiceFramework{system_, "bpc:b"} {}
FunctionInfoBase const* FindRequest(u32 key) override {
return HandlerTableGenerateWithFind(key,
2026-09-25 15:53:30 +00:00
FunctionInfo{0, nullptr, "GetSleepButtonState"},
FunctionInfo{1, nullptr, "GetPowerButtonEvent"}
2026-09-25 15:57:13 +00:00
);
}
};
class BPC_W final : public ServiceFramework<BPC_W> {
public:
2026-09-25 15:57:13 +00:00
explicit BPC_W(Core::System& system_) : ServiceFramework{system_, "bpc:w"} {}
FunctionInfoBase const* FindRequest(u32 key) override {
return HandlerTableGenerateWithFind(key,
2026-09-25 15:53:30 +00:00
FunctionInfo{0, nullptr, "CreateWakeupTimer"},
FunctionInfo{1, nullptr, "CancelWakeupTimer"},
FunctionInfo{2, nullptr, "EnableWakeupTimerOnDevice"}
2026-09-25 15:57:13 +00:00
);
}
};
class BPC_AMS final : public ServiceFramework<BPC_AMS> {
public:
2026-09-25 15:57:13 +00:00
explicit BPC_AMS(Core::System& system_) : ServiceFramework{system_, "bpc:ams"} {}
FunctionInfoBase const* FindRequest(u32 key) override {
return HandlerTableGenerateWithFind(key,
2026-09-25 15:53:30 +00:00
FunctionInfo{65000, nullptr, "RebootToFatalError"},
FunctionInfo{65001, nullptr, "SetRebootPayload"}
2026-09-25 15:57:13 +00: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("bpc", std::make_shared<BPC>(system), 13);
server_manager->RegisterNamedService("bpc:r", std::make_shared<BPC_R>(system), 13);
server_manager->RegisterNamedService("bpc:c", std::make_shared<BPC_C>(system), 13);
server_manager->RegisterNamedService("bpc:b", std::make_shared<BPC_B>(system), 13);
server_manager->RegisterNamedService("bpc:w", std::make_shared<BPC_W>(system), 13);
server_manager->RegisterNamedService("bpc:ams", std::make_shared<BPC_AMS>(system), 4);
2023-02-18 16:26:48 -05:00
ServerManager::RunServer(std::move(server_manager));
2018-08-01 15:40:55 -04:00
}
} // namespace Service::BPC