Fix compressed palette alignment

This commit is contained in:
Diegoisawesome 2018-12-18 20:15:59 -06:00
parent 2592803460
commit bd7c251859
16 changed files with 30 additions and 31 deletions

View File

@ -122,7 +122,7 @@ s16 CloneBattlerSpriteWithBlend(u8);
void obj_delete_but_dont_free_vram(struct Sprite*); void obj_delete_but_dont_free_vram(struct Sprite*);
u8 sub_80A89C8(int, u8, int); u8 sub_80A89C8(int, u8, int);
void sub_80A6D60(struct UnknownAnimStruct2*, const void*, u32); void sub_80A6D60(struct UnknownAnimStruct2*, const void*, u32);
void sub_80A6CC0(u32, const void*, u32); void sub_80A6CC0(u32, const u32*, u32);
void sub_80A6DAC(bool8); void sub_80A6DAC(bool8);
void TranslateSpriteInGrowingCircleOverDuration(struct Sprite *); void TranslateSpriteInGrowingCircleOverDuration(struct Sprite *);
void sub_80A653C(struct Sprite *); void sub_80A653C(struct Sprite *);
@ -190,7 +190,7 @@ u8 LaunchBallFadeMonTask(bool8 unFadeLater, u8 battlerId, u32 selectedPalettes,
// battle_anim_utility_funcs.s // battle_anim_utility_funcs.s
void sub_8116EB4(u8); void sub_8116EB4(u8);
void sub_8117854(u8 taskId, int unused, u16 arg2, u8 battler1, u8 arg4, u8 arg5, u8 arg6, u8 arg7, const u8 *arg8, const u8 *arg9, const u16 *palette); void sub_8117854(u8 taskId, int unused, u16 arg2, u8 battler1, u8 arg4, u8 arg5, u8 arg6, u8 arg7, const u32 *arg8, const u32 *arg9, const u32 *palette);
u32 UnpackSelectedBattleAnimPalettes(s16); u32 UnpackSelectedBattleAnimPalettes(s16);

View File

@ -3071,7 +3071,7 @@ extern const u32 gTrainerBackPicPalette_Leaf[];
// pokeblock // pokeblock
extern const u32 gMenuPokeblock_Gfx[]; extern const u32 gMenuPokeblock_Gfx[];
extern const u8 gMenuPokeblock_Pal[]; extern const u32 gMenuPokeblock_Pal[];
extern const u32 gMenuPokeblock_Tilemap[]; extern const u32 gMenuPokeblock_Tilemap[];
extern const u32 gMenuPokeblockDevice_Gfx[]; extern const u32 gMenuPokeblockDevice_Gfx[];
extern const u32 gMenuPokeblockDevice_Pal[]; extern const u32 gMenuPokeblockDevice_Pal[];
@ -3859,8 +3859,8 @@ extern const u8 gFireRedMenuElements_Gfx[];
// item menu graphics // item menu graphics
extern const u32 gBagScreen_Gfx[]; extern const u32 gBagScreen_Gfx[];
extern const u16 gBagScreenFemale_Pal[]; extern const u32 gBagScreenFemale_Pal[];
extern const u16 gBagScreenMale_Pal[]; extern const u32 gBagScreenMale_Pal[];
extern const u8 gBagMenuHMIcon_Gfx[]; extern const u8 gBagMenuHMIcon_Gfx[];
// item menu icons graphics // item menu icons graphics
@ -4100,6 +4100,10 @@ extern const u32 gUnknown_08D83C3C[];
extern const u32 gUnknown_08D83900[]; extern const u32 gUnknown_08D83900[];
extern const u32 gBattleFrontierGfx_DomeOptions[]; extern const u32 gBattleFrontierGfx_DomeOptions[];
extern const u32 gUnknown_08D854E8[];
extern const u32 gUnknown_08D855E8[];
extern const u32 gContest2Pal[];
extern const u32 gBattleAnimSpriteSheet_000[]; extern const u32 gBattleAnimSpriteSheet_000[];
extern const u32 gBattleAnimSpriteSheet_001[]; extern const u32 gBattleAnimSpriteSheet_001[];
extern const u32 gBattleAnimSpriteSheet_002[]; extern const u32 gBattleAnimSpriteSheet_002[];
@ -4769,5 +4773,7 @@ extern const u16 gCableCar_Pal[];
extern const u16 gUnknown_08DDB3E4[]; extern const u16 gUnknown_08DDB3E4[];
extern const u8 gUnknown_08DDB464[]; extern const u8 gUnknown_08DDB464[];
extern const u16 gUnknown_08DDCF04[]; extern const u16 gUnknown_08DDCF04[];
extern const u16 gTradeGba2_Pal[];
extern const u8 gTradeGba_Gfx[];
#endif //GUARD_GRAPHICS_H #endif //GUARD_GRAPHICS_H

View File

@ -43,7 +43,7 @@ extern u8 gPaletteDecompressionBuffer[];
extern u16 gPlttBufferUnfaded[]; extern u16 gPlttBufferUnfaded[];
extern u16 gPlttBufferFaded[]; extern u16 gPlttBufferFaded[];
void LoadCompressedPalette(const void *, u16, u16); void LoadCompressedPalette(const u32 *, u16, u16);
void LoadPalette(const void *, u16, u16); void LoadPalette(const void *, u16, u16);
void FillPalette(u16, u16, u16); void FillPalette(u16, u16, u16);
void TransferPlttBuffer(void); void TransferPlttBuffer(void);

View File

@ -944,7 +944,7 @@ void sub_80A6C68(u32 bgId)
CopyBgTilemapBufferToVram(unkStruct.bgId); CopyBgTilemapBufferToVram(unkStruct.bgId);
} }
void sub_80A6CC0(u32 bgId, const void *src, u32 tilesOffset) void sub_80A6CC0(u32 bgId, const u32 *src, u32 tilesOffset)
{ {
CpuFill32(0, gUnknown_0202305C, 0x2000); CpuFill32(0, gUnknown_0202305C, 0x2000);
LZDecompressWram(src, gUnknown_0202305C); LZDecompressWram(src, gUnknown_0202305C);

View File

@ -3390,8 +3390,8 @@ void sub_81064F8(u8 taskId)
else else
sub_80A6D60(&unknownStruct, &gBattleAnimBackgroundTilemap_ScaryFaceOpponent, 0); sub_80A6D60(&unknownStruct, &gBattleAnimBackgroundTilemap_ScaryFaceOpponent, 0);
sub_80A6CC0(unknownStruct.bgId, &gUnknown_08C249F8, unknownStruct.tilesOffset); sub_80A6CC0(unknownStruct.bgId, gUnknown_08C249F8, unknownStruct.tilesOffset);
LoadCompressedPalette(&gUnknown_08C249D0, unknownStruct.unk8 << 4, 32); LoadCompressedPalette(gUnknown_08C249D0, unknownStruct.unk8 << 4, 32);
gTasks[taskId].func = sub_81065EC; gTasks[taskId].func = sub_81065EC;
} }

