profi200 / open_agb_firm

open_agb_firm is a bare metal app for running GBA homebrew/games using the 3DS builtin GBA hardware.
GNU General Public License v3.0
860 stars 42 forks source link

(WIP) Improved Sleep Mode #42

Open shinyquagsire23 opened 3 years ago

shinyquagsire23 commented 3 years ago

Not expecting this to be merged per-se but I figured it would be better to have the PR for discussion/experiments.

Additions:

Current Regressions:

Other notes:

If anyone wants to test the changes I have a build here.

profi200 commented 3 years ago

Looks interesting.

Yeah, the mute and just turning off the backlight is not ideal. Real sleep mode is more involved since basically every GPU block needs to be deinitialized and VRAM must also be powered off. Then PDN trickery needs to be implemented (a hardware sleep mode). I have not bothered with real sleep mode yet because gsp is a bitch to understand. You can use CODEC_deinit() which is basically sleep and power off in one. CODEC_wakeup() brings it right back up.

And yeah, i have played with the BIOS vector overlay before and thought about ways to use it. I'm worrying a bit about accuracy with this approach. A good while ago i tested a different way. We can transfer data via ARM7 KEYCNT and the other way around with button override. From ARM7 to ARM11 i archived over 950 KiB/s with hand crafted asm. I expect less than half in the other direction because ARM7 needs to notify ARM11 for every received byte. The other way around ARM7 is so much slower that we can pump data out without needing to care about ARM11. This would effectively make save states and the like possible. Maybe also wireless adapter and gyro "emulation" by patching games to use this communication channel. I call this "lgylink".

Also yeah, there are certain freezes here and there if the timing is off. Might be related to LgyFb (FIFO overrun?). This can also happen when taking screenshots.