Replace ZX0 by the builtin LZ10 compression.

LZ10 decompression is builtin to the GBA's bios, so we don't need ZX0. It's also significantly faster
(618 usec instead of 2311 usec in my personal benchmark code for decompression of the same data)

And it seems like by doing so, we saved 1 KB as well!

So, seems like replacing ZX0 is the right move.

The reason I didn't initially is because I misunderstood the documentation. I assumed LZ77UnCompWram could only uncompress into EWRAM, not IWRAM.
But it turns out it can do both.

And using standardized tools is usually better than using a custom implementation.

The only downside of this right now, is that we can no longer stream text tables through a smaller buffer than the entire decompressed size.

Anyway, things seem to work fine, so bye bye ZX0. It's been fun.
This commit is contained in:
Philippe Symons
2025-07-18 16:19:34 +02:00
parent 31c72b5390
commit 47cd143de6
18 changed files with 151 additions and 1115 deletions

View File

@@ -30,11 +30,10 @@ bool text_exit;
// attribute noinline was used to make sure the compiler doesn't inline this code back into text_loop()
static __attribute__((noinline)) const u8* read_dialogue_text_entry(uint8_t index, u8 *output_buffer)
{
u8 text_decompression_buffer[3072];
u8 index_buffer[100];
u8 text_decompression_buffer[6144];
const u8 *text_entry;
streamed_text_data_table dialogue_table(text_decompression_buffer, sizeof(text_decompression_buffer), index_buffer);
text_data_table dialogue_table(text_decompression_buffer);
dialogue_table.decompress(get_compressed_PTGB_table());