Skip to content

Commit 0a492fe

Browse files
committed
fix graphics flickering
fix rxTools
1 parent 0d45810 commit 0a492fe

7 files changed

Lines changed: 22 additions & 31 deletions

File tree

source/arm9/stage2/data/stage2.bin

0 Bytes
Binary file not shown.

source/arm9/stage2/payload/payload_stage2.ld

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ ENTRY(_start)
44

55
MEMORY
66
{
7-
ram : ORIGIN = 0x08006000, LENGTH = 0x10000K
7+
ram : ORIGIN = 0x21000000, LENGTH = 0x10000K
88
}
99

1010
SECTIONS

source/arm9/stage2/payload/source/main.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
#include "common.h"
22

3-
#define PTR_TOP_SCREEN 0x18300000
4-
#define PTR_BOT_SCREEN 0x18346500
5-
63
#define PTR_PAYLOAD_MAIN 0x23F00000
74
#define PTR_PAYLOAD_MAIN_DATA 0x20000000
85
#define PTR_PAYLOAD_SIZE_MAX 0x00100000
9-
#define PTR_PAYLOAD_STAGE2 0x08006000
6+
#define PTR_PAYLOAD_STAGE2 0x21000000
107

118
int main()
129
{
@@ -23,9 +20,9 @@ int main()
2320
*(volatile uint32_t*)0x80FFFDC = 1; // framebuffer select bottom
2421

2522
//cakehax
26-
*(u32*)0x23FFFE00 = PTR_TOP_SCREEN;
27-
*(u32*)0x23FFFE04 = PTR_TOP_SCREEN;
28-
*(u32*)0x23FFFE08 = PTR_BOT_SCREEN;
23+
*(u32*)0x23FFFE00 = 0x18300000;
24+
*(u32*)0x23FFFE04 = 0x18300000;
25+
*(u32*)0x23FFFE08 = 0x18346500;
2926

3027
((void (*)())PTR_PAYLOAD_MAIN)();
3128

source/config_new.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ void loadBg(gfxScreen_t screen) {
225225
}
226226

227227
#ifdef ARM9
228-
u8 *bg = screen == GFX_TOP ? PTR_BG_TOP : PTR_BG_BOT;
228+
u8 *bg = screen == GFX_TOP ? PTR_TOP_BG_BUF : PTR_BOT_BG_BUF;
229229
#else
230230
u8 *bg = malloc(size);
231231
#endif

source/gfx.c

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515
u8* gfxGetFramebuffer(gfxScreen_t screen, gfx3dSide_t side, u16* width, u16* height) {
1616
if(screen == GFX_TOP) {
1717
*width = 240; *height = 400;
18-
return PTR_TOP_SCREEN;
18+
return PTR_TOP_SCREEN_BUF; //PTR_TOP_SCREEN;
1919
} else {
2020
*width = 240; *height = 320;
21-
return PTR_BOT_SCREEN;
21+
return PTR_BOT_SCREEN_BUF;//PTR_BOT_SCREEN;
2222
}
2323
}
2424
#endif
@@ -167,20 +167,15 @@ void gfxClearTop(u8 top1[3], u8 top2[3]) {
167167
gfxFillColorGradient(GFX_TOP, GFX_LEFT, top1, top2);
168168
}
169169

170-
void gfxClearTopRight(u8 top1[3], u8 top2[3]) {
171-
gfxFillColorGradient(GFX_TOP, GFX_RIGHT, top1, top2);
172-
}
173-
174170
void gfxClearBot(u8 bot[8]) {
175171
gfxFillColor(GFX_BOTTOM, GFX_LEFT, bot);
176172
}
177173

178-
void gfxClearBotRight(u8 bot[8]) {
179-
gfxFillColor(GFX_BOTTOM, GFX_RIGHT, bot);
180-
}
181-
182174
void gfxSwap() {
183-
#ifndef ARM9
175+
#ifdef ARM9
176+
memcpy(PTR_TOP_SCREEN, PTR_TOP_SCREEN_BUF, TOP_SCREEN_SIZE);
177+
memcpy(PTR_BOT_SCREEN, PTR_BOT_SCREEN_BUF, BOT_SCREEN_SIZE);
178+
#else
184179
gfxFlushBuffers();
185180
gfxSwapBuffers();
186181
gspWaitForVBlank();

source/gfx.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
#ifdef ARM9
44
#include "arm9/source/common.h"
55
u8* gfxGetFramebuffer(gfxScreen_t screen, gfx3dSide_t side, u16* width, u16* height);
6-
6+
#define TOP_SCREEN_SIZE (400*240*3)
7+
#define BOT_SCREEN_SIZE (320*240*3)
78
#else
89
#include <3ds.h>
910
#endif
@@ -28,10 +29,6 @@ void gfxDrawRectangle(gfxScreen_t screen, gfx3dSide_t side, u8 rgbColor[3], s16
2829

2930
void gfxClearTop(u8 top1[3], u8 top2[3]);
3031

31-
void gfxClearTopRight(u8 top1[3], u8 top2[3]);
32-
33-
void gfxClearBotRight(u8 bot[8]);
34-
3532
void gfxClearBot(u8 bot[8]);
3633

3734
void gfxSwap();

source/memory.h

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,17 @@
55
#ifndef CTRBOOTMANAGER_MEMORY_H
66
#define CTRBOOTMANAGER_MEMORY_H
77

8-
#define PTR_TOP_SCREEN (u8*)(0x18300000)
9-
#define PTR_BOT_SCREEN (u8*)(0x18346500)
8+
#define PTR_TOP_SCREEN (u8*)(*(u32*)0x23FFFE00)
9+
#define PTR_BOT_SCREEN (u8*)(*(u32*)0x23FFFE08)
10+
#define PTR_TOP_SCREEN_BUF (u8*)(0x2207E700)
11+
#define PTR_BOT_SCREEN_BUF (u8*)(0x220C4A00)
12+
13+
#define PTR_TOP_BG_BUF (u8*)(0x22000000)
14+
#define PTR_BOT_BG_BUF (u8*)(0x22046300)
1015

1116
#define PTR_PAYLOAD_MAIN 0x23F00000
1217
#define PTR_PAYLOAD_MAIN_DATA 0x20000000
1318
#define PTR_PAYLOAD_SIZE_MAX 0x00100000
14-
#define PTR_PAYLOAD_STAGE2 0x08006000
15-
16-
#define PTR_BG_TOP (u8*)(0x23FFFE00)
17-
#define PTR_BG_BOT (u8*)(0x24046300)
19+
#define PTR_PAYLOAD_STAGE2 0x21000000
1820

1921
#endif //CTRBOOTMANAGER_MEMORY_H

0 commit comments

Comments
 (0)