Core Update Manager works again when HAVE_NETWORKING is defined -

enygmata jumped the gun with refactoring the HAVE_NETPLAY define
This commit is contained in:
twinaphex 2015-01-28 08:55:02 +01:00
parent bb5d2877cf
commit 524f754ec3
10 changed files with 95 additions and 86 deletions

View File

@ -622,7 +622,8 @@ endif
ifeq ($(HAVE_NETWORKING), 1)
DEFINES += -DHAVE_NETWORKING
OBJ += net_compat.o
OBJ += net_compat.o \
net_http.o
ifneq ($(findstring Win32,$(OS)),)
LIBS += -lws2_32
@ -630,8 +631,7 @@ ifeq ($(HAVE_NETWORKING), 1)
ifeq ($(HAVE_NETPLAY), 1)
DEFINES += -DHAVE_NETPLAY -DHAVE_NETWORK_CMD
OBJ += netplay.o \
net_http.o
OBJ += netplay.o
endif
endif

View File

@ -59,7 +59,7 @@
#include "command.h"
#endif
#ifdef HAVE_NETPLAY
#ifdef HAVE_NETWORKING
#include "net_http.h"
#endif
@ -391,7 +391,7 @@ typedef struct rarch_resolution
#define AUDIO_BUFFER_FREE_SAMPLES_COUNT (8 * 1024)
#define MEASURE_FRAME_TIME_SAMPLES_COUNT (2 * 1024)
#ifdef HAVE_NETPLAY
#ifdef HAVE_NETWORKING
typedef int (*http_cb_t )(void *data, size_t len);
#endif
@ -579,7 +579,7 @@ struct global
#endif
msg_queue_t *msg_queue;
#ifdef HAVE_NETPLAY
#ifdef HAVE_NETWORKING
msg_queue_t *http_msg_queue;
http_t *http_handle;
http_cb_t http_cb;
@ -784,7 +784,7 @@ static inline void rarch_fail(int error_code, const char *error)
longjmp(g_extern.error_sjlj_context, error_code);
}
#ifdef HAVE_NETPLAY
#ifdef HAVE_NETWORKING
void net_http_set_pending_cb(http_cb_t cb);
#endif

View File

