dwsrame::SRAMFile Class Reference

#include <sramfile.hh>

List of all members.


Detailed Description

class to interface with an SRAM file

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


Constructor & Destructor Documentation

SRAMFile::SRAMFile ( const wxString &  filename  )  throw (InvalidSRAMFileException)

Creates a new SRAMFile.

Parameters:
filename The SRAM filename.
Exceptions:
InvalidSRAMFileException if the filename is not a valid Dragon Warrior SRAM file.

Definition at line 59 of file sramfile.cc.


Member Function Documentation

wxUint16 SRAMFile::checksum ( int  game  )  const [private]

Calculates the checksum for one of the save games.

Parameters:
game The game to checksum.
Returns:
The 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.

Parameters:
dwChar The Dragon Warrior character.
Returns:
The ASCII 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.

Parameters:
game The game.
Returns:
The checksum.

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.

Parameters:
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.

Parameters:
filename The filename to write the data to.
Returns:
true on success; false otherwise.

Definition at line 219 of file sramfile.cc.

enum dw_armor dwsrame::SRAMFile::getArmor (  )  const [inline]

Gets the hero's armor.

Returns:
The armor.

Definition at line 400 of file sramfile.hh.

void SRAMFile::setArmor ( enum dw_armor  armor  ) 

Sets the hero's armor.

Parameters:
armor The new armor.

Definition at line 283 of file sramfile.cc.

wxUint16 SRAMFile::getExperience (  )  const

Gets the hero's experience.

Returns:
The experience.

Definition at line 311 of file sramfile.cc.

void SRAMFile::setExperience ( wxUint16  experience  ) 

Sets the hero's experience.

Parameters:
experience The new experience.

Definition at line 318 of file sramfile.cc.

int dwsrame::SRAMFile::getGame (  )  const [inline]

Gets the current game.

Returns:
The game.

Definition at line 406 of file sramfile.hh.

void SRAMFile::setGame ( int  game  ) 

Sets the game currently being edited.

Parameters:
game The game.

Definition at line 326 of file sramfile.cc.

wxUint16 SRAMFile::getGold (  )  const

Gets the hero's gold.

Returns:
The gold.

Definition at line 335 of file sramfile.cc.

void SRAMFile::setGold ( wxUint16  gold  ) 

Sets the hero's gold.

Parameters:
gold The new gold.

Definition at line 342 of file sramfile.cc.

int dwsrame::SRAMFile::getHerbs (  )  const [inline]

Gets the hero's herbs.

Returns:
The herbs.

Definition at line 409 of file sramfile.hh.

void SRAMFile::setHerbs ( int  herbs  ) 

Sets the hero's herbs.

Parameters:
herbs The new herbs.

Definition at line 350 of file sramfile.cc.

unsigned int dwsrame::SRAMFile::getHP (  )  const [inline]

Gets the hero's current HP.

Returns:
The current HP.

Definition at line 412 of file sramfile.hh.

void SRAMFile::setHP ( unsigned int  hp  ) 

Sets the hero's current HP.

Parameters:
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.

Parameters:
number The item number.
Returns:
The item.

Definition at line 360 of file sramfile.cc.

void SRAMFile::setItem ( dw_item  item,
int  number 
)

Sets one of the hero's items.

Parameters:
item The new item.
number The item number.

Definition at line 371 of file sramfile.cc.

int dwsrame::SRAMFile::getKeys (  )  const [inline]

Gets the hero's keys.

Returns:
The keys.

Definition at line 415 of file sramfile.hh.

void SRAMFile::setKeys ( int  keys  ) 

Sets the hero's keys.

Parameters:
keys The new keys.

Definition at line 388 of file sramfile.cc.

bool dwsrame::SRAMFile::isModified (  )  const [inline]

Checks whether this SRAMFile has been modified or not.

Returns:
true if modified; false otherwise.

Definition at line 418 of file sramfile.hh.

unsigned int dwsrame::SRAMFile::getMP (  )  const [inline]

Gets the hero's current MP.

Returns:
The current MP.

Definition at line 421 of file sramfile.hh.

void SRAMFile::setMP ( unsigned int  mp  ) 

Sets the hero's current MP.

Parameters:
mp The new current MP.

Definition at line 393 of file sramfile.cc.

wxString SRAMFile::getName (  )  const

Gets the hero's name.

Returns:
The name.

Definition at line 398 of file sramfile.cc.

void SRAMFile::setName ( const wxString &  name  ) 

Sets the hero's name.

Parameters:
name The new name.

Definition at line 413 of file sramfile.cc.

bool dwsrame::SRAMFile::getQuestMarker ( enum dw_quest  marker  )  const [inline]

Checks one of the quest markers.

Parameters:
marker The quest marker to check.
Returns:
true if the quest marker is set, false otherwise.

Definition at line 424 of file sramfile.hh.

void SRAMFile::setQuestMarker ( enum dw_quest  marker,
bool  set = true 
)

Sets one of the quest markers.

Parameters:
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]

Gets the hero's shield.

Returns:
The shield.

Definition at line 430 of file sramfile.hh.

void SRAMFile::setShield ( dw_shield  shield  ) 

Sets the hero's shield.

Parameters:
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.

Parameters:
game The game to check.
Returns:
true if valid; false otherwise.

Definition at line 436 of file sramfile.hh.

enum dw_weapon dwsrame::SRAMFile::getWeapon (  )  const [inline]

Gets the hero's weapon.

Returns:
The weapon.

Definition at line 442 of file sramfile.hh.

void SRAMFile::setWeapon ( enum dw_weapon  weapon  ) 

Sets the hero's weapon.

Parameters:
weapon The new weapon.

Definition at line 454 of file sramfile.cc.


Member Data Documentation

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]

the various quest offsets

Definition at line 133 of file sramfile.hh.


Generated on Fri Feb 2 21:09:25 2007 for dwsrame by  doxygen 1.5.1-p1