From 1ad144e451172f2b44567036830560babcb1a086 Mon Sep 17 00:00:00 2001 From: "Dr. Chat" Date: Sat, 27 Jun 2015 17:08:42 -0500 Subject: [PATCH] NetDll_WSARecvFrom Stub --- src/xenia/kernel/xam_net.cc | 47 +++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/src/xenia/kernel/xam_net.cc b/src/xenia/kernel/xam_net.cc index 12af982f0..d39d334e6 100644 --- a/src/xenia/kernel/xam_net.cc +++ b/src/xenia/kernel/xam_net.cc @@ -15,6 +15,7 @@ #include "xenia/base/clock.h" #include "xenia/base/logging.h" #include "xenia/kernel/kernel_state.h" +#include "xenia/kernel/objects/xevent.h" #include "xenia/kernel/util/shim_utils.h" #include "xenia/kernel/xam_private.h" #include "xenia/xbox.h" @@ -42,6 +43,29 @@ typedef struct { uint8_t abOnline[20]; // Online identification } XNADDR; +struct Xsockaddr_t { + xe::be sa_family; + char sa_data[14]; +}; + +struct XWSABUF { + xe::be len; + xe::be buf_ptr; +}; + +struct XWSAOVERLAPPED { + xe::be internal; + xe::be internal_high; + union { + struct { + xe::be offset; + xe::be offset_high; + }; + xe::be pointer; + }; + xe::be event_handle; +}; + void LoadSockaddr(const uint8_t* ptr, sockaddr* out_addr) { out_addr->sa_family = xe::load_and_swap(ptr + 0); switch (out_addr->sa_family) { @@ -206,6 +230,27 @@ SHIM_CALL NetDll_WSAGetLastError_shim(PPCContext* ppc_context, SHIM_SET_RETURN_32(err); } +dword_result_t NetDll_WSARecvFrom(dword_t caller, dword_t socket, + pointer_t buffers_ptr, + dword_t buffer_count, + lpdword_t num_bytes_recv, lpdword_t flags_ptr, + pointer_t from_addr, + pointer_t overlapped_ptr, + lpvoid_t completion_routine_ptr) { + if (overlapped_ptr) { + auto evt = kernel_state()->object_table()->LookupObject( + overlapped_ptr->event_handle); + + if (evt) { + evt->Set(0, false); + } + } + + return 0; +} +DECLARE_XAM_EXPORT(NetDll_WSARecvFrom, + ExportTag::kNetworking | ExportTag::kStub); + struct XnAddrStatus { // Address acquisition is not yet complete const static uint32_t XNET_GET_XNADDR_PENDING = 0x00000000; @@ -304,6 +349,8 @@ SHIM_CALL NetDll_socket_shim(PPCContext* ppc_context, SOCKET socket_handle = socket(af, type, protocol); assert_true(socket_handle >> 32 == 0); + XELOGD("NetDll_socket = %.8X", socket_handle); + SHIM_SET_RETURN_32(static_cast(socket_handle)); }