Valhalla Legends Archive

Programming => Battle.net Bot Development => Topic started by: Brand.X on February 13, 2003, 11:02 AM

Title: In-Game Packet Decompression
Post by: Brand.X on February 13, 2003, 11:02 AM
This code is based on a disassembly from fog.dll.

Quote//----------------------------------------------------------------------
// Packet Decompression Tables
//----------------------------------------------------------------------

unsigned int CharIndex[] = {
    0x0247, 0x0236, 0x0225, 0x0214, 0x0203, 0x01F2, 0x01E1, 0x01D0,
    0x01BF, 0x01AE, 0x019D, 0x018C, 0x017B, 0x016A, 0x0161, 0x0158,
    0x014F, 0x0146, 0x013D, 0x0134, 0x012B, 0x0122, 0x0119, 0x0110,
    0x0107, 0x00FE, 0x00F5, 0x00EC, 0x00E3, 0x00DA, 0x00D1, 0x00C8,
    0x00BF, 0x00B6, 0x00AD, 0x00A8, 0x00A3, 0x009E, 0x0099, 0x0094,
    0x008F, 0x008A, 0x0085, 0x0080, 0x007B, 0x0076, 0x0071, 0x006C,
    0x0069, 0x0066, 0x0063, 0x0060, 0x005D, 0x005A, 0x0057, 0x0054,
    0x0051, 0x004E, 0x004B, 0x0048, 0x0045, 0x0042, 0x003F, 0x003F,
    0x003C, 0x003C, 0x0039, 0x0039, 0x0036, 0x0036, 0x0033, 0x0033,
    0x0030, 0x0030, 0x002D, 0x002D, 0x002A, 0x002A, 0x0027, 0x0027,
    0x0024, 0x0024, 0x0021, 0x0021, 0x001E, 0x001E, 0x001B, 0x001B,
    0x0018, 0x0018, 0x0015, 0x0015, 0x0012, 0x0012, 0x0012, 0x0012,
    0x000F, 0x000F, 0x000F, 0x000F, 0x000C, 0x000C, 0x000C, 0x000C,
    0x0009, 0x0009, 0x0009, 0x0009, 0x0006, 0x0006, 0x0006, 0x0006,
    0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003,
    0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003,
    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000
};


