summaryrefslogtreecommitdiff
path: root/games/openjazz/paths.diff
blob: e24b46988bc68a41d01c78f38667fc3227101fc0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
diff -Naur openjazz-20190106/src/io/file.cpp openjazz-20190106.patched/src/io/file.cpp
--- openjazz-20190106/src/io/file.cpp	2018-06-18 17:54:50.791926735 -0400
+++ openjazz-20190106.patched/src/io/file.cpp	2021-10-26 19:57:37.051448527 -0400
@@ -48,6 +48,16 @@
  * @param write Whether or not the file can be written to
  */
 File::File (const char* name, bool write) {
+#ifdef HOMEDIR
+  if(write) {
+     char *writepath = createString(getenv("HOME"), "/.openjazz/");
+     bool ok = open(writepath, name, write);
+     delete [] writepath;
+     if(ok) return;
+     log("Could not open file for writing in $HOME", name);
+     throw E_FILE;
+  }
+#endif
 
 	Path* path;
 
@@ -60,7 +70,7 @@
 
 	}
 
-	log("Could not open file", name);
+	log("Could not find file in path", name);
 
 	throw E_FILE;
 
@@ -74,9 +84,7 @@
 
 	fclose(file);
 
-#ifdef VERBOSE
 	log("Closed file", filePath);
-#endif
 
 	delete[] filePath;
 
diff -Naur openjazz-20190106/src/io/sound.cpp openjazz-20190106.patched/src/io/sound.cpp
--- openjazz-20190106/src/io/sound.cpp	2018-10-08 05:17:30.504617277 -0400
+++ openjazz-20190106.patched/src/io/sound.cpp	2021-10-26 19:58:53.975443489 -0400
@@ -27,6 +27,8 @@
  */
 
 
+#include <ctype.h>
+#include <string.h>
 #include "file.h"
 #include "sound.h"
 
@@ -280,7 +282,15 @@
 
 	} catch (int e) {
 
-		return;
+     char *upperName = strdup(fileName);
+     for(char *ch = upperName; *ch; ++ch)
+        *ch = toupper(*ch);
+     try {
+        file = new File(upperName, false);
+        free(upperName);
+     } catch(int e) {
+        return;
+     }
 
 	}
 
diff -Naur openjazz-20190106/src/main.cpp openjazz-20190106.patched/src/main.cpp
--- openjazz-20190106/src/main.cpp	2018-03-29 22:03:53.319965677 -0400
+++ openjazz-20190106.patched/src/main.cpp	2021-10-26 20:03:30.167425404 -0400
@@ -31,6 +31,7 @@
 
 #define EXTERN
 
+#include <sys/stat.h>
 #include "game/game.h"
 #include "io/controls.h"
 #include "io/file.h"
@@ -194,7 +195,9 @@
 	#ifdef _WIN32
 	firstPath = new Path(firstPath, createString(getenv("HOME"), "\\"));
 	#else
-	firstPath = new Path(firstPath, createString(getenv("HOME"), "/."));
+  char *homeSubDir = createString(getenv("HOME"), "/.openjazz/");
+  mkdir(homeSubDir, 0700); /* ignore errors */
+  firstPath = new Path(firstPath, homeSubDir);
 	#endif
 #endif
 
diff -Naur openjazz-20190106/src/menu/mainmenu.cpp openjazz-20190106.patched/src/menu/mainmenu.cpp
--- openjazz-20190106/src/menu/mainmenu.cpp	2019-01-06 07:14:31.696191429 -0500
+++ openjazz-20190106.patched/src/menu/mainmenu.cpp	2021-10-26 20:04:32.023421353 -0400
@@ -58,7 +58,11 @@
 
 	} catch (int e) {
 
-		throw e;
+     try {
+        file = new File("/usr/share/games/openjazz/openjazz.000", false);
+     } catch(int e) {
+        throw e;
+     }
 
 	}