lozsrame::SRAMFile Class Reference

#include <sramfile.hh>

List of all members.


Detailed Description

A model of the SRAM data used by The Legend of Zelda.

Definition at line 161 of file sramfile.hh.


Public Member Functions

 SRAMFile (const QString &filename) throw (InvalidSRAMFileException)
 Creates an SRAMFile object from an SRAM file.
bool save (const QString &filename)
 Saves the SRAM data to a file.
enum sf_arrow getArrows () const
 Gets the kind of arrows Link is carrying.
void setArrows (sf_arrow arrows)
 Sets the kind of arrows Link is carrying.
int getBombCapacity () const
 Gets Link's bomb capacity.
void setBombCapacity (int capacity)
 Sets Link's bomb capacity.
int getBombs () const
 Gets the number of bombs Link is carrying.
void setBombs (int bombs)
 Sets the number of bombs Link is carrying.
enum sf_candle getCandle () const
 Gets the candle Link is carrying.
void setCandle (enum sf_candle candle)
 Sets the candle Link is carrying.
bool hasCompass (int level) const
 Checks if Link has the compass for a level.
void setCompass (int level, bool give)
 Sets whether Link has the compass for a level.
int getGame () const
 Gets the game slot being edited.
void setGame (int game)
 Sets the game slot (0 - 2) being edited.
int getHeartContainers () const
 Gets the number of heart containers Link has.
void setHeartContainers (int containers)
 Sets the number of heart containers Link has.
bool hasItem (sf_item item) const
 Checks if Link has a particular item or not.
void setItem (sf_item item, bool give)
 Sets whether Link has a particular item or not.
int getKeys () const
 Gets the number of keys Link has.
void setKeys (int keys)
 Sets the number of keys Link has.
bool hasMap (int level) const
 Checks if Link has the map for a level.
void setMap (int level, bool give)
 Sets whether Link has the map for a level.
bool isModified () const
 Checks if this SRAMFile has been modified or not.
QString getName () const
 Gets the name of the hero.
void setName (const QString &name)
 Sets the name of the hero.
enum sf_note getNote () const
 Gets the location of the potion note.
void setNote (enum sf_note note)
 Sets the location of the potion note.
int getPlayCount () const
 Gets the game's play count.
void setPlayCount (int count)
 Sets the game's play count.
enum sf_potion getPotion () const
 Gets the potion Link is carrying.
void setPotion (enum sf_potion potion)
 Sets the potion Link is carrying.
enum sf_quest getQuest () const
 Gets the quest Link is on.
void setQuest (enum sf_quest quest)
 Sets the quest Link is on.
enum sf_ring getRing () const
 Gets the ring Link is wearing.
void setRing (enum sf_ring ring)
 Sets the ring Link is wearing.
int getRupees () const
 Gets how many rupees Link is carrying.
void setRupees (int rupees)
 Sets how many rupees Link is carrying.
enum sf_sword getSword () const
 Gets the sword Link has.
void setSword (enum sf_sword sword)
 Sets the sword Link has.
bool hasTriforce (int piece) const
 Checks if Link has a piece of the triforce.
void setTriforce (int piece, bool give)
 Sets whether Link has a piece of the triforce.
bool isValid (int game) const
 Returns true if a game slot is valid; false otherwise.

Private Member Functions

quint16 checksum (int game) const
 Calculates the checksum for one of the games.
quint16 getChecksum (int game) const
 Gets the checksum value for one of the games.
void setChecksum (int game, quint16 checksum)
 Sets the checksum value for one of the games.

Private Attributes

int game
char sram [SRAM_SIZE]
bool modified
bool valid [3]

Constructor & Destructor Documentation

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

Creates an SRAMFile object from an SRAM file.

Parameters:
filename The SRAM filename.
Returns:
The new SRAMFile object.
Exceptions:
InvalidSRAMFileException if the file is not a valid SRAM file.

Definition at line 33 of file sramfile.cc.


Member Function Documentation

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

Calculates the checksum for one of the games.

Parameters:
game The game to checksum.
Returns:
The checksum.

Definition at line 137 of file sramfile.cc.

quint16 SRAMFile::getChecksum ( int  game  )  const [private]

Gets the checksum value for one of the games.

Parameters:
game The game.
Returns:
The checksum.

