1
0
Fork 0
forked from len0rd/rockbox

RaaA: Fix write locations of plugins

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29506 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Thomas Jarosch 2011-03-02 23:43:54 +00:00
parent a25153be6b
commit f9f89cf5cb
25 changed files with 66 additions and 36 deletions

View file

@ -29,8 +29,8 @@
/* save files */ /* save files */
#define SCORE_FILE PLUGIN_GAMES_DIR "/blackjack.score" #define SCORE_FILE PLUGIN_GAMES_DATA_DIR "/blackjack.score"
#define SAVE_FILE PLUGIN_GAMES_DIR "/blackjack.save" #define SAVE_FILE PLUGIN_GAMES_DATA_DIR "/blackjack.save"
#define NUM_SCORES 5 #define NUM_SCORES 5
/* final game return status */ /* final game return status */

View file

@ -450,8 +450,8 @@ CONFIG_KEYPAD == SANSA_M200_PAD
*/ */
#define CONFIG_FILE_NAME "brickmania.cfg" #define CONFIG_FILE_NAME "brickmania.cfg"
#define SAVE_FILE PLUGIN_GAMES_DIR "/brickmania.save" #define SAVE_FILE PLUGIN_GAMES_DATA_DIR "/brickmania.save"
#define SCORE_FILE PLUGIN_GAMES_DIR "/brickmania.score" #define SCORE_FILE PLUGIN_GAMES_DATA_DIR "/brickmania.score"
#define NUM_SCORES 5 #define NUM_SCORES 5

View file

