mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2024-11-26 06:20:48 +00:00
Remove ZIP compile time option.
Having ZIP optional only complicates things and is unnecessary now that the dependency to zlib is gone.
This commit is contained in:
parent
0264c6d946
commit
daf3dc6f41
5 changed files with 20 additions and 95 deletions
|
@ -36,7 +36,6 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 -Wall -fno-strict-aliasing -fwrap
|
|||
string(REPLACE "-O3" "-O2" CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}")
|
||||
|
||||
# yquake2 compilation options
|
||||
option(ZIP_SUPPORT "ZIP support" ON)
|
||||
option(OPENAL_SUPPORT "OpenAL support" ON)
|
||||
option(SYSTEMWIDE_SUPPORT "Enable systemwide installation of game assets" OFF)
|
||||
|
||||
|
@ -75,6 +74,13 @@ if(${SYSTEMWIDE_SUPPORT})
|
|||
add_definitions(-DSYSTEMWIDE)
|
||||
endif()
|
||||
|
||||
# We need to pass some options to minizip / unzip
|
||||
add_definitions(-DNOUNCRYPT)
|
||||
|
||||
if(NOT CMAKE_SYSTEM_NAME MATCHES "Linux" OR NOT CMAKE_SYSTEM_NAME MATCHES "Windows")
|
||||
add_definitions(-DIOAPI_NO_64)
|
||||
endif()
|
||||
|
||||
# Required libraries to build the different components of the binaries. Find
|
||||
# them and add the include/linker directories and flags (in case the package
|
||||
# manager find it in a weird place)
|
||||
|
@ -93,14 +99,6 @@ if(${CMAKE_HOST_SYSTEM_NAME} STREQUAL "FreeBSD")
|
|||
list(APPEND yquake2ServerLinkerFlags ${EXECINFO_LIBRARIES})
|
||||
endif()
|
||||
|
||||
if(${ZIP_SUPPORT})
|
||||
add_definitions(-DZIP -DNOUNCRYPT)
|
||||
|
||||
if(NOT CMAKE_SYSTEM_NAME MATCHES "Linux" OR NOT CMAKE_SYSTEM_NAME MATCHES "Windows")
|
||||
add_definitions(-DIOAPI_NO_64)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(${OPENAL_SUPPORT})
|
||||
find_package(OpenAL)
|
||||
|
||||
|
|
32
Makefile
32
Makefile
|
@ -37,10 +37,6 @@ WITH_OPENAL:=yes
|
|||
# is ignored, OpenAL is always loaded at runtime.
|
||||
DLOPEN_OPENAL:=yes
|
||||
|
||||
# Enables opening of ZIP files (also known as .pk3 paks).
|
||||
# Adds a dependency to libz
|
||||
WITH_ZIP:=yes
|
||||
|
||||
# Enable systemwide installation of game assets
|
||||
WITH_SYSTEMWIDE:=no
|
||||
|
||||
|
@ -206,6 +202,9 @@ ZIPCFLAGS += -DIOAPI_NO_64
|
|||
endif
|
||||
endif
|
||||
|
||||
# We don't support encrypted ZIP files.
|
||||
ZIPCFLAGS += -DNOUNCRYPT
|
||||
|
||||
# ----------
|
||||
|
||||
# Extra CFLAGS for SDL
|
||||
|
@ -289,7 +288,6 @@ config:
|
|||
@echo "Build configuration"
|
||||
@echo "============================"
|
||||
@echo "WITH_OPENAL = $(WITH_OPENAL)"
|
||||
@echo "WITH_ZIP = $(WITH_ZIP)"
|
||||
@echo "WITH_SYSTEMWIDE = $(WITH_SYSTEMWIDE)"
|
||||
@echo "WITH_SYSTEMDIR = $(WITH_SYSTEMDIR)"
|
||||
@echo "============================"
|
||||
|
@ -331,16 +329,12 @@ client:
|
|||
build/client/%.o: %.c
|
||||
@echo "===> CC $<"
|
||||
${Q}mkdir -p $(@D)
|
||||
${Q}$(CC) -c $(CFLAGS) $(SDLCFLAGS) $(INCLUDE) -o $@ $<
|
||||
${Q}$(CC) -c $(CFLAGS) $(SDLCFLAGS) $(ZIPCFLAGS) $(INCLUDE) -o $@ $<
|
||||
|
||||
ifeq ($(WITH_OPENAL),yes)
|
||||
release/yquake2.exe : CFLAGS += -DUSE_OPENAL -DDEFAULT_OPENAL_DRIVER='"openal32.dll"' -DDLOPEN_OPENAL
|
||||
endif
|
||||
|
||||
ifeq ($(WITH_ZIP),yes)
|
||||
release/yquake2.exe : CFLAGS += -DZIP -DNOUNCRYPT
|
||||
endif
|
||||
|
||||
release/yquake2.exe : LDFLAGS += -mwindows
|
||||
|
||||
else # not Windows
|
||||
|
@ -353,7 +347,7 @@ client:
|
|||
build/client/%.o: %.c
|
||||
@echo "===> CC $<"
|
||||
${Q}mkdir -p $(@D)
|
||||
${Q}$(CC) -c $(CFLAGS) $(SDLCFLAGS) $(INCLUDE) -o $@ $<
|
||||
${Q}$(CC) -c $(CFLAGS) $(SDLCFLAGS) $(ZIPCFLAGS) $(INCLUDE) -o $@ $<
|
||||
|
||||
ifeq ($(YQ2_OSTYPE), Darwin)
|
||||
build/client/%.o : %.m
|
||||
|
@ -384,10 +378,6 @@ endif # Darwin
|
|||
endif # !DLOPEN_OPENAL
|
||||
endif # WITH_OPENAL
|
||||
|
||||
ifeq ($(WITH_ZIP),yes)
|
||||
release/quake2 : CFLAGS += $(ZIPCFLAGS) -DZIP -DNOUNCRYPT
|
||||
endif
|
||||
|
||||
ifeq ($(YQ2_OSTYPE), FreeBSD)
|
||||
release/quake2 : LDFLAGS += -Wl,-z,origin,-rpath='$$ORIGIN/lib' -lexecinfo
|
||||
else ifeq ($(YQ2_OSTYPE), Linux)
|
||||
|
@ -423,14 +413,12 @@ server:
|
|||
build/server/%.o: %.c
|
||||
@echo "===> CC $<"
|
||||
${Q}mkdir -p $(@D)
|
||||
${Q}$(CC) -c $(CFLAGS) $(INCLUDE) -o $@ $<
|
||||
${Q}$(CC) -c $(CFLAGS) $(ZIPCFLAGS) $(INCLUDE) -o $@ $<
|
||||
|
||||
release/q2ded.exe : CFLAGS += -DDEDICATED_ONLY
|
||||
|
||||
ifeq ($(WITH_ZIP),yes)
|
||||
release/q2ded.exe : CFLAGS += -DZIP -DNOUNCRYPT
|
||||
endif
|
||||
else # not Windows
|
||||
|
||||
server:
|
||||
@echo "===> Building q2ded"
|
||||
${Q}mkdir -p release
|
||||
|
@ -439,14 +427,10 @@ server:
|
|||
build/server/%.o: %.c
|
||||
@echo "===> CC $<"
|
||||
${Q}mkdir -p $(@D)
|
||||
${Q}$(CC) -c $(CFLAGS) $(INCLUDE) -o $@ $<
|
||||
${Q}$(CC) -c $(CFLAGS) $(ZIPCFLAGS) $(INCLUDE) -o $@ $<
|
||||
|
||||
release/q2ded : CFLAGS += -DDEDICATED_ONLY -Wno-unused-result
|
||||
|
||||
ifeq ($(WITH_ZIP),yes)
|
||||
release/q2ded : CFLAGS += $(ZIPCFLAGS) -DZIP -DNOUNCRYPT
|
||||
endif
|
||||
|
||||
ifeq ($(YQ2_OSTYPE), FreeBSD)
|
||||
release/q2ded : LDFLAGS += -lexecinfo
|
||||
endif
|
||||
|
|
|
@ -35,10 +35,6 @@
|
|||
// Screenshots
|
||||
// -----------
|
||||
|
||||
#ifdef ZIP
|
||||
// If we build with zip support, zlib is available and
|
||||
// we can use that for better PNG compression.
|
||||
|
||||
#include "../../common/unzip/miniz.h"
|
||||
|
||||
static unsigned char*
|
||||
|
@ -64,8 +60,6 @@ compress_for_stbiw(unsigned char *data, int data_len, int *out_len, int quality)
|
|||
}
|
||||
|
||||
#define STBIW_ZLIB_COMPRESS compress_for_stbiw
|
||||
#endif
|
||||
|
||||
#define STB_IMAGE_WRITE_IMPLEMENTATION
|
||||
#include "header/stb_image_write.h"
|
||||
|
||||
|
|
|
@ -27,12 +27,10 @@
|
|||
|
||||
#include "header/common.h"
|
||||
#include "header/glob.h"
|
||||
#include "unzip/unzip.h"
|
||||
|
||||
#include "../client/sound/header/vorbis.h"
|
||||
|
||||
#ifdef ZIP
|
||||
#include "unzip/unzip.h"
|
||||
#endif
|
||||
|
||||
#define MAX_HANDLES 512
|
||||
#define MAX_PAKS 100
|
||||
|
@ -48,9 +46,7 @@ typedef struct
|
|||
char name[MAX_QPATH];
|
||||
fsMode_t mode;
|
||||
FILE *file; /* Only one will be used. */
|
||||
#ifdef ZIP
|
||||
unzFile *zip; /* (file or zip) */
|
||||
#endif
|
||||
} fsHandle_t;
|
||||
|
||||
typedef struct fsLink_s
|
||||
|
@ -73,9 +69,7 @@ typedef struct
|
|||
char name[MAX_OSPATH];
|
||||
int numFiles;
|
||||
FILE *pak;
|
||||
#ifdef ZIP
|
||||
unzFile *pk3;
|
||||
#endif
|
||||
fsPackFile_t *files;
|
||||
} fsPack_t;
|
||||
|
||||
|
@ -89,9 +83,7 @@ typedef struct fsSearchPath_s
|
|||
typedef enum
|
||||
{
|
||||
PAK,
|
||||
#ifdef ZIP
|
||||
PK3
|
||||
#endif
|
||||
} fsPackFormat_t;
|
||||
|
||||
typedef struct
|
||||
|
@ -108,11 +100,9 @@ fsSearchPath_t *fs_baseSearchPaths;
|
|||
/* Pack formats / suffixes. */
|
||||
fsPackTypes_t fs_packtypes[] = {
|
||||
{"pak", PAK},
|
||||
#ifdef ZIP
|
||||
{"pk2", PK3},
|
||||
{"pk3", PK3},
|
||||
{"zip", PK3}
|
||||
#endif
|
||||
};
|
||||
|
||||
char datadir[MAX_OSPATH];
|
||||
|
@ -140,7 +130,6 @@ fsRawPath_t *fs_rawPath;
|
|||
|
||||
// --------
|
||||
|
||||
#ifdef ZIP
|
||||
#if _WIN32
|
||||
/*
|
||||
* We need some trickery to make minizip Unicode compatible...
|
||||
|
@ -179,7 +168,6 @@ static voidpf ZCALLBACK fopen_file_func_utf(voidpf opaque, const char *filename,
|
|||
return file;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// --------
|
||||
|
||||
|
@ -316,11 +304,7 @@ FS_HandleForFile(const char *path, fileHandle_t *f)
|
|||
|
||||
for (i = 0; i < MAX_HANDLES; i++, handle++)
|
||||
{
|
||||
if ((handle->file == NULL)
|
||||
#ifdef ZIP
|
||||
&& (handle->zip == NULL)
|
||||
#endif
|
||||
)
|
||||
if ((handle->file == NULL) && (handle->zip == NULL))
|
||||
{
|
||||
Q_strlcpy(handle->name, path, sizeof(handle->name));
|
||||
*f = i + 1;
|
||||
|
@ -367,13 +351,11 @@ FS_FCloseFile(fileHandle_t f)
|
|||
{
|
||||
fclose(handle->file);
|
||||
}
|
||||
#ifdef ZIP
|
||||
else if (handle->zip)
|
||||
{
|
||||
unzCloseCurrentFile(handle->zip);
|
||||
unzClose(handle->zip);
|
||||
}
|
||||
#endif
|
||||
|
||||
memset(handle, 0, sizeof(*handle));
|
||||
}
|
||||
|
@ -443,7 +425,6 @@ FS_FOpenFile(const char *name, fileHandle_t *f, qboolean gamedir_only)
|
|||
return pack->files[i].size;
|
||||
}
|
||||
}
|
||||
#ifdef ZIP
|
||||
else if (pack->pk3)
|
||||
{
|
||||
/* PK3 */
|
||||
|
@ -468,7 +449,6 @@ FS_FOpenFile(const char *name, fileHandle_t *f, qboolean gamedir_only)
|
|||
unzClose(handle->zip);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
Com_Error(ERR_FATAL, "Couldn't reopen '%s'", pack->name);
|
||||
}
|
||||
|
@ -539,12 +519,10 @@ FS_Read(void *buffer, int size, fileHandle_t f)
|
|||
{
|
||||
r = fread(buf, 1, remaining, handle->file);
|
||||
}
|
||||
#ifdef ZIP
|
||||
else if (handle->zip)
|
||||
{
|
||||
r = unzReadCurrentFile(handle->zip, buf, remaining);
|
||||
}
|
||||
#endif
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
|
@ -607,12 +585,10 @@ FS_FRead(void *buffer, int size, int count, fileHandle_t f)
|
|||
{
|
||||
r = fread(buf, 1, remaining, handle->file);
|
||||
}
|
||||
#ifdef ZIP
|
||||
else if (handle->zip)
|
||||
{
|
||||
r = unzReadCurrentFile(handle->zip, buf, remaining);
|
||||
}
|
||||
#endif
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
|
@ -759,9 +735,7 @@ FS_LoadPAK(const char *packPath)
|
|||
pack = Z_Malloc(sizeof(fsPack_t));
|
||||
Q_strlcpy(pack->name, packPath, sizeof(pack->name));
|
||||
pack->pak = handle;
|
||||
#ifdef ZIP
|
||||
pack->pk3 = NULL;
|
||||
#endif
|
||||
pack->numFiles = numFiles;
|
||||
pack->files = files;
|
||||
|
||||
|
@ -770,7 +744,6 @@ FS_LoadPAK(const char *packPath)
|
|||
return pack;
|
||||
}
|
||||
|
||||
#ifdef ZIP
|
||||
/*
|
||||
* Takes an explicit (not game tree related) path to a pack file.
|
||||
*
|
||||
|
@ -844,7 +817,6 @@ FS_LoadPK3(const char *packPath)
|
|||
|
||||
return pack;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Allows enumerating all of the directories in the search path.
|
||||
|
@ -909,11 +881,7 @@ FS_Path_f(void)
|
|||
|
||||
for (i = 0, handle = fs_handles; i < MAX_HANDLES; i++, handle++)
|
||||
{
|
||||
if ((handle->file != NULL)
|
||||
#ifdef ZIP
|
||||
|| (handle->zip != NULL)
|
||||
#endif
|
||||
)
|
||||
if ((handle->file != NULL) || (handle->zip != NULL))
|
||||
{
|
||||
Com_Printf("Handle %i: '%s'.\n", i + 1, handle->name);
|
||||
}
|
||||
|
@ -925,11 +893,8 @@ FS_Path_f(void)
|
|||
}
|
||||
|
||||
Com_Printf("----------------------\n");
|
||||
#ifdef ZIP
|
||||
|
||||
Com_Printf("%i files in PAK/PK2/PK3/ZIP files.\n", totalFiles);
|
||||
#else
|
||||
Com_Printf("%i files in PAK/PK2 files.\n", totalFiles);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1371,11 +1336,9 @@ FS_AddDirToSearchPath(char *dir, qboolean create) {
|
|||
case PAK:
|
||||
pack = FS_LoadPAK(path);
|
||||
break;
|
||||
#ifdef ZIP
|
||||
case PK3:
|
||||
pack = FS_LoadPK3(path);
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
||||
if (pack == NULL)
|
||||
|
@ -1417,11 +1380,9 @@ FS_AddDirToSearchPath(char *dir, qboolean create) {
|
|||
case PAK:
|
||||
pack = FS_LoadPAK(list[j]);
|
||||
break;
|
||||
#ifdef ZIP
|
||||
case PK3:
|
||||
pack = FS_LoadPK3(list[j]);
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
||||
if (pack == NULL)
|
||||
|
@ -1505,12 +1466,10 @@ FS_BuildGameSpecificSearchPath(char *dir)
|
|||
fclose(fs_searchPaths->pack->pak);
|
||||
}
|
||||
|
||||
#ifdef ZIP
|
||||
if (fs_searchPaths->pack->pk3)
|
||||
{
|
||||
unzClose(fs_searchPaths->pack->pk3);
|
||||
}
|
||||
#endif
|
||||
|
||||
Z_Free(fs_searchPaths->pack->files);
|
||||
Z_Free(fs_searchPaths->pack);
|
||||
|
@ -1524,12 +1483,7 @@ FS_BuildGameSpecificSearchPath(char *dir)
|
|||
/* Close open files for game dir. */
|
||||
for (i = 0; i < MAX_HANDLES; i++)
|
||||
{
|
||||
if (strstr(fs_handles[i].name, dir) &&
|
||||
((fs_handles[i].file != NULL)
|
||||
#ifdef ZIP
|
||||
|| (fs_handles[i].zip != NULL)
|
||||
#endif
|
||||
))
|
||||
if (strstr(fs_handles[i].name, dir) && ((fs_handles[i].file != NULL) || (fs_handles[i].zip != NULL)))
|
||||
{
|
||||
FS_FCloseFile(i);
|
||||
}
|
||||
|
|
|
@ -107,11 +107,6 @@ Qcommon_Buildstring(void)
|
|||
#else
|
||||
printf(" - OpenAL audio\n");
|
||||
#endif
|
||||
#ifdef ZIP
|
||||
printf(" + Zip file support\n");
|
||||
#else
|
||||
printf(" - Zip file support\n");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
printf("Platform: %s\n", YQ2OSTYPE);
|
||||
|
|
Loading…
Reference in a new issue