fixed autosleep shenanigans when emulating
This commit is contained in:
parent
1145988066
commit
d42e7c31d0
3 changed files with 15 additions and 1 deletions
|
|
@ -964,8 +964,16 @@ void POW_fauxSleep(void) {
|
|||
system("killall -CONT keymon.elf");
|
||||
POW_exitSleep();
|
||||
}
|
||||
|
||||
static int can_autosleep = 1;
|
||||
void POW_disableAutosleep(void) {
|
||||
can_autosleep = 0;
|
||||
}
|
||||
void POW_enableAutosleep(void) {
|
||||
can_autosleep = 1;
|
||||
}
|
||||
int POW_preventAutosleep(void) {
|
||||
return POW_isCharging();
|
||||
return POW_isCharging() || !can_autosleep;
|
||||
}
|
||||
int POW_isCharging(void) {
|
||||
return getInt("/sys/class/power_supply/battery/charger_online");
|
||||
|
|
|
|||
|
|
@ -161,6 +161,8 @@ void POW_update(int* dirty, int* show_setting, POW_callback_t before_sleep, POW_
|
|||
void POW_disablePowerOff(void);
|
||||
void POW_powerOff(void);
|
||||
void POW_fauxSleep(void);
|
||||
void POW_disableAutosleep(void);
|
||||
void POW_enableAutosleep(void);
|
||||
int POW_preventAutosleep(void);
|
||||
int POW_isCharging(void);
|
||||
int POW_getBattery(void);
|
||||
|
|
|
|||
|
|
@ -968,6 +968,7 @@ void Menu_afterSleep(void) {
|
|||
unlink(AUTO_RESUME_PATH);
|
||||
}
|
||||
void Menu_loop(void) {
|
||||
POW_enableAutosleep();
|
||||
PAD_reset();
|
||||
|
||||
// current screen is on the previous buffer
|
||||
|
|
@ -1046,6 +1047,8 @@ void Menu_loop(void) {
|
|||
if (!quit) SDL_BlitSurface(backing, NULL, screen, NULL);
|
||||
SDL_FreeSurface(backing);
|
||||
GFX_flip(screen);
|
||||
|
||||
POW_disableAutosleep();
|
||||
}
|
||||
|
||||
int main(int argc , char* argv[]) {
|
||||
|
|
@ -1075,6 +1078,7 @@ int main(int argc , char* argv[]) {
|
|||
State_resume();
|
||||
// State_read(); LOG_info("after State_read\n");
|
||||
|
||||
POW_disableAutosleep();
|
||||
sec_start = SDL_GetTicks();
|
||||
while (!quit) {
|
||||
GFX_startFrame();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue