Merge master into developer

This commit is contained in:
Aurora
2016-09-03 19:22:01 +02:00
7 changed files with 13 additions and 190 deletions

View File

@@ -80,7 +80,6 @@ void configMenu(bool oldPinStatus)
"( ) Use second EmuNAND as default",
"( ) Enable region/language emu. and ext. .code",
"( ) Show current NAND in System Settings",
"( ) Enable experimental TwlBg patches",
"( ) Show GBA boot screen in patched AGB_FIRM",
"( ) Display splash screen before payloads",
"( ) Use a PIN",
@@ -234,7 +233,7 @@ void configMenu(bool oldPinStatus)
for(u32 i = 0; i < singleOptionsAmount; i++)
configData.config |= (singleOptions[i].enabled ? 1 : 0) << (i + 16);
if(CONFIG(8)) newPin(oldPinStatus);
if(CONFIG(7)) newPin(oldPinStatus);
else if(oldPinStatus) fileDelete("/luma/pin.bin");
//Wait for the pressed buttons to change

View File

@@ -94,9 +94,6 @@ void main(void)
}
else
{
//Get pressed buttons
u32 pressed = HID_PAD;
isFirmlaunch = false;
firmType = NATIVE_FIRM;
@@ -105,6 +102,9 @@ void main(void)
if(isA9lh) installArm9Handlers();
//Get pressed buttons
u32 pressed = HID_PAD;
//Save old options and begin saving the new boot configuration
configTemp = (configData.config & 0xFFFFFFC0) | ((u32)isA9lh << 3);
@@ -135,7 +135,7 @@ void main(void)
//Boot options aren't being forced
if(needConfig != DONT_CONFIGURE)
{
bool pinExists = CONFIG(8) && verifyPin();
bool pinExists = CONFIG(7) && verifyPin();
//If no configuration file exists or SELECT is held, load configuration menu
bool shouldLoadConfigMenu = needConfig == CREATE_CONFIGURATION || ((pressed & BUTTON_SELECT) && !(pressed & BUTTON_L1));
@@ -165,7 +165,7 @@ void main(void)
}
else
{
if(CONFIG(7) && loadSplash()) pressed = HID_PAD;
if(CONFIG(6) && loadSplash()) pressed = HID_PAD;
/* If L and R/A/Select or one of the single payload buttons are pressed,
chainload an external payload */
@@ -173,7 +173,7 @@ void main(void)
if(shouldLoadPayload) loadPayload(pressed);
if(!CONFIG(7)) loadSplash();
if(!CONFIG(6)) loadSplash();
//Determine if the user chose to use the SysNAND FIRM as default for a R boot
bool useSysAsDefault = isA9lh ? CONFIG(1) : false;
@@ -358,7 +358,7 @@ static inline void patchNativeFirm(u32 firmVersion, FirmwareSource nandType, u32
patchKernel11Panic(arm11Section1, section[1].size);
}
if(CONFIG(9))
if(CONFIG(8))
{
patchArm11SvcAccessChecks(arm11SvcHandler);
patchK11ModuleChecks(arm11Section1, section[1].size, &freeK11Space);
@@ -381,8 +381,6 @@ static inline void patchLegacyFirm(FirmwareType firmType)
if(DEV_OPTIONS == 1) patchUnitInfoValueSet(arm9Section, section[3].size);
applyLegacyFirmPatches((u8 *)firm, firmType);
if(firmType == TWL_FIRM && CONFIG(5)) patchTwlBg((u8 *)firm + section[1].offset);
}
static inline void patch1x2xNativeAndSafeFirm(void)

View File

@@ -26,7 +26,6 @@
#include "../build/rebootpatch.h"
#include "../build/svcGetCFWInfopatch.h"
#include "../build/k11modulespatch.h"
#include "../build/twl_k11modulespatch.h"
u8 *getProcess9(u8 *pos, u32 size, u32 *process9Size, u32 *process9MemAddr)
{
@@ -136,7 +135,6 @@ void reimplementSvcBackdoor(u8 *pos, u32 *arm11SvcTable, u8 **freeK11Space)
}
}
void implementSvcGetCFWInfo(u8 *pos, u32 *arm11SvcTable, u8 **freeK11Space)
{
memcpy(*freeK11Space, svcGetCFWInfo, svcGetCFWInfo_size);
@@ -193,7 +191,7 @@ void applyLegacyFirmPatches(u8 *pos, FirmwareType firmType)
/* Calculate the amount of patches to apply. Only count the boot screen patch for AGB_FIRM
if the matching option was enabled (keep it as last) */
u32 numPatches = firmType == TWL_FIRM ? (sizeof(twlPatches) / sizeof(patchData)) :
(sizeof(agbPatches) / sizeof(patchData) - !CONFIG(6));
(sizeof(agbPatches) / sizeof(patchData) - !CONFIG(5));
const patchData *patches = firmType == TWL_FIRM ? twlPatches : agbPatches;
//Patch
@@ -213,26 +211,6 @@ void applyLegacyFirmPatches(u8 *pos, FirmwareType firmType)
}
}
void patchTwlBg(u8 *pos)
{
u8 *dst = pos + (isN3DS ? 0xFEA4 : 0xFCA0);
memcpy(dst, twl_k11modules, twl_k11modules_size); //Install K11 hook
u32 *off = (u32 *)memsearch(dst, "LAUN", twl_k11modules_size, 4);
*off = isN3DS ? 0xCDE88 : 0xCD5F8; //Dev SRL launcher offset
u16 *src1 = (u16 *)(pos + (isN3DS ? 0xE38 : 0xE3C)),
*src2 = (u16 *)(pos + (isN3DS ? 0xE54 : 0xE58));
//Construct BLX instructions:
src1[0] = 0xF000 | ((((u32)dst - (u32)src1 - 4) & (0xFFF << 11)) >> 12);
src1[1] = 0xE800 | ((((u32)dst - (u32)src1 - 4) & 0xFFF) >> 1);
src2[0] = 0xF000 | ((((u32)dst - (u32)src2 - 4) & (0xFFF << 11)) >> 12);
src2[1] = 0xE800 | ((((u32)dst - (u32)src2 - 4) & 0xFFF) >> 1);
}
void patchArm9ExceptionHandlersInstall(u8 *pos, u32 size)
{
const u8 pattern[] = {0x03, 0xA0, 0xE3, 0x18};

View File

@@ -59,7 +59,6 @@ void patchOldFirmWrites(u8 *pos, u32 size);
void reimplementSvcBackdoor(u8 *pos, u32 *arm11SvcTable, u8 **freeK11Space);
void implementSvcGetCFWInfo(u8 *pos, u32 *arm11SvcTable, u8 **freeK11Space);
void applyLegacyFirmPatches(u8 *pos, FirmwareType firmType);
void patchTwlBg(u8 *pos);
void patchArm9ExceptionHandlersInstall(u8 *pos, u32 size);
u32 getInfoForArm11ExceptionHandlers(u8 *pos, u32 size, u32 *codeSetOffset);