mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/4jcraft.git
synced 2026-06-11 14:22:32 +00:00
cleanup: flatten dead branches in world io level network and stats
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
#include "../../Platform/stdafx.h"
|
||||
#include "Compression.h"
|
||||
#if 0 || 0 || 0 || \
|
||||
defined _WIN64 || defined __linux__
|
||||
#if defined(_WIN64) || defined(__linux__)
|
||||
// zconf.h defines "typedef unsigned char Byte" which conflicts with the
|
||||
// project's "class Byte" from BasicTypeContainers.h (via stdafx.h).
|
||||
// Rename zlib's Byte to zlib_Byte before the include so the typedef lands
|
||||
@@ -137,7 +136,7 @@ HRESULT Compression::CompressRLE(void* pDestination, unsigned int* pDestSize,
|
||||
*pDestSize = rleSize;
|
||||
memcpy(pDestination, rleCompressBuf, *pDestSize);
|
||||
} else {
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
#if !defined(_CONTENT_PACKAGE)
|
||||
assert(false);
|
||||
#endif
|
||||
}
|
||||
@@ -247,18 +246,12 @@ 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
|
||||
#if 0 || 0 || defined _WIN64 || \
|
||||
0 || defined __linux__
|
||||
#if defined(_WIN64) || defined(__linux__)
|
||||
SIZE_T destSize = (SIZE_T)(*pDestSize);
|
||||
int res = ::compress((Bytef*)pDestination, (uLongf*)&destSize,
|
||||
(Bytef*)pSource, SrcSize);
|
||||
*pDestSize = (unsigned int)destSize;
|
||||
return ((res == Z_OK) ? S_OK : -1);
|
||||
#elif 0
|
||||
std::uint32_t destSize = (std::uint32_t)(*pDestSize);
|
||||
bool res = EdgeZLib::Compress(pDestination, &destSize, pSource, SrcSize);
|
||||
*pDestSize = (unsigned int)destSize;
|
||||
return ((res) ? S_OK : -1);
|
||||
#else
|
||||
SIZE_T destSize = (SIZE_T)(*pDestSize);
|
||||
HRESULT res = XMemCompress(compressionContext, pDestination, &destSize,
|
||||
@@ -281,18 +274,12 @@ HRESULT Compression::Decompress(void* pDestination, unsigned int* pDestSize,
|
||||
|
||||
// Using zlib for x64 compression - 360 is using native 360 compression and
|
||||
// PS3 a stubbed non-compressing version of this
|
||||
#if 0 || 0 || defined _WIN64 || \
|
||||
0 || defined __linux__
|
||||
#if defined(_WIN64) || defined(__linux__)
|
||||
SIZE_T destSize = (SIZE_T)(*pDestSize);
|
||||
int res = ::uncompress((Bytef*)pDestination, (uLongf*)&destSize,
|
||||
(Bytef*)pSource, SrcSize);
|
||||
*pDestSize = (unsigned int)destSize;
|
||||
return ((res == Z_OK) ? S_OK : -1);
|
||||
#elif 0
|
||||
std::uint32_t destSize = (std::uint32_t)(*pDestSize);
|
||||
bool res = EdgeZLib::Decompress(pDestination, &destSize, pSource, SrcSize);
|
||||
*pDestSize = (unsigned int)destSize;
|
||||
return ((res) ? S_OK : -1);
|
||||
#else
|
||||
SIZE_T destSize = (SIZE_T)(*pDestSize);
|
||||
HRESULT res = XMemDecompress(decompressionContext, pDestination,
|
||||
@@ -304,7 +291,6 @@ HRESULT Compression::Decompress(void* pDestination, unsigned int* pDestSize,
|
||||
|
||||
// MGH - same as VirtualDecompress in PSVitaStubs, but for use on other
|
||||
// platforms (so no virtual mem stuff)
|
||||
#if 1
|
||||
void Compression::VitaVirtualDecompress(
|
||||
void* pDestination, unsigned int* pDestSize, void* pSource,
|
||||
unsigned int SrcSize) // (LPVOID buf, SIZE_T dwSize, LPVOID dst)
|
||||
@@ -334,7 +320,6 @@ void Compression::VitaVirtualDecompress(
|
||||
}
|
||||
*pDestSize = Offset;
|
||||
}
|
||||
#endif
|
||||
|
||||
HRESULT Compression::DecompressWithType(void* pDestination,
|
||||
unsigned int* pDestSize, void* pSource,
|
||||
@@ -347,7 +332,7 @@ HRESULT Compression::DecompressWithType(void* pDestination,
|
||||
*pDestSize = SrcSize;
|
||||
return S_OK;
|
||||
case eCompressionType_LZXRLE: {
|
||||
#if (0 || 0 || defined _WIN64)
|
||||
#if defined(_WIN64)
|
||||
SIZE_T destSize = (SIZE_T)(*pDestSize);
|
||||
HRESULT res = XMemDecompress(decompressionContext, pDestination,
|
||||
(SIZE_T*)&destSize, pSource, SrcSize);
|
||||
@@ -358,8 +343,7 @@ HRESULT Compression::DecompressWithType(void* pDestination,
|
||||
#endif
|
||||
} break;
|
||||
case eCompressionType_ZLIBRLE:
|
||||
#if (0 || 0 || 0 || \
|
||||
defined _WIN64 || defined __linux__)
|
||||
#if defined(_WIN64) || defined(__linux__)
|
||||
if (pDestination != NULL)
|
||||
return ::uncompress(
|
||||
(Bytef*)pDestination, (unsigned long*)pDestSize,
|
||||
@@ -371,8 +355,7 @@ HRESULT Compression::DecompressWithType(void* pDestination,
|
||||
break;
|
||||
#endif
|
||||
case eCompressionType_PS3ZLIB:
|
||||
#if (0 || 0 || 0 || \
|
||||
defined _WIN64)
|
||||
#if defined(_WIN64)
|
||||
// Note that we're missing the normal zlib header and footer so
|
||||
// we'll use inflate to decompress the payload and skip all the CRC
|
||||
// checking, etc
|
||||
@@ -441,7 +424,6 @@ HRESULT Compression::DecompressWithType(void* pDestination,
|
||||
Compression::Compression() {
|
||||
// Using zlib for x64 compression - 360 is using native 360 compression and
|
||||
// PS3 a stubbed non-compressing version of this
|
||||
#if !(0 || 0)
|
||||
// The default parameters for compression context allocated about 6.5MB,
|
||||
// reducing the partition size here from the default 512KB to 128KB brings
|
||||
// this down to about 3MB
|
||||
@@ -454,15 +436,8 @@ Compression::Compression() {
|
||||
&compressionContext);
|
||||
XMemCreateDecompressionContext(XMEMCODEC_LZX, ¶ms, 0,
|
||||
&decompressionContext);
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
m_localDecompressType = eCompressionType_LZXRLE;
|
||||
#elif 0
|
||||
m_localDecompressType = eCompressionType_PS3ZLIB;
|
||||
#else
|
||||
m_localDecompressType = eCompressionType_ZLIBRLE;
|
||||
#endif
|
||||
m_decompressType = m_localDecompressType;
|
||||
|
||||
InitializeCriticalSection(&rleCompressLock);
|
||||
@@ -470,11 +445,9 @@ Compression::Compression() {
|
||||
}
|
||||
|
||||
Compression::~Compression() {
|
||||
#if !(0 || 0 || 0)
|
||||
|
||||
XMemDestroyCompressionContext(compressionContext);
|
||||
XMemDestroyDecompressionContext(decompressionContext);
|
||||
#endif
|
||||
DeleteCriticalSection(&rleCompressLock);
|
||||
DeleteCriticalSection(&rleDecompressLock);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user