mirror of
https://github.com/yann64/haikuports.git
synced 2026-04-22 19:50:05 +02:00
LTris: Save config/themes/highscores to the user settings directory
This commit is contained in:
@@ -11,8 +11,7 @@ LICENSE="GNU GPL v2"
|
||||
COPYRIGHT="2002-2011 Michael Speck"
|
||||
ARCHITECTURES="x86_gcc2 ?x86 ?x86_64"
|
||||
|
||||
PATCHES="ltris-1.0.19.patch"
|
||||
GLOBAL_WRITABLE_FILES="var/ltris.hscr keep-old"
|
||||
PATCHES="ltris-1.0.19.patchset"
|
||||
|
||||
PROVIDES="
|
||||
ltris = $portVersion
|
||||
@@ -50,5 +49,11 @@ BUILD()
|
||||
INSTALL()
|
||||
{
|
||||
make install
|
||||
|
||||
# Clean up some unnecessary things from the package
|
||||
rm $localStateDir/ltris.hscr
|
||||
rm -rf $dataDir/applications
|
||||
rm -rf $dataDir/icons
|
||||
|
||||
addAppDeskbarSymlink $binDir/ltris LTris
|
||||
}
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
--- /dev/null 2014-09-03 18:56:15.136019000 +0200
|
||||
+++ ltris-1.0.19/LTris.rdef 2014-09-03 17:14:27.000000000 +0200
|
||||
@@ -0,0 +1,37 @@
|
||||
+resource app_signature "application/x-vnd-ltris";
|
||||
+
|
||||
+resource app_flags B_SINGLE_LAUNCH;
|
||||
+
|
||||
+resource app_version {
|
||||
+ major = 1,
|
||||
+ middle = 0,
|
||||
+ minor = 19,
|
||||
+
|
||||
+ /* 0 = development 1 = alpha 2 = beta
|
||||
+ 3 = gamma 4 = golden master 5 = final */
|
||||
+ variety = 5,
|
||||
+
|
||||
+ internal = 0,
|
||||
+
|
||||
+ short_info = "LTris is a tetris clone.",
|
||||
+ long_info = "LTris is a tetris clone: differently shaped blocks are falling down the rectangular playing field."
|
||||
+};
|
||||
+
|
||||
+resource vector_icon {
|
||||
+ $"6E6369660A05000200060239BCD5357062B86B6C3CA1364826E049473700C0BE"
|
||||
+ $"33FF6A6925020006023C15033A71ACB873493A166346BF9949CB5C00FFFC1BFF"
|
||||
+ $"CDCB16020006023A39972E8567AFC35B3B523345A11E4863C900CECC1BFF9E9D"
|
||||
+ $"150392901702001602399F0E3686A9B98DF63C8C42488EEB4924C900C2FF5A02"
|
||||
+ $"0016023C15033A71ACB873493A166347FF994A15AE00FAFFD7020016023C9D60"
|
||||
+ $"377C1EB78C243CA9674705BF48FA9100DAFFB30578040174060A04223E224A2D"
|
||||
+ $"4F2D420A042D422D4F334B333F0A04223E2D42333F283B0A1C224A223E233D22"
|
||||
+ $"3C222F282D2E2F2E2735243F283F2A41294B2D4B394A3B4B3C5740574C51504B"
|
||||
+ $"4E4B5545593A543A483B473344334B2D4F0A072D513A4F455B5159575A605337"
|
||||
+ $"420A04463F533E35332E351B0A090104000A0001031001178403040A01010100"
|
||||
+ $"0A020100000A040102000A05010120382A0A06010020382A0A08010220382A0A"
|
||||
+ $"0101012020120A0201002020120A0301022020120A010101202C170A02010020"
|
||||
+ $"2C170A040102202C170A05010120381C0A06010020381C0A08010220381C0A05"
|
||||
+ $"01012044210A0601002044210A0701022044210A090105000A010101202C090A"
|
||||
+ $"020100202C090A030102202C090A05010120380E0A06010020380E0A07010220"
|
||||
+ $"380E"
|
||||
+};
|
||||
187
games-puzzle/ltris/patches/ltris-1.0.19.patchset
Normal file
187
games-puzzle/ltris/patches/ltris-1.0.19.patchset
Normal file
@@ -0,0 +1,187 @@
|
||||
From 3afd9f9500c8cc0a9cc7d8f09128e4c44b5c2538 Mon Sep 17 00:00:00 2001
|
||||
From: Markus Himmel <markus@himmel-villmar.de>
|
||||
Date: Mon, 12 Jan 2015 20:53:30 +0000
|
||||
Subject: [PATCH 1/2] Original resource definition file
|
||||
|
||||
---
|
||||
LTris.rdef | 37 +++++++++++++++++++++++++++++++++++++
|
||||
1 file changed, 37 insertions(+)
|
||||
create mode 100644 LTris.rdef
|
||||
|
||||
diff --git a/LTris.rdef b/LTris.rdef
|
||||
new file mode 100644
|
||||
index 0000000..b1cea42
|
||||
--- /dev/null
|
||||
+++ b/LTris.rdef
|
||||
@@ -0,0 +1,37 @@
|
||||
+resource app_signature "application/x-vnd.lgames.ltris";
|
||||
+
|
||||
+resource app_flags B_SINGLE_LAUNCH;
|
||||
+
|
||||
+resource app_version {
|
||||
+ major = 1,
|
||||
+ middle = 0,
|
||||
+ minor = 19,
|
||||
+
|
||||
+ /* 0 = development 1 = alpha 2 = beta
|
||||
+ 3 = gamma 4 = golden master 5 = final */
|
||||
+ variety = 5,
|
||||
+
|
||||
+ internal = 0,
|
||||
+
|
||||
+ short_info = "LTris is a tetris clone.",
|
||||
+ long_info = "LTris is a tetris clone: differently shaped blocks are falling down the rectangular playing field."
|
||||
+};
|
||||
+
|
||||
+resource vector_icon {
|
||||
+ $"6E6369660A05000200060239BCD5357062B86B6C3CA1364826E049473700C0BE"
|
||||
+ $"33FF6A6925020006023C15033A71ACB873493A166346BF9949CB5C00FFFC1BFF"
|
||||
+ $"CDCB16020006023A39972E8567AFC35B3B523345A11E4863C900CECC1BFF9E9D"
|
||||
+ $"150392901702001602399F0E3686A9B98DF63C8C42488EEB4924C900C2FF5A02"
|
||||
+ $"0016023C15033A71ACB873493A166347FF994A15AE00FAFFD7020016023C9D60"
|
||||
+ $"377C1EB78C243CA9674705BF48FA9100DAFFB30578040174060A04223E224A2D"
|
||||
+ $"4F2D420A042D422D4F334B333F0A04223E2D42333F283B0A1C224A223E233D22"
|
||||
+ $"3C222F282D2E2F2E2735243F283F2A41294B2D4B394A3B4B3C5740574C51504B"
|
||||
+ $"4E4B5545593A543A483B473344334B2D4F0A072D513A4F455B5159575A605337"
|
||||
+ $"420A04463F533E35332E351B0A090104000A0001031001178403040A01010100"
|
||||
+ $"0A020100000A040102000A05010120382A0A06010020382A0A08010220382A0A"
|
||||
+ $"0101012020120A0201002020120A0301022020120A010101202C170A02010020"
|
||||
+ $"2C170A040102202C170A05010120381C0A06010020381C0A08010220381C0A05"
|
||||
+ $"01012044210A0601002044210A0701022044210A090105000A010101202C090A"
|
||||
+ $"020100202C090A030102202C090A05010120380E0A06010020380E0A07010220"
|
||||
+ $"380E"
|
||||
+};
|
||||
--
|
||||
1.8.3.4
|
||||
|
||||
|
||||
From c735a348244339d0e12c90a027e20cce1de18370 Mon Sep 17 00:00:00 2001
|
||||
From: Markus Himmel <markus@himmel-villmar.de>
|
||||
Date: Mon, 12 Jan 2015 22:16:46 +0000
|
||||
Subject: [PATCH 2/2] Move settings and highscores to B_USER_SETTINGS_DIRECTORY
|
||||
|
||||
---
|
||||
src/chart.c | 4 ++++
|
||||
src/config.c | 18 +++++++++++++++++-
|
||||
src/config.h | 4 ++++
|
||||
src/manager.c | 20 ++++++++++++++++++++
|
||||
4 files changed, 45 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/chart.c b/src/chart.c
|
||||
index 87d8e03..8cee31d 100644
|
||||
--- a/src/chart.c
|
||||
+++ b/src/chart.c
|
||||
@@ -189,15 +189,19 @@ void chart_load()
|
||||
if ( charts ) list_delete( charts ); charts = 0;
|
||||
charts = list_create( LIST_AUTO_DELETE, chart_set_delete );
|
||||
/* load highscore */
|
||||
+#ifndef __HAIKU__
|
||||
if ( !chart_load_from_path( HI_DIR ) ) {
|
||||
fprintf( stderr, "Unable to access highscore chart in '%s'.\n", HI_DIR );
|
||||
fprintf( stderr, "Trying to use config directory '%s'.\n", config.dir_name );
|
||||
+#endif
|
||||
if ( !chart_load_from_path( config.dir_name ) ) {
|
||||
fprintf( stderr, "Unable to access highscore chart in config directory... won't be "
|
||||
"able to save any results. Sorry.\n" );
|
||||
return;
|
||||
}
|
||||
+#ifndef __HAIKU__
|
||||
}
|
||||
+#endif
|
||||
printf( "Saving highscore chart in: %s\n", chart_path );
|
||||
/* load resources */
|
||||
cfont = load_fixed_font( "f_small_yellow.bmp", 32, 96, 8 );
|
||||
diff --git a/src/config.c b/src/config.c
|
||||
index 00f7e9c..c4d6ea0 100644
|
||||
--- a/src/config.c
|
||||
+++ b/src/config.c
|
||||
@@ -23,6 +23,11 @@
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
+#ifdef __HAIKU__
|
||||
+#include <FindDirectory.h>
|
||||
+#include <fs_info.h>
|
||||
+#endif
|
||||
+
|
||||
#include "sdl.h"
|
||||
#include "config.h"
|
||||
#include "parser.h"
|
||||
@@ -40,7 +45,18 @@ void config_check_dir()
|
||||
{
|
||||
#ifdef DISABLE_INSTALL
|
||||
sprintf( config.dir_name, "." );
|
||||
-#else
|
||||
+#elif __HAIKU__
|
||||
+ dev_t volume = dev_for_path("/boot");
|
||||
+ if ( find_directory(B_USER_SETTINGS_DIRECTORY, volume, false,
|
||||
+ config.dir_name, sizeof(config.dir_name)-1 ) == B_OK &&
|
||||
+ strlen(config.dir_name) + strlen(CONFIG_DIR_NAME)
|
||||
+ < sizeof(config.dir_name)-1 ) {
|
||||
+ strcat(config.dir_name, "/");
|
||||
+ strcat(config.dir_name, CONFIG_DIR_NAME);
|
||||
+ } else
|
||||
+ snprintf( config.dir_name, sizeof(config.dir_name)-1, "%s/%s", getenv( "HOME" ), CONFIG_DIR_NAME );
|
||||
+ fprintf( stderr, "HAIKU: Config directory is '%s'\n", config.dir_name );
|
||||
+#else
|
||||
snprintf( config.dir_name, sizeof(config.dir_name)-1, "%s/%s", getenv( "HOME" ), CONFIG_DIR_NAME );
|
||||
#endif
|
||||
if ( opendir( config.dir_name ) == 0 ) {
|
||||
diff --git a/src/config.h b/src/config.h
|
||||
index ee52a64..491ed64 100644
|
||||
--- a/src/config.h
|
||||
+++ b/src/config.h
|
||||
@@ -99,7 +99,11 @@ typedef struct {
|
||||
} Config;
|
||||
|
||||
/* config directory name in home directory */
|
||||
+#ifdef __HAIKU__
|
||||
+#define CONFIG_DIR_NAME "LGames"
|
||||
+#else
|
||||
#define CONFIG_DIR_NAME ".lgames"
|
||||
+#endif
|
||||
|
||||
/* set config to default */
|
||||
void config_reset();
|
||||
diff --git a/src/manager.c b/src/manager.c
|
||||
index b8cc411..de07f73 100644
|
||||
--- a/src/manager.c
|
||||
+++ b/src/manager.c
|
||||
@@ -19,6 +19,11 @@
|
||||
#include "../config.h"
|
||||
#endif
|
||||
|
||||
+#ifdef __HAIKU__
|
||||
+#include <FindDirectory.h>
|
||||
+#include <fs_info.h>
|
||||
+#endif
|
||||
+
|
||||
#include "ltris.h"
|
||||
#include "manager.h"
|
||||
#include "chart.h"
|
||||
@@ -143,7 +148,22 @@ void cb_delete_set()
|
||||
return;
|
||||
}
|
||||
/* get file name + path */
|
||||
+#ifdef __HAIKU__
|
||||
+ dev_t volume = dev_for_path("/boot");
|
||||
+ if ( find_directory(B_USER_SETTINGS_DIRECTORY, volume, false,
|
||||
+ fname, sizeof(config.dir_name)-1 ) == B_OK &&
|
||||
+ strlen(fname) + strlen(CONFIG_DIR_NAME)
|
||||
+ + strlen(levelset_home_names[config.levelset_home_id])
|
||||
+ < sizeof(fname)-9 ) {
|
||||
+ strcat(fname, "/");
|
||||
+ strcat(fname, CONFIG_DIR_NAME);
|
||||
+ strcat(fname, "/levels/");
|
||||
+ strcat(fname, levelset_home_names[config.levelset_home_id]);
|
||||
+ } else
|
||||
+ snprintf( fname, sizeof(fname)-1, "%s/%s/levels/%s", getenv( "HOME" ), CONFIG_DIR_NAME, levelset_home_names[config.levelset_home_id] );
|
||||
+#else
|
||||
snprintf( fname, sizeof(fname)-1, "%s/%s/levels/%s", getenv( "HOME" ), CONFIG_DIR_NAME, levelset_home_names[config.levelset_home_id] );
|
||||
+#endif
|
||||
remove( fname );
|
||||
levelsets_load_names(); /* reinit name lists and configs indices */
|
||||
/* reassign these name lists as position in memory has changed */
|
||||
--
|
||||
1.8.3.4
|
||||
|
||||
Reference in New Issue
Block a user