Skip to content

Commit 2999f9e

Browse files
edo9300AntonioND
authored andcommitted
system: fix reading console id with SCFG_ROM registers disabled
The code was checking directly on the `SCFG_ROM` register if the console id register was enabled, but wasn't checking if the `SCFG_ROM` register was enabled in first place (leading to reading 0 and thinking the console id was available to be read from the register).
1 parent c17c469 commit 2999f9e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

source/arm7/console_id.twl.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,9 @@ static void computeConsoleIdFromNandKeyX(aes_keyslot_t *keyslot, u8 ConsoleIdOut
6161

6262
u64 getConsoleID(void)
6363
{
64-
// first check whether we can read the console ID directly and it was not hidden by SCFG
65-
if ((REG_SCFG_ROM & (1u << 10)) == 0 && (REG_CONSOLEID_FLAG & 0x1) == 0)
64+
if ((REG_SCFG_EXT & SCFG_EXT_SCFG_MBK_REG) != 0 // check if we have access to the SCFG ROM register
65+
&& (REG_SCFG_ROM & BIT(10)) == 0 // check if we have access to the console id register
66+
&& (REG_CONSOLEID_FLAG & 0x1) == 0) // check if the console id register is available
6667
{
6768
return REG_CONSOLEID;
6869
}

0 commit comments

Comments
 (0)