Subversion Repositories Games.Carmageddon

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1 pmbaty 1
#ifdef __MSDOS__ // Pierre-Marie Baty -- compile guard
2
 
3
#include "pd/net.h"
4
 
5
#include "errors.h"
6
#include "globvrpb.h"
7
#include "harness/hooks.h"
8
#include "harness/trace.h"
9
#include "network.h"
10
#include <ctype.h>
11
#include <stdlib.h>
12
#include <string.h>
13
 
14
#ifdef __DOS__
15
 
16
tU32 gNetwork_init_flags;
17
tPD_net_game_info* gJoinable_games;
18
int gMatts_PC;
19
tU16 gSocket_number_pd_format;
20
_IPX_ELEMENT gListen_elements[16];
21
char gLocal_ipx_addr_string[32];
22
_IPX_ELEMENT gSend_elements[16];
23
_IPX_LOCAL_TARGET gLocal_addr_ipx;
24
char gReceive_buffer[512];
25
tPD_net_player_info gRemote_net_player_info;
26
_IPX_LOCAL_TARGET gBroadcast_addr_ipx;
27
tPD_net_player_info gLocal_net_player_info;
28
char gSend_buffer[512];
29
tIPX_netnum gNetworks[16];
30
_IPX_LOCAL_TARGET gRemote_addr_ipx;
31
tU8* gSend_packet;
32
W32 gListen_segment;
33
tU8* gSend_packet_ptr;
34
W32 gSend_segment;
35
tU8* gListen_packet;
36
tU8* gListen_packet_ptr;
37
 
38
size_t gMsg_header_strlen;
39
int gNumber_of_networks;
40
int gNumber_of_hosts;
41
 
42
tRM_info RMI;
43
_IPX_HEADER gLast_received_IPX_header;
44
tU16 gSocket_number_network_order;
45
unsigned short gECB_offset;
46
tU16 gListen_selector;
47
tU16 gSend_selector;
48
 
49
/*static*/ void ClearupPDNetworkStuff(void);
50
/*static*/ void MATTMessageCheck(char* pFunction_name, tNet_message* pMessage, int pAlleged_size);
51
/*static*/ int GetProfileText(char* pDest, int pDest_len, char* pFname, char* pKeyname);
52
/*static*/ int GetSocketNumberFromProfileFile(void);
53
/*static*/ tU32 EthernetAddressToU32(_IPX_LOCAL_TARGET* pAddr_ipx);
54
/*static*/ void NetNowIPXLocalTarget2String(char* pString, _IPX_LOCAL_TARGET* pSock_addr_ipx);
55
/*static*/ int GetMessageTypeFromMessage(char* pMessage_str);
56
/*static*/ int SameEthernetAddress(_IPX_LOCAL_TARGET* pAddr_ipx1, _IPX_LOCAL_TARGET* pAddr_ipx2);
57
/*static*/ _IPX_LOCAL_TARGET* GetIPXAddrFromPlayerID(tPlayer_ID pPlayer_id);
58
/*static*/ void MakeMessageToSend(int pMessage_type);
59
/*static*/ int ReceiveHostResponses(void);
60
/*static*/ int BroadcastMessage(void);
61
/*static*/ int hmiIPXCloseSocket(W32 wSocket);
62
/*static*/ void hmiIPXListenForPacket(_IPX_ECB* pECB_ptr, tU32 pOffset);
63
/*static*/ int hmiIPXPostListen(_IPX_ECB* pECB_ptr, tU32 pOffset);
64
/*static*/ int hmiIPXGetData(char* pData, tU32 wDSize);
65
/*static*/ void hmiIPXSendPacket(_IPX_ECB* sECB, _IPX_ECB** pPacket, char* pHeader, W32 wSize);
66
/*static*/ int hmiIPXSendDataDirect(char* pHeader, W32 wHSize, char* pData, W32 wDSize, _NETNOW_NODE_ADDR* sNode);
67
/*static*/ void hmiIPXGetInternetworkAddr(_IPX_INTERNET_ADDR* sInterworkAddr);
68
/*static*/ void hmiIPXGetLocalTarget(_IPX_LOCAL_TARGET* sNetworkAddr);
69
/*static*/ int AllocateRealMem(W32 wSize, char** pPtr, W32* pSegment, tU16* pSelector);
70
/*static*/ int FreeRealMem(tU16 pSelector);
71
/*static*/ int hmiIPXInstalled(void);
72
/*static*/ void GetLargestPacketSizeOoErBetterInsertLinfordChristieJokeHere(void);
73
/*static*/ void GetIPXToStickItsEarToTheGround(void);
74
 
