Move g_extern.netplay to driver.netplay_data

This commit is contained in:
twinaphex 2014-10-01 23:00:05 +02:00
parent dead11f182
commit 0135d763db
5 changed files with 336 additions and 322 deletions

View File

@ -448,6 +448,9 @@ typedef struct driver
void *location_data; void *location_data;
void *resampler_data; void *resampler_data;
void *recording_data; void *recording_data;
#ifdef HAVE_NETPLAY
void *netplay_data;
#endif
bool audio_active; bool audio_active;
bool video_active; bool video_active;

View File

@ -641,7 +641,6 @@ struct global
#ifdef HAVE_NETPLAY #ifdef HAVE_NETPLAY
/* Netplay. */ /* Netplay. */
netplay_t *netplay;
char netplay_server[PATH_MAX]; char netplay_server[PATH_MAX];
bool netplay_enable; bool netplay_enable;
bool netplay_is_client; bool netplay_is_client;

View File

@ -399,7 +399,7 @@ void retro_init_libretro_cbs(void *data)
retro_set_default_callbacks(cbs); retro_set_default_callbacks(cbs);
#ifdef HAVE_NETPLAY #ifdef HAVE_NETPLAY
if (!g_extern.netplay) if (!driver.netplay_data)
return; return;
if (g_extern.netplay_is_spectate) if (g_extern.netplay_is_spectate)

620
netplay.c

File diff suppressed because it is too large Load Diff

View File

@ -1278,7 +1278,7 @@ static void init_cheats(void)
{ {
bool allow_cheats = true; bool allow_cheats = true;
#ifdef HAVE_NETPLAY #ifdef HAVE_NETPLAY
allow_cheats &= !g_extern.netplay; allow_cheats &= !driver.netplay_data;
#endif #endif
allow_cheats &= !g_extern.bsv.movie; allow_cheats &= !g_extern.bsv.movie;
@ -1300,7 +1300,7 @@ static void init_rewind(void)
{ {
void *state = NULL; void *state = NULL;
#ifdef HAVE_NETPLAY #ifdef HAVE_NETPLAY
if (g_extern.netplay) if (driver.netplay_data)
return; return;
#endif #endif
@ -1337,7 +1337,7 @@ static void init_rewind(void)
static void deinit_rewind(void) static void deinit_rewind(void)
{ {
#ifdef HAVE_NETPLAY #ifdef HAVE_NETPLAY
if (g_extern.netplay) if (driver.netplay_data)
return; return;
#endif #endif
@ -1419,13 +1419,13 @@ static void init_netplay(void)
else else
RARCH_LOG("Waiting for client...\n"); RARCH_LOG("Waiting for client...\n");
g_extern.netplay = netplay_new( driver.netplay_data = (netplay_t*)netplay_new(
g_extern.netplay_is_client ? g_extern.netplay_server : NULL, g_extern.netplay_is_client ? g_extern.netplay_server : NULL,
g_extern.netplay_port ? g_extern.netplay_port : RARCH_DEFAULT_PORT, g_extern.netplay_port ? g_extern.netplay_port : RARCH_DEFAULT_PORT,
g_extern.netplay_sync_frames, &cbs, g_extern.netplay_is_spectate, g_extern.netplay_sync_frames, &cbs, g_extern.netplay_is_spectate,
g_settings.username); g_settings.username);
if (!g_extern.netplay) if (!driver.netplay_data)
{ {
g_extern.netplay_is_client = false; g_extern.netplay_is_client = false;
RARCH_WARN(RETRO_LOG_INIT_NETPLAY_FAILED); RARCH_WARN(RETRO_LOG_INIT_NETPLAY_FAILED);
@ -1439,9 +1439,9 @@ static void init_netplay(void)
static void deinit_netplay(void) static void deinit_netplay(void)
{ {
if (g_extern.netplay) if (driver.netplay_data)
netplay_free(g_extern.netplay); netplay_free(driver.netplay_data);
g_extern.netplay = NULL; driver.netplay_data = NULL;
} }
#endif #endif
@ -2361,7 +2361,7 @@ static void check_volume(bool pressed_up, bool pressed_down)
static void check_netplay_flip(bool pressed, bool fullscreen_toggle_pressed) static void check_netplay_flip(bool pressed, bool fullscreen_toggle_pressed)
{ {
if (pressed) if (pressed)
netplay_flip_players(g_extern.netplay); netplay_flip_players(driver.netplay_data);
rarch_check_fullscreen(fullscreen_toggle_pressed); rarch_check_fullscreen(fullscreen_toggle_pressed);
} }
@ -2460,7 +2460,7 @@ static bool do_state_checks(
#endif #endif
#ifdef HAVE_NETPLAY #ifdef HAVE_NETPLAY
if (g_extern.netplay) if (driver.netplay_data)
{ {
check_netplay_flip_func(trigger_input); check_netplay_flip_func(trigger_input);
return true; return true;
@ -2708,7 +2708,7 @@ static void init_sram(void)
{ {
g_extern.use_sram = g_extern.use_sram && !g_extern.sram_save_disable g_extern.use_sram = g_extern.use_sram && !g_extern.sram_save_disable
#ifdef HAVE_NETPLAY #ifdef HAVE_NETPLAY
&& (!g_extern.netplay || !g_extern.netplay_is_client) && (!driver.netplay_data || !g_extern.netplay_is_client)
#endif #endif
; ;
@ -3084,7 +3084,7 @@ void rarch_main_command(unsigned cmd)
return; return;
#ifdef HAVE_NETPLAY #ifdef HAVE_NETPLAY
if (g_extern.netplay) if (driver.netplay_data)
return; return;
#endif #endif
main_state(cmd); main_state(cmd);
@ -3393,8 +3393,8 @@ bool rarch_main_iterate(void)
#endif #endif
#ifdef HAVE_NETPLAY #ifdef HAVE_NETPLAY
if (g_extern.netplay) if (driver.netplay_data)
netplay_pre_frame(g_extern.netplay); netplay_pre_frame(driver.netplay_data);
#endif #endif
if (g_extern.bsv.movie) if (g_extern.bsv.movie)
@ -3435,8 +3435,8 @@ bool rarch_main_iterate(void)
bsv_movie_set_frame_end(g_extern.bsv.movie); bsv_movie_set_frame_end(g_extern.bsv.movie);
#ifdef HAVE_NETPLAY #ifdef HAVE_NETPLAY
if (g_extern.netplay) if (driver.netplay_data)
netplay_post_frame(g_extern.netplay); netplay_post_frame(driver.netplay_data);
#endif #endif
#if defined(HAVE_THREADS) #if defined(HAVE_THREADS)