View File

@ -2388,8 +2388,8 @@ void sub_815BB84(u8 taskId)
gBattle_BG1_Y = 0; gBattle_BG1_Y = 0;
} }
sub_80A6CC0(unknownStruct.bgId, &gUnknown_08C2A634, unknownStruct.tilesOffset); sub_80A6CC0(unknownStruct.bgId, gUnknown_08C2A634, unknownStruct.tilesOffset);
LoadCompressedPalette(&gUnknown_08C2A6D4, unknownStruct.unk8 << 4, 32); LoadCompressedPalette(gUnknown_08C2A6D4, unknownStruct.unk8 << 4, 32);
gTasks[taskId].data[10] = gBattle_BG1_X; gTasks[taskId].data[10] = gBattle_BG1_X;
gTasks[taskId].data[11] = gBattle_BG1_Y; gTasks[taskId].data[11] = gBattle_BG1_Y;
@ -2594,8 +2594,8 @@ void sub_815C0A4(u8 taskId)
gBattle_BG1_Y = 0; gBattle_BG1_Y = 0;
} }
sub_80A6CC0(unknownStruct.bgId, &gUnknown_08C2A634, unknownStruct.tilesOffset); sub_80A6CC0(unknownStruct.bgId, gUnknown_08C2A634, unknownStruct.tilesOffset);
LoadCompressedPalette(&gUnknown_08C2A6D4, unknownStruct.unk8 << 4, 32); LoadCompressedPalette(gUnknown_08C2A6D4, unknownStruct.unk8 << 4, 32);
gTasks[taskId].data[10] = gBattle_BG1_X; gTasks[taskId].data[10] = gBattle_BG1_X;
gTasks[taskId].data[11] = gBattle_BG1_Y; gTasks[taskId].data[11] = gBattle_BG1_Y;
gTasks[taskId].data[0]++; gTasks[taskId].data[0]++;

View File