75
// IDA: void __cdecl ClearupPDNetworkStuff()
76
void ClearupPDNetworkStuff(void) {
77
    LOG_TRACE("()");
78
    NOT_IMPLEMENTED();
79
}
80
 
81
// IDA: void __usercall MATTMessageCheck(char *pFunction_name@<EAX>, tNet_message *pMessage@<EDX>, int pAlleged_size@<EBX>)
82
void MATTMessageCheck(char* pFunction_name, tNet_message* pMessage, int pAlleged_size) {
83
    LOG_TRACE("(\"%s\", %p, %d)", pFunction_name, pMessage, pAlleged_size);
84
    NOT_IMPLEMENTED();
85
}
86
 
87
// IDA: int __usercall GetProfileText@<EAX>(char *pDest@<EAX>, int pDest_len@<EDX>, char *pFname@<EBX>, char *pKeyname@<ECX>)
88
int GetProfileText(char* pDest, int pDest_len, char* pFname, char* pKeyname) {
89
    FILE* fp;
90
    char in_buf[256];
91
    int i;
92
    int j;
93
    int len;
94
    LOG_TRACE("(\"%s\", %d, \"%s\", \"%s\")", pDest, pDest_len, pFname, pKeyname);
95
    NOT_IMPLEMENTED();
96
}
97
 
98
// IDA: int __cdecl GetSocketNumberFromProfileFile()
99
int GetSocketNumberFromProfileFile(void) {
100
    char str[256];
101
    int sscanf_res;
102
    tU32 socknum;
103
    LOG_TRACE("()");
104
    NOT_IMPLEMENTED();
105
}
106
 
107
// IDA: tU32 __usercall EthernetAddressToU32@<EAX>(_IPX_LOCAL_TARGET *pAddr_ipx@<EAX>)
108
tU32 EthernetAddressToU32(_IPX_LOCAL_TARGET* pAddr_ipx) {
109
    LOG_TRACE("(%p)", pAddr_ipx);
110
    NOT_IMPLEMENTED();
111
}
112
 
113
// IDA: void __usercall NetNowIPXLocalTarget2String(char *pString@<EAX>, _IPX_LOCAL_TARGET *pSock_addr_ipx@<EDX>)
114
void NetNowIPXLocalTarget2String(char* pString, _IPX_LOCAL_TARGET* pSock_addr_ipx) {
115
    LOG_TRACE("(\"%s\", %p)", pString, pSock_addr_ipx);
116
    NOT_IMPLEMENTED();
117
}
118
 
119
// IDA: int __usercall GetMessageTypeFromMessage@<EAX>(char *pMessage_str@<EAX>)
120
int GetMessageTypeFromMessage(char* pMessage_str) {
121
    char* real_msg;
122
    int msg_type_int;
123
    LOG_TRACE("(\"%s\")", pMessage_str);
124
    NOT_IMPLEMENTED();
125
}
126
 
127
// IDA: int __usercall SameEthernetAddress@<EAX>(_IPX_LOCAL_TARGET *pAddr_ipx1@<EAX>, _IPX_LOCAL_TARGET *pAddr_ipx2@<EDX>)
128
int SameEthernetAddress(_IPX_LOCAL_TARGET* pAddr_ipx1, _IPX_LOCAL_TARGET* pAddr_ipx2) {
129
    LOG_TRACE("(%p, %p)", pAddr_ipx1, pAddr_ipx2);
130
    NOT_IMPLEMENTED();
131
}
132
 
133
_IPX_LOCAL_TARGET* GetIPXAddrFromPlayerID(tPlayer_ID pPlayer_id) {
134
    int i;
135
    tU8* nodenum;
136
    NOT_IMPLEMENTED();
137
}
138
 
139
// IDA: void __usercall MakeMessageToSend(int pMessage_type@<EAX>)
140
void MakeMessageToSend(int pMessage_type) {
141
    LOG_TRACE("(%d)", pMessage_type);
142
    NOT_IMPLEMENTED();
143
}
144
 
145
// IDA: int __cdecl ReceiveHostResponses()
146
int ReceiveHostResponses(void) {
147
    char str[256];
148
    int i;
149
    int already_registered;
150
    LOG_TRACE("()");
151
    NOT_IMPLEMENTED();
152
}
153
 
154
// IDA: int __cdecl BroadcastMessage()
155
int BroadcastMessage(void) {
156
    int i;
157
    int errors;
158
    char broadcast_addr_string[32];
159
    char* real_msg;
160
    LOG_TRACE("()");
161
    NOT_IMPLEMENTED();
162
}
163
 
164
// IDA: int __usercall hmiIPXCloseSocket@<EAX>(W32 wSocket@<EAX>)
165
int hmiIPXCloseSocket(W32 wSocket) {
166
    REGS regs;
167
    SREGS sregs;
168
    LOG_TRACE("(%d)", wSocket);
169
    NOT_IMPLEMENTED();
170
}
171
 
172
// IDA: void __usercall hmiIPXListenForPacket(_IPX_ECB *pECB_ptr@<EAX>, tU32 pOffset@<EDX>)
173
void hmiIPXListenForPacket(_IPX_ECB* pECB_ptr, tU32 pOffset) {
174
    SREGS sregs;
175
    REGS regs;
176
    _IPX_HEADER* IPX_header_ptr;
177
    _IPX_ECB* sIPXECB;
178
    LOG_TRACE("(%p, %d)", pECB_ptr, pOffset);
179
    NOT_IMPLEMENTED();
180
}
181
 
182
// IDA: int __usercall hmiIPXPostListen@<EAX>(_IPX_ECB *pECB_ptr@<EAX>, tU32 pOffset@<EDX>)
183
int hmiIPXPostListen(_IPX_ECB* pECB_ptr, tU32 pOffset) {
184
    LOG_TRACE("(%p, %d)", pECB_ptr, pOffset);
185
    NOT_IMPLEMENTED();
186
}
187
 
188
// IDA: int __cdecl hmiIPXGetData(char* pData, tU32 wDSize)
189
int hmiIPXGetData(char* pData, tU32 wDSize) {
190
    tU32 packets_checked;
191
    tU32 full_packet_ooer_missus;
192
    _IPX_ECB* ECB_ptr;
193
    static tU32 round_robin_jobby;
194
    LOG_TRACE("(%d, %d)", pData, wDSize);
195
    NOT_IMPLEMENTED();
196
}
197
 
198
// IDA: void __usercall hmiIPXSendPacket(_IPX_ECB *sECB@<EAX>, _IPX_ECB **pPacket@<EDX>, char* pHeader@<EBX>, W32 wSize@<ECX>)
199
void hmiIPXSendPacket(_IPX_ECB* sECB, _IPX_ECB** pPacket, char* pHeader, W32 wSize) {
200
    SREGS sregs;
201
    REGS regs;
202
    _IPX_HEADER* sIPXHeader;
203
    _IPX_ECB* sIPXECB;
204
    char* pIPXData;
205
    LOG_TRACE("(%p, %p, %d, %d)", sECB, pPacket, pHeader, wSize);
206
    NOT_IMPLEMENTED();
207
}
208
 
209
// IDA: int __usercall hmiIPXSendDataDirect@<EAX>(char* pHeader@<EAX>, W32 wHSize@<EDX>, char* pData@<EBX>, W32 wDSize@<ECX>, _NETNOW_NODE_ADDR *sNode)
210
int hmiIPXSendDataDirect(char* pHeader, W32 wHSize, char* pData, W32 wDSize, _NETNOW_NODE_ADDR* sNode) {
211
    W32 wIndex;
212
    _IPX_ELEMENT* sElement;
213
    W32* pSequence;
214
    LOG_TRACE("(%d, %d, %d, %d, %p)", pHeader, wHSize, pData, wDSize, sNode);
215
    NOT_IMPLEMENTED();
216
}
217
 
218
// IDA: void __usercall hmiIPXGetInternetworkAddr(_IPX_INTERNET_ADDR *sInterworkAddr@<EAX>)
219
void hmiIPXGetInternetworkAddr(_IPX_INTERNET_ADDR* sInterworkAddr) {
220
    SREGS sregs;
221
    REGS regs;
222
    LOG_TRACE("(%p)", sInterworkAddr);
223
    NOT_IMPLEMENTED();
224
}
225
 
226
// IDA: void __usercall hmiIPXGetLocalTarget(_IPX_LOCAL_TARGET *sNetworkAddr@<EAX>)
227
void hmiIPXGetLocalTarget(_IPX_LOCAL_TARGET* sNetworkAddr) {
228
    SREGS sregs;
229
    REGS regs;
230
    LOG_TRACE("(%p)", sNetworkAddr);
231
    NOT_IMPLEMENTED();
232
}
233
 
234
// IDA: int __usercall AllocateRealMem@<EAX>(W32 wSize@<EAX>, char* *pPtr@<EDX>, W32 *pSegment@<EBX>, tU16 *pSelector@<ECX>)
235
int AllocateRealMem(W32 wSize, char** pPtr, W32* pSegment, tU16* pSelector) {
236
    REGS regs;
237
    SREGS sregs;
238
    W32 wAddress;
239
    W32 wHandle;
240
    W32 wSegment;
241
    W32 wLinear;
242
    LOG_TRACE("(%d, %p, %p, %p)", wSize, pPtr, pSegment, pSelector);
243
    NOT_IMPLEMENTED();
244
}
245
 
246
// IDA: int __usercall FreeRealMem@<EAX>(tU16 pSelector@<EAX>)
247
int FreeRealMem(tU16 pSelector) {
248
    REGS regs;
249
    SREGS sregs;
250
    W32 wAddress;
251
    W32 wHandle;
252
    W32 wSegment;
253
    W32 wLinear;
254
    LOG_TRACE("(%d)", pSelector);
255
    NOT_IMPLEMENTED();
256
}
257
 
258
// IDA: int __cdecl hmiIPXInstalled()
259
int hmiIPXInstalled(void) {
260
    SREGS sregs;
261
    REGS regs;
262
    LOG_TRACE("()");
263
    NOT_IMPLEMENTED();
264
}
265
 
266
// IDA: int __usercall hmiIPXOpenSocket@<EAX>(W32 wSocket@<EAX>)
267
int hmiIPXOpenSocket(W32 wSocket) {
268
    SREGS sregs;
269
    REGS regs;
270
    LOG_TRACE("(%d)", wSocket);
271
    NOT_IMPLEMENTED();
272
}
273
 
274
// IDA: void __cdecl GetLargestPacketSizeOoErBetterInsertLinfordChristieJokeHere()
275
void GetLargestPacketSizeOoErBetterInsertLinfordChristieJokeHere(void) {
276
    SREGS sregs;
277
    REGS regs;
278
    LOG_TRACE("()");
279
    NOT_IMPLEMENTED();
280
}
281
 
282
// IDA: int __usercall hmiIPXInitSystem@<EAX>(W32 wSocket@<EAX>)
283
int hmiIPXInitSystem(W32 wSocket) {
284
    W32 wNIndex;
285
    W32 wIndex;
286
    W32 wMIndex;
287
    unsigned short wSOffset;
288
    unsigned short wLOffset;
289
    LOG_TRACE("(%d)", wSocket);
290
    NOT_IMPLEMENTED();
291
}
292
 
293
// IDA: void __cdecl GetIPXToStickItsEarToTheGround()
294
void GetIPXToStickItsEarToTheGround(void) {
295
    int i;
296
    LOG_TRACE("()");
297
    NOT_IMPLEMENTED();
298
}
299
 
300
// IDA: int __cdecl PDNetInitialise()
301
int PDNetInitialise(void) {
302
    tU32 timenow;
303
    char profile_string[32];
304
    char key_name[32];
305
    int sscanf_res;
306
    int i;
307
    tU32 netnum;
308
    char str[256];
309
    int mess_num;
310
 
311
    LOG_TRACE("()");
312
    NOT_IMPLEMENTED();
313
}
314
 
