summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2017-06-11 18:41:56 -0300
committerGitHub <noreply@github.com>2017-06-11 18:41:56 -0300
commit12b2652ecbe4acfe1a0391b162629cb2a86c1a0b (patch)
tree75d6a21525b8e75fe56b099465f62e2c77772831 /modules
parent61c82f4356624c175378fd7a3640b37348f66359 (diff)
parentf177c1534757973063f244450df063def879d7db (diff)
Merge pull request #9104 from tagcup/zstd
Add zstd compression support.
Diffstat (limited to 'modules')
-rw-r--r--modules/enet/networked_multiplayer_enet.cpp11
-rw-r--r--modules/enet/networked_multiplayer_enet.h3
2 files changed, 12 insertions, 2 deletions
diff --git a/modules/enet/networked_multiplayer_enet.cpp b/modules/enet/networked_multiplayer_enet.cpp
index c05c86d9ae..738bd27ed3 100644
--- a/modules/enet/networked_multiplayer_enet.cpp
+++ b/modules/enet/networked_multiplayer_enet.cpp
@@ -575,6 +575,9 @@ size_t NetworkedMultiplayerENet::enet_compress(void *context, const ENetBuffer *
case COMPRESS_ZLIB: {
mode = Compression::MODE_DEFLATE;
} break;
+ case COMPRESS_ZSTD: {
+ mode = Compression::MODE_ZSTD;
+ } break;
default: { ERR_FAIL_V(0); }
}
@@ -608,6 +611,10 @@ size_t NetworkedMultiplayerENet::enet_decompress(void *context, const enet_uint8
ret = Compression::decompress(outData, outLimit, inData, inLimit, Compression::MODE_DEFLATE);
} break;
+ case COMPRESS_ZSTD: {
+
+ ret = Compression::decompress(outData, outLimit, inData, inLimit, Compression::MODE_ZSTD);
+ } break;
default: {}
}
if (ret < 0) {
@@ -629,7 +636,8 @@ void NetworkedMultiplayerENet::_setup_compressor() {
enet_host_compress_with_range_coder(host);
} break;
case COMPRESS_FASTLZ:
- case COMPRESS_ZLIB: {
+ case COMPRESS_ZLIB:
+ case COMPRESS_ZSTD: {
enet_host_compress(host, &enet_compressor);
} break;
@@ -654,6 +662,7 @@ void NetworkedMultiplayerENet::_bind_methods() {
BIND_CONSTANT(COMPRESS_RANGE_CODER);
BIND_CONSTANT(COMPRESS_FASTLZ);
BIND_CONSTANT(COMPRESS_ZLIB);
+ BIND_CONSTANT(COMPRESS_ZSTD);
}
NetworkedMultiplayerENet::NetworkedMultiplayerENet() {
diff --git a/modules/enet/networked_multiplayer_enet.h b/modules/enet/networked_multiplayer_enet.h
index c20c1af68e..8b971adf55 100644
--- a/modules/enet/networked_multiplayer_enet.h
+++ b/modules/enet/networked_multiplayer_enet.h
@@ -43,7 +43,8 @@ public:
COMPRESS_NONE,
COMPRESS_RANGE_CODER,
COMPRESS_FASTLZ,
- COMPRESS_ZLIB
+ COMPRESS_ZLIB,
+ COMPRESS_ZSTD
};
private: