1 /*  RetroArch - A frontend for libretro.
2  *  Copyright (C) 2010-2014 - Hans-Kristian Arntzen
3  *  Copyright (C) 2011-2017 - Daniel De Matteis
4  *  Copyright (C) 2016-2017 - Gregor Richards
5  *
6  *  RetroArch is free software: you can redistribute it and/or modify it under the terms
7  *  of the GNU General Public License as published by the Free Software Found-
8  *  ation, either version 3 of the License, or (at your option) any later version.
9  *
10  *  RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
11  *  without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  *  PURPOSE.  See the GNU General Public License for more details.
13  *
14  *  You should have received a copy of the GNU General Public License along with RetroArch.
15  *  If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef __RARCH_NETPLAY_H
19 #define __RARCH_NETPLAY_H
20 
21 #include <stdint.h>
22 #include <stddef.h>
23 
24 #include <boolean.h>
25 #include <libretro.h>
26 
27 #include "../../core.h"
28 
29 typedef struct netplay netplay_t;
30 
31 typedef struct mitm_server
32 {
33    const char *name;
34    const char *description;
35 } mitm_server_t;
36 
37 static const mitm_server_t netplay_mitm_server_list[] = {
38    { "nyc", "New York City, USA" },
39    { "madrid", "Madrid, Spain" },
40    { "montreal", "Montreal, Canada" },
41    { "saopaulo", "Sao Paulo, Brazil" },
42 };
43 
44 enum rarch_netplay_ctl_state
45 {
46    RARCH_NETPLAY_CTL_NONE = 0,
47    RARCH_NETPLAY_CTL_GAME_WATCH,
48    RARCH_NETPLAY_CTL_POST_FRAME,
49    RARCH_NETPLAY_CTL_PRE_FRAME,
50    RARCH_NETPLAY_CTL_ENABLE_SERVER,
51    RARCH_NETPLAY_CTL_ENABLE_CLIENT,
52    RARCH_NETPLAY_CTL_DISABLE,
53    RARCH_NETPLAY_CTL_IS_ENABLED,
54    RARCH_NETPLAY_CTL_IS_REPLAYING,
55    RARCH_NETPLAY_CTL_IS_SERVER,
56    RARCH_NETPLAY_CTL_IS_CONNECTED,
57    RARCH_NETPLAY_CTL_IS_DATA_INITED,
58    RARCH_NETPLAY_CTL_PAUSE,
59    RARCH_NETPLAY_CTL_UNPAUSE,
60    RARCH_NETPLAY_CTL_LOAD_SAVESTATE,
61    RARCH_NETPLAY_CTL_RESET,
62    RARCH_NETPLAY_CTL_DISCONNECT,
63    RARCH_NETPLAY_CTL_FINISHED_NAT_TRAVERSAL,
64    RARCH_NETPLAY_CTL_DESYNC_PUSH,
65    RARCH_NETPLAY_CTL_DESYNC_POP
66 };
67 
68 /* Preferences for sharing digital devices */
69 enum rarch_netplay_share_digital_preference
70 {
71    RARCH_NETPLAY_SHARE_DIGITAL_NO_SHARING = 0,
72    RARCH_NETPLAY_SHARE_DIGITAL_NO_PREFERENCE,
73    RARCH_NETPLAY_SHARE_DIGITAL_OR,
74    RARCH_NETPLAY_SHARE_DIGITAL_XOR,
75    RARCH_NETPLAY_SHARE_DIGITAL_VOTE,
76    RARCH_NETPLAY_SHARE_DIGITAL_LAST
77 };
78 
79 /* Preferences for sharing analog devices */
80 enum rarch_netplay_share_analog_preference
81 {
82    RARCH_NETPLAY_SHARE_ANALOG_NO_SHARING = 0,
83    RARCH_NETPLAY_SHARE_ANALOG_NO_PREFERENCE,
84    RARCH_NETPLAY_SHARE_ANALOG_MAX,
85    RARCH_NETPLAY_SHARE_ANALOG_AVERAGE,
86    RARCH_NETPLAY_SHARE_ANALOG_LAST
87 };
88 
89 bool netplay_driver_ctl(enum rarch_netplay_ctl_state state, void *data);
90 
91 int netplay_rooms_parse(const char *buf);
92 
93 struct netplay_room* netplay_room_get(int index);
94 
95 int netplay_rooms_get_count(void);
96 
97 void netplay_rooms_free(void);
98 
99 #endif
100