Definition at line 265 of file sramfile.cc.

void SRAMFile::setChecksum ( int  game,
quint16  checksum 
) [private]

Sets the checksum value for one of the games.

Parameters:
game The game.
checksum The new checksum.

Definition at line 274 of file sramfile.cc.

bool SRAMFile::save ( const QString &  filename  ) 

Saves the SRAM data to a file.

Parameters:
filename The file to save to.
Returns:
true if the save succeeded; false otherwise.

Definition at line 169 of file sramfile.cc.

enum sf_arrow SRAMFile::getArrows (  )  const

Gets the kind of arrows Link is carrying.

Returns:
The kind of arrows.

Definition at line 195 of file sramfile.cc.

void SRAMFile::setArrows ( sf_arrow  arrows  ) 

Sets the kind of arrows Link is carrying.

Parameters:
arrows The new kind of arrows.

Definition at line 203 of file sramfile.cc.

int SRAMFile::getBombCapacity (  )  const

Gets Link's bomb capacity.

Returns:
The bomb capacity.

Definition at line 212 of file sramfile.cc.

void SRAMFile::setBombCapacity ( int  capacity  ) 

Sets Link's bomb capacity.

Parameters:
capacity The new bomb capacity.

Definition at line 220 of file sramfile.cc.

int SRAMFile::getBombs (  )  const

Gets the number of bombs Link is carrying.

Returns:
The bomb count.

Definition at line 230 of file sramfile.cc.

void SRAMFile::setBombs ( int  bombs  ) 

Sets the number of bombs Link is carrying.

Parameters:
bombs The new bomb count.

Definition at line 238 of file sramfile.cc.

enum sf_candle SRAMFile::getCandle (  )  const

Gets the candle Link is carrying.

Returns:
The candle.

Definition at line 248 of file sramfile.cc.

void SRAMFile::setCandle ( enum sf_candle  candle  ) 

Sets the candle Link is carrying.

Parameters:
candle The new candle.

Definition at line 256 of file sramfile.cc.

bool SRAMFile::hasCompass ( int  level  )  const

Checks if Link has the compass for a level.

Parameters:
level The level to check.
Returns:
true if Link has the compass; false otherwise.

Definition at line 283 of file sramfile.cc.

void SRAMFile::setCompass ( int  level,
bool  give 
)

Sets whether Link has the compass for a level.

Parameters:
level The level to check.
give true to give the compass; false to take away.

Definition at line 296 of file sramfile.cc.

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

Gets the game slot being edited.

Returns:
The game slot (0 - 2).

Definition at line 509 of file sramfile.hh.

void lozsrame::SRAMFile::setGame ( int  game  )  [inline]

Sets the game slot (0 - 2) being edited.

Parameters:
game The new game.

Definition at line 514 of file sramfile.hh.

int SRAMFile::getHeartContainers (  )  const

Gets the number of heart containers Link has.

Returns:
The number of heart containers.

Definition at line 315 of file sramfile.cc.

void SRAMFile::setHeartContainers ( int  containers  ) 

Sets the number of heart containers Link has.

Parameters:
containers The new number of heart containers.

Definition at line 323 of file sramfile.cc.

bool SRAMFile::hasItem ( sf_item  item  )  const

Checks if Link has a particular item or not.

Parameters:
item The item to check.
Returns:
true if Link has the item; false otherwise.

Definition at line 334 of file sramfile.cc.

void SRAMFile::setItem ( sf_item  item,
bool  give 
)

Sets whether Link has a particular item or not.

Parameters:
item The item to set.
give true to give; false to take away.

Definition at line 342 of file sramfile.cc.

int SRAMFile::getKeys (  )  const

Gets the number of keys Link has.

Returns:
The number of keys.

Definition at line 351 of file sramfile.cc.

void SRAMFile::setKeys ( int  keys  ) 

Sets the number of keys Link has.

Parameters:
keys The new number of keys.

Definition at line 359 of file sramfile.cc.

bool SRAMFile::hasMap ( int  level  )  const

Checks if Link has the map for a level.

Parameters:
level The level to check.
Returns:
true if Link has the map; false otherwise.

Definition at line 369 of file sramfile.cc.

void SRAMFile::setMap ( int  level,
bool  give 
)

