From 7eaf128fac9de00394c664f59f40bebae8b122b2 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Tue, 4 Mar 2014 06:32:04 +0100 Subject: [PATCH] (PS3) We shouldn't compile in zlib code in a core period - compile out zlib parts with NO_ZLIB ifdef for PSP and PS3 --- Makefile | 2 +- Makefile.libretro | 4 ++++ pico/cart.c | 11 ++++++++++- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 633f0bc..f18d26e 100644 --- a/Makefile +++ b/Makefile @@ -157,8 +157,8 @@ ifneq "$(DONT_COMPILE_IN_ZLIB)" "1" OBJS += zlib/gzio.o zlib/inffast.o zlib/inflate.o zlib/inftrees.o zlib/trees.o \ zlib/deflate.o zlib/crc32.o zlib/adler32.o zlib/zutil.o zlib/compress.o zlib/uncompr.o # unzip -endif OBJS += unzip/unzip.o unzip/unzip_stream.o +endif include platform/common/common.mak diff --git a/Makefile.libretro b/Makefile.libretro index 128e5f3..4818219 100644 --- a/Makefile.libretro +++ b/Makefile.libretro @@ -193,6 +193,10 @@ else CFLAGS += -D__WIN32__ -D__WIN32_LIBRETRO__ endif +ifeq ($(DONT_COMPILE_IN_ZLIB),1) +CFLAGS += -DNO_ZLIB +endif + ifeq ($(NO_MMAP),1) CFLAGS += -DNO_MMAP endif diff --git a/pico/cart.c b/pico/cart.c index a5c563d..d237fad 100644 --- a/pico/cart.c +++ b/pico/cart.c @@ -100,6 +100,7 @@ pm_file *pm_open(const char *path) return NULL; ext = get_ext(path); +#ifndef NO_ZLIB if (strcasecmp(ext, "zip") == 0) { struct zipent *zipentry; @@ -149,7 +150,9 @@ zip_failed: return NULL; } } - else if (strcasecmp(ext, "cso") == 0) + else +#endif + if (strcasecmp(ext, "cso") == 0) { cso_struct *cso = NULL, *tmp = NULL; int size; @@ -244,6 +247,7 @@ size_t pm_read(void *ptr, size_t bytes, pm_file *stream) { ret = fread(ptr, 1, bytes, stream->file); } +#ifndef NO_ZLIB else if (stream->type == PMT_ZIP) { gzFile gf = stream->param; @@ -254,6 +258,7 @@ size_t pm_read(void *ptr, size_t bytes, pm_file *stream) /* we must reset stream pointer or else next seek/read fails */ gzrewind(gf); } +#endif else if (stream->type == PMT_CSO) { cso_struct *cso = stream->param; @@ -329,6 +334,7 @@ int pm_seek(pm_file *stream, long offset, int whence) fseek(stream->file, offset, whence); return ftell(stream->file); } +#ifndef NO_ZLIB else if (stream->type == PMT_ZIP) { if (PicoMessage != NULL && offset > 6*1024*1024) { @@ -338,6 +344,7 @@ int pm_seek(pm_file *stream, long offset, int whence) } return gzseek((gzFile) stream->param, offset, whence); } +#endif else if (stream->type == PMT_CSO) { cso_struct *cso = stream->param; @@ -363,6 +370,7 @@ int pm_close(pm_file *fp) { fclose(fp->file); } +#ifndef NO_ZLIB else if (fp->type == PMT_ZIP) { ZIP *zipfile = fp->file; @@ -370,6 +378,7 @@ int pm_close(pm_file *fp) zipfile->fp = NULL; // gzclose() closed it closezip(zipfile); } +#endif else if (fp->type == PMT_CSO) { free(fp->param); -- 2.39.2