mirror of
https://github.com/yann64/haikuports.git
synced 2026-03-19 01:46:00 +01:00
xrick, fix launch from Tracker/Deskbar (#8907)
This commit is contained in:
@@ -1,44 +1,4 @@
|
||||
From b20e8f7b787c0ced7d635c24926bdb04572edfb6 Mon Sep 17 00:00:00 2001
|
||||
From: Adrien Destugues <pulkomandy@pulkomandy.tk>
|
||||
Date: Sun, 12 Jan 2014 21:32:19 +0100
|
||||
Subject: Look for the datafile next to the executable.
|
||||
|
||||
XRick can be run from Deskbar or Tracker this way.
|
||||
|
||||
diff --git a/src/xrick.c b/src/xrick.c
|
||||
index 38d4e26..4bde442 100644
|
||||
--- a/src/xrick.c
|
||||
+++ b/src/xrick.c
|
||||
@@ -14,6 +14,8 @@
|
||||
#include "system.h"
|
||||
#include "game.h"
|
||||
|
||||
+#include <libgen.h>
|
||||
+
|
||||
#include <SDL.h>
|
||||
|
||||
/*
|
||||
@@ -25,8 +27,13 @@ main(int argc, char *argv[])
|
||||
sys_init(argc, argv);
|
||||
if (sysarg_args_data)
|
||||
data_setpath(sysarg_args_data);
|
||||
- else
|
||||
- data_setpath("data.zip");
|
||||
+ else {
|
||||
+ const char* basename = dirname(argv[0]);
|
||||
+ char* datapath = malloc(strlen(basename) + strlen("/data.zip") + 1);
|
||||
+ strcpy(datapath, basename);
|
||||
+ strcat(datapath, "/data.zip");
|
||||
+ data_setpath(datapath);
|
||||
+ }
|
||||
game_run();
|
||||
data_closepath();
|
||||
sys_shutdown();
|
||||
--
|
||||
2.37.3
|
||||
|
||||
|
||||
From 8d9d18d6a0ce84cfa5810bf5f82ae5189163d0fe Mon Sep 17 00:00:00 2001
|
||||
From 0084dd6c8a0bcf12507f33d935206768ac6e62f5 Mon Sep 17 00:00:00 2001
|
||||
From: Humdinger <humdingerb@gmail.com>
|
||||
Date: Mon, 26 May 2014 19:18:37 +0200
|
||||
Subject: Disable quitting with ESC, just end the currently running game.
|
||||
@@ -101,14 +61,14 @@ index 2394760..adde88f 100644
|
||||
2.37.3
|
||||
|
||||
|
||||
From d65a82cd85ded96b9713dfbbf4ee89b24c464c02 Mon Sep 17 00:00:00 2001
|
||||
From d479502d2af7485aedf7e5d8741d466de45cd124 Mon Sep 17 00:00:00 2001
|
||||
From: Begasus <begasus@gmail.com>
|
||||
Date: Thu, 29 Jun 2023 13:01:09 +0000
|
||||
Subject: Makefile patches
|
||||
|
||||
|
||||
diff --git a/Makefile b/Makefile
|
||||
index d87bc0e..eddc21c 100644
|
||||
index d87bc0e..1096f7c 100644
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -71,10 +71,8 @@ endif
|
||||
@@ -145,7 +105,7 @@ index fb1c7eb..147f143 100644
|
||||
2.37.3
|
||||
|
||||
|
||||
From f4bdf8a5eea4db4a2890eb59050f4ee12530e99d Mon Sep 17 00:00:00 2001
|
||||
From 1ca0e09d617b41524d232e0a445b0b6ec1c428d9 Mon Sep 17 00:00:00 2001
|
||||
From: Begasus <begasus@gmail.com>
|
||||
Date: Thu, 29 Jun 2023 13:08:02 +0000
|
||||
Subject: Fix multiple defenitions
|
||||
@@ -192,3 +152,40 @@ index d28705d..42343c4 100644
|
||||
--
|
||||
2.37.3
|
||||
|
||||
|
||||
From fd553076ea4472827d7b12ec5b0b7b2f60aa418f Mon Sep 17 00:00:00 2001
|
||||
From: Begasus <begasus@gmail.com>
|
||||
Date: Fri, 30 Jun 2023 08:27:50 +0000
|
||||
Subject: Fix launch from Tracker/Deskbar
|
||||
|
||||
|
||||
diff --git a/src/xrick.c b/src/xrick.c
|
||||
index 4bde442..d704677 100644
|
||||
--- a/src/xrick.c
|
||||
+++ b/src/xrick.c
|
||||
@@ -18,12 +18,22 @@
|
||||
|
||||
#include <SDL.h>
|
||||
|
||||
+#ifdef __HAIKU__
|
||||
+#include <libgen.h>
|
||||
+#include <unistd.h>
|
||||
+#endif
|
||||
+
|
||||
/*
|
||||
* main
|
||||
*/
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
+ char *binpath = realpath(argv[0], NULL);
|
||||
+ if (binpath != NULL) {
|
||||
+ chdir(dirname(binpath));
|
||||
+ free(binpath);
|
||||
+ }
|
||||
sys_init(argc, argv);
|
||||
if (sysarg_args_data)
|
||||
data_setpath(sysarg_args_data);
|
||||
--
|
||||
2.37.3
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ and theSchwarzendumpf castle."
|
||||
HOMEPAGE="http://www.bigorno.net/xrick"
|
||||
COPYRIGHT="2000-2006 Bigorno.net"
|
||||
LICENSE="xrick"
|
||||
REVISION="4"
|
||||
REVISION="5"
|
||||
SOURCE_URI="http://www.bigorno.net/xrick/xrick-021212.tgz"
|
||||
CHECKSUM_SHA256="aa8542120bec97a730258027a294bd16196eb8b3d66134483d085f698588fc2b"
|
||||
PATCHES="xrick-$portVersion.patchset"
|
||||
|
||||
Reference in New Issue
Block a user