Skip to content

Commit

Permalink
Correct berry fix graphics colors, more PLTT constant use (#1892)
Browse files Browse the repository at this point in the history
  • Loading branch information
GriffinRichards authored Aug 9, 2023
1 parent 912a80e commit 6eaaa50
Show file tree
Hide file tree
Showing 20 changed files with 39 additions and 252 deletions.
4 changes: 1 addition & 3 deletions gflib/bg.c
Original file line number Diff line number Diff line change
Expand Up @@ -421,13 +421,11 @@ u16 Unused_LoadBgPalette(u8 bg, const void *src, u16 size, u16 destOffset)

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);

if (cursor == -1)
{
return -1;
}
}
else
{
Expand Down
File renamed without changes.
Binary file added graphics/berry_fix/gba_connect.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 0 additions & 35 deletions graphics/berry_fix/gba_small.pal

This file was deleted.

Binary file removed graphics/berry_fix/gba_small.png
Binary file not shown.
35 changes: 0 additions & 35 deletions graphics/berry_fix/gba_transfer.pal

This file was deleted.

Binary file modified graphics/berry_fix/gba_transfer.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 0 additions & 35 deletions graphics/berry_fix/gba_transfer_error.pal

This file was deleted.

Binary file modified graphics/berry_fix/gba_transfer_error.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 0 additions & 35 deletions graphics/berry_fix/gba_transfer_highlight.pal

This file was deleted.

Binary file modified graphics/berry_fix/gba_transfer_highlight.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
51 changes: 0 additions & 51 deletions graphics/berry_fix/logo.pal

This file was deleted.

Binary file modified graphics/berry_fix/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions graphics/berry_fix/text.pal
Original file line number Diff line number Diff line change
@@ -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
35 changes: 0 additions & 35 deletions graphics/berry_fix/window.pal

This file was deleted.

Binary file modified graphics/berry_fix/window.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions include/graphics.h
Original file line number Diff line number Diff line change
Expand Up @@ -3186,9 +3186,9 @@ extern const u16 gWallClockFemale_Pal[];
extern const u32 gWallClockStart_Tilemap[];
extern const u32 gWallClockView_Tilemap[];

extern const u32 gBerryFixGameboy_Gfx[];
extern const u32 gBerryFixGameboy_Tilemap[];
extern const u16 gBerryFixGameboy_Pal[];
extern const u32 gBerryFixGbaConnect_Gfx[];
extern const u32 gBerryFixGbaConnect_Tilemap[];
extern const u16 gBerryFixGbaConnect_Pal[];
extern const u32 gBerryFixGameboyLogo_Gfx[];
extern const u32 gBerryFixGameboyLogo_Tilemap[];
extern const u16 gBerryFixGameboyLogo_Pal[];
Expand Down
10 changes: 5 additions & 5 deletions src/berry_fix_graphics.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ static const struct {
const u16 *pltt;
} sBerryFixGraphics[] = {
{
gBerryFixGameboy_Gfx,
gBerryFixGameboy_Tilemap,
gBerryFixGameboy_Pal
gBerryFixGbaConnect_Gfx,
gBerryFixGbaConnect_Tilemap,
gBerryFixGbaConnect_Pal
}, {
gBerryFixGameboyLogo_Gfx,
gBerryFixGameboyLogo_Tilemap,
Expand Down Expand Up @@ -43,7 +43,7 @@ static void LoadBerryFixGraphics(u32 idx)
REG_BLDCNT = 0;
LZ77UnCompVram(sBerryFixGraphics[idx].gfx, (void *)BG_CHAR_ADDR(0));
LZ77UnCompVram(sBerryFixGraphics[idx].tilemap, (void *)BG_SCREEN_ADDR(31));
CpuCopy16(sBerryFixGraphics[idx].pltt, (void *)PLTT, 0x200);
REG_BG0CNT = 0x1f00;
CpuCopy16(sBerryFixGraphics[idx].pltt, (void *)BG_PLTT, BG_PLTT_SIZE);
REG_BG0CNT = BGCNT_SCREENBASE(31);
REG_DISPCNT = DISPCNT_BG0_ON;
}
20 changes: 8 additions & 12 deletions src/berry_fix_program.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,7 @@ static const struct WindowTemplate sBerryFixWindowTemplates[] = {
DUMMY_WIN_TEMPLATE
};

static const u16 ALIGNED(4) sBerryFixPalColors[] = {
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 u16 ALIGNED(4) sText_Pal[] = INCBIN_U16("graphics/berry_fix/text.gbapal");
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};

Expand Down Expand Up @@ -152,9 +146,9 @@ static const struct {
const u16 *palette;
} sBerryFixGraphics[] = {
[SCENE_ENSURE_CONNECT] = {
gBerryFixGameboy_Gfx,
gBerryFixGameboy_Tilemap,
gBerryFixGameboy_Pal
gBerryFixGbaConnect_Gfx,
gBerryFixGbaConnect_Tilemap,
gBerryFixGbaConnect_Pal
},
[SCENE_TURN_OFF_POWER] = {
gBerryFixGameboyLogo_Gfx,
Expand Down Expand Up @@ -304,7 +298,7 @@ static void BerryFix_GpuSet(void)
InitWindows(sBerryFixWindowTemplates);
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);
FillWindowPixelBuffer(WIN_GAME_NAMES, PIXEL_FILL(0));
FillWindowPixelBuffer(WIN_TURN_OFF_TITLE, PIXEL_FILL(0));
Expand Down Expand Up @@ -374,7 +368,9 @@ static void BerryFix_SetScene(int scene)
CopyBgTilemapBufferToVram(0);
LZ77UnCompVram(sBerryFixGraphics[scene].gfx, (void *)BG_CHAR_ADDR(1));
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(1);
}
Expand Down
6 changes: 3 additions & 3 deletions src/data/graphics/berry_fix.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const u16 gBerryFixGameboy_Pal[] = INCBIN_U16("graphics/berry_fix/gba_small.gbapal");
const u32 gBerryFixGameboy_Gfx[] = INCBIN_U32("graphics/berry_fix/gba_small.4bpp.lz");
const u32 gBerryFixGameboy_Tilemap[] = INCBIN_U32("graphics/berry_fix/gba_small.bin.lz");
const u16 gBerryFixGbaConnect_Pal[] = INCBIN_U16("graphics/berry_fix/gba_connect.gbapal");
const u32 gBerryFixGbaConnect_Gfx[] = INCBIN_U32("graphics/berry_fix/gba_connect.4bpp.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 u32 gBerryFixGameboyLogo_Gfx[] = INCBIN_U32("graphics/berry_fix/logo.4bpp.lz");
Expand Down

0 comments on commit 6eaaa50

Please sign in to comment.