diff --git a/arm11/source/main.c b/arm11/source/main.c index 5740ae4..f304390 100644 --- a/arm11/source/main.c +++ b/arm11/source/main.c @@ -37,7 +37,7 @@ extern u32 prepareForFirmlaunchSize; extern volatile Arm11Operation operation; -static void initScreens(u32 brightnessLevel, struct fb *fbs) +static void initScreens(u32 brightnessLevel) { *(vu32 *)0x10141200 = 0x1007F; *(vu32 *)0x10202014 = 0x00000001; @@ -70,13 +70,9 @@ static void initScreens(u32 brightnessLevel, struct fb *fbs) *(vu32 *)0x1040045C = 0x00f00190; *(vu32 *)0x10400460 = 0x01c100d1; *(vu32 *)0x10400464 = 0x01920002; - *(vu32 *)0x10400468 = (u32)fbs[0].top_left; - *(vu32 *)0x1040046C = (u32)fbs[1].top_left; *(vu32 *)0x10400470 = 0x80341; *(vu32 *)0x10400474 = 0x00010501; *(vu32 *)0x10400478 = 0; - *(vu32 *)0x10400494 = (u32)fbs[0].top_right; - *(vu32 *)0x10400498 = (u32)fbs[1].top_right; *(vu32 *)0x10400490 = 0x000002D0; *(vu32 *)0x1040049C = 0x00000000; @@ -107,8 +103,6 @@ static void initScreens(u32 brightnessLevel, struct fb *fbs) *(vu32 *)0x1040055C = 0x00f00140; *(vu32 *)0x10400560 = 0x01c100d1; *(vu32 *)0x10400564 = 0x01920052; - *(vu32 *)0x10400568 = (u32)fbs[0].bottom; - *(vu32 *)0x1040056C = (u32)fbs[1].bottom; *(vu32 *)0x10400570 = 0x80301; *(vu32 *)0x10400574 = 0x00010501; *(vu32 *)0x10400578 = 0; @@ -120,6 +114,16 @@ static void initScreens(u32 brightnessLevel, struct fb *fbs) *(vu32 *)0x10400584 = 0x10101 * i; } +static void setupFramebuffers(struct fb *fbs) +{ + *(vu32 *)0x10400468 = (u32)fbs[0].top_left; + *(vu32 *)0x1040046c = (u32)fbs[1].top_left; + *(vu32 *)0x10400494 = (u32)fbs[0].top_right; + *(vu32 *)0x10400498 = (u32)fbs[1].top_right; + *(vu32 *)0x10400568 = (u32)fbs[0].bottom; + *(vu32 *)0x1040056c = (u32)fbs[1].bottom; +} + static void clearScreens(struct fb *fb) { //Setting up two simultaneous memory fills using the GPU @@ -173,7 +177,10 @@ void main(void) case ARM11_READY: continue; case INIT_SCREENS: - initScreens(*(vu32 *)ARM11_PARAMETERS_ADDRESS, (struct fb *)(ARM11_PARAMETERS_ADDRESS + 4)); + initScreens(*(vu32 *)ARM11_PARAMETERS_ADDRESS); + break; + case SETUP_FRAMEBUFFERS: + setupFramebuffers((struct fb *)ARM11_PARAMETERS_ADDRESS); break; case CLEAR_SCREENS: clearScreens((struct fb *)ARM11_PARAMETERS_ADDRESS); diff --git a/arm11/source/types.h b/arm11/source/types.h index 70efb1a..7b56df1 100644 --- a/arm11/source/types.h +++ b/arm11/source/types.h @@ -55,6 +55,7 @@ struct fb { typedef enum { INIT_SCREENS = 0, + SETUP_FRAMEBUFFERS, CLEAR_SCREENS, SWAP_FRAMEBUFFERS, UPDATE_BRIGHTNESS, diff --git a/source/draw.c b/source/draw.c index e743c28..485a821 100644 --- a/source/draw.c +++ b/source/draw.c @@ -49,7 +49,6 @@ bool loadSplash(void) if(!isTopSplashValid && !isBottomSplashValid) return false; initScreens(); - clearScreens(true); if(isTopSplashValid) isTopSplashValid = fileRead(fbs[1].top_left, topSplashFile, SCREEN_TOP_FBSIZE) == SCREEN_TOP_FBSIZE; if(isBottomSplashValid) isBottomSplashValid = fileRead(fbs[1].bottom, bottomSplashFile, SCREEN_BOTTOM_FBSIZE) == SCREEN_BOTTOM_FBSIZE; diff --git a/source/screen.c b/source/screen.c index 969ad61..86ab666 100644 --- a/source/screen.c +++ b/source/screen.c @@ -99,7 +99,6 @@ void initScreens(void) if(!ARESCREENSINITIALIZED) { *(vu32 *)ARM11_PARAMETERS_ADDRESS = brightness[MULTICONFIG(BRIGHTNESS)]; - memcpy((void *)(ARM11_PARAMETERS_ADDRESS + 4), fbs, sizeof(fbs)); invokeArm11Function(INIT_SCREENS); //Turn on backlight @@ -107,10 +106,12 @@ void initScreens(void) } else updateBrightness(MULTICONFIG(BRIGHTNESS)); + memcpy((void *)ARM11_PARAMETERS_ADDRESS, fbs, sizeof(fbs)); + invokeArm11Function(SETUP_FRAMEBUFFERS); + clearScreens(true); needToSetup = false; } clearScreens(false); - clearScreens(true); swapFramebuffers(false); } diff --git a/source/screen.h b/source/screen.h index 5ce60c7..3905739 100644 --- a/source/screen.h +++ b/source/screen.h @@ -54,6 +54,7 @@ struct fb { typedef enum { INIT_SCREENS = 0, + SETUP_FRAMEBUFFERS, CLEAR_SCREENS, SWAP_FRAMEBUFFERS, UPDATE_BRIGHTNESS,