diff --git a/Minecraft.Client/Common/Network/NetworkSocketLayer.cpp b/Minecraft.Client/Common/Network/NetworkSocketLayer.cpp index 66d3ba31..7e2f07fa 100644 --- a/Minecraft.Client/Common/Network/NetworkSocketLayer.cpp +++ b/Minecraft.Client/Common/Network/NetworkSocketLayer.cpp @@ -59,18 +59,16 @@ std::vector NetworkSocketLayer::s_freeSmallIds; // only goes true on a successful Initialize(), and a failed one gets retried static bool s_locksCreated = false; - -bool g_MultiplayerHost = false; -#if defined __ORBIS__ -// Orbis has direct lan networking so it can bypass psn account checks -bool g_MultiplayerJoin = true; -int g_MultiplayerPort = NETWORK_LAN_DEFAULT_PORT; -char g_MultiplayerIP[256] = ""; -#else +#if defined _WINDOWS64 +bool g_MultiplayerHost = true; bool g_MultiplayerJoin = false; -int g_MultiplayerPort = NETWORK_LAN_DEFAULT_PORT; -char g_MultiplayerIP[256] = "127.0.0.1"; +#else +bool g_MultiplayerHost = false; +bool g_MultiplayerJoin = true; #endif +int g_MultiplayerPort = NETWORK_LAN_DEFAULT_PORT; +char g_MultiplayerIP[256] = "192.168.0.69"; + bool NetworkSocketLayer::Initialize() { @@ -1266,6 +1264,38 @@ int NetworkSocketLayer::AdvertiseThreadProc(LPVOID param) #ifdef __PSVITA__ int sent = sendto(s_advertiseSock, (const char *)&data, sizeof(data), 0, (const sockaddr *)&broadcastAddr, sizeof(broadcastAddr)); +#elif defined _WINDOWS64 + //Broadcast on all interfaces. + INTERFACE_INFO ifaces[32]; + DWORD ifaceBytes = 0; + int numIfaces = 0; + int sent = SOCKET_ERROR; + if (WSAIoctl(s_advertiseSock, SIO_GET_INTERFACE_LIST, NULL, 0, + ifaces, sizeof(ifaces), &ifaceBytes, NULL, NULL) != SOCKET_ERROR) + { + numIfaces = (int)(ifaceBytes / sizeof(INTERFACE_INFO)); + } + for (int i = 0; i < numIfaces; i++) + { + if (!(ifaces[i].iiFlags & IFF_UP)) continue; + if (ifaces[i].iiFlags & IFF_LOOPBACK) continue; + if (!(ifaces[i].iiFlags & IFF_BROADCAST)) continue; + + u_long ifIp = ifaces[i].iiAddress.AddressIn.sin_addr.s_addr; + u_long ifMask = ifaces[i].iiNetmask.AddressIn.sin_addr.s_addr; + broadcastAddr.sin_addr.s_addr = (ifIp & ifMask) | ~ifMask; + + int r = sendto(s_advertiseSock, (const char *)&data, sizeof(data), 0, + (struct sockaddr *)&broadcastAddr, sizeof(broadcastAddr)); + if (r != SOCKET_ERROR) sent = r; + } + if (sent == SOCKET_ERROR) + { + // no interface worked + broadcastAddr.sin_addr.s_addr = INADDR_BROADCAST; + sent = sendto(s_advertiseSock, (const char *)&data, sizeof(data), 0, + (struct sockaddr *)&broadcastAddr, sizeof(broadcastAddr)); + } #else int sent = sendto(s_advertiseSock, (const char *)&data, sizeof(data), 0, (struct sockaddr *)&broadcastAddr, sizeof(broadcastAddr)); diff --git a/Minecraft.Client/Minecraft.Client.vcxproj b/Minecraft.Client/Minecraft.Client.vcxproj index 9eab3062..6cdba948 100644 --- a/Minecraft.Client/Minecraft.Client.vcxproj +++ b/Minecraft.Client/Minecraft.Client.vcxproj @@ -1027,7 +1027,7 @@ xcopy /q /y /i /s /e $(ProjectDir)DurangoMedia\CU $(LayoutDir)Image\Loose\CUfalse $(OutDir)$(ProjectName).pch MultiThreaded - _DEBUG_MENUS_ENABLED;_CRT_NON_CONFORMING_SWPRINTFS;_CRT_SECURE_NO_WARNINGS;_WINDOWS64;%(PreprocessorDefinitions) + _LARGE_WORLDS;_DEBUG_MENUS_ENABLED;_CRT_NON_CONFORMING_SWPRINTFS;_CRT_SECURE_NO_WARNINGS;_WINDOWS64;%(PreprocessorDefinitions) Disabled Windows64\Iggy\include;$(ProjectDir);%(AdditionalIncludeDirectories) true diff --git a/Minecraft.Client/Windows64/Sound/Minecraft.msscmp b/Minecraft.Client/Windows64/Sound/Minecraft.msscmp index 0d0df508..ba22b635 100644 Binary files a/Minecraft.Client/Windows64/Sound/Minecraft.msscmp and b/Minecraft.Client/Windows64/Sound/Minecraft.msscmp differ diff --git a/Minecraft.World/Minecraft.World.vcxproj b/Minecraft.World/Minecraft.World.vcxproj index 5b74574e..11d5b643 100644 --- a/Minecraft.World/Minecraft.World.vcxproj +++ b/Minecraft.World/Minecraft.World.vcxproj @@ -858,7 +858,7 @@ false $(OutDir)$(ProjectName).pch MultiThreaded - _DEBUG_MENUS_ENABLED;_LIB;_CRT_NON_CONFORMING_SWPRINTFS;_CRT_SECURE_NO_WARNINGS;_WINDOWS64;%(PreprocessorDefinitions) + _LARGE_WORLDS;_DEBUG_MENUS_ENABLED;_LIB;_CRT_NON_CONFORMING_SWPRINTFS;_CRT_SECURE_NO_WARNINGS;_WINDOWS64;%(PreprocessorDefinitions) Disabled true false diff --git a/Minecraft.World/ThreadName.cpp b/Minecraft.World/ThreadName.cpp index a08f11b8..a21d67c8 100644 --- a/Minecraft.World/ThreadName.cpp +++ b/Minecraft.World/ThreadName.cpp @@ -20,9 +20,16 @@ void SetThreadName( DWORD dwThreadID, LPCSTR szThreadName ) info.dwFlags = 0; #if ( defined _WINDOWS64 | defined _DURANGO ) + // 0x406D1388 is a debugger protocol, not a real exception - only a debugger + // can consume it. With nothing attached it terminates the process. + if( !IsDebuggerPresent() ) + return; + __try { - RaiseException( 0x406D1388, 0, sizeof(info)/sizeof(DWORD), (ULONG_PTR *)&info ); + // count is in ULONG_PTRs, not DWORDs - on x64 the DWORD count made + // RaiseException read past the end of info + RaiseException( 0x406D1388, 0, sizeof(info)/sizeof(ULONG_PTR), (ULONG_PTR *)&info ); } __except( GetExceptionCode()==0x406D1388 ? EXCEPTION_CONTINUE_EXECUTION : EXCEPTION_EXECUTE_HANDLER ) {