diff --git a/gflib/bg.c b/gflib/bg.c index 89f503824..4ccb95eb6 100644 --- a/gflib/bg.c +++ b/gflib/bg.c @@ -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 { diff --git a/graphics/berry_fix/gba_small.bin b/graphics/berry_fix/gba_connect.bin similarity index 100% rename from graphics/berry_fix/gba_small.bin rename to graphics/berry_fix/gba_connect.bin diff --git a/graphics/berry_fix/gba_connect.png b/graphics/berry_fix/gba_connect.png new file mode 100644 index 000000000..78e292519 Binary files /dev/null and b/graphics/berry_fix/gba_connect.png differ diff --git a/graphics/berry_fix/gba_small.pal b/graphics/berry_fix/gba_small.pal deleted file mode 100644 index 0e177217f..000000000 --- a/graphics/berry_fix/gba_small.pal +++ /dev/null @@ -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 diff --git a/graphics/berry_fix/gba_small.png b/graphics/berry_fix/gba_small.png deleted file mode 100644 index 3bf1f3e36..000000000 Binary files a/graphics/berry_fix/gba_small.png and /dev/null differ diff --git a/graphics/berry_fix/gba_transfer.pal b/graphics/berry_fix/gba_transfer.pal deleted file mode 100644 index 0e177217f..000000000 --- a/graphics/berry_fix/gba_transfer.pal +++ /dev/null @@ -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 diff --git a/graphics/berry_fix/gba_transfer.png b/graphics/berry_fix/gba_transfer.png index 9b7eb5571..104227f8a 100644 Binary files a/graphics/berry_fix/gba_transfer.png and b/graphics/berry_fix/gba_transfer.png differ diff --git a/graphics/berry_fix/gba_transfer_error.pal b/graphics/berry_fix/gba_transfer_error.pal deleted file mode 100644 index 0e177217f..000000000 --- a/graphics/berry_fix/gba_transfer_error.pal +++ /dev/null @@ -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 diff --git a/graphics/berry_fix/gba_transfer_error.png b/graphics/berry_fix/gba_transfer_error.png index d8db4bfb9..2154b1c4d 100644 Binary files a/graphics/berry_fix/gba_transfer_error.png and b/graphics/berry_fix/gba_transfer_error.png differ diff --git a/graphics/berry_fix/gba_transfer_highlight.pal b/graphics/berry_fix/gba_transfer_highlight.pal deleted file mode 100644 index 0e177217f..000000000 --- a/graphics/berry_fix/gba_transfer_highlight.pal +++ /dev/null @@ -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 diff --git a/graphics/berry_fix/gba_transfer_highlight.png b/graphics/berry_fix/gba_transfer_highlight.png index 9fb9b6a48..f1845bdaf 100644 Binary files a/graphics/berry_fix/gba_transfer_highlight.png and b/graphics/berry_fix/gba_transfer_highlight.png differ diff --git a/graphics/berry_fix/logo.pal b/graphics/berry_fix/logo.pal deleted file mode 100644 index 4c76f3f9a..000000000 --- a/graphics/berry_fix/logo.pal +++ /dev/null @@ -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 diff --git a/graphics/berry_fix/logo.png b/graphics/berry_fix/logo.png index 29cda79b0..189ca9780 100644 Binary files a/graphics/berry_fix/logo.png and b/graphics/berry_fix/logo.png differ diff --git a/graphics/berry_fix/text.pal b/graphics/berry_fix/text.pal new file mode 100644 index 000000000..28675e904 --- /dev/null +++ b/graphics/berry_fix/text.pal @@ -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 diff --git a/graphics/berry_fix/window.pal b/graphics/berry_fix/window.pal deleted file mode 100644 index 0e177217f..000000000 --- a/graphics/berry_fix/window.pal +++ /dev/null @@ -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 diff --git a/graphics/berry_fix/window.png b/graphics/berry_fix/window.png index 7b57701e3..dd9f3b6af 100644 Binary files a/graphics/berry_fix/window.png and b/graphics/berry_fix/window.png differ diff --git a/include/graphics.h b/include/graphics.h index 04ad64606..2bfdc5537 100644 --- a/include/graphics.h +++ b/include/graphics.h @@ -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[]; diff --git a/src/berry_fix_graphics.c b/src/berry_fix_graphics.c index b37645d4c..d766c3966 100644 --- a/src/berry_fix_graphics.c +++ b/src/berry_fix_graphics.c @@ -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, @@ -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; } diff --git a/src/berry_fix_program.c b/src/berry_fix_program.c index 26af445a0..5900cb298 100644 --- a/src/berry_fix_program.c +++ b/src/berry_fix_program.c @@ -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}; @@ -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, @@ -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)); @@ -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); } diff --git a/src/data/graphics/berry_fix.h b/src/data/graphics/berry_fix.h index 07e2cbf51..0c26f7e92 100644 --- a/src/data/graphics/berry_fix.h +++ b/src/data/graphics/berry_fix.h @@ -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");