Homebrew [Release] 3DS Quick Shutdown

mashers

Stubborn ape
Member
Joined
Jun 10, 2015
Messages
3,837
Trophies
0
Age
40
Location
Kongo Jungle
XP
5,074
Country
But I think include a shutdown button on your launcher will be great for many people (specially, N3DS users) after all! Do it, please!
Well I've already done it and it works. It's in the menu you see when you press START. I just want to wait for daxtsu to say it's ok to include his code before I release this update.
 

mashers

Stubborn ape
Member
Joined
Jun 10, 2015
Messages
3,837
Trophies
0
Age
40
Location
Kongo Jungle
XP
5,074
Country
You're welcome. You probably won't need the hacky one-time call to aptMainLoop from a properly running application like your launcher, btw.
Actually I just lifted the shutdown3DS() function so that part wasn't included :)

Great, mashers! :yay:
Thanks! It's included in beta 64 which is up now.
 

Keylogger

Well-Known Member
Member
Joined
May 3, 2006
Messages
2,639
Trophies
1
Age
34
Website
Visit site
XP
6,636
Country
France
It's not working / semi-working on my N3DS 9.0.
I use the cia version of quick-shutdown-always, the screen is black but the power & wifi leds stay alight...
I have to manually press the power button for a few seconds to completely shutdown the 3DS
 

daxtsu

Well-Known Member
OP
Member
Joined
Jun 9, 2007
Messages
5,627
Trophies
2
XP
5,194
Country
Antarctica
It's not working / semi-working on my N3DS 9.0.
I use the cia version of quick-shutdown-always, the screen is black but the power & wifi leds stay alight...
I have to manually press the power button for a few seconds to completely shutdown the 3DS

It can take up to 14 seconds for your 3DS to shut down with this app. The method this uses (same as the home menu) has a 14 second timeout.
 

SomeGamer

Well-Known Member
Member
Joined
Dec 19, 2014
Messages
6,827
Trophies
1
XP
4,902
Country
Hungary
What is the difference between shutting down with this app and holding the power button? (Aside from that this method is more "proper"... :P)
 

daxtsu

Well-Known Member
OP
Member
Joined
Jun 9, 2007
Messages
5,627
Trophies
2
XP
5,194
Country
Antarctica
What is the difference between shutting down with this app and holding the power button? (Aside from that this method is more "proper"... :P)

It's meant more for being in the homebrew launcher (doesn't matter which one) than a standalone app, but I offered a CIA just in case. Also, in hax 2.1, the power button doesn't shut down the console unless you hold it for like 20 seconds or somesuch.

But to actually answer your question, it's pretty much as you said, it gives the 3DS time to actually shut down the OS properly.
 
  • Like
Reactions: SomeGamer

d0k3

3DS Homebrew Legend
Member
Joined
Dec 3, 2004
Messages
2,786
Trophies
1
XP
3,896
Country
Germany
EIcDfc5.png


If you want to save some wear and tear on your 3DS' power button, just run this and it'll automatically turn off your 3DS. It uses ns:s::ShutdownAsync (the same function the Home Menu uses) to accomplish the feat. It works like @AlbertoSONIC's Quick Reboot: if any button is held, it'll just exit, so it can serve as yet another dummy application to exit Smash Bros., MH4U, or RetroArch (the cores that reboot the O3DS).

To use the regular version:
1. Just run the application (if you're using the HB Launcher, you don't need the CIA files).
2. If any button is held, the shutdown is cancelled.
3. If no button is held, the 3DS will shutdown.

To use the "-Always" version (note that the always version ignores buttons; use this if you want to shutdown regardless):
1. Just run it, and the 3DS will shutdown (if you're using the HB Launcher, you don't need the CIA files).

If your 3DS "hangs" while running this, you're probably not waiting long enough. It can take up to 14 seconds before the 3DS shuts down. The 3DS runs an OS in the background, and it needs that time to shut down cleanly and properly.

Banner and icon are by @JJTapia19. Thanks to @smealum and #3dsdev for adding info about ns:s::ShutdownAsync, and @cpasjuste for the original shutdown code.


