Subversion Repositories Kolibri OS

Rev

Rev 298 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 298 Rev 333
Line -... Line 1...
-
 
1
#include 
1
#include 
2
#include 
2
#include 
3
#include 
3
#include 
4
#include 
4
#include 
5
#include "i_system.h"
5
#include "i_system.h"
6
#include "d_event.h"
Line 7... Line 8...
7
#include "d_net.h"
8
#include "m_argv.h"
8
#include "m_argv.h"
9
#include "doomstat.h"
9
#include "doomstat.h"
10
#include "i_net.h"
10
#include "i_net.h"
11
 
Line -... Line 12...
-
 
12
#ifdef DLHEAP
-
 
13
 
-
 
14
void* _cdecl dlmalloc(size_t);
-
 
15
void  _cdecl dlfree(void*);
-
 
16
void _cdecl mf_init();
-
 
17
 
-
 
18
#define malloc dlmalloc
-
 
19
#define free dlfree
-
 
20
#define realloc dlrealloc
-
 
21
 
-
 
22
#endif
-
 
23
 
11
 
24
#ifndef B_HOST_IS_LENDIAN
12
#ifndef B_HOST_IS_LENDIAN
25
#define B_HOST_IS_LENDIAN 1
13
#define B_HOST_IS_LENDIAN 1
26
#endif
14
#endif
27
#if !defined(sparc) && B_HOST_IS_LENDIAN
15
#if !defined(sparc) && B_HOST_IS_LENDIAN
28
#ifndef ntohl
Line 54... Line 67...
54
void	(*netget) (void);
67
void    (*netsend) (void);
55
void	(*netsend) (void);
68
 
Line 56... Line 69...
56
 
69
static int first_user_port=IPPORT_USERRESERVED+0x1D+0x10;
Line -... Line 70...
-
 
70
 
57
static int first_user_port=IPPORT_USERRESERVED+0x1D+0x10;
71
/**********
58
 
72
int GetAvailPort(void)
59
int GetAvailPort(void)
73
{
60
{
74
 int i,d0;
61
 int i,d0;
75
 //for(i=0;i<1024;i++)
Line 68... Line 82...
68
 // if(d0==1) return i+first_user_port;
82
 //}
69
 //}
83
 I_Error("Unable to get new port\n");
70
 I_Error("Unable to get new port\n");
84
 return -1;
71
 return -1;
85
}
72
}
86
**********/
73
 
87
 
Line 74... Line 88...
74
 
88
int CreateInputUDPsocket(void)
75
int CreateInputUDPsocket(void)
89
{
76
{
90
 int d0=0;
77
 int d0;
91
 //__asm__ __volatile__(
78
 //__asm__ __volatile__(
92
 //    "int $0x40"
79
 //    "int $0x40"
93
 //    :"=a"(d0)
80
 //    :"=a"(d0)
94
 //    :"0"(53),"b"(1),"c"(DOOMPORT),"d"(0),"S"(0));
81
 //    :"0"(53),"b"(1),"c"(DOOMPORT),"d"(0),"S"(0));
95
 //if(d0==0xffffffff)
Line 107... Line 121...
107
//
121
void PacketSend (void)
108
void PacketSend (void)
122
{
109
{
123
 int c;
110
 int c;
124
 doomdata_t sw; 
111
 doomdata_t sw;			
125
 
-
 
126
 
-
 
127
 //printf("ERROR Packet Send\n\r");
-
 
128
 
-
 
129
                
-
 
130
 // byte swap
112
 // byte swap
131
 sw.checksum = htonl(netbuffer->checksum);
113
 sw.checksum = htonl(netbuffer->checksum);
132
 sw.player = netbuffer->player;
114
 sw.player = netbuffer->player;
133
 sw.retransmitfrom = netbuffer->retransmitfrom;
115
 sw.retransmitfrom = netbuffer->retransmitfrom;
134
 sw.starttic = netbuffer->starttic;
116
 sw.starttic = netbuffer->starttic;
135
 sw.numtics = netbuffer->numtics;
Line 156... Line 175...
156
 
175
 
157
 
176
//
158
//
177
// I_InitNetwork
-
 
178
//
159
// I_InitNetwork
179
 
160
//
180
void I_InitNetwork (void)
161
void I_InitNetwork (void)
181
{
162
{
182
    boolean             trueval = true;
163
    boolean		trueval = true;
183
    int                 i;
Line 224... Line 244...
224
    }
244
    insocket=CreateInputUDPsocket();
225
    insocket=CreateInputUDPsocket();
245
 //   __libclog_printf("DOOM: Input UDP socket is %d\n",insocket);
226
 //   __libclog_printf("DOOM: Input UDP socket is %d\n",insocket);
246
}
227
}
247
 
Line 228... Line -...
228
 
-
 
229
 
248
void I_NetCmd (void)
230
void I_NetCmd (void)
249
{
-
 
250
 
-
 
251
 
-
 
252
    //printf("ERROR NetCmd");
-
 
253
 
-
 
254
 
231
{
255
    if (doomcom->command == CMD_SEND)
232
    if (doomcom->command == CMD_SEND)
256
    {
233
    {
257
//      netsend ();
234
	netsend ();
258
    }
235
    }
259
    else if (doomcom->command == CMD_GET)
236
    else if (doomcom->command == CMD_GET)
260
    {
237
    {
261
//      netget ();
238
	netget ();
262
    }
239
    }
263
    else
240
    else
264
        I_Error ("Bad net cmd: %i\n",doomcom->command);
241
	I_Error ("Bad net cmd: %i\n",doomcom->command);
265
}