From d32f71c2b90f5520fb18cfb4501f8c095ae065bd Mon Sep 17 00:00:00 2001 From: Eduardo Bart Date: Sun, 10 Nov 2013 20:09:46 -0200 Subject: [PATCH] Partial support for protocol 1020 and minimize lag I am able to login in global Tibia however there are game protocol errors * there is a new opcode 167, which I dont know what it is * there are changes in opcode 147 which handles text messages that I don't know too Connection writing was optimized, playing "lag" should improve by 10ms, and improve much more in systems with low fps --- modules/gamelib/const.lua | 2 +- modules/gamelib/game.lua | 2 +- src/framework/core/application.cpp | 5 +++++ src/framework/net/connection.cpp | 2 +- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/modules/gamelib/const.lua b/modules/gamelib/const.lua index b88a8fd4..8970777a 100644 --- a/modules/gamelib/const.lua +++ b/modules/gamelib/const.lua @@ -172,7 +172,7 @@ CIPSOFT_RSA = "1321277432058722840622950990822933849527763264961655079678763618" "88792221429527047321331896351555606801473202394175817" -- set to the latest Tibia.pic signature to make otclient compatible with official tibia -PIC_SIGNATURE = 0x50a6469d +PIC_SIGNATURE = 0x52131b61 OsTypes = { Linux = 1, diff --git a/modules/gamelib/game.lua b/modules/gamelib/game.lua index 468ece37..4c407963 100644 --- a/modules/gamelib/game.lua +++ b/modules/gamelib/game.lua @@ -52,7 +52,7 @@ function g_game.getSupportedClients() 854, 860, 861, 862, 870, 910, 940, 944, 953, 954, 960, 961, 963, 970, 980, 981, 982, 983, 984, 985, 986, - 1001, 1002, 1010 + 1001, 1002, 1010, 1020, 1021, 1022, } end diff --git a/src/framework/core/application.cpp b/src/framework/core/application.cpp index 0a643e04..6c0016a6 100644 --- a/src/framework/core/application.cpp +++ b/src/framework/core/application.cpp @@ -147,6 +147,11 @@ void Application::poll() #endif g_dispatcher.poll(); + + // poll connection again to flush pending write +#ifdef FW_NET + Connection::poll(); +#endif } void Application::exit() diff --git a/src/framework/net/connection.cpp b/src/framework/net/connection.cpp index d12f7b31..83841e74 100644 --- a/src/framework/net/connection.cpp +++ b/src/framework/net/connection.cpp @@ -126,7 +126,7 @@ void Connection::write(uint8* buffer, size_t size) m_outputStream = std::shared_ptr(new asio::streambuf); m_delayedWriteTimer.cancel(); - m_delayedWriteTimer.expires_from_now(boost::posix_time::milliseconds(10)); + m_delayedWriteTimer.expires_from_now(boost::posix_time::milliseconds(0)); m_delayedWriteTimer.async_wait(std::bind(&Connection::onCanWrite, asConnection(), std::placeholders::_1)); }