update libchdr for zstd support
authornotaz <notasas@gmail.com>
Mon, 20 May 2024 22:09:40 +0000 (01:09 +0300)
committerkub <derkub@gmail.com>
Fri, 24 May 2024 16:25:20 +0000 (16:25 +0000)
Makefile
jni/Android.mk
pico/cd/libchdr

index 2566e74..99c3391 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -328,16 +328,26 @@ CHDR_OBJS += $(CHDR)/src/libchdr_chd.o $(CHDR)/src/libchdr_cdrom.o
 CHDR_OBJS += $(CHDR)/src/libchdr_flac.o
 CHDR_OBJS += $(CHDR)/src/libchdr_bitstream.o $(CHDR)/src/libchdr_huffman.o
 
-# lzma - use 19.00 as newer versions have compile problems with libretro platforms
-LZMA = $(CHDR)/deps/lzma-19.00
+LZMA = $(CHDR)/deps/lzma-24.05
 LZMA_OBJS += $(LZMA)/src/CpuArch.o $(LZMA)/src/Alloc.o $(LZMA)/src/LzmaEnc.o
 LZMA_OBJS += $(LZMA)/src/Sort.o $(LZMA)/src/LzmaDec.o $(LZMA)/src/LzFind.o
 LZMA_OBJS += $(LZMA)/src/Delta.o
-$(LZMA_OBJS): CFLAGS += -D_7ZIP_ST
+$(LZMA_OBJS): CFLAGS += -DZ7_ST -Wno-unused
+
+ZSTD = $(CHDR)/deps/zstd-1.5.6/lib
+ZSTD_OBJS += $(ZSTD)/common/entropy_common.o $(ZSTD)/common/error_private.o
+ZSTD_OBJS += $(ZSTD)/common/fse_decompress.o $(ZSTD)/common/xxhash.o
+ZSTD_OBJS += $(ZSTD)/common/zstd_common.o
+ZSTD_OBJS += $(ZSTD)/decompress/huf_decompress.o
+ZSTD_OBJS += $(ZSTD)/decompress/huf_decompress_amd64.o
+ZSTD_OBJS += $(ZSTD)/decompress/zstd_ddict.o
+ZSTD_OBJS += $(ZSTD)/decompress/zstd_decompress_block.o
+ZSTD_OBJS += $(ZSTD)/decompress/zstd_decompress.o
+$(ZSTD_OBJS) $(CHDR_OBJS): CFLAGS += -I$(ZSTD) -Wno-unused
 
 OBJS += $(CHDR_OBJS)
 ifneq ($(STATIC_LINKING), 1)
-OBJS += $(LZMA_OBJS)
+OBJS += $(LZMA_OBJS) $(ZSTD_OBJS)
 endif
 # ouf... prepend includes to overload headers available in the toolchain
 CFLAGS := -I$(LZMA)/include -I$(CHDR)/include $(CFLAGS)
index b4d0143..43680aa 100644 (file)
@@ -53,6 +53,10 @@ endif
 
 include $(COMMON_DIR)/common.mak
 
+LCHDR = $(CORE_DIR)/pico/cd/libchdr
+LCHDR_LZMA = $(LCHDR)/deps/lzma-24.05
+LCHDR_ZSTD = $(LCHDR)/deps/zstd-1.5.6/lib
+
 SOURCES_C := $(LIBRETRO_DIR)/libretro.c \
              $(LIBRETRO_COMM_DIR)/formats/png/rpng.c \
              $(LIBRETRO_COMM_DIR)/streams/trans_stream.c \
@@ -70,16 +74,36 @@ SOURCES_C := $(LIBRETRO_DIR)/libretro.c \
              $(COMMON_DIR)/mp3_sync.c \
              $(COMMON_DIR)/mp3_dummy.c \
              $(UNZIP_DIR)/unzip.c \
-             $(CORE_DIR)/pico/cd/libchdr/src/libchdr_bitstream.c \
-             $(CORE_DIR)/pico/cd/libchdr/src/libchdr_cdrom.c \
-             $(CORE_DIR)/pico/cd/libchdr/src/libchdr_chd.c \
-             $(CORE_DIR)/pico/cd/libchdr/src/libchdr_flac.c \
-             $(CORE_DIR)/pico/cd/libchdr/src/libchdr_huffman.c \
-             $(CORE_DIR)/pico/cd/libchdr/deps/lzma-19.00/src/LzFind.c \
-             $(CORE_DIR)/pico/cd/libchdr/deps/lzma-19.00/src/LzmaDec.c \
-             $(CORE_DIR)/pico/cd/libchdr/deps/lzma-19.00/src/LzmaEnc.c
-
-COREFLAGS := $(addprefix -D,$(DEFINES)) -fno-strict-aliasing -DUSE_LIBCHDR=1 -D_7ZIP_ST -I$(CORE_DIR)/pico/cd/libchdr/include -I$(CORE_DIR)/pico/cd/libchdr/deps/lzma-19.00/include
+             $(LCHDR)/src/libchdr_bitstream.c \
+             $(LCHDR)/src/libchdr_cdrom.c \
+             $(LCHDR)/src/libchdr_chd.c \
+             $(LCHDR)/src/libchdr_flac.c \
+             $(LCHDR)/src/libchdr_huffman.c \
+             $(LCHDR_LZMA)/src/Alloc.c \
+             $(LCHDR_LZMA)/src/CpuArch.c \
+             $(LCHDR_LZMA)/src/Delta.c \
+             $(LCHDR_LZMA)/src/LzFind.c \
+             $(LCHDR_LZMA)/src/LzmaDec.c \
+             $(LCHDR_LZMA)/src/LzmaEnc.c \
+             $(LCHDR_LZMA)/src/Sort.c \
+             $(LCHDR_ZSTD)/common/entropy_common.c \
+             $(LCHDR_ZSTD)/common/error_private.c \
+             $(LCHDR_ZSTD)/common/fse_decompress.c \
+             $(LCHDR_ZSTD)/common/xxhash.c \
+             $(LCHDR_ZSTD)/common/zstd_common.c \
+             $(LCHDR_ZSTD)/decompress/huf_decompress.c \
+             $(LCHDR_ZSTD)/decompress/zstd_ddict.c \
+             $(LCHDR_ZSTD)/decompress/zstd_decompress_block.c \
+             $(LCHDR_ZSTD)/decompress/zstd_decompress.c
+
+COREFLAGS := $(addprefix -D,$(DEFINES)) -fno-strict-aliasing -DUSE_LIBCHDR=1 -DZ7_ST -DZSTD_DISABLE_ASM
+COREFLAGS += -I$(LCHDR)/include -I$(LCHDR_LZMA)/include -I$(LCHDR_ZSTD)
+ifeq (,$(call gte,$(APP_PLATFORM_LEVEL),18))
+ifneq ($(TARGET_ARCH_ABI),arm64-v8a)
+# HACK
+COREFLAGS += -Dgetauxval=0*
+endif
+endif
 
 GIT_REVISION := $(shell git rev-parse --short HEAD || echo unknown)
 COREFLAGS += -DREVISION=\"$(GIT_REVISION)\"
index 4ad57f9..0b5a86f 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 4ad57f9e71ea35a8e62be20a059463bfe3abf043
+Subproject commit 0b5a86fe0c8b64497d7c6cbc23db72fd6fb1b982