Added basic support for configuring the brightness level for the built-in screen init
This commit is contained in:
parent
bb437f6f7b
commit
6f8a9421ef
2
Makefile
2
Makefile
@ -59,7 +59,7 @@ $(dir_out)/$(name).dat: $(dir_build)/main.bin $(dir_out)
|
||||
@dd if=$(dir_build)/main.bin of=$@ bs=512 seek=144
|
||||
|
||||
$(dir_out)/arm9loaderhax.bin: $(dir_build)/main.bin $(dir_out)
|
||||
@cp -av $(dir_build)/main.bin $@
|
||||
@cp -a $(dir_build)/main.bin $@
|
||||
|
||||
$(dir_out)/3ds/$(name): $(dir_out)
|
||||
@mkdir -p "$(dir_out)/3ds/$(name)"
|
||||
|
@ -2,13 +2,15 @@
|
||||
|
||||
void main(void)
|
||||
{
|
||||
const u32 brightness[4] = {0x5F, 0x4C, 0x39, 0x26};
|
||||
u32 brightnessLevel = *(vu32 *)0x24F04000;
|
||||
vu32 *const arm11 = (u32 *)0x1FFFFFF8;
|
||||
|
||||
*(vu32 *)0x10141200 = 0x1007F;
|
||||
*(vu32 *)0x10202014 = 0x00000001;
|
||||
*(vu32 *)0x1020200C &= 0xFFFEFFFE;
|
||||
*(vu32 *)0x10202240 = 0x45;
|
||||
*(vu32 *)0x10202A40 = 0x45;
|
||||
*(vu32 *)0x10202240 = brightness[brightnessLevel];
|
||||
*(vu32 *)0x10202A40 = brightness[brightnessLevel];
|
||||
*(vu32 *)0x10202244 = 0x1023E;
|
||||
*(vu32 *)0x10202A44 = 0x1023E;
|
||||
|
||||
|
@ -38,8 +38,8 @@ static u32 firmSize,
|
||||
selectedFirm,
|
||||
usePatchedFirm,
|
||||
emuOffset,
|
||||
emuHeader,
|
||||
config;
|
||||
emuHeader;
|
||||
u32 config;
|
||||
|
||||
void setupCFW(void)
|
||||
{
|
||||
|
@ -50,6 +50,9 @@ void initScreens(void)
|
||||
{
|
||||
if(PDN_GPU_CNT == 1)
|
||||
{
|
||||
//Write brightness level for the stub to pick up
|
||||
*(vu32 *)0x24F04000 = (config >> 10) & 3;
|
||||
|
||||
memcpy((void *)SCREENINIT_ADDRESS, screeninit, screeninit_size);
|
||||
|
||||
*arm11 = SCREENINIT_ADDRESS;
|
||||
|
@ -13,5 +13,7 @@
|
||||
|
||||
#define PDN_GPU_CNT (*(vu8 *)0x10141200)
|
||||
|
||||
u32 config;
|
||||
|
||||
void deinitScreens(void);
|
||||
void initScreens(void);
|
@ -72,6 +72,8 @@ void configureCFW(const char *configPath, const char *patchedFirms[])
|
||||
for(u32 i = 0; i < optionsAmount; i++)
|
||||
options[i].enabled = (tempConfig >> i) & 1;
|
||||
|
||||
options[optionsAmount].enabled = (tempConfig >> 10) & 3;
|
||||
|
||||
//Pre-select the first configuration option
|
||||
u32 selectedOption = 0;
|
||||
|
||||
@ -81,12 +83,17 @@ void configureCFW(const char *configPath, const char *patchedFirms[])
|
||||
u16 pressed = 0;
|
||||
|
||||
do {
|
||||
options[optionsAmount].posY = drawString("Screen-init brightness: 4( ) 3( ) 2( ) 1( )", 10, 53, selectedOption == optionsAmount ? COLOR_RED : COLOR_WHITE);
|
||||
|
||||
for(u32 i = 0; i < optionsAmount; i++)
|
||||
{
|
||||
options[i].posY = drawString(optionsText[i], 10, !i ? 60 : options[i - 1].posY + SPACING_Y, selectedOption == i ? COLOR_RED : COLOR_WHITE);
|
||||
options[i].posY = drawString(optionsText[i], 10, !i ? options[optionsAmount].posY + 2 * SPACING_Y : options[i - 1].posY + SPACING_Y, selectedOption == i ? COLOR_RED : COLOR_WHITE);
|
||||
drawCharacter('x', 10 + SPACING_X, options[i].posY, options[i].enabled ? (selectedOption == i ? COLOR_RED : COLOR_WHITE) : COLOR_BLACK);
|
||||
}
|
||||
|
||||
for(u32 i = 0; i < 4; i++)
|
||||
drawCharacter('x', 10 + (26 + 5 * i) * SPACING_X, options[optionsAmount].posY, options[optionsAmount].enabled == i ? (selectedOption == optionsAmount ? COLOR_RED : COLOR_WHITE) : COLOR_BLACK);
|
||||
|
||||
pressed = waitInput();
|
||||
}
|
||||
while(!(pressed & MENU_BUTTONS));
|
||||
@ -94,10 +101,10 @@ void configureCFW(const char *configPath, const char *patchedFirms[])
|
||||
switch(pressed)
|
||||
{
|
||||
case BUTTON_UP:
|
||||
selectedOption = !selectedOption ? optionsAmount - 1 : selectedOption - 1;
|
||||
selectedOption = !selectedOption ? optionsAmount : selectedOption - 1;
|
||||
break;
|
||||
case BUTTON_DOWN:
|
||||
selectedOption = selectedOption == optionsAmount - 1 ? 0 : selectedOption + 1;
|
||||
selectedOption = selectedOption >= optionsAmount - 1 ? 0 : selectedOption + 1;
|
||||
break;
|
||||
case BUTTON_LEFT:
|
||||
selectedOption = 0;
|
||||
@ -106,7 +113,8 @@ void configureCFW(const char *configPath, const char *patchedFirms[])
|
||||
selectedOption = optionsAmount - 1;
|
||||
break;
|
||||
case BUTTON_A:
|
||||
options[selectedOption].enabled = !options[selectedOption].enabled;
|
||||
if(selectedOption != optionsAmount) options[selectedOption].enabled = !options[selectedOption].enabled;
|
||||
else options[optionsAmount].enabled = options[optionsAmount].enabled == 3 ? 0 : options[optionsAmount].enabled + 1;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -126,6 +134,8 @@ void configureCFW(const char *configPath, const char *patchedFirms[])
|
||||
for(u32 i = 0; i < optionsAmount; i++)
|
||||
tempConfig |= options[i].enabled << i;
|
||||
|
||||
tempConfig |= options[optionsAmount].enabled << 10;
|
||||
|
||||
fileWrite(&tempConfig, configPath, 3);
|
||||
|
||||
//Zero the last booted FIRM flag
|
||||
|
Reference in New Issue
Block a user