315
// IDA: int __cdecl PDNetShutdown()
316
int PDNetShutdown(void) {
317
    LOG_TRACE("()");
318
    NOT_IMPLEMENTED();
319
}
320
 
321
// IDA: void __cdecl PDNetStartProducingJoinList()
322
void PDNetStartProducingJoinList(void) {
323
    LOG_TRACE("()");
324
    NOT_IMPLEMENTED();
325
}
326
 
327
// IDA: void __cdecl PDNetEndJoinList()
328
void PDNetEndJoinList(void) {
329
    LOG_TRACE("()");
330
    NOT_IMPLEMENTED();
331
}
332
 
333
// IDA: int __usercall PDNetGetNextJoinGame@<EAX>(tNet_game_details *pGame@<EAX>, int pIndex@<EDX>)
334
int PDNetGetNextJoinGame(tNet_game_details* pGame, int pIndex) {
335
    static tU32 next_broadcast_time;
336
    int i;
337
    int j;
338
    int number_of_hosts_has_changed;
339
    char str[256];
340
    LOG_TRACE9("(%p, %d)", pGame, pIndex);
341
    NOT_IMPLEMENTED();
342
}
343
 
344
// IDA: void __usercall PDNetDisposeGameDetails(tNet_game_details *pDetails@<EAX>)
345
void PDNetDisposeGameDetails(tNet_game_details* pDetails) {
346
    LOG_TRACE("(%p)", pDetails);
347
    NOT_IMPLEMENTED();
348
}
349
 
350
// IDA: int __usercall PDNetHostGame@<EAX>(tNet_game_details *pDetails@<EAX>, char *pHost_name@<EDX>, void **pHost_address@<EBX>)
351
int PDNetHostGame(tNet_game_details* pDetails, char* pHost_name, void** pHost_address) {
352
    LOG_TRACE("(%p, \"%s\", %p)", pDetails, pHost_name, pHost_address);
353
    NOT_IMPLEMENTED();
354
}
355
 
356
// IDA: int __usercall PDNetJoinGame@<EAX>(tNet_game_details *pDetails@<EAX>, char *pPlayer_name@<EDX>)
357
int PDNetJoinGame(tNet_game_details* pDetails, char* pPlayer_name) {
358
    LOG_TRACE("(%p, \"%s\")", pDetails, pPlayer_name);
359
    NOT_IMPLEMENTED();
360
}
361
 
362
// IDA: void __usercall PDNetLeaveGame(tNet_game_details *pDetails@<EAX>)
363
void PDNetLeaveGame(tNet_game_details* pDetails) {
364
    LOG_TRACE("(%p)", pDetails);
365
    NOT_IMPLEMENTED();
366
}
367
 
368
// IDA: void __usercall PDNetHostFinishGame(tNet_game_details *pDetails@<EAX>)
369
void PDNetHostFinishGame(tNet_game_details* pDetails) {
370
    LOG_TRACE("(%p)", pDetails);
371
    NOT_IMPLEMENTED();
372
}
373
 
374
// IDA: tU32 __usercall PDNetExtractGameID@<EAX>(tNet_game_details *pDetails@<EAX>)
375
tU32 PDNetExtractGameID(tNet_game_details* pDetails) {
376
    LOG_TRACE("(%p)", pDetails);
377
    NOT_IMPLEMENTED();
378
}
379
 
380
// IDA: tPlayer_ID __usercall PDNetExtractPlayerID@<EAX>(tNet_game_details *pDetails@<EAX>)
381
tPlayer_ID PDNetExtractPlayerID(tNet_game_details* pDetails) {
382
    LOG_TRACE("(%p)", pDetails);
383
    NOT_IMPLEMENTED();
384
}
385
 
386
// IDA: void __usercall PDNetObtainSystemUserName(char *pName@<EAX>, int pMax_length@<EDX>)
387
void PDNetObtainSystemUserName(char* pName, int pMax_length) {
388
    strcpy(pName, "Ron Turn");
389
}
390
 
