summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'games-fps/cube/files/cube-20021020-add-custom-paths.patch')
-rw-r--r--games-fps/cube/files/cube-20021020-add-custom-paths.patch43
1 files changed, 43 insertions, 0 deletions
diff --git a/games-fps/cube/files/cube-20021020-add-custom-paths.patch b/games-fps/cube/files/cube-20021020-add-custom-paths.patch
new file mode 100644
index 000000000000..594a0714e5fb
--- /dev/null
+++ b/games-fps/cube/files/cube-20021020-add-custom-paths.patch
@@ -0,0 +1,43 @@
+--- tools.cpp.orig 2002-12-17 09:35:55.000000000 -0500
++++ tools.cpp 2002-12-17 09:39:28.000000000 -0500
+@@ -100,8 +100,19 @@
+
+ ///////////////////////// misc tools ///////////////////////
+
++char *addfullpath(char *s) {
++ static char ret[256]; // choose a reasonable max buffer size
++ if (s[0] == '/') { return s; }
++ int slen = strlen(s);
++ memset(ret, 0x00, 256);
++ memcpy(ret, GAMES_DATADIR, GAMES_DATADIR_LEN);
++ memcpy(ret+GAMES_DATADIR_LEN, s, slen);
++ return ret;
++}
++
+ char *path(char *s)
+ {
++ s = addfullpath(s);
+ for(char *t = s; t = strpbrk(t, "/\\"); *t++ = PATHDIV);
+ return s;
+ };
+--- rendergl.cpp.orig 2002-12-17 09:48:00.000000000 -0500
++++ rendergl.cpp 2002-12-17 09:50:19.000000000 -0500
+@@ -59,6 +59,7 @@
+
+ bool installtex(int tnum, char *texname, int &xs, int &ys, bool clamp)
+ {
++ texname = addfullpath(texname);
+ SDL_Surface *s = IMG_Load(texname);
+ if(!s) { conoutf("couldn't load texture %s", (int)texname); return false; };
+ if(s->format->BitsPerPixel!=24) { conoutf("texture must be 24bpp: %s", (int)texname); return false; };
+--- tools.h.orig 2002-12-17 09:51:06.000000000 -0500
++++ tools.h 2002-12-17 09:50:59.000000000 -0500
+@@ -96,7 +96,7 @@
+ #endif
+
+
+-
++extern char *addfullpath(char *s);
+ extern char *path(char *s);
+ extern char *loadfile(char *fn, int *size);
+ extern void endianswap(void *, int, int);