From 1572bfd989e60555e91f9c82e797c83798a0b15d Mon Sep 17 00:00:00 2001 From: TuxSH Date: Wed, 27 Dec 2017 19:30:57 +0100 Subject: [PATCH 1/3] [sm] Fix process unregistering logic bug (fixes #984) In this case pm+sm were supposed to automatically unregister ro's services (the kernel can close a dying process's handle automatically). Not doing this apparently induced a reference leak of DevMenu's as a process, preventing it to be destroyed and the memory allocation reslimit counter to be updated by KProcess's destructor accordingly. --- sysmodules/sm/source/processes.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sysmodules/sm/source/processes.c b/sysmodules/sm/source/processes.c index b4f7236..5977e98 100644 --- a/sysmodules/sm/source/processes.c +++ b/sysmodules/sm/source/processes.c @@ -58,13 +58,16 @@ Result UnregisterProcess(u32 pid) svcCloseHandle(processData->notificationSemaphore); // Unregister the services registered by the process - for(u32 i = 0; i < nbServices; i++) + u32 i = 0; + while(i < nbServices) { if(servicesInfo[i].pid == pid) { svcCloseHandle(servicesInfo[i].clientPort); servicesInfo[i] = servicesInfo[--nbServices]; } + else + ++i; } moveNode(processData, &freeProcessDataList, false); From 93561003e82950472362e9d8b5039fd44eceb07e Mon Sep 17 00:00:00 2001 From: Mikaela RJ Szekely Date: Thu, 28 Dec 2017 21:50:06 -0500 Subject: [PATCH 2/3] Implement #989: Add configurable splash duration --- k11_extension/include/config.h | 1 + source/config.c | 7 +++++++ source/config.h | 3 ++- source/draw.c | 5 ++++- sysmodules/loader/source/patcher.h | 1 + 5 files changed, 15 insertions(+), 2 deletions(-) diff --git a/k11_extension/include/config.h b/k11_extension/include/config.h index e1c6392..5193cc2 100644 --- a/k11_extension/include/config.h +++ b/k11_extension/include/config.h @@ -19,6 +19,7 @@ enum multiOptions DEFAULTEMU = 0, BRIGHTNESS, SPLASH, + SPLASH_DURATION, PIN, NEWCPU }; diff --git a/source/config.c b/source/config.c index 58262da..e6abadb 100644 --- a/source/config.c +++ b/source/config.c @@ -81,6 +81,7 @@ void configMenu(bool oldPinStatus, u32 oldPinMode) static const char *multiOptionsText[] = { "Default EmuNAND: 1( ) 2( ) 3( ) 4( )", "Screen brightness: 4( ) 3( ) 2( ) 1( )", "Splash: Off( ) Before( ) After( ) payloads", + "Splash duration 1( ) 3( ) 5( ) 7( ) seconds", "PIN lock: Off( ) 4( ) 6( ) 8( ) digits", "New 3DS CPU: Off( ) Clock( ) L2( ) Clock+L2( )", }; @@ -109,6 +110,11 @@ void configMenu(bool oldPinStatus, u32 oldPinMode) "\t* 'After payloads' displays it\n" "afterwards.", + "Select how long the splash screen\n" + "displays.\n\n" + "This has no effect if the splash\n" + "screen is not enabled.", + "Activate a PIN lock.\n\n" "The PIN will be asked each time\n" "Luma3DS boots.\n\n" @@ -198,6 +204,7 @@ void configMenu(bool oldPinStatus, u32 oldPinMode) { .posXs = {19, 24, 29, 34}, .visible = isSdMode }, { .posXs = {21, 26, 31, 36}, .visible = true }, { .posXs = {12, 22, 31, 0}, .visible = true }, + { .posXs = {18, 23, 28, 33}, .visible = true }, { .posXs = {14, 19, 24, 29}, .visible = true }, { .posXs = {17, 26, 32, 44}, .visible = ISN3DS }, }; diff --git a/source/config.h b/source/config.h index dfcb5d7..ebd14cd 100644 --- a/source/config.h +++ b/source/config.h @@ -34,7 +34,7 @@ #define CONFIG_FILE "config.bin" #define CONFIG_VERSIONMAJOR 2 -#define CONFIG_VERSIONMINOR 2 +#define CONFIG_VERSIONMINOR 3 #define BOOTCFG_NAND BOOTCONFIG(0, 7) #define BOOTCFG_FIRM BOOTCONFIG(3, 7) @@ -46,6 +46,7 @@ enum multiOptions DEFAULTEMU = 0, BRIGHTNESS, SPLASH, + SPLASH_DURATION, PIN, NEWCPU }; diff --git a/source/draw.c b/source/draw.c index 485a821..76d7334 100644 --- a/source/draw.c +++ b/source/draw.c @@ -36,6 +36,7 @@ #include "fs.h" #include "fmt.h" #include "font.h" +#include "config.h" bool loadSplash(void) { @@ -56,7 +57,9 @@ bool loadSplash(void) if(!isTopSplashValid && !isBottomSplashValid) return false; swapFramebuffers(true); - wait(3000ULL); + + u32 durationIndex = MULTICONFIG(SPLASH_DURATION); + wait(1000ULL + (durationIndex * 2000ULL)); return true; } diff --git a/sysmodules/loader/source/patcher.h b/sysmodules/loader/source/patcher.h index a4e4ee9..e2eebd7 100644 --- a/sysmodules/loader/source/patcher.h +++ b/sysmodules/loader/source/patcher.h @@ -21,6 +21,7 @@ enum multiOptions DEFAULTEMU = 0, BRIGHTNESS, SPLASH, + SPLASH_DURATION, PIN, NEWCPU }; From bfec874a7c7e95e90f046eafca31b3e1d8698ee2 Mon Sep 17 00:00:00 2001 From: Mikaela RJ Szekely Date: Thu, 28 Dec 2017 22:02:06 -0500 Subject: [PATCH 3/3] Add colon in option that I forgot --- source/config.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/config.c b/source/config.c index e6abadb..a4a1130 100644 --- a/source/config.c +++ b/source/config.c @@ -81,7 +81,7 @@ void configMenu(bool oldPinStatus, u32 oldPinMode) static const char *multiOptionsText[] = { "Default EmuNAND: 1( ) 2( ) 3( ) 4( )", "Screen brightness: 4( ) 3( ) 2( ) 1( )", "Splash: Off( ) Before( ) After( ) payloads", - "Splash duration 1( ) 3( ) 5( ) 7( ) seconds", + "Splash duration: 1( ) 3( ) 5( ) 7( ) seconds", "PIN lock: Off( ) 4( ) 6( ) 8( ) digits", "New 3DS CPU: Off( ) Clock( ) L2( ) Clock+L2( )", }; @@ -204,7 +204,7 @@ void configMenu(bool oldPinStatus, u32 oldPinMode) { .posXs = {19, 24, 29, 34}, .visible = isSdMode }, { .posXs = {21, 26, 31, 36}, .visible = true }, { .posXs = {12, 22, 31, 0}, .visible = true }, - { .posXs = {18, 23, 28, 33}, .visible = true }, + { .posXs = {19, 24, 29, 34}, .visible = true }, { .posXs = {14, 19, 24, 29}, .visible = true }, { .posXs = {17, 26, 32, 44}, .visible = ISN3DS }, };