mirror of
https://github.com/joel16/3DSident.git
synced 2024-11-23 03:29:45 +00:00
Read brightness from HW Regs
Should now work on o3ds/2ds as well.
This commit is contained in:
parent
29de5b2df0
commit
bcad84154b
@ -2,6 +2,9 @@
|
||||
|
||||
#include "hardware.h"
|
||||
|
||||
#define REG_LCD_TOP_SCREEN (u32)0x202200
|
||||
#define REG_LCD_BOTTOM_SCREEN (u32)0x202A00
|
||||
|
||||
char * getCardSlotStatus(void)
|
||||
{
|
||||
bool isInserted = false;
|
||||
@ -37,14 +40,24 @@ char * getBrightness(u32 screen)
|
||||
{
|
||||
u32 brightness = 0;
|
||||
static char level[5];
|
||||
|
||||
if(R_SUCCEEDED(gspLcdInit()))
|
||||
|
||||
if (R_SUCCEEDED(gspInit()))
|
||||
{
|
||||
if (R_SUCCEEDED(GSPLCD_GetBrightness(screen, &brightness)))
|
||||
gspLcdExit();
|
||||
if (screen == GSPLCD_SCREEN_TOP)
|
||||
{
|
||||
if (R_SUCCEEDED(GSPGPU_ReadHWRegs(REG_LCD_TOP_SCREEN + 0x40, &brightness, 4)))
|
||||
gspExit();
|
||||
}
|
||||
else if (screen = GSPLCD_SCREEN_BOTTOM)
|
||||
{
|
||||
if (R_SUCCEEDED(GSPGPU_ReadHWRegs(REG_LCD_BOTTOM_SCREEN + 0x40, &brightness, 4)))
|
||||
gspExit();
|
||||
}
|
||||
else
|
||||
gspExit();
|
||||
}
|
||||
|
||||
snprintf(level, 4, "%d", (int)brightness);
|
||||
|
||||
snprintf(level, 0x4, "%d", (int)brightness);
|
||||
|
||||
return level;
|
||||
}
|
@ -250,7 +250,7 @@ int main(int argc, char *argv[])
|
||||
printf("\x1b[36;1m*\x1b[0m CTR Size: \x1b[36;1m%s\x1b[0m / \x1b[36;1m%s\x1b[0m \n", ctrFreeSize, ctrTotalSize);
|
||||
|
||||
printf("\x1b[26;0H");
|
||||
printf("\x1b[36;1m*\x1b[0m Brightness level: \x1b[36;1m%s\x1b[0m \n", getBrightness(1));
|
||||
printf("\x1b[36;1m*\x1b[0m Brightness level: \x1b[36;1m%s\x1b[0m \n", getBrightness(GSPLCD_SCREEN_TOP));
|
||||
|
||||
printf("\x1b[27;0H");
|
||||
wifiPercent = (osGetWifiStrength() * 33.3333333333);
|
||||
|
Loading…
Reference in New Issue
Block a user