mirror of
https://github.com/GearsProgress/Poke_Transporter_GB.git
synced 2026-03-21 17:34:42 -05:00
libsysbase_libsysbase_a-handle_manager.o So, I optimized the MOVESETS table to only store the "overriding" bits in the movesets of the evolutions in relation to their base forms. That only improved compression slightly (about 300 bytes) I also eliminated 4 KB of IWRAM usage by libsysbase_libsysbase_a-handle_manager.o because of the "handles" buffer. We're not using it and we REALLY need our IWRAM. (and it also reduces the rom size with 4KB too!)
32 lines
1.3 KiB
C
32 lines
1.3 KiB
C
#ifndef _OPTIMIZE_MOVESETS_H
|
|
#define _OPTIMIZE_MOVESETS_H
|
|
|
|
#include "pokemon_data.h"
|
|
|
|
typedef struct optimize_moveset_result
|
|
{
|
|
u16 num_unique_rows;
|
|
u16 num_bytes;
|
|
} optimize_moveset_result;
|
|
|
|
/**
|
|
* input_buffer has 32 bytes for each pokémon. The first row is index 0, which doesn't actually represent a pokémon
|
|
* because the pokémon species index is 1-based.
|
|
*
|
|
* Anyway, the 32 bytes of the input_data have 1 bit for every available gen I/II move
|
|
*
|
|
* But we want to optimize it better for compression. For instance, there's a lot of overlap between the bits of evolutions vs base forms.
|
|
* So, as optimization, we could clear every move bit of an evolution that is also set for its base form.
|
|
*
|
|
* This way we can make the evolutions' moveset data a lot of zeros. That will compress better.
|
|
*
|
|
* But another optimization we can do is to deduplicate the resulting table and only store the unique rows.
|
|
*
|
|
* TL;DR: this function will turn the original MOVESETS table into this format:
|
|
*
|
|
* First 252 bytes: this chunk will associate a row index to every pokemon based on (species index - 1)
|
|
* Next bytes: rows of 32 bytes each for which every bit of these 32 bytes associates with a gen 1/2 move.
|
|
*/
|
|
optimize_moveset_result optimize_movesets(u8 *output_buffer, const u8 *input_buffer, u16 input_buffer_size);
|
|
|
|
#endif |