Skip to content

Commit

Permalink
dstwo: Make the Nintendo DS sleep when its lid is closed
Browse files Browse the repository at this point in the history
  • Loading branch information
Nebuleon committed Apr 6, 2017
1 parent 8f01dfe commit 2891fb9
Showing 1 changed file with 4 additions and 16 deletions.
20 changes: 4 additions & 16 deletions source/dstwo/gui.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
/******************************************************************************
* 头文件
******************************************************************************/
#include <ds2/pm.h>

#include "common.h"
#include "gui.h"
#include "input.h"
Expand Down Expand Up @@ -170,19 +172,7 @@ enum ReGBA_Buttons ReGBA_GetPressedButtons()
if (buttons & DS_BUTTON_LID)
{
LowFrequencyCPU();
// ds2_setSupend(); // TODO Make the Nintendo DS actually sleep
DS2_AwaitNoButtonsIn(DS_BUTTON_LID);
// ds2_wakeup(); // TODO Make the Nintendo DS actually wake up
// Before starting to emulate again, turn off the game
// screen's backlight.
if (gpsp_persistent_config.BottomScreenGame)
{
DS2_SetScreenBacklights(DS_SCREEN_LOWER);
}
else
{
DS2_SetScreenBacklights(DS_SCREEN_UPPER);
}
DS2_SystemSleep();
GameFrequencyCPU();
}

Expand Down Expand Up @@ -289,9 +279,7 @@ gui_action_type get_gui_input(void)
DS2_GetInputState(&inputdata);

if (inputdata.buttons & DS_BUTTON_LID) {
// ds2_setSupend(); // TODO Make the Nintendo DS actually sleep
DS2_AwaitNoButtonsIn(DS_BUTTON_LID);
// ds2_wakeup(); // TODO Make the Nintendo DS actually wake up
DS2_SystemSleep();
}

if ((inputdata.buttons & (DS_BUTTON_L | DS_BUTTON_R)) == (DS_BUTTON_L | DS_BUTTON_R)) {
Expand Down

0 comments on commit 2891fb9

Please sign in to comment.