Fix not enough memory being allocated when moves load background in contests (#8284)

This commit is contained in:
FosterProgramming 2025-11-18 17:50:15 +01:00 committed by GitHub
parent 0999ca8ff9
commit 9b16204705
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -13,6 +13,7 @@
#include "graphics.h"
#include "main.h"
#include "malloc.h"
#include "menu.h"
#include "m4a.h"
#include "palette.h"
#include "pokemon.h"
@ -1568,10 +1569,7 @@ void LoadMoveBg(u16 bgId)
{
if (IsContest())
{
void *decompressionBuffer = Alloc(0x800);
const u32 *tilemap = gBattleAnimBackgroundTable[bgId].tilemap;
DecompressDataWithHeaderWram(tilemap, decompressionBuffer);
void *decompressionBuffer = malloc_and_decompress(gBattleAnimBackgroundTable[bgId].tilemap, NULL);
RelocateBattleBgPal(GetBattleBgPaletteNum(), decompressionBuffer, 0x100, FALSE);
DmaCopy32(3, decompressionBuffer, (void *)BG_SCREEN_ADDR(26), 0x800);
DecompressDataWithHeaderVram(gBattleAnimBackgroundTable[bgId].image, (void *)BG_SCREEN_ADDR(4));