libSPEC
Pokemon Save Editing Library
|
Contains the structures and functions for editing GBA pokemon save games. More...
#include <stdlib.h>
#include <stdint.h>
Data Structures | |
struct | gba_save_t |
A structure used for handling gba save types. More... | |
struct | pk3_marking_t |
The pokemon's markings that you see in the party or box. Used for searching. More... | |
struct | pk3_effort_t |
The pokemon's effort values. More... | |
struct | pk3_contest_t |
The pokemon's contest stats. More... | |
struct | pk3_pokerus_t |
The pokemon's pokerus infection/strain. More... | |
struct | pk3_pp_up_t |
The ppup of each move of the pokemon. More... | |
struct | pk3_genes_t |
The pokemon's individual values. It's unchangable genes. More... | |
struct | pk3_ribbon_t |
The pokemon's ribbon data. More... | |
struct | pk3_box_t |
A GBA pokemon's box data. 80 bytes in size. More... | |
struct | pk3_stats_t |
struct | pk3_status_t |
struct | pk3_party_t |
struct | pk3_t |
A GBA pokemon's box and party data. 100 bytes in size. More... | |
struct | gba_party_t |
GBA Party Structure. More... | |
struct | gba_pc_box_t |
GBA PC Box Structure. More... | |
struct | gba_pc_t |
GBA PC Pokemon Storage Structure. More... | |
struct | gba_item_slot_t |
GBA Item Slot Structure. More... | |
struct | gba_rs_storage_t |
Ruby/Sapphire Item Storage. More... | |
union | gba_e_storage_t |
Emerald Item Storage. More... | |
union | gba_frlg_storage_t |
Fire Red/Leaf Green Item Storage. More... | |
struct | gba_storage_t |
struct | gba_time_t |
GBA Time Played Structure. More... | |
struct | gba_trainer_t |
GBA Trainer Data Structure. More... | |
Enumerations | |
enum | gba_savetype_t { GBA_TYPE_UNKNOWN, GBA_TYPE_RS, GBA_TYPE_E, GBA_TYPE_FRLG } |
Enum containing the different gba game types. More... | |
enum | { GBA_SAVE_SIZE = 0x20000, GBA_UNPACKED_SIZE = 0xD900 } |
enum | { PK3_BLOCK_SIZE = 0xC, PK3_BOX_SIZE = 0x50, PK3_PARTY_SIZE = 0x64, PK3_NICKNAME_LENGTH = 10, PK3_OT_NAME_LENGTH = 7 } |
Defines constants related to the GBA pokemon structure. More... | |
enum | { GBA_BOX_COUNT = 14, GBA_POKEMON_IN_BOX = 30, GBA_BOX_NAME_LENGTH = 9 } |
Defines constants related to GBA pokemon storage. More... | |
enum | { GBA_RS_ITEM_COUNT = 216, GBA_E_ITEM_COUNT = 236, GBA_FRLG_ITEM_COUNT = 216 } |
Functions | |
void | gba_text_to_ucs2 (char16_t *dst, char8_t *src, size_t size) |
Converts GBA encoded text into UCS2 encoded text. More... | |
void | ucs2_to_gba_text (char8_t *dst, char16_t *src, size_t size) |
Converts UCS2 encoded text into GBA encoded text. More... | |
gba_save_t * | gba_read_main_save (const uint8_t *) |
Reads the main save from the given save pointer. More... | |
gba_save_t * | gba_read_backup_save (const uint8_t *) |
Reads the backup save from the given save pointer. More... | |
void | gba_write_main_save (uint8_t *, const gba_save_t *) |
Writes the save to the main slot of the given dst file. More... | |
void | gba_write_backup_save (uint8_t *, const gba_save_t *) |
Writes the save to the backup slot of the given dst file. More... | |
void | gba_save_game (uint8_t *, gba_save_t *) |
Writes the save to the dst similar to how the game would do it. More... | |
void | gba_free_save (gba_save_t *) |
Frees the gba save made for the user. More... | |
uint8_t * | gba_create_data () |
Creates a data block of exactly GBA_SAVE_SIZE bytes in size, for loading save data into. You should free this data with free(). More... | |
void | pk3_decrypt (pk3_box_t *) |
Decrypts the given PK3 structure. More... | |
void | pk3_encrypt (pk3_box_t *) |
Encrypts the given PK3 structure. More... | |
gba_storage_t * | gba_get_storage (gba_save_t *) |
gba_trainer_t * | gba_get_trainer (gba_save_t *) |
Calculates the pointer to the saves trainer data. More... | |
gba_party_t * | gba_get_party (gba_save_t *) |
Calculates the pointer to the saves party data. More... | |
gba_pc_t * | gba_get_pc (gba_save_t *) |
Calculates the pointer to the saves pc data. More... | |
bool | gba_pokedex_get_national (gba_save_t *) |
Determines the national pokedex is owned. More... | |
void | gba_pokedex_set_national (gba_save_t *, bool) |
Sets if the national pokedex is owned. More... | |
bool | gba_pokedex_get_owned (gba_save_t *, size_t) |
Determines if the given pokemon is owned. More... | |
void | gba_pokedex_set_owned (gba_save_t *, size_t, bool) |
bool | gba_pokedex_get_seen (gba_save_t *, size_t) |
Determines if the given pokemon has been seen. More... | |
void | gba_pokedex_set_seen (gba_save_t *, size_t, bool) |
Sets if the given pokemon is seen. More... | |
Contains the structures and functions for editing GBA pokemon save games.
The GBA games, Generation 3 games. These games include Ruby, Sapphire, Emerald, Fire Red and Leaf Green.
enum gba_savetype_t |
anonymous enum |
anonymous enum |
Defines constants related to the GBA pokemon structure.
Enumerator | |
---|---|
PK3_BLOCK_SIZE |
The size of an individual block in the pokemon structure. |
PK3_BOX_SIZE |
The size of the pk3_box_t structure, the box storage structure. |
PK3_PARTY_SIZE |
The size of the pk3_t structure, the party storage structure. |
PK3_NICKNAME_LENGTH |
The length of a pokemons nickname. |
PK3_OT_NAME_LENGTH |
The length of a pokemon's original trainers name. |
anonymous enum |
Converts GBA encoded text into UCS2 encoded text.
dst | Pointer to destination. |
src | Pointer to source. |
size | Number of bytes to convert. |
Converts UCS2 encoded text into GBA encoded text.
dst | Pointer to destination. |
src | Pointer to source. |
size | Number of bytes to convert. |
gba_save_t* gba_read_main_save | ( | const uint8_t * | ptr | ) |
Reads the main save from the given save pointer.
ptr | The pointer to read from. |
gba_save_t* gba_read_backup_save | ( | const uint8_t * | ptr | ) |
Reads the backup save from the given save pointer.
ptr | The pointer to read from. |
void gba_write_main_save | ( | uint8_t * | dst, |
const gba_save_t * | save | ||
) |
Writes the save to the main slot of the given dst file.
dst | The pointer to the destination data block. Which should be at least GBA_SAVE_SIZE bytes long. |
save | The save to write to the main save area. |
void gba_write_backup_save | ( | uint8_t * | dst, |
const gba_save_t * | save | ||
) |
Writes the save to the backup slot of the given dst file.
dst | The pointer to the destination data block. Which should be at least GBA_SAVE_SIZE bytes long. |
save | The save to write to the backup save area. |
void gba_save_game | ( | uint8_t * | dst, |
gba_save_t * | save | ||
) |
Writes the save to the dst similar to how the game would do it.
dst | The pointer to the destination data block. Which should be at least GBA_SAVE_SIZE bytes long. |
save | save to save to data |
void gba_free_save | ( | gba_save_t * | save | ) |
Frees the gba save made for the user.
save | The pointer to the save to free. |
uint8_t* gba_create_data | ( | ) |
Creates a data block of exactly GBA_SAVE_SIZE bytes in size, for loading save data into. You should free this data with free().
void pk3_decrypt | ( | pk3_box_t * | pk3 | ) |
Decrypts the given PK3 structure.
pkm | The PK3 to be decrypted. |
void pk3_encrypt | ( | pk3_box_t * | pk3 | ) |
Encrypts the given PK3 structure.
pk3 | The PK3 to be encrypted. |
gba_trainer_t* gba_get_trainer | ( | gba_save_t * | save | ) |
Calculates the pointer to the saves trainer data.
save | The save to get the trainer data of. |
gba_party_t* gba_get_party | ( | gba_save_t * | save | ) |
Calculates the pointer to the saves party data.
save | The save to get the party data of. |
gba_pc_t* gba_get_pc | ( | gba_save_t * | save | ) |
Calculates the pointer to the saves pc data.
save | The save to get the pc data of. |
bool gba_pokedex_get_national | ( | gba_save_t * | save | ) |
Determines the national pokedex is owned.
save | The save to check. |
void gba_pokedex_set_national | ( | gba_save_t * | save, |
bool | has | ||
) |
Sets if the national pokedex is owned.
save | The save to set. |
has | true to set it, false to remove it. |
bool gba_pokedex_get_owned | ( | gba_save_t * | save, |
size_t | index | ||
) |
Determines if the given pokemon is owned.
save | The save to check. |
index | The pokemons national index number (starting from 0) |
void gba_pokedex_set_owned | ( | gba_save_t * | save, |
size_t | index, | ||
bool | owned | ||
) |
Sets if the given pokemon is owned.
save | The save to set. |
index | The pokemons national index number (starting from 0) |
owned | true to set it, false to remove it. |
bool gba_pokedex_get_seen | ( | gba_save_t * | save, |
size_t | index | ||
) |
Determines if the given pokemon has been seen.
save | The save to check. |
index | The pokemons national index number (starting from 0) |
void gba_pokedex_set_seen | ( | gba_save_t * | save, |
size_t | index, | ||
bool | seen | ||
) |
Sets if the given pokemon is seen.
save | The save to set. |
index | The pokemons national index number (starting from 0) |
owned | true to set it, false to remove it. |