Source: https://github.com/thedax/3DS_Quick_Shutdown
I'm currently looking to add a PowerOff() function to Decrypt9. The MCU one seems unsafe, yours looks to be a lot safer. I see it requires ctrulib though, and to that I don't have access in Decrypt9. Any idea how to get that function working?
 

daxtsu

Well-Known Member
OP
Member
Joined
Jun 9, 2007
Messages
5,627
Trophies
2
XP
5,194
Country
Antarctica
I'm currently looking to add a PowerOff() function to Decrypt9. The MCU one seems unsafe, yours looks to be a lot safer. I see it requires ctrulib though, and to that I don't have access in Decrypt9. Any idea how to get that function working?

Do you not have access to ns:s in Decrypt9?
 

d0k3

3DS Homebrew Legend
Member
Joined
Dec 3, 2004
Messages
2,786
Trophies
1
XP
3,896
Country
Germany
To be honest, I don't know :D.

Is there any safe way to test it? Also, is ns:s (seems to require writing to some registers) the only thing I need? The 3Dbrew entry doesn't help me a lot by now.
 

daxtsu

Well-Known Member
OP
Member
Joined
Jun 9, 2007
Messages
5,627
Trophies
2
XP
5,194
Country
Antarctica
To be honest, I don't know :D.

Is there any safe way to test it? Also, is ns:s (seems to require writing to some registers) the only thing I need? The 3Dbrew entry doesn't help me a lot by now.

I didn't have to write to anything weird to get it to work in my code:

Code:
void shutdown3DS()
{
  Handle nssHandle = 0;
  Result result = srvGetServiceHandle(&nssHandle, "ns:s");
  if (result != 0)
    return;
  // http://3dbrew.org/wiki/NSS:ShutdownAsync
  u32 *commandBuffer = getThreadCommandBuffer();
  commandBuffer[0] = 0x000E0000;
  svcSendSyncRequest(nssHandle);
  svcCloseHandle(nssHandle);
}

If services aren't completely broken when you boot Decrypt9, you should be able to just do that, I think.
 

d0k3

3DS Homebrew Legend
Member
Joined
Dec 3, 2004
Messages
2,786
Trophies
1
XP
3,896
Country
Germany
I didn't have to write to anything weird to get it to work in my code:

Code:
void shutdown3DS()
{
  Handle nssHandle = 0;
  Result result = srvGetServiceHandle(&nssHandle, "ns:s");
  if (result != 0)
    return;
  // http://3dbrew.org/wiki/NSS:ShutdownAsync
  u32 *commandBuffer = getThreadCommandBuffer();
  commandBuffer[0] = 0x000E0000;
  svcSendSyncRequest(nssHandle);
  svcCloseHandle(nssHandle);
}

If services aren't completely broken when you boot Decrypt9, you should be able to just do that, I think.
Problem is, I don't have the srvGetServiceHandle, getThreadCommandBuffer, svcSendSyncRequest and svcCloseHandle functions available. Porting that to Decrypt9 seems to be a lot of work. Also low level and therefore may be somewhat dangerous.
 

leonmagnus99

Well-Known Member
Member
Joined
Apr 2, 2013
Messages
3,704
Trophies
2
Age
33
Location
Seinegald
XP
2,875
Country
Iraq
i love this app, but "and it needs that time to shut down cleanly and properly." <<<< this one here , is that normal?

like when i power it off manually it shuts off within 2-3seconds, the battery light goes off quick.
but with the quick shutdown cia, it takes like 7-10 seconds, i guess this is no biggie yeah?
 

Asellus

Member
Newcomer
Joined
Apr 17, 2016
Messages
11
Trophies
0
Website
github.com
XP
86
Country
i love this app, but "and it needs that time to shut down cleanly and properly." <<<< this one here , is that normal?

like when i power it off manually it shuts off within 2-3seconds, the battery light goes off quick.
but with the quick shutdown cia, it takes like 7-10 seconds, i guess this is no biggie yeah?

https://github.com/Asellus/3DS_Quick_Shutdown

3DS Quick Shutdown more quickly.
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    Xdqwerty @ Xdqwerty: @salazarcosplay, gta v is down since november 2021