#include <sramfile.hh>
Definition at line 168 of file sramfile.hh.
Public Member Functions | |
SRAMFile (const QString &filename) throw (InvalidSRAMFileException) | |
Creates a new SRAMFile. | |
bool | save (const QString &filename) |
Saves this SRAMFile back to disk. | |
bool | hasAlchemy (enum sf_alchemy alchemy) const |
Checks whether the boy knows a particular alchemy. | |
void | setAlchemy (enum sf_alchemy alchemy, bool have=true) |
Sets whether the boy knows a particular alchemy. | |
std::pair< int, int > | getAlchemyLevel (enum sf_alchemy alchemy) const |
Gets the alchemy level. | |
void | setAlchemyLevel (enum sf_alchemy alchemy, std::pair< int, int > level) |
Sets the alchemy level. | |
std::pair< int, int > | getAttackLevel () const |
Gets the dog's attack level. | |
void | setAttackLevel (std::pair< int, int > level) |
Sets the dog's attack level. | |
bool | hasCharm (enum sf_charm charm) const |
Checks whether the heros have a particular charm. | |
void | setCharm (enum sf_charm charm, bool have=true) |
Sets whether the heros have a particular charm. | |
quint16 | getCurrentHP (enum sf_hero hero) const |
Gets the current HP of one of the heros. | |
void | setCurrentHP (enum sf_hero hero, quint16 hp) |
Sets the current HP of one of the heros. | |
quint32 | getExperience (enum sf_hero hero) const |
Gets the experience of one of the heros. | |
void | setExperience (enum sf_hero hero, quint32 experience) |
Sets the experience of one of the heros. | |
int | getGame () const |
Gets the current game. | |
void | setGame (int game=0) |
Sets the current game. | |
int | getIngredient (enum sf_ingredient ingredient) const |
Gets the inventory count for a particular alchemy ingredient. | |
void | setIngredient (enum sf_ingredient ingredient, int count) |
Sets the inventory count for a particular alchemy ingredient. | |
int | getItem (enum sf_item item) const |
Gets the inventory count for a particular item. | |
void | setItem (enum sf_item item, int count) |
Sets the inventory count for a particular item. | |
int | getLevel (enum sf_hero hero) const |
Gets the level of one of the heros. | |
void | setLevel (enum sf_hero hero, int level) |
Sets the level of one of the heros. | |
quint16 | getMaxHP (enum sf_hero hero) const |
Gets the max HP of one of the heros. | |
void | setMaxHP (enum sf_hero hero, quint16 hp) |
Sets the max HP of one of the heros. | |
bool | isModified () const |
Checks whether this SRAMFile has been modified. | |
quint32 | getMoney (enum sf_money money) const |
Gets the money count. | |
void | setMoney (enum sf_money money, quint32 count) |
Sets the money count. | |
QString | getName (enum sf_hero hero) const |
Gets the name of one of the heros. | |
void | setName (enum sf_hero hero, const QString &name) |
Sets the name of one of the heros. | |
quint16 | getTradeGood (enum sf_tradegood tradegood) const |
Gets the inventory count for one of the trade goods. | |
void | setTradeGood (enum sf_tradegood tradegood, quint16 count) |
Sets the inventory count for one of the trade goods. | |
bool | hasWeapon (enum sf_weapon weapon) const |
Checks whether the boy has a particular weapon. | |
void | setWeapon (enum sf_weapon weapon, bool have=true) |
Sets whether the boy has a particular weapon. | |
std::pair< int, int > | getWeaponLevel (enum sf_weapon weapon) const |
Gets the weapon level for one of the weapons. | |
void | setWeaponLevel (enum sf_weapon weapon, std::pair< int, int > level) |
Sets the weapon level for one of the weapons. | |
bool | isValid (int game) const |
Checks if a save game is a valid save. | |
Private Member Functions | |
quint16 | checksum (int game) const |
Calculates the checksum for one of the save games. | |
quint16 | getChecksum (int game) const |
Gets the checksum value. | |
void | setChecksum (int game, quint16 checksum) |
Sets the game's checksum value. | |
Private Attributes | |
int | game |
unsigned char * | offset |
unsigned char | sram [SRAM_FILE_SIZE] |
bool | modified |
bool | valid [4] |
Static Private Attributes | |
static const std::pair< int, int > | SRAM_ALCHEMY_OFFSETS [] |
the alchemy have/have not offsets | |
static const std::pair< int, int > | SRAM_CHARM_OFFSETS [] |
the charm have/have not offsets | |
static const std::pair< int, int > | SRAM_WEAPON_OFFSETS [] |
the weapon have/have not offsets |
SRAMFile::SRAMFile | ( | const QString & | filename | ) | throw (InvalidSRAMFileException) |
Creates a new SRAMFile.
filename | The SRAM file to load. |
InvalidSRAMFileException | if the file is not a valid Secret of Evermore SRAM file. |
Definition at line 117 of file sramfile.cc.
quint16 SRAMFile::checksum | ( | int | game | ) | const [private] |
Calculates the checksum for one of the save games.
game | The game to calculate the checksum for. |
Definition at line 151 of file sramfile.cc.
std::pair< int, int > SRAMFile::getAlchemyLevel | ( | enum sf_alchemy | alchemy | ) | const |
Gets the alchemy level.
alchemy | The alchemy. |
Definition at line 218 of file sramfile.cc.
std::pair< int, int > SRAMFile::getAttackLevel | ( | ) | const |
Gets the dog's attack level.
Definition at line 238 of file sramfile.cc.
quint16 SRAMFile::getChecksum | ( | int | game | ) | const [private] |
Gets the checksum value.
game | The game to get the checksum for. |
Definition at line 278 of file sramfile.cc.
quint16 SRAMFile::getCurrentHP | ( | enum sf_hero | hero | ) | const |
Gets the current HP of one of the heros.
hero | Which hero's current HP to get. |
Definition at line 295 of file sramfile.cc.
quint32 SRAMFile::getExperience | ( | enum sf_hero | hero | ) | const |
Gets the experience of one of the heros.
hero | Which hero's experience to get. |
Definition at line 320 of file sramfile.cc.
int soesrame::SRAMFile::getGame | ( | ) | const [inline] |
int SRAMFile::getIngredient | ( | enum sf_ingredient | ingredient | ) | const |
Gets the inventory count for a particular alchemy ingredient.
ingredient | The ingredient. |
Definition at line 354 of file sramfile.cc.
int SRAMFile::getItem | ( | enum sf_item | item | ) | const |
Gets the inventory count for a particular item.
item | The item. |
Definition at line 368 of file sramfile.cc.
int SRAMFile::getLevel | ( | enum sf_hero | hero | ) | const |
Gets the level of one of the heros.
hero | Which hero's level to get. |
Definition at line 382 of file sramfile.cc.
quint16 SRAMFile::getMaxHP | ( | enum sf_hero | hero | ) | const |
Gets the max HP of one of the heros.
hero | Which hero's max HP to get. |
Definition at line 400 of file sramfile.cc.
quint32 SRAMFile::getMoney | ( | enum sf_money | money | ) | const |
Gets the money count.
money | The money type. |
Definition at line 425 of file sramfile.cc.
QString SRAMFile::getName | ( | enum sf_hero | hero | ) | const |
Gets the name of one of the heros.
hero | Which hero's name to get. |
Definition at line 448 of file sramfile.cc.
quint16 SRAMFile::getTradeGood | ( | enum sf_tradegood | tradegood | ) | const |
Gets the inventory count for one of the trade goods.
tradegood | The trade good. |
Definition at line 473 of file sramfile.cc.
std::pair< int, int > SRAMFile::getWeaponLevel | ( | enum sf_weapon | weapon | ) | const |
Gets the weapon level for one of the weapons.
weapon | The weapon. |
Definition at line 514 of file sramfile.cc.
bool SRAMFile::hasAlchemy | ( | enum sf_alchemy | alchemy | ) | const |
Checks whether the boy knows a particular alchemy.
alchemy | The alchemy to check for. |
Definition at line 197 of file sramfile.cc.
bool SRAMFile::hasCharm | ( | enum sf_charm | charm | ) | const |
Checks whether the heros have a particular charm.
charm | The charm to check for. |
Definition at line 257 of file sramfile.cc.
bool SRAMFile::hasWeapon | ( | enum sf_weapon | weapon | ) | const |
Checks whether the boy has a particular weapon.
weapon | The weapon to check for. |
Definition at line 493 of file sramfile.cc.
bool soesrame::SRAMFile::isModified | ( | ) | const [inline] |
Checks whether this SRAMFile has been modified.
Definition at line 517 of file sramfile.hh.
bool soesrame::SRAMFile::isValid | ( | int | game | ) | const [inline] |
Checks if a save game is a valid save.
game | The game to check (0-3). |
Definition at line 520 of file sramfile.hh.
bool SRAMFile::save | ( | const QString & | filename | ) |
Saves this SRAMFile back to disk.
filename | The filename to save to. |
Definition at line 171 of file sramfile.cc.
void SRAMFile::setAlchemy | ( | enum sf_alchemy | alchemy, | |
bool | have = true | |||
) |
Sets whether the boy knows a particular alchemy.
alchemy | The alchemy to set. | |
have | true to give; false to take away. |
Definition at line 204 of file sramfile.cc.
void SRAMFile::setAlchemyLevel | ( | enum sf_alchemy | alchemy, | |
std::pair< int, int > | level | |||
) |
Sets the alchemy level.
alchemy | The alchemy. | |
level | The new level. |
Definition at line 226 of file sramfile.cc.
void SRAMFile::setAttackLevel | ( | std::pair< int, int > | level | ) |
Sets the dog's attack level.
level | The new level. |
Definition at line 246 of file sramfile.cc.
void SRAMFile::setCharm | ( | enum sf_charm | charm, | |
bool | have = true | |||
) |
Sets whether the heros have a particular charm.
charm | The charm to set. | |
have | true to give; false to take away. |
Definition at line 264 of file sramfile.cc.
void SRAMFile::setChecksum | ( | int | game, | |
quint16 | checksum | |||
) | [private] |
Sets the game's checksum value.
game | The game to set the checksum for. | |
checksum | The new checksum. |
Definition at line 287 of file sramfile.cc.
void SRAMFile::setCurrentHP | ( | enum sf_hero | hero, | |
quint16 | hp | |||
) |
Sets the current HP of one of the heros.
hero | Which hero to set. | |
hp | The new current HP. |
Definition at line 307 of file sramfile.cc.
void SRAMFile::setExperience | ( | enum sf_hero | hero, | |
quint32 | experience | |||
) |
Sets the experience of one of the heros.
hero | Which hero to set. | |
experience | The new experience. |
Definition at line 332 of file sramfile.cc.
void SRAMFile::setGame | ( | int | game = 0 |
) |
void SRAMFile::setIngredient | ( | enum sf_ingredient | ingredient, | |
int | count | |||
) |
Sets the inventory count for a particular alchemy ingredient.
ingredient | The ingredient. | |
count | The new inventory count. |
Definition at line 360 of file sramfile.cc.
void SRAMFile::setItem | ( | enum sf_item | item, | |
int | count | |||
) |
Sets the inventory count for a particular item.
item | The item. | |
count | The new inventory count. |
Definition at line 374 of file sramfile.cc.
void SRAMFile::setLevel | ( | enum sf_hero | hero, | |
int | level | |||
) |
Sets the level of one of the heros.
hero | Which hero's level to set. | |
level | The new level. |
Definition at line 390 of file sramfile.cc.
void SRAMFile::setMaxHP | ( | enum sf_hero | hero, | |
quint16 | hp | |||
) |
Sets the max HP of one of the heros.
hero | Which heros' max HP to set. | |
hp | The new max HP. |
Definition at line 412 of file sramfile.cc.
void SRAMFile::setMoney | ( | enum sf_money | money, | |
quint32 | count | |||
) |
Sets the money count.
money | The money type. | |
count | The new money count. |
Definition at line 435 of file sramfile.cc.
void SRAMFile::setName | ( | enum sf_hero | hero, | |
const QString & | name | |||
) |
Sets the name of one of the heros.
hero | Which hero's name to set. | |
name | The new name. |
Definition at line 460 of file sramfile.cc.
void SRAMFile::setTradeGood | ( | enum sf_tradegood | tradegood, | |
quint16 | count | |||
) |
Sets the inventory count for one of the trade goods.
tradegood | The trade good. | |
count | The new inventory count. |
Definition at line 482 of file sramfile.cc.
void SRAMFile::setWeapon | ( | enum sf_weapon | weapon, | |
bool | have = true | |||
) |
Sets whether the boy has a particular weapon.
weapon | The weapon to set. | |
have | true to give; false to take away. |
Definition at line 500 of file sramfile.cc.
void SRAMFile::setWeaponLevel | ( | enum sf_weapon | weapon, | |
std::pair< int, int > | level | |||
) |
Sets the weapon level for one of the weapons.
weapon | The weapon. | |
level | The new level. |
Definition at line 524 of file sramfile.cc.
int soesrame::SRAMFile::game [private] |
Definition at line 170 of file sramfile.hh.
bool soesrame::SRAMFile::modified [private] |
Definition at line 173 of file sramfile.hh.
unsigned char* soesrame::SRAMFile::offset [private] |
Definition at line 171 of file sramfile.hh.
unsigned char soesrame::SRAMFile::sram[SRAM_FILE_SIZE] [private] |
Definition at line 172 of file sramfile.hh.
const std::pair< int, int > SRAMFile::SRAM_ALCHEMY_OFFSETS [static, private] |
const std::pair< int, int > SRAMFile::SRAM_CHARM_OFFSETS [static, private] |
Initial value:
{ std::pair<int, int>(0x200, 0x20), std::pair<int, int>(0x200, 0x40), std::pair<int, int>(0x200, 0x80), std::pair<int, int>(0x201, 0x01), std::pair<int, int>(0x201, 0x02), std::pair<int, int>(0x201, 0x04), std::pair<int, int>(0x201, 0x08), std::pair<int, int>(0x201, 0x10), std::pair<int, int>(0x201, 0x20), std::pair<int, int>(0x201, 0x40), std::pair<int, int>(0x201, 0x80), std::pair<int, int>(0x202, 0x01), std::pair<int, int>(0x202, 0x02), std::pair<int, int>(0x202, 0x04) }
Definition at line 179 of file sramfile.hh.
const std::pair< int, int > SRAMFile::SRAM_WEAPON_OFFSETS [static, private] |
Initial value:
{ std::pair<int, int>(0x279, 0x02), std::pair<int, int>(0x279, 0x04), std::pair<int, int>(0x279, 0x08), std::pair<int, int>(0x279, 0x10), std::pair<int, int>(0x279, 0x20), std::pair<int, int>(0x279, 0x40), std::pair<int, int>(0x279, 0x80), std::pair<int, int>(0x27A, 0x01), std::pair<int, int>(0x27A, 0x02), std::pair<int, int>(0x27A, 0x04), std::pair<int, int>(0x27A, 0x08), std::pair<int, int>(0x27A, 0x10), std::pair<int, int>(0x27A, 0x20) }
Definition at line 182 of file sramfile.hh.
bool soesrame::SRAMFile::valid[4] [private] |
Definition at line 173 of file sramfile.hh.