diff --git a/README.md b/README.md index 91df4ba..8010958 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ 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. -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). --- diff --git a/chainloader/source/start.s b/chainloader/source/start.s index 60f149e..f1c9d52 100644 --- a/chainloader/source/start.s +++ b/chainloader/source/start.s @@ -56,5 +56,5 @@ disableMpuAndJumpToEntrypoints: @ Jump to the ARM9 entrypoint mov r0, r4 mov r1, r5 - ldr r2, =0x1BEEF + ldr r2, =0x2BEEF bx r6 diff --git a/sysmodules/rosalina/include/menu.h b/sysmodules/rosalina/include/menu.h index 9cf5a26..6fcc48b 100644 --- a/sysmodules/rosalina/include/menu.h +++ b/sysmodules/rosalina/include/menu.h @@ -78,6 +78,9 @@ extern u32 menuCombo; u32 waitInputWithTimeout(u32 msec); u32 waitInput(void); +u32 waitComboWithTimeout(u32 msec); +u32 waitCombo(void); + MyThread *menuCreateThread(void); void menuEnter(void); void menuLeave(void); diff --git a/sysmodules/rosalina/kernel_extension/include/fatalExceptionHandlers.h b/sysmodules/rosalina/kernel_extension/include/fatalExceptionHandlers.h index bf5e9eb..2deccb9 100644 --- a/sysmodules/rosalina/kernel_extension/include/fatalExceptionHandlers.h +++ b/sysmodules/rosalina/kernel_extension/include/fatalExceptionHandlers.h @@ -28,10 +28,9 @@ #include "types.h" -bool isExceptionFatal(u32 spsr); +bool isExceptionFatal(u32 spsr, u32 *regs, u32 index); bool isDataAbortExceptionRangeControlled(u32 spsr, u32 addr); - void FIQHandler(void); void undefinedInstructionHandler(void); void prefetchAbortHandler(void); diff --git a/sysmodules/rosalina/kernel_extension/source/fatalExceptionHandlers.s b/sysmodules/rosalina/kernel_extension/source/fatalExceptionHandlers.s index 9a0c455..30a9aec 100644 --- a/sysmodules/rosalina/kernel_extension/source/fatalExceptionHandlers.s +++ b/sysmodules/rosalina/kernel_extension/source/fatalExceptionHandlers.s @@ -47,6 +47,8 @@ push {r0-r12, lr} mrs r0, spsr + mov r1, sp + mov r2, #\index bl isExceptionFatal cmp r0, #0 pop {r0-r12, lr} @@ -138,7 +140,7 @@ _commonHandler: mcr p15, 0, r0, c7, c10, 4 @ Drain Synchronization Barrier ldr r0, =isN3DS - ldr r0, [r0] + ldrb r0, [r0] cmp r0, #0 beq _no_L2C ldr r0, =(0x17e10100 | 1 << 31) diff --git a/sysmodules/rosalina/kernel_extension/source/fatalExceptionHandlersMain.c b/sysmodules/rosalina/kernel_extension/source/fatalExceptionHandlersMain.c index 8879ae7..295c898 100644 --- a/sysmodules/rosalina/kernel_extension/source/fatalExceptionHandlersMain.c +++ b/sysmodules/rosalina/kernel_extension/source/fatalExceptionHandlersMain.c @@ -33,7 +33,7 @@ #define REG_DUMP_SIZE 4 * 23 #define CODE_DUMP_SIZE 48 -bool isExceptionFatal(u32 spsr) +bool isExceptionFatal(u32 spsr, u32 *regs, u32 index) { if((spsr & 0x1f) != 0x10) return true; @@ -51,6 +51,10 @@ bool isExceptionFatal(u32 spsr) thread = KPROCESS_GET_RVALUE(currentProcess, mainThread); if(thread != NULL && thread->threadLocalStorage != NULL && *((vu32 *)thread->threadLocalStorage + 0x10) != 0) 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; diff --git a/sysmodules/rosalina/source/gdb/query.c b/sysmodules/rosalina/source/gdb/query.c index f41e663..af2a79c 100644 --- a/sysmodules/rosalina/source/gdb/query.c +++ b/sysmodules/rosalina/source/gdb/query.c @@ -111,7 +111,10 @@ GDB_DECLARE_QUERY_HANDLER(Supported) "PacketSize=%x;" "qXfer:features:read+;qXfer:osdata:read+;" "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) diff --git a/sysmodules/rosalina/source/menu.c b/sysmodules/rosalina/source/menu.c index 087a56c..5c242eb 100644 --- a/sysmodules/rosalina/source/menu.c +++ b/sysmodules/rosalina/source/menu.c @@ -81,6 +81,47 @@ u32 waitInput(void) 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) { #define TRY(expr) if(R_FAILED(res = (expr))) { svcCloseHandle(mcuhwcHandle); return res; } diff --git a/sysmodules/rosalina/source/menus/miscellaneous.c b/sysmodules/rosalina/source/menus/miscellaneous.c index 06f3c5e..840ada2 100644 --- a/sysmodules/rosalina/source/menus/miscellaneous.c +++ b/sysmodules/rosalina/source/menus/miscellaneous.c @@ -146,7 +146,7 @@ void MiscellaneousMenu_ChangeMenuCombo(void) Draw_FlushFramebuffer(); Draw_Unlock(); - menuCombo = waitInput(); + menuCombo = waitCombo(); MiscellaneousMenu_ConvertComboToString(comboStr, menuCombo); do