Remove "Use EmuNAND FIRM with R" option

This is a leftover from the Gateway era that has long lost its utility
and that unnecessarily complicated the code base.

Please just load an external FIRM from SD card if you need something
similar.

Also refactor the multi-EmuNAND code and CTRNAND mounting code.
This commit is contained in:
TuxSH 2023-07-09 00:22:45 +02:00
parent 06c3215546
commit 5b417189db
20 changed files with 145 additions and 166 deletions

Binary file not shown.

View File

@ -59,7 +59,6 @@ static_assert(sizeof(CfgDataMcu) > 0, "wrong data size");
static const char *singleOptionIniNamesBoot[] = {
"autoboot_emunand",
"use_emunand_firm_if_r_pressed",
"enable_external_firm_and_modules",
"enable_game_patching",
"app_syscore_threads_on_core_2",
@ -642,10 +641,9 @@ static size_t saveLumaIniConfigToStr(char *out)
lumaVerStr, lumaRevSuffixStr,
(int)CONFIG_VERSIONMAJOR, (int)CONFIG_VERSIONMINOR,
(int)CONFIG(AUTOBOOTEMU), (int)CONFIG(USEEMUFIRM),
(int)CONFIG(LOADEXTFIRMSANDMODULES), (int)CONFIG(PATCHGAMES),
(int)CONFIG(REDIRECTAPPTHREADS), (int)CONFIG(PATCHVERSTRING),
(int)CONFIG(SHOWGBABOOT),
(int)CONFIG(AUTOBOOTEMU), (int)CONFIG(LOADEXTFIRMSANDMODULES),
(int)CONFIG(PATCHGAMES), (int)CONFIG(REDIRECTAPPTHREADS),
(int)CONFIG(PATCHVERSTRING), (int)CONFIG(SHOWGBABOOT),
1 + (int)MULTICONFIG(DEFAULTEMU), 4 - (int)MULTICONFIG(BRIGHTNESS),
splashPosStr, (unsigned int)cfg->splashDurationMsec,
@ -820,7 +818,6 @@ void configMenu(bool oldPinStatus, u32 oldPinMode)
};
static const char *singleOptionsText[] = { "( ) Autoboot EmuNAND",
"( ) Use EmuNAND FIRM if booting with R",
"( ) Enable loading external FIRMs and modules",
"( ) Enable game patching",
"( ) Redirect app. syscore threads to core2",
@ -829,8 +826,9 @@ void configMenu(bool oldPinStatus, u32 oldPinMode)
};
static const char *optionsDescription[] = { "Select the default EmuNAND.\n\n"
"It will be booted when no\n"
"directional pad buttons are pressed.",
"It will be booted when no directional\n"
"pad buttons are pressed (Up/Right/Down\n"
"/Left equal EmuNANDs 1/2/3/4).",
"Select the screen brightness.",
@ -876,17 +874,6 @@ void configMenu(bool oldPinStatus, u32 oldPinMode)
"(Up/Right/Down/Left equal EmuNANDs\n"
"1/2/3/4).",
"If enabled, when holding R on boot\n"
"SysNAND will be booted with an\n"
"EmuNAND FIRM.\n\n"
"Otherwise, an EmuNAND will be booted\n"
"with the SysNAND FIRM.\n\n"
"To use a different EmuNAND from the\n"
"default, hold a directional pad button\n"
"(Up/Right/Down/Left equal EmuNANDs\n"
"1/2/3/4), also add A if you have\n"
"a matching payload.",
"Enable loading external FIRMs and\n"
"system modules.\n\n"
"This isn't needed in most cases.\n\n"
@ -910,14 +897,10 @@ void configMenu(bool oldPinStatus, u32 oldPinMode)
"by about 10%. Can break some games\n"
"and other applications.\n",
"Enable showing the current NAND/FIRM:\n\n"
"Enable showing the current NAND:\n\n"
"\t* Sys = SysNAND\n"
"\t* Emu = EmuNAND 1\n"
"\t* EmuX = EmuNAND X\n"
"\t* SysE = SysNAND with EmuNAND 1 FIRM\n"
"\t* SyEX = SysNAND with EmuNAND X FIRM\n"
"\t* EmuS = EmuNAND 1 with SysNAND FIRM\n"
"\t* EmXS = EmuNAND X with SysNAND FIRM\n\n"
"\t* EmuX = EmuNAND X\n\n"
"or a user-defined custom string in\n"
"System Settings.\n\n"
"Refer to the wiki for instructions.",
@ -929,8 +912,10 @@ void configMenu(bool oldPinStatus, u32 oldPinMode)
FirmwareSource nandType = FIRMWARE_SYSNAND;
if(isSdMode)
{
// Check if there is at least one emuNAND
u32 emuIndex = 0;
nandType = FIRMWARE_EMUNAND;
locateEmuNand(&nandType);
locateEmuNand(&nandType, &emuIndex, false);
}
struct multiOption {
@ -953,7 +938,6 @@ void configMenu(bool oldPinStatus, u32 oldPinMode)
bool enabled;
bool visible;
} singleOptions[] = {
{ .visible = nandType == FIRMWARE_EMUNAND },
{ .visible = nandType == FIRMWARE_EMUNAND },
{ .visible = true },
{ .visible = true },

View File

@ -36,12 +36,12 @@
#define CONFIG_FILE "config.ini"
#define CONFIG_VERSIONMAJOR 3
#define CONFIG_VERSIONMINOR 7
#define CONFIG_VERSIONMINOR 8
#define BOOTCFG_NAND BOOTCONFIG(0, 7)
#define BOOTCFG_FIRM BOOTCONFIG(3, 7)
#define BOOTCFG_NOFORCEFLAG BOOTCONFIG(6, 1)
#define BOOTCFG_NTRCARDBOOT BOOTCONFIG(7, 1)
#define BOOTCFG_NAND BOOTCONFIG(0, 1)
#define BOOTCFG_EMUINDEX BOOTCONFIG(1, 3)
#define BOOTCFG_NOFORCEFLAG BOOTCONFIG(3, 1)
#define BOOTCFG_NTRCARDBOOT BOOTCONFIG(4, 1)
enum multiOptions
{
@ -57,7 +57,6 @@ enum multiOptions
enum singleOptions
{
AUTOBOOTEMU = 0,
USEEMUFIRM,
LOADEXTFIRMSANDMODULES,
PATCHGAMES,
REDIRECTAPPTHREADS,

View File

@ -322,7 +322,7 @@ __attribute__((aligned(4))) static u8 nandCtr[AES_BLOCK_SIZE];
static u8 nandSlot;
static u32 fatStart = 0;
FirmwareSource firmSource = FIRMWARE_SYSNAND;
FirmwareSource ctrNandLocation = FIRMWARE_SYSNAND;
__attribute__((aligned(4))) static const u8 key1s[2][AES_BLOCK_SIZE] = {
{0x07, 0x29, 0x44, 0x38, 0xF8, 0xC9, 0x75, 0x93, 0xAA, 0x0E, 0x4A, 0xB4, 0xAE, 0x84, 0xC1, 0xD8},
@ -348,7 +348,7 @@ int ctrNandInit(void)
u8 __attribute__((aligned(4))) temp[0x200];
//Read NCSD header
result = firmSource == FIRMWARE_SYSNAND ? sdmmc_nand_readsectors(0, 1, temp) : sdmmc_sdcard_readsectors(emuOffset + emuHeader, 1, temp);
result = ctrNandLocation == FIRMWARE_SYSNAND ? sdmmc_nand_readsectors(0, 1, temp) : sdmmc_sdcard_readsectors(emuOffset + emuHeader, 1, temp);
if(!result)
{
@ -375,7 +375,7 @@ int ctrNandRead(u32 sector, u32 sectorCount, u8 *outbuf)
//Read
int result;
if(firmSource == FIRMWARE_SYSNAND)
if(ctrNandLocation == FIRMWARE_SYSNAND)
result = sdmmc_nand_readsectors(sector + fatStart, sectorCount, outbuf);
else
{

View File

@ -110,7 +110,7 @@
#define SHA_224_HASH_SIZE (224 / 8)
#define SHA_1_HASH_SIZE (160 / 8)
extern FirmwareSource firmSource;
extern FirmwareSource ctrNandLocation;
void sha(void *res, const void *src, u32 size, u32 mode);

View File

@ -38,7 +38,7 @@
u32 emuOffset,
emuHeader;
void locateEmuNand(FirmwareSource *nandType)
void locateEmuNand(FirmwareSource *nandType, u32 *emunandIndex, bool configureCtrNandParams)
{
static u8 __attribute__((aligned(4))) temp[0x200];
static u32 nandSize = 0,
@ -51,7 +51,10 @@ void locateEmuNand(FirmwareSource *nandType)
fatStart = *(u32 *)(temp + 0x1C6); //First sector of the FAT partition
}
for(u32 i = 0; i < 3; i++)
/*if (*nandType == FIRMWARE_SYSNAND)
return;*/
for(u32 i = 0; i < 3; i++) // Test the different kinds of multi-EmuNAND there are, unless we are looking for the first one
{
static const u32 roundedMinsizes[] = {0x1D8000, 0x26E000};
@ -65,39 +68,45 @@ void locateEmuNand(FirmwareSource *nandType)
nandOffset = roundedMinsizes[ISN3DS ? 1 : 0]; //"Minsize" layout
break;
case 0:
nandOffset = *nandType == FIRMWARE_EMUNAND ? 0 : (nandSize > 0x200000 ? 0x400000 : 0x200000); //"Legacy" layout
nandOffset = nandSize > 0x200000 ? 0x400000 : 0x200000; //"Legacy" layout
break;
}
if(*nandType != FIRMWARE_EMUNAND) nandOffset *= ((u32)*nandType - 1);
nandOffset *= *emunandIndex; // always 0 for 1st EmuNAND
if(fatStart >= nandOffset + roundedMinsizes[ISN3DS ? 1 : 0])
{
//Check for RedNAND
if(!sdmmc_sdcard_readsectors(nandOffset + 1, 1, temp) && memcmp(temp + 0x100, "NCSD", 4) == 0)
{
if (configureCtrNandParams)
{
emuOffset = nandOffset + 1;
emuHeader = 0;
}
return;
}
//Check for Gateway EmuNAND
else if(i != 2 && !sdmmc_sdcard_readsectors(nandOffset + nandSize, 1, temp) && memcmp(temp + 0x100, "NCSD", 4) == 0)
{
if (configureCtrNandParams)
{
emuOffset = nandOffset;
emuHeader = nandSize;
}
return;
}
}
if(*nandType == FIRMWARE_EMUNAND) break;
if(*emunandIndex == 0) break; // See above comments
}
//Fallback to the first EmuNAND if there's no second/third/fourth one, or to SysNAND if there isn't any
if(*nandType != FIRMWARE_EMUNAND)
if(*emunandIndex != 0)
{
*nandType = FIRMWARE_EMUNAND;
locateEmuNand(nandType);
*emunandIndex = 0;
locateEmuNand(nandType, emunandIndex, configureCtrNandParams);
}
else *nandType = FIRMWARE_SYSNAND;
}

View File

@ -37,5 +37,5 @@
extern u32 emuOffset,
emuHeader;
void locateEmuNand(FirmwareSource *nandType);
void locateEmuNand(FirmwareSource *nandType, u32 *emunandIndex, bool configureCtrNandParams);
u32 patchEmuNand(u8 *arm9Section, u32 kernel9Size, u8 *process9Offset, u32 process9Size, u8 *kernel9Address, u32 firmVersion);

View File

@ -154,7 +154,7 @@ u32 loadNintendoFirm(FirmwareType *firmType, FirmwareSource nandType, bool loadF
u32 firmVersion = 0xFFFFFFFF,
firmSize;
bool ctrNandError = isSdMode && !mountFs(false, false);
bool ctrNandError = isSdMode && !remountCtrNandPartition(false);
if(!ctrNandError)
{

View File

@ -58,21 +58,40 @@ static bool switchToMainDir(bool isSd)
}
}
bool mountFs(bool isSd, bool switchToCtrNand)
bool mountSdCardPartition(bool switchMainDir)
{
static bool sdInitialized = false, nandInitialized = false;
if (isSd)
{
static bool sdInitialized = false;
if (!sdInitialized)
sdInitialized = f_mount(&sdFs, "sdmc:", 1) == FR_OK;
return sdInitialized && switchToMainDir(true);
}
else
if (sdInitialized && switchMainDir)
return f_chdrive("sdmc:") == FR_OK && switchToMainDir(true);
return sdInitialized;
}
bool remountCtrNandPartition(bool switchMainDir)
{
static bool nandInitialized = false;
if (nandInitialized)
{
if (f_unmount("nand:") != FR_OK)
return false;
nandInitialized = false;
}
if (!nandInitialized)
nandInitialized = f_mount(&nandFs, "nand:", 1) == FR_OK;
return nandInitialized && (!switchToCtrNand || (f_chdrive("nand:") == FR_OK && switchToMainDir(false)));
}
if (nandInitialized && switchMainDir)
return f_chdrive("nand:") == FR_OK && switchToMainDir(false);
return nandInitialized;
}
void unmountPartitions(void)
{
f_unmount("nand:");
f_unmount("sdmc:");
}
u32 fileRead(void *dest, const char *path, u32 maxSize)
@ -412,8 +431,7 @@ static bool backupEssentialFiles(void)
{
size_t sz = sizeof(fileCopyBuffer);
bool ok = !(isSdMode && !mountFs(false, false));
bool ok = true;
ok = ok && fileCopy("nand:/ro/sys/HWCAL0.dat", "backups/HWCAL0.dat", false, fileCopyBuffer, sz);
ok = ok && fileCopy("nand:/ro/sys/HWCAL1.dat", "backups/HWCAL1.dat", false, fileCopyBuffer, sz);
@ -454,10 +472,19 @@ static bool backupEssentialFiles(void)
bool doLumaUpgradeProcess(void)
{
// Ensure CTRNAND is mounted
bool ok = mountFs(false, false), ok2 = true;
if (!ok)
FirmwareSource oldCtrNandLocation = ctrNandLocation;
bool ok = true, ok2 = true, ok3 = true;
// Ensure SysNAND CTRNAND is mounted
if (isSdMode)
{
ctrNandLocation = FIRMWARE_SYSNAND;
if (!remountCtrNandPartition(false))
{
ctrNandLocation = oldCtrNandLocation;
return false;
}
}
// Try to boot.firm to CTRNAND, when applicable
if (isSdMode && memcmp(launchedPathForFatfs, "sdmc:", 5) == 0)
@ -470,5 +497,10 @@ bool doLumaUpgradeProcess(void)
fileDelete("sdmc:/luma/config.bin");
fileDelete("nand:/rw/luma/config.bin");
return ok && ok2;
if (isSdMode)
{
ctrNandLocation = oldCtrNandLocation;
ok3 = remountCtrNandPartition(false);
}
return ok && ok2 && ok3;
}

View File

@ -30,7 +30,10 @@
#define PATTERN(a) a "_*.firm"
bool mountFs(bool isSd, bool switchToCtrNand);
bool mountSdCardPartition(bool switchMainDir);
bool remountCtrNandPartition(bool switchMainDir);
void unmountPartitions(void);
u32 fileRead(void *dest, const char *path, u32 maxSize);
u32 getFileSize(const char *path);
bool fileWrite(const void *buffer, const char *path, u32 size);

View File

@ -45,7 +45,6 @@ extern u8 __itcm_start__[], __itcm_lma__[], __itcm_bss_start__[], __itcm_end__[]
extern CfgData configData;
extern ConfigurationStatus needConfig;
extern FirmwareSource firmSource;
bool isSdMode;
char launchedPathForFatfs[256];
@ -57,14 +56,16 @@ u8 mcuConsoleInfo[9];
void main(int argc, char **argv, u32 magicWord)
{
bool isFirmProtEnabled,
bool isFirmProtEnabled = true,
isSafeMode = false,
needToInitSd = false,
isNoForceFlagSet = false,
isInvalidLoader = false,
isNtrBoot;
FirmwareType firmType;
FirmwareSource nandType;
isNtrBoot = false;
FirmwareType firmType = NATIVE_FIRM;
FirmwareSource nandType = FIRMWARE_SYSNAND;
u32 emunandIndex = 0;
const vu8 *bootMediaStatus = (const vu8 *)0x1FFFE00C;
const vu32 *bootPartitionsStatus = (const vu32 *)0x1FFFE010;
u32 firmlaunchTidLow = 0;
@ -145,18 +146,18 @@ void main(int argc, char **argv, u32 magicWord)
if(memcmp(launchedPath, u"sdmc", 8) == 0)
{
if(!mountFs(true, false)) error("Failed to mount SD.");
if(!mountSdCardPartition(true)) error("Failed to mount SD.");
isSdMode = true;
}
else if(memcmp(launchedPath, u"nand", 8) == 0)
{
if(!mountFs(false, true)) error("Failed to mount CTRNAND.");
if(!remountCtrNandPartition(true)) error("Failed to mount CTRNAND.");
isSdMode = false;
}
else if(bootType == NTR || memcmp(launchedPath, u"firm", 8) == 0)
{
if(mountFs(true, false)) isSdMode = true;
else if(mountFs(false, true)) isSdMode = false;
if(mountSdCardPartition(true)) isSdMode = true;
else if(remountCtrNandPartition(true)) isSdMode = false;
else error("Failed to mount SD and CTRNAND.");
if(bootType == NTR)
@ -202,7 +203,7 @@ void main(int argc, char **argv, u32 magicWord)
}
nandType = (FirmwareSource)BOOTCFG_NAND;
firmSource = (FirmwareSource)BOOTCFG_FIRM;
emunandIndex = BOOTCFG_EMUINDEX;
isFirmProtEnabled = !BOOTCFG_NTRCARDBOOT;
goto boot;
@ -227,13 +228,12 @@ void main(int argc, char **argv, u32 magicWord)
if(bootenv == 7)
{
nandType = FIRMWARE_SYSNAND;
firmSource = (BOOTCFG_NAND != 0) == (BOOTCFG_FIRM != 0) ? FIRMWARE_SYSNAND : (FirmwareSource)BOOTCFG_FIRM;
// Prevent multiple boot options-forcing
// This bit is a bit weird. Basically, as you return to Home Menu by pressing either
// the HOME or POWER button, nandType will be overridden to "SysNAND" (needed). But,
// if you reboot again (e.g. via Rosalina menu), it'll use your default settings.
if(nandType != BOOTCFG_NAND || firmSource != BOOTCFG_FIRM) isNoForceFlagSet = true;
if(nandType != BOOTCFG_NAND) isNoForceFlagSet = true;
goto boot;
}
@ -247,7 +247,7 @@ void main(int argc, char **argv, u32 magicWord)
if(validTlnc || !(pressed || BOOTCFG_NOFORCEFLAG))
{
nandType = (FirmwareSource)BOOTCFG_NAND;
firmSource = (FirmwareSource)BOOTCFG_FIRM;
emunandIndex = BOOTCFG_EMUINDEX;
goto boot;
}
@ -280,7 +280,6 @@ void main(int argc, char **argv, u32 magicWord)
if(!CFG_BOOTENV && pressed == SAFE_MODE)
{
nandType = FIRMWARE_SYSNAND;
firmSource = FIRMWARE_SYSNAND;
isSafeMode = true;
needToInitSd = true;
@ -308,7 +307,6 @@ void main(int argc, char **argv, u32 magicWord)
if(!CFG_BOOTENV && pressed == SAFE_MODE)
{
nandType = FIRMWARE_SYSNAND;
firmSource = FIRMWARE_SYSNAND;
isSafeMode = true;
needToInitSd = true;
@ -322,51 +320,29 @@ void main(int argc, char **argv, u32 magicWord)
//If booting from CTRNAND, always use SysNAND
if(!isSdMode) nandType = FIRMWARE_SYSNAND;
//If R is pressed, boot the non-updated NAND with the FIRM of the opposite one
else if(pressed & BUTTON_R1)
{
if(CONFIG(USEEMUFIRM))
{
nandType = FIRMWARE_SYSNAND;
firmSource = FIRMWARE_EMUNAND;
}
else
{
nandType = FIRMWARE_EMUNAND;
firmSource = FIRMWARE_SYSNAND;
}
}
/* Else, boot the NAND the user set to autoboot or the opposite one, depending on L,
with their own FIRM */
else firmSource = nandType = (autoBootEmu == ((pressed & BUTTON_L1) == BUTTON_L1)) ? FIRMWARE_SYSNAND : FIRMWARE_EMUNAND;
else nandType = (autoBootEmu == ((pressed & BUTTON_L1) == BUTTON_L1)) ? FIRMWARE_SYSNAND : FIRMWARE_EMUNAND;
//If we're booting EmuNAND or using EmuNAND FIRM, determine which one from the directional pad buttons, or otherwise from the config
if(nandType == FIRMWARE_EMUNAND || firmSource == FIRMWARE_EMUNAND)
if(nandType == FIRMWARE_EMUNAND)
{
FirmwareSource tempNand;
switch(pressed & DPAD_BUTTONS)
{
case BUTTON_UP:
tempNand = FIRMWARE_EMUNAND;
emunandIndex = 0;
break;
case BUTTON_RIGHT:
tempNand = FIRMWARE_EMUNAND2;
emunandIndex = 1;
break;
case BUTTON_DOWN:
tempNand = FIRMWARE_EMUNAND3;
emunandIndex = 2;
break;
case BUTTON_LEFT:
tempNand = FIRMWARE_EMUNAND4;
emunandIndex = 3;
break;
default:
tempNand = (FirmwareSource)(1 + MULTICONFIG(DEFAULTEMU));
emunandIndex = MULTICONFIG(DEFAULTEMU);
break;
}
if(nandType == FIRMWARE_EMUNAND) nandType = tempNand;
else firmSource = tempNand;
}
boot:
@ -374,24 +350,21 @@ boot:
//If we need to boot EmuNAND, make sure it exists
if(nandType != FIRMWARE_SYSNAND)
{
locateEmuNand(&nandType);
if(nandType == FIRMWARE_SYSNAND) firmSource = FIRMWARE_SYSNAND;
else if((*(vu16 *)(SDMMC_BASE + REG_SDSTATUS0) & TMIO_STAT0_WRPROTECT) == 0) //Make sure the SD card isn't write protected
locateEmuNand(&nandType, &emunandIndex, true);
if(nandType == FIRMWARE_EMUNAND && (*(vu16 *)(SDMMC_BASE + REG_SDSTATUS0) & TMIO_STAT0_WRPROTECT) == 0) //Make sure the SD card isn't write protected
error("The SD card is locked, EmuNAND can not be used.\nPlease turn the write protection switch off.");
}
//Same if we're using EmuNAND as the FIRM source
else if(firmSource != FIRMWARE_SYSNAND)
locateEmuNand(&firmSource);
ctrNandLocation = nandType; // for CTRNAND partition
if(bootType != FIRMLAUNCH)
{
configData.bootConfig = ((bootType == NTR ? 1 : 0) << 7) | ((u32)isNoForceFlagSet << 6) | ((u32)firmSource << 3) | (u32)nandType;
configData.bootConfig = ((bootType == NTR ? 1 : 0) << 4) | ((u32)isNoForceFlagSet << 3) | ((u32)emunandIndex << 1) | (u32)nandType;
writeConfig(false);
}
bool loadFromStorage = CONFIG(LOADEXTFIRMSANDMODULES);
u32 firmVersion = loadNintendoFirm(&firmType, firmSource, loadFromStorage, isSafeMode);
u32 firmVersion = loadNintendoFirm(&firmType, nandType, loadFromStorage, isSafeMode);
bool doUnitinfoPatch = CONFIG(PATCHUNITINFO);
u32 res = 0;
@ -417,6 +390,7 @@ boot:
if(res != 0) error("Failed to apply %u FIRM patch(es).", res);
unmountPartitions();
if(bootType != FIRMLAUNCH) deinitScreens();
launchFirm(0, NULL);
}

View File

@ -122,9 +122,6 @@ typedef enum FirmwareSource
{
FIRMWARE_SYSNAND = 0,
FIRMWARE_EMUNAND,
FIRMWARE_EMUNAND2,
FIRMWARE_EMUNAND3,
FIRMWARE_EMUNAND4
} FirmwareSource;
typedef enum FirmwareType

View File

@ -115,6 +115,9 @@ u32 waitInput(bool isMenu)
void mcuPowerOff(void)
{
// Unmount partitions
unmountPartitions();
if(!needToSetupScreens) clearScreens(false);
//Shutdown LCD

View File

@ -9,10 +9,10 @@
#define MULTICONFIG(a) ((cfwInfo.multiConfig >> (2 * (a))) & 3)
#define BOOTCONFIG(a, b) ((cfwInfo.bootConfig >> (a)) & (b))
#define BOOTCFG_NAND BOOTCONFIG(0, 7)
#define BOOTCFG_FIRM BOOTCONFIG(3, 7)
#define BOOTCFG_NOFORCEFLAG BOOTCONFIG(6, 1)
#define BOOTCFG_NTRCARDBOOT BOOTCONFIG(7, 1)
#define BOOTCFG_NAND BOOTCONFIG(0, 1)
#define BOOTCFG_EMUINDEX BOOTCONFIG(1, 3)
#define BOOTCFG_NOFORCEFLAG BOOTCONFIG(3, 1)
#define BOOTCFG_NTRCARDBOOT BOOTCONFIG(4, 1)
enum multiOptions
{
@ -28,7 +28,6 @@ enum multiOptions
enum singleOptions
{
AUTOBOOTEMU = 0,
USEEMUFIRM,
LOADEXTFIRMSANDMODULES,
PATCHGAMES,
REDIRECTAPPTHREADS,

View File

@ -695,7 +695,7 @@ void patchCode(u64 progId, u16 progVer, u8 *code, u32 size, u32 textSize, u32 ro
&& CONFIG(PATCHVERSTRING))
{
static const u16 pattern[] = u"Ve";
u16 *patch;
const u16 *patch;
u32 patchSize = 0,
currentNand = BOOTCFG_NAND;
@ -706,26 +706,9 @@ void patchCode(u64 progId, u16 progVer, u8 *code, u32 size, u32 textSize, u32 ro
else
{
patchSize = 8;
u32 currentFirm = BOOTCFG_FIRM;
static u16 *verStringsNands[] = { u" Sys",
u" Emu",
u"Emu2",
u"Emu3",
u"Emu4" },
*verStringsEmuSys[] = { u"EmuS",
u"Em2S",
u"Em3S",
u"Em4S" },
*verStringsSysEmu[] = { u"SysE",
u"SyE2",
u"SyE3",
u"SyE4" };
patch = (currentFirm != 0) == (currentNand != 0) ? verStringsNands[currentNand] :
(!currentNand ? verStringsSysEmu[currentFirm - 1] : verStringsEmuSys[currentNand - 1]);
static const u16 *const verStringNandEmu[] = { u" Emu", u"Emu2", u"Emu3", u"Emu4" };
patch = currentNand == 0 ? u" Sys" : verStringNandEmu[BOOTCFG_EMUINDEX];
}
//Patch Ver. string

View File

@ -12,10 +12,10 @@
#define MULTICONFIG(a) ((multiConfig >> (2 * (a))) & 3)
#define BOOTCONFIG(a, b) ((bootConfig >> (a)) & (b))
#define BOOTCFG_NAND BOOTCONFIG(0, 7)
#define BOOTCFG_FIRM BOOTCONFIG(3, 7)
#define BOOTCFG_NOFORCEFLAG BOOTCONFIG(6, 1)
#define BOOTCFG_NTRCARDBOOT BOOTCONFIG(7, 1)
#define BOOTCFG_NAND BOOTCONFIG(0, 1)
#define BOOTCFG_EMUINDEX BOOTCONFIG(1, 3)
#define BOOTCFG_NOFORCEFLAG BOOTCONFIG(3, 1)
#define BOOTCFG_NTRCARDBOOT BOOTCONFIG(4, 1)
enum multiOptions
{
@ -31,7 +31,6 @@ enum multiOptions
enum singleOptions
{
AUTOBOOTEMU = 0,
USEEMUFIRM,
LOADEXTFIRMSANDMODULES,
PATCHGAMES,
REDIRECTAPPTHREADS,

View File

@ -6,10 +6,10 @@
#define MULTICONFIG(a) ((multiConfig >> (2 * (a))) & 3)
#define BOOTCONFIG(a, b) ((bootConfig >> (a)) & (b))
#define BOOTCFG_NAND BOOTCONFIG(0, 7)
#define BOOTCFG_FIRM BOOTCONFIG(3, 7)
#define BOOTCFG_NOFORCEFLAG BOOTCONFIG(6, 1)
#define BOOTCFG_NTRCARDBOOT BOOTCONFIG(7, 1)
#define BOOTCFG_NAND BOOTCONFIG(0, 1)
#define BOOTCFG_EMUINDEX BOOTCONFIG(1, 3)
#define BOOTCFG_NOFORCEFLAG BOOTCONFIG(3, 1)
#define BOOTCFG_NTRCARDBOOT BOOTCONFIG(4, 1)
enum multiOptions
{
@ -25,7 +25,6 @@ enum multiOptions
enum singleOptions
{
AUTOBOOTEMU = 0,
USEEMUFIRM,
LOADEXTFIRMSANDMODULES,
PATCHGAMES,
REDIRECTAPPTHREADS,

View File

@ -33,7 +33,6 @@
enum singleOptions
{
AUTOBOOTEMU = 0,
USEEMUFIRM,
LOADEXTFIRMSANDMODULES,
PATCHGAMES,
REDIRECTAPPTHREADS,

View File

@ -161,10 +161,9 @@ static size_t LumaConfig_SaveLumaIniConfigToStr(char *out, const CfgData *cfg)
lumaVerStr, lumaRevSuffixStr,
(int)cfg->formatVersionMajor, (int)cfg->formatVersionMinor,
(int)CONFIG(AUTOBOOTEMU), (int)CONFIG(USEEMUFIRM),
(int)CONFIG(LOADEXTFIRMSANDMODULES), (int)CONFIG(PATCHGAMES),
(int)CONFIG(REDIRECTAPPTHREADS), (int)CONFIG(PATCHVERSTRING),
(int)CONFIG(SHOWGBABOOT),
(int)CONFIG(AUTOBOOTEMU), (int)CONFIG(LOADEXTFIRMSANDMODULES),
(int)CONFIG(PATCHGAMES), (int)CONFIG(REDIRECTAPPTHREADS),
(int)CONFIG(PATCHVERSTRING), (int)CONFIG(SHOWGBABOOT),
1 + (int)MULTICONFIG(DEFAULTEMU), 4 - (int)MULTICONFIG(BRIGHTNESS),
splashPosStr, (unsigned int)cfg->splashDurationMsec,