Skip to content

Commit 8d2b04a

Browse files
committed
[Net] Convert sockets to asio
Makes the socket layer cross-platform while retaining mostly BSD socket style API.
1 parent fc30372 commit 8d2b04a

File tree

6 files changed

+466
-185
lines changed

6 files changed

+466
-185
lines changed

src/xenia/base/platform.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,12 @@
8181
#endif
8282

8383
#if XE_PLATFORM_WIN32
84+
#ifndef WIN32_LEAN_AND_MEAN
8485
#define WIN32_LEAN_AND_MEAN
86+
#endif
87+
#ifndef NOMINMAX
8588
#define NOMINMAX // Don't want windows.h including min/max macros.
89+
#endif
8690
#endif // XE_PLATFORM_WIN32
8791

8892
#if XE_PLATFORM_WIN32

src/xenia/base/platform_win.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@
1919
#ifndef WIN32_LEAN_AND_MEAN
2020
#define WIN32_LEAN_AND_MEAN
2121
#endif
22+
#ifndef NOMINMAX
2223
#define NOMINMAX
24+
#endif
2325
#include <ObjBase.h>
2426
#include <SDKDDKVer.h>
2527
#include <bcrypt.h>

src/xenia/kernel/premake5.lua

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,22 @@ project("xenia-kernel")
66
uuid("ae185c4a-1c4f-4503-9892-328e549e871a")
77
kind("StaticLib")
88
language("C++")
9+
includedirs({
10+
project_root.."/third_party/asio/include",
11+
})
12+
defines({
13+
"ASIO_STANDALONE",
14+
"ASIO_NO_DEPRECATED",
15+
})
16+
filter("platforms:Windows")
17+
defines({
18+
"_WIN32_WINNT=0x0A00", -- Windows 10+ for Asio
19+
"_WINSOCK_DEPRECATED_NO_WARNINGS", -- Suppress deprecated Winsock API warnings
20+
})
21+
filter({})
922
links({
1023
"aes_128",
24+
"asio",
1125
"fmt",
1226
"zlib-ng",
1327
"pugixml",

src/xenia/kernel/xam/xam_net.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@
2121

2222
#ifdef XE_PLATFORM_WIN32
2323
// NOTE: must be included last as it expects windows.h to already be included.
24+
#ifndef _WINSOCK_DEPRECATED_NO_WARNINGS
2425
#define _WINSOCK_DEPRECATED_NO_WARNINGS // inet_addr
26+
#endif
2527
#include <winsock2.h> // NOLINT(build/include_order)
2628
#elif XE_PLATFORM_LINUX
2729
#include <arpa/inet.h>
@@ -311,9 +313,7 @@ DECLARE_XAM_EXPORT1(NetDll_WSACleanup, kNetworking, kImplemented);
311313
// Xbox shares space between normal error codes and WSA errors.
312314
// This under the hood returns directly value received from RtlGetLastError.
313315
dword_result_t NetDll_WSAGetLastError_entry() {
314-
uint32_t last_error = XThread::GetLastError();
315-
XELOGD("NetDll_WSAGetLastError: {}", last_error);
316-
return last_error;
316+
return XThread::GetLastError();
317317
}
318318
DECLARE_XAM_EXPORT1(NetDll_WSAGetLastError, kNetworking, kImplemented);
319319

0 commit comments

Comments
 (0)