Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New sprite compressor #5627

Draft
wants to merge 75 commits into
base: upcoming
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
bf4c933
Testing decompression
Oct 2, 2024
0fc2270
Savepoint
Oct 3, 2024
76e3426
Saving
Oct 3, 2024
8a5d3aa
save point
Oct 4, 2024
0fd9de7
Before branching to test
Oct 4, 2024
5d774bc
Reading stage 1 works
Oct 4, 2024
1bb0cdf
Saving
Oct 4, 2024
1dc423b
Progress
Oct 9, 2024
c115253
Progress
Oct 17, 2024
add3925
It works
Oct 22, 2024
c6a875b
Minor cleanup
Oct 22, 2024
7c2b83b
Merge branch 'upcoming' into smolCompress-test
Oct 22, 2024
5d68264
More cleanup
Oct 22, 2024
c02de1a
Moved all calls to decompression functions into their wrapper functions
Oct 22, 2024
6ea4156
Removed extra line
Oct 22, 2024
e2489cf
Merge branch 'compression-wrapper' into smolCompress-test
Oct 23, 2024
dcf1754
small fix
Oct 23, 2024
33b5152
Split DecompressData into V/Wram versions
Oct 23, 2024
4534623
Pokemon sprites work
Oct 30, 2024
5e950b9
Merge branch 'upcoming' into smolCompress-test
Oct 30, 2024
84b41d5
New image compressor, first public reveal
Oct 31, 2024
406ee24
Some cleanup
Nov 1, 2024
6cde528
Fixed stuff
Nov 3, 2024
fb33a2a
plase stop using outdated gcc
Nov 3, 2024
09596ee
Some cleanup and performance increase
Nov 8, 2024
05ceee4
tANS decoding improvement
Nov 10, 2024
0c80310
Some progress
Nov 11, 2024
c3fd449
Progress
Nov 19, 2024
e8ee526
Merge branch 'upcoming' into smolCompress-test
Dec 1, 2024
b824ffd
Tests and progress
Dec 5, 2024
9a0e3ce
Cleanup
Dec 5, 2024
6f4e6fe
Cleanup and test additions
Dec 5, 2024
21adec3
start
DizzyEggg Dec 5, 2024
8886cf7
595120
DizzyEggg Dec 5, 2024
e06bdec
558724
DizzyEggg Dec 5, 2024
ae73816
559906
DizzyEggg Dec 5, 2024
d663cdb
528282
DizzyEggg Dec 5, 2024
f74fa5b
514820
DizzyEggg Dec 5, 2024
68270e3
minor cleanup
Dec 5, 2024
1f76371
511676
DizzyEggg Dec 5, 2024
e73ef3c
509011
DizzyEggg Dec 5, 2024
e444b00
476660
DizzyEggg Dec 6, 2024
62e7c66
476660 it is....
DizzyEggg Dec 6, 2024
50722eb
Merge pull request #4 from DizzyEggg/compresss
hedara90 Dec 6, 2024
89d18ce
Merge branch 'smolCompress-test' of github.com:hedara90/pokeemerald-e…
Dec 6, 2024
3268e6a
Fix alignement of LO/Sym data
Dec 6, 2024
4d80738
395766
DizzyEggg Dec 6, 2024
dde78fd
merge
DizzyEggg Dec 6, 2024
f1732a9
remove
DizzyEggg Dec 6, 2024
630100c
Merge pull request #5 from DizzyEggg/compresss
hedara90 Dec 6, 2024
563a7d2
331597
DizzyEggg Dec 6, 2024
1cafefd
328614
DizzyEggg Dec 6, 2024
84c8f0b
299175
DizzyEggg Dec 6, 2024
3529d6d
281124
DizzyEggg Dec 6, 2024
c89e96b
Merge pull request #6 from DizzyEggg/compresss
hedara90 Dec 6, 2024
94c114b
268710
DizzyEggg Dec 7, 2024
239964a
265422
DizzyEggg Dec 7, 2024
4438440
cleanup
DizzyEggg Dec 7, 2024
83c0a08
265230
DizzyEggg Dec 7, 2024
9601fe2
Merge pull request #7 from DizzyEggg/compresss
hedara90 Dec 7, 2024
0f65304
Stuff
Dec 7, 2024
97b923e
Merge branch 'smolCompress-test' of github.com:hedara90/pokeemerald-e…
Dec 7, 2024
657d50d
Stuff again
Dec 7, 2024
796a0d4
Fixed accidental breaking of non-tANS encoded images
Dec 7, 2024
2053844
move sReadIndex write 0
DizzyEggg Dec 7, 2024
f06ff69
Size acquisition fixes
Dec 7, 2024
3fd2bf4
Merge pull request #8 from DizzyEggg/compresss
hedara90 Dec 7, 2024
54ad44f
Minor cleanup
Dec 8, 2024
5c7ab67
Cleaned out wrong printf's
Dec 8, 2024
832699f
Changed image size alignment requirement
Dec 8, 2024
a2bd014
remove dma
DizzyEggg Dec 9, 2024
e34fb5d
remove dma
DizzyEggg Dec 9, 2024
58058a0
Merge pull request #9 from DizzyEggg/compresss
hedara90 Dec 9, 2024
db40868
lucky's suggestions
DizzyEggg Dec 11, 2024
fa29eac
Merge pull request #10 from DizzyEggg/compresss
hedara90 Dec 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
*.8bpp
*.gbapal
*.lz
*.smol
*.rl
*.latfont
*.hwjpnfont
Expand Down Expand Up @@ -41,3 +42,4 @@ prefabs.json
/pokeemerald-*.png
src/data/map_group_count.h
tools/trainerproc/trainerproc
tools/compresSmol/compresSmol
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ endif
AUTO_GEN_TARGETS :=
include make_tools.mk
# Tool executables
SMOL := $(TOOLS_DIR)/compresSmol/compresSmol$(EXE)
GFX := $(TOOLS_DIR)/gbagfx/gbagfx$(EXE)
AIF := $(TOOLS_DIR)/aif2pcm/aif2pcm$(EXE)
MID := $(TOOLS_DIR)/mid2agb/mid2agb$(EXE)
Expand Down Expand Up @@ -294,7 +295,7 @@ clean-assets:
rm -f $(DATA_ASM_SUBDIR)/layouts/layouts.inc $(DATA_ASM_SUBDIR)/layouts/layouts_table.inc
rm -f $(DATA_ASM_SUBDIR)/maps/connections.inc $(DATA_ASM_SUBDIR)/maps/events.inc $(DATA_ASM_SUBDIR)/maps/groups.inc $(DATA_ASM_SUBDIR)/maps/headers.inc $(DATA_SRC_SUBDIR)/map_group_count.h
find sound -iname '*.bin' -exec rm {} +
find . \( -iname '*.1bpp' -o -iname '*.4bpp' -o -iname '*.8bpp' -o -iname '*.gbapal' -o -iname '*.lz' -o -iname '*.rl' -o -iname '*.latfont' -o -iname '*.hwjpnfont' -o -iname '*.fwjpnfont' \) -exec rm {} +
find . \( -iname '*.1bpp' -o -iname '*.4bpp' -o -iname '*.8bpp' -o -iname '*.gbapal' -o -iname '*.lz' -o -iname '*.smol' -o -iname '*.rl' -o -iname '*.latfont' -o -iname '*.hwjpnfont' -o -iname '*.fwjpnfont' \) -exec rm {} +
find $(DATA_ASM_SUBDIR)/maps \( -iname 'connections.inc' -o -iname 'events.inc' -o -iname 'header.inc' \) -exec rm {} +

