#include <sramfile.hh>
Definition at line 125 of file sramfile.hh.
Public Member Functions | |
SRAMFile (const wxString &filename) throw (InvalidSRAMFileException) | |
Creates a new SRAMFile. | |
bool | save (const wxString &filename) |
Saves this SRAMfile back to disk. | |
enum dw_armor | getArmor () const |
Gets the hero's armor. | |
void | setArmor (enum dw_armor armor) |
Sets the hero's armor. | |
wxUint16 | getExperience () const |
Gets the hero's experience. | |
void | setExperience (wxUint16 experience) |
Sets the hero's experience. | |
int | getGame () const |
Gets the current game. | |
void | setGame (int game) |
Sets the game currently being edited. | |
wxUint16 | getGold () const |
Gets the hero's gold. | |
void | setGold (wxUint16 gold) |
Sets the hero's gold. | |
int | getHerbs () const |
Gets the hero's herbs. | |
void | setHerbs (int herbs) |
Sets the hero's herbs. | |
unsigned int | getHP () const |
Gets the hero's current HP. | |
void | setHP (unsigned int hp) |
Sets the hero's current HP. | |
enum dw_item | getItem (int number) const |
Gets one of the hero's items. | |
void | setItem (dw_item item, int number) |
Sets one of the hero's items. | |
int | getKeys () const |
Gets the hero's keys. | |
void | setKeys (int keys) |
Sets the hero's keys. | |
bool | isModified () const |
Checks whether this SRAMFile has been modified or not. | |
unsigned int | getMP () const |
Gets the hero's current MP. | |
void | setMP (unsigned int mp) |
Sets the hero's current MP. | |
wxString | getName () const |
Gets the hero's name. | |
void | setName (const wxString &name) |
Sets the hero's name. | |
bool | getQuestMarker (enum dw_quest marker) const |
Checks one of the quest markers. | |
void | setQuestMarker (enum dw_quest marker, bool set=true) |
Sets one of the quest markers. | |
enum dw_shield | getShield () const |
Gets the hero's shield. | |
void | setShield (dw_shield shield) |
Sets the hero's shield. | |
bool | isValid (int game) const |
Checks whether a game is valid or not. | |
enum dw_weapon | getWeapon () const |
Gets the hero's weapon. | |
void | setWeapon (enum dw_weapon weapon) |
Sets the hero's weapon. | |
Private Member Functions | |
wxUint16 | checksum (int game) const |
Calculates the checksum for one of the save games. | |
char | fromASCII (char asciiChar) const |
Converts an ASCII character to the Dragon Warrior alphabet. | |
char | toASCII (char dwChar) const |
Converts a Dragon Warrior alphabetic character to ASCII. | |
wxUint16 | getChecksum (int game) const |
Gets the checksum for one of the save games. | |
void | setChecksum (int game, wxUint16 checksum) |
Sets the checksum for one of the save games. | |
Private Attributes | |
int | game |
char | sram [SRAM_SIZE] |
unsigned char * | offset |
bool | valid [3] |
bool | modified |
Static Private Attributes | |
static const std::pair< int, int > | QUEST_OFFSETS [] |
the various quest offsets |
SRAMFile::SRAMFile | ( | const wxString & | filename | ) | throw (InvalidSRAMFileException) |
Creates a new SRAMFile.
filename | The SRAM filename. |
InvalidSRAMFileException | if the filename is not a valid Dragon Warrior SRAM file. |
Definition at line 59 of file sramfile.cc.
wxUint16 SRAMFile::checksum | ( | int | game | ) | const [private] |
Calculates the checksum for one of the save games.
game | The game to checksum. |
Definition at line 136 of file sramfile.cc.
char SRAMFile::fromASCII | ( | char | asciiChar | ) | const [private] |
Converts an ASCII character to the Dragon Warrior alphabet.
Definition at line 175 of file sramfile.cc.
char SRAMFile::toASCII | ( | char | dwChar | ) | const [private] |
Converts a Dragon Warrior alphabetic character to ASCII.
dwChar | The Dragon Warrior character. |
Definition at line 239 of file sramfile.cc.
wxUint16 SRAMFile::getChecksum | ( | int | game | ) | const [private] |
Gets the checksum for one of the save games.
game | The game. |
Definition at line 293 of file sramfile.cc.
void SRAMFile::setChecksum | ( | int | game, | |
wxUint16 | checksum | |||
) | [private] |
Sets the checksum for one of the save games.
game | The game. | |
checksum | The new checksum. |
Definition at line 302 of file sramfile.cc.
bool SRAMFile::save | ( | const wxString & | filename | ) |
Saves this SRAMfile back to disk.
filename | The filename to write the data to. |
Definition at line 219 of file sramfile.cc.
enum dw_armor dwsrame::SRAMFile::getArmor | ( | ) | const [inline] |
void SRAMFile::setArmor | ( | enum dw_armor | armor | ) |
wxUint16 SRAMFile::getExperience | ( | ) | const |
void SRAMFile::setExperience | ( | wxUint16 | experience | ) |
Sets the hero's experience.
experience | The new experience. |
Definition at line 318 of file sramfile.cc.
int dwsrame::SRAMFile::getGame | ( | ) | const [inline] |
void SRAMFile::setGame | ( | int | game | ) |
Sets the game currently being edited.
game | The game. |
Definition at line 326 of file sramfile.cc.
wxUint16 SRAMFile::getGold | ( | ) | const |
void SRAMFile::setGold | ( | wxUint16 | gold | ) |
int dwsrame::SRAMFile::getHerbs | ( | ) | const [inline] |
void SRAMFile::setHerbs | ( | int | herbs | ) |
unsigned int dwsrame::SRAMFile::getHP | ( | ) | const [inline] |
void SRAMFile::setHP | ( | unsigned int | hp | ) |
Sets the hero's current HP.
hp | The new current HP. |
Definition at line 355 of file sramfile.cc.
enum dw_item SRAMFile::getItem | ( | int | number | ) | const |
Gets one of the hero's items.
number | The item number. |
Definition at line 360 of file sramfile.cc.
void SRAMFile::setItem | ( | dw_item | item, | |
int | number | |||
) |
Sets one of the hero's items.
item | The new item. | |
number | The item number. |
Definition at line 371 of file sramfile.cc.
int dwsrame::SRAMFile::getKeys | ( | ) | const [inline] |
void SRAMFile::setKeys | ( | int | keys | ) |
bool dwsrame::SRAMFile::isModified | ( | ) | const [inline] |
Checks whether this SRAMFile has been modified or not.
Definition at line 418 of file sramfile.hh.
unsigned int dwsrame::SRAMFile::getMP | ( | ) | const [inline] |
void SRAMFile::setMP | ( | unsigned int | mp | ) |
Sets the hero's current MP.
mp | The new current MP. |
Definition at line 393 of file sramfile.cc.
wxString SRAMFile::getName | ( | ) | const |
void SRAMFile::setName | ( | const wxString & | name | ) |
bool dwsrame::SRAMFile::getQuestMarker | ( | enum dw_quest | marker | ) | const [inline] |
Checks one of the quest markers.
marker | The quest marker to check. |
Definition at line 424 of file sramfile.hh.
void SRAMFile::setQuestMarker | ( | enum dw_quest | marker, | |
bool | set = true | |||
) |
Sets one of the quest markers.
marker | The quest marker to set. | |
set | true to set, false to clear. |
Definition at line 434 of file sramfile.cc.
enum dw_shield dwsrame::SRAMFile::getShield | ( | ) | const [inline] |
void SRAMFile::setShield | ( | dw_shield | shield | ) |
Sets the hero's shield.
shield | The new shield. |
Definition at line 444 of file sramfile.cc.
bool dwsrame::SRAMFile::isValid | ( | int | game | ) | const [inline] |
Checks whether a game is valid or not.
game | The game to check. |
Definition at line 436 of file sramfile.hh.
enum dw_weapon dwsrame::SRAMFile::getWeapon | ( | ) | const [inline] |
void SRAMFile::setWeapon | ( | enum dw_weapon | weapon | ) |
Sets the hero's weapon.
weapon | The new weapon. |
Definition at line 454 of file sramfile.cc.
int dwsrame::SRAMFile::game [private] |
Definition at line 127 of file sramfile.hh.
char dwsrame::SRAMFile::sram[SRAM_SIZE] [private] |
Definition at line 128 of file sramfile.hh.
unsigned char* dwsrame::SRAMFile::offset [private] |
Definition at line 129 of file sramfile.hh.
bool dwsrame::SRAMFile::valid[3] [private] |
Definition at line 130 of file sramfile.hh.
bool dwsrame::SRAMFile::modified [private] |
Definition at line 130 of file sramfile.hh.
const std::pair< int, int > SRAMFile::QUEST_OFFSETS [static, private] |
Initial value:
{ std::pair<int, int>(0xB, 0x04), std::pair<int, int>(0xB, 0x08), std::pair<int, int>(0xB, 0x10), std::pair<int, int>(0xB, 0x20), std::pair<int, int>(0xB, 0x40), std::pair<int, int>(0xB, 0x80), std::pair<int, int>(0xC, 0x01), std::pair<int, int>(0xC, 0x02), std::pair<int, int>(0xC, 0x08), std::pair<int, int>(0xD, 0x02), std::pair<int, int>(0xD, 0x04), std::pair<int, int>(0xD, 0x40), }
Definition at line 133 of file sramfile.hh.