1 #ifndef __MDFN_NETPLAY_H
2 #define __MDFN_NETPLAY_H
3 
4 namespace Mednafen
5 {
6 
7 void Netplay_Update(const uint32 PortDeviceCache[], uint8* const PortData[], const uint32 PortLen[]);
8 void Netplay_PostProcess(const uint32 PortDevIdx[], uint8* const PortData[], const uint32 PortLen[]);
9 
10 void NetplaySendState(void);
11 bool NetplaySendCommand(uint8, uint32, const void* data = NULL);
12 
13 MDFN_HIDE extern int MDFNnetplay;
14 
15 #define MDFNNPCMD_RESET 	MDFN_MSC_RESET
16 #define MDFNNPCMD_POWER 	MDFN_MSC_POWER
17 
18 #define MDFNNPCMD_VSUNICOIN     MDFN_MSC_INSERT_COIN
19 #define MDFNNPCMD_VSUNIDIP0	MDFN_MSC_TOGGLE_DIP0
20 #define MDFNNPCMD_FDSINSERTx	MDFN_MSC_INSERT_DISK0
21 #define MDFNNPCMD_FDSINSERT	MDFN_MSC_INSERT_DISK
22 #define MDFNNPCMD_FDSEJECT	MDFN_MSC_EJECT_DISK
23 #define MDFNNPCMD_FDSSELECT	MDFN_MSC_SELECT_DISK
24 
25 #define MDFNNPCMD_SETFPS        0x40 	// Client->server.  It should be ignored server-side if it's not from the first
26                                         // active player for the game).
27 
28 #define MDFNNPCMD_NOP           0x41	// Client->server.
29 
30 //
31 #define MDFNNPCMD_CTRL_CHANGE     0x43  // Server->client.
32 #define MDFNNPCMD_CTRL_CHANGE_ACK 0x44	// Client->server.  Acknowledge controller change.  Sent using old local data length, everything after
33 					// this should be new data size.
34 //
35 
36 #define MDFNNPCMD_CTRLR_SWAP_NOTIF	0x68	// Server->Client
37 
38 #define MDFNNPCMD_CTRLR_TAKE		0x70	// Client->server.  Take the specified controllers(from other clients)
39 #define MDFNNPCMD_CTRLR_DROP		0x71	// Client->server.  Drop(relinquish) the specified controllers.
40 #define MDFNNPCMD_CTRLR_DUPE		0x72	// Client->server.  Take the specified controllers(but let other clients still keep their control).
41 
42 
43 #define MDFNNPCMD_CTRLR_SWAP		0x78	// Client->server.
44 
45 #define MDFNNPCMD_REQUEST_LIST	0x7F	// client->server
46 
47 #define MDFNNPCMD_LOADSTATE     0x80	// Client->server, and server->client
48 #define MDFNNPCMD_REQUEST_STATE 0x81	// Server->client
49 
50 #define MDFNNPCMD_TEXT		0x90
51 
52 #define MDFNNPCMD_SERVERTEXT	0x93 // Server text message(informational), server->client
53 #define MDFNNPCMD_ECHO		0x94 // Echos the string(no larger than 256 bytes) back to the client(used for pinging).
54 
55 #define MDFNNPCMD_INTEGRITY	0x95 // Send from a client to a server, then from the server to all clients.
56 #define MDFNNPCMD_INTEGRITY_RES	0x96 // Integrity result, sent from the clients to the server.  The result should be no larger
57 				     // than 256 bytes.
58 
59 #define MDFNNPCMD_SETNICK       0x98 /* Sent from client to server only. */
60 
61 #define MDFNNPCMD_PLAYERJOINED	0xA0	// Data:  <byte: bitmask, which inputs this player controls>
62 					//	  <bytestream: nickname>
63 #define MDFNNPCMD_PLAYERLEFT	0xA1	// Data: (see above)
64 
65 #define MDFNNPCMD_YOUJOINED     0xB0
66 #define MDFNNPCMD_YOULEFT       0xB1
67 
68 #define MDFNNPCMD_NICKCHANGED	0xB8
69 
70 #define MDFNNPCMD_LIST		0xC0 // Server->client
71 
72 #define MDFNNPCMD_SET_MEDIA     	0xD0	// Client->server, and server->client
73 
74 #define MDFNNPCMD_CTRLR_TAKE_NOTIF	0xF0	// Server->client
75 #define MDFNNPCMD_CTRLR_DROP_NOTIF	0xF1	// Server->client
76 #define MDFNNPCMD_CTRLR_DUPE_NOTIF	0xF2	// Server->client
77 
78 
79 #define MDFNNPCMD_QUIT          0xFF // Client->server
80 
81 }
82 #endif
83