Fixed Xbox 360 AGAIN.

This commit is contained in:
2026-08-08 02:43:05 -07:00
parent bc871dd39b
commit 53c32884b3
6 changed files with 368 additions and 135 deletions
@@ -486,31 +486,41 @@ bool NetworkSocketLayer::JoinGame(const char *ip, int port)
s_hostConnectionSocket = INVALID_SOCKET;
}
XNDNS *pDns = NULL;
int iResult = XNetDnsLookup(ip, NULL, &pDns);
if (iResult != 0 || pDns == NULL)
{
app.DebugPrintf("XNetDnsLookup failed for %s - %d\n", ip, iResult);
return false;
}
while (pDns->iStatus == WSAEINPROGRESS)
{
Sleep(10);
}
if (pDns->iStatus != 0 || pDns->cina == 0)
{
app.DebugPrintf("pDns->iStatus failed for %s - %d\n", ip, iResult);
XNetDnsRelease(pDns);
return false;
}
int iResult = 0;
struct sockaddr_in addr = {};
addr.sin_family = AF_INET;
addr.sin_port = htons((WORD)port);
addr.sin_addr = pDns->aina[0];
XNetDnsRelease(pDns);
unsigned long ipAddr = inet_addr(ip);
if (ipAddr != INADDR_NONE)
{
addr.sin_addr.s_addr = ipAddr;
}
else
{
XNDNS *pDns = NULL;
iResult = XNetDnsLookup(ip, NULL, &pDns);
if (iResult != 0 || pDns == NULL)
{
app.DebugPrintf("XNetDnsLookup failed for %s - %d\n", ip, iResult);
return false;
}
while (pDns->iStatus == WSAEINPROGRESS)
{
Sleep(10);
}
if (pDns->iStatus != 0 || pDns->cina == 0)
{
app.DebugPrintf("pDns->iStatus failed for %s - %d\n", ip, iResult);
XNetDnsRelease(pDns);
return false;
}
addr.sin_addr = pDns->aina[0];
XNetDnsRelease(pDns);
}
bool connected = false;
BYTE assignedSmallId = 0;
@@ -935,7 +945,7 @@ int NetworkSocketLayer::AcceptThreadProc(LPVOID param)
setsockopt(clientSocket, IPPROTO_TCP, TCP_NODELAY, (const char *)&noDelay, sizeof(noDelay));
extern QNET_STATE _iQNetStubState;
if (_iQNetStubState != QNET_STATE_GAME_PLAY)
if (_iQNetStubState != QNET_STATE_GAME_PLAY && _iQNetStubState != QNET_STATE_SESSION_STARTING)
{
app.DebugPrintf("Win64 LAN: Rejecting connection, game not ready\n");
closesocket(clientSocket);
@@ -1260,7 +1270,8 @@ void NetworkSocketLayer::UpdateAdvertisePlayerNames(BYTE count, const char playe
s_advertiseData.playerCount = count;
for (int i = 0; i < count && i < 8; i++)
{
memcpy(s_advertiseData.playerNames[i], playerNames[i], XUSER_NAME_SIZE);
memcpy(s_advertiseData.playerNames[i], playerNames[i],
NETWORK_LAN_PLAYER_NAME_SIZE < (int)XUSER_NAME_SIZE ? NETWORK_LAN_PLAYER_NAME_SIZE : (int)XUSER_NAME_SIZE);
}
LeaveCriticalSection(&s_advertiseLock);
}