Correct berry fix graphics colors, more PLTT constant use (#1892)

This commit is contained in:
GriffinR 2023-08-09 12:49:21 -04:00 committed by GitHub
parent 912a80e27a
commit 6eaaa50ad5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
20 changed files with 39 additions and 252 deletions

View File

@ -421,14 +421,12 @@ u16 Unused_LoadBgPalette(u8 bg, const void *src, u16 size, u16 destOffset)
if (!IsInvalidBg32(bg)) if (!IsInvalidBg32(bg))
{ {
u16 paletteOffset = (sGpuBgConfigs2[bg].basePalette * 0x20) + (destOffset * 2); u16 paletteOffset = PLTT_OFFSET_4BPP(sGpuBgConfigs2[bg].basePalette) + (destOffset * 2);
cursor = RequestDma3Copy(src, (void *)(paletteOffset + BG_PLTT), size, 0); cursor = RequestDma3Copy(src, (void *)(paletteOffset + BG_PLTT), size, 0);
if (cursor == -1) if (cursor == -1)
{
return -1; return -1;
} }
}
else else
{ {
return -1; return -1;

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 KiB

View File

@ -1,35 +0,0 @@
JASC-PAL
0100
32
0 0 0
255 255 255
32 32 32
172 172 172
230 8 8
255 189 115
32 156 8
148 246 148
49 82 205
164 197 246
164 213 90
238 230 197
148 197 213
32 57 98
106 148 197
90 106 156
255 255 255
164 213 90
32 32 32
123 123 205
255 255 255
74 74 115
197 197 197
98 98 189
106 106 197
98 123 57
131 131 131
222 41 0
189 123 41
180 180 222
0 0 0
0 0 0

Binary file not shown.

Before

Width:  |  Height:  |  Size: 982 B

View File

@ -1,35 +0,0 @@
JASC-PAL
0100
32
0 0 0
255 255 255
32 32 32
172 172 172
230 8 8
255 189 115
32 156 8
148 246 148
49 82 205
164 197 246
164 213 90
238 230 197
148 197 213
32 57 98
106 148 197
90 106 156
255 255 255
164 213 90
32 32 32
123 123 205
255 255 255
74 74 115
197 197 197
98 98 189
106 106 197
98 123 57
131 131 131
222 41 0
189 123 41
180 180 222
0 0 0
0 0 0

Binary file not shown.

Before

Width:  |  Height:  |  Size: 900 B

After

Width:  |  Height:  |  Size: 5.4 KiB

View File

@ -1,35 +0,0 @@
JASC-PAL
0100
32
0 0 0
255 255 255
32 32 32
172 172 172
230 8 8
255 189 115
32 156 8
148 246 148
49 82 205
164 197 246
164 213 90
238 230 197
148 197 213
32 57 98
106 148 197
90 106 156
255 255 255
164 213 90
32 32 32
123 123 205
255 255 255
74 74 115
197 197 197
98 98 189
106 106 197
98 123 57
131 131 131
222 41 0
189 123 41
180 180 222
0 0 0
0 0 0

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1014 B

After

Width:  |  Height:  |  Size: 6.1 KiB

View File

@ -1,35 +0,0 @@
JASC-PAL
0100
32
0 0 0
255 255 255
32 32 32
172 172 172
230 8 8
255 189 115
32 156 8
148 246 148
49 82 205
164 197 246
164 213 90
238 230 197
148 197 213
32 57 98
106 148 197
90 106 156
255 255 255
164 213 90
32 32 32
123 123 205
255 255 255
74 74 115
197 197 197
98 98 189
106 106 197
98 123 57
131 131 131
222 41 0
189 123 41
180 180 222
0 0 0
0 0 0

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 6.2 KiB

View File

@ -1,51 +0,0 @@
JASC-PAL
0100
48
0 0 0
255 255 255
32 32 32
172 172 172
230 8 8
255 189 115
32 156 8
148 246 148
49 82 205
164 197 246
164 213 90
238 230 197
148 197 213
32 57 98
106 148 197
90 106 156
255 255 255
164 213 90
32 32 32
123 123 205
255 255 255
74 74 115
197 197 197
98 98 189
106 106 197
98 123 57
131 131 131
222 41 0
189 123 41
180 180 222
0 0 0
0 0 0
0 0 0
255 255 255
238 238 238
222 222 230
205 205 222
197 197 205
180 180 197
164 164 189
156 156 172
139 139 164
123 123 156
115 115 139
98 98 131
82 82 123
74 74 115
32 32 32

Binary file not shown.

Before

Width:  |  Height:  |  Size: 811 B

After

Width:  |  Height:  |  Size: 4.5 KiB

View File

@ -0,0 +1,19 @@
JASC-PAL
0100
16
255 255 255
255 255 255
99 99 99
214 214 206
230 8 8
255 189 115
32 156 8
148 246 148
49 82 205
164 197 246
255 255 255
99 99 99
214 214 206
0 0 0
0 0 0
0 0 0

View File

@ -1,35 +0,0 @@
JASC-PAL
0100
32
0 0 0
255 255 255
32 32 32
172 172 172
230 8 8
255 189 115
32 156 8
148 246 148
49 82 205
164 197 246
164 213 90
238 230 197
148 197 213
32 57 98
106 148 197
90 106 156
255 255 255
164 213 90
32 32 32
123 123 205
255 255 255
74 74 115
197 197 197
98 98 189
106 106 197
98 123 57
131 131 131
222 41 0
189 123 41
180 180 222
0 0 0
0 0 0

Binary file not shown.

Before

Width:  |  Height:  |  Size: 211 B

After

Width:  |  Height:  |  Size: 279 B

View File

@ -3186,9 +3186,9 @@ extern const u16 gWallClockFemale_Pal[];
extern const u32 gWallClockStart_Tilemap[]; extern const u32 gWallClockStart_Tilemap[];
extern const u32 gWallClockView_Tilemap[]; extern const u32 gWallClockView_Tilemap[];
extern const u32 gBerryFixGameboy_Gfx[]; extern const u32 gBerryFixGbaConnect_Gfx[];
extern const u32 gBerryFixGameboy_Tilemap[]; extern const u32 gBerryFixGbaConnect_Tilemap[];
extern const u16 gBerryFixGameboy_Pal[]; extern const u16 gBerryFixGbaConnect_Pal[];
extern const u32 gBerryFixGameboyLogo_Gfx[]; extern const u32 gBerryFixGameboyLogo_Gfx[];
extern const u32 gBerryFixGameboyLogo_Tilemap[]; extern const u32 gBerryFixGameboyLogo_Tilemap[];
extern const u16 gBerryFixGameboyLogo_Pal[]; extern const u16 gBerryFixGameboyLogo_Pal[];

View File

@ -8,9 +8,9 @@ static const struct {
const u16 *pltt; const u16 *pltt;
} sBerryFixGraphics[] = { } sBerryFixGraphics[] = {
{ {
gBerryFixGameboy_Gfx, gBerryFixGbaConnect_Gfx,
gBerryFixGameboy_Tilemap, gBerryFixGbaConnect_Tilemap,
gBerryFixGameboy_Pal gBerryFixGbaConnect_Pal
}, { }, {
gBerryFixGameboyLogo_Gfx, gBerryFixGameboyLogo_Gfx,
gBerryFixGameboyLogo_Tilemap, gBerryFixGameboyLogo_Tilemap,
@ -43,7 +43,7 @@ static void LoadBerryFixGraphics(u32 idx)
REG_BLDCNT = 0; REG_BLDCNT = 0;
LZ77UnCompVram(sBerryFixGraphics[idx].gfx, (void *)BG_CHAR_ADDR(0)); LZ77UnCompVram(sBerryFixGraphics[idx].gfx, (void *)BG_CHAR_ADDR(0));
LZ77UnCompVram(sBerryFixGraphics[idx].tilemap, (void *)BG_SCREEN_ADDR(31)); LZ77UnCompVram(sBerryFixGraphics[idx].tilemap, (void *)BG_SCREEN_ADDR(31));
CpuCopy16(sBerryFixGraphics[idx].pltt, (void *)PLTT, 0x200); CpuCopy16(sBerryFixGraphics[idx].pltt, (void *)BG_PLTT, BG_PLTT_SIZE);
REG_BG0CNT = 0x1f00; REG_BG0CNT = BGCNT_SCREENBASE(31);
REG_DISPCNT = DISPCNT_BG0_ON; REG_DISPCNT = DISPCNT_BG0_ON;
} }

View File

@ -117,13 +117,7 @@ static const struct WindowTemplate sBerryFixWindowTemplates[] = {
DUMMY_WIN_TEMPLATE DUMMY_WIN_TEMPLATE
}; };
static const u16 ALIGNED(4) sBerryFixPalColors[] = { static const u16 ALIGNED(4) sText_Pal[] = INCBIN_U16("graphics/berry_fix/text.gbapal");
RGB_WHITE, RGB_WHITE, RGB(12, 12, 12), RGB(26, 26, 25),
RGB(28, 1, 1), RGB(31, 23, 14), RGB(4, 19, 1), RGB(18, 30, 18),
RGB(6, 10, 25), RGB(20, 24, 30), RGB_WHITE, RGB(12, 12, 12),
RGB(26, 26, 25), RGB_BLACK, RGB_BLACK, RGB_BLACK
};
static const u8 sBerryProgramTextColors[] = {TEXT_DYNAMIC_COLOR_1, TEXT_DYNAMIC_COLOR_2, TEXT_DYNAMIC_COLOR_3}; static const u8 sBerryProgramTextColors[] = {TEXT_DYNAMIC_COLOR_1, TEXT_DYNAMIC_COLOR_2, TEXT_DYNAMIC_COLOR_3};
static const u8 sGameTitleTextColors[] = { TEXT_COLOR_TRANSPARENT, TEXT_DYNAMIC_COLOR_1, TEXT_DYNAMIC_COLOR_4}; static const u8 sGameTitleTextColors[] = { TEXT_COLOR_TRANSPARENT, TEXT_DYNAMIC_COLOR_1, TEXT_DYNAMIC_COLOR_4};
@ -152,9 +146,9 @@ static const struct {
const u16 *palette; const u16 *palette;
} sBerryFixGraphics[] = { } sBerryFixGraphics[] = {
[SCENE_ENSURE_CONNECT] = { [SCENE_ENSURE_CONNECT] = {
gBerryFixGameboy_Gfx, gBerryFixGbaConnect_Gfx,
gBerryFixGameboy_Tilemap, gBerryFixGbaConnect_Tilemap,
gBerryFixGameboy_Pal gBerryFixGbaConnect_Pal
}, },
[SCENE_TURN_OFF_POWER] = { [SCENE_TURN_OFF_POWER] = {
gBerryFixGameboyLogo_Gfx, gBerryFixGameboyLogo_Gfx,
@ -304,7 +298,7 @@ static void BerryFix_GpuSet(void)
InitWindows(sBerryFixWindowTemplates); InitWindows(sBerryFixWindowTemplates);
DeactivateAllTextPrinters(); DeactivateAllTextPrinters();
DmaCopy32(3, sBerryFixPalColors, BG_PLTT + 0x1E0, sizeof(sBerryFixPalColors)); DmaCopy32(3, sText_Pal, BG_PLTT + PLTT_OFFSET_4BPP(15), sizeof(sText_Pal));
SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_1D_MAP); SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_1D_MAP);
FillWindowPixelBuffer(WIN_GAME_NAMES, PIXEL_FILL(0)); FillWindowPixelBuffer(WIN_GAME_NAMES, PIXEL_FILL(0));
FillWindowPixelBuffer(WIN_TURN_OFF_TITLE, PIXEL_FILL(0)); FillWindowPixelBuffer(WIN_TURN_OFF_TITLE, PIXEL_FILL(0));
@ -374,7 +368,9 @@ static void BerryFix_SetScene(int scene)
CopyBgTilemapBufferToVram(0); CopyBgTilemapBufferToVram(0);
LZ77UnCompVram(sBerryFixGraphics[scene].gfx, (void *)BG_CHAR_ADDR(1)); LZ77UnCompVram(sBerryFixGraphics[scene].gfx, (void *)BG_CHAR_ADDR(1));
LZ77UnCompVram(sBerryFixGraphics[scene].tilemap, (void *)BG_SCREEN_ADDR(31)); LZ77UnCompVram(sBerryFixGraphics[scene].tilemap, (void *)BG_SCREEN_ADDR(31));
CpuCopy32(sBerryFixGraphics[scene].palette, (void *)BG_PLTT, 0x100); // These palettes range in size from 32-48 colors, so the below is interpreting whatever
// follows the palette (by default, the corresponding tiles) as the remaining 80-96.
CpuCopy32(sBerryFixGraphics[scene].palette, (void *)BG_PLTT, PLTT_SIZEOF(128));
ShowBg(0); ShowBg(0);
ShowBg(1); ShowBg(1);
} }

View File

@ -1,6 +1,6 @@
const u16 gBerryFixGameboy_Pal[] = INCBIN_U16("graphics/berry_fix/gba_small.gbapal"); const u16 gBerryFixGbaConnect_Pal[] = INCBIN_U16("graphics/berry_fix/gba_connect.gbapal");
const u32 gBerryFixGameboy_Gfx[] = INCBIN_U32("graphics/berry_fix/gba_small.4bpp.lz"); const u32 gBerryFixGbaConnect_Gfx[] = INCBIN_U32("graphics/berry_fix/gba_connect.4bpp.lz");
const u32 gBerryFixGameboy_Tilemap[] = INCBIN_U32("graphics/berry_fix/gba_small.bin.lz"); const u32 gBerryFixGbaConnect_Tilemap[] = INCBIN_U32("graphics/berry_fix/gba_connect.bin.lz");
const u16 gBerryFixGameboyLogo_Pal[] = INCBIN_U16("graphics/berry_fix/logo.gbapal"); const u16 gBerryFixGameboyLogo_Pal[] = INCBIN_U16("graphics/berry_fix/logo.gbapal");
const u32 gBerryFixGameboyLogo_Gfx[] = INCBIN_U32("graphics/berry_fix/logo.4bpp.lz"); const u32 gBerryFixGameboyLogo_Gfx[] = INCBIN_U32("graphics/berry_fix/logo.4bpp.lz");