From 7135da3f37f4ffc5fff35135209dba4cdbe787d7 Mon Sep 17 00:00:00 2001 From: qloak Date: Wed, 5 Aug 2026 19:04:01 -0700 Subject: [PATCH] Fixed Xbox 360 crash --- Minecraft.Client/Common/Consoles_App.cpp | 4 + .../Common/Leaderboards/base64.cpp | 6 +- Minecraft.Client/Common/Leaderboards/base64.h | 2 +- .../Common/Network/GameNetworkManager.cpp | 28 +- .../Network/PlatformNetworkManagerStub.cpp | 30 +- .../Common/Network/WinsockNetLayer.cpp | 76 +-- .../Common/UI/UIScene_JoinMenu.cpp | 15 + .../Common/XUI/XUI_LoadSettings.cpp | 19 +- .../Common/XUI/XUI_MultiGameCreate.cpp | 19 +- .../Common/XUI/XUI_MultiGameInfo.cpp | 19 + .../Common/XUI/XUI_MultiGameJoinLoad.cpp | 15 +- Minecraft.Client/EnderDragonRenderer.cpp | 9 +- Minecraft.Client/EntityRenderDispatcher.cpp | 11 + Minecraft.Client/EntityRenderDispatcher.h | 3 +- Minecraft.Client/Extrax64Stubs.cpp | 1 + Minecraft.Client/GameRenderer.cpp | 60 +-- Minecraft.Client/GameRenderer.h | 2 - Minecraft.Client/HorseRenderer.cpp | 8 +- Minecraft.Client/HorseRenderer.h | 2 +- Minecraft.Client/Minecraft.Client.vcxproj | 436 +++++++++++++----- Minecraft.Client/Minecraft.cpp | 4 +- Minecraft.Client/MinecraftServer.cpp | 6 +- .../Orbis/Leaderboards/base64.cpp | 6 +- Minecraft.Client/Orbis/Leaderboards/base64.h | 2 +- Minecraft.Client/PS3/Leaderboards/base64.cpp | 6 +- Minecraft.Client/PS3/Leaderboards/base64.h | 2 +- Minecraft.Client/stdafx.h | 6 + Minecraft.World/BlockRegionUpdatePacket.cpp | 4 +- Minecraft.World/Connection.cpp | 6 +- Minecraft.World/Minecraft.World.vcxproj | 3 +- Minecraft.World/compression.cpp | 8 +- Minecraft.World/stdafx.h | 6 + 32 files changed, 610 insertions(+), 214 deletions(-) diff --git a/Minecraft.Client/Common/Consoles_App.cpp b/Minecraft.Client/Common/Consoles_App.cpp index ad5513bc..8b375f6b 100644 --- a/Minecraft.Client/Common/Consoles_App.cpp +++ b/Minecraft.Client/Common/Consoles_App.cpp @@ -4889,11 +4889,13 @@ void CMinecraftApp::SignInChangeCallback(LPVOID pParam,bool bPrimaryPlayerChange // 4J Stu - On PS4 we can also cause to exit players if they are signed out here, but we shouldn't do that if // we are going to switch to an offline game as it will likely crash due to incompatible parallel processes bool switchToOffline = false; +#ifndef _DISABLE_XBLIVE // If it's an online game, and the primary profile is no longer signed into LIVE then we act as if disconnected if( !ProfileManager.IsSignedInLive( ProfileManager.GetLockedProfile() ) && !g_NetworkManager.IsLocalGame() ) { switchToOffline = true; } +#endif //printf("Old: %x, New: %x, Changed: %x\n", m_ulLastSignInData, ulSignInData, changedPlayers); for(unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) @@ -4958,6 +4960,7 @@ void CMinecraftApp::SignInChangeCallback(LPVOID pParam,bool bPrimaryPlayerChange g_NetworkManager.HandleSignInChange(); } +#ifndef _DISABLE_XBLIVE // Some menus require the player to be signed in to live, so if this callback happens and the primary player is // no longer signed in then nav back else if ( pApp->GetLiveLinkRequired() && !ProfileManager.IsSignedInLive( ProfileManager.GetLockedProfile() ) ) @@ -4969,6 +4972,7 @@ void CMinecraftApp::SignInChangeCallback(LPVOID pParam,bool bPrimaryPlayerChange pApp->SetAction(iPrimaryPlayer,eAppAction_EthernetDisconnected); } } +#endif #if ( defined __PS3__ || defined __ORBIS__ || defined _DURANGO || defined __PSVITA__ ) // 4J-JEV: Need to kick of loading of profile data for sub-sign in players. diff --git a/Minecraft.Client/Common/Leaderboards/base64.cpp b/Minecraft.Client/Common/Leaderboards/base64.cpp index 01aa4cf0..477a92c7 100644 --- a/Minecraft.Client/Common/Leaderboards/base64.cpp +++ b/Minecraft.Client/Common/Leaderboards/base64.cpp @@ -1,7 +1,7 @@ /* base64.cpp and base64.h - Copyright (C) 2004-2008 René Nyffenegger + Copyright (C) 2004-2008 René Nyffenegger This source code is provided 'as-is', without any express or implied warranty. In no event will the author be held liable for any damages @@ -21,7 +21,7 @@ 3. This notice may not be removed or altered from any source distribution. - René Nyffenegger rene.nyffenegger@adp-gmbh.ch + René Nyffenegger rene.nyffenegger@adp-gmbh.ch */ @@ -41,7 +41,7 @@ static inline bool is_base64(unsigned char c) { } // 4J ADDED, -std::string base64_encode(std::string str) +std::string base64_encode(const std::string& str) { return base64_encode( reinterpret_cast(str.c_str()), str.length() ); } diff --git a/Minecraft.Client/Common/Leaderboards/base64.h b/Minecraft.Client/Common/Leaderboards/base64.h index bdd8a9c1..5892a406 100644 --- a/Minecraft.Client/Common/Leaderboards/base64.h +++ b/Minecraft.Client/Common/Leaderboards/base64.h @@ -2,6 +2,6 @@ #include -std::string base64_encode(std::string str); +std::string base64_encode(const std::string& str); std::string base64_encode(unsigned char const* , unsigned int len); std::string base64_decode(std::string const& s); \ No newline at end of file diff --git a/Minecraft.Client/Common/Network/GameNetworkManager.cpp b/Minecraft.Client/Common/Network/GameNetworkManager.cpp index 5b94e250..9bb89f07 100644 --- a/Minecraft.Client/Common/Network/GameNetworkManager.cpp +++ b/Minecraft.Client/Common/Network/GameNetworkManager.cpp @@ -100,12 +100,14 @@ void CGameNetworkManager::DoWork() { case XN_LIVE_LINK_STATE_CHANGED: { +#ifndef _DISABLE_XBLIVE int iPrimaryPlayer = g_NetworkManager.GetPrimaryPad(); bool bConnected = (pNotification->uiParam!=0)?true:false; if((g_NetworkManager.GetLockedProfile()!=-1) && iPrimaryPlayer!=-1 && bConnected == false && g_NetworkManager.IsInSession() ) { app.SetAction(iPrimaryPlayer,eAppAction_EthernetDisconnected); - } + } +#endif } break; case XN_LIVE_INVITE_ACCEPTED: @@ -782,7 +784,11 @@ int CGameNetworkManager::JoinFromInvite_SignInReturned(void *pParam,bool bContin app.DebugPrintf("JoinFromInvite_SignInReturned, iPad %d\n",iPad); // It's possible that the player has not signed in - they can back out +#ifndef _DISABLE_XBLIVE if(ProfileManager.IsSignedIn(iPad) && ProfileManager.IsSignedInLive(iPad) ) +#else + if(ProfileManager.IsSignedIn(iPad)) +#endif { app.DebugPrintf("JoinFromInvite_SignInReturned, passed sign-in tests\n"); int localUsersMask = 0; @@ -794,7 +800,9 @@ int CGameNetworkManager::JoinFromInvite_SignInReturned(void *pParam,bool bContin if(ProfileManager.IsSignedIn(index) ) { ++joiningUsers; +#ifndef _DISABLE_XBLIVE if( !ProfileManager.AllowedToPlayMultiplayer(index) ) noPrivileges = true; +#endif localUsersMask |= GetLocalPlayerMask( index ); } } @@ -905,7 +913,7 @@ int CGameNetworkManager::RunNetworkGameThreadProc( void* lpParameter ) TexturePack *tPack = Minecraft::GetInstance()->skins->getSelected(); while ( tPack->isLoadingData() || (Minecraft::GetInstance()->skins->needsUIUpdate() || ui.IsReloadingSkin()) ) { - Sleep(1); + Sleep(0); } ui.CleanUpSkinReload(); if(app.GetDisconnectReason() == DisconnectPacket::eDisconnect_None) @@ -942,7 +950,7 @@ int CGameNetworkManager::ServerThreadProc( void* lpParameter ) { while((Minecraft::GetInstance()->skins->needsUIUpdate() || ui.IsReloadingSkin())) { - Sleep(1); + Sleep(0); } param->levelGen->loadBaseSaveData(); } @@ -984,7 +992,7 @@ int CGameNetworkManager::ExitAndJoinFromInviteThreadProc( void* lpParam ) while( g_NetworkManager.IsInSession() ) { - Sleep(1); + Sleep(0); } // Xbox should always be online when receiving invites - on PS3 we need to check & ask the user to sign in @@ -1260,7 +1268,7 @@ int CGameNetworkManager::ChangeSessionTypeThreadProc( void* lpParam ) // wait for the current session to end while( g_NetworkManager.IsInSession() ) { - Sleep(1); + Sleep(0); } // Reset this flag as the we don't need to know that we only lost the room only from this point onwards, the behaviour is exactly the same @@ -1662,6 +1670,7 @@ void CGameNetworkManager::GameInviteReceived( int userIndex, const INVITE_INFO * { if (ProfileManager.IsSignedIn(i) && (i == ProfileManager.GetPrimaryPad() || isLocalMultiplayerAvailable)) { +#ifndef _DISABLE_XBLIVE if (isSignedInLive && !ProfileManager.IsSignedInLive(i)) { // Record the first non signed in live pad @@ -1669,6 +1678,9 @@ void CGameNetworkManager::GameInviteReceived( int userIndex, const INVITE_INFO * } isSignedInLive = isSignedInLive && ProfileManager.IsSignedInLive(i); +#else + isSignedInLive = true; +#endif } } @@ -1740,7 +1752,9 @@ void CGameNetworkManager::GameInviteReceived( int userIndex, const INVITE_INFO * if(index==userIndex || pMinecraft->localplayers[index]!=NULL ) { ++joiningUsers; +#ifndef _DISABLE_XBLIVE if( !ProfileManager.AllowedToPlayMultiplayer(index) ) noPrivileges = true; +#endif localUsersMask |= GetLocalPlayerMask( index ); } } @@ -1895,6 +1909,7 @@ void CGameNetworkManager::HandleInviteWhenInMenus( int userIndex, const INVITE_I if(!app.IsLocalMultiplayerAvailable()) #endif { +#ifndef _DISABLE_XBLIVE bool noPrivileges=!ProfileManager.AllowedToPlayMultiplayer(userIndex); if(noPrivileges) @@ -1905,6 +1920,7 @@ void CGameNetworkManager::HandleInviteWhenInMenus( int userIndex, const INVITE_I } else { +#endif ProfileManager.SetLockedProfile(userIndex); ProfileManager.SetPrimaryPad(userIndex); @@ -1927,7 +1943,9 @@ void CGameNetworkManager::HandleInviteWhenInMenus( int userIndex, const INVITE_I { app.DebugPrintf( "Failed joining game from invite\n" ); } +#ifndef _DISABLE_XBLIVE } +#endif } else { diff --git a/Minecraft.Client/Common/Network/PlatformNetworkManagerStub.cpp b/Minecraft.Client/Common/Network/PlatformNetworkManagerStub.cpp index 9ced020a..896d2249 100644 --- a/Minecraft.Client/Common/Network/PlatformNetworkManagerStub.cpp +++ b/Minecraft.Client/Common/Network/PlatformNetworkManagerStub.cpp @@ -14,6 +14,9 @@ CPlatformNetworkManagerStub *g_pPlatformNetworkManager; void CPlatformNetworkManagerStub::NotifyPlayerJoined(IQNetPlayer *pQNetPlayer ) { + if (getNetworkPlayer(pQNetPlayer) != NULL) + return; + const char * pszDescription; // 4J Stu - We create a fake socket for every where that we need an INBOUND queue of game data. Outbound @@ -160,6 +163,8 @@ bool CPlatformNetworkManagerStub::Initialise(CGameNetworkManager *pGameNetworkMa { playerChangedCallback[ i ] = NULL; } + + WinsockNetLayer::Initialize(); m_bLeavingGame = false; m_bLeaveGameOnTick = false; @@ -348,6 +353,9 @@ void CPlatformNetworkManagerStub::HostGame(int localUsersMask, bool bOnlineGame, IQNet::m_player[0].m_isHostPlayer = true; IQNet::s_playerCount = 1; + if (getNetworkPlayer(&IQNet::m_player[0]) == NULL) + NotifyPlayerJoined(&IQNet::m_player[0]); + _HostGame( localUsersMask, publicSlots, privateSlots ); int port = WIN64_NET_DEFAULT_PORT; @@ -388,6 +396,7 @@ int CPlatformNetworkManagerStub::JoinGame(FriendSessionInfo *searchResult, int l IQNet::m_player[0].m_isRemote = true; IQNet::m_player[0].m_isHostPlayer = true; wcsncpy(IQNet::m_player[0].m_gamertag, searchResult->data.hostName, 31); + IQNet::m_player[0].m_gamertag[31] = L'\0'; WinsockNetLayer::StopDiscovery(); @@ -754,7 +763,22 @@ vector *CPlatformNetworkManagerStub::GetSessionList(int iPa { vector *filteredList = new vector(); for (size_t i = 0; i < friendsSessions[0].size(); i++) - filteredList->push_back(friendsSessions[0][i]); + { + FriendSessionInfo *src = friendsSessions[0][i]; + FriendSessionInfo *copy = new FriendSessionInfo(); + *copy = *src; + if (src->displayLabel != NULL) + { + copy->displayLabel = new wchar_t[(size_t)src->displayLabelLength + 1]; + wcsncpy(copy->displayLabel, src->displayLabel, src->displayLabelLength); + copy->displayLabel[src->displayLabelLength] = L'\0'; + } + else + { + copy->displayLabel = NULL; + } + filteredList->push_back(copy); + } return filteredList; } @@ -802,9 +826,11 @@ void CPlatformNetworkManagerStub::removeNetworkPlayer(IQNetPlayer *pQNetPlayer) if( *it == pNetworkPlayer ) { currentNetworkPlayers.erase(it); - return; + break; } } + + pQNetPlayer->SetCustomDataValue(0); } INetworkPlayer *CPlatformNetworkManagerStub::getNetworkPlayer(IQNetPlayer *pQNetPlayer) diff --git a/Minecraft.Client/Common/Network/WinsockNetLayer.cpp b/Minecraft.Client/Common/Network/WinsockNetLayer.cpp index 9b75a8df..5f0cfddd 100644 --- a/Minecraft.Client/Common/Network/WinsockNetLayer.cpp +++ b/Minecraft.Client/Common/Network/WinsockNetLayer.cpp @@ -361,31 +361,41 @@ bool WinsockNetLayer::JoinGame(const char *ip, int port) return false; } #elif defined _XBOX - 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; - } - 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; + int iResult = XNetDnsLookup(ip, NULL, &pDns); + if (iResult != 0 || pDns == NULL) + { + app.DebugPrintf("XNetDnsLookup failed for %s - %d\n", ip, iResult); + return false; + } + + int timeoutTicks = 500; + while (pDns->iStatus == WSAEINPROGRESS && --timeoutTicks > 0) + { + 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); + } s_hostConnectionSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); if (s_hostConnectionSocket == INVALID_SOCKET) @@ -397,7 +407,7 @@ bool WinsockNetLayer::JoinGame(const char *ip, int port) int noDelay = 1; setsockopt(s_hostConnectionSocket, IPPROTO_TCP, TCP_NODELAY, (const char *)&noDelay, sizeof(noDelay)); - iResult = connect(s_hostConnectionSocket, (struct sockaddr*)&addr, sizeof(addr)); + int iResult = connect(s_hostConnectionSocket, (struct sockaddr*)&addr, sizeof(addr)); if (iResult == SOCKET_ERROR) { app.DebugPrintf("connect() to %s:%d failed: %d\n", ip, port, WSAGetLastError()); @@ -613,7 +623,7 @@ int WinsockNetLayer::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); @@ -858,7 +868,7 @@ void WinsockNetLayer::StopAdvertising() { s_advertising = false; -#if defined _WINDOWS64 +#if defined _WINDOWS64 || defined _XBOX if (s_advertiseSock != INVALID_SOCKET) { closesocket(s_advertiseSock); @@ -984,8 +994,16 @@ bool WinsockNetLayer::StartDiscovery() return false; } #endif + +#if defined _WINDOWS64 DWORD timeout = 500; setsockopt(s_discoverySock, SOL_SOCKET, SO_RCVTIMEO, (const char *)&timeout, sizeof(timeout)); +#elif defined _XBOX || defined __PS3__ + struct timeval timeout; + timeout.tv_sec = 0; + timeout.tv_usec = 500000; + setsockopt(s_discoverySock, SOL_SOCKET, SO_RCVTIMEO, (const char *)&timeout, sizeof(timeout)); +#endif s_discovering = true; s_discoveryThread = new C4JThread(DiscoveryThreadProc, NULL, "DiscoveryThreadProc"); @@ -1028,9 +1046,11 @@ void WinsockNetLayer::StopDiscovery() std::vector WinsockNetLayer::GetDiscoveredSessions() { std::vector result; - EnterCriticalSection(&s_discoveryLock); - result = s_discoveredSessions; - LeaveCriticalSection(&s_discoveryLock); + if (TryEnterCriticalSection(&s_discoveryLock)) + { + result = s_discoveredSessions; + LeaveCriticalSection(&s_discoveryLock); + } return result; } diff --git a/Minecraft.Client/Common/UI/UIScene_JoinMenu.cpp b/Minecraft.Client/Common/UI/UIScene_JoinMenu.cpp index 5abfb56f..b43abc0d 100644 --- a/Minecraft.Client/Common/UI/UIScene_JoinMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_JoinMenu.cpp @@ -557,6 +557,21 @@ void UIScene_JoinMenu::JoinGame(UIScene_JoinMenu* pClass) ui.NavigateToHomeMenu(); } } + else + { + LoadingInputParams *loadingParams = new LoadingInputParams(); + loadingParams->func = &CGameNetworkManager::RunNetworkGameThreadProc; + loadingParams->lpParam = NULL; + + UIFullscreenProgressCompletionData *completionData = new UIFullscreenProgressCompletionData(); + completionData->bShowBackground = TRUE; + completionData->bShowLogo = TRUE; + completionData->type = e_ProgressCompletion_CloseAllPlayersUIScenes; + completionData->iPad = DEFAULT_XUI_MENU_USER; + loadingParams->completionData = completionData; + + ui.NavigateToScene(ProfileManager.GetPrimaryPad(), eUIScene_FullscreenProgress, loadingParams); + } } } diff --git a/Minecraft.Client/Common/XUI/XUI_LoadSettings.cpp b/Minecraft.Client/Common/XUI/XUI_LoadSettings.cpp index 7f32ff89..de2084be 100644 --- a/Minecraft.Client/Common/XUI/XUI_LoadSettings.cpp +++ b/Minecraft.Client/Common/XUI/XUI_LoadSettings.cpp @@ -76,7 +76,19 @@ HRESULT CScene_LoadGameSettings::OnInit( XUIMessageInit* pInitData, BOOL& bHandl XuiControlSetText(m_ButtonLoad,app.GetString(IDS_LOAD)); XuiControlSetText(m_pTexturePacksList->m_hObj,app.GetString(IDS_DLC_MENU_TEXTUREPACKS)); +#ifndef _DISABLE_XBLIVE +#ifndef _DISABLE_XBLIVE +#ifndef _DISABLE_XBLIVE m_bMultiplayerAllowed = ProfileManager.IsSignedInLive( m_iPad ) && ProfileManager.AllowedToPlayMultiplayer(m_iPad); +#else + m_bMultiplayerAllowed = true; +#endif +#else + m_bMultiplayerAllowed = true; +#endif +#else + m_bMultiplayerAllowed = true; +#endif // 4J-PB - read the settings for the online flag. We'll only save this setting if the user changed it. bool bGameSetting_Online=(app.GetGameSettings(m_iPad,eGameSetting_Online)!=0); m_MoreOptionsParams.bOnlineSettingChangedBySystem=false; @@ -741,7 +753,10 @@ HRESULT CScene_LoadGameSettings::OnTimer( XUIMessageTimer *pTimer, BOOL& bHandle { case GAME_CREATE_ONLINE_TIMER_ID: { - bool bMultiplayerAllowed = ProfileManager.IsSignedInLive( m_iPad ) && ProfileManager.AllowedToPlayMultiplayer(m_iPad); + bool bMultiplayerAllowed = true; +#ifndef _DISABLE_XBLIVE + bMultiplayerAllowed = ProfileManager.IsSignedInLive( m_iPad ) && ProfileManager.AllowedToPlayMultiplayer(m_iPad); +#endif if(bMultiplayerAllowed != m_bMultiplayerAllowed) { @@ -1015,7 +1030,9 @@ int CScene_LoadGameSettings::StartGame_SignInReturned(void *pParam,bool bContinu { if(ProfileManager.IsSignedIn(index) ) { +#ifndef _DISABLE_XBLIVE if( !ProfileManager.AllowedToPlayMultiplayer(index) ) noPrivileges = true; +#endif dwLocalUsersMask |= CGameNetworkManager::GetLocalPlayerMask(index); } } diff --git a/Minecraft.Client/Common/XUI/XUI_MultiGameCreate.cpp b/Minecraft.Client/Common/XUI/XUI_MultiGameCreate.cpp index b3608b06..09bd4359 100644 --- a/Minecraft.Client/Common/XUI/XUI_MultiGameCreate.cpp +++ b/Minecraft.Client/Common/XUI/XUI_MultiGameCreate.cpp @@ -67,7 +67,19 @@ HRESULT CScene_MultiGameCreate::OnInit( XUIMessageInit* pInitData, BOOL& bHandle m_iPad=params->iPad; delete params; +#ifndef _DISABLE_XBLIVE +#ifndef _DISABLE_XBLIVE +#ifndef _DISABLE_XBLIVE m_bMultiplayerAllowed = ProfileManager.IsSignedInLive( m_iPad ) && ProfileManager.AllowedToPlayMultiplayer(m_iPad); +#else + m_bMultiplayerAllowed = true; +#endif +#else + m_bMultiplayerAllowed = true; +#endif +#else + m_bMultiplayerAllowed = true; +#endif // 4J-PB - read the settings for the online flag. We'll only save this setting if the user changed it. bool bGameSetting_Online=(app.GetGameSettings(m_iPad,eGameSetting_Online)!=0); m_MoreOptionsParams.bOnlineSettingChangedBySystem=false; @@ -663,7 +675,10 @@ HRESULT CScene_MultiGameCreate::OnTimer( XUIMessageTimer *pTimer, BOOL& bHandled case GAME_CREATE_ONLINE_TIMER_ID: { - bool bMultiplayerAllowed = ProfileManager.IsSignedInLive( m_iPad ) && ProfileManager.AllowedToPlayMultiplayer(m_iPad); + bool bMultiplayerAllowed = true; +#ifndef _DISABLE_XBLIVE + bMultiplayerAllowed = ProfileManager.IsSignedInLive( m_iPad ) && ProfileManager.AllowedToPlayMultiplayer(m_iPad); +#endif if(bMultiplayerAllowed != m_bMultiplayerAllowed) { @@ -824,7 +839,9 @@ int CScene_MultiGameCreate::StartGame_SignInReturned(void *pParam,bool bContinue { if(ProfileManager.IsSignedIn(index) ) { +#ifndef _DISABLE_XBLIVE if( !ProfileManager.AllowedToPlayMultiplayer(index) ) noPrivileges = true; +#endif dwLocalUsersMask |= CGameNetworkManager::GetLocalPlayerMask(index); } } diff --git a/Minecraft.Client/Common/XUI/XUI_MultiGameInfo.cpp b/Minecraft.Client/Common/XUI/XUI_MultiGameInfo.cpp index 1d59730a..0f22aab0 100644 --- a/Minecraft.Client/Common/XUI/XUI_MultiGameInfo.cpp +++ b/Minecraft.Client/Common/XUI/XUI_MultiGameInfo.cpp @@ -274,7 +274,9 @@ void CScene_MultiGameInfo::JoinGame(CScene_MultiGameInfo* pClass) if(ProfileManager.IsSignedIn(index) ) { ++dwSignedInUsers; +#ifndef _DISABLE_XBLIVE if( !ProfileManager.AllowedToPlayMultiplayer(index) ) noPrivileges = true; +#endif dwLocalUsersMask |= CGameNetworkManager::GetLocalPlayerMask(index); } } @@ -284,7 +286,9 @@ void CScene_MultiGameInfo::JoinGame(CScene_MultiGameInfo* pClass) if(ProfileManager.IsSignedIn(ProfileManager.GetPrimaryPad()) ) { ++dwSignedInUsers; +#ifndef _DISABLE_XBLIVE if( !ProfileManager.AllowedToPlayMultiplayer(ProfileManager.GetPrimaryPad()) ) noPrivileges = true; +#endif dwLocalUsersMask |= CGameNetworkManager::GetLocalPlayerMask(ProfileManager.GetPrimaryPad()); } } @@ -348,6 +352,21 @@ void CScene_MultiGameInfo::JoinGame(CScene_MultiGameInfo* pClass) app.NavigateToHomeMenu(); } } + else + { + LoadingInputParams *loadingParams = new LoadingInputParams(); + loadingParams->func = &CGameNetworkManager::RunNetworkGameThreadProc; + loadingParams->lpParam = NULL; + + UIFullscreenProgressCompletionData *completionData = new UIFullscreenProgressCompletionData(); + completionData->bShowBackground = TRUE; + completionData->bShowLogo = TRUE; + completionData->type = e_ProgressCompletion_CloseAllPlayersUIScenes; + completionData->iPad = DEFAULT_XUI_MENU_USER; + loadingParams->completionData = completionData; + + app.NavigateToScene(ProfileManager.GetPrimaryPad(), eUIScene_FullscreenProgress, loadingParams); + } } } diff --git a/Minecraft.Client/Common/XUI/XUI_MultiGameJoinLoad.cpp b/Minecraft.Client/Common/XUI/XUI_MultiGameJoinLoad.cpp index 1c4f3f21..84a42945 100644 --- a/Minecraft.Client/Common/XUI/XUI_MultiGameJoinLoad.cpp +++ b/Minecraft.Client/Common/XUI/XUI_MultiGameJoinLoad.cpp @@ -73,7 +73,11 @@ HRESULT CScene_MultiGameJoinLoad::OnInit( XUIMessageInit* pInitData, BOOL& bHand // } m_initData= new JoinMenuInitData(); +#ifndef _DISABLE_XBLIVE m_bMultiplayerAllowed = ProfileManager.IsSignedInLive( m_iPad ) && ProfileManager.AllowedToPlayMultiplayer(m_iPad); +#else + m_bMultiplayerAllowed = true; +#endif XPARTY_USER_LIST partyList; @@ -768,7 +772,11 @@ HRESULT CScene_MultiGameJoinLoad::OnNavReturn(HXUIOBJ hSceneFrom,BOOL& rfHandled // start the texture pack timer again XuiSetTimer(m_hObj,CHECKFORAVAILABLETEXTUREPACKS_TIMER_ID,CHECKFORAVAILABLETEXTUREPACKS_TIMER_TIME); - m_bMultiplayerAllowed = ProfileManager.IsSignedInLive( m_iPad ) && ProfileManager.AllowedToPlayMultiplayer(m_iPad); +#ifndef _DISABLE_XBLIVE + m_bMultiplayerAllowed = ProfileManager.IsSignedInLive( m_iPad ) && ProfileManager.AllowedToPlayMultiplayer(m_iPad); +#else + m_bMultiplayerAllowed = true; +#endif // re-enable button presses m_bIgnoreInput=false; @@ -1643,7 +1651,10 @@ HRESULT CScene_MultiGameJoinLoad::OnTimer( XUIMessageTimer *pTimer, BOOL& bHandl m_bInParty=false; } - bool bMultiplayerAllowed = ProfileManager.IsSignedInLive( m_iPad ) && ProfileManager.AllowedToPlayMultiplayer(m_iPad); + bool bMultiplayerAllowed = true; +#ifndef _DISABLE_XBLIVE + bMultiplayerAllowed = ProfileManager.IsSignedInLive( m_iPad ) && ProfileManager.AllowedToPlayMultiplayer(m_iPad); +#endif if(bMultiplayerAllowed != m_bMultiplayerAllowed) { if( bMultiplayerAllowed ) diff --git a/Minecraft.Client/EnderDragonRenderer.cpp b/Minecraft.Client/EnderDragonRenderer.cpp index 1d9a3ff0..41ba91b6 100644 --- a/Minecraft.Client/EnderDragonRenderer.cpp +++ b/Minecraft.Client/EnderDragonRenderer.cpp @@ -145,10 +145,11 @@ void EnderDragonRenderer::render(shared_ptr _mob, double x, double y, do int steps = 8; for (int i = 0; i <= steps; i++) { - double d=i % steps * PI * 2 / steps; - float s = sin(i % steps * PI * 2 / steps) * 0.75f; - float c = cos(i % steps * PI * 2 / steps) * 0.75f; - float u = i % steps * 1.0f / steps; + int idx = i % steps; + double d = idx * PI * 2 / steps; + float s = sin(d) * 0.75f; + float c = cos(d) * 0.75f; + float u = idx * 1.0f / steps; //t->color(0x000000); t->vertexUV(s * 0.2f, c * 0.2f, 0, u, v1); //t->color(0xffffff); diff --git a/Minecraft.Client/EntityRenderDispatcher.cpp b/Minecraft.Client/EntityRenderDispatcher.cpp index dd3231a6..b1934199 100644 --- a/Minecraft.Client/EntityRenderDispatcher.cpp +++ b/Minecraft.Client/EntityRenderDispatcher.cpp @@ -94,6 +94,17 @@ void EntityRenderDispatcher::staticCtor() instance = new EntityRenderDispatcher(); } +EntityRenderDispatcher::~EntityRenderDispatcher() +{ + AUTO_VAR(itEnd, renderers.end()); + for( classToRendererMap::iterator it = renderers.begin(); it != itEnd; it++ ) + { + delete it->second; + it->second = NULL; + } + renderers.clear(); +} + EntityRenderDispatcher::EntityRenderDispatcher() { glEnable(GL_LIGHTING); diff --git a/Minecraft.Client/EntityRenderDispatcher.h b/Minecraft.Client/EntityRenderDispatcher.h index 86132178..029f44b3 100644 --- a/Minecraft.Client/EntityRenderDispatcher.h +++ b/Minecraft.Client/EntityRenderDispatcher.h @@ -1,7 +1,7 @@ #pragma once #include "EntityRenderer.h" -#include "..\Minecraft.World\Entity.h" #include "..\Minecraft.World\JavaIntHash.h" +class Entity; class font; using namespace std; @@ -37,6 +37,7 @@ public: private: EntityRenderDispatcher(); + ~EntityRenderDispatcher(); public: EntityRenderer *getRenderer(eINSTANCEOF e); diff --git a/Minecraft.Client/Extrax64Stubs.cpp b/Minecraft.Client/Extrax64Stubs.cpp index 3696c6ff..5fb77f9f 100644 --- a/Minecraft.Client/Extrax64Stubs.cpp +++ b/Minecraft.Client/Extrax64Stubs.cpp @@ -75,6 +75,7 @@ HRESULT XPartyGetUserList(XPARTY_USER_LIST *pUserList) { return S_OK; } DWORD XContentGetThumbnail(DWORD dwUserIndex, const XCONTENT_DATA *pContentData, PBYTE pbThumbnail, PDWORD pcbThumbnail, PXOVERLAPPED *pOverlapped) { return 0; } void XShowAchievementsUI(int i) {} DWORD XBackgroundDownloadSetMode(XBACKGROUND_DOWNLOAD_MODE Mode) { return 0; } +DWORD XamBackgroundDownloadSetMode(XBACKGROUND_DOWNLOAD_MODE Mode) { return 0; } #ifndef _DURANGO void PIXAddNamedCounter(int a, char *b, ...) {} diff --git a/Minecraft.Client/GameRenderer.cpp b/Minecraft.Client/GameRenderer.cpp index a43f83f0..fc404da4 100644 --- a/Minecraft.Client/GameRenderer.cpp +++ b/Minecraft.Client/GameRenderer.cpp @@ -105,8 +105,6 @@ GameRenderer::GameRenderer(Minecraft *mc) zoom = 1; zoom_x = 0; zoom_y = 0; - rainXa = NULL; - rainZa = NULL; lastActiveTime = Minecraft::currentTimeMillis(); lastNsTime = 0; random = new Random(); @@ -181,8 +179,9 @@ GameRenderer::GameRenderer(Minecraft *mc) // 4J Stu Added to go with 1.8.2 change GameRenderer::~GameRenderer() { - if(rainXa != NULL) delete [] rainXa; - if(rainZa != NULL) delete [] rainZa; + delete random; + delete cameraPos; + delete lb; } void GameRenderer::tick(bool first) // 4J - add bFirst @@ -838,19 +837,21 @@ void GameRenderer::updateLightTexture(float a) Level *level = player->level; // 4J - was mc->level when it was just to update the one light texture float skyDarken1 = level->getSkyDarken((float) 1); + float darken = skyDarken1 * 0.95f + 0.05f; + float rsGsMul = skyDarken1 * 0.65f + 0.35f; + float blockMul = blr * 0.1f + 1.5f; for (int i = 0; i < 256; i++) { - float darken = skyDarken1 * 0.95f + 0.05f; float sky = level->dimension->brightnessRamp[i / 16] * darken; - float block = level->dimension->brightnessRamp[i % 16] * (blr * 0.1f + 1.5f); + float block = level->dimension->brightnessRamp[i % 16] * blockMul; if (level->skyFlashTime > 0) { sky = level->dimension->brightnessRamp[i / 16]; } - float rs = sky * (skyDarken1 * 0.65f + 0.35f); - float gs = sky * (skyDarken1 * 0.65f + 0.35f); + float rs = sky * rsGsMul; + float gs = sky * rsGsMul; float bs = sky; float rb = block; @@ -1526,27 +1527,30 @@ void GameRenderer::tickRain() int x = x0 + random->nextInt(r) - random->nextInt(r); int z = z0 + random->nextInt(r) - random->nextInt(r); int y = level->getTopRainBlock(x, z); - int t = level->getTile(x, y - 1, z); - Biome *biome = level->getBiome(x,z); - if (y <= y0 + r && y >= y0 - r && biome->hasRain() && biome->getTemperature() >= 0.2f) + if (y <= y0 + r && y >= y0 - r) { - float xa = random->nextFloat(); - float za = random->nextFloat(); - if (t > 0) + int t = level->getTile(x, y - 1, z); + Biome *biome = level->getBiome(x,z); + if (biome->hasRain() && biome->getTemperature() >= 0.2f) { - if (Tile::tiles[t]->material == Material::lava) + float xa = random->nextFloat(); + float za = random->nextFloat(); + if (t > 0) { - mc->particleEngine->add( shared_ptr( new SmokeParticle(level, x + xa, y + 0.1f - Tile::tiles[t]->getShapeY0(), z + za, 0, 0, 0) ) ); - } - else - { - if (random->nextInt(++rainPosSamples) == 0) + if (Tile::tiles[t]->material == Material::lava) { - rainPosX = x + xa; - rainPosY = y + 0.1f - Tile::tiles[t]->getShapeY0(); - rainPosZ = z + za; + mc->particleEngine->add( shared_ptr( new SmokeParticle(level, x + xa, y + 0.1f - Tile::tiles[t]->getShapeY0(), z + za, 0, 0, 0) ) ); + } + else + { + if (random->nextInt(++rainPosSamples) == 0) + { + rainPosX = x + xa; + rainPosY = y + 0.1f - Tile::tiles[t]->getShapeY0(); + rainPosZ = z + za; + } + mc->particleEngine->add( shared_ptr( new WaterDropParticle(level, x + xa, y + 0.1f - Tile::tiles[t]->getShapeY0(), z + za) ) ); } - mc->particleEngine->add( shared_ptr( new WaterDropParticle(level, x + xa, y + 0.1f - Tile::tiles[t]->getShapeY0(), z + za) ) ); } } } @@ -1581,10 +1585,12 @@ void GameRenderer::renderSnowAndRain(float a) turnOnLightLayer(a); - if (rainXa == NULL) + static float rainXa[32 * 32]; + static float rainZa[32 * 32]; + static bool rainArraysInitialized = false; + if (!rainArraysInitialized) { - rainXa = new float[32 * 32]; - rainZa = new float[32 * 32]; + rainArraysInitialized = true; for (int z = 0; z < 32; z++) { diff --git a/Minecraft.Client/GameRenderer.h b/Minecraft.Client/GameRenderer.h index 7c5632d2..04d52ccb 100644 --- a/Minecraft.Client/GameRenderer.h +++ b/Minecraft.Client/GameRenderer.h @@ -128,8 +128,6 @@ private: void tickRain(); private: // 4J - brought forward from 1.8.2 - float *rainXa; - float *rainZa; protected: void renderSnowAndRain(float a); volatile int xMod; diff --git a/Minecraft.Client/HorseRenderer.cpp b/Minecraft.Client/HorseRenderer.cpp index 97f75df1..6a0c5120 100644 --- a/Minecraft.Client/HorseRenderer.cpp +++ b/Minecraft.Client/HorseRenderer.cpp @@ -10,7 +10,7 @@ ResourceLocation HorseRenderer::HORSE_DONKEY_LOCATION = ResourceLocation(TN_MOB_ ResourceLocation HorseRenderer::HORSE_ZOMBIE_LOCATION = ResourceLocation(TN_MOB_HORSE_ZOMBIE); ResourceLocation HorseRenderer::HORSE_SKELETON_LOCATION = ResourceLocation(TN_MOB_HORSE_SKELETON); -std::map HorseRenderer::LAYERED_LOCATION_CACHE; +std::map HorseRenderer::LAYERED_LOCATION_CACHE; HorseRenderer::HorseRenderer(Model *model, float f) : MobRenderer(model, f) { @@ -114,14 +114,14 @@ ResourceLocation *HorseRenderer::getOrCreateLayeredTextureLocation(shared_ptrsecond; + location = &(it->second); } else { - LAYERED_LOCATION_CACHE[textureName] = new ResourceLocation(horse->getLayeredTextureLayers()); + LAYERED_LOCATION_CACHE[textureName] = ResourceLocation(horse->getLayeredTextureLayers()); it = LAYERED_LOCATION_CACHE.find(textureName); - location = it->second; + location = &(it->second); } return location; diff --git a/Minecraft.Client/HorseRenderer.h b/Minecraft.Client/HorseRenderer.h index 71ebde15..9f85f471 100644 --- a/Minecraft.Client/HorseRenderer.h +++ b/Minecraft.Client/HorseRenderer.h @@ -8,7 +8,7 @@ class PathfinderMob; class HorseRenderer : public MobRenderer { private: - static std::map LAYERED_LOCATION_CACHE; + static std::map LAYERED_LOCATION_CACHE; static ResourceLocation HORSE_LOCATION; static ResourceLocation HORSE_MULE_LOCATION; diff --git a/Minecraft.Client/Minecraft.Client.vcxproj b/Minecraft.Client/Minecraft.Client.vcxproj index 98190241..7c3b8c32 100644 --- a/Minecraft.Client/Minecraft.Client.vcxproj +++ b/Minecraft.Client/Minecraft.Client.vcxproj @@ -1,4 +1,4 @@ - + @@ -277,6 +277,7 @@ Application MultiByte v110 + true Application @@ -1583,6 +1584,7 @@ xcopy /q /y /i /s /e $(ProjectDir)DurangoMedia\CU $(LayoutDir)Image\Loose\CUd3d11.lib;..\Minecraft.World\x64_Release\Minecraft.World.lib;XInput9_1_0.lib;Windows64\Iggy\lib\iggy_w64.lib;%(AdditionalDependencies) NotSet false + UseLinkTimeCodeGeneration $(ProjectDir)xbox\xex-dev.xml @@ -1615,7 +1617,7 @@ xcopy /q /y /i /s /e $(ProjectDir)DurangoMedia\CU $(LayoutDir)Image\Loose\CUfalse $(OutDir)$(ProjectName).pch MultiThreaded - _LARGE_WORLDS;_DEBUG_MENUS_ENABLED;_CRT_NON_CONFORMING_SWPRINTFS;_CRT_SECURE_NO_WARNINGS;_WINDOWS64;%(PreprocessorDefinitions) + _LARGE_WORLDS;_DEBUG_MENUS_ENABLED;NDEBUG;_CRT_NON_CONFORMING_SWPRINTFS;_CRT_SECURE_NO_WARNINGS;_WINDOWS64;%(PreprocessorDefinitions) Disabled Windows64\Iggy\include;$(ProjectDir);%(AdditionalIncludeDirectories) true @@ -1623,6 +1625,9 @@ xcopy /q /y /i /s /e $(ProjectDir)DurangoMedia\CU $(LayoutDir)Image\Loose\CUDefault false Speed + true + true + true true @@ -1656,7 +1661,7 @@ xcopy /q /y /i /s /e $(ProjectDir)DurangoMedia\CU $(LayoutDir)Image\Loose\CUfalse $(OutDir)$(ProjectName).pch MultiThreaded - _LARGE_WORLDS;_DEBUG_MENUS_ENABLED;_CRT_NON_CONFORMING_SWPRINTFS;_CRT_SECURE_NO_WARNINGS;_WINDOWS64;%(PreprocessorDefinitions) + _LARGE_WORLDS;_DEBUG_MENUS_ENABLED;NDEBUG;_CRT_NON_CONFORMING_SWPRINTFS;_CRT_SECURE_NO_WARNINGS;_WINDOWS64;%(PreprocessorDefinitions) Disabled Windows64\Iggy\include;$(ProjectDir);%(AdditionalIncludeDirectories) true @@ -1664,6 +1669,9 @@ xcopy /q /y /i /s /e $(ProjectDir)DurangoMedia\CU $(LayoutDir)Image\Loose\CUDefault false Speed + true + true + true true @@ -27891,13 +27899,20 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CUtrue - true - true - true - true - true - true - true + NotUsing + NotUsing + NotUsing + NotUsing + NotUsing + NotUsing + NotUsing + false + false + false + false + false + false + false false true false @@ -27943,15 +27958,29 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CU NotUsing + CompileAsC + CompileAsC + CompileAsC + CompileAsC + CompileAsC + CompileAsC + CompileAsC - true - true - true - true - true - true - true + NotUsing + NotUsing + NotUsing + NotUsing + NotUsing + NotUsing + NotUsing + false + false + false + false + false + false + false false true false @@ -27995,15 +28024,29 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CUfalse NotUsing false + CompileAsC + CompileAsC + CompileAsC + CompileAsC + CompileAsC + CompileAsC + CompileAsC - true - true - true - true - true - true - true + NotUsing + NotUsing + NotUsing + NotUsing + NotUsing + NotUsing + NotUsing + false + false + false + false + false + false + false false true false @@ -28047,15 +28090,29 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CUfalse NotUsing false + CompileAsC + CompileAsC + CompileAsC + CompileAsC + CompileAsC + CompileAsC + CompileAsC - true - true - true - true - true - true - true + NotUsing + NotUsing + NotUsing + NotUsing + NotUsing + NotUsing + NotUsing + false + false + false + false + false + false + false false true false @@ -28099,15 +28156,29 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CUfalse NotUsing false + CompileAsC + CompileAsC + CompileAsC + CompileAsC + CompileAsC + CompileAsC + CompileAsC - true - true - true - true - true - true - true + NotUsing + NotUsing + NotUsing + NotUsing + NotUsing + NotUsing + NotUsing + false + false + false + false + false + false + false false true false @@ -28158,15 +28229,29 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CUtrue NotUsing false + CompileAsC + CompileAsC + CompileAsC + CompileAsC + CompileAsC + CompileAsC + CompileAsC - true - true - true - true - true - true - true + NotUsing + NotUsing + NotUsing + NotUsing + NotUsing + NotUsing + NotUsing + false + false + false + false + false + false + false false true false @@ -28217,15 +28302,29 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CUtrue NotUsing false + CompileAsC + CompileAsC + CompileAsC + CompileAsC + CompileAsC + CompileAsC + CompileAsC - true - true - true - true - true - true - true + NotUsing + NotUsing + NotUsing + NotUsing + NotUsing + NotUsing + NotUsing + false + false + false + false + false + false + false false true false @@ -28276,15 +28375,29 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CUtrue NotUsing false + CompileAsC + CompileAsC + CompileAsC + CompileAsC + CompileAsC + CompileAsC + CompileAsC - true - true - true - true - true - true - true + NotUsing + NotUsing + NotUsing + NotUsing + NotUsing + NotUsing + NotUsing + false + false + false + false + false + false + false false true false @@ -28335,15 +28448,29 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CUtrue NotUsing false + CompileAsC + CompileAsC + CompileAsC + CompileAsC + CompileAsC + CompileAsC + CompileAsC - true - true - true - true - true - true - true + NotUsing + NotUsing + NotUsing + NotUsing + NotUsing + NotUsing + NotUsing + false + false + false + false + false + false + false false true false @@ -28387,15 +28514,29 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CUfalse NotUsing false + CompileAsC + CompileAsC + CompileAsC + CompileAsC + CompileAsC + CompileAsC + CompileAsC - true - true - true - true - true - true - true + NotUsing + NotUsing + NotUsing + NotUsing + NotUsing + NotUsing + NotUsing + false + false + false + false + false + false + false false true false @@ -28439,15 +28580,29 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CUfalse NotUsing false + CompileAsC + CompileAsC + CompileAsC + CompileAsC + CompileAsC + CompileAsC + CompileAsC - true - true - true - true - true - true - true + NotUsing + NotUsing + NotUsing + NotUsing + NotUsing + NotUsing + NotUsing + false + false + false + false + false + false + false false true false @@ -28491,15 +28646,29 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CUfalse NotUsing false + CompileAsC + CompileAsC + CompileAsC + CompileAsC + CompileAsC + CompileAsC + CompileAsC - true - true - true - true - true - true - true + NotUsing + NotUsing + NotUsing + NotUsing + NotUsing + NotUsing + NotUsing + false + false + false + false + false + false + false false true false @@ -28543,15 +28712,29 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CUfalse NotUsing false + CompileAsC + CompileAsC + CompileAsC + CompileAsC + CompileAsC + CompileAsC + CompileAsC - true - true - true - true - true - true - true + NotUsing + NotUsing + NotUsing + NotUsing + NotUsing + NotUsing + NotUsing + false + false + false + false + false + false + false false true false @@ -28595,15 +28778,29 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CUfalse NotUsing false + CompileAsC + CompileAsC + CompileAsC + CompileAsC + CompileAsC + CompileAsC + CompileAsC - true - true - true - true - true - true - true + NotUsing + NotUsing + NotUsing + NotUsing + NotUsing + NotUsing + NotUsing + false + false + false + false + false + false + false false true false @@ -28647,15 +28844,29 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CUfalse NotUsing false + CompileAsC + CompileAsC + CompileAsC + CompileAsC + CompileAsC + CompileAsC + CompileAsC - true - true - true - true - true - true - true + NotUsing + NotUsing + NotUsing + NotUsing + NotUsing + NotUsing + NotUsing + false + false + false + false + false + false + false false true false @@ -28699,6 +28910,13 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CUfalse NotUsing false + CompileAsC + CompileAsC + CompileAsC + CompileAsC + CompileAsC + CompileAsC + CompileAsC @@ -43085,4 +43303,4 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CU - \ No newline at end of file + diff --git a/Minecraft.Client/Minecraft.cpp b/Minecraft.Client/Minecraft.cpp index ea9dedd6..9b841226 100644 --- a/Minecraft.Client/Minecraft.cpp +++ b/Minecraft.Client/Minecraft.cpp @@ -1298,9 +1298,9 @@ void Minecraft::run_middle() INetworkPlayer *pHostPlayer = g_NetworkManager.GetHostPlayer(); #ifdef _XBOX - PlayerUID xuid=((NetworkPlayerXbox *)pHostPlayer)->GetUID(); + PlayerUID xuid=((pHostPlayer != NULL) ? ((NetworkPlayerXbox *)pHostPlayer)->GetUID() : 0); #else - PlayerUID xuid=pHostPlayer->GetUID(); + PlayerUID xuid=(pHostPlayer != NULL) ? pHostPlayer->GetUID() : 0; #endif if(app.IsInBannedLevelList(i,xuid,app.GetUniqueMapName())) diff --git a/Minecraft.Client/MinecraftServer.cpp b/Minecraft.Client/MinecraftServer.cpp index 026c3fa4..626b5d08 100644 --- a/Minecraft.Client/MinecraftServer.cpp +++ b/Minecraft.Client/MinecraftServer.cpp @@ -165,7 +165,7 @@ bool MinecraftServer::initServer(__int64 seed, NetworkGameInitData *initData, DW //localIp = settings->getString(L"server-ip", L""); //onlineMode = settings->getBoolean(L"online-mode", true); //motd = settings->getString(L"motd", L"A Minecraft Server"); - //motd.replace('§', '$'); + //motd.replace('§', '$'); setAnimals(settings->getBoolean(L"spawn-animals", true)); setNpcsEnabled(settings->getBoolean(L"spawn-npcs", true)); @@ -210,7 +210,7 @@ bool MinecraftServer::initServer(__int64 seed, NetworkGameInitData *initData, DW // 4J-JEV: Need to wait for levelGenerationOptions to load. while ( app.getLevelGenerationOptions() != NULL && !app.getLevelGenerationOptions()->hasLoadedData() ) - Sleep(1); + Sleep(0); if ( app.getLevelGenerationOptions() != NULL && !app.getLevelGenerationOptions()->ready() ) { @@ -319,7 +319,7 @@ int MinecraftServer::runPostUpdate(void* lpParam) { LeaveCriticalSection(&server->m_postProcessCS); } - Sleep(1); + Sleep(0); } while (!server->m_postUpdateTerminate && ShutdownManager::ShouldRun(ShutdownManager::ePostProcessThread)); //#ifndef __PS3__ // One final pass through updates to make sure we're done diff --git a/Minecraft.Client/Orbis/Leaderboards/base64.cpp b/Minecraft.Client/Orbis/Leaderboards/base64.cpp index 01aa4cf0..477a92c7 100644 --- a/Minecraft.Client/Orbis/Leaderboards/base64.cpp +++ b/Minecraft.Client/Orbis/Leaderboards/base64.cpp @@ -1,7 +1,7 @@ /* base64.cpp and base64.h - Copyright (C) 2004-2008 René Nyffenegger + Copyright (C) 2004-2008 René Nyffenegger This source code is provided 'as-is', without any express or implied warranty. In no event will the author be held liable for any damages @@ -21,7 +21,7 @@ 3. This notice may not be removed or altered from any source distribution. - René Nyffenegger rene.nyffenegger@adp-gmbh.ch + René Nyffenegger rene.nyffenegger@adp-gmbh.ch */ @@ -41,7 +41,7 @@ static inline bool is_base64(unsigned char c) { } // 4J ADDED, -std::string base64_encode(std::string str) +std::string base64_encode(const std::string& str) { return base64_encode( reinterpret_cast(str.c_str()), str.length() ); } diff --git a/Minecraft.Client/Orbis/Leaderboards/base64.h b/Minecraft.Client/Orbis/Leaderboards/base64.h index bdd8a9c1..5892a406 100644 --- a/Minecraft.Client/Orbis/Leaderboards/base64.h +++ b/Minecraft.Client/Orbis/Leaderboards/base64.h @@ -2,6 +2,6 @@ #include -std::string base64_encode(std::string str); +std::string base64_encode(const std::string& str); std::string base64_encode(unsigned char const* , unsigned int len); std::string base64_decode(std::string const& s); \ No newline at end of file diff --git a/Minecraft.Client/PS3/Leaderboards/base64.cpp b/Minecraft.Client/PS3/Leaderboards/base64.cpp index 01aa4cf0..477a92c7 100644 --- a/Minecraft.Client/PS3/Leaderboards/base64.cpp +++ b/Minecraft.Client/PS3/Leaderboards/base64.cpp @@ -1,7 +1,7 @@ /* base64.cpp and base64.h - Copyright (C) 2004-2008 René Nyffenegger + Copyright (C) 2004-2008 René Nyffenegger This source code is provided 'as-is', without any express or implied warranty. In no event will the author be held liable for any damages @@ -21,7 +21,7 @@ 3. This notice may not be removed or altered from any source distribution. - René Nyffenegger rene.nyffenegger@adp-gmbh.ch + René Nyffenegger rene.nyffenegger@adp-gmbh.ch */ @@ -41,7 +41,7 @@ static inline bool is_base64(unsigned char c) { } // 4J ADDED, -std::string base64_encode(std::string str) +std::string base64_encode(const std::string& str) { return base64_encode( reinterpret_cast(str.c_str()), str.length() ); } diff --git a/Minecraft.Client/PS3/Leaderboards/base64.h b/Minecraft.Client/PS3/Leaderboards/base64.h index bdd8a9c1..5892a406 100644 --- a/Minecraft.Client/PS3/Leaderboards/base64.h +++ b/Minecraft.Client/PS3/Leaderboards/base64.h @@ -2,6 +2,6 @@ #include -std::string base64_encode(std::string str); +std::string base64_encode(const std::string& str); std::string base64_encode(unsigned char const* , unsigned int len); std::string base64_decode(std::string const& s); \ No newline at end of file diff --git a/Minecraft.Client/stdafx.h b/Minecraft.Client/stdafx.h index e5fb0b50..4fa7b1b9 100644 --- a/Minecraft.Client/stdafx.h +++ b/Minecraft.Client/stdafx.h @@ -5,6 +5,12 @@ #pragma once +#ifdef _XBOX +#ifndef _DISABLE_XBLIVE +#define _DISABLE_XBLIVE +#endif +#endif + //#include //#include diff --git a/Minecraft.World/BlockRegionUpdatePacket.cpp b/Minecraft.World/BlockRegionUpdatePacket.cpp index 441501d6..d5484e5a 100644 --- a/Minecraft.World/BlockRegionUpdatePacket.cpp +++ b/Minecraft.World/BlockRegionUpdatePacket.cpp @@ -74,7 +74,7 @@ BlockRegionUpdatePacket::BlockRegionUpdatePacket(int x, int y, int z, int xs, in unsigned char *ucTemp = new unsigned char[(256 * 16 * 16 * 5)/2]; unsigned int inputSize = (256 * 16 * 16 * 5)/2; - Compression::getCompression()->CompressLZXRLE(ucTemp, &inputSize, rawBuffer.data, (unsigned int) rawBuffer.length); + Compression::getCompression()->CompressRLE(ucTemp, &inputSize, rawBuffer.data, (unsigned int) rawBuffer.length); //app.DebugPrintf("Chunk (%d,%d) compressed from %d to size %d\n", x>>4, z>>4, rawBuffer.length, inputSize); unsigned char *ucTemp2 = new unsigned char[inputSize]; memcpy(ucTemp2,ucTemp,inputSize); @@ -120,7 +120,7 @@ void BlockRegionUpdatePacket::read(DataInputStream *dis) //throws IOException if( success ) { - Compression::getCompression()->DecompressLZXRLE( buffer.data, &outputSize, compressedBuffer.data, size); + Compression::getCompression()->DecompressRLE( buffer.data, &outputSize, compressedBuffer.data, size); } else { diff --git a/Minecraft.World/Connection.cpp b/Minecraft.World/Connection.cpp index f37f0f1d..d3fb5694 100644 --- a/Minecraft.World/Connection.cpp +++ b/Minecraft.World/Connection.cpp @@ -341,7 +341,7 @@ bool Connection::readTick() // printf("Con:0x%x readTick close EOS\n",this); // 4J Stu - Remove this line - // Fix for #10410 - UI: If the player is removed from a splitscreened host’s game, the next game that player joins will produce a message stating that the host has left. + // Fix for #10410 - UI: If the player is removed from a splitscreened hostÂ’s game, the next game that player joins will produce a message stating that the host has left. //close(DisconnectPacket::eDisconnect_EndOfStream); } @@ -666,7 +666,7 @@ int Connection::runClose(void* lpParam) //try { - Sleep(2000); + Sleep(500); if (con->running) { // 4J TODO writeThread.interrupt(); @@ -690,7 +690,7 @@ int Connection::runSendAndQuit(void* lpParam) //try { - Sleep(2000); + Sleep(500); if (con->running) { // 4J TODO writeThread.interrupt(); diff --git a/Minecraft.World/Minecraft.World.vcxproj b/Minecraft.World/Minecraft.World.vcxproj index 274964cb..5530b5be 100644 --- a/Minecraft.World/Minecraft.World.vcxproj +++ b/Minecraft.World/Minecraft.World.vcxproj @@ -1,4 +1,4 @@ - + @@ -274,6 +274,7 @@ StaticLibrary MultiByte v110 + true StaticLibrary diff --git a/Minecraft.World/compression.cpp b/Minecraft.World/compression.cpp index bada5069..9bbf0a8e 100644 --- a/Minecraft.World/compression.cpp +++ b/Minecraft.World/compression.cpp @@ -1,6 +1,6 @@ #include "stdafx.h" #include "compression.h" -#if defined __ORBIS__ || defined __PS3__ || defined _DURANGO || defined _WIN64 +#if defined __ORBIS__ || defined __PS3__ || defined _DURANGO || defined _WIN64 || defined _XBOX #include "..\Minecraft.Client\Common\zlib\zlib.h" #endif @@ -299,7 +299,7 @@ HRESULT Compression::DecompressRLE(void *pDestination, unsigned int *pDestSize, HRESULT Compression::Compress(void *pDestination, unsigned int *pDestSize, void *pSource, unsigned int SrcSize) { - // Using zlib for x64 compression - 360 is using native 360 compression and PS3 a stubbed non-compressing version of this + // Using zlib for x64 compression - 360 is using native 64 compression and PS3 a stubbed non-compressing version of this #if defined __ORBIS__ || defined _DURANGO || defined _WIN64 || defined __PSVITA__ SIZE_T destSize = (SIZE_T)(*pDestSize); int res = ::compress((Bytef *)pDestination, (uLongf *)&destSize, (Bytef *)pSource, SrcSize); @@ -327,7 +327,7 @@ HRESULT Compression::Decompress(void *pDestination, unsigned int *pDestSize, voi return DecompressWithType(pDestination, pDestSize, pSource, SrcSize); } - // Using zlib for x64 compression - 360 is using native 360 compression and PS3 a stubbed non-compressing version of this + // Using zlib for x64 and 360 compression - 360 is using native 360 compression and PS3 a stubbed non-compressing version of this #if defined __ORBIS__ || defined _DURANGO || defined _WIN64 || defined __PSVITA__ SIZE_T destSize = (SIZE_T)(*pDestSize); int res = ::uncompress((Bytef *)pDestination, (uLongf *)&destSize, (Bytef *)pSource, SrcSize); @@ -406,7 +406,7 @@ HRESULT Compression::DecompressWithType(void *pDestination, unsigned int *pDestS } break; case eCompressionType_ZLIBRLE: -#if (defined __ORBIS__ || defined __PS3__ || defined _DURANGO || defined _WIN64) +#if (defined __ORBIS__ || defined __PS3__ || defined _DURANGO || defined _WIN64 || defined _XBOX) if (pDestination != NULL) return ::uncompress((PBYTE)pDestination, (unsigned long *) pDestSize, (PBYTE) pSource, SrcSize); // Decompress else break; // Cannot decompress when destination is NULL diff --git a/Minecraft.World/stdafx.h b/Minecraft.World/stdafx.h index 96e206ec..59b45889 100644 --- a/Minecraft.World/stdafx.h +++ b/Minecraft.World/stdafx.h @@ -4,6 +4,12 @@ // #pragma once +#ifdef _XBOX +#ifndef _DISABLE_XBLIVE +#define _DISABLE_XBLIVE +#endif +#endif + #ifdef __PS3__ #else #define AUTO_VAR(_var, _val) auto _var = _val