tidy: tidymodern tidycheck tidydebug
Expand Down Expand Up @@ -334,6 +335,7 @@ generated: $(AUTO_GEN_TARGETS)
%.gbapal: %.pal ; $(GFX) $< $@
%.gbapal: %.png ; $(GFX) $< $@
%.lz: % ; $(GFX) $< $@
%.smol: % ; $(SMOL) -w $< $@
%.rl: % ; $(GFX) $< $@

clean-generated:
Expand Down
2 changes: 1 addition & 1 deletion include/config/general.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// still has them in the ROM. This is because the developers forgot
// to define NDEBUG before release, however this has been changed as
// Ruby's actual debug build does not use the AGBPrint features.
#define NDEBUG
//#define NDEBUG

// To enable printf debugging, comment out "#define NDEBUG". This allows
// the various AGBPrint functions to be used. (See include/gba/isagbprint.h).
Expand Down
79 changes: 79 additions & 0 deletions include/decompress.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,87 @@

#include "sprite.h"

#define TANS_TABLE_SIZE 64
#define PACKED_FREQ_MASK 0x3F
#define PARTIAL_FREQ_MASK 0xC0000000

#define FIRST_LO_MASK 0x7f
#define CONTINUE_BIT 0x80

#define SMOL_IMAGE_SIZE_MULTIPLIER 16


