-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathwar3.h
More file actions
269 lines (238 loc) · 5.39 KB
/
Copy pathwar3.h
File metadata and controls
269 lines (238 loc) · 5.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
#ifndef _WAR3__H
#define _WAR3__H
#pragma pack(1)
#define BLIZZARD_ID_WARCRAFT_3_XP "PX3W" // W3XP
#define BLIZZARD_ID_WARCRAFT_3 "3RAW"
#define PRODUCT_NONE "NONE"
enum w3_msg_id
{
W3GS_PING = 0x01,
W3GS_SLOT_INFO_JOIN = 0x04,
W3GS_REJECT_JOIN,
W3GS_PLAYER_INFO,
W3GS_PLAYER_LEFT,
W3GS_PLAYER_LOADED,
W3GS_SLOT_INFO,
W3GS_COUNTDOWN_START,
W3GS_COUNTDOWN_END,
W3GS_INCOMING_ACTION,
W3GS_CHAT_FROM_HOST = 0x0F,
W3GS_UNKNOWN2 = 0x11,
W3GS_KICKED = 0x1C,
W3GS_REQ_JOIN = 0x1E,
W3GS_GAME_LOADED = 0x23,
W3GS_OUTGOING_ACTION = 0x26,
W3GS_KEEPALIVE, // 0x27
W3GS_PLAYER_UPDATE, // 0x28 - original: CHAT_TO_HOST
W3GS_SEARCH_GAME = 0x2F,
W3GS_GAME_INFO,
W3GS_CREATE_GAME,
W3GS_REFRESH_GAME,
W3GS_END_GAME, // originally DECREATEGAME, which isn't a word
W3GS_MAP_CHECK = 0x3D,
W3GS_UNKNOWN1 = 0x40,
W3GS_MAP_SIZE = 0x42,
W3GS_PONG = 0x46,
};
enum
{
REASON_LEFT_DISCONNECT=0x01,
REASON_LEFT_LOST=0x07,
REASON_LEFT_LOST_BUILDINGS,
REASON_LEFT_WON,
REASON_LEFT_DRAW,
REASON_LEFT_OBSERVER,
REASON_LEFT_LOBBY = 0x0D,
};
enum
{
PLAYER_TYPE_HUMAN,
PLAYER_TYPE_COMPUTER
};
enum
{
SLOT_STATUS_OPEN,
SLOT_STATUS_CLOSED,
SLOT_STATUS_OCCUPIED
};
enum
{
RACE_HUMAN_SHIFT,
RACE_ORC_SHIFT,
RACE_ELF_SHIFT,
RACE_UNDEAD_SHIFT,
RACE_FIXED_SHIFT,
RACE_RANDOM_SHIFT,
};
enum
{
COMPUTER_TYPE_EASY,
COMPUTER_TYPE_NORMAL,
COMPUTER_TYPE_HARD
};
typedef struct w3gs_header
{
unsigned char a; // magic F7
unsigned char msg_id; // see W3_MSG_ID
unsigned short len; // total message length (including this header)
} w3gs_header;
typedef struct w3gs_slot_info
{
unsigned char player;
unsigned char dl_status;
unsigned char status;
unsigned char type; // see PLAYER_TYPE_
unsigned char team;
unsigned char color;
unsigned char race;
unsigned char computer_type;
unsigned char handicap;
} w3gs_slot_info;
typedef struct w3gs_slot_info_join_1 // 0x04 and 0x09
{
w3gs_header header;
unsigned short length;
unsigned char num_slots;
w3gs_slot_info slot[0];
} w3gs_slot_info_join_1;
typedef struct w3gs_slot_info_join_2 // 0x04
{
unsigned int timestamp;
unsigned short u1;
char player; // your player id for this game
} w3gs_slot_info_join_2;
typedef struct w3gs_player_info_1 // 0x06
{
w3gs_header header;
unsigned int counter;
unsigned char player;
char name[0];
} w3gs_player_info_1;
// another one of these damn variable length strings in the middle of a packet!
typedef struct w3gs_player_info_2 // 0x06
{
unsigned short unknown;
unsigned short af_inet;
unsigned short port;
unsigned int ext_addr;
unsigned int unknown2;
unsigned int unknown3;
unsigned short af_inet2;
unsigned short int_port;
unsigned int int_addr;
unsigned int unknown4;
unsigned int unknown5;
} w3gs_player_info_2;
typedef struct w3gs_player_left // 0x07
{
w3gs_header header;
unsigned char player;
unsigned int reason; // see REASON_LEFT_
} w3gs_player_left;
typedef struct w3gs_player_loaded // 0x08
{
w3gs_header header;
unsigned char player;
} w3gs_player_loaded;
typedef struct w3gs_incoming_action // 0x0C
{
w3gs_header header;
unsigned char player;
unsigned short len;
char data[0];
} w3gs_incoming_action;
typedef struct w3gs_req_join // 0x1E
{
w3gs_header header;
unsigned int game_id; // index of game started by host
unsigned int key;
char unknown;
unsigned short port;
unsigned int peer_key;
char name[8];
unsigned short unknown2;
unsigned short unknown3;
unsigned short int_port;
unsigned int int_ip;
unsigned int unknown4;
unsigned int unknown5;
} w3gs_req_join;
typedef struct w3gs_keepalive // 0x27
{
w3gs_header header;
char u1;
unsigned int val;
} w3gs_keepalive;
typedef struct w3gs_player_update // 0x28
{
w3gs_header header;
unsigned char f1;
unsigned char f2;
unsigned char player;
unsigned char attr;
unsigned char val;
} w3gs_player_update;
typedef struct w3gs_search_game // 0x2F
{
w3gs_header header;
char product[4]; // see BLIZZARD_ID_
unsigned int version; // version of app
unsigned int unknown; //
} w3gs_search_game;
typedef struct w3gs_game_info_1 // 0x30
{
w3gs_header header;
char product[4]; // see BLIZZARD_ID_
unsigned int version; // version of app
unsigned int game_id; // index of game started by host
unsigned int key; // need this key to join the game
char name[0];
} w3gs_game_info_1;
typedef struct w3gs_game_info_2 // 0x30
{
} w3gs_game_info_2;
typedef struct w3gs_create_game // 0x31
{
w3gs_header header;
char product[4]; // see BLIZZARD_ID_
unsigned int version; // version of app
unsigned int counter; // index of game started by host
} w3gs_create_game;
typedef struct w3gs_refresh_game // 0x32
{
w3gs_header header;
unsigned int game_id; // index of game started by host
unsigned int players; // how many players are currently in the game
unsigned int slots; // how many slots in the game
} w3gs_refresh_game;
typedef struct w3gs_end_game // 0x33
{
w3gs_header header;
unsigned int game_id;
} w3gs_end_game;
typedef struct w3gs_map_check_1 // 0x3D
{
w3gs_header header;
unsigned int unknown;
char path[0]; // again???
} w3gs_map_check_1;
typedef struct w3gs_map_check_2 // 0x3D
{
unsigned int size;
unsigned int crc;
unsigned int csum;
unsigned int sha1;
} w3gs_map_check_2;
typedef struct w3gs_map_size // 0x42
{
w3gs_header header;
unsigned int unknown;
unsigned char flags;
unsigned int size;
} w3gs_map_size;
typedef struct w3gs_ping // 0x01 and 0x46
{
w3gs_header header;
unsigned int tick;
} w3gs_ping;
#endif // _WAR3__H