unsigned char CharTable[] = {
    0x00,0x00,0x01,0x00,0x01,0x04,0x00,0xFF,0x06,0x00,0x14,0x06,
    0x00,0x13,0x06,0x00,0x05,0x06,0x00,0x02,0x06,0x00,0x80,0x07,
    0x00,0x6D,0x07,0x00,0x69,0x07,0x00,0x68,0x07,0x00,0x67,0x07,
    0x00,0x1E,0x07,0x00,0x15,0x07,0x00,0x12,0x07,0x00,0x0D,0x07,
    0x00,0x0A,0x07,0x00,0x08,0x07,0x00,0x07,0x07,0x00,0x06,0x07,
    0x00,0x04,0x07,0x00,0x03,0x07,0x00,0x6C,0x08,0x00,0x51,0x08,
    0x00,0x20,0x08,0x00,0x1F,0x08,0x00,0x1D,0x08,0x00,0x18,0x08,
    0x00,0x17,0x08,0x00,0x16,0x08,0x00,0x11,0x08,0x00,0x10,0x08,
    0x00,0x0F,0x08,0x00,0x0C,0x08,0x00,0x0B,0x08,0x00,0x09,0x08,
    0x01,0x96,0x09,0x97,0x09,0x01,0x90,0x09,0x95,0x09,0x01,0x64,
    0x09,0x6B,0x09,0x01,0x62,0x09,0x63,0x09,0x01,0x56,0x09,0x58,
    0x09,0x01,0x52,0x09,0x55,0x09,0x01,0x4D,0x09,0x50,0x09,0x01,
    0x45,0x09,0x4C,0x09,0x01,0x40,0x09,0x43,0x09,0x01,0x31,0x09,
    0x3B,0x09,0x01,0x28,0x09,0x30,0x09,0x01,0x1A,0x09,0x25,0x09,
    0x01,0x0E,0x09,0x19,0x09,0x02,0xE2,0x0A,0xE8,0x0A,0xF0,0x0A,
    0xF8,0x0A,0x02,0xC0,0x0A,0xC2,0x0A,0xCE,0x0A,0xE0,0x0A,0x02,
    0xA0,0x0A,0xA2,0x0A,0xB0,0x0A,0xB8,0x0A,0x02,0x8A,0x0A,0x8F,
    0x0A,0x93,0x0A,0x98,0x0A,0x02,0x81,0x0A,0x82,0x0A,0x83,0x0A,
    0x89,0x0A,0x02,0x7C,0x0A,0x7D,0x0A,0x7E,0x0A,0x7F,0x0A,0x02,
    0x77,0x0A,0x78,0x0A,0x79,0x0A,0x7A,0x0A,0x02,0x73,0x0A,0x74,
    0x0A,0x75,0x0A,0x76,0x0A,0x02,0x6E,0x0A,0x6F,0x0A,0x70,0x0A,
    0x72,0x0A,0x02,0x61,0x0A,0x65,0x0A,0x66,0x0A,0x6A,0x0A,0x02,
    0x5D,0x0A,0x5E,0x0A,0x5F,0x0A,0x60,0x0A,0x02,0x57,0x0A,0x59,
    0x0A,0x5A,0x0A,0x5B,0x0A,0x02,0x4A,0x0A,0x4B,0x0A,0x4E,0x0A,
    0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xC3,0x0B,0xC4,0x0B,0x03,0xB2,0x0B,0xB3,0x0B,0xB4,
    0x0B,0xB5,0x0B,0xB6,0x0B,0xB7,0x0B,0xB9,0x0B,0xBA,0x0B,0x03,
    0xA9,0x0B,0xAA,0x0B,0xAB,0x0B,0xAC,0x0B,0xAD,0x0B,0xAE,0x0B,
    0xAF,0x0B,0xB1,0x0B,0x03,0x9F,0x0B,0xA1,0x0B,0xA3,0x0B,0xA4,
    0x0B,0xA5,0x0B,0xA6,0x0B,0xA7,0x0B,0xA8,0x0B,0x03,0x92,0x0B,
    0x94,0x0B,0x99,0x0B,0x9A,0x0B,0x9B,0x0B,0x9C,0x0B,0x9D,0x0B,
    0x9E,0x0B,0x03,0x86,0x0B,0x87,0x0B,0x88,0x0B,0x8B,0x0B,0x8C,
    0x0B,0x8D,0x0B,0x8E,0x0B,0x91,0x0B,0x03,0x2F,0x0B,0x4F,0x0B,
    0x54,0x0B,0x5C,0x0B,0x71,0x0B,0x7B,0x0B,0x84,0x0B,0x85,0x0B
};

unsigned int BitMasks[] = {
    0x0000,0x0001,0x0003,0x0007,0x000F,0x001F,0x003F,0x007F,
    0x00FF,0x01FF,0x03FF,0x07FF,0x0FFF,0x1FFF,0x3FFF,0x7FFF
};

//----------------------------------------------------------------------
// GamePacketSize
//   Calculates the size of a compressed game packet.
//  
// data: [in] pointer to received packet
// size: [out] pointer to size
// returns: the offset to the data.
//----------------------------------------------------------------------

unsigned char *GamePacketSize(unsigned char *data, unsigned int *size,
                              unsigned int *offset)
{
    unsigned int a;

    if (data[0] < 0xF0) {
        *size = data[0] - 1;
        *offset = 1;
        return &data[1];
    }

    a = (data[0] & 0xF) << 8;
    *size = a + data[1] - 2;
    *offset = 2;
    return &data[2];
}

//----------------------------------------------------------------------
// GamePacketDecode
//   Decompress a d2gs packet into data.
//   Note: packets come in clumps. A single compressed packet may have
//   several game packets, and its up to you to figure it out.
//
// indata: [in] compressed packet (without size byte)
// insize: [in] length of indata
// outdata: [out] output buffer
// outmax: [in] size of output buffer
// outsize: [out] location to store size of decoded data
// returns: 1 on successf decode, 0 if not enough room
//----------------------------------------------------------------------

int GamePacketDecode(unsigned char *indata, unsigned int insize,
                     unsigned char *outdata, unsigned int outmax,
                     unsigned int *outsize)
{
    unsigned int a, b, c, d;
    unsigned int maxcnt, index, cnt;
    unsigned char *outptr, *inptr;
    int size;

    b = 0;

    size = insize;
    inptr = indata;

    maxcnt = outmax;
    outptr = outdata;
    cnt = 0x20;

    while (1) {

        if (cnt >= 0x8) {
            while (size > 0 && cnt >= 8) {
                cnt -= 0x8;
                size--;
                a = *inptr++ << cnt;
                b |= a;
            };
        }

        index = CharIndex[b >> 0x18];
        a = CharTable[index];
        d = (b >> (0x18 - a)) & BitMasks[a];
        c = CharTable[index + 2*d + 2];

        cnt += c;
        if (cnt > 0x20) {
            *outsize = outmax - maxcnt;
            return 1;
        }

        if (maxcnt-- == 0)
            return 0;

        a = CharTable[index + 2*d + 1];
        *outptr++ = (unsigned char)a;

        b <<= (c & 0xFF);
    }

    assert(0);
    return 0;
}

Title: Re: In-Game Packet Decompression
Post by: dxoigmn on February 13, 2003, 12:19 PM
Ahh...nice.  I was looking into this but my skill at converting ASM to C++ is horrible.  Thanks ;).
Title: Re: In-Game Packet Decompression
Post by: talon60k on February 14, 2003, 02:44 AM
nice!
Title: Re: In-Game Packet Decompression
Post by: Brand.X on February 15, 2003, 07:19 AM
The work was mostly stepping through function calls with SoftICE trying to find where decompression was happening. And the dumping of the memory which contained the tables. It was a lot easier than I expected; thanks to Blizzard's clean code.

People had this information before but kept it private. Not mentioning any names, but I hope it will speed up bot development in general.
Title: Re: In-Game Packet Decompression
Post by: l)ragon on February 15, 2003, 12:51 PM
QuoteThe work was mostly stepping through function calls with SoftICE trying to find where decompression was happening. And the dumping of the memory which contained the tables. It was a lot easier than I expected; thanks to Blizzard's clean code.

People had this information before but kept it private. Not mentioning any names, but I hope it will speed up bot development in general.

it was not private it is in the hackit source code if i remember correctly.

Title: Re: In-Game Packet Decompression
Post by: l)ragon on February 15, 2003, 01:17 PM
in any case maybe someone will sticky this thread due to the point lots of people were looking for this.

maybe we will see some d2gs talk now ^^
Title: Re: In-Game Packet Decompression
Post by: Noodlez on February 15, 2003, 04:33 PM
now im not special anymore :(

dragon it was private, d2hackit intercepted packets after they were decompressed. oh well, atleast my gamebots done :P
Title: Re: In-Game Packet Decompression
Post by: l)ragon on February 15, 2003, 05:42 PM
Quotenow im not special anymore :(

dragon it was private, d2hackit intercepted packets after they were decompressed. oh well, atleast my gamebots done :P

you'll get over it. :P

to anyone that can see the decompressed data, PM me.

kthx
Title: Re: In-Game Packet Decompression
Post by: talon60k on February 17, 2003, 03:45 PM
Quotenow im not special anymore :(

dragon it was private, d2hackit intercepted packets after they were decompressed. oh well, atleast my gamebots done :P

when u gonna release it tho ?

yeah, that decompression was private, i figured out my own version also. my bots pretty much done tho also, so hopefully there wont be too many bots!
Title: Re: In-Game Packet Decompression
Post by: Noodlez on February 19, 2003, 07:22 PM
and maybe when your communist ass dies ill spit on your grave
Title: Re: In-Game Packet Decompression
Post by: talon60k on February 20, 2003, 04:38 PM
Quoteand maybe when your communist ass dies ill spit on your grave

lmao, me or dragon ?
Title: Re: In-Game Packet Decompression
Post by: c0ke on February 20, 2003, 05:05 PM
Quotenow im not special anymore :(

dragon it was private, d2hackit intercepted packets after they were decompressed. oh well, atleast my gamebots done :P

Noodlez; special because you were given first Yobguls', then Talon's decompression source?

(sorry in advance, this is for flaming me on blizzhackers)
Title: Re: In-Game Packet Decompression
Post by: Noodlez on February 20, 2003, 05:47 PM
talon, was talking to warz  not you :p
but he removed his post, guess he didn't want people to see it.
Title: Re:In-Game Packet Decompression
Post by: l)ragon on May 31, 2003, 02:44 AM
/me kicks topic back to the top of the list

This is a rather usefull topic.
Would someone Pin it or some thing along with the .BNI tut. Kain posted this way there both up at the top and noone asks + then theres also no need to search it out 8p

Quote from: laurion on May 31, 2003, 06:14 AM
Quote from: dRAgoN on May 31, 2003, 02:44 AM
/me kicks topic back to the top of the list

This is a rather usefull topic.
Would someone Pin it or some thing along with the .BNI tut. Kain posted this way there both up at the top and noone asks + then theres also no need to search it out 8p
the BNI tut is on http://botdev.valhallalegends.com/

forgot about that
Title: Re:In-Game Packet Decompression
Post by: Tazo on May 31, 2003, 06:14 AM
Quote from: dRAgoN on May 31, 2003, 02:44 AM
/me kicks topic back to the top of the list

This is a rather usefull topic.
Would someone Pin it or some thing along with the .BNI tut. Kain posted this way there both up at the top and noone asks + then theres also no need to search it out 8p
the BNI tut is on http://botdev.valhallalegends.com/
Title: Re:In-Game Packet Decompression
Post by: tA-Kane on June 02, 2003, 02:35 PM
Quote from: dRAgoN on May 31, 2003, 02:44 AMWould someone Pin it along with the .BNI tut. Kain posted this way there both up at the top and noone asks + then theres also no need to search it out
I'm Kane by the way. Kain is someone else. There is a difference.

FYI, the file reference on BotDev has become invalid, as the file has moved to:
http://kbg3.ath.cx/misc/bni_file.shtml

Or, if you don't want to view the website's top and side panels, it's here:
http://kbg3.ath.cx/misc/bni_file.include

Additionally, BnetDocs has a document on the BNI file here:
http://www.valhallalegends.com/arta/bnetdocs/page.php?id=3
But, you should note that the BnetDocs one does not have the information on how to parse (render?) the embedded TGA image.
Title: Re:In-Game Packet Decompression
Post by: Skywing on June 02, 2003, 02:50 PM
Quote from: tA-Kane on June 02, 2003, 02:35 PM
Additionally, BnetDocs has a document on the BNI file here:
http://www.valhallalegends.com/arta/bnetdocs/page.php?id=3
But, you should note that the BnetDocs one does not have the information on how to parse (render?) the embedded TGA image.
That information is freely available on Truevision's FTP site (http://ftp://ftp.truevision.com).
Title: Re:In-Game Packet Decompression
Post by: l)ragon on June 02, 2003, 10:05 PM
Quote from: tA-Kane on June 02, 2003, 02:35 PM
Quote from: dRAgoN on May 31, 2003, 02:44 AMWould someone Pin it along with the .BNI tut. Kain posted this way there both up at the top and noone asks + then theres also no need to search it out
I'm Kane by the way. Kain is someone else. There is a difference.

FYI, the file reference on BotDev has become invalid, as the file has moved to:
http://kbg3.ath.cx/misc/bni_file.shtml

Or, if you don't want to view the website's top and side panels, it's here:
http://kbg3.ath.cx/misc/bni_file.include

Additionally, BnetDocs has a document on the BNI file here:
http://www.valhallalegends.com/arta/bnetdocs/page.php?id=3
But, you should note that the BnetDocs one does not have the information on how to parse (render?) the embedded TGA image.

were all not perfect 8p
'typo' you all know who i ment.

i was just pointing out some topics to pin up, noticed your info up on botdev but forgot about it
Title: Re:In-Game Packet Decompression
Post by: smoke on August 20, 2003, 11:33 PM
[removed comment since it was mostly wrong]

-smoke
Title: Re:In-Game Packet Decompression
Post by: smoke on August 21, 2003, 10:59 PM
my mistake...

The original table is actually correct.  Blizzard treats those two values a little strangely to save 1 bit on each.  I'm not sure where the bug is in my compression table generator at the moment the inconsistancy to occur.  After fiddling with it for a while, I did manage to get my compression code to generate compressed data compatible with the original decompression code (tables).

-smoke

note: the 2 values talked about here were a couple of bytes that are slightly abnormal.  they caused some headaches in generating a valid compression table.  of course, that all means pretty much nil since I found the compression and decompression tables in the diablo ii memory space for 1.10s. (see below)
Title: Re:In-Game Packet Decompression
Post by: Skywing on August 21, 2003, 11:39 PM
Quote from: smoke on August 21, 2003, 10:59 PM
my mistake...

The original table is actually correct.  Blizzard treats those two values a little strangely to save 1 bit on each.  I'm not sure where the bug is in my compression table generator at the moment the inconsistancy to occur.  After fiddling with it for a while, I did manage to get my compression code to generate compressed data compatible with the original decompression code (tables).

-smoke
There are indeed several bugs in the D2 packet decompressor code floating around - and you're right about them not being with the table itself.

You ought to be able to find them without too much trouble if you try to understand what all of the code does.
Title: Re:In-Game Packet Decompression
Post by: smoke on August 22, 2003, 04:13 AM
I just extracted all of the tables from memory of the 1.10s client.  They are all pretty much identical.  I also took the liberty of grabbing the huffman code table if you are interested in doing the compression.


HuffmanCodes:
01 07 17 1f 20 18 21 22 23 30 24 31 32 25 46 33  
34 35 26 19 1a 27 36 37 38 47 48 36 37 39 28 3a  
3b 38 39 3a 3b 49 3c 3d 4a 3e 3f 40 41 42 43 00  
4b 4c 44 45 46 47 48 49 4a 4b 4c 4d 4d 4e 4f 50  
4e 51 52 4f 53 50 54 55 56 57 58 59 51 52 5a 01  
53 3c 54 5b 02 55 56 5c 57 5d 5e 5f 03 60 61 62  
63 64 58 59 5a 65 66 29 2a 2b 67 5b 3d 2c 68 69  
6a 04 6b 6c 6d 6e 6f 70 71 72 73 05 74 75 76 77  
2d 78 79 7a 06 07 08 09 0a 7b 7c 0b 0c 0d 0e 7d  
5c 0f 10 7e 11 5d 5e 5f 7f 12 13 14 15 16 17 18  
80 19 81 1a 1b 1c 1d 1e 1f 20 21 22 23 24 25 26  
82 27 28 29 2a 2b 2c 2d 83 2e 2f 30 31 32 33 34  
84 35 85 36 37 38 39 3a 3b 3c 3d 3e 3f 40 86 41  
42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f 50 51  
87 52 88 53 54 55 56 57 89 58 59 5a 5b 5c 5d 5e  
8a 5f 60 61 62 63 64 65 8b 66 67 68 69 6a 6b 1b

BitMasks:
00000000 00000001 00000003 00000007 0000000f 0000001f 0000003f 0000007f  
000000ff 000001ff 000003ff 000007ff 00000fff 00001fff 00003fff 00007fff

HuffmanLengths:
01 04 06 07 07 06 07 07 07 08 07 08 08 07 09 08  
08 08 07 06 06 07 08 08 08 09 09 0a 0a 08 07 08  
08 0a 0a 0a 0a 09 0a 0a 09 0a 0a 0a 0a 0a 0a 0b  
09 09 0a 0a 0a 0a 0a 0a 0a 0a 0a 09 0a 0a 0a 0a  
09 0a 0a 09 0a 09 0a 0a 0a 0a 0a 0a 09 09 0a 0b  
09 08 09 0a 0b 09 09 0a 09 0a 0a 0a 0b 0a 0a 0a  
0a 0a 09 09 09 0a 0a 07 07 07 0a 09 08 07 0a 0a  
0a 0b 0a 0a 0a 0a 0a 0a 0a 0a 0a 0b 0a 0a 0a 0a  
07 0a 0a 0a 0b 0b 0b 0b 0b 0a 0a 0b 0b 0b 0b 0a  
09 0b 0b 0a 0b 09 09 09 0a 0b 0b 0b 0b 0b 0b 0b  
0a 0b 0a 0b 0b 0b 0b 0b 0b 0b 0b 0b 0b 0b 0b 0b  
0a 0b 0b 0b 0b 0b 0b 0b 0a 0b 0b 0b 0b 0b 0b 0b  
0a 0b 0a 0b 0b 0b 0b 0b 0b 0b 0b 0b 0b 0b 0a 0b  
0b 0b 0b 0b 0b 0b 0b 0b 0b 0b 0b 0b 0b 0b 0b 0b  
0a 0b 0a 0b 0b 0b 0b 0b 0a 0b 0b 0b 0b 0b 0b 0b  
0a 0b 0b 0b 0b 0b 0b 0b 0a 0b 0b 0b 0b 0b 0b 06

CharTable (Base Address -> 0x6ff9f8b8):
00 00
00 01
00 ff
00 14
00 13
00 05
00 02
00 80
00 6d
00 69
00 68
00 67
00 1e
00 15
00 12
00 0d
00 0a  
00 08
00 07
00 06
00 04
00 03
00 6c
00 51
00 20
00 1f
00 1d
00 18
00 17
00 16
00 11
00 10
00 0f
00 0c
00 0b
00 09  
01 96 97
01 90 95
01 64 6b
01 62 63
01 56 58
01 52 55
01 4d 50
01 45 4c
01 40 43
01 31 3b
01 28 30
01 1a 25
01 0e 19
02 e2 e8 f0 f8
02 c0 c2 ce e0
02 a0 a2 b0 b8
02 8a 8f 93 98
02 81 82 83 89
02 7c 7d 7e 7f
02 77 78 79 7a
02 73 74 75 76
02 6e 6f 70 72
02 61 65 66 6a
02 5d 5e 5f 60
02 57 59 5a 5b
02 4a 4b 4e 53
02 46 47 48 49
02 3f 41 42 44  
02 3a 3c 3d 3e
02 36 37 38 39
02 32 33 34 35
02 2b 2c 2d 2e
02 26 27 29 2a
02 21 22 23 24
03 fb fc fd fe 1b 1b 1c 1c
03 f2 f3 f4 f5 f6 f7 f9 fa
03 e9 ea eb ec ed ee ef f1
03 de df e1 e3 e4 e5 e6 e7
03 d6 d7 d8 d9 da db dc dd
03 cd cf d0 d1 d2 d3 d4 d5
03 c5 c6 c7 c8 c9 ca cb cc
03 bb bc bd be bf c1 c3 c4
03 b2 b3 b4 b5 b6 b7 b9 ba
03 a9 aa ab ac ad ae af b1
03 9f a1 a3 a4 a5 a6 a7 a8
03 92 94 99 9a 9b 9c 9d 9e
03 86 87 88 8b 8c 8d 8e 91
03 2f 4f 54 5c 71 7b 84 85

CharIndex (Points to a row of the CharTable):
6ff9fa05 6ff9f9fc 6ff9f9f3 6ff9f9ea 6ff9f9e1 6ff9f9d8 6ff9f9cf 6ff9f9c6
6ff9f9bd 6ff9f9b4 6ff9f9ab 6ff9f9a2 6ff9f999 6ff9f990 6ff9f98b 6ff9f986
6ff9f981 6ff9f97c 6ff9f977 6ff9f972 6ff9f96d 6ff9f968 6ff9f963 6ff9f95e
6ff9f959 6ff9f954 6ff9f94f 6ff9f94a 6ff9f945 6ff9f940 6ff9f93b 6ff9f936
6ff9f931 6ff9f92c 6ff9f927 6ff9f924 6ff9f921 6ff9f91e 6ff9f91b 6ff9f918
6ff9f915 6ff9f912 6ff9f90f 6ff9f90c 6ff9f909 6ff9f906 6ff9f903 6ff9f900
6ff9f8fe 6ff9f8fc 6ff9f8fa 6ff9f8f8 6ff9f8f6 6ff9f8f4 6ff9f8f2 6ff9f8f0
6ff9f8ee 6ff9f8ec 6ff9f8ea 6ff9f8e8 6ff9f8e6 6ff9f8e4 6ff9f8e2 6ff9f8e2
6ff9f8e0 6ff9f8e0 6ff9f8de 6ff9f8de 6ff9f8dc 6ff9f8dc 6ff9f8da 6ff9f8da
6ff9f8d8 6ff9f8d8 6ff9f8d6 6ff9f8d6 6ff9f8d4 6ff9f8d4 6ff9f8d2 6ff9f8d2
6ff9f8d0 6ff9f8d0 6ff9f8ce 6ff9f8ce 6ff9f8cc 6ff9f8cc 6ff9f8ca 6ff9f8ca
6ff9f8c8 6ff9f8c8 6ff9f8c6 6ff9f8c6 6ff9f8c4 6ff9f8c4 6ff9f8c4 6ff9f8c4
6ff9f8c2 6ff9f8c2 6ff9f8c2 6ff9f8c2 6ff9f8c0 6ff9f8c0 6ff9f8c0 6ff9f8c0
6ff9f8be 6ff9f8be 6ff9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f8b8 6ff9f8b8 6ff9f8b8 6ff9f8b8
6ff9f8b8 6ff9f8b8 6ff9f8b8 6ff9f8b8 6ff9f8b8 6ff9f8b8 6ff9f8b8 6ff9f8b8
6ff9f8b8 6ff9f8b8 6ff9f8b8 6ff9f8b8 6ff9f8b8 6ff9f8b8 6ff9f8b8 6ff9f8b8
6ff9f8b8 6ff9f8b8 6ff9f8b8 6ff9f8b8 6ff9f8b8 6ff9f8b8 6ff9f8b8 6ff9f8b8
6ff9f8b8 6ff9f8b8 6ff9f8b8 6ff9f8b8 6ff9f8b8 6ff9f8b8 6ff9f8b8 6ff9f8b8


Note:
The decompression code posted here merged the HuffmanSizes table and the CharTable.
Title: Re:In-Game Packet Decompression
Post by: Lycaon on June 02, 2004, 12:23 AM
Can I talk someone into doing a quick VB port of the decompression function for me? c++ is definitely not my strong suit.
Title: Re:In-Game Packet Decompression
Post by: BinaryzL on June 02, 2004, 10:59 AM
I will probably be porting it to vb later.
Title: Re:In-Game Packet Decompression
Post by: UserLoser. on June 02, 2004, 01:13 PM
Quote from: Lycaon on June 02, 2004, 12:23 AM
Can I talk someone into doing a quick VB port of the decompression function for me? c++ is definitely not my strong suit.

This code is publically available via BnetAuth.dll - but beware, there's some some problems which may cause it to overflow or something and not work and crash your bot
Title: Re:In-Game Packet Decompression
Post by: Lycaon on June 04, 2004, 03:44 AM
I'll try the DLL til I either figure out why my ported VB function isn't working, or BinaryzL releases some code. I was hoping to get away from having to use extra DLLs.  :)

I was using the tables available from this thread (Brand.X's post).  Are those still valid or are there new/different ones with 1.10?
Title: Re:In-Game Packet Decompression
Post by: Lycaon on June 07, 2004, 09:39 AM
Nevermind, I got it converted.  Now I just have to redo my recv packet buffer :p