Allow for separate custom versions for each NAND

This commit is contained in:
Aurora 2016-09-23 00:08:15 +02:00
parent 2cbaf39fd5
commit 4f11162fae

View File

@ -67,13 +67,17 @@ static bool secureInfoExists(void)
return exists;
}
static void loadCustomVerString(u16 *out, u32 *verStringSize)
static void loadCustomVerString(u16 *out, u32 *verStringSize, u32 currentNand)
{
static const char path[] = "/luma/customversion.txt";
static const char *paths[] = { "/luma/customversion_sys.txt",
"/luma/customversion_emu.txt",
"/luma/customversion_emu2.txt",
"/luma/customversion_emu3.txt",
"/luma/customversion_emu4.txt" };
IFile file;
if(R_SUCCEEDED(fileOpen(&file, ARCHIVE_SDMC, path, FS_OPEN_READ)))
if(R_SUCCEEDED(fileOpen(&file, ARCHIVE_SDMC, paths[currentNand], FS_OPEN_READ)))
{
u64 fileSize;
@ -403,16 +407,16 @@ void patchCode(u64 progId, u8 *code, u32 size)
static const u16 verPattern[] = u"Ver.";
static u16 *verString;
u32 verStringSize = 0;
u32 currentNand = BOOTCFG_NAND;
u16 customVerString[19];
loadCustomVerString(customVerString, &verStringSize);
loadCustomVerString(customVerString, &verStringSize, currentNand);
if(verStringSize != 0) verString = customVerString;
else
{
verStringSize = 8;
u32 currentNand = BOOTCFG_NAND,
currentFirm = BOOTCFG_FIRM;
u32 currentFirm = BOOTCFG_FIRM;
bool matchingFirm = (currentFirm != 0) == (currentNand != 0);
static u16 verStringEmu[] = u"Emu ",