diff --git a/cores/retropad/Makefile b/cores/retropad/Makefile index fefae26434..9c6b54a416 100644 --- a/cores/retropad/Makefile +++ b/cores/retropad/Makefile @@ -103,7 +103,12 @@ else SHARED := -shared -static-libgcc -static-libstdc++ -s -Wl,--version-script=link.T -Wl,--no-undefined endif -LDFLAGS += $(LIBM) -lws2_32 + +LDFLAGS += $(LIBM) + +ifeq ($(platform), win) +LDFLAGS += -lws2_32 +endif ifeq ($(DEBUG), 1) CFLAGS += -O0 -g @@ -111,7 +116,7 @@ else CFLAGS += -O3 endif -OBJECTS := retropad.o +OBJECTS := ../../libretro-common/net/net_compat.o ../../libretro-common/net/net_socket.o retropad.o CFLAGS += -I../../libretro-common/include -Wall -pedantic $(fpic) ifneq (,$(findstring qnx,$(platform))) diff --git a/cores/retropad/retropad.c b/cores/retropad/retropad.c index 87e8f1cfa4..59fee41d8e 100644 --- a/cores/retropad/retropad.c +++ b/cores/retropad/retropad.c @@ -35,9 +35,8 @@ #include #include - #include - #include - #include + #include + #include #include @@ -51,7 +50,6 @@ int s, slen=sizeof(si_other); char message[64]; char server[64]; int port; -WSADATA wsa; int input_state = 0; void retro_init(void) @@ -59,11 +57,7 @@ void retro_init(void) frame_buf = (uint16_t*)calloc(320 * 240, sizeof(uint16_t)); //Initialise winsock log_cb(RETRO_LOG_INFO, "Initialising sockets\n"); - if (WSAStartup(MAKEWORD(2,2),&wsa) != 0) - { - log_cb(RETRO_LOG_INFO, "Failed. Error Code : %d",WSAGetLastError()); - } - log_cb(RETRO_LOG_INFO, "Sockets initialised.\n"); + network_init(); } void retro_deinit(void) @@ -245,14 +239,14 @@ bool retro_load_game(const struct retro_game_info *info) //create socket if ( (s=socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) == SOCKET_ERROR) { - log_cb(RETRO_LOG_INFO, "socket() failed with error code : %d" , WSAGetLastError()); + log_cb(RETRO_LOG_INFO, "socket failed"); } //setup address structure memset((char *) &si_other, 0, sizeof(si_other)); si_other.sin_family = AF_INET; si_other.sin_port = htons(port); si_other.sin_addr.S_un.S_addr = inet_addr(server); - log_cb(RETRO_LOG_INFO, "Server : %s" , server); + log_cb(RETRO_LOG_INFO, "Server IP Address: %s\n" , server); return true; }