extern u8 ALIGNED(4) gDecompressionBuffer[0x4000];

struct LZ77Header {
u32 lz77IdBits:5;
u32 padding:3;
u32 size:24;
};

struct SmolHeader {
u32 mode:5;
u32 imageSize:12;
u32 symSize:15;
u32 initialState:6;
u32 bitstreamSize:13;
u32 loSize:13;
};

union CompressionHeader {
struct LZ77Header lz77;
struct SmolHeader smol;
};

struct SpriteSheetHeader {
u32 mode:5;
u32 numComponents:11;
u32 framesPerComponent:16;
};

struct DecodeYK {
u8 yVal;
u8 kVal;
};

enum CompressionMode {
BASE_ONLY = 0,
ENCODE_SYMS = 1,
ENCODE_DELTA_SYMS = 2,
ENCODE_LO = 3,
ENCODE_BOTH = 4,
ENCODE_BOTH_DELTA_SYMS = 5,
IS_FRAME_CONTAINER = 6,
MODE_LZ77 = 16,
};

extern struct DecodeYK ykTemplate[2*TANS_TABLE_SIZE];

void UnpackFrequencies(const u32 *packedFreqs, u32 *freqs);

void DecompressDataVram(const u32 *src, void *dest);
void DecompressDataWram(const u32 *src, void *dest);

// For decompressing a single part of a multi-part spritesheet
//void DecompressSubFrame(const u32 *src, void *dest, u32 frameId);

void SmolDecompressData(const struct SmolHeader *header, const u32 *data, void *dest);

void BuildDecompressionTable(const u32 *freqs, struct DecodeYK *ykTable, u32 *symbolTable);

void DecodeLOtANS(const u32 *data, const u32 *pFreqs, u8 *resultVec, u32 count);

void DecodeSymtANS(const u32 *data, const u32 *pFreqs, u16 *resultVec, u32 count);

void DecodeSymDeltatANS(const u32 *data, const u32 *pFreqs, u16 *resultVec, u32 count);

void DecodeInstructions(u32 headerLoSize, u8 *loVec, u16 *symVec, void *dest);

bool32 isModeLoEncoded(enum CompressionMode mode);
bool32 isModeSymEncoded(enum CompressionMode mode);
bool32 isModeSymDelta(enum CompressionMode mode);

// Default Decompression functions are below here
void LZDecompressWram(const u32 *src, void *dest);
void LZDecompressVram(const u32 *src, void *dest);

Expand Down
1 change: 1 addition & 0 deletions include/global.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "gba/gba.h"
#include "fpmath.h"
#include "metaprogram.h"
#include "decompress.h"
#include "constants/global.h"
#include "constants/flags.h"
#include "constants/vars.h"
Expand Down
2 changes: 2 additions & 0 deletions include/sprite.h
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,8 @@ struct Sprite
u8 subspriteMode:2;

/*0x43*/ u8 subpriority;
//u16 prevFrame;
//const u32 *spriteArray;
};

struct OamMatrix
Expand Down
2 changes: 1 addition & 1 deletion make_tools.mk
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ MAKEFLAGS += --no-print-directory

# Inclusive list. If you don't want a tool to be built, don't add it here.
TOOLS_DIR := tools
TOOL_NAMES := aif2pcm bin2c gbafix gbagfx jsonproc mapjson mid2agb preproc ramscrgen rsfont scaninc trainerproc
TOOL_NAMES := aif2pcm bin2c gbafix gbagfx jsonproc mapjson mid2agb preproc ramscrgen rsfont scaninc trainerproc compresSmol
CHECK_TOOL_NAMES = patchelf mgba-rom-test-hydra

TOOLDIRS := $(TOOL_NAMES:%=$(TOOLS_DIR)/%)
Expand Down
36 changes: 18 additions & 18 deletions src/battle_transition.c
Original file line number Diff line number Diff line change
Expand Up @@ -1370,7 +1370,7 @@ static bool8 Aqua_Init(struct Task *task)
InitPatternWeaveTransition(task);
GetBg0TilesDst(&tilemap, &tileset);
CpuFill16(0, tilemap, BG_SCREEN_SIZE);
LZ77UnCompVram(sTeamAqua_Tileset, tileset);
LZDecompressVram(sTeamAqua_Tileset, tileset);
LoadPalette(sEvilTeam_Palette, BG_PLTT_ID(15), sizeof(sEvilTeam_Palette));

