From d0b9e3690875d507d521e5630725539fc15ae545 Mon Sep 17 00:00:00 2001 From: T3CHNOLOG1C Date: Mon, 5 Jun 2017 06:58:19 -0400 Subject: [PATCH 1/6] fix typo in readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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). --- From dda11206db86ca636ed42cb0b157da56d693cecd Mon Sep 17 00:00:00 2001 From: TuxSH Date: Mon, 5 Jun 2017 19:32:37 +0200 Subject: [PATCH 2/6] Fix bug in fatalExceptionHandlers.s --- .../rosalina/kernel_extension/source/fatalExceptionHandlers.s | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sysmodules/rosalina/kernel_extension/source/fatalExceptionHandlers.s b/sysmodules/rosalina/kernel_extension/source/fatalExceptionHandlers.s index 9a0c455..d0f7b9d 100644 --- a/sysmodules/rosalina/kernel_extension/source/fatalExceptionHandlers.s +++ b/sysmodules/rosalina/kernel_extension/source/fatalExceptionHandlers.s @@ -138,7 +138,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) From 26dd61e4e6352a35c0e69e804e093ba0a6025f9b Mon Sep 17 00:00:00 2001 From: TuxSH Date: Mon, 5 Jun 2017 20:28:33 +0200 Subject: [PATCH 3/6] Fix (work around) Nintendo own HM bug, GG Ninty --- .../kernel_extension/include/fatalExceptionHandlers.h | 3 +-- .../kernel_extension/source/fatalExceptionHandlers.s | 2 ++ .../kernel_extension/source/fatalExceptionHandlersMain.c | 6 +++++- 3 files changed, 8 insertions(+), 3 deletions(-) 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 d0f7b9d..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} 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; From 0ac6db006adbd5d72fe07e6e540b454d1fe975a4 Mon Sep 17 00:00:00 2001 From: TuxSH Date: Mon, 5 Jun 2017 21:23:17 +0200 Subject: [PATCH 4/6] Work around a GDB bug (w/r/t packet size) --- sysmodules/rosalina/source/gdb/query.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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) From 0ba7f9dba05fee44a85495698479e1d830c20970 Mon Sep 17 00:00:00 2001 From: TuxSH Date: Mon, 5 Jun 2017 21:24:18 +0200 Subject: [PATCH 5/6] Fix chainloader --- chainloader/source/start.s | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From 60d136f9b52c5b2954ccf027b57f82c502214453 Mon Sep 17 00:00:00 2001 From: Aurora Wright Date: Tue, 6 Jun 2017 01:21:52 +0200 Subject: [PATCH 6/6] Fix #491 --- sysmodules/rosalina/include/menu.h | 3 ++ sysmodules/rosalina/source/menu.c | 41 +++++++++++++++++++ .../rosalina/source/menus/miscellaneous.c | 2 +- 3 files changed, 45 insertions(+), 1 deletion(-) 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/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