391
// IDA: int __usercall PDNetSendMessageToPlayer@<EAX>(tNet_game_details *pDetails@<EAX>, tNet_message *pMessage@<EDX>, tPlayer_ID pPlayer@<EBX>)
392
int PDNetSendMessageToPlayer(tNet_game_details* pDetails, tNet_message* pMessage, tPlayer_ID pPlayer) {
393
    char str[256];
394
    _IPX_LOCAL_TARGET* remote_addr_ipx;
395
    LOG_TRACE("(%p, %p, %d)", pDetails, pMessage, pPlayer);
396
    NOT_IMPLEMENTED();
397
}
398
 
399
// IDA: int __usercall PDNetSendMessageToAllPlayers@<EAX>(tNet_game_details *pDetails@<EAX>, tNet_message *pMessage@<EDX>)
400
int PDNetSendMessageToAllPlayers(tNet_game_details* pDetails, tNet_message* pMessage) {
401
    char str[256];
402
    int i;
403
    int r; // Added by dethrace
404
    LOG_TRACE("(%p, %p)", pDetails, pMessage);
405
    NOT_IMPLEMENTED();
406
}
407
 
408
// IDA: tNet_message* __usercall PDNetGetNextMessage@<EAX>(tNet_game_details *pDetails@<EAX>, void **pSender_address@<EDX>)
409
tNet_message* PDNetGetNextMessage(tNet_game_details* pDetails, void** pSender_address) {
410
    char* receive_buffer;
411
    char str[256];
412
    int msg_type;
413
    LOG_TRACE("(%p, %p)", pDetails, pSender_address);
414
    NOT_IMPLEMENTED();
415
}
416
 
417
// IDA: tNet_message* __usercall PDNetAllocateMessage@<EAX>(tU32 pSize@<EAX>, tS32 pSize_decider@<EDX>)
418
tNet_message* PDNetAllocateMessage(tU32 pSize, tS32 pSize_decider) {
419
    LOG_TRACE("(%d, %d)", pSize, pSize_decider);
420
    NOT_IMPLEMENTED();
421
}
422
 
423
// IDA: void __usercall PDNetDisposeMessage(tNet_game_details *pDetails@<EAX>, tNet_message *pMessage@<EDX>)
424
void PDNetDisposeMessage(tNet_game_details* pDetails, tNet_message* pMessage) {
425
    LOG_TRACE("(%p, %p)", pDetails, pMessage);
426
    NOT_IMPLEMENTED();
427
}
428
 
429
// IDA: void __usercall PDNetSetPlayerSystemInfo(tNet_game_player_info *pPlayer@<EAX>, void *pSender_address@<EDX>)
430
void PDNetSetPlayerSystemInfo(tNet_game_player_info* pPlayer, void* pSender_address) {
431
    LOG_TRACE("(%p, %p)", pPlayer, pSender_address);
432
    NOT_IMPLEMENTED();
433
}
434
 
435
// IDA: void __usercall PDNetDisposePlayer(tNet_game_player_info *pPlayer@<EAX>)
436
void PDNetDisposePlayer(tNet_game_player_info* pPlayer) {
437
    LOG_TRACE("(%p)", pPlayer);
438
    NOT_IMPLEMENTED();
439
}
440
 
441
// IDA: int __usercall PDNetSendMessageToAddress@<EAX>(tNet_game_details *pDetails@<EAX>, tNet_message *pMessage@<EDX>, void *pAddress@<EBX>)
442
int PDNetSendMessageToAddress(tNet_game_details* pDetails, tNet_message* pMessage, void* pAddress) {
443
    char str[256];
444
    LOG_TRACE("(%p, %p, %p)", pDetails, pMessage, pAddress);
445
    NOT_IMPLEMENTED();
446
}
447
 
448
// IDA: int __usercall PDNetInitClient@<EAX>(tNet_game_details *pDetails@<EAX>)
449
int PDNetInitClient(tNet_game_details* pDetails) {
450
    LOG_TRACE("(%p)", pDetails);
451
    NOT_IMPLEMENTED();
452
}
453
 
454
// IDA: int __cdecl PDNetGetHeaderSize()
455
int PDNetGetHeaderSize(void) {
456
    LOG_TRACE("()");
457
    NOT_IMPLEMENTED();
458
}
459
 
460
#endif
461
 
462
#endif // __MSDOS__