task->tState++;
Expand All @@ -1385,7 +1385,7 @@ static bool8 Magma_Init(struct Task *task)
InitPatternWeaveTransition(task);
GetBg0TilesDst(&tilemap, &tileset);
CpuFill16(0, tilemap, BG_SCREEN_SIZE);
LZ77UnCompVram(sTeamMagma_Tileset, tileset);
LZDecompressVram(sTeamMagma_Tileset, tileset);
LoadPalette(sEvilTeam_Palette, BG_PLTT_ID(15), sizeof(sEvilTeam_Palette));

task->tState++;
Expand Down Expand Up @@ -1445,7 +1445,7 @@ static bool8 Aqua_SetGfx(struct Task *task)
u16 *tilemap, *tileset;

GetBg0TilesDst(&tilemap, &tileset);
LZ77UnCompVram(sTeamAqua_Tilemap, tilemap);
LZDecompressVram(sTeamAqua_Tilemap, tilemap);
SetSinWave((s16*)gScanlineEffectRegBuffers[0], 0, task->tSinIndex, 132, task->tAmplitude, DISPLAY_HEIGHT);

task->tState++;
Expand All @@ -1457,7 +1457,7 @@ static bool8 Magma_SetGfx(struct Task *task)
u16 *tilemap, *tileset;

GetBg0TilesDst(&tilemap, &tileset);
LZ77UnCompVram(sTeamMagma_Tilemap, tilemap);
LZDecompressVram(sTeamMagma_Tilemap, tilemap);
SetSinWave((s16*)gScanlineEffectRegBuffers[0], 0, task->tSinIndex, 132, task->tAmplitude, DISPLAY_HEIGHT);

task->tState++;
Expand Down Expand Up @@ -1511,8 +1511,8 @@ static bool8 Kyogre_Init(struct Task *task)

GetBg0TilesDst(&tilemap, &tileset);
CpuFill16(0, tilemap, BG_SCREEN_SIZE);
LZ77UnCompVram(sKyogre_Tileset, tileset);
LZ77UnCompVram(sKyogre_Tilemap, tilemap);
LZDecompressVram(sKyogre_Tileset, tileset);
LZDecompressVram(sKyogre_Tilemap, tilemap);

task->tState++;
return FALSE;
Expand Down Expand Up @@ -3300,8 +3300,8 @@ static bool8 Groudon_Init(struct Task *task)

GetBg0TilesDst(&tilemap, &tileset);
CpuFill16(0, tilemap, BG_SCREEN_SIZE);
LZ77UnCompVram(sGroudon_Tileset, tileset);
LZ77UnCompVram(sGroudon_Tilemap, tilemap);
LZDecompressVram(sGroudon_Tileset, tileset);
LZDecompressVram(sGroudon_Tilemap, tilemap);

task->tState++;
task->tTimer = 0;
Expand Down Expand Up @@ -4165,7 +4165,7 @@ static bool8 FrontierLogoWiggle_Init(struct Task *task)
InitPatternWeaveTransition(task);
GetBg0TilesDst(&tilemap, &tileset);
CpuFill16(0, tilemap, BG_SCREEN_SIZE);
LZ77UnCompVram(sFrontierLogo_Tileset, tileset);
LZDecompressVram(sFrontierLogo_Tileset, tileset);
LoadPalette(sFrontierLogo_Palette, BG_PLTT_ID(15), sizeof(sFrontierLogo_Palette));

task->tState++;
Expand All @@ -4177,7 +4177,7 @@ static bool8 FrontierLogoWiggle_SetGfx(struct Task *task)
u16 *tilemap, *tileset;

GetBg0TilesDst(&tilemap, &tileset);
LZ77UnCompVram(sFrontierLogo_Tilemap, tilemap);
LZDecompressVram(sFrontierLogo_Tilemap, tilemap);
SetSinWave((s16*)gScanlineEffectRegBuffers[0], 0, task->tSinIndex, 132, task->tAmplitude, DISPLAY_HEIGHT);

task->tState++;
Expand Down Expand Up @@ -4227,7 +4227,7 @@ static bool8 FrontierLogoWave_Init(struct Task *task)
REG_BLDALPHA = sTransitionData->BLDALPHA;
GetBg0TilesDst(&tilemap, &tileset);
CpuFill16(0, tilemap, BG_SCREEN_SIZE);
LZ77UnCompVram(sFrontierLogo_Tileset, tileset);
LZDecompressVram(sFrontierLogo_Tileset, tileset);
LoadPalette(sFrontierLogo_Palette, BG_PLTT_ID(15), sizeof(sFrontierLogo_Palette));
sTransitionData->cameraY = 0;

