-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Remove gDecompressionBuffer #6029
base: upcoming
Are you sure you want to change the base?
Conversation
…expansion into decompression_buffer
It is done.
Because GF abused the buffer, this PR affects pretty much every area of the game(though some are more affected than others), so a full playthrough would be advised before merging. |
Trading: Works. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haven't had time to look through it properly.
Some initial things.
void LoadCompressedSpriteSheetOverrideBuffer(const struct CompressedSpriteSheet *src, void *buffer); | ||
u32 LoadCompressedSpriteSheet(const struct CompressedSpriteSheet *src); | ||
u32 LoadCompressedSpriteSheetByTemplate(const struct SpriteTemplate *template, s32 offset); | ||
u32 LoadCompressedSpriteSheetOverrideBuffer(const struct CompressedSpriteSheet *src, void *buffer); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does this return an u32
?
The single call to this function doesn't store the result, and the final function called in the chain return an u16
@@ -255,10 +255,14 @@ static void CB2_MysteryEventMenu(void) | |||
case 11: | |||
if (gReceivedRemoteLinkPlayers == 0) | |||
{ | |||
// No clue what is going on here, and from where gDecompressionBuffer gets actually populated with mystery event script. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there even a way to test mystery gifts?
data->status = 0; | ||
data->unusedBuffer = AllocZeroed(CLIENT_MAX_MSG_SIZE); | ||
data->buffer = AllocZeroed(0x2000); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should it be a #define
d value here that's more explanatory than 0x2000
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should allocations with 0xXXXX
sizes have #define
d sizes instead?
@@ -1612,6 +1628,9 @@ static void PrintPlayerNames(void) | |||
} | |||
} | |||
|
|||
// This is a small little addition, that basically speeds up the animation where all players' berries are thrown into the blender. Self-explanatory I hope! | |||
#define BERRY_BLENDER_THROW_ALL_BERRIES_AT_ONCE TRUE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd say that this should be moved to a config file, probably include/config/overworld.h
.
|
||
u32 LoadCompressedSpriteSheetOverrideBuffer(const struct CompressedSpriteSheet *src, void *buffer) | ||
{ | ||
LZ77UnCompWram(src->data, buffer); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Purely a personal thing, but I would prefer that no new uses of the bios LZ77 decompression functions are introduced, all calls should go through the wrapper functions (LZDecompressWram in this case).
{ | ||
buffer[(sBlockRecv[i].pos / 2) + j] = gRecvCmds[i][j + 1]; | ||
} | ||
// Too large block was sent. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this case is empty shouldn't the if
statement be switched and the empty case be removed?
@@ -686,8 +685,8 @@ static void LoadLeftHeaderGfxForMenu(u32 menuGfxId) | |||
tag = sMenuLeftHeaderSpriteSheets[menuGfxId].tag; | |||
size = GetDecompressedDataSize(sMenuLeftHeaderSpriteSheets[menuGfxId].data); | |||
LoadPalette(&gPokenavLeftHeader_Pal[tag * 16], OBJ_PLTT_ID(IndexOfSpritePaletteTag(1)), PLTT_SIZE_4BPP); | |||
LZ77UnCompWram(sMenuLeftHeaderSpriteSheets[menuGfxId].data, gDecompressionBuffer); | |||
RequestDma3Copy(gDecompressionBuffer, (void *)OBJ_VRAM0 + (GetSpriteTileStartByTag(2) * 32), size, 1); | |||
LZ77UnCompWram(sMenuLeftHeaderSpriteSheets[menuGfxId].data, menu->leftHeaderMenuBuffer); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer wrapper function over bios call
tag = sPokenavSubMenuLeftHeaderSpriteSheets[menuGfxId].tag; | ||
size = GetDecompressedDataSize(sPokenavSubMenuLeftHeaderSpriteSheets[menuGfxId].data); | ||
LoadPalette(&gPokenavLeftHeader_Pal[tag * 16], OBJ_PLTT_ID(IndexOfSpritePaletteTag(2)), PLTT_SIZE_4BPP); | ||
LZ77UnCompWram(sPokenavSubMenuLeftHeaderSpriteSheets[menuGfxId].data, &gDecompressionBuffer[0x1000]); | ||
RequestDma3Copy(&gDecompressionBuffer[0x1000], (void *)OBJ_VRAM0 + 0x800 + (GetSpriteTileStartByTag(2) * 32), size, 1); | ||
LZ77UnCompWram(sPokenavSubMenuLeftHeaderSpriteSheets[menuGfxId].data, menu->leftHeaderSubMenuBuffer); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer wrapper function over bios call
If someone's already started working on it, or would like to do it - let me know and I'll cancel the PR.
If not, I'll continue working on it.