Revert "Create RARCH_NETPLAY_CTL_IS_ENABLED, RARCH_NETPLAY_CTL_SET_ENABLE,"

This reverts commit 1a978b0f3cfff8ab450a9e6ee62a762a997db6dc.
This commit is contained in:
twinaphex 2016-03-18 00:32:02 +01:00
parent 7f1c4fa2ff
commit 91d14cbb62
9 changed files with 15 additions and 55 deletions

View File

@ -31,10 +31,6 @@
#include "../verbosity.h" #include "../verbosity.h"
#include "../string_list_special.h" #include "../string_list_special.h"
#ifdef HAVE_NETPLAY
#include "../netplay/netplay.h"
#endif
#ifndef AUDIO_BUFFER_FREE_SAMPLES_COUNT #ifndef AUDIO_BUFFER_FREE_SAMPLES_COUNT
#define AUDIO_BUFFER_FREE_SAMPLES_COUNT (8 * 1024) #define AUDIO_BUFFER_FREE_SAMPLES_COUNT (8 * 1024)
#endif #endif
@ -854,12 +850,15 @@ bool audio_driver_ctl(enum rarch_audio_ctl_state state, void *data)
{ {
const struct retro_audio_callback *cb = const struct retro_audio_callback *cb =
(const struct retro_audio_callback*)data; (const struct retro_audio_callback*)data;
#ifdef HAVE_NETPLAY
global_t *global = global_get_ptr();
#endif
if (recording_driver_get_data_ptr()) /* A/V sync is a must. */ if (recording_driver_get_data_ptr()) /* A/V sync is a must. */
return false; return false;
#ifdef HAVE_NETPLAY #ifdef HAVE_NETPLAY
if (netplay_driver_ctl(RARCH_NETPLAY_CTL_IS_ENABLED, NULL)) if (global->netplay.enable)
return false; return false;
#endif #endif
if (cb) if (cb)

View File

@ -461,8 +461,7 @@ static void event_load_auto_state(void)
global_t *global = global_get_ptr(); global_t *global = global_get_ptr();
#ifdef HAVE_NETPLAY #ifdef HAVE_NETPLAY
if (netplay_driver_ctl(RARCH_NETPLAY_CTL_IS_ENABLED, NULL) if (global->netplay.enable && !global->netplay.is_spectate)
&& !global->netplay.is_spectate)
return; return;
#endif #endif

View File

@ -36,10 +36,6 @@
#include "system.h" #include "system.h"
#include "verbosity.h" #include "verbosity.h"
#ifdef HAVE_NETPLAY
#include "netplay/netplay.h"
#endif
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include "config.h" #include "config.h"
#endif #endif
@ -2042,7 +2038,7 @@ bool config_load_override(void)
} }
#ifdef HAVE_NETPLAY #ifdef HAVE_NETPLAY
if (netplay_driver_ctl(RARCH_NETPLAY_CTL_IS_ENABLED, NULL)) if (global->netplay.enable)
{ {
RARCH_WARN("Overrides: can't use overrides in conjunction with netplay, disabling overrides\n"); RARCH_WARN("Overrides: can't use overrides in conjunction with netplay, disabling overrides\n");
return false; return false;

View File

@ -55,9 +55,6 @@
#include "../tasks/tasks_internal.h" #include "../tasks/tasks_internal.h"
#ifdef HAVE_NETPLAY
#include "../netplay/netplay.h"
#endif
struct rarch_setting_info struct rarch_setting_info
{ {
@ -157,9 +154,6 @@ struct rarch_setting
bool enforce_maxrange; bool enforce_maxrange;
}; };
/* static local variables */
static bool setting_netplay_enable;
/* forward decls */ /* forward decls */
static void setting_get_string_representation_default(void *data, static void setting_get_string_representation_default(void *data,
char *s, size_t len); char *s, size_t len);
@ -2845,14 +2839,6 @@ void general_write_handler(void *data)
switch (hash) switch (hash)
{ {
case MENU_LABEL_NETPLAY_ENABLE:
#ifdef HAVE_NETPLAY
if (*setting->value.boolean)
netplay_driver_ctl(RARCH_NETPLAY_CTL_SET_ENABLE, NULL);
else
netplay_driver_ctl(RARCH_NETPLAY_CTL_UNSET_ENABLE, NULL);
#endif
break;
case MENU_LABEL_VIDEO_THREADED: case MENU_LABEL_VIDEO_THREADED:
{ {
if (*setting->value.boolean) if (*setting->value.boolean)
@ -6367,7 +6353,7 @@ static bool setting_append_list_netplay_options(
CONFIG_BOOL( CONFIG_BOOL(
list, list_info, list, list_info,
&setting_netplay_enable, &global->netplay.enable,
menu_hash_to_str(MENU_LABEL_NETPLAY_ENABLE), menu_hash_to_str(MENU_LABEL_NETPLAY_ENABLE),
menu_hash_to_str(MENU_LABEL_VALUE_NETPLAY_ENABLE), menu_hash_to_str(MENU_LABEL_VALUE_NETPLAY_ENABLE),
false, false,

View File

@ -1102,9 +1102,6 @@ void netplay_post_frame(netplay_t *netplay)
void deinit_netplay(void) void deinit_netplay(void)
{ {
netplay_t *netplay = (netplay_t*)netplay_data; netplay_t *netplay = (netplay_t*)netplay_data;
netplay_driver_ctl(RARCH_NETPLAY_CTL_DEINIT, NULL);
if (netplay) if (netplay)
netplay_free(netplay); netplay_free(netplay);
netplay_data = NULL; netplay_data = NULL;
@ -1126,7 +1123,7 @@ bool init_netplay(void)
settings_t *settings = config_get_ptr(); settings_t *settings = config_get_ptr();
global_t *global = global_get_ptr(); global_t *global = global_get_ptr();
if (!netplay_driver_ctl(RARCH_NETPLAY_CTL_IS_ENABLED, NULL)) if (!global->netplay.enable)
return false; return false;
if (bsv_movie_ctl(BSV_MOVIE_CTL_START_PLAYBACK, NULL)) if (bsv_movie_ctl(BSV_MOVIE_CTL_START_PLAYBACK, NULL))
@ -1166,23 +1163,11 @@ bool init_netplay(void)
bool netplay_driver_ctl(enum rarch_netplay_ctl_state state, void *data) bool netplay_driver_ctl(enum rarch_netplay_ctl_state state, void *data)
{ {
static bool netplay_is_enabled = false;
if (!netplay_data) if (!netplay_data)
return false; return false;
switch (state) switch (state)
{ {
case RARCH_NETPLAY_CTL_DEINIT:
netplay_is_enabled = false;
break;
case RARCH_NETPLAY_CTL_IS_ENABLED:
return netplay_is_enabled;
case RARCH_NETPLAY_CTL_SET_ENABLE:
netplay_is_enabled = true;
break;
case RARCH_NETPLAY_CTL_UNSET_ENABLE:
netplay_is_enabled = false;
break;
case RARCH_NETPLAY_CTL_IS_DATA_INITED: case RARCH_NETPLAY_CTL_IS_DATA_INITED:
return true; return true;
case RARCH_NETPLAY_CTL_POST_FRAME: case RARCH_NETPLAY_CTL_POST_FRAME:

View File

@ -31,15 +31,11 @@ typedef struct netplay netplay_t;
enum rarch_netplay_ctl_state enum rarch_netplay_ctl_state
{ {
RARCH_NETPLAY_CTL_NONE = 0, RARCH_NETPLAY_CTL_NONE = 0,
RARCH_NETPLAY_CTL_DEINIT,
RARCH_NETPLAY_CTL_FLIP_PLAYERS, RARCH_NETPLAY_CTL_FLIP_PLAYERS,
RARCH_NETPLAY_CTL_FULLSCREEN_TOGGLE, RARCH_NETPLAY_CTL_FULLSCREEN_TOGGLE,
RARCH_NETPLAY_CTL_POST_FRAME, RARCH_NETPLAY_CTL_POST_FRAME,
RARCH_NETPLAY_CTL_PRE_FRAME, RARCH_NETPLAY_CTL_PRE_FRAME,
RARCH_NETPLAY_CTL_IS_DATA_INITED, RARCH_NETPLAY_CTL_IS_DATA_INITED
RARCH_NETPLAY_CTL_IS_ENABLED,
RARCH_NETPLAY_CTL_SET_ENABLE,
RARCH_NETPLAY_CTL_UNSET_ENABLE
}; };
enum netplay_cmd enum netplay_cmd

View File

@ -68,10 +68,6 @@
#include "command.h" #include "command.h"
#endif #endif
#ifdef HAVE_NETPLAY
#include "netplay/netplay.h"
#endif
#ifdef HAVE_MENU #ifdef HAVE_MENU
#include "menu/menu_driver.h" #include "menu/menu_driver.h"
#include "menu/menu_content.h" #include "menu/menu_content.h"
@ -856,13 +852,13 @@ static void parse_input(int argc, char *argv[])
#ifdef HAVE_NETPLAY #ifdef HAVE_NETPLAY
case 'H': case 'H':
global->has_set.netplay_ip_address = true; global->has_set.netplay_ip_address = true;
netplay_driver_ctl(RARCH_NETPLAY_CTL_SET_ENABLE, NULL); global->netplay.enable = true;
*global->netplay.server = '\0'; *global->netplay.server = '\0';
break; break;
case 'C': case 'C':
global->has_set.netplay_ip_address = true; global->has_set.netplay_ip_address = true;
netplay_driver_ctl(RARCH_NETPLAY_CTL_SET_ENABLE, NULL); global->netplay.enable = true;
strlcpy(global->netplay.server, optarg, strlcpy(global->netplay.server, optarg,
sizeof(global->netplay.server)); sizeof(global->netplay.server));
break; break;

View File

@ -572,9 +572,11 @@ bool runloop_ctl(enum runloop_ctl_state state, void *data)
const struct retro_frame_time_callback *info = const struct retro_frame_time_callback *info =
(const struct retro_frame_time_callback*)data; (const struct retro_frame_time_callback*)data;
#ifdef HAVE_NETPLAY #ifdef HAVE_NETPLAY
global_t *global = global_get_ptr();
/* retro_run() will be called in very strange and /* retro_run() will be called in very strange and
* mysterious ways, have to disable it. */ * mysterious ways, have to disable it. */
if (netplay_driver_ctl(RARCH_NETPLAY_CTL_IS_ENABLED, NULL)) if (global->netplay.enable)
return false; return false;
#endif #endif
runloop_frame_time = *info; runloop_frame_time = *info;

View File

@ -242,6 +242,7 @@ typedef struct global
struct struct
{ {
char server[PATH_MAX_LENGTH]; char server[PATH_MAX_LENGTH];
bool enable;
bool is_client; bool is_client;
bool is_spectate; bool is_spectate;
unsigned sync_frames; unsigned sync_frames;