mirror of
https://github.com/Ponce/slackbuilds
synced 2024-11-21 19:42:24 +01:00
games/wolf4sdl: Fixed broken line endings in patches.
This commit is contained in:
parent
acc32ca66d
commit
9fae0e2dcc
5 changed files with 2 additions and 346 deletions
|
@ -1,312 +0,0 @@
|
|||
diff -Naur Wolf4SDL-1.7-src.orig//Makefile Wolf4SDL-1.7-src/Makefile
|
||||
--- Wolf4SDL-1.7-src.orig//Makefile 2008-02-18 01:54:38.000000000 -0500
|
||||
+++ Wolf4SDL-1.7-src/Makefile 2012-01-13 16:43:43.000000000 -0500
|
||||
@@ -17,6 +17,7 @@
|
||||
LDFLAGS_SDL ?= $(shell $(SDL_CONFIG) --libs)
|
||||
|
||||
|
||||
+CFLAGS += -DPREFIX='"$(PREFIX)"'
|
||||
CFLAGS += $(CFLAGS_SDL)
|
||||
|
||||
#CFLAGS += -Wall
|
||||
@@ -64,6 +65,7 @@
|
||||
SRCS += wl_play.cpp
|
||||
SRCS += wl_state.cpp
|
||||
SRCS += wl_text.cpp
|
||||
+SRCS += datafile.cpp
|
||||
|
||||
DEPS = $(filter %.d, $(SRCS:.c=.d) $(SRCS:.cpp=.d))
|
||||
OBJS = $(filter %.o, $(SRCS:.c=.o) $(SRCS:.cpp=.o))
|
||||
diff -Naur Wolf4SDL-1.7-src.orig//datafile.cpp Wolf4SDL-1.7-src/datafile.cpp
|
||||
--- Wolf4SDL-1.7-src.orig//datafile.cpp 1969-12-31 19:00:00.000000000 -0500
|
||||
+++ Wolf4SDL-1.7-src/datafile.cpp 2012-01-13 16:41:32.000000000 -0500
|
||||
@@ -0,0 +1,60 @@
|
||||
+
|
||||
+#include <stdlib.h>
|
||||
+#include <unistd.h>
|
||||
+#include <limits.h>
|
||||
+#include <stdio.h>
|
||||
+#include <sys/types.h>
|
||||
+#include <sys/stat.h>
|
||||
+#include <fcntl.h>
|
||||
+
|
||||
+#include "datafile.h"
|
||||
+
|
||||
+static char *datapath = NULL;
|
||||
+
|
||||
+static void set_data_path(void) {
|
||||
+ if(datapath) return;
|
||||
+ datapath = getenv("WOLF4PATH");
|
||||
+ if(datapath) return;
|
||||
+
|
||||
+ // 20120113 bkw: should this be "C:\\WOLF3D" on Windows?
|
||||
+ datapath = (char *)PREFIX "/share/games/wolf3d";
|
||||
+}
|
||||
+
|
||||
+int datafile_exists(const char *file) {
|
||||
+ char datafile[PATH_MAX];
|
||||
+ struct stat statbuf;
|
||||
+
|
||||
+ set_data_path();
|
||||
+
|
||||
+ if(stat(file, &statbuf))
|
||||
+ return 1;
|
||||
+
|
||||
+ sprintf(datafile, "%s/%s", datapath, file);
|
||||
+ return stat(datafile, &statbuf);
|
||||
+}
|
||||
+
|
||||
+int datafile_open(const char *file, int flags) {
|
||||
+ char datafile[PATH_MAX];
|
||||
+ int handle;
|
||||
+
|
||||
+ set_data_path();
|
||||
+
|
||||
+ if( (handle = open(file, flags)) > 0 )
|
||||
+ return handle;
|
||||
+
|
||||
+ sprintf(datafile, "%s/%s", datapath, file);
|
||||
+ return open(datafile, flags);
|
||||
+}
|
||||
+
|
||||
+FILE *datafile_fopen(const char *file, const char *mode) {
|
||||
+ char datafile[PATH_MAX];
|
||||
+ FILE *f;
|
||||
+
|
||||
+ set_data_path();
|
||||
+
|
||||
+ if( (f = fopen(file, mode)) )
|
||||
+ return f;
|
||||
+
|
||||
+ sprintf(datafile, "%s/%s", datapath, file);
|
||||
+ return fopen(datafile, mode);
|
||||
+}
|
||||
diff -Naur Wolf4SDL-1.7-src.orig//datafile.h Wolf4SDL-1.7-src/datafile.h
|
||||
--- Wolf4SDL-1.7-src.orig//datafile.h 1969-12-31 19:00:00.000000000 -0500
|
||||
+++ Wolf4SDL-1.7-src/datafile.h 2012-01-13 16:41:41.000000000 -0500
|
||||
@@ -0,0 +1,22 @@
|
||||
+
|
||||
+#include <stdio.h>
|
||||
+/*
|
||||
+20120113 bkw:
|
||||
+Functions for loading game data files.
|
||||
+
|
||||
+All these functions search for files in:
|
||||
+
|
||||
+- The current directory
|
||||
+- The directory specified by $WOLF4PATH if set
|
||||
+- If WOLF4PATH not set, fall back to PREFIX/share/games/wolf3d
|
||||
+
|
||||
+*/
|
||||
+
|
||||
+/* returns true if file exists in the data path, otherwise false */
|
||||
+int datafile_exists(const char *file);
|
||||
+
|
||||
+/* returns a filehandle to the file if found, or -1 if not */
|
||||
+int datafile_open(const char *file, int flags);
|
||||
+
|
||||
+/* returns a FILE* if found, or NULL if not */
|
||||
+FILE *datafile_fopen(const char *file, const char *mode);
|
||||
diff -Naur Wolf4SDL-1.7-src.orig//id_ca.cpp Wolf4SDL-1.7-src/id_ca.cpp
|
||||
--- Wolf4SDL-1.7-src.orig//id_ca.cpp 2009-02-24 15:13:22.000000000 -0500
|
||||
+++ Wolf4SDL-1.7-src/id_ca.cpp 2012-01-13 16:40:25.000000000 -0500
|
||||
@@ -24,6 +24,7 @@
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
+#include "datafile.h"
|
||||
#include "wl_def.h"
|
||||
#pragma hdrstop
|
||||
|
||||
@@ -185,7 +186,7 @@
|
||||
{
|
||||
int32_t size;
|
||||
|
||||
- const int handle = open(filename, O_RDONLY | O_BINARY);
|
||||
+ const int handle = datafile_open(filename, O_RDONLY | O_BINARY);
|
||||
if (handle == -1)
|
||||
return false;
|
||||
|
||||
@@ -463,7 +464,7 @@
|
||||
strcpy(fname,gdictname);
|
||||
strcat(fname,graphext);
|
||||
|
||||
- handle = open(fname, O_RDONLY | O_BINARY);
|
||||
+ handle = datafile_open(fname, O_RDONLY | O_BINARY);
|
||||
if (handle == -1)
|
||||
CA_CannotOpen(fname);
|
||||
|
||||
@@ -474,7 +475,7 @@
|
||||
strcpy(fname,gheadname);
|
||||
strcat(fname,graphext);
|
||||
|
||||
- handle = open(fname, O_RDONLY | O_BINARY);
|
||||
+ handle = datafile_open(fname, O_RDONLY | O_BINARY);
|
||||
if (handle == -1)
|
||||
CA_CannotOpen(fname);
|
||||
|
||||
@@ -513,7 +514,7 @@
|
||||
strcpy(fname,gfilename);
|
||||
strcat(fname,graphext);
|
||||
|
||||
- grhandle = open(fname, O_RDONLY | O_BINARY);
|
||||
+ grhandle = datafile_open(fname, O_RDONLY | O_BINARY);
|
||||
if (grhandle == -1)
|
||||
CA_CannotOpen(fname);
|
||||
|
||||
@@ -555,7 +556,7 @@
|
||||
strcpy(fname,mheadname);
|
||||
strcat(fname,extension);
|
||||
|
||||
- handle = open(fname, O_RDONLY | O_BINARY);
|
||||
+ handle = datafile_open(fname, O_RDONLY | O_BINARY);
|
||||
if (handle == -1)
|
||||
CA_CannotOpen(fname);
|
||||
|
||||
@@ -574,14 +575,14 @@
|
||||
strcpy(fname, "gamemaps.");
|
||||
strcat(fname, extension);
|
||||
|
||||
- maphandle = open(fname, O_RDONLY | O_BINARY);
|
||||
+ maphandle = datafile_open(fname, O_RDONLY | O_BINARY);
|
||||
if (maphandle == -1)
|
||||
CA_CannotOpen(fname);
|
||||
#else
|
||||
strcpy(fname,mfilename);
|
||||
strcat(fname,extension);
|
||||
|
||||
- maphandle = open(fname, O_RDONLY | O_BINARY);
|
||||
+ maphandle = datafile_open(fname, O_RDONLY | O_BINARY);
|
||||
if (maphandle == -1)
|
||||
CA_CannotOpen(fname);
|
||||
#endif
|
||||
@@ -646,7 +647,7 @@
|
||||
strcpy(fname,afilename);
|
||||
strcat(fname,audioext);
|
||||
|
||||
- audiohandle = open(fname, O_RDONLY | O_BINARY);
|
||||
+ audiohandle = datafile_open(fname, O_RDONLY | O_BINARY);
|
||||
if (audiohandle == -1)
|
||||
CA_CannotOpen(fname);
|
||||
}
|
||||
diff -Naur Wolf4SDL-1.7-src.orig//id_pm.cpp Wolf4SDL-1.7-src/id_pm.cpp
|
||||
--- Wolf4SDL-1.7-src.orig//id_pm.cpp 2008-05-25 04:40:50.000000000 -0400
|
||||
+++ Wolf4SDL-1.7-src/id_pm.cpp 2012-01-13 16:42:23.000000000 -0500
|
||||
@@ -1,3 +1,4 @@
|
||||
+#include "datafile.h"
|
||||
#include "wl_def.h"
|
||||
|
||||
int ChunksInFile;
|
||||
@@ -19,7 +20,7 @@
|
||||
char fname[13] = "vswap.";
|
||||
strcat(fname,extension);
|
||||
|
||||
- FILE *file = fopen(fname,"rb");
|
||||
+ FILE *file = datafile_fopen(fname,"rb");
|
||||
if(!file)
|
||||
CA_CannotOpen(fname);
|
||||
|
||||
diff -Naur Wolf4SDL-1.7-src.orig//wl_menu.cpp Wolf4SDL-1.7-src/wl_menu.cpp
|
||||
--- Wolf4SDL-1.7-src.orig//wl_menu.cpp 2010-11-01 13:17:58.000000000 -0400
|
||||
+++ Wolf4SDL-1.7-src/wl_menu.cpp 2012-01-13 16:55:02.000000000 -0500
|
||||
@@ -14,6 +14,7 @@
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
+#include "datafile.h"
|
||||
#include "wl_def.h"
|
||||
#pragma hdrstop
|
||||
|
||||
@@ -4029,12 +4030,12 @@
|
||||
//
|
||||
#ifdef JAPAN
|
||||
#ifdef JAPDEMO
|
||||
- if(!stat("vswap.wj1", &statbuf))
|
||||
+ if(datafile_exists("vswap.wj1"))
|
||||
{
|
||||
strcpy (extension, "wj1");
|
||||
numEpisodesMissing = 5;
|
||||
#else
|
||||
- if(!stat("vswap.wj6", &statbuf))
|
||||
+ if(datafile_exists("vswap.wj6"))
|
||||
{
|
||||
strcpy (extension, "wj6");
|
||||
#endif
|
||||
@@ -4052,7 +4053,7 @@
|
||||
// ENGLISH
|
||||
//
|
||||
#ifdef UPLOAD
|
||||
- if(!stat("vswap.wl1", &statbuf))
|
||||
+ if(datafile_exists("vswap.wl1"))
|
||||
{
|
||||
strcpy (extension, "wl1");
|
||||
numEpisodesMissing = 5;
|
||||
@@ -4061,7 +4062,7 @@
|
||||
Quit ("NO WOLFENSTEIN 3-D DATA FILES to be found!");
|
||||
#else
|
||||
#ifndef SPEAR
|
||||
- if(!stat("vswap.wl6", &statbuf))
|
||||
+ if(datafile_exists("vswap.wl6"))
|
||||
{
|
||||
strcpy (extension, "wl6");
|
||||
NewEmenu[2].active =
|
||||
@@ -4074,7 +4075,7 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
- if(!stat("vswap.wl3", &statbuf))
|
||||
+ if(datafile_exists("vswap.wl3"))
|
||||
{
|
||||
strcpy (extension, "wl3");
|
||||
numEpisodesMissing = 3;
|
||||
@@ -4082,7 +4083,7 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
- if(!stat("vswap.wl1", &statbuf))
|
||||
+ if(datafile_exists("vswap.wl1"))
|
||||
{
|
||||
strcpy (extension, "wl1");
|
||||
numEpisodesMissing = 5;
|
||||
@@ -4099,28 +4100,28 @@
|
||||
#ifndef SPEARDEMO
|
||||
if(param_mission == 0)
|
||||
{
|
||||
- if(!stat("vswap.sod", &statbuf))
|
||||
+ if(datafile_exists("vswap.sod"))
|
||||
strcpy (extension, "sod");
|
||||
else
|
||||
Quit ("NO SPEAR OF DESTINY DATA FILES TO BE FOUND!");
|
||||
}
|
||||
else if(param_mission == 1)
|
||||
{
|
||||
- if(!stat("vswap.sd1", &statbuf))
|
||||
+ if(datafile_exists("vswap.sd1"))
|
||||
strcpy (extension, "sd1");
|
||||
else
|
||||
Quit ("NO SPEAR OF DESTINY DATA FILES TO BE FOUND!");
|
||||
}
|
||||
else if(param_mission == 2)
|
||||
{
|
||||
- if(!stat("vswap.sd2", &statbuf))
|
||||
+ if(datafile_exists("vswap.sd2"))
|
||||
strcpy (extension, "sd2");
|
||||
else
|
||||
Quit ("NO SPEAR OF DESTINY DATA FILES TO BE FOUND!");
|
||||
}
|
||||
else if(param_mission == 3)
|
||||
{
|
||||
- if(!stat("vswap.sd3", &statbuf))
|
||||
+ if(datafile_exists("vswap.sd3"))
|
||||
strcpy (extension, "sd3");
|
||||
else
|
||||
Quit ("NO SPEAR OF DESTINY DATA FILES TO BE FOUND!");
|
||||
@@ -4130,7 +4131,7 @@
|
||||
strcpy (graphext, "sod");
|
||||
strcpy (audioext, "sod");
|
||||
#else
|
||||
- if(!stat("vswap.sdm", &statbuf))
|
||||
+ if(datafile_exists("vswap.sdm"))
|
||||
{
|
||||
strcpy (extension, "sdm");
|
||||
}
|
BIN
games/wolf4sdl/datadir.diff.gz
Normal file
BIN
games/wolf4sdl/datadir.diff.gz
Normal file
Binary file not shown.
|
@ -1,32 +0,0 @@
|
|||
diff -Naur Wolf4SDL-1.7-src/wl_main.cpp Wolf4SDL-1.7-src.patched/wl_main.cpp
|
||||
--- Wolf4SDL-1.7-src/wl_main.cpp 2011-05-15 23:11:34.000000000 -0400
|
||||
+++ Wolf4SDL-1.7-src.patched/wl_main.cpp 2014-09-05 12:06:24.000000000 -0400
|
||||
@@ -1678,6 +1678,10 @@
|
||||
bool hasError = false, showHelp = false;
|
||||
bool sampleRateGiven = false, audioBufferGiven = false;
|
||||
int defaultSampleRate = param_samplerate;
|
||||
+ char *exename = argv[0], *p;
|
||||
+
|
||||
+ for (p = argv[0]; *p; p++)
|
||||
+ if (*p == '/') exename = p + 1;
|
||||
|
||||
for(int i = 1; i < argc; i++)
|
||||
{
|
||||
@@ -1884,7 +1888,7 @@
|
||||
"Wolf4SDL v1.7 ($Revision: 256 $)\n"
|
||||
"Ported by Chaos-Software (http://www.chaos-software.de.vu)\n"
|
||||
"Original Wolfenstein 3D by id Software\n\n"
|
||||
- "Usage: Wolf4SDL [options]\n"
|
||||
+ "Usage: %s [options]\n"
|
||||
"Options:\n"
|
||||
" --help This help page\n"
|
||||
" --tedlevel <level> Starts the game in the given level\n"
|
||||
@@ -1923,7 +1927,7 @@
|
||||
" (default: 0 -> .sod, 1-3 -> .sd*)\n"
|
||||
" --goodtimes Disable copy protection quiz\n"
|
||||
#endif
|
||||
- , defaultSampleRate
|
||||
+ , exename, defaultSampleRate
|
||||
);
|
||||
exit(1);
|
||||
}
|
BIN
games/wolf4sdl/exename.diff.gz
Normal file
BIN
games/wolf4sdl/exename.diff.gz
Normal file
Binary file not shown.
|
@ -56,10 +56,10 @@ find -L . \
|
|||
-o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
|
||||
|
||||
# look for game data files in /usr/share/games/wolf3d
|
||||
patch -p1 < $CWD/datadir.diff
|
||||
zcat $CWD/datadir.diff.gz | patch -p1
|
||||
|
||||
# show correct executable name in usage message (instead of Wolf4SDL)
|
||||
patch -p1 < $CWD/exename.diff
|
||||
zcat $CWD/exename.diff.gz | patch -p1
|
||||
|
||||
# don't use 'make install', do it manually.
|
||||
mkdir -p $PKG/usr/games $PKG/usr/share/games/wolf3d
|
||||
|
|
Loading…
Reference in a new issue