Skip to content

Commit

Permalink
update libchdr for zstd support
Browse files Browse the repository at this point in the history
  • Loading branch information
notaz authored and irixxxx committed May 24, 2024
1 parent 3b480be commit 808b7f0
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 15 deletions.
18 changes: 14 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 4 additions & 0 deletions Makefile.libretro
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ else ifeq ($(platform), ctr)
CXX = $(DEVKITARM)/bin/arm-none-eabi-g++$(EXE_EXT)
AR = $(DEVKITARM)/bin/arm-none-eabi-ar$(EXE_EXT)
CFLAGS += -DARM11 -D_3DS
CFLAGS += -DZ7_DECL_Int32_AS_long
CFLAGS += -march=armv6k -mtune=mpcore -mfloat-abi=hard -marm -mfpu=vfp
CFLAGS += -Wall -mword-relocations
CFLAGS += -fomit-frame-pointer -ffast-math
Expand Down Expand Up @@ -269,6 +270,7 @@ else ifeq ($(platform), ngc)
CC = $(DEVKITPPC)/bin/powerpc-eabi-gcc$(EXE_EXT)
AR = $(DEVKITPPC)/bin/powerpc-eabi-ar$(EXE_EXT)
CFLAGS += -DGEKKO -DHW_DOL -mrvl -mcpu=750 -meabi -mhard-float
CFLAGS += -DZ7_DECL_Int32_AS_long
STATIC_LINKING = 1
STATIC_LINKING_LINK = 1

Expand All @@ -278,6 +280,7 @@ else ifeq ($(platform), wii)
CC = $(DEVKITPPC)/bin/powerpc-eabi-gcc$(EXE_EXT)
AR = $(DEVKITPPC)/bin/powerpc-eabi-ar$(EXE_EXT)
CFLAGS += -DGEKKO -DHW_RVL -mrvl -mcpu=750 -meabi -mhard-float -ffat-lto-objects
CFLAGS += -DZ7_DECL_Int32_AS_long
STATIC_LINKING = 1
STATIC_LINKING_LINK = 1

Expand All @@ -288,6 +291,7 @@ else ifeq ($(platform), wiiu)
CXX = $(DEVKITPPC)/bin/powerpc-eabi-g++$(EXE_EXT)
AR = $(DEVKITPPC)/bin/powerpc-eabi-ar$(EXE_EXT)
CFLAGS += -DGEKKO -DWIIU -DHW_RVL -DHW_WUP -mwup -mcpu=750 -meabi -mhard-float
CFLAGS += -DZ7_DECL_Int32_AS_long
STATIC_LINKING = 1
STATIC_LINKING_LINK = 1

Expand Down
44 changes: 34 additions & 10 deletions jni/Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand All @@ -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)\"
Expand Down
2 changes: 1 addition & 1 deletion pico/cd/libchdr
Submodule libchdr updated 1033 files

0 comments on commit 808b7f0

Please sign in to comment.