Trying really hard to keep games from spinning up networking.

This commit is contained in:
Ben Vanik 2014-07-02 21:57:21 -07:00
parent d5f27dbf34
commit a0cb341662
2 changed files with 29 additions and 10 deletions

View File

@ -35,7 +35,8 @@ SHIM_CALL NetDll_XNetStartup_shim(
arg0, arg0,
params_ptr); params_ptr);
SHIM_SET_RETURN_64(0); // Fail for now.
SHIM_SET_RETURN_64(1);
} }
SHIM_CALL NetDll_WSAStartup_shim( SHIM_CALL NetDll_WSAStartup_shim(
@ -60,13 +61,25 @@ SHIM_CALL NetDll_WSAStartup_shim(
SHIM_SET_MEM_32(data_ptr + 0x190, 0); SHIM_SET_MEM_32(data_ptr + 0x190, 0);
} }
SHIM_SET_RETURN_64(0); // Fail for now. This prevents games from actually trying to use this stuff.
SHIM_SET_RETURN_64(1);
} }
SHIM_CALL NetDll_WSAGetLastError_shim( SHIM_CALL NetDll_WSAGetLastError_shim(
PPCContext* ppc_state, KernelState* state) { PPCContext* ppc_state, KernelState* state) {
XELOGD("NetDll_WSAGetLastError()"); XELOGD("NetDll_WSAGetLastError()");
SHIM_SET_RETURN_32(WSAENETDOWN); SHIM_SET_RETURN_32(10093L); // WSANOTINITIALISED
}
SHIM_CALL NetDll_XNetGetTitleXnAddr_shim(
PPCContext* ppc_state, KernelState* state) {
uint32_t arg0 = SHIM_GET_ARG_32(0);
uint32_t arg1 = SHIM_GET_ARG_32(1);
XELOGD(
"NetDll_XNetGetTitleXnAddr(%d, %.8X)",
arg0,
arg1);
SHIM_SET_RETURN_32(0x00000001);
} }
SHIM_CALL NetDll_XNetGetEthernetLinkStatus_shim( SHIM_CALL NetDll_XNetGetEthernetLinkStatus_shim(
@ -86,7 +99,7 @@ SHIM_CALL NetDll_inet_addr_shim(
XELOGD( XELOGD(
"NetDll_inet_addr(%.8X)", "NetDll_inet_addr(%.8X)",
cp_ptr); cp_ptr);
SHIM_SET_RETURN_32(INADDR_NONE); SHIM_SET_RETURN_32(0xFFFFFFFF); // X_INADDR_NONE
} }
SHIM_CALL NetDll_socket_shim( SHIM_CALL NetDll_socket_shim(
@ -101,7 +114,7 @@ SHIM_CALL NetDll_socket_shim(
af, af,
type, type,
protocol); protocol);
SHIM_SET_RETURN_32(SOCKET_ERROR); SHIM_SET_RETURN_32(X_SOCKET_ERROR);
} }
SHIM_CALL NetDll_setsockopt_shim( SHIM_CALL NetDll_setsockopt_shim(
@ -120,7 +133,7 @@ SHIM_CALL NetDll_setsockopt_shim(
optname, optname,
optval_ptr, optval_ptr,
optlen); optlen);
SHIM_SET_RETURN_32(SOCKET_ERROR); SHIM_SET_RETURN_32(X_SOCKET_ERROR);
} }
SHIM_CALL NetDll_connect_shim( SHIM_CALL NetDll_connect_shim(
@ -133,7 +146,7 @@ SHIM_CALL NetDll_connect_shim(
socket_ptr, socket_ptr,
sockaddr_ptr, sockaddr_ptr,
namelen); namelen);
SHIM_SET_RETURN_32(SOCKET_ERROR); SHIM_SET_RETURN_32(X_SOCKET_ERROR);
} }
SHIM_CALL NetDll_recv_shim( SHIM_CALL NetDll_recv_shim(
@ -150,7 +163,7 @@ SHIM_CALL NetDll_recv_shim(
buf_ptr, buf_ptr,
len, len,
flags); flags);
SHIM_SET_RETURN_32(SOCKET_ERROR); SHIM_SET_RETURN_32(X_SOCKET_ERROR);
} }
SHIM_CALL NetDll_recvfrom_shim( SHIM_CALL NetDll_recvfrom_shim(
@ -171,7 +184,7 @@ SHIM_CALL NetDll_recvfrom_shim(
flags, flags,
from_ptr, from_ptr,
fromlen_ptr); fromlen_ptr);
SHIM_SET_RETURN_32(SOCKET_ERROR); SHIM_SET_RETURN_32(X_SOCKET_ERROR);
} }
SHIM_CALL NetDll_send_shim( SHIM_CALL NetDll_send_shim(
@ -188,7 +201,7 @@ SHIM_CALL NetDll_send_shim(
buf_ptr, buf_ptr,
len, len,
flags); flags);
SHIM_SET_RETURN_32(SOCKET_ERROR); SHIM_SET_RETURN_32(X_SOCKET_ERROR);
} }
@ -201,6 +214,7 @@ void xe::kernel::xam::RegisterNetExports(
SHIM_SET_MAPPING("xam.xex", NetDll_XNetStartup, state); SHIM_SET_MAPPING("xam.xex", NetDll_XNetStartup, state);
SHIM_SET_MAPPING("xam.xex", NetDll_WSAStartup, state); SHIM_SET_MAPPING("xam.xex", NetDll_WSAStartup, state);
SHIM_SET_MAPPING("xam.xex", NetDll_WSAGetLastError, state); SHIM_SET_MAPPING("xam.xex", NetDll_WSAGetLastError, state);
SHIM_SET_MAPPING("xam.xex", NetDll_XNetGetTitleXnAddr, state);
SHIM_SET_MAPPING("xam.xex", NetDll_XNetGetEthernetLinkStatus, state); SHIM_SET_MAPPING("xam.xex", NetDll_XNetGetEthernetLinkStatus, state);
SHIM_SET_MAPPING("xam.xex", NetDll_inet_addr, state); SHIM_SET_MAPPING("xam.xex", NetDll_inet_addr, state);
SHIM_SET_MAPPING("xam.xex", NetDll_socket, state); SHIM_SET_MAPPING("xam.xex", NetDll_socket, state);

View File

@ -116,6 +116,11 @@ typedef uint32_t X_RESULT;
#define X_PROCTYPE_SYSTEM 2 #define X_PROCTYPE_SYSTEM 2
// Sockets/networking.
#define X_INVALID_SOCKET (uint32_t)(~0)
#define X_SOCKET_ERROR (uint32_t)(-1)
// Thread enums. // Thread enums.
#define X_CREATE_SUSPENDED 0x00000004 #define X_CREATE_SUSPENDED 0x00000004