@ -30,9 +30,9 @@
#include "lib/highscore.h" #include "lib/highscore.h"
/* files */ /* files */
#define SCORE_FILE PLUGIN_GAMES_DIR "/bubbles.score" #define SCORE_FILE PLUGIN_GAMES_DATA_DIR "/bubbles.score"
#define SAVE_FILE PLUGIN_GAMES_DIR "/bubbles.save" #define SAVE_FILE PLUGIN_GAMES_DATA_DIR "/bubbles.save"
#define DATA_FILE PLUGIN_GAMES_DIR "/bubbles.data" #define DATA_FILE PLUGIN_GAMES_DATA_DIR "/bubbles.data"
/* final game return status */ /* final game return status */
enum { enum {

View file

@ -319,8 +319,8 @@
#endif #endif
#endif #endif
#define MEMO_FILE PLUGIN_APPS_DIR "/.memo" #define MEMO_FILE PLUGIN_APPS_DATA_DIR "/.memo"
#define TEMP_FILE PLUGIN_APPS_DIR "/~temp" #define TEMP_FILE PLUGIN_APPS_DATA_DIR "/~temp"
#define X_OFFSET ((LCD_WIDTH%7)/2) #define X_OFFSET ((LCD_WIDTH%7)/2)
#if LCD_HEIGHT <= 80 #if LCD_HEIGHT <= 80

View file

@ -59,7 +59,7 @@ extern const fb_data chessbox_pieces[];
#define YOFS ((LCD_HEIGHT-8*TILE_HEIGHT)/2) #define YOFS ((LCD_HEIGHT-8*TILE_HEIGHT)/2)
/* save files */ /* save files */
#define SAVE_FILE PLUGIN_GAMES_DIR "/chessbox.save" #define SAVE_FILE PLUGIN_GAMES_DATA_DIR "/chessbox.save"
/* commands enum */ /* commands enum */
#define COMMAND_NOP 0 #define COMMAND_NOP 0

View file

@ -22,8 +22,8 @@
#include "plugin.h" #include "plugin.h"
#include "chessbox_pgn.h" #include "chessbox_pgn.h"
#define PGN_FILE PLUGIN_GAMES_DIR "/chessbox.pgn" #define PGN_FILE PLUGIN_GAMES_DATA_DIR "/chessbox.pgn"
#define LOG_FILE PLUGIN_GAMES_DIR "/chessbox.log" #define LOG_FILE PLUGIN_GAMES_DATA_DIR "/chessbox.log"
int loghandler; int loghandler;
short kn_offs[8][2] = {{2,1},{2,-1},{-2,1},{-2,-1},{1,2},{1,-2},{-1,2},{-1,-2}}; short kn_offs[8][2] = {{2,1},{2,-1},{-2,1},{-2,-1},{1,2},{1,-2},{-1,2},{-1,-2}};

View file

@ -192,7 +192,7 @@
#define CLIX_BUTTON_CLICK BUTTON_CENTER #define CLIX_BUTTON_CLICK BUTTON_CENTER
#endif #endif
#define SCORE_FILE PLUGIN_GAMES_DIR "/clix.score" #define SCORE_FILE PLUGIN_GAMES_DATA_DIR "/clix.score"
#define NUM_SCORES 5 #define NUM_SCORES 5
struct highscore highscores[NUM_SCORES]; struct highscore highscores[NUM_SCORES];

View file

@ -44,8 +44,8 @@ struct tidy_type {
int tidy_type_count; int tidy_type_count;
bool tidy_loaded_and_changed = false; bool tidy_loaded_and_changed = false;
#define DEFAULT_FILES PLUGIN_APPS_DIR "/disktidy.config" #define DEFAULT_FILES PLUGIN_APPS_DATA_DIR "/disktidy.config"
#define CUSTOM_FILES PLUGIN_APPS_DIR "/disktidy_custom.config" #define CUSTOM_FILES PLUGIN_APPS_DATA_DIR "/disktidy_custom.config"
void add_item(const char* name, int index) void add_item(const char* name, int index)
{ {

View file

@ -632,7 +632,7 @@ CONFIG_KEYPAD == MROBE500_PAD
#define TARGET_BOTTOM 3 #define TARGET_BOTTOM 3
#define TARGET_UFO 4 #define TARGET_UFO 4
#define HISCOREFILE PLUGIN_GAMES_DIR "/invadrox.high" #define HISCOREFILE PLUGIN_GAMES_DATA_DIR "/invadrox.high"
/* The time (in ms) for one iteration through the game loop - decrease this /* The time (in ms) for one iteration through the game loop - decrease this

View file

@ -461,8 +461,8 @@ struct puzzle_level puzzle_levels[NUM_PUZZLE_LEVELS] = {
{4, 7, PUZZLE_TILE_LEFT|PUZZLE_TILE_UP} } }, {4, 7, PUZZLE_TILE_LEFT|PUZZLE_TILE_UP} } },
}; };
#define SAVE_FILE PLUGIN_GAMES_DIR "/jewels.save" #define SAVE_FILE PLUGIN_GAMES_DATA_DIR "/jewels.save"
#define SCORE_FILE PLUGIN_GAMES_DIR "/jewels.score" #define SCORE_FILE PLUGIN_GAMES_DATA_DIR "/jewels.score"
struct highscore highscores[NUM_SCORES]; struct highscore highscores[NUM_SCORES];
static bool resume_file = false; static bool resume_file = false;

View file

@ -23,7 +23,7 @@
#include "lib/md5.h" #include "lib/md5.h"
#define KEYBOX_FILE PLUGIN_APPS_DIR "/keybox.dat" #define KEYBOX_FILE PLUGIN_APPS_DATA_DIR "/keybox.dat"
#define BLOCK_SIZE 8 #define BLOCK_SIZE 8
#define MAX_ENTRIES 12*BLOCK_SIZE /* keep this a multiple of BLOCK_SIZE */ #define MAX_ENTRIES 12*BLOCK_SIZE /* keep this a multiple of BLOCK_SIZE */
#define FIELD_LEN 32 /* should be enough for anyone ;) */ #define FIELD_LEN 32 /* should be enough for anyone ;) */

View file

@ -23,12 +23,15 @@
static void get_cfg_filename(char* buf, int buf_len, const char* filename) static void get_cfg_filename(char* buf, int buf_len, const char* filename)
{ {
#ifdef APPLICATION
rb->snprintf(buf, buf_len, PLUGIN_DATA_DIR "/%s", filename);
#else
char *s; char *s;
rb->strcpy(buf, rb->plugin_get_current_filename()); rb->strcpy(buf, rb->plugin_get_current_filename());
s = rb->strrchr(buf, '/'); s = rb->strrchr(buf, '/');
if (!s) /* should never happen */ if (!s) /* should never happen */
{ {
rb->snprintf(buf, buf_len, PLUGIN_DIR "/%s", filename); rb->snprintf(buf, buf_len, PLUGIN_DATA_DIR "/%s", filename);
} }
else else
{ {
@ -36,6 +39,7 @@ static void get_cfg_filename(char* buf, int buf_len, const char* filename)
*s = '\0'; *s = '\0';
rb->strcat(s, filename); rb->strcat(s, filename);
} }
#endif
} }
int configfile_save(const char *filename, struct configdata *cfg, int configfile_save(const char *filename, struct configdata *cfg,

View file

@ -228,7 +228,7 @@ typedef fb_data pix_t;
#define MAX_SLIDES_COUNT 10 #define MAX_SLIDES_COUNT 10
#define THREAD_STACK_SIZE DEFAULT_STACK_SIZE + 0x200 #define THREAD_STACK_SIZE DEFAULT_STACK_SIZE + 0x200
#define CACHE_PREFIX PLUGIN_DEMOS_DIR "/pictureflow" #define CACHE_PREFIX PLUGIN_DEMOS_DATA_DIR "/pictureflow"
#define EV_EXIT 9999 #define EV_EXIT 9999
#define EV_WAKEUP 1337 #define EV_WAKEUP 1337

View file

@ -311,7 +311,7 @@ static struct tuner_settings
/* Settings loading and saving(adapted from the clock plugin) */ /* Settings loading and saving(adapted from the clock plugin) */
/*=================================================================*/ /*=================================================================*/
#define SETTINGS_FILENAME PLUGIN_APPS_DIR "/.pitch_detector_settings" #define SETTINGS_FILENAME PLUGIN_APPS_DATA_DIR "/.pitch_detector_settings"
/* The settings as they exist on the hard disk, so that /* The settings as they exist on the hard disk, so that
* we can know at saving time if changes have been made */ * we can know at saving time if changes have been made */

View file

@ -800,8 +800,8 @@ bool resume = false;
bool resume_file = false; bool resume_file = false;
/* Rockbox File System only supports full filenames inc dir */ /* Rockbox File System only supports full filenames inc dir */
#define SCORE_FILE PLUGIN_GAMES_DIR "/rockblox.score" #define SCORE_FILE PLUGIN_GAMES_DATA_DIR "/rockblox.score"
#define RESUME_FILE PLUGIN_GAMES_DIR "/rockblox.resume" #define RESUME_FILE PLUGIN_GAMES_DATA_DIR "/rockblox.resume"
#define NUM_SCORES 5 #define NUM_SCORES 5
/* Default High Scores... */ /* Default High Scores... */

View file

@ -254,7 +254,7 @@ dir is the current direction of the snake - 0=up, 1=right, 2=down, 3=left;
#define BOARD_HEIGHT (LCD_HEIGHT/4) #define BOARD_HEIGHT (LCD_HEIGHT/4)
#define CONFIG_FILE_NAME "snake.cfg" #define CONFIG_FILE_NAME "snake.cfg"
#define SCORE_FILE PLUGIN_GAMES_DIR "/snake.score" #define SCORE_FILE PLUGIN_GAMES_DATA_DIR "/snake.score"
#define NUM_SCORES 5 #define NUM_SCORES 5
static int board[BOARD_WIDTH][BOARD_HEIGHT],snakelength; static int board[BOARD_WIDTH][BOARD_HEIGHT],snakelength;

View file

@ -413,7 +413,7 @@ static struct highscore highscores[NUM_SCORES];
#define SOUTH_WEST 4096 #define SOUTH_WEST 4096
#define LEVELS_FILE PLUGIN_GAMES_DIR "/snake2.levels" #define LEVELS_FILE PLUGIN_GAMES_DIR "/snake2.levels"
#define SCORE_FILE PLUGIN_GAMES_DIR "/snake2.score" #define SCORE_FILE PLUGIN_GAMES_DATA_DIR "/snake2.score"
int load_all_levels(void) int load_all_levels(void)
{ {

View file

@ -29,8 +29,13 @@
#define SOKOBAN_TITLE "Sokoban" #define SOKOBAN_TITLE "Sokoban"
#define SOKOBAN_LEVELS_FILE PLUGIN_GAMES_DIR "/sokoban.levels" #define SOKOBAN_LEVELS_FILE PLUGIN_GAMES_DIR "/sokoban.levels"
#define SOKOBAN_SAVE_FILE PLUGIN_GAMES_DIR "/sokoban.save" #define SOKOBAN_SAVE_FILE PLUGIN_GAMES_DATA_DIR "/sokoban.save"
#ifdef APPLICATION
#define SOKOBAN_SAVE_FOLDER PLUGIN_GAMES_DATA_DIR
#else
#define SOKOBAN_SAVE_FOLDER "/games" #define SOKOBAN_SAVE_FOLDER "/games"
#endif
#include "pluginbitmaps/sokoban_tiles.h" #include "pluginbitmaps/sokoban_tiles.h"
#define SOKOBAN_TILESIZE BMPWIDTH_sokoban_tiles #define SOKOBAN_TILESIZE BMPWIDTH_sokoban_tiles

View file

@ -1293,11 +1293,15 @@ int bouncing_cards( void )
*/ */
void get_save_filename( char *buf ) void get_save_filename( char *buf )
{ {
#ifdef APPLICATION
rb->snprintf(buf, sizeof(buf), PLUGIN_DATA_DIR "/sol.save");
#else
char *s; char *s;
rb->strcpy( buf, rb->plugin_get_current_filename() ); rb->strcpy( buf, rb->plugin_get_current_filename() );
s = rb->strrchr( buf, '/' ) + 1; s = rb->strrchr( buf, '/' ) + 1;
*s = '\0'; *s = '\0';
rb->strcat( s, "sol.save" ); rb->strcat( s, "sol.save" );
#endif
} }
int open_save_file( int flags ) int open_save_file( int flags )

View file

@ -400,7 +400,7 @@
#define SET_BG(x) #define SET_BG(x)
#endif #endif
#define SCORE_FILE PLUGIN_GAMES_DIR "/spacerocks.score" #define SCORE_FILE PLUGIN_GAMES_DATA_DIR "/spacerocks.score"
#define NUM_SCORES 5 #define NUM_SCORES 5
static struct highscore highscores[NUM_SCORES]; static struct highscore highscores[NUM_SCORES];

View file

@ -32,7 +32,7 @@
#define LAP_Y TIMER_Y+1 #define LAP_Y TIMER_Y+1
#define MAX_LAPS 64 #define MAX_LAPS 64
#define STOPWATCH_FILE PLUGIN_APPS_DIR "/stopwatch.dat" #define STOPWATCH_FILE PLUGIN_APPS_DATA_DIR "/stopwatch.dat"
/* variable button definitions */ /* variable button definitions */
#if CONFIG_KEYPAD == RECORDER_PAD #if CONFIG_KEYPAD == RECORDER_PAD

View file

@ -54,8 +54,8 @@
* font name MAX_PATH * font name MAX_PATH
*/ */
#define VIEWER_GLOBAL_SETTINGS_FILE VIEWERS_DIR "/viewer.dat" #define VIEWER_GLOBAL_SETTINGS_FILE VIEWERS_DATA_DIR "/viewer.dat"
#define TV_GLOBAL_SETTINGS_FILE VIEWERS_DIR "/tv_global.dat" #define TV_GLOBAL_SETTINGS_FILE VIEWERS_DATA_DIR "/tv_global.dat"
#define TV_GLOBAL_SETTINGS_HEADER "\x54\x56\x47\x53" /* "TVGS" */ #define TV_GLOBAL_SETTINGS_HEADER "\x54\x56\x47\x53" /* "TVGS" */
#define TV_GLOBAL_SETTINGS_VERSION 0x38 #define TV_GLOBAL_SETTINGS_VERSION 0x38
@ -108,11 +108,11 @@
* ... * ...
* [last file] * [last file]
*/ */
#define VIEWER_SETTINGS_FILE VIEWERS_DIR "/viewer_file.dat" #define VIEWER_SETTINGS_FILE VIEWERS_DATA_DIR "/viewer_file.dat"
#define TV_SETTINGS_FILE VIEWERS_DIR "/tv_file.dat" #define TV_SETTINGS_FILE VIEWERS_DATA_DIR "/tv_file.dat"
/* temporary file */ /* temporary file */
#define TV_SETTINGS_TMP_FILE VIEWERS_DIR "/tv_file.tmp" #define TV_SETTINGS_TMP_FILE VIEWERS_DATA_DIR "/tv_file.tmp"
#define TV_SETTINGS_HEADER "\x54\x56\x53" /* "TVS" */ #define TV_SETTINGS_HEADER "\x54\x56\x53" /* "TVS" */
#define TV_SETTINGS_VERSION 0x39 #define TV_SETTINGS_VERSION 0x39

View file

@ -467,7 +467,7 @@ void calc_scales(void)
} }
void load_settings(void) { void load_settings(void) {
int fp = rb->open(PLUGIN_DEMOS_DIR "/.vu_meter", O_RDONLY); int fp = rb->open(PLUGIN_DEMOS_DATA_DIR "/.vu_meter", O_RDONLY);
if(fp>=0) { if(fp>=0) {
rb->read(fp, &vumeter_settings, sizeof(struct saved_settings)); rb->read(fp, &vumeter_settings, sizeof(struct saved_settings));
rb->close(fp); rb->close(fp);
@ -479,7 +479,7 @@ void load_settings(void) {
} }
void save_settings(void) { void save_settings(void) {
int fp = rb->creat(PLUGIN_DEMOS_DIR "/.vu_meter", 0666); int fp = rb->creat(PLUGIN_DEMOS_DATA_DIR "/.vu_meter", 0666);
if(fp >= 0) { if(fp >= 0) {
rb->write (fp, &vumeter_settings, sizeof(struct saved_settings)); rb->write (fp, &vumeter_settings, sizeof(struct saved_settings));
rb->close(fp); rb->close(fp);

View file

@ -70,6 +70,7 @@ void paths_init(void)
/* make sure $HOME/.config/rockbox.org exists, it's needed for config.cfg */ /* make sure $HOME/.config/rockbox.org exists, it's needed for config.cfg */
#if (CONFIG_PLATFORM & PLATFORM_ANDROID) #if (CONFIG_PLATFORM & PLATFORM_ANDROID)
mkdir("/sdcard/rockbox"); mkdir("/sdcard/rockbox");
mkdir("/sdcard/rockbox/rocks.data");
#else #else
char config_dir[MAX_PATH]; char config_dir[MAX_PATH];
@ -84,6 +85,9 @@ void paths_init(void)
mkdir(config_dir); mkdir(config_dir);
snprintf(config_dir, sizeof(config_dir), "%s/.config/rockbox.org", home); snprintf(config_dir, sizeof(config_dir), "%s/.config/rockbox.org", home);
mkdir(config_dir); mkdir(config_dir);
/* Plugin data directory */
snprintf(config_dir, sizeof(config_dir), "%s/.config/rockbox.org/rocks.data", home);
mkdir(config_dir);
#endif #endif
} }

View file

@ -76,6 +76,19 @@ extern void paths_init(void);
#define PLUGIN_DEMOS_DIR PLUGIN_DIR "/demos" #define PLUGIN_DEMOS_DIR PLUGIN_DIR "/demos"
#define VIEWERS_DIR PLUGIN_DIR "/viewers" #define VIEWERS_DIR PLUGIN_DIR "/viewers"
#ifdef APPLICATION
#define PLUGIN_DATA_DIR "/.rockbox/rocks.data"
#define PLUGIN_GAMES_DATA_DIR PLUGIN_DATA_DIR
#define PLUGIN_APPS_DATA_DIR PLUGIN_DATA_DIR
#define PLUGIN_DEMOS_DATA_DIR PLUGIN_DATA_DIR
#define VIEWERS_DATA_DIR PLUGIN_DATA_DIR
#else
#define PLUGIN_DATA_DIR PLUGIN_DIR
#define PLUGIN_GAMES_DATA_DIR PLUGIN_DIR "/games"
#define PLUGIN_APPS_DATA_DIR PLUGIN_DIR "/apps"
#define PLUGIN_DEMOS_DATA_DIR PLUGIN_DIR "/demos"
#define VIEWERS_DATA_DIR PLUGIN_DIR "/viewers"
#endif
#define WPS_DIR ROCKBOX_DIR "/wps" #define WPS_DIR ROCKBOX_DIR "/wps"
#define SBS_DIR WPS_DIR #define SBS_DIR WPS_DIR