@ -767,7 +767,7 @@ void sub_81177E4(u8 taskId)
DestroyAnimVisualTask(taskId); DestroyAnimVisualTask(taskId);
} }
void sub_8117854(u8 taskId, int unused, u16 arg2, u8 battler1, u8 arg4, u8 arg5, u8 arg6, u8 arg7, const u8 *arg8, const u8 *arg9, const u16 *palette) void sub_8117854(u8 taskId, int unused, u16 arg2, u8 battler1, u8 arg4, u8 arg5, u8 arg6, u8 arg7, const u32 *arg8, const u32 *arg9, const u32 *palette)
{ {
u16 species; u16 species;
u8 spriteId, spriteId2; u8 spriteId, spriteId2;

View File

@ -8,6 +8,7 @@
#include "decompress.h" #include "decompress.h"
#include "event_data.h" #include "event_data.h"
#include "frontier_util.h" #include "frontier_util.h"
#include "graphics.h"
#include "gpu_regs.h" #include "gpu_regs.h"
#include "item.h" #include "item.h"
#include "m4a.h" #include "m4a.h"
@ -23,9 +24,6 @@
#include "constants/battle_frontier.h" #include "constants/battle_frontier.h"
#include "constants/moves.h" #include "constants/moves.h"
extern const u32 gUnknown_08D854E8[];
extern const u16 gUnknown_08D855E8[];
// This file's functions. // This file's functions.
static void sub_81A58B4(void); static void sub_81A58B4(void);
static void sub_81A5964(void); static void sub_81A5964(void);

View File

@ -16,6 +16,7 @@
#include "dma3.h" #include "dma3.h"
#include "event_data.h" #include "event_data.h"
#include "evolution_scene.h" #include "evolution_scene.h"
#include "graphics.h"
#include "gpu_regs.h" #include "gpu_regs.h"
#include "international_string_util.h" #include "international_string_util.h"
#include "item.h" #include "item.h"
@ -73,7 +74,6 @@ extern struct MusicPlayerInfo gMPlayInfo_SE1;
extern struct MusicPlayerInfo gMPlayInfo_SE2; extern struct MusicPlayerInfo gMPlayInfo_SE2;
extern u8 gUnknown_0203CF00[]; extern u8 gUnknown_0203CF00[];
extern const u16 gBattleTextboxPalette[];
extern const struct BgTemplate gBattleBgTemplates[]; extern const struct BgTemplate gBattleBgTemplates[];
extern const struct WindowTemplate *const gBattleWindowTemplates[]; extern const struct WindowTemplate *const gBattleWindowTemplates[];
extern const u8 *const gBattleScriptsForMoveEffects[]; extern const u8 *const gBattleScriptsForMoveEffects[];

View File

@ -217,7 +217,6 @@ extern const u8 gText_0827D597[];
extern const struct ContestPokemon gContestOpponents[96]; extern const struct ContestPokemon gContestOpponents[96];
extern const u8 gUnknown_085898A4[96]; extern const u8 gUnknown_085898A4[96];
extern const struct CompressedSpriteSheet gUnknown_08587C00; extern const struct CompressedSpriteSheet gUnknown_08587C00;
extern const u8 gContest2Pal[];
extern const struct SpriteTemplate gSpriteTemplate_8587BE8; extern const struct SpriteTemplate gSpriteTemplate_8587BE8;
extern const struct CompressedSpriteSheet gUnknown_08587C08; extern const struct CompressedSpriteSheet gUnknown_08587C08;
extern const struct CompressedSpritePalette gUnknown_08587C10; extern const struct CompressedSpritePalette gUnknown_08587C10;

View File

@ -23,6 +23,7 @@
#include "bg.h" #include "bg.h"
#include "m4a.h" #include "m4a.h"
#include "window.h" #include "window.h"
#include "graphics.h"
#include "constants/abilities.h" #include "constants/abilities.h"
#include "daycare.h" #include "daycare.h"
#include "overworld.h" #include "overworld.h"
@ -51,11 +52,6 @@ struct EggHatchData
}; };
extern const struct CompressedSpriteSheet gMonFrontPicTable[]; extern const struct CompressedSpriteSheet gMonFrontPicTable[];
extern const u8 gBattleTextboxTiles[];
extern const u8 gBattleTextboxTilemap[];
extern const u8 gBattleTextboxPalette[];
extern const u16 gTradeGba2_Pal[]; // palette, gameboy advance
extern const u32 gTradeGba_Gfx[]; // tileset gameboy advance
extern const u32 gUnknown_08331F60[]; // tilemap gameboy circle extern const u32 gUnknown_08331F60[]; // tilemap gameboy circle
extern const u8 gText_HatchedFromEgg[]; extern const u8 gText_HatchedFromEgg[];
extern const u8 gText_NickHatchPrompt[]; extern const u8 gText_NickHatchPrompt[];

View File

