wezt 95 Posted May 4, 2016 Share Posted May 4, 2016 Hello, I'd like to share a fix for "Phase Game does not handle this header (header: 81, last: 45, 81)". Spoiler This error usually happens when players on low-lvl characters teleporting between different maps (as far I noticed this also happens only on wireless connection). At least these symptoms were on my server. Let's start First of all I'd like to begin from adding some debug info in client, in order to be sure that this fix is necessary (check spoiler below). Spoiler Go in Client_source\UserInterface\PythonNetworkStreamPhaseGame.cpp Find there "bool CPythonNetworkStream::RecvQuestInfoPacket()": and replace: if (0 != (c_rFlag & QUEST_SEND_TITLE)) { if (!Recv(sizeof(szTitle), &szTitle)) return false; szTitle[30]='\0'; } if (0 != (c_rFlag & QUEST_SEND_CLOCK_NAME)) { if (!Recv(sizeof(szClockName), &szClockName)) return false; szClockName[16]='\0'; } if (0 != (c_rFlag & QUEST_SEND_CLOCK_VALUE)) { if (!Recv(sizeof(iClockValue), &iClockValue)) return false; } if (0 != (c_rFlag & QUEST_SEND_COUNTER_NAME)) { if (!Recv(sizeof(szCounterName), &szCounterName)) return false; szCounterName[16]='\0'; } if (0 != (c_rFlag & QUEST_SEND_COUNTER_VALUE)) { if (!Recv(sizeof(iCounterValue), &iCounterValue)) return false; } if (0 != (c_rFlag & QUEST_SEND_ICON_FILE)) { if (!Recv(sizeof(szIconFileName), &szIconFileName)) return false; szIconFileName[24]='\0'; } With: if (0 != (c_rFlag & QUEST_SEND_TITLE)) { if (!Recv(sizeof(szTitle), &szTitle)) { TraceError("!Recv(sizeof(szTitle), &szTitle)"); return false; } szTitle[30]='\0'; } if (0 != (c_rFlag & QUEST_SEND_CLOCK_NAME)) { if (!Recv(sizeof(szClockName), &szClockName)) { TraceError("!Recv(sizeof(szClockName), &szClockName)"); return false; } szClockName[16]='\0'; } if (0 != (c_rFlag & QUEST_SEND_CLOCK_VALUE)) { if (!Recv(sizeof(iClockValue), &iClockValue)) { TraceError("!Recv(sizeof(iClockValue), &iClockValue)"); return false; } } if (0 != (c_rFlag & QUEST_SEND_COUNTER_NAME)) { if (!Recv(sizeof(szCounterName), &szCounterName)) { TraceError("!Recv(sizeof(szCounterName), &szCounterName)"); return false; } szCounterName[16]='\0'; } if (0 != (c_rFlag & QUEST_SEND_COUNTER_VALUE)) { if (!Recv(sizeof(iCounterValue), &iCounterValue)) { TraceError("!Recv(sizeof(iCounterValue), &iCounterValue)"); return false; } } if (0 != (c_rFlag & QUEST_SEND_ICON_FILE)) { if (!Recv(sizeof(szIconFileName), &szIconFileName)) { TraceError("!Recv(sizeof(szIconFileName), &szIconFileName)"); return false; } szIconFileName[24]='\0'; } Compile your game client and try to catch an error with header. Check out client syserr.txt. There should be more info (we've added it with previous changes). If you'll have there something like this: Spoiler 0504 19:17:23903 :: !Recv(sizeof(szTitle), &szTitle) 0504 19:17:23903 :: Phase Game does not handle this header (header: 81, last: 45, 81) 0504 19:17:23903 :: Unknown packet header blabla Means that this fix is for you At this point we'll start with fix (if you didn't have "!Recv(sizeof(BLA), &BLA)" in syserr.txt I don't sure that this fix is for you). GAME SOURCE: game/src/packet.h Spoiler Find: struct packet_quest_info Replace it with next one: struct packet_quest_info { BYTE header; WORD size; WORD index; BYTE flag; char szTitle[30 + 1]; BYTE isBegin; char szClockName[16 + 1]; int iClockValue; char szCounterName[16 + 1]; int iCounterValue; char szIconFileName[24 + 1]; }; game/src/questpc.cpp Spoiler Find: void PC::SendQuestInfoPakcet() Replace whole function with next one: void PC::SendQuestInfoPakcet() { assert(m_iSendToClient); assert(m_RunningQuestState); packet_quest_info qi; qi.header = HEADER_GC_QUEST_INFO; qi.size = sizeof(struct packet_quest_info); qi.index = m_RunningQuestState->iIndex; qi.flag = m_iSendToClient; if (m_iSendToClient & QUEST_SEND_TITLE) { m_RunningQuestState->_title.reserve(30+1); strlcpy(qi.szTitle, m_RunningQuestState->_title.c_str(), sizeof(qi.szTitle)); qi.szTitle[30] = '\0'; } else qi.szTitle[30 + 1] = '\0'; if (m_iSendToClient & QUEST_SEND_ISBEGIN) { qi.isBegin = m_RunningQuestState->bStart?1:0; } else qi.isBegin = 0; if (m_iSendToClient & QUEST_SEND_CLOCK_NAME) { m_RunningQuestState->_clock_name.reserve(16+1); strlcpy(qi.szClockName, m_RunningQuestState->_clock_name.c_str(), sizeof(qi.szClockName)); qi.szClockName[16] = '\0'; } else qi.szClockName[16] = '\0'; if (m_iSendToClient & QUEST_SEND_CLOCK_VALUE) { qi.iClockValue = m_RunningQuestState->_clock_value; } else qi.iClockValue = 0; if (m_iSendToClient & QUEST_SEND_COUNTER_NAME) { m_RunningQuestState->_counter_name.reserve(16+1); strlcpy(qi.szCounterName, m_RunningQuestState->_counter_name.c_str(), sizeof(qi.szCounterName)); qi.szCounterName[16] = '\0'; } else qi.szCounterName[16] = '\0'; if (m_iSendToClient & QUEST_SEND_COUNTER_VALUE) { qi.iCounterValue = m_RunningQuestState->_counter_value; } else qi.iCounterValue = 0; if (m_iSendToClient & QUEST_SEND_ICON_FILE) { m_RunningQuestState->_icon_file.reserve(24+1); strlcpy(qi.szIconFileName, m_RunningQuestState->_icon_file.c_str(), sizeof(qi.szIconFileName)); qi.szIconFileName[24] = '\0'; } else qi.szIconFileName[24] = '\0'; CQuestManager::instance().GetCurrentCharacterPtr()->GetDesc()->Packet(&qi, sizeof(qi)); m_iSendToClient = 0; } CLIENT SOURCE: UserInterface\Packet.h Spoiler Find: typedef struct packet_quest_info Replace with: typedef struct packet_quest_info { BYTE header; WORD size; WORD index; BYTE flag; char szTitle[30 + 1]; BYTE isBegin; char szClockName[16 + 1]; int iClockValue; char szCounterName[16 + 1]; int iCounterValue; char szIconFileName[24 + 1]; } TPacketGCQuestInfo; UserInterface\PythonNetworkStreamPhaseGame.cpp Spoiler Find: bool CPythonNetworkStream::RecvQuestInfoPacket() Replace whole function with next one: bool CPythonNetworkStream::RecvQuestInfoPacket() { TPacketGCQuestInfo QuestInfo; if (!Peek(sizeof(TPacketGCQuestInfo), &QuestInfo)) { Tracen("Recv Quest Info Packet Error #1"); TraceError("Recv Quest Info Packet Error #1"); return false; } if (!Peek(QuestInfo.size)) { Tracen("Recv Quest Info Packet Error #2"); TraceError("Recv Quest Info Packet Error #2"); return false; } Recv(sizeof(TPacketGCQuestInfo)); const BYTE & c_rFlag = QuestInfo.flag; enum { QUEST_PACKET_TYPE_NONE, QUEST_PACKET_TYPE_BEGIN, QUEST_PACKET_TYPE_UPDATE, QUEST_PACKET_TYPE_END, }; BYTE byQuestPacketType = QUEST_PACKET_TYPE_NONE; if (0 != (c_rFlag & QUEST_SEND_IS_BEGIN)) { BYTE isBegin = QuestInfo.isBegin; if (isBegin) byQuestPacketType = QUEST_PACKET_TYPE_BEGIN; else byQuestPacketType = QUEST_PACKET_TYPE_END; } else { byQuestPacketType = QUEST_PACKET_TYPE_UPDATE; } // Recv Data Start char szTitle[30 + 1] = ""; char szClockName[16 + 1] = ""; int iClockValue = 0; char szCounterName[16 + 1] = ""; int iCounterValue = 0; char szIconFileName[24 + 1] = ""; if (0 != (c_rFlag & QUEST_SEND_TITLE)) { strncpy(szTitle, QuestInfo.szTitle, sizeof(szTitle)); szTitle[30]='\0'; } if (0 != (c_rFlag & QUEST_SEND_CLOCK_NAME)) { strncpy(szClockName, QuestInfo.szClockName, sizeof(szClockName)); szClockName[16]='\0'; } if (0 != (c_rFlag & QUEST_SEND_CLOCK_VALUE)) { iClockValue = QuestInfo.iClockValue; } if (0 != (c_rFlag & QUEST_SEND_COUNTER_NAME)) { strncpy(szCounterName, QuestInfo.szCounterName, sizeof(szCounterName)); szCounterName[16]='\0'; } if (0 != (c_rFlag & QUEST_SEND_COUNTER_VALUE)) { iCounterValue = QuestInfo.iCounterValue; } if (0 != (c_rFlag & QUEST_SEND_ICON_FILE)) { strncpy(szIconFileName, QuestInfo.szIconFileName, sizeof(szIconFileName)); szIconFileName[24]='\0'; } // Recv Data End CPythonQuest& rkQuest=CPythonQuest::Instance(); // Process Start if (QUEST_PACKET_TYPE_END == byQuestPacketType) { rkQuest.DeleteQuestInstance(QuestInfo.index); } else if (QUEST_PACKET_TYPE_UPDATE == byQuestPacketType) { if (!rkQuest.IsQuest(QuestInfo.index)) { rkQuest.MakeQuest(QuestInfo.index); } if (strlen(szTitle) > 0) rkQuest.SetQuestTitle(QuestInfo.index, szTitle); if (strlen(szClockName) > 0) rkQuest.SetQuestClockName(QuestInfo.index, szClockName); if (strlen(szCounterName) > 0) rkQuest.SetQuestCounterName(QuestInfo.index, szCounterName); if (strlen(szIconFileName) > 0) rkQuest.SetQuestIconFileName(QuestInfo.index, szIconFileName); if (c_rFlag & QUEST_SEND_CLOCK_VALUE) rkQuest.SetQuestClockValue(QuestInfo.index, iClockValue); if (c_rFlag & QUEST_SEND_COUNTER_VALUE) rkQuest.SetQuestCounterValue(QuestInfo.index, iCounterValue); } else if (QUEST_PACKET_TYPE_BEGIN == byQuestPacketType) { CPythonQuest::SQuestInstance QuestInstance; QuestInstance.dwIndex = QuestInfo.index; QuestInstance.strTitle = szTitle; QuestInstance.strClockName = szClockName; QuestInstance.iClockValue = iClockValue; QuestInstance.strCounterName = szCounterName; QuestInstance.iCounterValue = iCounterValue; QuestInstance.strIconFileName = szIconFileName; CPythonQuest::Instance().RegisterQuestInstance(QuestInstance); } // Process Start End PyCallClassMemberFunc(m_apoPhaseWnd[PHASE_WINDOW_GAME], "RefreshQuest", Py_BuildValue("()")); return true; } That's it. As you can see we've just deleted TEMP_BUFFER from server function and put all data in packet body. Spoiler P.S.: 1. I'm very hope that you'll make backup for your source before apply this fix. 2. I cannot promise that this will fix the problem for you (but I'm 100% sure that problem was solved on my server with current fix ). 3. If you'll repost this solution somewhere, please keep credits in your repost. And last thing. Would be nice to hear if this solution solved header 81 problem on your servers. Let me know if you'll have problems with compiling (I could forget to add something in this TUT). And sorry if my English isn't good enough for you Regards. 3 1 11 Link to comment Share on other sites More sharing options...
karaca425 39 Posted May 4, 2016 Share Posted May 4, 2016 thank you wezt Link to comment Share on other sites More sharing options...
emoemolizu 1 Posted May 8, 2016 Share Posted May 8, 2016 please help game compile: questpc.cpp: In member function 'void quest::PC::SendQuestInfoPakcet()': questpc.cpp:335: error: expected primary-expression before ';' token questpc.cpp:338: error: expected primary-expression before ';' token questpc.cpp:354: error: expected primary-expression before ';' token questpc.cpp:370: error: expected primary-expression before ';' token questpc.cpp:383: error: expected primary-expression before ';' token gmake: *** [OBJDIR/questpc.o] Error 1 Link to comment Share on other sites More sharing options...
wezt 95 Posted May 8, 2016 Author Share Posted May 8, 2016 Hey, should be ok now. Idk why, but some pieces of code were corrupted (already fixed in 1st post). Regards. Link to comment Share on other sites More sharing options...
.Meyvis# 44 Posted May 14, 2016 Share Posted May 14, 2016 Thanks wezt I just tried it out and it seems to work Link to comment Share on other sites More sharing options...
MORTE 79 Posted May 9, 2017 Share Posted May 9, 2017 I corrected the problem, but after installation in the long run it creates more header errors that did not occur before, I do not know if it's just me, but it got worse after installing this fix, thanks again! Link to comment Share on other sites More sharing options...
Recommended Posts