Expand All @@ -4240,7 +4240,7 @@ static bool8 FrontierLogoWave_SetGfx(struct Task *task)
u16 *tilemap, *tileset;

GetBg0TilesDst(&tilemap, &tileset);
LZ77UnCompVram(sFrontierLogo_Tilemap, tilemap);
LZDecompressVram(sFrontierLogo_Tilemap, tilemap);

task->tState++;
return TRUE;
Expand Down Expand Up @@ -4372,7 +4372,7 @@ static bool8 FrontierSquares_Init(struct Task *task)
u16 *tilemap, *tileset;

GetBg0TilesDst(&tilemap, &tileset);
LZ77UnCompVram(sFrontierSquares_FilledBg_Tileset, tileset);
LZDecompressVram(sFrontierSquares_FilledBg_Tileset, tileset);

FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 32, 32);
FillBgTilemapBufferRect(0, 1, 0, 0, MARGIN_SIZE, 32, 15);
Expand Down Expand Up @@ -4430,13 +4430,13 @@ static bool8 FrontierSquares_Shrink(struct Task *task)
break;
case 1:
BlendPalettes(PALETTES_ALL & ~(1 << 15), 16, RGB_BLACK);
LZ77UnCompVram(sFrontierSquares_EmptyBg_Tileset, tileset);
LZDecompressVram(sFrontierSquares_EmptyBg_Tileset, tileset);
break;
case 2:
LZ77UnCompVram(sFrontierSquares_Shrink1_Tileset, tileset);
LZDecompressVram(sFrontierSquares_Shrink1_Tileset, tileset);
break;
case 3:
LZ77UnCompVram(sFrontierSquares_Shrink2_Tileset, tileset);
LZDecompressVram(sFrontierSquares_Shrink2_Tileset, tileset);
break;
default:
FillBgTilemapBufferRect_Palette0(0, 1, 0, 0, 32, 32);
Expand Down Expand Up @@ -4467,7 +4467,7 @@ static bool8 FrontierSquaresSpiral_Init(struct Task *task)
u16 *tilemap, *tileset;

GetBg0TilesDst(&tilemap, &tileset);
LZ77UnCompVram(sFrontierSquares_FilledBg_Tileset, tileset);
LZDecompressVram(sFrontierSquares_FilledBg_Tileset, tileset);

FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 32, 32);
FillBgTilemapBufferRect(0, 1, 0, 0, MARGIN_SIZE, 32, 15);
Expand Down Expand Up @@ -4585,7 +4585,7 @@ static bool8 FrontierSquaresScroll_Init(struct Task *task)
u16 *tilemap, *tileset;

GetBg0TilesDst(&tilemap, &tileset);
LZ77UnCompVram(sFrontierSquares_FilledBg_Tileset, tileset);
LZDecompressVram(sFrontierSquares_FilledBg_Tileset, tileset);
FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 32, 32);
CopyBgTilemapBufferToVram(0);
LoadPalette(sFrontierSquares_Palette, BG_PLTT_ID(15), sizeof(sFrontierSquares_Palette));
Expand Down
4 changes: 2 additions & 2 deletions src/battle_transition_frontier.c
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,8 @@ static void LoadLogoGfx(void)
u16 *tilemap, *tileset;

GetBg0TilesDst(&tilemap, &tileset);
LZ77UnCompVram(sLogoCenter_Gfx, tileset);
LZ77UnCompVram(sLogoCenter_Tilemap, tilemap);
LZDecompressVram(sLogoCenter_Gfx, tileset);
LZDecompressVram(sLogoCenter_Tilemap, tilemap);
LoadPalette(sLogo_Pal, BG_PLTT_ID(15), sizeof(sLogo_Pal));
LoadCompressedSpriteSheet(&sSpriteSheet_LogoCircles);
LoadSpritePalette(&sSpritePalette_LogoCircles);
Expand Down
2 changes: 1 addition & 1 deletion src/berry_crush.c
Original file line number Diff line number Diff line change
Expand Up @@ -1944,7 +1944,7 @@ static void CopyPlayerNameWindowGfxToBg(struct BerryCrushGame *game)
u8 i = 0;
u8 *windowGfx;

LZ77UnCompWram(gBerryCrush_TextWindows_Tilemap, gDecompressionBuffer);
LZDecompressWram(gBerryCrush_TextWindows_Tilemap, gDecompressionBuffer);

for (windowGfx = gDecompressionBuffer; i < game->playerCount; i++)
{
Expand Down
4 changes: 2 additions & 2 deletions src/berry_fix_graphics.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ static void UNUSED LoadBerryFixGraphics(u32 idx)
REG_BG0HOFS = 0;
REG_BG0VOFS = 0;
REG_BLDCNT = 0;
LZ77UnCompVram(sBerryFixGraphics[idx].gfx, (void *)BG_CHAR_ADDR(0));
LZ77UnCompVram(sBerryFixGraphics[idx].tilemap, (void *)BG_SCREEN_ADDR(31));
LZDecompressVram(sBerryFixGraphics[idx].gfx, (void *)BG_CHAR_ADDR(0));
LZDecompressVram(sBerryFixGraphics[idx].tilemap, (void *)BG_SCREEN_ADDR(31));
CpuCopy16(sBerryFixGraphics[idx].pltt, (void *)BG_PLTT, BG_PLTT_SIZE);
REG_BG0CNT = BGCNT_SCREENBASE(31);
REG_DISPCNT = DISPCNT_BG0_ON;
Expand Down
4 changes: 2 additions & 2 deletions src/berry_fix_program.c
Original file line number Diff line number Diff line change
Expand Up @@ -366,8 +366,8 @@ static void BerryFix_SetScene(int scene)
break;
}
CopyBgTilemapBufferToVram(0);
LZ77UnCompVram(sBerryFixGraphics[scene].gfx, (void *)BG_CHAR_ADDR(1));
LZ77UnCompVram(sBerryFixGraphics[scene].tilemap, (void *)BG_SCREEN_ADDR(31));
LZDecompressVram(sBerryFixGraphics[scene].gfx, (void *)BG_CHAR_ADDR(1));
LZDecompressVram(sBerryFixGraphics[scene].tilemap, (void *)BG_SCREEN_ADDR(31));
// 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));
Expand Down
2 changes: 1 addition & 1 deletion src/bg.c
Original file line number Diff line number Diff line change
Expand Up @@ -872,7 +872,7 @@ void CopyToBgTilemapBuffer(u32 bg, const void *src, u16 mode, u16 destOffset)
if (mode != 0)
CpuCopy16(src, (void *)(sGpuBgConfigs2[bg].tilemap + (destOffset * 2)), mode);
else
LZ77UnCompWram(src, (void *)(sGpuBgConfigs2[bg].tilemap + (destOffset * 2)));
LZDecompressWram(src, (void *)(sGpuBgConfigs2[bg].tilemap + (destOffset * 2)));
}
}

Expand Down
6 changes: 3 additions & 3 deletions src/credits.c
Original file line number Diff line number Diff line change
Expand Up @@ -548,8 +548,8 @@ static void Task_LoadShowMons(u8 taskId)
ResetAllPicSprites();
FreeAllSpritePalettes();
gReservedSpritePaletteCount = 8;
LZ77UnCompVram(gBirchBagGrass_Gfx, (void *)VRAM);
LZ77UnCompVram(gBirchGrassTilemap, (void *)(BG_SCREEN_ADDR(7)));
LZDecompressVram(gBirchBagGrass_Gfx, (void *)VRAM);
LZDecompressVram(gBirchGrassTilemap, (void *)(BG_SCREEN_ADDR(7)));
LoadPalette(gBirchBagGrass_Pal + 1, BG_PLTT_ID(0) + 1, PLTT_SIZEOF(2 * 16 - 1));

for (i = 0; i < MON_PIC_SIZE; i++)
Expand Down Expand Up @@ -1291,7 +1291,7 @@ static void LoadTheEndScreen(u16 tileOffsetLoad, u16 tileOffsetWrite, u16 palOff
u16 baseTile;
u16 i;

LZ77UnCompVram(sCreditsCopyrightEnd_Gfx, (void *)(VRAM + tileOffsetLoad));
LZDecompressVram(sCreditsCopyrightEnd_Gfx, (void *)(VRAM + tileOffsetLoad));
LoadPalette(gIntroCopyright_Pal, palOffset, sizeof(gIntroCopyright_Pal));

baseTile = (palOffset / 16) << 12;
Expand Down
Loading
Loading