mirror of
https://github.com/xenia-project/xenia.git
synced 2025-12-06 07:12:03 +01:00
[3PP] Switch to zlib-ng
This commit is contained in:
parent
4b9509391a
commit
f36dbd2b33
7
.gitmodules
vendored
7
.gitmodules
vendored
|
|
@ -98,9 +98,10 @@
|
|||
[submodule "third_party/rapidcsv"]
|
||||
path = third_party/rapidcsv
|
||||
url = https://github.com/d99kris/rapidcsv.git
|
||||
[submodule "third_party/zlib"]
|
||||
path = third_party/zlib
|
||||
url = https://github.com/madler/zlib.git
|
||||
[submodule "third_party/zlib-ng"]
|
||||
path = third_party/zlib-ng
|
||||
url = https://github.com/zlib-ng/zlib-ng.git
|
||||
ignore = dirty
|
||||
[submodule "third_party/pugixml"]
|
||||
path = third_party/pugixml
|
||||
url = https://github.com/zeux/pugixml.git
|
||||
|
|
|
|||
|
|
@ -300,7 +300,7 @@ workspace("xenia")
|
|||
include("third_party/xxhash.lua")
|
||||
include("third_party/zarchive.lua")
|
||||
include("third_party/zstd.lua")
|
||||
include("third_party/zlib.lua")
|
||||
include("third_party/zlib-ng.lua")
|
||||
include("third_party/pugixml.lua")
|
||||
|
||||
if os.istarget("windows") then
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ project("xenia-kernel")
|
|||
links({
|
||||
"aes_128",
|
||||
"fmt",
|
||||
"zlib",
|
||||
"zlib-ng",
|
||||
"pugixml",
|
||||
"xenia-apu",
|
||||
"xenia-base",
|
||||
|
|
@ -18,7 +18,22 @@ project("xenia-kernel")
|
|||
"xenia-vfs",
|
||||
})
|
||||
defines({
|
||||
"X86_FEATURES",
|
||||
"X86_HAVE_XSAVE_INTRIN",
|
||||
"X86_SSSE3",
|
||||
"X86_SSE42",
|
||||
"WITH_GZFILEOP",
|
||||
})
|
||||
if os.istarget("windows") then
|
||||
defines({
|
||||
"X86_SSE2",
|
||||
"X86_AVX2",
|
||||
"X86_AVX512",
|
||||
"X86_AVX512VNNI",
|
||||
"X86_PCLMULQDQ_CRC",
|
||||
"X86_VPCLMULQDQ_CRC",
|
||||
})
|
||||
end
|
||||
recursive_platform_files()
|
||||
files({
|
||||
"debug_visualizers.natvis",
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
*/
|
||||
|
||||
#include "xenia/kernel/util/xlast.h"
|
||||
#include "third_party/zlib/zlib.h"
|
||||
#include "third_party/zlib-ng/zlib-ng.h"
|
||||
#include "xenia/base/filesystem.h"
|
||||
#include "xenia/base/logging.h"
|
||||
#include "xenia/base/string_util.h"
|
||||
|
|
@ -50,14 +50,14 @@ XLast::XLast(const uint8_t* compressed_xml_data,
|
|||
parsed_xlast_ = std::make_unique<pugi::xml_document>();
|
||||
xlast_decompressed_xml_.resize(decompressed_data_size);
|
||||
|
||||
z_stream stream;
|
||||
zng_stream stream;
|
||||
stream.zalloc = Z_NULL;
|
||||
stream.zfree = Z_NULL;
|
||||
stream.opaque = Z_NULL;
|
||||
stream.avail_in = 0;
|
||||
stream.next_in = Z_NULL;
|
||||
|
||||
int ret = inflateInit2(
|
||||
int ret = zng_inflateInit2(
|
||||
&stream, 16 + MAX_WBITS); // 16 + MAX_WBITS enables gzip decoding
|
||||
if (ret != Z_OK) {
|
||||
XELOGE("XLast: Error during Zlib stream init");
|
||||
|
|
@ -70,13 +70,13 @@ XLast::XLast(const uint8_t* compressed_xml_data,
|
|||
stream.avail_out = decompressed_data_size;
|
||||
stream.next_out = reinterpret_cast<Bytef*>(xlast_decompressed_xml_.data());
|
||||
|
||||
ret = inflate(&stream, Z_NO_FLUSH);
|
||||
ret = zng_inflate(&stream, Z_NO_FLUSH);
|
||||
if (ret == Z_STREAM_ERROR) {
|
||||
XELOGE("XLast: Error during XLast decompression");
|
||||
inflateEnd(&stream);
|
||||
zng_inflateEnd(&stream);
|
||||
return;
|
||||
}
|
||||
inflateEnd(&stream);
|
||||
zng_inflateEnd(&stream);
|
||||
|
||||
parse_result_ = parsed_xlast_->load_buffer(xlast_decompressed_xml_.data(),
|
||||
xlast_decompressed_xml_.size());
|
||||
|
|
|
|||
1
third_party/zlib
vendored
1
third_party/zlib
vendored
|
|
@ -1 +0,0 @@
|
|||
Subproject commit 51b7f2abdade71cd9bb0e7a373ef2610ec6f9daf
|
||||
1
third_party/zlib-ng
vendored
Submodule
1
third_party/zlib-ng
vendored
Submodule
|
|
@ -0,0 +1 @@
|
|||
Subproject commit 860e4cff7917d93f54f5d7f0bc1d0e8b1a3cb988
|
||||
63
third_party/zlib-ng.lua
vendored
Normal file
63
third_party/zlib-ng.lua
vendored
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
group("third_party")
|
||||
project("zlib-ng")
|
||||
uuid("13d4073d-f1c9-47e3-a057-79b133596fc2")
|
||||
kind("StaticLib")
|
||||
language("C")
|
||||
|
||||
defines({
|
||||
"X86_FEATURES",
|
||||
"X86_HAVE_XSAVE_INTRIN",
|
||||
"X86_SSSE3",
|
||||
"X86_SSE42",
|
||||
"WITH_GZFILEOP",
|
||||
})
|
||||
if os.istarget("windows") then
|
||||
defines({
|
||||
"X86_SSE2",
|
||||
"X86_AVX2",
|
||||
"X86_AVX512",
|
||||
"X86_AVX512VNNI",
|
||||
"X86_PCLMULQDQ_CRC",
|
||||
"X86_VPCLMULQDQ_CRC",
|
||||
})
|
||||
end
|
||||
|
||||
files({
|
||||
"zlib-ng/*.c",
|
||||
"zlib-ng/arch/x86/*.c",
|
||||
"zlib-ng/arch/generic/*.c",
|
||||
})
|
||||
if not os.istarget("windows") then
|
||||
removefiles({
|
||||
"zlib-ng/arch/x86/adler32_avx2.c",
|
||||
"zlib-ng/arch/x86/adler32_avx512.c",
|
||||
"zlib-ng/arch/x86/adler32_avx512_vnni.c",
|
||||
"zlib-ng/arch/x86/chunkset_avx2.c",
|
||||
"zlib-ng/arch/x86/compare256_avx2.c",
|
||||
"zlib-ng/arch/x86/crc32_pclmulqdq.c",
|
||||
"zlib-ng/arch/x86/crc32_vpclmulqdq.c",
|
||||
"zlib-ng/arch/x86/slide_hash_avx2.c",
|
||||
})
|
||||
end
|
||||
|
||||
includedirs({
|
||||
"zlib-ng",
|
||||
})
|
||||
|
||||
local zlibng_dir = path.getabsolute("zlib-ng")
|
||||
local zlibng_h_src_files = {
|
||||
path.join(zlibng_build_dir, "zlib-ng.h"),
|
||||
path.join(zlibng_build_dir, "zconf-ng.h"),
|
||||
path.join(zlibng_build_dir, "zlib_name_mangling-ng.h"),
|
||||
path.join(zlibng_build_dir, "gzread.c"),
|
||||
}
|
||||
for i = 1,#zlibng_h_src_files,1
|
||||
do
|
||||
if not os.isfile(path.join(zlibng_dir, zlibng_h_src_files[i])) then
|
||||
zlibng_build = true
|
||||
break
|
||||
end
|
||||
end
|
||||
if zlibng_build then
|
||||
os.execute("cmake -DZLIB_ENABLE_TESTS=OFF -DWITH_GTEST=OFF "..zlibng_dir.." -B"..zlibng_dir)
|
||||
end
|
||||
16
third_party/zlib.lua
vendored
16
third_party/zlib.lua
vendored
|
|
@ -1,16 +0,0 @@
|
|||
group("third_party")
|
||||
project("zlib")
|
||||
uuid("13d4073d-f1c9-47e3-a057-79b133596fc2")
|
||||
kind("StaticLib")
|
||||
language("C")
|
||||
cdialect("C90")
|
||||
filter({"toolset:gcc or clang"})
|
||||
buildoptions({
|
||||
"-Wno-implicit-function-declaration"
|
||||
})
|
||||
filter {}
|
||||
|
||||
files({
|
||||
"zlib/*.c",
|
||||
"zlib/*.h",
|
||||
})
|
||||
Loading…
Reference in a new issue