Fix X360 Crossplay (#26)

^Reviewed-on: pieeebot/cafeberry#26

Co-authored-by: qloak <realminecart@gmail.com>
This commit is contained in:
qloak authored and pieeebot committed 2026-08-07 17:14:12 +00:00
1 parent 92891de261
commit ebbd54288b
41 files changed
+1346 -1287

No files matched your search

+11
View File
@@ -1856,6 +1856,7 @@ void ClientConnection::handlePreLogin(shared_ptr<PreLoginPacket> packet)
} }
#ifdef _XBOX #ifdef _XBOX
#if !defined(_DISABLE_XBLIVE)
if(!g_NetworkManager.IsHost() && !app.GetGameHostOption(eGameHostOption_FriendsOfFriends)) if(!g_NetworkManager.IsHost() && !app.GetGameHostOption(eGameHostOption_FriendsOfFriends))
{ {
if(m_userIndex == ProfileManager.GetPrimaryPad() ) if(m_userIndex == ProfileManager.GetPrimaryPad() )
@@ -1999,6 +2000,16 @@ void ClientConnection::handlePreLogin(shared_ptr<PreLoginPacket> packet)
} }
} }
} }
#else
// Offline/system-link games have no Xbox Live friend list, so grant all
// pre-login permissions (the Xbox Live-only checks above would otherwise
// fail and reject the client's own pre-login before Login is ever sent).
canPlay = TRUE;
canPlayLocal = TRUE;
isAtLeastOneFriend = TRUE;
isFriendsWithHost = TRUE;
cantPlayContentRestricted = FALSE;
#endif // _DISABLE_XBLIVE
#else #else
// TODO - handle this kind of things for non-360 platforms // TODO - handle this kind of things for non-360 platforms
canPlay = TRUE; canPlay = TRUE;
+4
View File
@@ -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 // 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 // we are going to switch to an offline game as it will likely crash due to incompatible parallel processes
bool switchToOffline = false; 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 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() ) if( !ProfileManager.IsSignedInLive( ProfileManager.GetLockedProfile() ) && !g_NetworkManager.IsLocalGame() )
{ {
switchToOffline = true; switchToOffline = true;
} }
#endif
//printf("Old: %x, New: %x, Changed: %x\n", m_ulLastSignInData, ulSignInData, changedPlayers); //printf("Old: %x, New: %x, Changed: %x\n", m_ulLastSignInData, ulSignInData, changedPlayers);
for(unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) for(unsigned int i = 0; i < XUSER_MAX_COUNT; ++i)
@@ -4958,6 +4960,7 @@ void CMinecraftApp::SignInChangeCallback(LPVOID pParam,bool bPrimaryPlayerChange
g_NetworkManager.HandleSignInChange(); 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 // 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 // no longer signed in then nav back
else if ( pApp->GetLiveLinkRequired() && !ProfileManager.IsSignedInLive( ProfileManager.GetLockedProfile() ) ) else if ( pApp->GetLiveLinkRequired() && !ProfileManager.IsSignedInLive( ProfileManager.GetLockedProfile() ) )
@@ -4969,6 +4972,7 @@ void CMinecraftApp::SignInChangeCallback(LPVOID pParam,bool bPrimaryPlayerChange
pApp->SetAction(iPrimaryPlayer,eAppAction_EthernetDisconnected); pApp->SetAction(iPrimaryPlayer,eAppAction_EthernetDisconnected);
} }
} }
#endif
#if ( defined __PS3__ || defined __ORBIS__ || defined _DURANGO || defined __PSVITA__ ) #if ( defined __PS3__ || defined __ORBIS__ || defined _DURANGO || defined __PSVITA__ )
// 4J-JEV: Need to kick of loading of profile data for sub-sign in players. // 4J-JEV: Need to kick of loading of profile data for sub-sign in players.
@@ -1,7 +1,7 @@
/* /*
base64.cpp and base64.h 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 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 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. 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, // 4J ADDED,
std::string base64_encode(std::string str) std::string base64_encode(const std::string& str)
{ {
return base64_encode( reinterpret_cast<const unsigned char*>(str.c_str()), str.length() ); return base64_encode( reinterpret_cast<const unsigned char*>(str.c_str()), str.length() );
} }
@@ -2,6 +2,6 @@
#include <string> #include <string>
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_encode(unsigned char const* , unsigned int len);
std::string base64_decode(std::string const& s); std::string base64_decode(std::string const& s);
@@ -100,12 +100,14 @@ void CGameNetworkManager::DoWork()
{ {
case XN_LIVE_LINK_STATE_CHANGED: case XN_LIVE_LINK_STATE_CHANGED:
{ {
#ifndef _DISABLE_XBLIVE
int iPrimaryPlayer = g_NetworkManager.GetPrimaryPad(); int iPrimaryPlayer = g_NetworkManager.GetPrimaryPad();
bool bConnected = (pNotification->uiParam!=0)?true:false; bool bConnected = (pNotification->uiParam!=0)?true:false;
if((g_NetworkManager.GetLockedProfile()!=-1) && iPrimaryPlayer!=-1 && bConnected == false && g_NetworkManager.IsInSession() ) if((g_NetworkManager.GetLockedProfile()!=-1) && iPrimaryPlayer!=-1 && bConnected == false && g_NetworkManager.IsInSession() )
{ {
app.SetAction(iPrimaryPlayer,eAppAction_EthernetDisconnected); app.SetAction(iPrimaryPlayer,eAppAction_EthernetDisconnected);
} }
#endif
} }
break; break;
case XN_LIVE_INVITE_ACCEPTED: 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); app.DebugPrintf("JoinFromInvite_SignInReturned, iPad %d\n",iPad);
// It's possible that the player has not signed in - they can back out // It's possible that the player has not signed in - they can back out
#ifndef _DISABLE_XBLIVE
if(ProfileManager.IsSignedIn(iPad) && ProfileManager.IsSignedInLive(iPad) ) if(ProfileManager.IsSignedIn(iPad) && ProfileManager.IsSignedInLive(iPad) )
#else
if(ProfileManager.IsSignedIn(iPad))
#endif
{ {
app.DebugPrintf("JoinFromInvite_SignInReturned, passed sign-in tests\n"); app.DebugPrintf("JoinFromInvite_SignInReturned, passed sign-in tests\n");
int localUsersMask = 0; int localUsersMask = 0;
@@ -794,7 +800,9 @@ int CGameNetworkManager::JoinFromInvite_SignInReturned(void *pParam,bool bContin
if(ProfileManager.IsSignedIn(index) ) if(ProfileManager.IsSignedIn(index) )
{ {
++joiningUsers; ++joiningUsers;
#ifndef _DISABLE_XBLIVE
if( !ProfileManager.AllowedToPlayMultiplayer(index) ) noPrivileges = true; if( !ProfileManager.AllowedToPlayMultiplayer(index) ) noPrivileges = true;
#endif
localUsersMask |= GetLocalPlayerMask( index ); localUsersMask |= GetLocalPlayerMask( index );
} }
} }
@@ -890,6 +898,12 @@ bool CGameNetworkManager::IsNetworkThreadRunning()
int CGameNetworkManager::RunNetworkGameThreadProc( void* lpParameter ) int CGameNetworkManager::RunNetworkGameThreadProc( void* lpParameter )
{ {
if( g_NetworkManager.m_bNetworkThreadRunning )
{
return -1;
}
g_NetworkManager.m_bNetworkThreadRunning = true;
// Share AABB & Vec3 pools with default (main thread) - should be ok as long as we don't tick the main thread whilst this thread is running // Share AABB & Vec3 pools with default (main thread) - should be ok as long as we don't tick the main thread whilst this thread is running
AABB::UseDefaultThreadStorage(); AABB::UseDefaultThreadStorage();
Vec3::UseDefaultThreadStorage(); Vec3::UseDefaultThreadStorage();
@@ -897,7 +911,6 @@ int CGameNetworkManager::RunNetworkGameThreadProc( void* lpParameter )
Tile::CreateNewThreadStorage(); Tile::CreateNewThreadStorage();
IntCache::CreateNewThreadStorage(); IntCache::CreateNewThreadStorage();
g_NetworkManager.m_bNetworkThreadRunning = true;
bool success = g_NetworkManager._RunNetworkGame(lpParameter); bool success = g_NetworkManager._RunNetworkGame(lpParameter);
g_NetworkManager.m_bNetworkThreadRunning = false; g_NetworkManager.m_bNetworkThreadRunning = false;
if( !success) if( !success)
@@ -905,7 +918,7 @@ int CGameNetworkManager::RunNetworkGameThreadProc( void* lpParameter )
TexturePack *tPack = Minecraft::GetInstance()->skins->getSelected(); TexturePack *tPack = Minecraft::GetInstance()->skins->getSelected();
while ( tPack->isLoadingData() || (Minecraft::GetInstance()->skins->needsUIUpdate() || ui.IsReloadingSkin()) ) while ( tPack->isLoadingData() || (Minecraft::GetInstance()->skins->needsUIUpdate() || ui.IsReloadingSkin()) )
{ {
Sleep(1); Sleep(0);
} }
ui.CleanUpSkinReload(); ui.CleanUpSkinReload();
if(app.GetDisconnectReason() == DisconnectPacket::eDisconnect_None) if(app.GetDisconnectReason() == DisconnectPacket::eDisconnect_None)
@@ -942,7 +955,7 @@ int CGameNetworkManager::ServerThreadProc( void* lpParameter )
{ {
while((Minecraft::GetInstance()->skins->needsUIUpdate() || ui.IsReloadingSkin())) while((Minecraft::GetInstance()->skins->needsUIUpdate() || ui.IsReloadingSkin()))
{ {
Sleep(1); Sleep(0);
} }
param->levelGen->loadBaseSaveData(); param->levelGen->loadBaseSaveData();
} }
@@ -984,7 +997,7 @@ int CGameNetworkManager::ExitAndJoinFromInviteThreadProc( void* lpParam )
while( g_NetworkManager.IsInSession() ) 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 // Xbox should always be online when receiving invites - on PS3 we need to check & ask the user to sign in
@@ -1260,7 +1273,7 @@ int CGameNetworkManager::ChangeSessionTypeThreadProc( void* lpParam )
// wait for the current session to end // wait for the current session to end
while( g_NetworkManager.IsInSession() ) 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 // 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
@@ -1665,6 +1678,7 @@ void CGameNetworkManager::GameInviteReceived( int userIndex, const INVITE_INFO *
{ {
if (ProfileManager.IsSignedIn(i) && (i == ProfileManager.GetPrimaryPad() || isLocalMultiplayerAvailable)) if (ProfileManager.IsSignedIn(i) && (i == ProfileManager.GetPrimaryPad() || isLocalMultiplayerAvailable))
{ {
#ifndef _DISABLE_XBLIVE
if (isSignedInLive && !ProfileManager.IsSignedInLive(i)) if (isSignedInLive && !ProfileManager.IsSignedInLive(i))
{ {
// Record the first non signed in live pad // Record the first non signed in live pad
@@ -1672,6 +1686,9 @@ void CGameNetworkManager::GameInviteReceived( int userIndex, const INVITE_INFO *
} }
isSignedInLive = isSignedInLive && ProfileManager.IsSignedInLive(i); isSignedInLive = isSignedInLive && ProfileManager.IsSignedInLive(i);
#else
isSignedInLive = true;
#endif
} }
} }
@@ -1743,7 +1760,9 @@ void CGameNetworkManager::GameInviteReceived( int userIndex, const INVITE_INFO *
if(index==userIndex || pMinecraft->localplayers[index]!=NULL ) if(index==userIndex || pMinecraft->localplayers[index]!=NULL )
{ {
++joiningUsers; ++joiningUsers;
#ifndef _DISABLE_XBLIVE
if( !ProfileManager.AllowedToPlayMultiplayer(index) ) noPrivileges = true; if( !ProfileManager.AllowedToPlayMultiplayer(index) ) noPrivileges = true;
#endif
localUsersMask |= GetLocalPlayerMask( index ); localUsersMask |= GetLocalPlayerMask( index );
} }
} }
@@ -1898,6 +1917,7 @@ void CGameNetworkManager::HandleInviteWhenInMenus( int userIndex, const INVITE_I
if(!app.IsLocalMultiplayerAvailable()) if(!app.IsLocalMultiplayerAvailable())
#endif #endif
{ {
#ifndef _DISABLE_XBLIVE
bool noPrivileges=!ProfileManager.AllowedToPlayMultiplayer(userIndex); bool noPrivileges=!ProfileManager.AllowedToPlayMultiplayer(userIndex);
if(noPrivileges) if(noPrivileges)
@@ -1908,6 +1928,7 @@ void CGameNetworkManager::HandleInviteWhenInMenus( int userIndex, const INVITE_I
} }
else else
{ {
#endif
ProfileManager.SetLockedProfile(userIndex); ProfileManager.SetLockedProfile(userIndex);
ProfileManager.SetPrimaryPad(userIndex); ProfileManager.SetPrimaryPad(userIndex);
@@ -1930,7 +1951,9 @@ void CGameNetworkManager::HandleInviteWhenInMenus( int userIndex, const INVITE_I
{ {
app.DebugPrintf( "Failed joining game from invite\n" ); app.DebugPrintf( "Failed joining game from invite\n" );
} }
#ifndef _DISABLE_XBLIVE
} }
#endif
} }
else else
{ {
@@ -1,4 +1,4 @@
#include "stdafx.h" #include "stdafx.h"
#include "NetworkSocketLayer.h" #include "NetworkSocketLayer.h"
#include "..\..\Common\Network\PlatformNetworkManager.h" #include "..\..\Common\Network\PlatformNetworkManager.h"
File diff suppressed because it is too large. Load diff
@@ -1,171 +1,171 @@
#pragma once #pragma once
using namespace std; using namespace std;
#include <vector> #include <vector>
#include "..\..\..\Minecraft.World\C4JThread.h" #include "..\..\..\Minecraft.World\C4JThread.h"
#include "NetworkPlayerInterface.h" #include "NetworkPlayerInterface.h"
#include "PlatformNetworkManagerInterface.h" #include "PlatformNetworkManagerInterface.h"
#include "SessionInfo.h" #include "SessionInfo.h"
class CPlatformNetworkManagerStub : public CPlatformNetworkManager class CPlatformNetworkManagerStub : public CPlatformNetworkManager
{ {
friend class CGameNetworkManager; friend class CGameNetworkManager;
public: public:
virtual bool Initialise(CGameNetworkManager *pGameNetworkManager, int flagIndexSize); virtual bool Initialise(CGameNetworkManager *pGameNetworkManager, int flagIndexSize);
virtual void Terminate(); virtual void Terminate();
virtual int GetJoiningReadyPercentage(); virtual int GetJoiningReadyPercentage();
virtual int CorrectErrorIDS(int IDS); virtual int CorrectErrorIDS(int IDS);
virtual void DoWork(); virtual void DoWork();
virtual int GetPlayerCount(); virtual int GetPlayerCount();
virtual int GetOnlinePlayerCount(); virtual int GetOnlinePlayerCount();
virtual int GetLocalPlayerMask(int playerIndex); virtual int GetLocalPlayerMask(int playerIndex);
virtual bool AddLocalPlayerByUserIndex( int userIndex ); virtual bool AddLocalPlayerByUserIndex( int userIndex );
virtual bool RemoveLocalPlayerByUserIndex( int userIndex ); virtual bool RemoveLocalPlayerByUserIndex( int userIndex );
virtual INetworkPlayer *GetLocalPlayerByUserIndex( int userIndex ); virtual INetworkPlayer *GetLocalPlayerByUserIndex( int userIndex );
virtual INetworkPlayer *GetPlayerByIndex(int playerIndex); virtual INetworkPlayer *GetPlayerByIndex(int playerIndex);
virtual INetworkPlayer * GetPlayerByXuid(PlayerUID xuid); virtual INetworkPlayer * GetPlayerByXuid(PlayerUID xuid);
virtual INetworkPlayer * GetPlayerBySmallId(unsigned char smallId); virtual INetworkPlayer * GetPlayerBySmallId(unsigned char smallId);
virtual bool ShouldMessageForFullSession(); virtual bool ShouldMessageForFullSession();
virtual INetworkPlayer *GetHostPlayer(); virtual INetworkPlayer *GetHostPlayer();
virtual bool IsHost(); virtual bool IsHost();
virtual bool JoinGameFromInviteInfo( int userIndex, int userMask, const INVITE_INFO *pInviteInfo); virtual bool JoinGameFromInviteInfo( int userIndex, int userMask, const INVITE_INFO *pInviteInfo);
virtual bool LeaveGame(bool bMigrateHost); virtual bool LeaveGame(bool bMigrateHost);
virtual bool IsInSession(); virtual bool IsInSession();
virtual bool IsInGameplay(); virtual bool IsInGameplay();
virtual bool IsReadyToPlayOrIdle(); virtual bool IsReadyToPlayOrIdle();
virtual bool IsInStatsEnabledSession(); virtual bool IsInStatsEnabledSession();
virtual bool SessionHasSpace(unsigned int spaceRequired = 1); virtual bool SessionHasSpace(unsigned int spaceRequired = 1);
virtual void SendInviteGUI(int quadrant); virtual void SendInviteGUI(int quadrant);
virtual bool IsAddingPlayer(); virtual bool IsAddingPlayer();
virtual void HostGame(int localUsersMask, bool bOnlineGame, bool bIsPrivate, unsigned char publicSlots = MINECRAFT_NET_MAX_PLAYERS, unsigned char privateSlots = 0); virtual void HostGame(int localUsersMask, bool bOnlineGame, bool bIsPrivate, unsigned char publicSlots = MINECRAFT_NET_MAX_PLAYERS, unsigned char privateSlots = 0);
virtual int JoinGame(FriendSessionInfo *searchResult, int localUsersMask, int primaryUserIndex ); virtual int JoinGame(FriendSessionInfo *searchResult, int localUsersMask, int primaryUserIndex );
virtual bool SetLocalGame(bool isLocal); virtual bool SetLocalGame(bool isLocal);
virtual bool IsLocalGame() { return m_bIsOfflineGame; } virtual bool IsLocalGame() { return m_bIsOfflineGame; }
virtual void SetPrivateGame(bool isPrivate); virtual void SetPrivateGame(bool isPrivate);
virtual bool IsPrivateGame() { return m_bIsPrivateGame; } virtual bool IsPrivateGame() { return m_bIsPrivateGame; }
virtual bool IsLeavingGame() { return m_bLeavingGame; } virtual bool IsLeavingGame() { return m_bLeavingGame; }
virtual void ResetLeavingGame() { m_bLeavingGame = false; } virtual void ResetLeavingGame() { m_bLeavingGame = false; }
virtual void RegisterPlayerChangedCallback(int iPad, void (*callback)(void *callbackParam, INetworkPlayer *pPlayer, bool leaving), void *callbackParam); virtual void RegisterPlayerChangedCallback(int iPad, void (*callback)(void *callbackParam, INetworkPlayer *pPlayer, bool leaving), void *callbackParam);
virtual void UnRegisterPlayerChangedCallback(int iPad, void (*callback)(void *callbackParam, INetworkPlayer *pPlayer, bool leaving), void *callbackParam); virtual void UnRegisterPlayerChangedCallback(int iPad, void (*callback)(void *callbackParam, INetworkPlayer *pPlayer, bool leaving), void *callbackParam);
virtual void HandleSignInChange(); virtual void HandleSignInChange();
virtual bool _RunNetworkGame(); virtual bool _RunNetworkGame();
private: private:
bool isSystemPrimaryPlayer(IQNetPlayer *pQNetPlayer); bool isSystemPrimaryPlayer(IQNetPlayer *pQNetPlayer);
virtual bool _LeaveGame(bool bMigrateHost, bool bLeaveRoom); virtual bool _LeaveGame(bool bMigrateHost, bool bLeaveRoom);
virtual void _HostGame(int dwUsersMask, unsigned char publicSlots = MINECRAFT_NET_MAX_PLAYERS, unsigned char privateSlots = 0); virtual void _HostGame(int dwUsersMask, unsigned char publicSlots = MINECRAFT_NET_MAX_PLAYERS, unsigned char privateSlots = 0);
virtual bool _StartGame(); virtual bool _StartGame();
IQNet * m_pIQNet; // pointer to QNet interface IQNet * m_pIQNet; // pointer to QNet interface
HANDLE m_notificationListener; HANDLE m_notificationListener;
vector<IQNetPlayer *> m_machineQNetPrimaryPlayers; // collection of players that we deem to be the main one for that system vector<IQNetPlayer *> m_machineQNetPrimaryPlayers; // collection of players that we deem to be the main one for that system
bool m_bLeavingGame; bool m_bLeavingGame;
bool m_bLeaveGameOnTick; bool m_bLeaveGameOnTick;
bool m_migrateHostOnLeave; bool m_migrateHostOnLeave;
bool m_bHostChanged; bool m_bHostChanged;
bool m_bIsOfflineGame; bool m_bIsOfflineGame;
bool m_bIsPrivateGame; bool m_bIsPrivateGame;
int m_flagIndexSize; int m_flagIndexSize;
// This is only maintained by the host, and is not valid on client machines // This is only maintained by the host, and is not valid on client machines
GameSessionData m_hostGameSessionData; GameSessionData m_hostGameSessionData;
CGameNetworkManager *m_pGameNetworkManager; CGameNetworkManager *m_pGameNetworkManager;
public: public:
virtual void UpdateAndSetGameSessionData(INetworkPlayer *pNetworkPlayerLeaving = NULL); virtual void UpdateAndSetGameSessionData(INetworkPlayer *pNetworkPlayerLeaving = NULL);
private: private:
// TODO 4J Stu - Do we need to be able to have more than one of these? // TODO 4J Stu - Do we need to be able to have more than one of these?
void (*playerChangedCallback[XUSER_MAX_COUNT])(void *callbackParam, INetworkPlayer *pPlayer, bool leaving); void (*playerChangedCallback[XUSER_MAX_COUNT])(void *callbackParam, INetworkPlayer *pPlayer, bool leaving);
void *playerChangedCallbackParam[XUSER_MAX_COUNT]; void *playerChangedCallbackParam[XUSER_MAX_COUNT];
static int RemovePlayerOnSocketClosedThreadProc( void* lpParam ); static int RemovePlayerOnSocketClosedThreadProc( void* lpParam );
virtual bool RemoveLocalPlayer( INetworkPlayer *pNetworkPlayer ); virtual bool RemoveLocalPlayer( INetworkPlayer *pNetworkPlayer );
// Things for handling per-system flags // Things for handling per-system flags
class PlayerFlags class PlayerFlags
{ {
public: public:
INetworkPlayer *m_pNetworkPlayer; INetworkPlayer *m_pNetworkPlayer;
unsigned char *flags; unsigned char *flags;
unsigned int count; unsigned int count;
PlayerFlags(INetworkPlayer *pNetworkPlayer, unsigned int count); PlayerFlags(INetworkPlayer *pNetworkPlayer, unsigned int count);
~PlayerFlags(); ~PlayerFlags();
}; };
vector<PlayerFlags *> m_playerFlags; vector<PlayerFlags *> m_playerFlags;
void SystemFlagAddPlayer(INetworkPlayer *pNetworkPlayer); void SystemFlagAddPlayer(INetworkPlayer *pNetworkPlayer);
void SystemFlagRemovePlayer(INetworkPlayer *pNetworkPlayer); void SystemFlagRemovePlayer(INetworkPlayer *pNetworkPlayer);
void SystemFlagReset(); void SystemFlagReset();
public: public:
virtual void SystemFlagSet(INetworkPlayer *pNetworkPlayer, int index); virtual void SystemFlagSet(INetworkPlayer *pNetworkPlayer, int index);
virtual bool SystemFlagGet(INetworkPlayer *pNetworkPlayer, int index); virtual bool SystemFlagGet(INetworkPlayer *pNetworkPlayer, int index);
// For telemetry // For telemetry
private: private:
float m_lastPlayerEventTimeStart; float m_lastPlayerEventTimeStart;
public: public:
wstring GatherStats(); wstring GatherStats();
wstring GatherRTTStats(); wstring GatherRTTStats();
private: private:
vector<FriendSessionInfo *> friendsSessions[XUSER_MAX_COUNT]; vector<FriendSessionInfo *> friendsSessions[XUSER_MAX_COUNT];
int m_searchResultsCount[XUSER_MAX_COUNT]; int m_searchResultsCount[XUSER_MAX_COUNT];
int m_lastSearchStartTime[XUSER_MAX_COUNT]; int m_lastSearchStartTime[XUSER_MAX_COUNT];
// The results that will be filled in with the current search // The results that will be filled in with the current search
XSESSION_SEARCHRESULT_HEADER *m_pSearchResults[XUSER_MAX_COUNT]; XSESSION_SEARCHRESULT_HEADER *m_pSearchResults[XUSER_MAX_COUNT];
XNQOS *m_pQoSResult[XUSER_MAX_COUNT]; XNQOS *m_pQoSResult[XUSER_MAX_COUNT];
// The results from the previous search, which are currently displayed in the game // The results from the previous search, which are currently displayed in the game
XSESSION_SEARCHRESULT_HEADER *m_pCurrentSearchResults[XUSER_MAX_COUNT]; XSESSION_SEARCHRESULT_HEADER *m_pCurrentSearchResults[XUSER_MAX_COUNT];
XNQOS *m_pCurrentQoSResult[XUSER_MAX_COUNT]; XNQOS *m_pCurrentQoSResult[XUSER_MAX_COUNT];
int m_currentSearchResultsCount[XUSER_MAX_COUNT]; int m_currentSearchResultsCount[XUSER_MAX_COUNT];
int m_lastSearchPad; int m_lastSearchPad;
bool m_bSearchResultsReady; bool m_bSearchResultsReady;
bool m_bSearchPending; bool m_bSearchPending;
LPVOID m_pSearchParam; LPVOID m_pSearchParam;
void (*m_SessionsUpdatedCallback)(LPVOID pParam); void (*m_SessionsUpdatedCallback)(LPVOID pParam);
C4JThread* m_SearchingThread; C4JThread* m_SearchingThread;
void TickSearch(); void TickSearch();
void SearchForGames(); void SearchForGames();
static int SearchForGamesThreadProc( void* lpParameter ); static int SearchForGamesThreadProc( void* lpParameter );
void SetSearchResultsReady(int resultCount = 0); void SetSearchResultsReady(int resultCount = 0);
vector<INetworkPlayer *>currentNetworkPlayers; vector<INetworkPlayer *>currentNetworkPlayers;
INetworkPlayer *addNetworkPlayer(IQNetPlayer *pQNetPlayer); INetworkPlayer *addNetworkPlayer(IQNetPlayer *pQNetPlayer);
void removeNetworkPlayer(IQNetPlayer *pQNetPlayer); void removeNetworkPlayer(IQNetPlayer *pQNetPlayer);
static INetworkPlayer *getNetworkPlayer(IQNetPlayer *pQNetPlayer); static INetworkPlayer *getNetworkPlayer(IQNetPlayer *pQNetPlayer);
virtual void SetSessionTexturePackParentId( int id ); virtual void SetSessionTexturePackParentId( int id );
virtual void SetSessionSubTexturePackId( int id ); virtual void SetSessionSubTexturePackId( int id );
virtual void Notify(int ID, ULONG_PTR Param); virtual void Notify(int ID, ULONG_PTR Param);
public: public:
virtual vector<FriendSessionInfo *> *GetSessionList(int iPad, int localPlayers, bool partyOnly); virtual vector<FriendSessionInfo *> *GetSessionList(int iPad, int localPlayers, bool partyOnly);
virtual bool GetGameSessionInfo(int iPad, SessionID sessionId,FriendSessionInfo *foundSession); virtual bool GetGameSessionInfo(int iPad, SessionID sessionId,FriendSessionInfo *foundSession);
virtual void SetSessionsUpdatedCallback( void (*SessionsUpdatedCallback)(LPVOID pParam), LPVOID pSearchParam ); virtual void SetSessionsUpdatedCallback( void (*SessionsUpdatedCallback)(LPVOID pParam), LPVOID pSearchParam );
virtual void GetFullFriendSessionInfo( FriendSessionInfo *foundSession, void (* FriendSessionUpdatedFn)(bool success, void *pParam), void *pParam ); virtual void GetFullFriendSessionInfo( FriendSessionInfo *foundSession, void (* FriendSessionUpdatedFn)(bool success, void *pParam), void *pParam );
virtual void ForceFriendsSessionRefresh(); virtual void ForceFriendsSessionRefresh();
public: public:
void NotifyPlayerJoined( IQNetPlayer *pQNetPlayer ); void NotifyPlayerJoined( IQNetPlayer *pQNetPlayer );
void NotifyPlayerLeaving( IQNetPlayer *pQNetPlayer ); void NotifyPlayerLeaving( IQNetPlayer *pQNetPlayer );
#ifndef _XBOX #ifndef _XBOX
void FakeLocalPlayerJoined() { NotifyPlayerJoined(m_pIQNet->GetLocalPlayerByUserIndex(0)); } void FakeLocalPlayerJoined() { NotifyPlayerJoined(m_pIQNet->GetLocalPlayerByUserIndex(0)); }
#endif #endif
}; };
@@ -600,6 +600,21 @@ void UIScene_JoinMenu::JoinGame(UIScene_JoinMenu* pClass)
ui.NavigateToHomeMenu(); 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);
}
} }
} }
@@ -76,7 +76,19 @@ HRESULT CScene_LoadGameSettings::OnInit( XUIMessageInit* pInitData, BOOL& bHandl
XuiControlSetText(m_ButtonLoad,app.GetString(IDS_LOAD)); XuiControlSetText(m_ButtonLoad,app.GetString(IDS_LOAD));
XuiControlSetText(m_pTexturePacksList->m_hObj,app.GetString(IDS_DLC_MENU_TEXTUREPACKS)); 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); 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. // 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); bool bGameSetting_Online=(app.GetGameSettings(m_iPad,eGameSetting_Online)!=0);
m_MoreOptionsParams.bOnlineSettingChangedBySystem=false; m_MoreOptionsParams.bOnlineSettingChangedBySystem=false;
@@ -741,7 +753,10 @@ HRESULT CScene_LoadGameSettings::OnTimer( XUIMessageTimer *pTimer, BOOL& bHandle
{ {
case GAME_CREATE_ONLINE_TIMER_ID: 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) if(bMultiplayerAllowed != m_bMultiplayerAllowed)
{ {
@@ -1015,7 +1030,9 @@ int CScene_LoadGameSettings::StartGame_SignInReturned(void *pParam,bool bContinu
{ {
if(ProfileManager.IsSignedIn(index) ) if(ProfileManager.IsSignedIn(index) )
{ {
#ifndef _DISABLE_XBLIVE
if( !ProfileManager.AllowedToPlayMultiplayer(index) ) noPrivileges = true; if( !ProfileManager.AllowedToPlayMultiplayer(index) ) noPrivileges = true;
#endif
dwLocalUsersMask |= CGameNetworkManager::GetLocalPlayerMask(index); dwLocalUsersMask |= CGameNetworkManager::GetLocalPlayerMask(index);
} }
} }
@@ -67,7 +67,19 @@ HRESULT CScene_MultiGameCreate::OnInit( XUIMessageInit* pInitData, BOOL& bHandle
m_iPad=params->iPad; m_iPad=params->iPad;
delete params; delete params;
#ifndef _DISABLE_XBLIVE
#ifndef _DISABLE_XBLIVE
#ifndef _DISABLE_XBLIVE
m_bMultiplayerAllowed = ProfileManager.IsSignedInLive( m_iPad ) && ProfileManager.AllowedToPlayMultiplayer(m_iPad); 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. // 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); bool bGameSetting_Online=(app.GetGameSettings(m_iPad,eGameSetting_Online)!=0);
m_MoreOptionsParams.bOnlineSettingChangedBySystem=false; m_MoreOptionsParams.bOnlineSettingChangedBySystem=false;
@@ -663,7 +675,10 @@ HRESULT CScene_MultiGameCreate::OnTimer( XUIMessageTimer *pTimer, BOOL& bHandled
case GAME_CREATE_ONLINE_TIMER_ID: 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) if(bMultiplayerAllowed != m_bMultiplayerAllowed)
{ {
@@ -824,7 +839,9 @@ int CScene_MultiGameCreate::StartGame_SignInReturned(void *pParam,bool bContinue
{ {
if(ProfileManager.IsSignedIn(index) ) if(ProfileManager.IsSignedIn(index) )
{ {
#ifndef _DISABLE_XBLIVE
if( !ProfileManager.AllowedToPlayMultiplayer(index) ) noPrivileges = true; if( !ProfileManager.AllowedToPlayMultiplayer(index) ) noPrivileges = true;
#endif
dwLocalUsersMask |= CGameNetworkManager::GetLocalPlayerMask(index); dwLocalUsersMask |= CGameNetworkManager::GetLocalPlayerMask(index);
} }
} }
@@ -274,7 +274,9 @@ void CScene_MultiGameInfo::JoinGame(CScene_MultiGameInfo* pClass)
if(ProfileManager.IsSignedIn(index) ) if(ProfileManager.IsSignedIn(index) )
{ {
++dwSignedInUsers; ++dwSignedInUsers;
#ifndef _DISABLE_XBLIVE
if( !ProfileManager.AllowedToPlayMultiplayer(index) ) noPrivileges = true; if( !ProfileManager.AllowedToPlayMultiplayer(index) ) noPrivileges = true;
#endif
dwLocalUsersMask |= CGameNetworkManager::GetLocalPlayerMask(index); dwLocalUsersMask |= CGameNetworkManager::GetLocalPlayerMask(index);
} }
} }
@@ -284,7 +286,9 @@ void CScene_MultiGameInfo::JoinGame(CScene_MultiGameInfo* pClass)
if(ProfileManager.IsSignedIn(ProfileManager.GetPrimaryPad()) ) if(ProfileManager.IsSignedIn(ProfileManager.GetPrimaryPad()) )
{ {
++dwSignedInUsers; ++dwSignedInUsers;
#ifndef _DISABLE_XBLIVE
if( !ProfileManager.AllowedToPlayMultiplayer(ProfileManager.GetPrimaryPad()) ) noPrivileges = true; if( !ProfileManager.AllowedToPlayMultiplayer(ProfileManager.GetPrimaryPad()) ) noPrivileges = true;
#endif
dwLocalUsersMask |= CGameNetworkManager::GetLocalPlayerMask(ProfileManager.GetPrimaryPad()); dwLocalUsersMask |= CGameNetworkManager::GetLocalPlayerMask(ProfileManager.GetPrimaryPad());
} }
} }
@@ -348,6 +352,21 @@ void CScene_MultiGameInfo::JoinGame(CScene_MultiGameInfo* pClass)
app.NavigateToHomeMenu(); 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);
}
} }
} }
@@ -73,7 +73,11 @@ HRESULT CScene_MultiGameJoinLoad::OnInit( XUIMessageInit* pInitData, BOOL& bHand
// } // }
m_initData= new JoinMenuInitData(); m_initData= new JoinMenuInitData();
#ifndef _DISABLE_XBLIVE
m_bMultiplayerAllowed = ProfileManager.IsSignedInLive( m_iPad ) && ProfileManager.AllowedToPlayMultiplayer(m_iPad); m_bMultiplayerAllowed = ProfileManager.IsSignedInLive( m_iPad ) && ProfileManager.AllowedToPlayMultiplayer(m_iPad);
#else
m_bMultiplayerAllowed = true;
#endif
XPARTY_USER_LIST partyList; XPARTY_USER_LIST partyList;
@@ -768,7 +772,11 @@ HRESULT CScene_MultiGameJoinLoad::OnNavReturn(HXUIOBJ hSceneFrom,BOOL& rfHandled
// start the texture pack timer again // start the texture pack timer again
XuiSetTimer(m_hObj,CHECKFORAVAILABLETEXTUREPACKS_TIMER_ID,CHECKFORAVAILABLETEXTUREPACKS_TIMER_TIME); 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 // re-enable button presses
m_bIgnoreInput=false; m_bIgnoreInput=false;
@@ -1643,7 +1651,10 @@ HRESULT CScene_MultiGameJoinLoad::OnTimer( XUIMessageTimer *pTimer, BOOL& bHandl
m_bInParty=false; 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 != m_bMultiplayerAllowed)
{ {
if( bMultiplayerAllowed ) if( bMultiplayerAllowed )
+5 -4
View File
@@ -145,10 +145,11 @@ void EnderDragonRenderer::render(shared_ptr<Entity> _mob, double x, double y, do
int steps = 8; int steps = 8;
for (int i = 0; i <= steps; i++) for (int i = 0; i <= steps; i++)
{ {
double d=i % steps * PI * 2 / steps; int idx = i % steps;
float s = sin(i % steps * PI * 2 / steps) * 0.75f; double d = idx * PI * 2 / steps;
float c = cos(i % steps * PI * 2 / steps) * 0.75f; float s = sin(d) * 0.75f;
float u = i % steps * 1.0f / steps; float c = cos(d) * 0.75f;
float u = idx * 1.0f / steps;
//t->color(0x000000); //t->color(0x000000);
t->vertexUV(s * 0.2f, c * 0.2f, 0, u, v1); t->vertexUV(s * 0.2f, c * 0.2f, 0, u, v1);
//t->color(0xffffff); //t->color(0xffffff);
@@ -94,6 +94,17 @@ void EntityRenderDispatcher::staticCtor()
instance = new EntityRenderDispatcher(); 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() EntityRenderDispatcher::EntityRenderDispatcher()
{ {
glEnable(GL_LIGHTING); glEnable(GL_LIGHTING);
+2 -1
View File
@@ -1,7 +1,7 @@
#pragma once #pragma once
#include "EntityRenderer.h" #include "EntityRenderer.h"
#include "..\Minecraft.World\Entity.h"
#include "..\Minecraft.World\JavaIntHash.h" #include "..\Minecraft.World\JavaIntHash.h"
class Entity;
class font; class font;
using namespace std; using namespace std;
@@ -37,6 +37,7 @@ public:
private: private:
EntityRenderDispatcher(); EntityRenderDispatcher();
~EntityRenderDispatcher();
public: public:
EntityRenderer *getRenderer(eINSTANCEOF e); EntityRenderer *getRenderer(eINSTANCEOF e);
+1
View File
@@ -78,6 +78,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; } DWORD XContentGetThumbnail(DWORD dwUserIndex, const XCONTENT_DATA *pContentData, PBYTE pbThumbnail, PDWORD pcbThumbnail, PXOVERLAPPED *pOverlapped) { return 0; }
void XShowAchievementsUI(int i) {} void XShowAchievementsUI(int i) {}
DWORD XBackgroundDownloadSetMode(XBACKGROUND_DOWNLOAD_MODE Mode) { return 0; } DWORD XBackgroundDownloadSetMode(XBACKGROUND_DOWNLOAD_MODE Mode) { return 0; }
DWORD XamBackgroundDownloadSetMode(XBACKGROUND_DOWNLOAD_MODE Mode) { return 0; }
#ifndef _DURANGO #ifndef _DURANGO
void PIXAddNamedCounter(int a, char *b, ...) {} void PIXAddNamedCounter(int a, char *b, ...) {}
+33 -27
View File
@@ -105,8 +105,6 @@ GameRenderer::GameRenderer(Minecraft *mc)
zoom = 1; zoom = 1;
zoom_x = 0; zoom_x = 0;
zoom_y = 0; zoom_y = 0;
rainXa = NULL;
rainZa = NULL;
lastActiveTime = Minecraft::currentTimeMillis(); lastActiveTime = Minecraft::currentTimeMillis();
lastNsTime = 0; lastNsTime = 0;
random = new Random(); random = new Random();
@@ -181,8 +179,9 @@ GameRenderer::GameRenderer(Minecraft *mc)
// 4J Stu Added to go with 1.8.2 change // 4J Stu Added to go with 1.8.2 change
GameRenderer::~GameRenderer() GameRenderer::~GameRenderer()
{ {
if(rainXa != NULL) delete [] rainXa; delete random;
if(rainZa != NULL) delete [] rainZa; delete cameraPos;
delete lb;
} }
void GameRenderer::tick(bool first) // 4J - add bFirst 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 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 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++) for (int i = 0; i < 256; i++)
{ {
float darken = skyDarken1 * 0.95f + 0.05f;
float sky = level->dimension->brightnessRamp[i / 16] * darken; 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) if (level->skyFlashTime > 0)
{ {
sky = level->dimension->brightnessRamp[i / 16]; sky = level->dimension->brightnessRamp[i / 16];
} }
float rs = sky * (skyDarken1 * 0.65f + 0.35f); float rs = sky * rsGsMul;
float gs = sky * (skyDarken1 * 0.65f + 0.35f); float gs = sky * rsGsMul;
float bs = sky; float bs = sky;
float rb = block; float rb = block;
@@ -1526,27 +1527,30 @@ void GameRenderer::tickRain()
int x = x0 + random->nextInt(r) - random->nextInt(r); int x = x0 + random->nextInt(r) - random->nextInt(r);
int z = z0 + random->nextInt(r) - random->nextInt(r); int z = z0 + random->nextInt(r) - random->nextInt(r);
int y = level->getTopRainBlock(x, z); int y = level->getTopRainBlock(x, z);
int t = level->getTile(x, y - 1, z); if (y <= y0 + r && y >= y0 - r)
Biome *biome = level->getBiome(x,z);
if (y <= y0 + r && y >= y0 - r && biome->hasRain() && biome->getTemperature() >= 0.2f)
{ {
float xa = random->nextFloat(); int t = level->getTile(x, y - 1, z);
float za = random->nextFloat(); Biome *biome = level->getBiome(x,z);
if (t > 0) 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<SmokeParticle>( new SmokeParticle(level, x + xa, y + 0.1f - Tile::tiles[t]->getShapeY0(), z + za, 0, 0, 0) ) ); if (Tile::tiles[t]->material == Material::lava)
}
else
{
if (random->nextInt(++rainPosSamples) == 0)
{ {
rainPosX = x + xa; mc->particleEngine->add( shared_ptr<SmokeParticle>( new SmokeParticle(level, x + xa, y + 0.1f - Tile::tiles[t]->getShapeY0(), z + za, 0, 0, 0) ) );
rainPosY = y + 0.1f - Tile::tiles[t]->getShapeY0(); }
rainPosZ = z + za; 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<WaterDropParticle>( new WaterDropParticle(level, x + xa, y + 0.1f - Tile::tiles[t]->getShapeY0(), z + za) ) );
} }
mc->particleEngine->add( shared_ptr<WaterDropParticle>( 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); 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]; rainArraysInitialized = true;
rainZa = new float[32 * 32];
for (int z = 0; z < 32; z++) for (int z = 0; z < 32; z++)
{ {
-2
View File
@@ -128,8 +128,6 @@ private:
void tickRain(); void tickRain();
private: private:
// 4J - brought forward from 1.8.2 // 4J - brought forward from 1.8.2
float *rainXa;
float *rainZa;
protected: protected:
void renderSnowAndRain(float a); void renderSnowAndRain(float a);
volatile int xMod; volatile int xMod;
+4 -4
View File
@@ -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_ZOMBIE_LOCATION = ResourceLocation(TN_MOB_HORSE_ZOMBIE);
ResourceLocation HorseRenderer::HORSE_SKELETON_LOCATION = ResourceLocation(TN_MOB_HORSE_SKELETON); ResourceLocation HorseRenderer::HORSE_SKELETON_LOCATION = ResourceLocation(TN_MOB_HORSE_SKELETON);
std::map<wstring, ResourceLocation *> HorseRenderer::LAYERED_LOCATION_CACHE; std::map<wstring, ResourceLocation> HorseRenderer::LAYERED_LOCATION_CACHE;
HorseRenderer::HorseRenderer(Model *model, float f) : MobRenderer(model, f) HorseRenderer::HorseRenderer(Model *model, float f) : MobRenderer(model, f)
{ {
@@ -114,14 +114,14 @@ ResourceLocation *HorseRenderer::getOrCreateLayeredTextureLocation(shared_ptr<En
ResourceLocation *location; ResourceLocation *location;
if (it != LAYERED_LOCATION_CACHE.end()) if (it != LAYERED_LOCATION_CACHE.end())
{ {
location = it->second; location = &(it->second);
} }
else else
{ {
LAYERED_LOCATION_CACHE[textureName] = new ResourceLocation(horse->getLayeredTextureLayers()); LAYERED_LOCATION_CACHE[textureName] = ResourceLocation(horse->getLayeredTextureLayers());
it = LAYERED_LOCATION_CACHE.find(textureName); it = LAYERED_LOCATION_CACHE.find(textureName);
location = it->second; location = &(it->second);
} }
return location; return location;
+1 -1
View File
@@ -8,7 +8,7 @@ class PathfinderMob;
class HorseRenderer : public MobRenderer class HorseRenderer : public MobRenderer
{ {
private: private:
static std::map<wstring, ResourceLocation *> LAYERED_LOCATION_CACHE; static std::map<wstring, ResourceLocation> LAYERED_LOCATION_CACHE;
static ResourceLocation HORSE_LOCATION; static ResourceLocation HORSE_LOCATION;
static ResourceLocation HORSE_MULE_LOCATION; static ResourceLocation HORSE_MULE_LOCATION;
+1 -1
View File
@@ -36516,4 +36516,4 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CU</Comman
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets"> <ImportGroup Label="ExtensionTargets">
</ImportGroup> </ImportGroup>
</Project> </Project>
+2 -2
View File
@@ -1298,9 +1298,9 @@ void Minecraft::run_middle()
INetworkPlayer *pHostPlayer = g_NetworkManager.GetHostPlayer(); INetworkPlayer *pHostPlayer = g_NetworkManager.GetHostPlayer();
#ifdef _XBOX #ifdef _XBOX
PlayerUID xuid=((NetworkPlayerXbox *)pHostPlayer)->GetUID(); PlayerUID xuid=((pHostPlayer != NULL) ? ((NetworkPlayerXbox *)pHostPlayer)->GetUID() : 0);
#else #else
PlayerUID xuid=pHostPlayer->GetUID(); PlayerUID xuid=(pHostPlayer != NULL) ? pHostPlayer->GetUID() : 0;
#endif #endif
if(app.IsInBannedLevelList(i,xuid,app.GetUniqueMapName())) if(app.IsInBannedLevelList(i,xuid,app.GetUniqueMapName()))
+3 -3
View File
@@ -165,7 +165,7 @@ bool MinecraftServer::initServer(__int64 seed, NetworkGameInitData *initData, DW
//localIp = settings->getString(L"server-ip", L""); //localIp = settings->getString(L"server-ip", L"");
//onlineMode = settings->getBoolean(L"online-mode", true); //onlineMode = settings->getBoolean(L"online-mode", true);
//motd = settings->getString(L"motd", L"A Minecraft Server"); //motd = settings->getString(L"motd", L"A Minecraft Server");
//motd.replace('§', '$'); //motd.replace('§', '$');
setAnimals(settings->getBoolean(L"spawn-animals", true)); setAnimals(settings->getBoolean(L"spawn-animals", true));
setNpcsEnabled(settings->getBoolean(L"spawn-npcs", 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. // 4J-JEV: Need to wait for levelGenerationOptions to load.
while ( app.getLevelGenerationOptions() != NULL && !app.getLevelGenerationOptions()->hasLoadedData() ) while ( app.getLevelGenerationOptions() != NULL && !app.getLevelGenerationOptions()->hasLoadedData() )
Sleep(1); Sleep(0);
if ( app.getLevelGenerationOptions() != NULL && !app.getLevelGenerationOptions()->ready() ) if ( app.getLevelGenerationOptions() != NULL && !app.getLevelGenerationOptions()->ready() )
{ {
@@ -319,7 +319,7 @@ int MinecraftServer::runPostUpdate(void* lpParam)
{ {
LeaveCriticalSection(&server->m_postProcessCS); LeaveCriticalSection(&server->m_postProcessCS);
} }
Sleep(1); Sleep(0);
} while (!server->m_postUpdateTerminate && ShutdownManager::ShouldRun(ShutdownManager::ePostProcessThread)); } while (!server->m_postUpdateTerminate && ShutdownManager::ShouldRun(ShutdownManager::ePostProcessThread));
//#ifndef __PS3__ //#ifndef __PS3__
// One final pass through updates to make sure we're done // One final pass through updates to make sure we're done
@@ -1,7 +1,7 @@
/* /*
base64.cpp and base64.h 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 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 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. 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, // 4J ADDED,
std::string base64_encode(std::string str) std::string base64_encode(const std::string& str)
{ {
return base64_encode( reinterpret_cast<const unsigned char*>(str.c_str()), str.length() ); return base64_encode( reinterpret_cast<const unsigned char*>(str.c_str()), str.length() );
} }
+1 -1
View File
@@ -2,6 +2,6 @@
#include <string> #include <string>
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_encode(unsigned char const* , unsigned int len);
std::string base64_decode(std::string const& s); std::string base64_decode(std::string const& s);
+3 -3
View File
@@ -1,7 +1,7 @@
/* /*
base64.cpp and base64.h 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 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 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. 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, // 4J ADDED,
std::string base64_encode(std::string str) std::string base64_encode(const std::string& str)
{ {
return base64_encode( reinterpret_cast<const unsigned char*>(str.c_str()), str.length() ); return base64_encode( reinterpret_cast<const unsigned char*>(str.c_str()), str.length() );
} }
+1 -1
View File
@@ -2,6 +2,6 @@
#include <string> #include <string>
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_encode(unsigned char const* , unsigned int len);
std::string base64_decode(std::string const& s); std::string base64_decode(std::string const& s);
+6
View File
@@ -5,6 +5,12 @@
#pragma once #pragma once
#ifdef _XBOX
#ifndef _DISABLE_XBLIVE
#define _DISABLE_XBLIVE
#endif
#endif
//#include <xtl.h> //#include <xtl.h>
//#include <xboxmath.h> //#include <xboxmath.h>
-12
View File
@@ -56,15 +56,9 @@ void AddEntityPacket::read(DataInputStream *dis) // throws IOException TODO 4J
{ {
id = dis->readShort(); id = dis->readShort();
type = dis->readByte(); type = dis->readByte();
#ifdef _LARGE_WORLDS
x = dis->readInt(); x = dis->readInt();
y = dis->readInt(); y = dis->readInt();
z = dis->readInt(); z = dis->readInt();
#else
x = dis->readShort();
y = dis->readShort();
z = dis->readShort();
#endif
yRot = dis->readByte(); yRot = dis->readByte();
xRot = dis->readByte(); xRot = dis->readByte();
data = dis->readInt(); data = dis->readInt();
@@ -80,15 +74,9 @@ void AddEntityPacket::write(DataOutputStream *dos) // throws IOException TODO 4J
{ {
dos->writeShort(id); dos->writeShort(id);
dos->writeByte(type); dos->writeByte(type);
#ifdef _LARGE_WORLDS
dos->writeInt(x); dos->writeInt(x);
dos->writeInt(y); dos->writeInt(y);
dos->writeInt(z); dos->writeInt(z);
#else
dos->writeShort(x);
dos->writeShort(y);
dos->writeShort(z);
#endif
dos->writeByte(yRot); dos->writeByte(yRot);
dos->writeByte(xRot); dos->writeByte(xRot);
dos->writeInt(data); dos->writeInt(data);
-12
View File
@@ -68,15 +68,9 @@ void AddMobPacket::read(DataInputStream *dis) //throws IOException
{ {
id = dis->readShort(); id = dis->readShort();
type = dis->readByte() & 0xff; type = dis->readByte() & 0xff;
#ifdef _LARGE_WORLDS
x = dis->readInt(); x = dis->readInt();
y = dis->readInt(); y = dis->readInt();
z = dis->readInt(); z = dis->readInt();
#else
x = dis->readShort();
y = dis->readShort();
z = dis->readShort();
#endif
yRot = dis->readByte(); yRot = dis->readByte();
xRot = dis->readByte(); xRot = dis->readByte();
yHeadRot = dis->readByte(); yHeadRot = dis->readByte();
@@ -92,15 +86,9 @@ void AddMobPacket::write(DataOutputStream *dos) //throws IOException
{ {
dos->writeShort(id); dos->writeShort(id);
dos->writeByte(type & 0xff); dos->writeByte(type & 0xff);
#ifdef _LARGE_WORLDS
dos->writeInt(x); dos->writeInt(x);
dos->writeInt(y); dos->writeInt(y);
dos->writeInt(z); dos->writeInt(z);
#else
dos->writeShort(x);
dos->writeShort(y);
dos->writeShort(z);
#endif
dos->writeByte(yRot); dos->writeByte(yRot);
dos->writeByte(xRot); dos->writeByte(xRot);
dos->writeByte(yHeadRot); dos->writeByte(yHeadRot);
+2 -2
View File
@@ -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 char *ucTemp = new unsigned char[(256 * 16 * 16 * 5)/2];
unsigned int inputSize = (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); //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]; unsigned char *ucTemp2 = new unsigned char[inputSize];
memcpy(ucTemp2,ucTemp,inputSize); memcpy(ucTemp2,ucTemp,inputSize);
@@ -120,7 +120,7 @@ void BlockRegionUpdatePacket::read(DataInputStream *dis) //throws IOException
if( success ) if( success )
{ {
Compression::getCompression()->DecompressLZXRLE( buffer.data, &outputSize, compressedBuffer.data, size); Compression::getCompression()->DecompressRLE( buffer.data, &outputSize, compressedBuffer.data, size);
} }
else else
{ {
@@ -51,17 +51,10 @@ ChunkTilesUpdatePacket::ChunkTilesUpdatePacket(int xc, int zc, shortArray positi
void ChunkTilesUpdatePacket::read(DataInputStream *dis) //throws IOException void ChunkTilesUpdatePacket::read(DataInputStream *dis) //throws IOException
{ {
// 4J - changed format. See comments in write method. // 4J - changed format. See comments in write method.
#ifdef _LARGE_WORLDS
xc = dis->readShort(); xc = dis->readShort();
zc = dis->readShort(); zc = dis->readShort();
xc = ( xc << 16 ) >> 16; xc = ( xc << 16 ) >> 16;
zc = ( zc << 16 ) >> 16; zc = ( zc << 16 ) >> 16;
#else
xc = dis->read();
zc = dis->read();
xc = ( xc << 24 ) >> 24;
zc = ( zc << 24 ) >> 24;
#endif
int countAndFlags = dis->readByte(); int countAndFlags = dis->readByte();
bool dataAllZero = (( countAndFlags & 0x80 ) == 0x80 ); bool dataAllZero = (( countAndFlags & 0x80 ) == 0x80 );
@@ -97,13 +90,8 @@ void ChunkTilesUpdatePacket::read(DataInputStream *dis) //throws IOException
void ChunkTilesUpdatePacket::write(DataOutputStream *dos) //throws IOException void ChunkTilesUpdatePacket::write(DataOutputStream *dos) //throws IOException
{ {
// 4J - changed format to reduce size of these packets. // 4J - changed format to reduce size of these packets.
#ifdef _LARGE_WORLDS
dos->writeShort(xc); dos->writeShort(xc);
dos->writeShort(zc); dos->writeShort(zc);
#else
dos->write(xc);
dos->write(zc);
#endif
// Determine if we've got any data elements that are non-zero - a large % of these packets set all data to zero, so we don't // Determine if we've got any data elements that are non-zero - a large % of these packets set all data to zero, so we don't
// bother sending all those zeros in that case. // bother sending all those zeros in that case.
bool dataAllZero = true; bool dataAllZero = true;
+3 -3
View File
@@ -341,7 +341,7 @@ bool Connection::readTick()
// printf("Con:0x%x readTick close EOS\n",this); // printf("Con:0x%x readTick close EOS\n",this);
// 4J Stu - Remove this line // 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); //close(DisconnectPacket::eDisconnect_EndOfStream);
} }
@@ -666,7 +666,7 @@ int Connection::runClose(void* lpParam)
//try { //try {
Sleep(2000); Sleep(500);
if (con->running) if (con->running)
{ {
// 4J TODO writeThread.interrupt(); // 4J TODO writeThread.interrupt();
@@ -690,7 +690,7 @@ int Connection::runSendAndQuit(void* lpParam)
//try { //try {
Sleep(2000); Sleep(500);
if (con->running) if (con->running)
{ {
// 4J TODO writeThread.interrupt(); // 4J TODO writeThread.interrupt();
-4
View File
@@ -123,10 +123,8 @@ void LoginPacket::read(DataInputStream *dis) //throws IOException
m_isGuest = dis->readBoolean(); m_isGuest = dis->readBoolean();
m_newSeaLevel = dis->readBoolean(); m_newSeaLevel = dis->readBoolean();
m_uiGamePrivileges = dis->readInt(); m_uiGamePrivileges = dis->readInt();
#ifdef _LARGE_WORLDS
m_xzSize = dis->readShort(); m_xzSize = dis->readShort();
m_hellScale = dis->read(); m_hellScale = dis->read();
#endif
app.DebugPrintf("LoginPacket::read - Difficulty = %d\n",difficulty); app.DebugPrintf("LoginPacket::read - Difficulty = %d\n",difficulty);
} }
@@ -160,10 +158,8 @@ void LoginPacket::write(DataOutputStream *dos) //throws IOException
dos->writeBoolean(m_isGuest); dos->writeBoolean(m_isGuest);
dos->writeBoolean(m_newSeaLevel); dos->writeBoolean(m_newSeaLevel);
dos->writeInt(m_uiGamePrivileges); dos->writeInt(m_uiGamePrivileges);
#ifdef _LARGE_WORLDS
dos->writeShort(m_xzSize); dos->writeShort(m_xzSize);
dos->write(m_hellScale); dos->write(m_hellScale);
#endif
} }
void LoginPacket::handle(PacketListener *listener) void LoginPacket::handle(PacketListener *listener)
+2 -1
View File
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations"> <ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="ContentPackage_NO_TU|Durango"> <ProjectConfiguration Include="ContentPackage_NO_TU|Durango">
@@ -201,6 +201,7 @@
<ConfigurationType>StaticLibrary</ConfigurationType> <ConfigurationType>StaticLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet> <CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v110</PlatformToolset> <PlatformToolset>v110</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Durango'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Durango'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType> <ConfigurationType>StaticLibrary</ConfigurationType>
-4
View File
@@ -55,10 +55,8 @@ void RespawnPacket::read(DataInputStream *dis) //throws IOException
difficulty = dis->readByte(); difficulty = dis->readByte();
m_newSeaLevel = dis->readBoolean(); m_newSeaLevel = dis->readBoolean();
m_newEntityId = dis->readShort(); m_newEntityId = dis->readShort();
#ifdef _LARGE_WORLDS
m_xzSize = dis->readShort(); m_xzSize = dis->readShort();
m_hellScale = dis->read(); m_hellScale = dis->read();
#endif
app.DebugPrintf("RespawnPacket::read - Difficulty = %d\n",difficulty); app.DebugPrintf("RespawnPacket::read - Difficulty = %d\n",difficulty);
} }
@@ -80,10 +78,8 @@ void RespawnPacket::write(DataOutputStream *dos) //throws IOException
dos->writeByte(difficulty); dos->writeByte(difficulty);
dos->writeBoolean(m_newSeaLevel); dos->writeBoolean(m_newSeaLevel);
dos->writeShort(m_newEntityId); dos->writeShort(m_newEntityId);
#ifdef _LARGE_WORLDS
dos->writeShort(m_xzSize); dos->writeShort(m_xzSize);
dos->write(m_hellScale); dos->write(m_hellScale);
#endif
} }
int RespawnPacket::getEstimatedSize() int RespawnPacket::getEstimatedSize()
-12
View File
@@ -40,15 +40,9 @@ TeleportEntityPacket::TeleportEntityPacket(int id, int x, int y, int z, byte yRo
void TeleportEntityPacket::read(DataInputStream *dis) //throws IOException void TeleportEntityPacket::read(DataInputStream *dis) //throws IOException
{ {
id = dis->readShort(); id = dis->readShort();
#ifdef _LARGE_WORLDS
x = dis->readInt(); x = dis->readInt();
y = dis->readInt(); y = dis->readInt();
z = dis->readInt(); z = dis->readInt();
#else
x = dis->readShort();
y = dis->readShort();
z = dis->readShort();
#endif
yRot = dis->readByte(); yRot = dis->readByte();
xRot = dis->readByte(); xRot = dis->readByte();
} }
@@ -56,15 +50,9 @@ void TeleportEntityPacket::read(DataInputStream *dis) //throws IOException
void TeleportEntityPacket::write(DataOutputStream *dos) //throws IOException void TeleportEntityPacket::write(DataOutputStream *dos) //throws IOException
{ {
dos->writeShort(id); dos->writeShort(id);
#ifdef _LARGE_WORLDS
dos->writeInt(x); dos->writeInt(x);
dos->writeInt(y); dos->writeInt(y);
dos->writeInt(z); dos->writeInt(z);
#else
dos->writeShort(x);
dos->writeShort(y);
dos->writeShort(z);
#endif
dos->write(yRot); dos->write(yRot);
dos->write(xRot); dos->write(xRot);
} }
-33
View File
@@ -26,7 +26,6 @@ TileUpdatePacket::TileUpdatePacket(int x, int y, int z, Level *level)
void TileUpdatePacket::read(DataInputStream *dis) //throws IOException void TileUpdatePacket::read(DataInputStream *dis) //throws IOException
{ {
#ifdef _LARGE_WORLDS
x = dis->readInt(); x = dis->readInt();
y = dis->readUnsignedByte(); y = dis->readUnsignedByte();
z = dis->readInt(); z = dis->readInt();
@@ -36,26 +35,10 @@ void TileUpdatePacket::read(DataInputStream *dis) //throws IOException
BYTE dataLevel = dis->readByte(); BYTE dataLevel = dis->readByte();
data = dataLevel & 0xf; data = dataLevel & 0xf;
levelIdx = (dataLevel>>4) & 0xf; levelIdx = (dataLevel>>4) & 0xf;
#else
// 4J - See comments in write for packing
int xyzdata = dis->readInt();
x = ( xyzdata >> 22 ) & 0x3ff;
y = ( xyzdata >> 14 ) & 0xff;
z = ( xyzdata >> 4 ) & 0x3ff;
x = ( x << 22 ) >> 22;
z = ( z << 22 ) >> 22;
data = xyzdata & 0xf;
block = (int)dis->readShort() & 0xffff;
//levelIdx = ( xyzdata >> 31 ) & 1;
// Can't pack this as it's now 2 bits
levelIdx = (int)dis->readByte();
#endif
} }
void TileUpdatePacket::write(DataOutputStream *dos) //throws IOException void TileUpdatePacket::write(DataOutputStream *dos) //throws IOException
{ {
#ifdef _LARGE_WORLDS
dos->writeInt(x); dos->writeInt(x);
dos->write(y); dos->write(y);
dos->writeInt(z); dos->writeInt(z);
@@ -63,18 +46,6 @@ void TileUpdatePacket::write(DataOutputStream *dos) //throws IOException
BYTE dataLevel = ((levelIdx & 0xf ) << 4) | (data & 0xf); BYTE dataLevel = ((levelIdx & 0xf ) << 4) | (data & 0xf);
dos->writeByte(dataLevel); dos->writeByte(dataLevel);
#else
// 4J - for our fixed size map, we can pack x & z into 10 bits each (-512 -> 511), y into 8 bits (0 to 255)
// block type could really be 7 bits but leaving that as 8 for future ease of expansion. Data only needs to be 4-bits as that is how it
// is ultimately stored
int xyzdata = ( ( x & 0x3ff ) << 22 ) | ( ( y & 0xff ) << 14 ) | ( ( z & 0x3ff ) << 4 ) | ( data & 0xf);
//xyzdata |= levelIdx << 31;
dos->writeInt(xyzdata);
dos->writeShort(block);
// Can't pack this as it's now 2 bits
dos->write(levelIdx);
#endif
} }
void TileUpdatePacket::handle(PacketListener *listener) void TileUpdatePacket::handle(PacketListener *listener)
@@ -84,9 +55,5 @@ void TileUpdatePacket::handle(PacketListener *listener)
int TileUpdatePacket::getEstimatedSize() int TileUpdatePacket::getEstimatedSize()
{ {
#ifdef _LARGE_WORLDS
return 12; return 12;
#else
return 5;
#endif
} }
+4 -4
View File
@@ -1,6 +1,6 @@
#include "stdafx.h" #include "stdafx.h"
#include "compression.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" #include "..\Minecraft.Client\Common\zlib\zlib.h"
#endif #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) 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__ #if defined __ORBIS__ || defined _DURANGO || defined _WIN64 || defined __PSVITA__
SIZE_T destSize = (SIZE_T)(*pDestSize); SIZE_T destSize = (SIZE_T)(*pDestSize);
int res = ::compress((Bytef *)pDestination, (uLongf *)&destSize, (Bytef *)pSource, SrcSize); 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); 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__ #if defined __ORBIS__ || defined _DURANGO || defined _WIN64 || defined __PSVITA__
SIZE_T destSize = (SIZE_T)(*pDestSize); SIZE_T destSize = (SIZE_T)(*pDestSize);
int res = ::uncompress((Bytef *)pDestination, (uLongf *)&destSize, (Bytef *)pSource, SrcSize); int res = ::uncompress((Bytef *)pDestination, (uLongf *)&destSize, (Bytef *)pSource, SrcSize);
@@ -406,7 +406,7 @@ HRESULT Compression::DecompressWithType(void *pDestination, unsigned int *pDestS
} }
break; break;
case eCompressionType_ZLIBRLE: 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) if (pDestination != NULL)
return ::uncompress((PBYTE)pDestination, (unsigned long *) pDestSize, (PBYTE) pSource, SrcSize); // Decompress return ::uncompress((PBYTE)pDestination, (unsigned long *) pDestSize, (PBYTE) pSource, SrcSize); // Decompress
else break; // Cannot decompress when destination is NULL else break; // Cannot decompress when destination is NULL
+6
View File
@@ -4,6 +4,12 @@
// //
#pragma once #pragma once
#ifdef _XBOX
#ifndef _DISABLE_XBLIVE
#define _DISABLE_XBLIVE
#endif
#endif
#ifdef __PS3__ #ifdef __PS3__
#else #else
#define AUTO_VAR(_var, _val) auto _var = _val #define AUTO_VAR(_var, _val) auto _var = _val