This commit is contained in:
Aurora Wright 2017-06-06 02:13:02 +02:00
commit 6ec21611c0
9 changed files with 60 additions and 8 deletions

View File

@ -7,7 +7,7 @@
It also allows you to run unauthorized ("homebrew") content by removing signature checks. It also allows you to run unauthorized ("homebrew") content by removing signature checks.
To use it, you will need a console capable of running homebrew software on the ARM9 processor. We recommend [Plailect's guide](https://3ds.guide/) for details on how to get your system ready. To use it, you will need a console capable of running homebrew software on the ARM9 processor. We recommend [Plailect's guide](https://3ds.guide/) for details on how to get your system ready.
Since Luma3DS v8.0, Luma3DS has its own in-game menu, triggerable by `L+Start+Select` (see the release notes). Since Luma3DS v8.0, Luma3DS has its own in-game menu, triggerable by `L+Down+Select` (see the release notes).
--- ---

View File

@ -56,5 +56,5 @@ disableMpuAndJumpToEntrypoints:
@ Jump to the ARM9 entrypoint @ Jump to the ARM9 entrypoint
mov r0, r4 mov r0, r4
mov r1, r5 mov r1, r5
ldr r2, =0x1BEEF ldr r2, =0x2BEEF
bx r6 bx r6

View File

@ -78,6 +78,9 @@ extern u32 menuCombo;
u32 waitInputWithTimeout(u32 msec); u32 waitInputWithTimeout(u32 msec);
u32 waitInput(void); u32 waitInput(void);
u32 waitComboWithTimeout(u32 msec);
u32 waitCombo(void);
MyThread *menuCreateThread(void); MyThread *menuCreateThread(void);
void menuEnter(void); void menuEnter(void);
void menuLeave(void); void menuLeave(void);

View File

@ -28,10 +28,9 @@
#include "types.h" #include "types.h"
bool isExceptionFatal(u32 spsr); bool isExceptionFatal(u32 spsr, u32 *regs, u32 index);
bool isDataAbortExceptionRangeControlled(u32 spsr, u32 addr); bool isDataAbortExceptionRangeControlled(u32 spsr, u32 addr);
void FIQHandler(void); void FIQHandler(void);
void undefinedInstructionHandler(void); void undefinedInstructionHandler(void);
void prefetchAbortHandler(void); void prefetchAbortHandler(void);

View File

@ -47,6 +47,8 @@
push {r0-r12, lr} push {r0-r12, lr}
mrs r0, spsr mrs r0, spsr
mov r1, sp
mov r2, #\index
bl isExceptionFatal bl isExceptionFatal
cmp r0, #0 cmp r0, #0
pop {r0-r12, lr} pop {r0-r12, lr}
@ -138,7 +140,7 @@ _commonHandler:
mcr p15, 0, r0, c7, c10, 4 @ Drain Synchronization Barrier mcr p15, 0, r0, c7, c10, 4 @ Drain Synchronization Barrier
ldr r0, =isN3DS ldr r0, =isN3DS
ldr r0, [r0] ldrb r0, [r0]
cmp r0, #0 cmp r0, #0
beq _no_L2C beq _no_L2C
ldr r0, =(0x17e10100 | 1 << 31) ldr r0, =(0x17e10100 | 1 << 31)

View File

@ -33,7 +33,7 @@
#define REG_DUMP_SIZE 4 * 23 #define REG_DUMP_SIZE 4 * 23
#define CODE_DUMP_SIZE 48 #define CODE_DUMP_SIZE 48
bool isExceptionFatal(u32 spsr) bool isExceptionFatal(u32 spsr, u32 *regs, u32 index)
{ {
if((spsr & 0x1f) != 0x10) return true; if((spsr & 0x1f) != 0x10) return true;
@ -51,6 +51,10 @@ bool isExceptionFatal(u32 spsr)
thread = KPROCESS_GET_RVALUE(currentProcess, mainThread); thread = KPROCESS_GET_RVALUE(currentProcess, mainThread);
if(thread != NULL && thread->threadLocalStorage != NULL && *((vu32 *)thread->threadLocalStorage + 0x10) != 0) if(thread != NULL && thread->threadLocalStorage != NULL && *((vu32 *)thread->threadLocalStorage + 0x10) != 0)
return false; return false;
if(index == 3 && strcmp(codeSetOfProcess(currentProcess)->processName, "menu") == 0 && // workaround a Home Menu bug leading to a dabort
regs[0] == 0x3FFF && regs[2] == 0 && regs[5] == 2 && regs[7] == 1)
return false;
} }
return true; return true;

View File

@ -111,7 +111,10 @@ GDB_DECLARE_QUERY_HANDLER(Supported)
"PacketSize=%x;" "PacketSize=%x;"
"qXfer:features:read+;qXfer:osdata:read+;" "qXfer:features:read+;qXfer:osdata:read+;"
"QStartNoAckMode+;QThreadEvents+;QCatchSyscalls+;" "QStartNoAckMode+;QThreadEvents+;QCatchSyscalls+;"
"vContSupported+;swbreak+", sizeof(ctx->buffer)); "vContSupported+;swbreak+",
GDB_BUF_LEN // should have been sizeof(ctx->buffer) but GDB memory functions are bugged
);
} }
GDB_DECLARE_QUERY_HANDLER(StartNoAckMode) GDB_DECLARE_QUERY_HANDLER(StartNoAckMode)

View File

@ -81,6 +81,47 @@ u32 waitInput(void)
return waitInputWithTimeout(0); return waitInputWithTimeout(0);
} }
u32 waitComboWithTimeout(u32 msec)
{
u32 key = 0;
u32 n = 0;
//Wait for no keys to be pressed
while(HID_PAD && !terminationRequest && (msec == 0 || n < msec))
{
svcSleepThread(1 * 1000 * 1000LL);
n++;
}
if(terminationRequest || (msec != 0 && n >= msec))
return 0;
do
{
svcSleepThread(1 * 1000 * 1000LL);
n++;
u32 tempKey = HID_PAD;
for(u32 i = 0x26000; i > 0; i--)
{
if(tempKey != HID_PAD) break;
if(i == 1) key = tempKey;
}
}
while((!key || HID_PAD) && !terminationRequest && (msec == 0 || n < msec));
if(terminationRequest || (msec != 0 && n >= msec))
return 0;
return key;
}
u32 waitCombo(void)
{
return waitComboWithTimeout(0);
}
static Result _MCUHWC_GetBatteryLevel(u8 *out) static Result _MCUHWC_GetBatteryLevel(u8 *out)
{ {
#define TRY(expr) if(R_FAILED(res = (expr))) { svcCloseHandle(mcuhwcHandle); return res; } #define TRY(expr) if(R_FAILED(res = (expr))) { svcCloseHandle(mcuhwcHandle); return res; }

View File

@ -146,7 +146,7 @@ void MiscellaneousMenu_ChangeMenuCombo(void)
Draw_FlushFramebuffer(); Draw_FlushFramebuffer();
Draw_Unlock(); Draw_Unlock();
menuCombo = waitInput(); menuCombo = waitCombo();
MiscellaneousMenu_ConvertComboToString(comboStr, menuCombo); MiscellaneousMenu_ConvertComboToString(comboStr, menuCombo);
do do