mirror of
https://github.com/yann64/haikuports.git
synced 2026-04-08 21:00:05 +02:00
abe: Save game to B_USER_SETTINGS_DIRECTORY + fix crash on startup
This commit is contained in:
@@ -38,7 +38,9 @@ BUILD_PREREQUIRES="
|
||||
cmd:automake
|
||||
cmd:autoconf
|
||||
"
|
||||
|
||||
|
||||
PATCHES="abe-1.1.patch"
|
||||
|
||||
PATCH()
|
||||
{
|
||||
sed -i 's/AM_CONFIG_HEADER/AC_CONFIG_HEADERS/g' configure.in
|
||||
|
||||
69
games-kids/abe/patches/abe-1.1.patch
Normal file
69
games-kids/abe/patches/abe-1.1.patch
Normal file
@@ -0,0 +1,69 @@
|
||||
diff --git a/src/Directories.c b/src/Directories.c
|
||||
index cca0472..f43d181 100644
|
||||
--- a/src/Directories.c
|
||||
+++ b/src/Directories.c
|
||||
@@ -7,7 +7,12 @@ getHomeUserAbe()
|
||||
{
|
||||
|
||||
static char path[PATH_SIZE];
|
||||
-#ifndef WIN32
|
||||
+#ifdef WIN32
|
||||
+ sprintf(path, xstr(BASE_DIR) PATH_SEP);
|
||||
+#elif __HAIKU__
|
||||
+ find_directory(B_USER_SETTINGS_DIRECTORY, -1, true, path, PATH_SIZE);
|
||||
+ strncat(path, "/abe/", PATH_SIZE);
|
||||
+#else
|
||||
struct passwd *pwent;
|
||||
|
||||
pwent = getpwuid(getuid());
|
||||
@@ -17,8 +22,6 @@ getHomeUserAbe()
|
||||
}
|
||||
|
||||
sprintf(path, "%s%s", pwent->pw_dir, PATH_SEP ".abe" PATH_SEP);
|
||||
-#else
|
||||
- sprintf(path, xstr(BASE_DIR) PATH_SEP);
|
||||
#endif
|
||||
|
||||
return path;
|
||||
diff --git a/src/Directories.h b/src/Directories.h
|
||||
index 3abe73e..45e8d12 100644
|
||||
--- a/src/Directories.h
|
||||
+++ b/src/Directories.h
|
||||
@@ -9,6 +9,10 @@
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
+#ifdef __HAIKU__
|
||||
+#include <FindDirectory.h>
|
||||
+#endif
|
||||
+
|
||||
// The macros xstr(s) and str(s) were extracted from
|
||||
// http://gcc.gnu.org/onlinedocs/cpp/Stringification.html
|
||||
// They are used to expand BASE_DIR .
|
||||
diff --git a/src/Main.c b/src/Main.c
|
||||
index 2520856..a158796 100644
|
||||
--- a/src/Main.c
|
||||
+++ b/src/Main.c
|
||||
@@ -90,12 +90,22 @@ main(int argc, char *argv[])
|
||||
int intro = 0;
|
||||
char *mapname;
|
||||
int mapwidth, mapheight;
|
||||
+ char *directory;
|
||||
+ char *sep;
|
||||
|
||||
mainstruct.drawBackground = 1;
|
||||
mainstruct.alphaBlend = 1;
|
||||
mainstruct.effects_enabled = 1;
|
||||
runmode = RUNMODE_SPLASH;
|
||||
mainstruct.full_screen = 1;
|
||||
+
|
||||
+ directory = strdup(argv[0]);
|
||||
+ sep = strrchr(directory, '/');
|
||||
+ if (sep != NULL) {
|
||||
+ *sep = '\0';
|
||||
+ chdir(directory);
|
||||
+ }
|
||||
+ free(directory);
|
||||
|
||||
// my laptop can't handle fullscreen for some reason
|
||||
#if defined(__APPLE__) || defined(__MACH_O__)
|
||||
Reference in New Issue
Block a user