Sets whether Link has the map for a level.

Parameters:
level The level to set.
give true to give the map; false to take away.

Definition at line 382 of file sramfile.cc.

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

Checks if this SRAMFile has been modified or not.

Returns:
true if modified; false otherwise.

Definition at line 521 of file sramfile.hh.

QString SRAMFile::getName (  )  const

Gets the name of the hero.

Returns:
The name.

Definition at line 401 of file sramfile.cc.

void SRAMFile::setName ( const QString &  name  ) 

Sets the name of the hero.

Parameters:
name The new name.

Definition at line 441 of file sramfile.cc.

enum sf_note SRAMFile::getNote (  )  const

Gets the location of the potion note.

Returns:
The location.

Definition at line 484 of file sramfile.cc.

void SRAMFile::setNote ( enum sf_note  note  ) 

Sets the location of the potion note.

Parameters:
note The new location.

Definition at line 492 of file sramfile.cc.

int SRAMFile::getPlayCount (  )  const

Gets the game's play count.

Returns:
The play count.

Definition at line 501 of file sramfile.cc.

void SRAMFile::setPlayCount ( int  count  ) 

Sets the game's play count.

Parameters:
count The new play count.

Definition at line 510 of file sramfile.cc.

enum sf_potion SRAMFile::getPotion (  )  const

Gets the potion Link is carrying.

Returns:
The potion.

Definition at line 521 of file sramfile.cc.

void SRAMFile::setPotion ( enum sf_potion  potion  ) 

Sets the potion Link is carrying.

Parameters:
potion The new potion.

Definition at line 529 of file sramfile.cc.

enum sf_quest SRAMFile::getQuest (  )  const

Gets the quest Link is on.

Returns:
The current quest.

Definition at line 538 of file sramfile.cc.

void SRAMFile::setQuest ( enum sf_quest  quest  ) 

Sets the quest Link is on.

Parameters:
quest The new quest.

Definition at line 546 of file sramfile.cc.

enum sf_ring SRAMFile::getRing (  )  const

Gets the ring Link is wearing.

Returns:
The ring.

Definition at line 555 of file sramfile.cc.

void SRAMFile::setRing ( enum sf_ring  ring  ) 

Sets the ring Link is wearing.

Parameters:
ring The new ring.

Definition at line 563 of file sramfile.cc.

int SRAMFile::getRupees (  )  const

Gets how many rupees Link is carrying.

Returns:
The rupees.

Definition at line 572 of file sramfile.cc.

void SRAMFile::setRupees ( int  rupees  ) 

Sets how many rupees Link is carrying.

Parameters:
rupees The new rupees.

Definition at line 581 of file sramfile.cc.

enum sf_sword SRAMFile::getSword (  )  const

Gets the sword Link has.

Returns:
The sword.

Definition at line 592 of file sramfile.cc.

void SRAMFile::setSword ( enum sf_sword  sword  ) 

Sets the sword Link has.

Parameters:
sword The new sword.

Definition at line 600 of file sramfile.cc.

bool SRAMFile::hasTriforce ( int  piece  )  const

Checks if Link has a piece of the triforce.

Parameters:
piece The piece to check.
Returns:
true if Link has the piece; false otherwise.

Definition at line 609 of file sramfile.cc.

void SRAMFile::setTriforce ( int  piece,
bool  give 
)

Sets whether Link has a piece of the triforce.

Parameters:
piece The piece to set.
give true to give; false to take away.

Definition at line 618 of file sramfile.cc.

bool lozsrame::SRAMFile::isValid ( int  game  )  const [inline]

Returns true if a game slot is valid; false otherwise.

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

Definition at line 526 of file sramfile.hh.


Member Data Documentation

int lozsrame::SRAMFile::game [private]

Definition at line 163 of file sramfile.hh.

char lozsrame::SRAMFile::sram[SRAM_SIZE] [private]

Definition at line 164 of file sramfile.hh.

bool lozsrame::SRAMFile::modified [private]

Definition at line 165 of file sramfile.hh.

bool lozsrame::SRAMFile::valid[3] [private]

Definition at line 165 of file sramfile.hh.


Generated on Fri Feb 1 09:29:52 2008 for Legend of Zelda SRAM Editor by  doxygen 1.5.3