Atmosphere/stratosphere/pm/source/pm_boot_mode_service.cpp
Michael Scire 49763aee92 pm: add new 19.0.0 commands
This is functionally correct, but I have no idea what these are meant to represent.
These functions are completely unused on NX.
2024-10-10 02:44:19 -07:00

61 lines
1.6 KiB
C++

/*
* Copyright (c) Atmosphère-NX
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stratosphere.hpp>
#include "pm_boot_mode_service.hpp"
namespace ams::pm {
namespace {
/* Global bootmode. */
constinit BootMode g_boot_mode = BootMode::Normal;
constinit u32 g_unknown = 0;
}
/* Override of weakly linked boot_mode_api functions. */
namespace bm {
BootMode GetBootMode() {
return g_boot_mode;
}
void SetMaintenanceBoot() {
g_boot_mode = BootMode::Maintenance;
}
}
/* Service command implementations. */
void BootModeService::GetBootMode(sf::Out<u32> out) {
out.SetValue(static_cast<u32>(pm::bm::GetBootMode()));
}
void BootModeService::SetMaintenanceBoot() {
pm::bm::SetMaintenanceBoot();
}
void BootModeService::GetUnknown(sf::Out<u32> out) {
out.SetValue(g_unknown);
}
Result BootModeService::SetUnknown(u32 val) {
R_UNLESS(val <= 3, pm::ResultUnknown7());
g_unknown = val;
R_SUCCEED();
}
}