| 1 | // |
| 2 | // DF Netplay Plugin |
| 3 | // |
| 4 | // Based on netSock 0.2 by linuzappz. |
| 5 | // The Plugin is free source code. |
| 6 | // |
| 7 | |
| 8 | #ifndef __DFNET_H__ |
| 9 | #define __DFNET_H__ |
| 10 | |
| 11 | #include "config.h" |
| 12 | |
| 13 | #include <sys/time.h> |
| 14 | #include <sys/types.h> |
| 15 | #include <sys/socket.h> |
| 16 | #include <netinet/in.h> |
| 17 | #include <arpa/inet.h> |
| 18 | #include <netdb.h> |
| 19 | #include <unistd.h> |
| 20 | |
| 21 | #ifdef ENABLE_NLS |
| 22 | #include <libintl.h> |
| 23 | #include <locale.h> |
| 24 | #define _(x) gettext(x) |
| 25 | #define N_(x) (x) |
| 26 | #else |
| 27 | #define _(x) (x) |
| 28 | #define N_(x) (x) |
| 29 | #endif |
| 30 | |
| 31 | typedef void* HWND; |
| 32 | |
| 33 | struct timeval tm; |
| 34 | |
| 35 | #define CALLBACK |
| 36 | |
| 37 | long timeGetTime(); |
| 38 | |
| 39 | #include "psemu_plugin_defs.h" |
| 40 | |
| 41 | typedef struct { |
| 42 | int PlayerNum; |
| 43 | unsigned short PortNum; |
| 44 | char ipAddress[32]; |
| 45 | } Config; |
| 46 | |
| 47 | Config conf; |
| 48 | |
| 49 | void LoadConf(); |
| 50 | void SaveConf(); |
| 51 | |
| 52 | long sock; |
| 53 | char *PadSendData; |
| 54 | char *PadRecvData; |
| 55 | char PadSendSize; |
| 56 | char PadRecvSize; |
| 57 | char PadSize[2]; |
| 58 | int PadCount; |
| 59 | int PadCountMax; |
| 60 | int PadInit; |
| 61 | int Ping; |
| 62 | volatile int WaitCancel; |
| 63 | fd_set rset; |
| 64 | fd_set wset; |
| 65 | |
| 66 | long sockInit(); |
| 67 | long sockShutdown(); |
| 68 | long sockOpen(); |
| 69 | void sockCreateWaitDlg(); |
| 70 | void sockDlgUpdate(); |
| 71 | void sockDestroyWaitDlg(); |
| 72 | int sockPing(); |
| 73 | |
| 74 | int ShowPauseDlg(); |
| 75 | void SysMessage(const char *fmt, ...); |
| 76 | |
| 77 | int SEND(const void *pData, int Size, int Mode); |
| 78 | int RECV(void *pData, int Size, int Mode); |
| 79 | |
| 80 | #endif |