#include <Password.hh>
Definition at line 58 of file Password.hh.
Public Member Functions | |
Password () | |
Creates a new blank password. | |
Password (const wxString &password, bool fixChecksum=false) throw (InvalidPasswordException) | |
Creates a password from a Metroid password. | |
bool | getBit (int bit) const |
Gets a bit from the raw password data. | |
void | setBit (int bit, bool value=true) |
Sets a bit in the raw password data. | |
const wxString & | getEncoded () const |
Gets the encoded Metroid password encapsulated by this Password. | |
wxUint32 | getGameTime () const |
Gets the game time in ticks (1 tick = ~4 seconds). | |
void | setGameTime (wxUint32 time) |
Sets the game time. | |
unsigned char | getMissiles () const |
Gets the number of missiles held by Samus. | |
void | setMissiles (unsigned char missiles) |
Sets the number of missiles held by Samus. | |
unsigned char | getShift () const |
Gets the shift byte used by this Password. | |
void | setShift (unsigned char shift) |
Sets the shift byte used by this Password. | |
Static Public Attributes | |
static const wxString | ALPHABET |
Private Member Functions | |
unsigned char | calcChecksum () const |
Calculates the checksum value for this Password. | |
void | decode (const wxString &password, bool fixChecksum) throw (InvalidPasswordException) |
Decodes a Metroid password into our raw format. | |
void | encode () |
Encodes the raw password data into a Metroid password. | |
Private Attributes | |
wxString | encoded |
unsigned char | data [18] |
Static Private Attributes | |
static const int | MISSILE_COUNT_BYTE = 10 |
static const int | GAME_TIME_BYTE = 11 |
static const int | SHIFT_BYTE = 16 |
static const int | CHECKSUM_BYTE = 17 |
static const unsigned char | SPACE_VALUE = 0xFF |
Password::Password | ( | ) |
Password::Password | ( | const wxString & | password, | |
bool | fixChecksum = false | |||
) | throw (InvalidPasswordException) |
Creates a password from a Metroid password.
password | The Metroid password. | |
fixChecksum | true if the checksum should be fixed to force a valid password; false to accept only valid Metroid passwords. |
InvalidPasswordException | if an invalid password is supplied. |
Definition at line 43 of file Password.cc.
unsigned char Password::calcChecksum | ( | ) | const [private] |
Calculates the checksum value for this Password.
Definition at line 104 of file Password.cc.
void Password::decode | ( | const wxString & | password, | |
bool | fixChecksum | |||
) | throw (InvalidPasswordException) [private] |
Decodes a Metroid password into our raw format.
password | The password to decode. | |
fixChecksum | true if the checksum should be fixed to force a valid password; false to accept only valid Metroid passwords. |
InvalidPasswordException | if the given password is invalid. |
Definition at line 114 of file Password.cc.
void Password::encode | ( | ) | [private] |
bool Password::getBit | ( | int | bit | ) | const |
Gets a bit from the raw password data.
bit | The bit to get (1-128). |
Definition at line 56 of file Password.cc.
void Password::setBit | ( | int | bit, | |
bool | value = true | |||
) |
Sets a bit in the raw password data.
bit | the bit to set (1-128). | |
value | true to set the bit; false to clear it. |
Definition at line 64 of file Password.cc.
const wxString & mpg::Password::getEncoded | ( | ) | const [inline] |
Gets the encoded Metroid password encapsulated by this Password.
Definition at line 182 of file Password.hh.
wxUint32 Password::getGameTime | ( | ) | const |
Gets the game time in ticks (1 tick = ~4 seconds).
Definition at line 78 of file Password.cc.
void Password::setGameTime | ( | wxUint32 | time | ) |
Sets the game time.
time | The game time in ticks (1 tick = ~4 seconds). |
Definition at line 85 of file Password.cc.
unsigned char mpg::Password::getMissiles | ( | ) | const [inline] |
Gets the number of missiles held by Samus.
Definition at line 183 of file Password.hh.
void Password::setMissiles | ( | unsigned char | missiles | ) |
Sets the number of missiles held by Samus.
missiles | The number of missiles. |
Definition at line 92 of file Password.cc.
unsigned char mpg::Password::getShift | ( | ) | const [inline] |
Gets the shift byte used by this Password.
Definition at line 185 of file Password.hh.
void Password::setShift | ( | unsigned char | shift | ) |
Sets the shift byte used by this Password.
shift | The shift byte. |
Definition at line 98 of file Password.cc.
wxString mpg::Password::encoded [private] |
Definition at line 60 of file Password.hh.
unsigned char mpg::Password::data[18] [private] |
Definition at line 61 of file Password.hh.
const int mpg::Password::MISSILE_COUNT_BYTE = 10 [static, private] |
Definition at line 63 of file Password.hh.
const int mpg::Password::GAME_TIME_BYTE = 11 [static, private] |
Definition at line 64 of file Password.hh.
const int mpg::Password::SHIFT_BYTE = 16 [static, private] |
Definition at line 65 of file Password.hh.
const int mpg::Password::CHECKSUM_BYTE = 17 [static, private] |
Definition at line 66 of file Password.hh.
const unsigned char mpg::Password::SPACE_VALUE = 0xFF [static, private] |
Definition at line 67 of file Password.hh.
const wxString Password::ALPHABET [static] |
Definition at line 95 of file Password.hh.