switch to using compat

This commit is contained in:
Jettford 2024-12-11 15:39:57 +00:00
parent 4133008d9c
commit ba2c692565
3 changed files with 8 additions and 25 deletions

View File

@ -47,6 +47,7 @@ elseif (WIN32)
set(WITH_GTEST OFF CACHE BOOL "" FORCE) set(WITH_GTEST OFF CACHE BOOL "" FORCE)
set(ZLIB_ENABLE_TESTS OFF CACHE BOOL "" FORCE) set(ZLIB_ENABLE_TESTS OFF CACHE BOOL "" FORCE)
set(ZLIB_COMPAT ON CACHE BOOL "Enable ZLIB compatibility mode" FORCE)
# TODO Keep an eye on the zlib repository for an update to disable testing. Don't forget to update CMakePresets # TODO Keep an eye on the zlib repository for an update to disable testing. Don't forget to update CMakePresets
FetchContent_Declare( FetchContent_Declare(

View File

@ -1,24 +1,6 @@
#include "ZCompression.h" #include "ZCompression.h"
#ifdef DARKFLAME_PLATFORM_WIN32
#include "zlib-ng.h"
// Yes, I know there is a "zlib compat mode", it doesn't work, it's really fucking dumb
#define z_stream zng_stream
#define z_deflateInit zng_deflateInit
#define z_deflate zng_deflate
#define z_deflateEnd zng_deflateEnd
#define z_inflateInit zng_inflateInit
#define z_inflate zng_inflate
#define z_inflateEnd zng_inflateEnd
#else
#include "zlib.h" #include "zlib.h"
#endif
namespace ZCompression { namespace ZCompression {
int32_t GetMaxCompressedLength(int32_t nLenSrc) { int32_t GetMaxCompressedLength(int32_t nLenSrc) {
@ -35,14 +17,14 @@ namespace ZCompression {
zInfo.next_out = abDst; zInfo.next_out = abDst;
int nErr, nRet = -1; int nErr, nRet = -1;
nErr = z_deflateInit(&zInfo, Z_DEFAULT_COMPRESSION); // zlib function nErr = deflateInit(&zInfo, Z_DEFAULT_COMPRESSION); // zlib function
if (nErr == Z_OK) { if (nErr == Z_OK) {
nErr = z_deflate(&zInfo, Z_FINISH); // zlib function nErr = deflate(&zInfo, Z_FINISH); // zlib function
if (nErr == Z_STREAM_END) { if (nErr == Z_STREAM_END) {
nRet = zInfo.total_out; nRet = zInfo.total_out;
} }
} }
z_deflateEnd(&zInfo); // zlib function deflateEnd(&zInfo); // zlib function
return(nRet); return(nRet);
} }
@ -55,14 +37,14 @@ namespace ZCompression {
zInfo.next_out = abDst; zInfo.next_out = abDst;
int nRet = -1; int nRet = -1;
nErr = z_inflateInit(&zInfo); // zlib function nErr = inflateInit(&zInfo); // zlib function
if (nErr == Z_OK) { if (nErr == Z_OK) {
nErr = z_inflate(&zInfo, Z_FINISH); // zlib function nErr = inflate(&zInfo, Z_FINISH); // zlib function
if (nErr == Z_STREAM_END) { if (nErr == Z_STREAM_END) {
nRet = zInfo.total_out; nRet = zInfo.total_out;
} }
} }
z_inflateEnd(&zInfo); // zlib function inflateEnd(&zInfo); // zlib function
return(nRet); return(nRet);
} }
} }

View File

@ -8,7 +8,7 @@ class AMFArrayValue;
/** /**
* @brief Sent when a player moves a Behavior A at position B to their inventory. * @brief Sent when a player moves a Behavior A at position B to their inventory.
*/ */
#pragma message("This Control Behavior Message does not have a test yet. Non-developers can ignore this warning.") #pragma message("MoveToInventory.h This Control Behavior Message does not have a test yet. Non-developers can ignore this warning.")
class MoveToInventoryMessage : public BehaviorMessageBase { class MoveToInventoryMessage : public BehaviorMessageBase {
public: public:
MoveToInventoryMessage(const AMFArrayValue& arguments); MoveToInventoryMessage(const AMFArrayValue& arguments);