Jump to content


  • Content count

  • Posts on chatbox

  • Joined

  • Last visited

  • Days Won


Madara last won the day on November 9

Madara had the most liked content!

Community Reputation

455 M2tec Professional

1 Follower

About Madara

  • Rank
    M2tec Pro

Recent Profile Visitors

480 profile views
  1. Hello, I come to share my knowledge on what I discovered recently on the packets encryption. Some might tell me, but that was already shared by MartySama. In fact, this one is not complete, it has forgotten a very important factor which I will present to you subsequently. But suddenly, you have to wonder what happens if we disable the encryption packets the way he shared it? Well, we risk having an overload in the buffer, which may lead to crash games without error or bugs quite strange. There are different strange bug that I could see, the most common was the fact that we can no longer perform an action that requires an agreement with the game. Example, after 15 minutes of play with some player connected, some will no longer click on an item, or else can not talk etc ... There was a lot of debate about that, I took advice left and right and I drew a problematic. I - Why these bugs where not present before the packet encryption? Simply because the structure has been edited. Indeed, we can see that in the protocol.h of the Game, the function buffer_adjust_size was commented. Also, in the desc.cpp, they completely removed the condition in the function: void DESC::Packet But why? Simply because it is no longer useful, the new system does not require a size adjuster for the buffer (it seems to me) Or, they coded something else that automatically adjusts the size of the buffers but I have not watched yet. II - How to remove the encryption packet system properly? In Common, open service.h and comment this: #define _IMPROVED_PACKET_ENCRYPTION_ In Game now, open protocol.h and search: //buffer_adjust_size(pbuf, length); Edit by this: buffer_adjust_size(pbuf, length); Game, open desc.cpp, and the search the function: void DESC::Packet(const void * c_pvData, int iSize) By this: void DESC::Packet(const void * c_pvData, int iSize) { assert(iSize > 0); if (m_iPhase == PHASE_CLOSE) // 끊는 상태면 보내지 않는다. return; if (m_stRelayName.length() != 0) { // Relay 패킷은 암호화하지 않는다. TPacketGGRelay p; p.bHeader = HEADER_GG_RELAY; strlcpy(p.szName, m_stRelayName.c_str(), sizeof(p.szName)); p.lSize = iSize; if (!packet_encode(m_lpOutputBuffer, &p, sizeof(p))) { m_iPhase = PHASE_CLOSE; return; } m_stRelayName.clear(); if (!packet_encode(m_lpOutputBuffer, c_pvData, iSize)) { m_iPhase = PHASE_CLOSE; return; } } else { if (m_lpBufferedOutputBuffer) { buffer_write(m_lpBufferedOutputBuffer, c_pvData, iSize); c_pvData = buffer_read_peek(m_lpBufferedOutputBuffer); iSize = buffer_size(m_lpBufferedOutputBuffer); } // TRAFFIC_PROFILE if (g_bTrafficProfileOn) TrafficProfiler::instance().Report(TrafficProfiler::IODIR_OUTPUT, *(BYTE *) c_pvData, iSize); // END_OF_TRAFFIC_PROFILER #ifdef _IMPROVED_PACKET_ENCRYPTION_ void* buf = buffer_write_peek(m_lpOutputBuffer); if (packet_encode(m_lpOutputBuffer, c_pvData, iSize)) { if (cipher_.activated()) { cipher_.Encrypt(buf, iSize); } } else { m_iPhase = PHASE_CLOSE; } #else if (!m_bEncrypted) { if (!packet_encode(m_lpOutputBuffer, c_pvData, iSize)) { m_iPhase = PHASE_CLOSE; } } else { if (buffer_has_space(m_lpOutputBuffer) < iSize + 8) { buffer_adjust_size(m_lpOutputBuffer, iSize); if (buffer_has_space(m_lpOutputBuffer) < iSize + 8) { sys_err( "desc buffer mem_size overflow : ", " memsize(%u) ", " write_pos(%u)", " iSize(%d)", m_lpOutputBuffer->mem_size, m_lpOutputBuffer->write_point_pos, iSize); m_iPhase = PHASE_CLOSE; } } else { // 암호화에 필요한 충분한 버퍼 크기를 확보한다. /* buffer_adjust_size(m_lpOutputBuffer, iSize + 8); */ DWORD * pdwWritePoint = (DWORD *) buffer_write_peek(m_lpOutputBuffer); if (packet_encode(m_lpOutputBuffer, c_pvData, iSize)) { int iSize2 = TEA_Encrypt(pdwWritePoint, pdwWritePoint, GetEncryptionKey(), iSize); if (iSize2 > iSize) buffer_write_proceed(m_lpOutputBuffer, iSize2 - iSize); } } } #endif // _IMPROVED_PACKET_ENCRYPTION_ SAFE_BUFFER_DELETE(m_lpBufferedOutputBuffer); } //sys_log(0, "%d bytes written (first byte %d)", iSize, *(BYTE *) c_pvData); if (m_iPhase != PHASE_CLOSE) fdwatch_add_fd(m_lpFdw, m_sock, this, FDW_WRITE, true); } You can compile your game. Do not forget to compile a db also ! EterBase, open ServiceDefs.h and comment: #define _IMPROVED_PACKET_ENCRYPTION_ Userinterface, open Locale.cpp and edit: #define LSS_SECURITY_KEY "testtesttesttest" By this: #define LSS_SECURITY_KEY "1234abcd5678efgh" III - Why would I disable this system? - Connection time LARGEMENT decreased (unused cipher) - Loading time also decreased - Better fluidity (personal opinion) - Size of the game enormously decreased as well as that of the launcher Here is a small video: Hoping that it serves you well! Madara
  2. Great job, I use them and i have nothing to say, it's very good work Thanks for the community
  3. Madara


    Welcome @Xayah
  4. Not what, subject solved, I close
  5. Excellent work as usual, thank you for your investment in the forum
  6. @rawn3cr0 Thank you to integrate your code into a spoiler in the future, thank you. If you want to enable acce in inventory: Open uiinventory.py and search: self.wndItem.RefreshSlot() if self.wndBelt: self.wndBelt.RefreshSlot() Add below: def RefreshNewSlotAcce(self): getAcceVnum=player.GetItemIndex illumina_slot_acce = item.COSTUME_SLOT_COUNT for acce_illumina in xrange(illumina_slot_acce): slot_Acce = item.COSTUME_SLOT_START + acce_illumina self.wndEquip.SetItemSlot(slot_Acce, getAcceVnum(slot_Acce), 0) self.wndEquip.RefreshSlot() Search: def Show(self): self.__LoadWindow() Add below: self.RefreshNewSlotAcce() Search: setItemVNum(slotNumber, getItemVNum(slotNumber), itemCount) getItemVNum=player.GetItemIndex Add below: illumina_slot_acce = item.COSTUME_SLOT_COUNT for acce_illumina in xrange(illumina_slot_acce): slot_Acce = item.COSTUME_SLOT_START + acce_illumina self.wndEquip.SetItemSlot(slot_Acce, getItemVNum(slot_Acce), 0) Now open inventorywindows.py and search: import item Add below: SLOT_ACCE_ILLUMINA = item.COSTUME_SLOT_START Search: "slot" : ( Add below: {"index":SLOT_ACCE_ILLUMINA+2, "x":80, "y":3, "width":32, "height":32}, # Slot Acce Illumina
  7. Hello, Have you edited something in item_attribute.cpp?
  8. Sorry, I have not started working on this problem yet, I can not help you anymore
  9. This bug is present since the arrival of sources in late 2013. I had talked about it a long time ago with Vanilla and we concluded that it was due to the fact that there is a delay between the game and the client. The source of the problem comes from the position of the monster that is not identical on the client side to the position calculated by the game I remind you that this bug is not present on the 2012 file and on the official. cordially
  10. Yes i have try with 200 - 250 player ( 2 mounth ) and the fix is working. When ymir write encryption of packet, they comment in protocol the old adjuster because they dont use it. In my src, i have enabled the old structure before encryption of packet. If you delete only the define, you will have crash client, or game.core without syserr or some strange bugs.
  11. I do not have this problem. The only function i have edited is desc.cpp (Thank's to my friends Robert): void DESC::Packet(const void * c_pvData, int iSize) And something in protocol.h Now all is fixed