Main Page   Modules   Data Structures   File List   Globals  

msh_sram.h File Reference

SaveRAM functions used for savegames. More...


Functions

void save_to_sram (void *data, u8 slot, u16 size, u16 offset)
u8 sram_exists (char save_id[], u8 id_len, u8 slot, u16 size, u16 offset)
void load_from_sram (void *data, u8 slot, u16 size, u16 offset)
void erase_sram (u16 num_erasebytes, u8 slot, u16 size, u16 offset)


Detailed Description


Function Documentation

void save_to_sram void *    data,
u8    slot,
u16    size,
u16    offset
 

Parameters:
data  Data to save
slot  Slot Number
size  Size of slot in bytes
offset  Offset in bytes
Copies data to a save slot in SRAM. You can specify an offset if you put other data such as game options at the start of SaveRAM.

The data being copied must be the same size as specified in size.

u8 sram_exists char    save_id[],
u8    id_len,
u8    slot,
u16    size,
u16    offset
 

Parameters:
save_id  SaveID
id_len  Length of SaveID in bytes
slot  Slot Number
size  Size of slot in bytes
offset  Offset in bytes
Returns TRUE if save_id is found in the specified slot. This means the savegame should exist there as well. This should be used before attempting to use load_from_sram().

void load_from_sram void *    data,
u8    slot,
u16    size,
u16    offset
 

Parameters:
data  Data Destination
slot  Slot Number
size  Size of slot in bytes
offset  Offset in bytes
Loads data from SRAM into data. Use sram_exists() first to check if the data actually exists.

void erase_sram u16    num_erasebytes,
u8    slot,
u16    size,
u16    offset
 

Parameters:
num_erasebytes  Number of bytes to erase
slot  Slot Number
size  Size of slot in bytes
offset  Offset in bytes
Erases num_erasebytes of SRAM. The bytes are set to zero. You only need to erase the save_id portion of a savegame, as that is the only part used to check if it exists when using sram_exists(). However, you can erase any ammount of SRAM you like.


Generated on Wed May 19 21:45:09 2004 for Mushroom GBALib by doxygen 1.2.18