@ -28,7 +28,7 @@
#include "../retroarch.h"
#include "../performance.h"
#ifdef HAVE_NETPLAY
#ifdef HAVE_NETWORKING
#include "../net_http.h"
#endif
@ -1325,7 +1325,7 @@ static int action_ok_save_state(const char *path,
return generic_action_ok_command(RARCH_CMD_RESUME);
}
#ifdef HAVE_NETPLAY
#ifdef HAVE_NETWORKING
/* HACK - we have to find some way to pass state inbetween
* function pointer callback functions that don't necessarily
* call each other. */
@ -1364,7 +1364,7 @@ static int cb_core_manager_download(void *data_, size_t len)
static int action_ok_core_manager_list(const char *path,
const char *label, unsigned type, size_t idx)
{
#ifdef HAVE_NETPLAY
#ifdef HAVE_NETWORKING
char core_path[PATH_MAX_LENGTH], msg[PATH_MAX_LENGTH];
fill_pathname_join(core_path, g_settings.network.buildbot_url,
path, sizeof(core_path));
@ -2876,7 +2876,7 @@ static int deferred_push_disk_options(void *data, void *userdata,
return 0;
}
#ifdef HAVE_NETPLAY
#ifdef HAVE_NETWORKING
static void print_buf_lines(file_list_t *list, char *buf, int buf_size,
unsigned type)
{
@ -2955,7 +2955,7 @@ static int cb_core_manager_list(void *data_, size_t len)
static int deferred_push_core_manager_list(void *data, void *userdata,
const char *path, const char *label, unsigned type)
{
#ifdef HAVE_NETPLAY
#ifdef HAVE_NETWORKING
char url_path[PATH_MAX_LENGTH];
strlcpy(core_manager_list_path, path,
@ -2970,7 +2970,7 @@ static int deferred_push_core_manager_list(void *data, void *userdata,
file_list_t *list = (file_list_t*)data;
menu_list_clear(list);
#ifdef HAVE_NETPLAY
#ifdef HAVE_NETWORKING
menu_list_push(list,
"Buildbot URL not configured.", "",
0, 0);
@ -2985,7 +2985,7 @@ static int deferred_push_core_manager_list(void *data, void *userdata,
return 0;
}
#ifdef HAVE_NETPLAY
#ifdef HAVE_NETWORKING
rarch_main_command(RARCH_CMD_NETWORK_INIT);
fill_pathname_join(url_path, g_settings.network.buildbot_url,

View File

@ -153,3 +153,52 @@ int socket_receive_all_blocking(int fd, void *data_, size_t size)
return true;
}
/**
* network_init:
*
* Platform specific socket library initialization.
*
* Returns: true (1) if successful, otherwise false (0).
**/
bool network_init(void)
{
#ifdef _WIN32
WSADATA wsaData;
#endif
static bool inited = false;
if (inited)
return true;
#if defined(_WIN32)
if (WSAStartup(MAKEWORD(2, 2), &wsaData) != 0)
{
network_deinit();
return false;
}
RARCH_LOG("WSA Initialized.\n");
#elif defined(__CELLOS_LV2__) && !defined(__PSL1GHT__)
cellSysmoduleLoadModule(CELL_SYSMODULE_NET);
sys_net_initialize_network();
#else
signal(SIGPIPE, SIG_IGN); /* Do not like SIGPIPE killing our app. */
#endif
inited = true;
return true;
}
/**
* network_deinit:
*
* Deinitialize platform specific socket libraries.
**/
void network_deinit(void)
{
#if defined(_WIN32)
WSACleanup();
#elif defined(__CELLOS_LV2__) && !defined(__PSL1GHT__)
sys_net_finalize_network();
cellSysmoduleUnloadModule(CELL_SYSMODULE_NET);
#endif
}

View File

@ -155,5 +155,21 @@ int socket_send_all_blocking(int fd, const void *data_, size_t size);
int socket_receive_all_blocking(int fd, void *data_, size_t size);
/**
* network_init:
*
* Platform specific socket library initialization.
*
* Returns: true (1) if successful, otherwise false (0).
**/
bool network_init(void);
/**
* network_deinit:
*
* Deinitialize platform specific socket libraries.
**/
void network_deinit(void);
#endif

View File

@ -780,55 +780,6 @@ static bool init_udp_socket(netplay_t *netplay, const char *server,
return true;
}
/**
* network_init:
*
* Platform specific socket library initialization.
*
* Returns: true (1) if successful, otherwise false (0).
**/
bool network_init(void)
{
#ifdef _WIN32
WSADATA wsaData;
#endif
static bool inited = false;
if (inited)
return true;
#if defined(_WIN32)
if (WSAStartup(MAKEWORD(2, 2), &wsaData) != 0)
{
network_deinit();
return false;
}
RARCH_LOG("WSA Initialized.\n");
#elif defined(__CELLOS_LV2__) && !defined(__PSL1GHT__)
cellSysmoduleLoadModule(CELL_SYSMODULE_NET);
sys_net_initialize_network();
#else
signal(SIGPIPE, SIG_IGN); /* Do not like SIGPIPE killing our app. */
#endif
inited = true;
return true;
}
/**
* network_deinit:
*
* Deinitialize platform specific socket libraries.
**/
void network_deinit(void)
{
#if defined(_WIN32)
WSACleanup();
#elif defined(__CELLOS_LV2__) && !defined(__PSL1GHT__)
sys_net_finalize_network();
cellSysmoduleUnloadModule(CELL_SYSMODULE_NET);
#endif
}
static bool init_socket(netplay_t *netplay, const char *server, uint16_t port)
{
if (!network_init())

View File

@ -44,22 +44,6 @@ int16_t input_state_spectate(unsigned port, unsigned device,
int16_t input_state_spectate_client(unsigned port, unsigned device,
unsigned idx, unsigned id);
/**
* network_init:
*
* Platform specific socket library initialization.
*
* Returns: true (1) if successful, otherwise false (0).
**/
bool network_init(void);
/**
* network_deinit:
*
* Deinitialize platform specific socket libraries.
**/
void network_deinit(void);
/**
* netplay_new:
* @server : IP address of server.

View File

@ -49,6 +49,11 @@
#include "menu/menu_input.h"
#endif
#ifdef HAVE_NETWORKING
#include "net_compat.h"
#include "net_http.h"
#endif
#ifdef HAVE_NETPLAY
#include "netplay.h"
#endif
@ -2934,7 +2939,7 @@ bool rarch_main_command(unsigned cmd)
rarch_main_command(RARCH_CMD_MSG_QUEUE_DEINIT);
if (!g_extern.msg_queue)
rarch_assert(g_extern.msg_queue = msg_queue_new(8));
#ifdef HAVE_NETPLAY
#ifdef HAVE_NETWORKING
if (!g_extern.http_msg_queue)
rarch_assert(g_extern.http_msg_queue = msg_queue_new(8));
#endif
@ -2959,12 +2964,12 @@ bool rarch_main_command(unsigned cmd)
#endif
break;
case RARCH_CMD_NETWORK_DEINIT:
#ifdef HAVE_NETPLAY
#ifdef HAVE_NETWORKING
network_deinit();
#endif
break;
case RARCH_CMD_NETWORK_INIT:
#ifdef HAVE_NETPLAY
#ifdef HAVE_NETWORKING
network_init();
#endif
break;

View File

@ -32,6 +32,10 @@
#include "netplay.h"
#endif
#ifdef HAVE_NETWORKING
#include "net_http.h"
#endif
/* Convenience macros. */
#define check_oneshot_func(trigger_input) (check_is_oneshot(BIT64_GET(trigger_input, RARCH_FRAMEADVANCE), BIT64_GET(trigger_input, RARCH_REWIND)))
#define check_slowmotion_func(input) (check_slowmotion(BIT64_GET(input, RARCH_SLOWMOTION)))
@ -866,7 +870,7 @@ static int rarch_main_iterate_quit(void)
return -1;
}
#ifdef HAVE_NETPLAY
#ifdef HAVE_NETWORKING
static http_cb_t pending_cb;
@ -996,7 +1000,7 @@ int rarch_main_iterate(void)
do_pre_state_checks(input, old_input, trigger_input);
#ifdef HAVE_NETPLAY
#ifdef HAVE_NETWORKING
if (g_extern.http_handle)
{
if (!rarch_main_iterate_http_transfer())

View File

@ -3351,7 +3351,7 @@ static bool setting_data_append_list_main_menu_options(
settings_data_list_current_add_flags(list, list_info, SD_FLAG_BROWSER_ACTION);
#endif
#ifdef HAVE_NETPLAY
#ifdef HAVE_NETWORKING
CONFIG_ACTION(
"core_manager_list",
"Core Update Manager",
@ -5457,7 +5457,7 @@ static bool setting_data_append_list_core_manager_options(
rarch_setting_t **list,
rarch_setting_info_t *list_info)
{
#ifdef HAVE_NETPLAY
#ifdef HAVE_NETWORKING
rarch_setting_group_info_t group_info;
rarch_setting_group_info_t subgroup_info;