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.

130 lines
4.8 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:
explicit BPC(Core::System& system_) : ServiceFramework{system_, "bpc"} {
2018-08-01 15:40:55 -04:00
// clang-format off
static const FunctionInfo functions[] = {
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"}
2018-08-01 15:40:55 -04:00
};
// clang-format on
RegisterHandlers(functions);
}
};
class BPC_R final : public ServiceFramework<BPC_R> {
public:
explicit BPC_R(Core::System& system_) : ServiceFramework{system_, "bpc:r"} {
2018-08-01 15:40:55 -04:00
// clang-format off
static const FunctionInfo functions[] = {
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"}
2018-08-01 15:40:55 -04:00
};
// clang-format on
RegisterHandlers(functions);
}
};
class BPC_C final : public ServiceFramework<BPC_C> {
public:
explicit BPC_C(Core::System& system_) : ServiceFramework{system_, "bpc:c"} {
// clang-format off
static const FunctionInfo functions[] = {
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"}
};
// clang-format on
RegisterHandlers(functions);
}
};
class BPC_B final : public ServiceFramework<BPC_B> {
public:
explicit BPC_B(Core::System& system_) : ServiceFramework{system_, "bpc:b"} {
// clang-format off
static const FunctionInfo functions[] = {
2026-09-25 15:53:30 +00:00
FunctionInfo{0, nullptr, "GetSleepButtonState"},
FunctionInfo{1, nullptr, "GetPowerButtonEvent"}
};
// clang-format on
RegisterHandlers(functions);
}
};
class BPC_W final : public ServiceFramework<BPC_W> {
public:
explicit BPC_W(Core::System& system_) : ServiceFramework{system_, "bpc:w"} {
// clang-format off
static const FunctionInfo functions[] = {
2026-09-25 15:53:30 +00:00
FunctionInfo{0, nullptr, "CreateWakeupTimer"},
FunctionInfo{1, nullptr, "CancelWakeupTimer"},
FunctionInfo{2, nullptr, "EnableWakeupTimerOnDevice"}
};
// clang-format on
RegisterHandlers(functions);
}
};
class BPC_AMS final : public ServiceFramework<BPC_AMS> {
public:
explicit BPC_AMS(Core::System& system_) : ServiceFramework{system_, "bpc:ams"} {
// clang-format off
static const FunctionInfo functions[] = {
2026-09-25 15:53:30 +00:00
FunctionInfo{65000, nullptr, "RebootToFatalError"},
FunctionInfo{65001, nullptr, "SetRebootPayload"}
};
// clang-format on
RegisterHandlers(functions);
}
};
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