Add 4.x configitem stuff

This commit is contained in:
TuxSH 2018-03-09 11:54:36 +01:00
parent 1ffa239b5a
commit 3d72183471
2 changed files with 17 additions and 2 deletions

View file

@ -7,6 +7,7 @@
#include "se.h"
#include "fuse.h"
#include "utils.h"
#include "masterkey.h"
static bool g_battery_profile = false;
@ -79,7 +80,12 @@ uint32_t configitem_get(ConfigItem item, uint64_t *p_outvalue) {
*p_outvalue = fuse_get_device_id();
break;
case CONFIGITEM_BOOTREASON:
*p_outvalue = bootconfig_get_boot_reason();
/* For some reason, Nintendo removed it on 4.0 */
if (mkey_get_revision() < MASTERKEY_REVISION_400_CURRENT) {
*p_outvalue = bootconfig_get_boot_reason();
} else {
result = 2;
}
break;
case CONFIGITEM_MEMORYARRANGE:
*p_outvalue = bootconfig_get_memory_arrangement();
@ -93,6 +99,14 @@ uint32_t configitem_get(ConfigItem item, uint64_t *p_outvalue) {
case CONFIGITEM_BATTERYPROFILE:
*p_outvalue = (int)g_battery_profile;
break;
case CONFIGITEM_ODM4BIT10_4X:
/* Added on 4.x ... where is it being used? */
if (mkey_get_revision() >= MASTERKEY_REVISION_400_CURRENT) {
*p_outvalue = (fuse_get_reserved_odm(4) >> 10) & 1;
} else {
result = 2;
}
break;
default:
result = 2;
break;

View file

@ -17,7 +17,8 @@ typedef enum {
CONFIGITEM_MEMORYARRANGE = 10,
CONFIGITEM_ISDEBUGMODE = 11,
CONFIGITEM_KERNELMEMORYCONFIGURATION = 12,
CONFIGITEM_BATTERYPROFILE = 13
CONFIGITEM_BATTERYPROFILE = 13,
CONFIGITEM_ODM4BIT10_4X = 14,
} ConfigItem;
uint32_t configitem_set(ConfigItem item, uint64_t value);