Created
February 22, 2017 00:21
-
-
Save SonoSooS/c56dd359d2c071c234bdf363840efef6 to your computer and use it in GitHub Desktop.
Screen brightness setter for 3DS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <3ds.h> | |
#include <stdio.h> | |
#include <string.h> | |
#include <stdlib.h> | |
int main() | |
{ | |
gfxInit(GSP_RGBA8_OES, GSP_RGBA8_OES, false); | |
PrintConsole console; | |
consoleInit(GFX_BOTTOM, &console); | |
int redraw = 1; | |
u32 kDown = 0; | |
u8 bri = 1; | |
u32 regtop = 0x202240; | |
u32 regbot = 0x202A40; | |
while(aptMainLoop()) | |
{ | |
hidScanInput(); | |
kDown = hidKeysDown(); | |
if(kDown & KEY_SELECT) break; | |
if(kDown & KEY_UP) bri++; | |
if(kDown & KEY_DOWN) bri--; | |
if(kDown & KEY_LEFT) bri-=0x10; | |
if(kDown & KEY_RIGHT) bri+=0x10; | |
if(kDown & KEY_X) | |
{ | |
u32 dmy = bri; | |
GSPGPU_WriteHWRegs(regtop, &dmy, 4); | |
} | |
if(kDown & KEY_Y) | |
{ | |
u32 dmy = bri; | |
GSPGPU_WriteHWRegs(regbot, &dmy, 4); | |
} | |
if(kDown) redraw = 1; | |
if(redraw) | |
{ | |
console.cursorX = 0; | |
console.cursorY = 0; | |
u32 britop = 0xF00FCACE; | |
u32 bribot = 0xF00FCACE; | |
GSPGPU_ReadHWRegs(regtop, &britop, 4); | |
GSPGPU_ReadHWRegs(regbot, &bribot, 4); | |
printf("REG: %02X\nTOP: %02X\nBOT: %02X\n", bri, britop, bribot); | |
redraw = 0; | |
} | |
gspWaitForVBlank(); | |
} | |
ded: | |
gfxExit(); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment