Commit 29dd8186 authored by nanahira's avatar nanahira

add debug param for message

parent 22c0da77
...@@ -253,6 +253,9 @@ int DuelClient::ClientThread() { ...@@ -253,6 +253,9 @@ int DuelClient::ClientThread() {
void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) { void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
char* pdata = data; char* pdata = data;
unsigned char pktType = BufferIO::ReadUInt8(pdata); unsigned char pktType = BufferIO::ReadUInt8(pdata);
#ifdef YGOPRO_MESSAGE_DEBUG
printf("STOC: %d Length: %d\n", pktType, len);
#endif
switch(pktType) { switch(pktType) {
case STOC_GAME_MSG: { case STOC_GAME_MSG: {
ClientAnalyze(pdata, len - 1); ClientAnalyze(pdata, len - 1);
...@@ -960,6 +963,9 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -960,6 +963,9 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
char* pbuf = msg; char* pbuf = msg;
wchar_t textBuffer[256]; wchar_t textBuffer[256];
mainGame->dInfo.curMsg = BufferIO::ReadUInt8(pbuf); mainGame->dInfo.curMsg = BufferIO::ReadUInt8(pbuf);
#ifdef YGOPRO_MESSAGE_DEBUG
printf("MSG: %d Length: %d\n", mainGame->dInfo.curMsg, len);
#endif
if(mainGame->dInfo.curMsg != MSG_RETRY) { if(mainGame->dInfo.curMsg != MSG_RETRY) {
memcpy(last_successful_msg, msg, len); memcpy(last_successful_msg, msg, len);
last_successful_msg_length = len; last_successful_msg_length = len;
......
...@@ -59,6 +59,9 @@ public: ...@@ -59,6 +59,9 @@ public:
char* p = duel_client_write; char* p = duel_client_write;
BufferIO::WriteInt16(p, 1); BufferIO::WriteInt16(p, 1);
BufferIO::WriteInt8(p, proto); BufferIO::WriteInt8(p, proto);
#ifdef YGOPRO_MESSAGE_DEBUG
printf("CTOS: %d\n", proto);
#endif
bufferevent_write(client_bev, duel_client_write, 3); bufferevent_write(client_bev, duel_client_write, 3);
} }
template<typename ST> template<typename ST>
...@@ -67,6 +70,9 @@ public: ...@@ -67,6 +70,9 @@ public:
BufferIO::WriteInt16(p, 1 + sizeof(ST)); BufferIO::WriteInt16(p, 1 + sizeof(ST));
BufferIO::WriteInt8(p, proto); BufferIO::WriteInt8(p, proto);
memcpy(p, &st, sizeof(ST)); memcpy(p, &st, sizeof(ST));
#ifdef YGOPRO_MESSAGE_DEBUG
printf("CTOS: %d Length: %d\n", proto, sizeof(ST));
#endif
bufferevent_write(client_bev, duel_client_write, sizeof(ST) + 3); bufferevent_write(client_bev, duel_client_write, sizeof(ST) + 3);
} }
static void SendBufferToServer(unsigned char proto, void* buffer, size_t len) { static void SendBufferToServer(unsigned char proto, void* buffer, size_t len) {
...@@ -74,6 +80,9 @@ public: ...@@ -74,6 +80,9 @@ public:
BufferIO::WriteInt16(p, 1 + len); BufferIO::WriteInt16(p, 1 + len);
BufferIO::WriteInt8(p, proto); BufferIO::WriteInt8(p, proto);
memcpy(p, buffer, len); memcpy(p, buffer, len);
#ifdef YGOPRO_MESSAGE_DEBUG
printf("CTOS: %d Length: %d\n", proto, len);
#endif
bufferevent_write(client_bev, duel_client_write, len + 3); bufferevent_write(client_bev, duel_client_write, len + 3);
} }
......
...@@ -19,6 +19,9 @@ project "ygopro" ...@@ -19,6 +19,9 @@ project "ygopro"
if os.getenv("YGOPRO_COMPAT_MYCARD") then if os.getenv("YGOPRO_COMPAT_MYCARD") then
defines { "YGOPRO_COMPAT_MYCARD" } defines { "YGOPRO_COMPAT_MYCARD" }
end end
if os.getenv("YGOPRO_MESSAGE_DEBUG") then
defines { "YGOPRO_MESSAGE_DEBUG" }
end
local mr=os.getenv("YGOPRO_DEFAULT_DUEL_RULE") local mr=os.getenv("YGOPRO_DEFAULT_DUEL_RULE")
if mr and tonumber(mr) then defines { "DEFAULT_DUEL_RULE="..tonumber(mr) } end if mr and tonumber(mr) then defines { "DEFAULT_DUEL_RULE="..tonumber(mr) } end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment