|
OpenCoD2-Plus
Call of Duty 2 client & server, rebuilt
|
Classes | |
| class | MsgWriter |
| class | Client |
Functions | |
| huffman_compress (data) | |
| huffman_decompress (data) | |
| xor_codec (data, key, string) | |
| hash_key (string, maxlen=32) | |
Variables | |
| str | PREFIX = b'\xff\xff\xff\xff' |
| str | HUFFMAN_CODES |
| dict | HUFFMAN_SYMBOLS = {code: symbol for symbol, code in enumerate(HUFFMAN_CODES)} |
| int | FRAGMENT_SIZE = 1300 |
| int | FRAGMENT_BIT = 1 << 31 |
| int | CLC_MOVE_NO_DELTA = 1 |
| int | CLC_CLIENT_COMMAND = 2 |
| int | CLC_EOF = 3 |
| int | KEY_MASK_MOVE_FORWARD = 1 |
A minimal CoD2 client for tests. It speaks just enough of the protocol to take a client slot, receive the gamestate, enter the game and send client commands and moves through the same path as a real player: netchan (including fragments both ways), the XOR keys, Huffman compression, SV_ClientCommand and SV_UserMove. Server messages are parsed by cod2snap: read_frames returns the snapshots and server commands.
| cod2client.hash_key | ( | string, | |
| maxlen = 32 ) |
Com_HashKey, with the signed chars of the server.
| cod2client.huffman_compress | ( | data | ) |
| cod2client.huffman_decompress | ( | data | ) |
Decodes until the input runs out; a symbol cut short by the end of the input (the padding of the last byte) is dropped, as the server does.
| cod2client.xor_codec | ( | data, | |
| key, | |||
| string ) |
SV_Netchan_Encode / SV_Netchan_Decode: the key is changed by each byte of a command string both sides know, cycling through it.
| int cod2client.CLC_CLIENT_COMMAND = 2 |
| int cod2client.CLC_EOF = 3 |
| int cod2client.CLC_MOVE_NO_DELTA = 1 |
| int cod2client.FRAGMENT_BIT = 1 << 31 |
| int cod2client.FRAGMENT_SIZE = 1300 |
| str cod2client.HUFFMAN_CODES |
| dict cod2client.HUFFMAN_SYMBOLS = {code: symbol for symbol, code in enumerate(HUFFMAN_CODES)} |
| int cod2client.KEY_MASK_MOVE_FORWARD = 1 |
| str cod2client.PREFIX = b'\xff\xff\xff\xff' |