Type EepromBlockStruct

From Uzebox Wiki
Jump to: navigation, search

EepromBlockStruct represents a Uzebox Eeprom data block that can be used in conjunction with EepromReadBlock and EepromWriteBlock for preservation of data between Uzebox resets.

struct EepromBlockStruct {
    unsigned int id;         // Unique block id. 0xffff if block is free (assuming formatted eeprom)
    unsigned char data[30];  // Application specific data (cast to your own types)
};

Example:

u32 LoadHighScore(void) {
    struct EepromBlockStruct ebs;

    ebs.id = 99;

    if (!isEepromFormatted() || EepromReadBlock(99, &ebs))
        return;
    u32 hiScore = 0;

    for (u8 i = 0; i < 4; i++)
        hiScore |= ((u32)(ebs.data[i]))<<(24-(i<<3));
    return hiScore
}
  • Video Modes: All