Skip to content

Add automatic GBA + PDN lid sleep support. - #295

Open
dleicht wants to merge 1 commit into
profi200:masterfrom
dleicht:sleep
Open

dleicht wants to merge 1 commit into
profi200:masterfrom
dleicht:sleep

Conversation

@dleicht

@dleicht dleicht commented Sep 5, 2026

Copy link
Copy Markdown

Caution: This depends on Add deep sleep support #9

This adds automatic lid-triggered (or switch-triggered on the O2DS) GBA + PDN sleep/wake support to open_agb_firm.

On lid close, open_agb_firm requests real GBA SWI 03h STOP through the new libn3ds vector-overlay mechanism, then suspends the video pipeline and enters full ARM11 PDN sleep. On wake, the graphics hardware and video pipeline are rebuilt, the GBA is resumed, and gameplay continues from the exact point where it stopped.

It keeps the sleep orchestration isolated in sleep.c/.h.

It improves battery life dramatically:

# profi200 dleicht
battery drain 12 %/h 1,5 %/h
battery life ~ 8 hours ~ 3 days

You can find some sort of dev log here.

@tasken tasken mentioned this pull request Sep 5, 2026
@cybardev

cybardev commented Sep 6, 2026

Copy link
Copy Markdown

should this be draft until profi200/libn3ds#9 is merged? 🤔 would it break OAF if this gets merged before that one?

@dleicht

dleicht commented Sep 6, 2026

Copy link
Copy Markdown
Author

should this be draft until profi200/libn3ds#9 is merged? 🤔 would it break OAF if this gets merged before that one?

Right now OAF upstream master points to libn3ds @ ccbb6a9 which is 2 commits behind. I deliberately rebased my libn3ds sleep branch on libn3ds @ a3975be. So merging my sleep branch with master would be clean.

My OAF PR points to libn3ds @ 2a9a72b which is exactly one commit ahead of libn3ds @ a3975be. If this PR gets merged all we'd need to do is to update the submodule pointer back to profi200.

I did put word of caution into this PR, but they will know how to do this. No worries 😄

@cybardev

cybardev commented Sep 6, 2026

Copy link
Copy Markdown

Fabulous. Was just curious about the logistics as a dev. Thanks for explaining.


Aside: This has been the most inspiring and interesting PR (including the previous thread) I've ever followed. Thank you and everyone else for your time and dedication to this. 😊

@Rhlp-Engineering

Copy link
Copy Markdown

is this a new build? and if so can i try it? more time playing donkeykongg!

@dleicht

dleicht commented Sep 8, 2026

Copy link
Copy Markdown
Author

A compiled release build can be found here.

@Rhlp-Engineering

Copy link
Copy Markdown

also sorry i couldent test the stuff, i can soon maby but today is the first day back in school here.

@dleicht

dleicht commented Sep 8, 2026

Copy link
Copy Markdown
Author

No worries. Please focus on your schoolwork 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants