Last active
February 14, 2022 01:01
-
-
Save tehsausage/54acba49d982234f2b01e9849c4d48fc to your computer and use it in GitHub Desktop.
EO big packet patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; Change packet substring index from 2 to 4 | |
+9FA3D -> B9 02 | |
edited -> B9 04 | |
; Change packet substring bounds from (2, len-2) to (4, len-4) | |
+9FAA0 -> C1 FE BA 03 | |
edited -> C1 FC BA 05 | |
; more of the above... | |
+9FAE8 -> BA 03 | |
edited -> BA 05 | |
; even more of the above... | |
+9FAF9 -> C1 FE | |
edited -> C1 FC | |
; replace packet length calculation code to process three and four byte lengths | |
+A00B5 -> 83 FB 01 75 02 03 F0 83 FB 02 75 0C 8B C8 C1 E1 06 2B C8 8D 0C 88 | |
edited -> 53 8B C8 83 FB 01 7E 0D 50 66 B8 FD 00 F7 E1 8B C8 58 4B EB EE 5B | |
; code before: | |
endless.exe+A00B5 - 83 FB 01 - cmp ebx,01 { 1 } | |
endless.exe+A00B8 - 75 02 - jne endless.exe+A00BC | |
endless.exe+A00BA - 03 F0 - add esi,eax | |
endless.exe+A00BC - 83 FB 02 - cmp ebx,02 { 2 } | |
endless.exe+A00BF - 75 0C - jne endless.exe+A00CD | |
endless.exe+A00C1 - 8B C8 - mov ecx,eax | |
endless.exe+A00C3 - C1 E1 06 - shl ecx,06 { 6 } | |
endless.exe+A00C6 - 2B C8 - sub ecx,eax | |
endless.exe+A00C8 - 8D 0C 88 - lea ecx,[eax+ecx*4] | |
; code after: | |
endless.exe+A00B5 - 53 - push ebx | |
endless.exe+A00B6 - 8B C8 - mov ecx,eax | |
endless.exe+A00B8 - 83 FB 01 - cmp ebx,01 { 1 } | |
endless.exe+A00BB - 7E 0D - jle endless.exe+A00CA | |
endless.exe+A00BD - 50 - push eax | |
endless.exe+A00BE - 66 B8 FD00 - mov ax,00FD { 253 } | |
endless.exe+A00C2 - F7 E1 - mul ecx | |
endless.exe+A00C4 - 8B C8 - mov ecx,eax | |
endless.exe+A00C6 - 58 - pop eax | |
endless.exe+A00C7 - 4B - dec ebx | |
endless.exe+A00C8 - EB EE - jmp endless.exe+A00B8 | |
endless.exe+A00CA - 5B - pop ebx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/packet.cpp b/src/packet.cpp | |
index f942b03..6a75401 100644 | |
--- a/src/packet.cpp | |
+++ b/src/packet.cpp | |
@@ -176,19 +176,21 @@ std::string PacketProcessor::Decode(const std::string &str) | |
std::string PacketProcessor::Encode(const std::string &rawstr) | |
{ | |
- if (emulti_e == 0 || ((unsigned char)rawstr[2] == PACKET_A_INIT && (unsigned char)rawstr[3] == PACKET_F_INIT)) | |
+ if (emulti_e == 0 || ((unsigned char)rawstr[4] == PACKET_A_INIT && (unsigned char)rawstr[5] == PACKET_F_INIT)) | |
return rawstr; | |
std::string str = this->DickWinderE(rawstr); | |
std::string newstr; | |
int length = str.length(); | |
- int i = 2; | |
- int ii = 2; | |
+ int i = 4; | |
+ int ii = 4; | |
newstr.resize(length); | |
- newstr[0] = str[0]; | |
- newstr[1] = str[1]; | |
+ newstr[0] = str[0]; | |
+ newstr[1] = str[1]; | |
+ newstr[2] = str[2]; | |
+ newstr[3] = str[3]; | |
while (i < length) | |
{ | |
@@ -203,13 +205,13 @@ std::string PacketProcessor::Encode(const std::string &rawstr) | |
--i; | |
} | |
- while (i >= 2) | |
+ while (i >= 4) | |
{ | |
newstr[i] = (unsigned char)str[ii++] ^ 0x80; | |
i -= 2; | |
} | |
- for (int i = 2; i < length; ++i) | |
+ for (int i = 4; i < length; ++i) | |
{ | |
if (static_cast<unsigned char>(newstr[i]) == 128) | |
{ | |
@@ -678,12 +680,14 @@ void PacketBuilder::Reset(std::size_t size_guess) | |
std::string PacketBuilder::Get() const | |
{ | |
std::string retdata; | |
- retdata.reserve(4 + this->data.length()); | |
+ retdata.reserve(6 + this->data.length()); | |
std::array<unsigned char, 2> id = PacketProcessor::EPID(this->id); | |
- std::array<unsigned char, 4> length = PacketProcessor::ENumber(this->data.length() + 2 + this->add_size); | |
+ std::array<unsigned char, 4> length = PacketProcessor::ENumber(this->data.length() + 4 + this->add_size); | |
- retdata += length[0]; | |
- retdata += length[1]; | |
+ retdata += length[0]; | |
+ retdata += length[1]; | |
+ retdata += length[2]; | |
+ retdata += length[3]; | |
retdata += id[0]; | |
retdata += id[1]; | |
retdata += this->data; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment