Added displaying boot source and loader on the bottom screen in the config
This commit is contained in:
parent
0419fc4e30
commit
f619dafff1
@ -239,8 +239,14 @@ void configMenu(bool oldPinStatus, u32 oldPinMode)
|
|||||||
|
|
||||||
initScreens();
|
initScreens();
|
||||||
|
|
||||||
drawFormattedString(true, 10, 10, COLOR_TITLE, "%s%s", CONFIG_TITLE, isNtrcardBoot ? " (ntrboot)" : "");
|
static const char *bootTypes[] = { "B9S",
|
||||||
|
"B9S (ntrboothax)",
|
||||||
|
"FIRM0",
|
||||||
|
"FIRM1" };
|
||||||
|
|
||||||
|
drawString(true, 10, 10, COLOR_TITLE, CONFIG_TITLE);
|
||||||
drawString(true, 10, 10 + SPACING_Y, COLOR_TITLE, "Press A to select, START to save");
|
drawString(true, 10, 10 + SPACING_Y, COLOR_TITLE, "Press A to select, START to save");
|
||||||
|
drawFormattedString(false, 10, SCREEN_HEIGHT - 2 * SPACING_Y, COLOR_YELLOW, "Booted from %s via %s", isSdMode ? "SD" : "CTRNAND", bootTypes[(u32)bootType]);
|
||||||
|
|
||||||
//Character to display a selected option
|
//Character to display a selected option
|
||||||
char selected = 'x';
|
char selected = 'x';
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
|
|
||||||
#define CONFIG_FILE "config.bin"
|
#define CONFIG_FILE "config.bin"
|
||||||
#define CONFIG_VERSIONMAJOR 2
|
#define CONFIG_VERSIONMAJOR 2
|
||||||
#define CONFIG_VERSIONMINOR 0
|
#define CONFIG_VERSIONMINOR 1
|
||||||
|
|
||||||
#define BOOTCFG_NAND BOOTCONFIG(0, 7)
|
#define BOOTCFG_NAND BOOTCONFIG(0, 7)
|
||||||
#define BOOTCFG_FIRM BOOTCONFIG(3, 7)
|
#define BOOTCFG_FIRM BOOTCONFIG(3, 7)
|
||||||
|
@ -43,9 +43,9 @@ extern ConfigurationStatus needConfig;
|
|||||||
extern FirmwareSource firmSource;
|
extern FirmwareSource firmSource;
|
||||||
|
|
||||||
bool isFirmlaunch = false,
|
bool isFirmlaunch = false,
|
||||||
isSdMode,
|
isSdMode;
|
||||||
isNtrcardBoot;
|
|
||||||
u16 launchedPath[41];
|
u16 launchedPath[41];
|
||||||
|
BootType bootType;
|
||||||
|
|
||||||
void main(int argc, char **argv, u32 magicWord)
|
void main(int argc, char **argv, u32 magicWord)
|
||||||
{
|
{
|
||||||
@ -58,7 +58,7 @@ void main(int argc, char **argv, u32 magicWord)
|
|||||||
const vu32 *bootPartitionsStatus = (const vu32 *)0x1FFFE010;
|
const vu32 *bootPartitionsStatus = (const vu32 *)0x1FFFE010;
|
||||||
|
|
||||||
//Shell closed, no error booting NTRCARD, NAND paritions not even considered
|
//Shell closed, no error booting NTRCARD, NAND paritions not even considered
|
||||||
isNtrcardBoot = bootMediaStatus[3] == 2 && !bootMediaStatus[1] && !bootPartitionsStatus[0] && !bootPartitionsStatus[1];
|
bootType = (bootMediaStatus[3] == 2 && !bootMediaStatus[1] && !bootPartitionsStatus[0] && !bootPartitionsStatus[1]) ? NTR : B9S;
|
||||||
|
|
||||||
if((magicWord & 0xFFFF) == 0xBEEF && argc >= 1) //Normal (B9S) boot
|
if((magicWord & 0xFFFF) == 0xBEEF && argc >= 1) //Normal (B9S) boot
|
||||||
{
|
{
|
||||||
@ -79,9 +79,19 @@ void main(int argc, char **argv, u32 magicWord)
|
|||||||
}
|
}
|
||||||
else if(magicWord == 0xB002) //FIRM/NTRCARD boot
|
else if(magicWord == 0xB002) //FIRM/NTRCARD boot
|
||||||
{
|
{
|
||||||
if(!isNtrcardBoot)
|
if(bootType != NTR)
|
||||||
{
|
{
|
||||||
const char *path = !((vu8 *)bootPartitionsStatus)[2] ? "firm1:" : "firm0:";
|
const char *path;
|
||||||
|
if(!((vu8 *)bootPartitionsStatus)[2])
|
||||||
|
{
|
||||||
|
bootType = FIRM0;
|
||||||
|
path = "firm0:";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
bootType = FIRM1;
|
||||||
|
path = "firm1:";
|
||||||
|
}
|
||||||
|
|
||||||
for(u32 i = 0; i < 7; i++) //Copy and convert the path to UTF-16
|
for(u32 i = 0; i < 7; i++) //Copy and convert the path to UTF-16
|
||||||
launchedPath[i] = path[i];
|
launchedPath[i] = path[i];
|
||||||
@ -100,7 +110,7 @@ void main(int argc, char **argv, u32 magicWord)
|
|||||||
if(!mountFs(false, true)) error("Failed to mount CTRNAND.");
|
if(!mountFs(false, true)) error("Failed to mount CTRNAND.");
|
||||||
isSdMode = false;
|
isSdMode = false;
|
||||||
}
|
}
|
||||||
else if(memcmp(launchedPath, u"firm", 8) == 0 || isNtrcardBoot)
|
else if(bootType != B9S)
|
||||||
{
|
{
|
||||||
setupKeyslots();
|
setupKeyslots();
|
||||||
|
|
||||||
@ -120,7 +130,7 @@ void main(int argc, char **argv, u32 magicWord)
|
|||||||
error("Launched from an unsupported location: %s.", mountPoint);
|
error("Launched from an unsupported location: %s.", mountPoint);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isNtrcardBoot && magicWord == 0xB002)
|
if(bootType == NTR && magicWord == 0xB002)
|
||||||
{
|
{
|
||||||
loadHomebrewFirm(0);
|
loadHomebrewFirm(0);
|
||||||
mcuPowerOff();
|
mcuPowerOff();
|
||||||
@ -158,7 +168,7 @@ void main(int argc, char **argv, u32 magicWord)
|
|||||||
installArm9Handlers();
|
installArm9Handlers();
|
||||||
|
|
||||||
firmType = NATIVE_FIRM;
|
firmType = NATIVE_FIRM;
|
||||||
isFirmProtEnabled = !isNtrcardBoot;
|
isFirmProtEnabled = bootType != NTR;
|
||||||
|
|
||||||
//Get pressed buttons
|
//Get pressed buttons
|
||||||
u32 pressed = HID_PAD;
|
u32 pressed = HID_PAD;
|
||||||
@ -301,7 +311,7 @@ boot:
|
|||||||
|
|
||||||
if(!isFirmlaunch)
|
if(!isFirmlaunch)
|
||||||
{
|
{
|
||||||
configData.bootConfig = ((u32)isNtrcardBoot << 7) | ((u32)isNoForceFlagSet << 6) | ((u32)firmSource << 3) | (u32)nandType;
|
configData.bootConfig = ((bootType == NTR ? 1 : 0) << 7) | ((u32)isNoForceFlagSet << 6) | ((u32)firmSource << 3) | (u32)nandType;
|
||||||
writeConfig(false);
|
writeConfig(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -114,9 +114,18 @@ typedef enum FirmwareType
|
|||||||
NATIVE_FIRM1X2X
|
NATIVE_FIRM1X2X
|
||||||
} FirmwareType;
|
} FirmwareType;
|
||||||
|
|
||||||
|
typedef enum bootType
|
||||||
|
{
|
||||||
|
B9S = 0,
|
||||||
|
NTR,
|
||||||
|
FIRM0,
|
||||||
|
FIRM1
|
||||||
|
} BootType;
|
||||||
|
|
||||||
extern bool isFirmlaunch,
|
extern bool isFirmlaunch,
|
||||||
isSdMode,
|
isSdMode;
|
||||||
isNtrcardBoot;
|
|
||||||
|
extern BootType bootType;
|
||||||
|
|
||||||
extern u16 launchedFirmTidLow[8];
|
extern u16 launchedFirmTidLow[8];
|
||||||
extern u16 launchedPath[41];
|
extern u16 launchedPath[41];
|
||||||
|
Reference in New Issue
Block a user