forked from cafeberry/cafeberry
Fix X360 Crossplay (#26)
^Reviewed-on: pieeebot/cafeberry#26 Co-authored-by: qloak <realminecart@gmail.com>
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 hosts 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();
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="ContentPackage_NO_TU|Durango">
|
||||
@@ -201,6 +201,7 @@
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Durango'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user