Page 1 of 1

3DS halts after sleeping while running homebrew

Posted: Fri May 01, 2020 6:29 pm
by darkweb
Hi all,
I've got an SDL game that I've ported over to the 3DS and I'm having an issue where the entire 3DS seems to lock up after you close the lid and open it again. I've tried accessing Luma but that doesn't seem to come up at all after closing the lid either and I have to do a hard shutdown. I've tested other homebrew such as OpenTyrian and that doesn't seem to have a problem.
I've also tried using gdb but as soon as I close the lid it terminates the connection.

If you'd like to take a look at the code you can see it here: https://github.com/pyroticinsanity/3dsdod

I'm out of ideas so any help would be greatly appreciated!

Re: 3DS halts after sleeping while running homebrew

Posted: Tue May 26, 2020 10:25 pm
by darkweb
It turned out that it's not enough to just call aptMainLoop. If you call it in a tight loop without any graphical code you need to give up the CPU as well. The fix for me was to call svcSleepThread(1) in my code as well and that was enough to give resources to the 3DS to properly manage the home button.