1
0
mirror of https://github.com/XProger/OpenLara.git synced 2025-08-13 16:44:50 +02:00

3DS backlight cleanup and APT handling (#191)

This commit is contained in:
vaguerant
2019-06-24 16:39:36 +10:00
committed by Timur Gagiev
parent 5bba4e53b5
commit f9ac5fbf7a

View File

@@ -32,19 +32,42 @@ int osGetTimeMS() {
return int(osGetTime() - osStartTime);
}
// backlight
bool bottomScreenOn = true;
void setBottomScreen(bool enable) {
gspLcdInit();
enable ? GSPLCD_PowerOnBacklight(GSPLCD_SCREEN_BOTTOM) : GSPLCD_PowerOffBacklight(GSPLCD_SCREEN_BOTTOM);
gspLcdExit();
}
aptHookCookie(cookie);
void checkAptHook(APT_HookType hook, void *param) {
if (!bottomScreenOn) {
switch(hook) {
case APTHOOK_ONSUSPEND : setBottomScreen(1);
break;
case APTHOOK_ONRESTORE :
case APTHOOK_ONWAKEUP : setBottomScreen(0);
break;
default:
break;
}
}
}
// input
bool osJoyReady(int index) {
return index == 0;
}
// backlight
bool bottomScreenOn = true;
void osJoyVibrate(int index, float L, float R) {
//
}
void inputInit() {
aptHook(&cookie, checkAptHook, NULL);
hidInit();
}
@@ -74,22 +97,13 @@ void inputUpdate() {
if (down & KEY_TOUCH) {
bottomScreenOn = !bottomScreenOn;
gspLcdInit();
if (bottomScreenOn) {
GSPLCD_PowerOffBacklight(GSPLCD_SCREEN_BOTTOM);
} else {
GSPLCD_PowerOnBacklight(GSPLCD_SCREEN_BOTTOM);
}
gspLcdExit();
bottomScreenOn ? setBottomScreen(1) : setBottomScreen(0);
}
}
void inputFree() {
if (!bottomScreenOn) {
gspLcdInit();
GSPLCD_PowerOnBacklight(GSPLCD_SCREEN_BOTTOM);
gspLcdExit();
}
if (!bottomScreenOn)
setBottomScreen(1);
hidExit();
}