• Welcome to Valhalla Legends Archive.
 

D2GS Packet Lengths

Started by BrainScan, December 02, 2004, 03:25 PM

Previous topic - Next topic

BrainScan

Does anyone have the D2GS Packet Length Tables that they are willing to share?

Also, a question about huffman compression.
Suppose a compression ends up in a length of bits that is not divisible by 8... (eg 12 bits) I assume that this must be padded at the end with 0's right? how does this affect the resulting packet when i's decompressed?

UserLoser.

#1
If you're doing any disassembly, check D2Net.dll around:

.text:6FC01423 GetPacketSize
.data:6FC08148 ReceivePacketSizeTable

Edit:
If someone sends me D2Net.dll [seems brother took d2 cds when he went away to school], I'll translate the tables nicely~

BrainScan

Quote from: UserLoser on December 02, 2004, 05:38 PM
If someone sends me D2Net.dll [seems brother took d2 cds when he went away to school], I'll translate the tables nicely~

I would gladly send it to you. It would help me out a lot seeing as I'm not great at dissasembly quite yet. How should I send it to you?

Thanks
-BrainScan

OnlyMeat

d2net.dll is actually surprisingly easy to decipher, just do a search in ida for the std berkley recv call and you can find all the major functions from there, well thats how i did it anyways you dont need to know asm that well to work out most of it just the basic op codes and how the stack works etc. You can lookup the more advanced op codes up as you go along, also writing a few basic c++ apps ( without any framework support) then decompiling/analysing the output gives you a good idea of compiler optimizations ( it's worth trying out different optimizations i.e speed vs size to see what the differences produce ).


OnlyMeat

#4
I found a script i did a while back to format them if this helps, userloser can confirm if they are right.

Note the variable length packets are ommited.

Formatted as a c++ table:-

unsigned char D2GS_PktSize_Table[] = {
0x01,0x08,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x0C,0x00,0x00,
0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,
0x00,0x06,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x0B,0x00,0x00,
0x00,0x06,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x09,0x00,0x00,
0x00,0x0D,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,0x10,0x00,0x00,
0x00,0x10,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x1A,0x00,0x00,
0x00,0x0E,0x00,0x00,0x00,0x12,0x00,0x00,0x00,0x0B,0x00,0x00,
0x00,0x0FF,0x0FF,0x0FF,0x0FF,0x00,0x00,0x00,0x00,0x0F,0x00,0x00,
0x00,0x02,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x03,0x00,0x00,
0x00,0x05,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x04,0x00,0x00,
0x00,0x06,0x00,0x00,0x00,0x0A,0x00,0x00,0x00,0x0C,0x00,0x00,
0x00,0x0C,0x00,0x00,0x00,0x0D,0x00,0x00,0x00,0x5A,0x00,0x00,
0x00,0x5A,0x00,0x00,0x00,0x0FF,0x0FF,0x0FF,0x0FF,0x28,0x00,0x00,
0x00,0x67,0x00,0x00,0x00,0x61,0x00,0x00,0x00,0x0F,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x08,0x00
};


Just a simple listing with associated packet ID:-


Packet: 0x00 Length: 0x01
Packet: 0x01 Length: 0x08
Packet: 0x05 Length: 0x01
Packet: 0x9 Length: 0x0C
Packet: 0x0D Length: 0x01
Packet: 0x011 Length: 0x01
Packet: 0x015 Length: 0x01
Packet: 0x019 Length: 0x06
Packet: 0x01D Length: 0x06
Packet: 0x21 Length: 0x0B
Packet: 0x025 Length: 0x06
Packet: 0x029 Length: 0x06
Packet: 0x02D Length: 0x09
Packet: 0x31 Length: 0x0D
Packet: 0x35 Length: 0x0C
Packet: 0x39 Length: 0x10
Packet: 0x3D Length: 0x10
Packet: 0x041 Length: 0x08
Packet: 0x45 Length: 0x1A
Packet: 0x49 Length: 0x0E
Packet: 0x4D Length: 0x12
Packet: 0x51 Length: 0x0B
Packet: 0x55 Length: 0x0FF
Packet: 0x56 Length: 0x0FF
Packet: 0x57 Length: 0x0FF
Packet: 0x58 Length: 0x0FF
Packet: 0x5D Length: 0x0F
Packet: 0x061 Length: 0x02
Packet: 0x065 Length: 0x02
Packet: 0x069 Length: 0x03
Packet: 0x06D Length: 0x05
Packet: 0x071 Length: 0x03
Packet: 0x075 Length: 0x04
Packet: 0x079 Length: 0x06
Packet: 0x7D Length: 0x0A
Packet: 0x81 Length: 0x0C
Packet: 0x85 Length: 0x0C
Packet: 0x89 Length: 0x0D
Packet: 0x8D Length: 0x5A
Packet: 0x91 Length: 0x5A
Packet: 0x95 Length: 0x0FF
Packet: 0x96 Length: 0x0FF
Packet: 0x97 Length: 0x0FF
Packet: 0x98 Length: 0x0FF
Packet: 0x99 Length: 0x28
Packet: 0x9D Length: 0x67
Packet: 0xA1 Length: 0x61
Packet: 0xA5 Length: 0x0F
Packet: 0x0AD Length: 0x08


Edit: Oops Script had a couple of bugs in it think it's fixed now enjoy :)

UserLoser.

IIRC, there's no packet with an id of the message greater than 0xAE.; and the id is an 8-bit value

BrainScan

Quote from: UserLoser on December 03, 2004, 04:49 PM
IIRC, there's no packet with an id of the message greater than 0xAE.; and the id is an 8-bit value

So, does that mean that this table here is wrong?

UserLoser, are you still willing to take a look at my D2Net.dll?

UserLoser.

Quote from: BrainScan on December 04, 2004, 04:35 PM
Quote from: UserLoser on December 03, 2004, 04:49 PM
IIRC, there's no packet with an id of the message greater than 0xAE.; and the id is an 8-bit value

So, does that mean that this table here is wrong?

UserLoser, are you still willing to take a look at my D2Net.dll?

This is on my list of things to re-do.  Been busy lately, havn't had much time or been home much.  I already got D2Net.dll from someone else, though.

Skywing

Quote from: UserLoser on December 03, 2004, 04:49 PM
IIRC, there's no packet with an id of the message greater than 0xAE.; and the id is an 8-bit value
I think those are used for open games instead of realm games.

botmaster


WORD table[256][9] = {
{0x0008,0x0b2f,0x0b4f,0x0b54,0x0b5c,0x0b71,0x0b7b,0x0b84,0x0b85},
{0x0008,0x0b86,0x0b87,0x0b88,0x0b8b,0x0b8c,0x0b8d,0x0b8e,0x0b91},
{0x0008,0x0b92,0x0b94,0x0b99,0x0b9a,0x0b9b,0x0b9c,0x0b9d,0x0b9e},
{0x0008,0x0b9f,0x0ba1,0x0ba3,0x0ba4,0x0ba5,0x0ba6,0x0ba7,0x0ba8},
{0x0008,0x0ba9,0x0baa,0x0bab,0x0bac,0x0bad,0x0bae,0x0baf,0x0bb1},
{0x0008,0x0bb2,0x0bb3,0x0bb4,0x0bb5,0x0bb6,0x0bb7,0x0bb9,0x0bba},
{0x0008,0x0bbb,0x0bbc,0x0bbd,0x0bbe,0x0bbf,0x0bc1,0x0bc3,0x0bc4},
{0x0008,0x0bc5,0x0bc6,0x0bc7,0x0bc8,0x0bc9,0x0bca,0x0bcb,0x0bcc},
{0x0008,0x0bcd,0x0bcf,0x0bd0,0x0bd1,0x0bd2,0x0bd3,0x0bd4,0x0bd5},
{0x0008,0x0bd6,0x0bd7,0x0bd8,0x0bd9,0x0bda,0x0bdb,0x0bdc,0x0bdd},
{0x0008,0x0bde,0x0bdf,0x0be1,0x0be3,0x0be4,0x0be5,0x0be6,0x0be7},
{0x0008,0x0be9,0x0bea,0x0beb,0x0bec,0x0bed,0x0bee,0x0bef,0x0bf1},
{0x0008,0x0bf2,0x0bf3,0x0bf4,0x0bf5,0x0bf6,0x0bf7,0x0bf9,0x0bfa},
{0x0008,0x0bfb,0x0bfc,0x0bfd,0x0bfe,0x0a1b,0x0a1b,0x0a1c,0x0a1c},
{0x0004,0x0a21,0x0a22,0x0a23,0x0a24,0x0000,0x0000,0x0000,0x0000},
{0x0004,0x0a26,0x0a27,0x0a29,0x0a2a,0x0000,0x0000,0x0000,0x0000},
{0x0004,0x0a2b,0x0a2c,0x0a2d,0x0a2e,0x0000,0x0000,0x0000,0x0000},
{0x0004,0x0a32,0x0a33,0x0a34,0x0a35,0x0000,0x0000,0x0000,0x0000},
{0x0004,0x0a36,0x0a37,0x0a38,0x0a39,0x0000,0x0000,0x0000,0x0000},
{0x0004,0x0a3a,0x0a3c,0x0a3d,0x0a3e,0x0000,0x0000,0x0000,0x0000},
{0x0004,0x0a3f,0x0a41,0x0a42,0x0a44,0x0000,0x0000,0x0000,0x0000},
{0x0004,0x0a46,0x0a47,0x0a48,0x0a49,0x0000,0x0000,0x0000,0x0000},
{0x0004,0x0a4a,0x0a4b,0x0a4e,0x0a53,0x0000,0x0000,0x0000,0x0000},
{0x0004,0x0a57,0x0a59,0x0a5a,0x0a5b,0x0000,0x0000,0x0000,0x0000},
{0x0004,0x0a5d,0x0a5e,0x0a5f,0x0a60,0x0000,0x0000,0x0000,0x0000},
{0x0004,0x0a61,0x0a65,0x0a66,0x0a6a,0x0000,0x0000,0x0000,0x0000},
{0x0004,0x0a6e,0x0a6f,0x0a70,0x0a72,0x0000,0x0000,0x0000,0x0000},
{0x0004,0x0a73,0x0a74,0x0a75,0x0a76,0x0000,0x0000,0x0000,0x0000},
{0x0004,0x0a77,0x0a78,0x0a79,0x0a7a,0x0000,0x0000,0x0000,0x0000},
{0x0004,0x0a7c,0x0a7d,0x0a7e,0x0a7f,0x0000,0x0000,0x0000,0x0000},
{0x0004,0x0a81,0x0a82,0x0a83,0x0a89,0x0000,0x0000,0x0000,0x0000},
{0x0004,0x0a8a,0x0a8f,0x0a93,0x0a98,0x0000,0x0000,0x0000,0x0000},
{0x0004,0x0aa0,0x0aa2,0x0ab0,0x0ab8,0x0000,0x0000,0x0000,0x0000},
{0x0004,0x0ac0,0x0ac2,0x0ace,0x0ae0,0x0000,0x0000,0x0000,0x0000},
{0x0004,0x0ae2,0x0ae8,0x0af0,0x0af8,0x0000,0x0000,0x0000,0x0000},
{0x0002,0x090e,0x0919,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0002,0x091a,0x0925,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0002,0x0928,0x0930,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0002,0x0931,0x093b,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0002,0x0940,0x0943,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0002,0x0945,0x094c,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0002,0x094d,0x0950,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0002,0x0952,0x0955,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0002,0x0956,0x0958,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0002,0x0962,0x0963,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0002,0x0964,0x096b,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0002,0x0990,0x0995,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0002,0x0996,0x0997,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0809,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x080b,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x080c,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x080f,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0810,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0811,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0816,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0817,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0818,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x081d,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x081f,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0820,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0851,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x086c,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0703,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0703,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0704,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0704,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0706,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0706,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0707,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0707,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0708,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0708,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x070a,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x070a,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x070d,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x070d,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0712,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0712,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0715,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0715,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x071e,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x071e,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0767,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0767,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0768,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0768,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0769,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0769,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x076d,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x076d,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0780,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0780,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0602,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0602,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0602,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0602,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0605,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0605,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0605,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0605,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0613,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0613,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0613,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0613,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0614,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0614,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0614,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0614,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x06ff,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x06ff,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x06ff,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x06ff,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0401,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0401,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0401,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0401,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0401,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0401,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0401,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0401,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0401,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0401,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0401,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0401,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0401,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0401,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0401,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0401,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000},
{0x0001,0x0100,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000}};

WORD InvTable[256][2];

DWORD aMasks[] = {0x0, 0x1, 0x3, 0x7, 0xF, 0x1F, 0x3F, 0x7F, 0xFF,
0x1FF, 0x3FF, 0x7FF, 0xFFF, 0x1FFF, 0x3FFF, 0x7FFF, 0xFFFF};


BrainScan

hey botmaster, nice table.....   ::)  What is it?

I feel like I should know what to do with it, but I'm drawing a blank. I'm assuming that it has to do with the packet lengths, but thats as far as I am able to get. Would you mind explaining it a little?

botmaster

#11
you really don't need to know the lengths what I post is part of the decompression.


*Edit*
I fixed my problem ;)

BrainScan

Quote from: botmaster on December 08, 2004, 06:15 PM
you really don't need to know the lengths

Since almost all of the D2GS packets are fixed length, it's good to know the length so you can verify it. Also I've heard that serveral server packets can be clumped into one compressed packet, so you need to know the length of a packet reletive to it's packet ID to seperate the clumps.

This is my understanding of it at least. If I'm wrong, someone please let me know.

Skywing

You will want the packet length table and the variable packet length calculator function if you aren't going to handle every packet with the assumption that each handler knows how long it's packet is.  IIRC, messages with length 0xFF in the table have a variable length that you need to determine based on the message contents (usually embedded strings or a count of items, that sort of thing).