mirror of
https://github.com/edubart/otclient.git
synced 2025-11-30 23:26:51 +01:00
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:
@@ -141,3 +141,14 @@ void Application::close()
|
||||
if(!g_lua.callGlobalField<bool>("g_app", "onClose"))
|
||||
exit();
|
||||
}
|
||||
|
||||
std::string Application::getOs()
|
||||
{
|
||||
#if defined(WIN32)
|
||||
return "windows";
|
||||
#elif defined(__APPLE__)
|
||||
return "mac";
|
||||
#else
|
||||
return "linux";
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -58,6 +58,7 @@ public:
|
||||
std::string getBuildCommit() { return BUILD_COMMIT; }
|
||||
std::string getBuildType() { return BUILD_TYPE; }
|
||||
std::string getBuildArch() { return BUILD_ARCH; }
|
||||
std::string getOs();
|
||||
std::string getStartupOptions() { return m_startupOptions; }
|
||||
|
||||
protected:
|
||||
|
||||
@@ -22,22 +22,25 @@
|
||||
|
||||
#include <framework/core/application.h>
|
||||
#include <framework/luaengine/luainterface.h>
|
||||
#include <framework/graphics/fontmanager.h>
|
||||
#include <framework/ui/ui.h>
|
||||
#include <framework/net/protocol.h>
|
||||
#include <framework/core/eventdispatcher.h>
|
||||
#include <framework/core/configmanager.h>
|
||||
#include <framework/otml/otml.h>
|
||||
#include <framework/graphics/graphics.h>
|
||||
#include <framework/platform/platformwindow.h>
|
||||
#include <framework/core/modulemanager.h>
|
||||
#include <framework/core/module.h>
|
||||
#include <framework/sound/soundmanager.h>
|
||||
#include <framework/util/crypt.h>
|
||||
#include <framework/core/resourcemanager.h>
|
||||
#include <framework/graphics/particlemanager.h>
|
||||
#include <framework/graphics/texturemanager.h>
|
||||
|
||||
#ifdef FW_GRAPHICS
|
||||
#include <framework/graphics/graphics.h>
|
||||
#include <framework/platform/platformwindow.h>
|
||||
#include <framework/graphics/particlemanager.h>
|
||||
#include <framework/graphics/fontmanager.h>
|
||||
#include <framework/ui/ui.h>
|
||||
#endif
|
||||
|
||||
void Application::registerLuaFunctions()
|
||||
{
|
||||
// conversion globals
|
||||
@@ -67,6 +70,7 @@ void Application::registerLuaFunctions()
|
||||
g_lua.bindSingletonFunction("g_app", "getBuildCommit", &Application::getBuildCommit, static_cast<Application*>(&g_app));
|
||||
g_lua.bindSingletonFunction("g_app", "getBuildType", &Application::getBuildType, static_cast<Application*>(&g_app));
|
||||
g_lua.bindSingletonFunction("g_app", "getBuildArch", &Application::getBuildArch, static_cast<Application*>(&g_app));
|
||||
g_lua.bindSingletonFunction("g_app", "getOs", &Application::getOs, static_cast<Application*>(&g_app));
|
||||
g_lua.bindSingletonFunction("g_app", "exit", &Application::exit, static_cast<Application*>(&g_app));
|
||||
|
||||
// Crypt
|
||||
@@ -644,7 +648,7 @@ void Application::registerLuaFunctions()
|
||||
g_lua.bindClassMemberFunction<InputMessage>("peekU16", &InputMessage::peekU16);
|
||||
g_lua.bindClassMemberFunction<InputMessage>("peekU32", &InputMessage::peekU32);
|
||||
g_lua.bindClassMemberFunction<InputMessage>("peekU64", &InputMessage::peekU64);
|
||||
g_lua.bindClassMemberFunction<InputMessage>("decryptRSA", &InputMessage::decryptRSA);
|
||||
g_lua.bindClassMemberFunction<InputMessage>("decryptRsa", &InputMessage::decryptRsa);
|
||||
g_lua.bindClassMemberFunction<InputMessage>("getReadSize", &InputMessage::getReadSize);
|
||||
g_lua.bindClassMemberFunction<InputMessage>("getUnreadSize", &InputMessage::getUnreadSize);
|
||||
g_lua.bindClassMemberFunction<InputMessage>("getMessageSize", &InputMessage::getMessageSize);
|
||||
@@ -661,7 +665,7 @@ void Application::registerLuaFunctions()
|
||||
g_lua.bindClassMemberFunction<OutputMessage>("addU64", &OutputMessage::addU64);
|
||||
g_lua.bindClassMemberFunction<OutputMessage>("addString", &OutputMessage::addString);
|
||||
g_lua.bindClassMemberFunction<OutputMessage>("addPaddingBytes", &OutputMessage::addPaddingBytes);
|
||||
g_lua.bindClassMemberFunction<OutputMessage>("encryptRSA", &OutputMessage::encryptRSA);
|
||||
g_lua.bindClassMemberFunction<OutputMessage>("encryptRsa", &OutputMessage::encryptRsa);
|
||||
g_lua.bindClassMemberFunction<OutputMessage>("getMessageSize", &OutputMessage::getMessageSize);
|
||||
#endif
|
||||
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -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; }
|
||||
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user