OpenCoD2-Plus
Call of Duty 2 client & server, rebuilt
Loading...
Searching...
No Matches
cod2client Namespace Reference

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

Detailed Description

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.

Function Documentation

◆ hash_key()

cod2client.hash_key ( string,
maxlen = 32 )
Com_HashKey, with the signed chars of the server.

◆ huffman_compress()

cod2client.huffman_compress ( data)

◆ huffman_decompress()

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.

◆ xor_codec()

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.

Variable Documentation

◆ CLC_CLIENT_COMMAND

int cod2client.CLC_CLIENT_COMMAND = 2

◆ CLC_EOF

int cod2client.CLC_EOF = 3

◆ CLC_MOVE_NO_DELTA

int cod2client.CLC_MOVE_NO_DELTA = 1

◆ FRAGMENT_BIT

int cod2client.FRAGMENT_BIT = 1 << 31

◆ FRAGMENT_SIZE

int cod2client.FRAGMENT_SIZE = 1300

◆ HUFFMAN_CODES

str cod2client.HUFFMAN_CODES

◆ HUFFMAN_SYMBOLS

dict cod2client.HUFFMAN_SYMBOLS = {code: symbol for symbol, code in enumerate(HUFFMAN_CODES)}

◆ KEY_MASK_MOVE_FORWARD

int cod2client.KEY_MASK_MOVE_FORWARD = 1

◆ PREFIX

str cod2client.PREFIX = b'\xff\xff\xff\xff'