Win64 joining Xbox 360 works again

This commit is contained in:
2026-08-07 04:15:12 -07:00
parent 7135da3f37
commit 1f5d7817fc
9 changed files with 6 additions and 92 deletions
@@ -898,6 +898,12 @@ bool CGameNetworkManager::IsNetworkThreadRunning()
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
AABB::UseDefaultThreadStorage();
Vec3::UseDefaultThreadStorage();
@@ -905,7 +911,6 @@ int CGameNetworkManager::RunNetworkGameThreadProc( void* lpParameter )
Tile::CreateNewThreadStorage();
IntCache::CreateNewThreadStorage();
g_NetworkManager.m_bNetworkThreadRunning = true;
bool success = g_NetworkManager._RunNetworkGame(lpParameter);
g_NetworkManager.m_bNetworkThreadRunning = false;
if( !success)
@@ -419,8 +419,6 @@ int CPlatformNetworkManagerStub::JoinGame(FriendSessionInfo *searchResult, int l
NotifyPlayerJoined(&IQNet::m_player[0]);
NotifyPlayerJoined(&IQNet::m_player[localSmallId]);
m_pGameNetworkManager->StateChange_AnyToStarting();
return CGameNetworkManager::JOINGAME_SUCCESS;
}
-12
View File
@@ -56,15 +56,9 @@ void AddEntityPacket::read(DataInputStream *dis) // throws IOException TODO 4J
{
id = dis->readShort();
type = dis->readByte();
#ifdef _LARGE_WORLDS
x = dis->readInt();
y = dis->readInt();
z = dis->readInt();
#else
x = dis->readShort();
y = dis->readShort();
z = dis->readShort();
#endif
yRot = dis->readByte();
xRot = dis->readByte();
data = dis->readInt();
@@ -80,15 +74,9 @@ void AddEntityPacket::write(DataOutputStream *dos) // throws IOException TODO 4J
{
dos->writeShort(id);
dos->writeByte(type);
#ifdef _LARGE_WORLDS
dos->writeInt(x);
dos->writeInt(y);
dos->writeInt(z);
#else
dos->writeShort(x);
dos->writeShort(y);
dos->writeShort(z);
#endif
dos->writeByte(yRot);
dos->writeByte(xRot);
dos->writeInt(data);
-12
View File
@@ -68,15 +68,9 @@ void AddMobPacket::read(DataInputStream *dis) //throws IOException
{
id = dis->readShort();
type = dis->readByte() & 0xff;
#ifdef _LARGE_WORLDS
x = dis->readInt();
y = dis->readInt();
z = dis->readInt();
#else
x = dis->readShort();
y = dis->readShort();
z = dis->readShort();
#endif
yRot = dis->readByte();
xRot = dis->readByte();
yHeadRot = dis->readByte();
@@ -92,15 +86,9 @@ void AddMobPacket::write(DataOutputStream *dos) //throws IOException
{
dos->writeShort(id);
dos->writeByte(type & 0xff);
#ifdef _LARGE_WORLDS
dos->writeInt(x);
dos->writeInt(y);
dos->writeInt(z);
#else
dos->writeShort(x);
dos->writeShort(y);
dos->writeShort(z);
#endif
dos->writeByte(yRot);
dos->writeByte(xRot);
dos->writeByte(yHeadRot);
@@ -51,17 +51,10 @@ ChunkTilesUpdatePacket::ChunkTilesUpdatePacket(int xc, int zc, shortArray positi
void ChunkTilesUpdatePacket::read(DataInputStream *dis) //throws IOException
{
// 4J - changed format. See comments in write method.
#ifdef _LARGE_WORLDS
xc = dis->readShort();
zc = dis->readShort();
xc = ( xc << 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();
bool dataAllZero = (( countAndFlags & 0x80 ) == 0x80 );
@@ -97,13 +90,8 @@ void ChunkTilesUpdatePacket::read(DataInputStream *dis) //throws IOException
void ChunkTilesUpdatePacket::write(DataOutputStream *dos) //throws IOException
{
// 4J - changed format to reduce size of these packets.
#ifdef _LARGE_WORLDS
dos->writeShort(xc);
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
// bother sending all those zeros in that case.
bool dataAllZero = true;
-4
View File
@@ -123,10 +123,8 @@ void LoginPacket::read(DataInputStream *dis) //throws IOException
m_isGuest = dis->readBoolean();
m_newSeaLevel = dis->readBoolean();
m_uiGamePrivileges = dis->readInt();
#ifdef _LARGE_WORLDS
m_xzSize = dis->readShort();
m_hellScale = dis->read();
#endif
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_newSeaLevel);
dos->writeInt(m_uiGamePrivileges);
#ifdef _LARGE_WORLDS
dos->writeShort(m_xzSize);
dos->write(m_hellScale);
#endif
}
void LoginPacket::handle(PacketListener *listener)
-4
View File
@@ -55,10 +55,8 @@ void RespawnPacket::read(DataInputStream *dis) //throws IOException
difficulty = dis->readByte();
m_newSeaLevel = dis->readBoolean();
m_newEntityId = dis->readShort();
#ifdef _LARGE_WORLDS
m_xzSize = dis->readShort();
m_hellScale = dis->read();
#endif
app.DebugPrintf("RespawnPacket::read - Difficulty = %d\n",difficulty);
}
@@ -80,10 +78,8 @@ void RespawnPacket::write(DataOutputStream *dos) //throws IOException
dos->writeByte(difficulty);
dos->writeBoolean(m_newSeaLevel);
dos->writeShort(m_newEntityId);
#ifdef _LARGE_WORLDS
dos->writeShort(m_xzSize);
dos->write(m_hellScale);
#endif
}
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
{
id = dis->readShort();
#ifdef _LARGE_WORLDS
x = dis->readInt();
y = dis->readInt();
z = dis->readInt();
#else
x = dis->readShort();
y = dis->readShort();
z = dis->readShort();
#endif
yRot = dis->readByte();
xRot = dis->readByte();
}
@@ -56,15 +50,9 @@ void TeleportEntityPacket::read(DataInputStream *dis) //throws IOException
void TeleportEntityPacket::write(DataOutputStream *dos) //throws IOException
{
dos->writeShort(id);
#ifdef _LARGE_WORLDS
dos->writeInt(x);
dos->writeInt(y);
dos->writeInt(z);
#else
dos->writeShort(x);
dos->writeShort(y);
dos->writeShort(z);
#endif
dos->write(yRot);
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
{
#ifdef _LARGE_WORLDS
x = dis->readInt();
y = dis->readUnsignedByte();
z = dis->readInt();
@@ -36,26 +35,10 @@ void TileUpdatePacket::read(DataInputStream *dis) //throws IOException
BYTE dataLevel = dis->readByte();
data = dataLevel & 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
{
#ifdef _LARGE_WORLDS
dos->writeInt(x);
dos->write(y);
dos->writeInt(z);
@@ -63,18 +46,6 @@ void TileUpdatePacket::write(DataOutputStream *dos) //throws IOException
BYTE dataLevel = ((levelIdx & 0xf ) << 4) | (data & 0xf);
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)
@@ -84,9 +55,5 @@ void TileUpdatePacket::handle(PacketListener *listener)
int TileUpdatePacket::getEstimatedSize()
{
#ifdef _LARGE_WORLDS
return 12;
#else
return 5;
#endif
}