2019-12-09 12:57:37 +01:00
|
|
|
/*
|
2020-01-24 11:10:40 +01:00
|
|
|
* Copyright (c) 2018-2020 Atmosphère-NX
|
2019-12-09 12:57:37 +01:00
|
|
|
*
|
|
|
|
* 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>
|
|
|
|
|
|
|
|
namespace ams::spl {
|
|
|
|
|
|
|
|
HardwareType GetHardwareType() {
|
|
|
|
u64 out_val = 0;
|
2020-02-23 08:05:14 +01:00
|
|
|
R_ABORT_UNLESS(splGetConfig(SplConfigItem_HardwareType, &out_val));
|
2019-12-09 12:57:37 +01:00
|
|
|
return static_cast<HardwareType>(out_val);
|
|
|
|
}
|
|
|
|
|
|
|
|
MemoryArrangement GetMemoryArrangement() {
|
|
|
|
u64 arrange = 0;
|
2020-02-23 08:05:14 +01:00
|
|
|
R_ABORT_UNLESS(splGetConfig(SplConfigItem_MemoryArrange, &arrange));
|
2019-12-09 12:57:37 +01:00
|
|
|
arrange &= 0x3F;
|
|
|
|
switch (arrange) {
|
|
|
|
case 2:
|
|
|
|
return MemoryArrangement_StandardForAppletDev;
|
|
|
|
case 3:
|
|
|
|
return MemoryArrangement_StandardForSystemDev;
|
|
|
|
case 17:
|
|
|
|
return MemoryArrangement_Expanded;
|
|
|
|
case 18:
|
|
|
|
return MemoryArrangement_ExpandedForAppletDev;
|
|
|
|
default:
|
|
|
|
return MemoryArrangement_Standard;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-04-14 11:54:55 +02:00
|
|
|
bool IsDisabledProgramVerification() {
|
|
|
|
u64 val = 0;
|
|
|
|
R_ABORT_UNLESS(splGetConfig(SplConfigItem_DisableProgramVerification, &val));
|
|
|
|
return val != 0;
|
|
|
|
}
|
|
|
|
|
2019-12-09 12:57:37 +01:00
|
|
|
bool IsDevelopmentHardware() {
|
|
|
|
bool is_dev_hardware;
|
2020-02-23 08:05:14 +01:00
|
|
|
R_ABORT_UNLESS(splIsDevelopment(&is_dev_hardware));
|
2019-12-09 12:57:37 +01:00
|
|
|
return is_dev_hardware;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool IsDevelopmentFunctionEnabled() {
|
|
|
|
u64 val = 0;
|
2020-02-23 08:05:14 +01:00
|
|
|
R_ABORT_UNLESS(splGetConfig(SplConfigItem_IsDebugMode, &val));
|
2019-12-09 12:57:37 +01:00
|
|
|
return val != 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool IsRecoveryBoot() {
|
|
|
|
u64 val = 0;
|
2020-02-23 08:05:14 +01:00
|
|
|
R_ABORT_UNLESS(splGetConfig(SplConfigItem_IsRecoveryBoot, &val));
|
2019-12-09 12:57:37 +01:00
|
|
|
return val != 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool IsMariko() {
|
|
|
|
const auto hw_type = GetHardwareType();
|
|
|
|
switch (hw_type) {
|
|
|
|
case HardwareType::Icosa:
|
|
|
|
case HardwareType::Copper:
|
|
|
|
return false;
|
|
|
|
case HardwareType::Hoag:
|
|
|
|
case HardwareType::Iowa:
|
|
|
|
return true;
|
|
|
|
AMS_UNREACHABLE_DEFAULT_CASE();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|