Multi-protocol

Lots of chagnes to add multi protocol flexibility, not really
completed yet, still have to rework text messages opcodes and other stuff,
so this still a working in progress feature

* Rework dat reader, the dat reader can now
* dinamically detect dat version
* Split game into gamelib and game_interface
* Lots of other minor changes
This commit is contained in:
Eduardo Bart
2012-07-17 20:49:21 -03:00
parent 6fc11d2fa9
commit eb24d6776e
64 changed files with 536 additions and 588 deletions

View File

@@ -86,7 +86,7 @@ std::string InputMessage::getString()
return std::string(v, stringLength);
}
void InputMessage::decryptRSA(int size, const std::string& p, const std::string& q, const std::string& d)
void InputMessage::decryptRsa(int size, const std::string& p, const std::string& q, const std::string& d)
{
checkRead(size);
RSA::decrypt((char*)m_buffer + m_readPos, size, p.c_str(), q.c_str(), d.c_str());

View File

@@ -40,6 +40,7 @@ public:
void setBuffer(const std::string& buffer);
void skipBytes(uint16 bytes) { m_readPos += bytes; }
void setReadPos(uint16 readPos) { m_readPos = readPos; }
uint8 getU8();
uint16 getU16();
uint32 getU32();
@@ -51,9 +52,10 @@ public:
uint32 peekU32() { uint32 v = getU32(); m_readPos-=4; return v; }
uint64 peekU64() { uint64 v = getU64(); m_readPos-=8; return v; }
void decryptRSA(int size, const std::string& p, const std::string& q, const std::string& d);
void decryptRsa(int size, const std::string& p, const std::string& q, const std::string& d);
int getReadSize() { return m_readPos - m_headerPos; }
int getReadPos() { return m_readPos; }
int getUnreadSize() { return m_messageSize - (m_readPos - m_headerPos); }
uint16 getMessageSize() { return m_messageSize; }

View File

@@ -89,7 +89,7 @@ void OutputMessage::addPaddingBytes(int bytes, uint8 byte)
m_messageSize += bytes;
}
void OutputMessage::encryptRSA(int size, const std::string& key)
void OutputMessage::encryptRsa(int size, const std::string& key)
{
if(m_messageSize < size)
throw stdext::exception("insufficient bytes in buffer to encrypt");

View File

@@ -49,7 +49,7 @@ public:
void addString(const std::string& buffer);
void addPaddingBytes(int bytes, uint8 byte = 0);
void encryptRSA(int size, const std::string& key);
void encryptRsa(int size, const std::string& key);
uint16 getMessageSize() { return m_messageSize; }