@ -986,7 +986,7 @@ void apply_map_tileset_palette(struct Tileset const *tileset, u16 destOffset, u1
} }
else else
{ {
LoadCompressedPalette((u16*)tileset->palettes, destOffset, size); LoadCompressedPalette((u32*)tileset->palettes, destOffset, size);
nullsub_3(destOffset, size >> 1); nullsub_3(destOffset, size >> 1);
} }
} }

View File

@ -897,9 +897,9 @@ const u32 gBattleStatMask6_Pal[] = INCBIN_U32("graphics/battle_anims/masks/stat6
const u32 gBattleStatMask7_Pal[] = INCBIN_U32("graphics/battle_anims/masks/stat7.gbapal.lz"); const u32 gBattleStatMask7_Pal[] = INCBIN_U32("graphics/battle_anims/masks/stat7.gbapal.lz");
const u32 gBattleStatMask8_Pal[] = INCBIN_U32("graphics/battle_anims/masks/stat8.gbapal.lz"); const u32 gBattleStatMask8_Pal[] = INCBIN_U32("graphics/battle_anims/masks/stat8.gbapal.lz");
const u8 gUnknown_08C2DC68[] = INCBIN_U8("graphics/battle_anims/masks/cure_bubbles.4bpp.lz"); const u32 gUnknown_08C2DC68[] = INCBIN_U32("graphics/battle_anims/masks/cure_bubbles.4bpp.lz");
const u16 gUnknown_08C2DDA4[] = INCBIN_U16("graphics/battle_anims/masks/cure_bubbles.gbapal.lz"); const u32 gUnknown_08C2DDA4[] = INCBIN_U32("graphics/battle_anims/masks/cure_bubbles.gbapal.lz");
const u8 gUnknown_08C2DDC4[] = INCBIN_U8("graphics/battle_anims/masks/cure_bubbles.bin.lz"); const u32 gUnknown_08C2DDC4[] = INCBIN_U32("graphics/battle_anims/masks/cure_bubbles.bin.lz");
const u32 gBattleAnimSpritePalette_245[] = INCBIN_U32("graphics/battle_anims/sprites/245.gbapal.lz"); const u32 gBattleAnimSpritePalette_245[] = INCBIN_U32("graphics/battle_anims/sprites/245.gbapal.lz");
const u32 gBattleAnimSpriteSheet_245[] = INCBIN_U32("graphics/battle_anims/sprites/245.4bpp.lz"); const u32 gBattleAnimSpriteSheet_245[] = INCBIN_U32("graphics/battle_anims/sprites/245.4bpp.lz");

View File

@ -77,7 +77,7 @@ static const u8 sRoundedDownGrayscaleMap[] = {
31, 31 31, 31
}; };
void LoadCompressedPalette(const void *src, u16 offset, u16 size) void LoadCompressedPalette(const u32 *src, u16 offset, u16 size)
{ {
LZDecompressWram(src, gPaletteDecompressionBuffer); LZDecompressWram(src, gPaletteDecompressionBuffer);
CpuCopy16(gPaletteDecompressionBuffer, gPlttBufferUnfaded + offset, size); CpuCopy16(gPaletteDecompressionBuffer, gPlttBufferUnfaded + offset, size);

View File

@ -1275,7 +1275,7 @@ static bool8 SummaryScreen_DecompressGraphics(void)
pssData->unk40F0++; pssData->unk40F0++;
break; break;
case 12: case 12:
LoadCompressedPalette(&gMoveTypes_Pal, 0x1D0, 0x60); LoadCompressedPalette(gMoveTypes_Pal, 0x1D0, 0x60);
pssData->unk40F0 = 0; pssData->unk40F0 = 0;
return TRUE; return TRUE;
} }

View File

@ -421,7 +421,7 @@ void AnimTask_LoadSandstormBackground(u8 taskId)
sub_80A6B30(&unknownStruct); sub_80A6B30(&unknownStruct);
sub_80A6CC0(unknownStruct.bgId, gUnknown_08D8D58C, unknownStruct.tilesOffset); sub_80A6CC0(unknownStruct.bgId, gUnknown_08D8D58C, unknownStruct.tilesOffset);
sub_80A6D60(&unknownStruct, gUnknown_08D8D410, 0); sub_80A6D60(&unknownStruct, gUnknown_08D8D410, 0);
LoadCompressedPalette(&gBattleAnimSpritePalette_261, unknownStruct.unk8 * 16, 32); LoadCompressedPalette(gBattleAnimSpritePalette_261, unknownStruct.unk8 * 16, 32);
if (gBattleAnimArgs[0] && GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER) if (gBattleAnimArgs[0] && GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER)
var0 = 1; var0 = 1;