From fda7d720c05b4a756f045e0c0f4afe9630edb5c5 Mon Sep 17 00:00:00 2001 From: Jonathan Gordon Date: Mon, 6 Aug 2007 13:42:52 +0000 Subject: [PATCH] Accept FS#5464 - organise the rocks directory. If any plugins or "open with" optoins dont work please let me know... git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14214 a1c6a512-1295-4272-9138-f99709370657 --- apps/filetypes.c | 16 +---- apps/lang/english.lang | 43 +++++++++++++- apps/menus/main_menu.c | 2 +- apps/plugin.c | 16 +++-- apps/plugin.h | 15 +++-- apps/plugins/CATEGORIES | 91 +++++++++++++++++++++++++++++ apps/plugins/blackjack.c | 4 +- apps/plugins/bubbles.c | 4 +- apps/plugins/chessbox.c | 2 +- apps/plugins/chessbox/chessbox.c | 2 +- apps/plugins/clock/clock_settings.h | 2 +- apps/plugins/invadrox.c | 2 +- apps/plugins/jewels.c | 4 +- apps/plugins/lib/configfile.c | 21 ++++++- apps/plugins/reversi/reversi-gui.h | 2 +- apps/plugins/rockblox.c | 2 +- apps/plugins/rockboy.c | 2 +- apps/plugins/rockpaint.c | 2 +- apps/plugins/snake2.c | 4 +- apps/plugins/sokoban.c | 4 +- apps/plugins/spacerocks.c | 2 +- apps/plugins/sudoku/sudoku.h | 2 +- apps/plugins/viewer.c | 4 +- apps/plugins/viewers.config | 16 ++--- apps/plugins/vu_meter.c | 4 +- apps/plugins/zxbox.c | 2 +- apps/root_menu.c | 33 ++++++++++- apps/settings.h | 9 ++- tools/buildzip.pl | 26 +++++++-- 29 files changed, 266 insertions(+), 72 deletions(-) create mode 100644 apps/plugins/CATEGORIES diff --git a/apps/filetypes.c b/apps/filetypes.c index 7590b1b3e7..973f60e6e5 100644 --- a/apps/filetypes.c +++ b/apps/filetypes.c @@ -119,7 +119,6 @@ void tree_get_filetypes(const struct filetype** types, int* count) struct file_type { int icon; /* the icon which shall be used for it, NOICON if unknown */ - bool viewer; /* true if the rock is in viewers, false if in rocks */ unsigned char attr; /* FILETYPES_MASK >> 8 */ char* plugin; /* Which plugin to use, NULL if unknown, or builtin */ char* extension; /* NULL for none */ @@ -289,7 +288,6 @@ static void read_config(char* config_file) { char line[64], *s, *e; char extension[8], plugin[32]; - bool viewer; int fd = open(config_file, O_RDONLY); if (fd < 0) return; @@ -314,24 +312,15 @@ static void read_config(char* config_file) /* get the plugin */ s = e+1; - e = strchr(s, '/'); - if (!e) - continue; - *e = '\0'; - if (!strcasecmp("viewers", s)) - viewer = true; - else - viewer = false; - s = e+1; e = strchr(s, ','); if (!e) continue; *e = '\0'; + strcpy(plugin, s); /* ok, store this plugin/extension, check icon after */ filetypes[filetype_count].extension = filetypes_strdup(extension); filetypes[filetype_count].plugin = filetypes_strdup(plugin); - filetypes[filetype_count].viewer = viewer; filetypes[filetype_count].attr = heighest_attr +1; filetypes[filetype_count].icon = Icon_Questionmark; heighest_attr++; @@ -422,8 +411,7 @@ char* filetype_get_plugin(const struct entry* file) if (filetypes[index].plugin == NULL) return NULL; snprintf(plugin_name, MAX_PATH, "%s/%s.%s", - filetypes[index].viewer? VIEWERS_DIR: PLUGIN_DIR, - filetypes[index].plugin, ROCK_EXTENSION); + PLUGIN_DIR, filetypes[index].plugin, ROCK_EXTENSION); return plugin_name; } diff --git a/apps/lang/english.lang b/apps/lang/english.lang index 332ca66195..6f631282f7 100644 --- a/apps/lang/english.lang +++ b/apps/lang/english.lang @@ -10962,4 +10962,45 @@ *: "of" - + + id: LANG_PLUGIN_GAMES + desc: in the main menu + user: + + *: "Games" + + + *: "Games" + + + *: "Games" + + + + id: LANG_PLUGIN_APPS + desc: in the main menu + user: + + *: "Applications" + + + *: "Applications" + + + *: "Applications" + + + + id: LANG_PLUGIN_DEMOS + desc: in the main menu + user: + + *: "Demos" + + + *: "Demos" + + + *: "Demos" + + diff --git a/apps/menus/main_menu.c b/apps/menus/main_menu.c index 313d7c10e9..9f6d9a527c 100644 --- a/apps/menus/main_menu.c +++ b/apps/menus/main_menu.c @@ -116,7 +116,7 @@ MAKE_MENU(manage_settings, ID2P(LANG_MANAGE_MENU), NULL, Icon_Config, static bool show_credits(void) { - if (plugin_load(PLUGIN_DIR "/credits.rock",NULL) != PLUGIN_OK) + if (plugin_load(VIEWERS_DIR "/credits.rock",NULL) != PLUGIN_OK) { /* show the rockbox logo and version untill a button is pressed */ show_logo(); diff --git a/apps/plugin.c b/apps/plugin.c index bdb9c23f22..660f6e9294 100644 --- a/apps/plugin.c +++ b/apps/plugin.c @@ -64,6 +64,8 @@ static int plugin_size = 0; static bool (*pfn_tsr_exit)(bool reenter) = NULL; /* TSR exit callback */ static char current_plugin[MAX_PATH]; +char *plugin_get_current_filename(void); + extern struct thread_entry threads[MAXTHREADS]; static const struct plugin_api rockbox_api = { @@ -125,6 +127,7 @@ static const struct plugin_api rockbox_api = { font_get, font_getstringsize, font_get_width, + screen_clear_area, #endif backlight_on, backlight_off, @@ -445,6 +448,7 @@ static const struct plugin_api rockbox_api = { plugin_get_buffer, plugin_get_audio_buffer, plugin_tsr, + plugin_get_current_filename, #ifdef IRAM_STEAL plugin_iram_init, #endif @@ -471,6 +475,8 @@ static const struct plugin_api rockbox_api = { #endif show_logo, tree_get_context, + set_current_file, + set_dirfilter, #ifdef HAVE_WHEEL_POSITION wheel_status, @@ -494,13 +500,8 @@ static const struct plugin_api rockbox_api = { codec_load_file, get_codec_filename, get_metadata, -#endif -#ifdef HAVE_LCD_BITMAP - screen_clear_area, #endif led, - set_current_file, - set_dirfilter, }; int plugin_load(const char* plugin, void* parameter) @@ -734,3 +735,8 @@ void plugin_tsr(bool (*exit_callback)(bool)) { pfn_tsr_exit = exit_callback; /* remember the callback for later */ } + +char *plugin_get_current_filename(void) +{ + return current_plugin; +} diff --git a/apps/plugin.h b/apps/plugin.h index c3febf3243..a424531a96 100644 --- a/apps/plugin.h +++ b/apps/plugin.h @@ -112,12 +112,12 @@ #define PLUGIN_MAGIC 0x526F634B /* RocK */ /* increase this every time the api struct changes */ -#define PLUGIN_API_VERSION 70 +#define PLUGIN_API_VERSION 71 /* update this to latest version if a change to the api struct breaks backwards compatibility (and please take the opportunity to sort in any new function which are "waiting" at the end of the function table) */ -#define PLUGIN_MIN_API_VERSION 69 +#define PLUGIN_MIN_API_VERSION 71 /* plugin return codes */ enum plugin_status { @@ -204,6 +204,8 @@ struct plugin_api { int (*font_getstringsize)(const unsigned char *str, int *w, int *h, int fontnumber); int (*font_get_width)(struct font* pf, unsigned short char_code); + void (*screen_clear_area)(struct screen * display, int xstart, int ystart, + int width, int height); #endif void (*backlight_on)(void); void (*backlight_off)(void); @@ -555,6 +557,7 @@ struct plugin_api { void* (*plugin_get_buffer)(size_t *buffer_size); void* (*plugin_get_audio_buffer)(size_t *buffer_size); void (*plugin_tsr)(bool (*exit_callback)(bool reenter)); + char* (*plugin_get_current_filename)(void); #ifdef IRAM_STEAL void (*plugin_iram_init)(char *iramstart, char *iramcopy, size_t iram_size, char *iedata, size_t iedata_size); @@ -590,6 +593,8 @@ struct plugin_api { #endif int (*show_logo)(void); struct tree_context* (*tree_get_context)(void); + void (*set_current_file)(char* path); + void (*set_dirfilter)(int l_dirfilter); #ifdef HAVE_WHEEL_POSITION int (*wheel_status)(void); @@ -614,14 +619,8 @@ struct plugin_api { const char *(*get_codec_filename)(int cod_spec); bool (*get_metadata)(struct track_info* track, int fd, const char* trackname, bool v1first); -#endif -#ifdef HAVE_LCD_BITMAP - void (*screen_clear_area)(struct screen * display, int xstart, int ystart, - int width, int height); #endif void (*led)(bool on); - void (*set_current_file)(char* path); - void (*set_dirfilter)(int l_dirfilter); }; /* plugin header */ diff --git a/apps/plugins/CATEGORIES b/apps/plugins/CATEGORIES new file mode 100644 index 0000000000..cb24f5af9c --- /dev/null +++ b/apps/plugins/CATEGORIES @@ -0,0 +1,91 @@ +alpine_cdc,apps +battery_bench,apps +blackjack,games +bounce,demos +brickmania,games +bubbles,games +calculator,apps +calendar,apps +chessbox,games +chessclock,apps +chip8,viewers +chopper,games +clock,apps +credits,viewers +cube,demos +demystify,demos +dice,games +dict,apps +doom,games +disktidy,apps +euroconverter,apps +fire,demos +fireworks,demos +firmware_flash,apps +flipit,games +grayscale,demos +helloworld,demos +invadrox,games +iriver_flash,apps +iriverify,viewers +jackpot,games +jewels,games +jpeg,viewers +logo,demos +mandelbrot,games +maze,games +mazezam,games +mem_mon,apps +metronome,apps +midi2wav,viewers +midiplay,viewers +minesweeper,games +mosaique,demos +mp3_encoder,apps +mpegplayer,viewers +nim,games +oscilloscope,demos +pacbox,games +plasma,demos +pong,games +properties,viewers +random_folder_advance_config,apps +reversi,games +rockblox,games +rockbox_flash,viewers +rockboy,viewers +rocklife,games +rockpaint,apps +search,viewers +searchengine,viewers +shortcuts,viewers +sliding_puzzle,games +snake2,games +snake,games +snow,demos +sokoban,games +solitaire,games +sort,viewers +spacerocks,games +splitedit,apps +star,games +starfield,demos +stats,apps +stopwatch,apps +test_codec,viewers +test_disk,test +test_fps,test +test_sampr,test +test_scanrate,test +text_editor,apps +vbrfix,viewers +video,viewers +viewer,viewers +vu_meter,demos +wav2wv,viewers +wavplay,viewers +wavrecord,apps +wavview,viewers +wormlet,games +xobox,games +zxbox,viewers diff --git a/apps/plugins/blackjack.c b/apps/plugins/blackjack.c index f587ecc27a..c4b424143d 100644 --- a/apps/plugins/blackjack.c +++ b/apps/plugins/blackjack.c @@ -24,8 +24,8 @@ PLUGIN_HEADER /* save files */ -#define SCORE_FILE PLUGIN_DIR "/blackjack.score" -#define SAVE_FILE PLUGIN_DIR "/blackjack.save" +#define SCORE_FILE PLUGIN_GAMES_DIR "/blackjack.score" +#define SAVE_FILE PLUGIN_GAMES_DIR "/blackjack.save" #define NUM_SCORES LCD_HEIGHT/8-2 diff --git a/apps/plugins/bubbles.c b/apps/plugins/bubbles.c index 25fd4f3c63..4d49c3fc14 100644 --- a/apps/plugins/bubbles.c +++ b/apps/plugins/bubbles.c @@ -30,8 +30,8 @@ PLUGIN_HEADER /* files */ -#define SCORE_FILE PLUGIN_DIR "/bubbles.score" -#define SAVE_FILE PLUGIN_DIR "/bubbles.save" +#define SCORE_FILE PLUGIN_GAMES_DIR "/bubbles.score" +#define SAVE_FILE PLUGIN_GAMES_DIR "/bubbles.save" /* final game return status */ #define BB_NONE 5 diff --git a/apps/plugins/chessbox.c b/apps/plugins/chessbox.c index c14606613e..fc3b703b2c 100644 --- a/apps/plugins/chessbox.c +++ b/apps/plugins/chessbox.c @@ -29,6 +29,6 @@ PLUGIN_HEADER /* this is the plugin entry point */ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) { - return run_overlay(api, parameter, "/.rockbox/rocks/chessbox.ovl", "ChessBox"); + return run_overlay(api, parameter, PLUGIN_GAMES_DIR "/chessbox.ovl", "ChessBox"); } #endif diff --git a/apps/plugins/chessbox/chessbox.c b/apps/plugins/chessbox/chessbox.c index aedb9f8cc3..ab75765885 100644 --- a/apps/plugins/chessbox/chessbox.c +++ b/apps/plugins/chessbox/chessbox.c @@ -241,7 +241,7 @@ PLUGIN_HEADER #define YOFS ((LCD_HEIGHT-8*TILE_HEIGHT)/2) /* save files */ -#define SAVE_FILE PLUGIN_DIR "/chessbox.save" +#define SAVE_FILE PLUGIN_GAMES_DIR "/chessbox.save" /* commands enum */ #define COMMAND_NOP 0 diff --git a/apps/plugins/clock/clock_settings.h b/apps/plugins/clock/clock_settings.h index fadf3d5e63..a786ddd3b4 100644 --- a/apps/plugins/clock/clock_settings.h +++ b/apps/plugins/clock/clock_settings.h @@ -78,7 +78,7 @@ struct clock_settings{ extern struct clock_settings clock_settings; /* settings are saved to this location */ -#define settings_filename "/.rockbox/rocks/.clock_settings" +#define settings_filename PLUGIN_GAMES_DIR "/.clock_settings" void clock_settings_skin_next(struct clock_settings* settings); void clock_settings_skin_previous(struct clock_settings* settings); diff --git a/apps/plugins/invadrox.c b/apps/plugins/invadrox.c index 62a1c3e805..aa2cf0d2bd 100644 --- a/apps/plugins/invadrox.c +++ b/apps/plugins/invadrox.c @@ -559,7 +559,7 @@ unsigned char fire_sprite[FIRE_HEIGHT] = { #define TARGET_BOTTOM 3 #define TARGET_UFO 4 -#define HISCOREFILE "/.rockbox/rocks/invadrox.high" +#define HISCOREFILE PLUGIN_GAMES_DIR "/invadrox.high" /* The time (in ms) for one iteration through the game loop - decrease this diff --git a/apps/plugins/jewels.c b/apps/plugins/jewels.c index b74bf24c60..cb4ab88048 100644 --- a/apps/plugins/jewels.c +++ b/apps/plugins/jewels.c @@ -178,8 +178,8 @@ PLUGIN_HEADER #endif /* save files */ -#define SCORE_FILE PLUGIN_DIR "/jewels.score" -#define SAVE_FILE PLUGIN_DIR "/jewels.save" +#define SCORE_FILE PLUGIN_GAMES_DIR "/jewels.score" +#define SAVE_FILE PLUGIN_GAMES_DIR "/jewels.save" /* final game return status */ #define BJ_QUIT_FROM_GAME 4 diff --git a/apps/plugins/lib/configfile.c b/apps/plugins/lib/configfile.c index 3ca38052e5..54c067c4a7 100644 --- a/apps/plugins/lib/configfile.c +++ b/apps/plugins/lib/configfile.c @@ -26,6 +26,23 @@ void configfile_init(struct plugin_api* newrb) cfg_rb = newrb; } +void get_cfg_filename(char* buf, int buf_len, const char* filename) +{ + char *s; + cfg_rb->strcpy(buf, cfg_rb->plugin_get_current_filename()); + s = cfg_rb->strrchr(buf, '/'); + if (!s) /* should never happen */ + { + cfg_rb->snprintf(buf, buf_len, "/.rockbox/rocks/%s", filename); + } + else + { + s++; + *s = '\0'; + cfg_rb->strcat(s, filename); + } +} + int configfile_save(const char *filename, struct configdata *cfg, int num_items, int version) { @@ -33,7 +50,7 @@ int configfile_save(const char *filename, struct configdata *cfg, int i; char buf[MAX_PATH]; - cfg_rb->snprintf(buf, MAX_PATH, "/.rockbox/rocks/%s", filename); + get_cfg_filename(buf, MAX_PATH, filename); fd = cfg_rb->creat(buf); if(fd < 0) return fd*10 - 1; @@ -78,7 +95,7 @@ int configfile_load(const char *filename, struct configdata *cfg, int file_version = -1; int tmp; - cfg_rb->snprintf(buf, MAX_PATH, "/.rockbox/rocks/%s", filename); + get_cfg_filename(buf, MAX_PATH, filename); fd = cfg_rb->open(buf, O_RDONLY); if(fd < 0) return fd*10 - 1; diff --git a/apps/plugins/reversi/reversi-gui.h b/apps/plugins/reversi/reversi-gui.h index 43dab46ae9..b82e40d275 100644 --- a/apps/plugins/reversi/reversi-gui.h +++ b/apps/plugins/reversi/reversi-gui.h @@ -22,7 +22,7 @@ #include "plugin.h" -#define GAME_FILE PLUGIN_DIR "/reversi.rev" +#define GAME_FILE PLUGIN_GAMES_DIR "/reversi.rev" /* variable button definitions */ #if CONFIG_KEYPAD == RECORDER_PAD diff --git a/apps/plugins/rockblox.c b/apps/plugins/rockblox.c index e66d24256b..1aafe5faf7 100644 --- a/apps/plugins/rockblox.c +++ b/apps/plugins/rockblox.c @@ -477,7 +477,7 @@ figures[BLOCKS_NUM] = { }; /* Rockbox File System only supports full filenames inc dir */ -#define HIGH_SCORE "/.rockbox/rocks/rockblox.score" +#define HIGH_SCORE PLUGIN_GAMES_DIR "/rockblox.score" #define MAX_HIGH_SCORES 5 /* Default High Scores... */ struct highscore Highest[MAX_HIGH_SCORES]; diff --git a/apps/plugins/rockboy.c b/apps/plugins/rockboy.c index 9ff176cd25..67f10043ba 100644 --- a/apps/plugins/rockboy.c +++ b/apps/plugins/rockboy.c @@ -29,6 +29,6 @@ PLUGIN_HEADER /* this is the plugin entry point */ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) { - return run_overlay(api, parameter, "/.rockbox/viewers/rockboy.ovl", "RockBoy"); + return run_overlay(api, parameter, PLUGIN_GAMES_DIR "/rockboy.ovl", "RockBoy"); } #endif diff --git a/apps/plugins/rockpaint.c b/apps/plugins/rockpaint.c index ae4517dfc6..3038a06bee 100644 --- a/apps/plugins/rockpaint.c +++ b/apps/plugins/rockpaint.c @@ -130,7 +130,7 @@ PLUGIN_HEADER #define COLOR_BROWN LCD_RGBPACK(128,64,0) #define COLOR_LIGHTBROWN LCD_RGBPACK(255,128,64) -#define SPLASH_SCREEN PLUGIN_DIR "/rockpaint/splash.bmp" +#define SPLASH_SCREEN PLUGIN_APPS_DIR "/rockpaint/splash.bmp" #define ROCKPAINT_TITLE_FONT 2 /*********************************************************************** diff --git a/apps/plugins/snake2.c b/apps/plugins/snake2.c index 8b49a7cd55..dbefef6b7b 100644 --- a/apps/plugins/snake2.c +++ b/apps/plugins/snake2.c @@ -321,8 +321,8 @@ extern const unsigned char snake2_bottom[]; #define SOUTH_EAST 2048 #define SOUTH_WEST 4096 -#define LEVELS_FILE PLUGIN_DIR "/snake2.levels" -#define HISCORE_FILE PLUGIN_DIR "/snake2.hs" +#define LEVELS_FILE PLUGIN_GAMES_DIR "/snake2.levels" +#define HISCORE_FILE PLUGIN_GAMES_DIR "/snake2.hs" int load_all_levels(void) { diff --git a/apps/plugins/sokoban.c b/apps/plugins/sokoban.c index 004494ff11..e031f6064a 100644 --- a/apps/plugins/sokoban.c +++ b/apps/plugins/sokoban.c @@ -33,8 +33,8 @@ extern const fb_data sokoban_tiles[]; #define SOKOBAN_TITLE "Sokoban" -#define SOKOBAN_LEVELS_FILE PLUGIN_DIR "/sokoban.levels" -#define SOKOBAN_SAVE_FILE PLUGIN_DIR "/sokoban.save" +#define SOKOBAN_LEVELS_FILE PLUGIN_GAMES_DIR "/sokoban.levels" +#define SOKOBAN_SAVE_FILE PLUGIN_GAMES_DIR "/sokoban.save" #define SOKOBAN_SAVE_FOLDER "/games" /* Magnify is the number of pixels for each block. diff --git a/apps/plugins/spacerocks.c b/apps/plugins/spacerocks.c index f4208f00d0..075f335af7 100644 --- a/apps/plugins/spacerocks.c +++ b/apps/plugins/spacerocks.c @@ -162,7 +162,7 @@ static struct plugin_api* rb; /* global api struct pointer */ #define WRAP_GAP 12 #define EXPLOSION_LENGTH 20 #define SHOW_COL 0 -#define HISCORE_FILE PLUGIN_DIR "/astrorocks.hs" +#define HISCORE_FILE PLUGIN_GAMES_DIR "/astrorocks.hs" #define POINT_SIZE 2 #define MAX_NUM_ASTEROIDS 25 #define MAX_NUM_MISSILES 6 diff --git a/apps/plugins/sudoku/sudoku.h b/apps/plugins/sudoku/sudoku.h index 20e7c435c4..d41c0b879d 100644 --- a/apps/plugins/sudoku/sudoku.h +++ b/apps/plugins/sudoku/sudoku.h @@ -22,7 +22,7 @@ #include "plugin.h" -#define GAME_FILE PLUGIN_DIR "/sudoku.ss" +#define GAME_FILE PLUGIN_GAMES_DIR "/sudoku.ss" /* variable button definitions */ #if CONFIG_KEYPAD == RECORDER_PAD diff --git a/apps/plugins/viewer.c b/apps/plugins/viewer.c index 615ed41b86..897b7c827e 100644 --- a/apps/plugins/viewer.c +++ b/apps/plugins/viewer.c @@ -24,8 +24,8 @@ PLUGIN_HEADER -#define SETTINGS_FILE "/.rockbox/viewers/viewer.dat" /* binary file, so dont use .cfg */ -#define BOOKMARKS_FILE "/.rockbox/viewers/viewer_bookmarks.dat" +#define SETTINGS_FILE PLUGIN_APPS_DIR "/viewer.dat" /* binary file, so dont use .cfg */ +#define BOOKMARKS_FILE PLUGIN_APPS_DIR "/viewer_bookmarks.dat" #define WRAP_TRIM 44 /* Max number of spaces to trim (arbitrary) */ #define MAX_COLUMNS 64 /* Max displayable string len (over-estimate) */ diff --git a/apps/plugins/viewers.config b/apps/plugins/viewers.config index 80ebe43334..57bb5b4961 100644 --- a/apps/plugins/viewers.config +++ b/apps/plugins/viewers.config @@ -1,7 +1,7 @@ ch8,viewers/chip8,0 txt,viewers/viewer,1 nfo,viewers/viewer,1 -txt,rocks/text_editor,2 +txt,apps/text_editor,2 jpg,viewers/jpeg,2 jpe,viewers/jpeg,2 jpeg,viewers/jpeg,2 @@ -17,15 +17,15 @@ m3u,viewers/iriverify,- mid,viewers/midiplay,7 rmi,viewers/midiplay,7 rsp,viewers/searchengine,8 -sok,rocks/sokoban,1 -pgn,rocks/chessbox,1 -ss,rocks/sudoku,1 +sok,games/sokoban,1 +pgn,games/chessbox,1 +ss,games/sudoku,1 wav,viewers/wav2wv,- wav,viewers/mp3_encoder,- wav,viewers/wavplay,10 wav,viewers/wavview,10 wav,viewers/test_codec,- -bmp,rocks/rockpaint,11 +bmp,apps/rockpaint,11 mpg,viewers/mpegplayer,4 mpeg,viewers/mpegplayer,4 iriver,viewers/iriver_flash,3 @@ -34,6 +34,6 @@ sna,viewers/zxbox,12 tzx,viewers/zxbox,12 z80,viewers/zxbox,12 zzz,viewers/properties,- -colours,rocks/text_editor,11 -ssg,rocks/superdom,- -link,rocks/shortcuts,- +colours,apps/text_editor,11 +ssg,games/superdom,- +link,viewers/shortcuts,- diff --git a/apps/plugins/vu_meter.c b/apps/plugins/vu_meter.c index a03f38fe54..f054a5946e 100644 --- a/apps/plugins/vu_meter.c +++ b/apps/plugins/vu_meter.c @@ -236,7 +236,7 @@ void calc_scales(void) } void load_settings(void) { - int fp = rb->open("/.rockbox/rocks/.vu_meter", O_RDONLY); + int fp = rb->open(PLUGIN_DEMOS_DIR "/.vu_meter", O_RDONLY); if(fp>=0) { rb->read(fp, &vumeter_settings, sizeof(struct saved_settings)); rb->close(fp); @@ -252,7 +252,7 @@ void load_settings(void) { } void save_settings(void) { - int fp = rb->creat("/.rockbox/rocks/.vu_meter"); + int fp = rb->creat(PLUGIN_DEMOS_DIR "/.vu_meter"); if(fp >= 0) { rb->write (fp, &vumeter_settings, sizeof(struct saved_settings)); rb->close(fp); diff --git a/apps/plugins/zxbox.c b/apps/plugins/zxbox.c index 2f3ce97788..61d9eea4ac 100644 --- a/apps/plugins/zxbox.c +++ b/apps/plugins/zxbox.c @@ -26,6 +26,6 @@ PLUGIN_HEADER /* this is the plugin entry point */ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) { - return run_overlay(api, parameter, "/.rockbox/viewers/zxbox.ovl", "ZXBox"); + return run_overlay(api, parameter, PLUGIN_APPS_DIR "/zxbox.ovl", "ZXBox"); } #endif diff --git a/apps/root_menu.c b/apps/root_menu.c index b2684abfda..ad603db8c7 100644 --- a/apps/root_menu.c +++ b/apps/root_menu.c @@ -279,6 +279,37 @@ static int load_bmarks(void* param) bookmark_mrb_load(); return GO_TO_PREVIOUS; } +static int plugins_menu(void* param) +{ + (void)param; + MENUITEM_STRINGLIST(plugins_menu_items, ID2P(LANG_PLUGINS), NULL, + ID2P(LANG_PLUGIN_GAMES), + ID2P(LANG_PLUGIN_APPS), ID2P(LANG_PLUGIN_DEMOS)); + char *folder; + int retval = GO_TO_PREVIOUS; + int selection = 0, current = 0; + while (retval == GO_TO_PREVIOUS) + { + selection = do_menu(&plugins_menu_items, ¤t); + switch (selection) + { + case 0: + folder = PLUGIN_GAMES_DIR; + break; + case 1: + folder = PLUGIN_APPS_DIR; + break; + case 2: + folder = PLUGIN_DEMOS_DIR; + break; + default: + return selection; + } + retval = rockbox_browse(folder, SHOW_PLUGINS); + } + return retval; +} + /* These are all static const'd from apps/menus/ *.c so little hack so we can use them */ extern struct menu_item_ex @@ -308,7 +339,7 @@ static const struct root_items items[] = { #endif [GO_TO_RECENTBMARKS] = { load_bmarks, NULL, &bookmark_settings_menu }, - [GO_TO_BROWSEPLUGINS] = { browser, (void*)GO_TO_BROWSEPLUGINS, NULL }, + [GO_TO_BROWSEPLUGINS] = { plugins_menu, NULL, NULL }, }; static const int nb_items = sizeof(items)/sizeof(*items); diff --git a/apps/settings.h b/apps/settings.h index 4d7073bf3b..39dabc72ce 100644 --- a/apps/settings.h +++ b/apps/settings.h @@ -56,8 +56,13 @@ #define WPS_DIR ROCKBOX_DIR "/wps" #define THEME_DIR ROCKBOX_DIR "/themes" #define ICON_DIR ROCKBOX_DIR "/icons" -#define PLUGIN_DIR ROCKBOX_DIR "/rocks" -#define VIEWERS_DIR ROCKBOX_DIR "/viewers" + +#define PLUGIN_DIR ROCKBOX_DIR "/rocks" +#define PLUGIN_GAMES_DIR PLUGIN_DIR "/games" +#define PLUGIN_APPS_DIR PLUGIN_DIR "/apps" +#define PLUGIN_DEMOS_DIR PLUGIN_DIR "/demos" +#define VIEWERS_DIR PLUGIN_DIR "/viewers" + #define BACKDROP_DIR ROCKBOX_DIR "/backdrops" #define REC_BASE_DIR "/" #define EQS_DIR ROCKBOX_DIR "/eqs" diff --git a/tools/buildzip.pl b/tools/buildzip.pl index c3f6ccc3d4..ea7aabee0b 100755 --- a/tools/buildzip.pl +++ b/tools/buildzip.pl @@ -213,6 +213,11 @@ sub buildzip { mkdir ".rockbox/langs", 0777; mkdir ".rockbox/rocks", 0777; + mkdir ".rockbox/rocks/games", 0777; + mkdir ".rockbox/rocks/apps", 0777; + mkdir ".rockbox/rocks/demos", 0777; + mkdir ".rockbox/rocks/viewers", 0777; + if ($recording) { mkdir ".rockbox/recpresets", 0777; } @@ -280,7 +285,7 @@ STOP open VIEWERS, ">.rockbox/viewers.config" or die "can't create .rockbox/viewers.config"; - mkdir ".rockbox/viewers", 0777; + foreach my $line (@viewers) { if ($line =~ /([^,]*),([^,]*),/) { my ($ext, $plugin)=($1, $2); @@ -305,7 +310,7 @@ STOP if($dir ne "rocks") { # target is not 'rocks' but the plugins are always in that # dir at first! - `mv .rockbox/rocks/$name .rockbox/$r`; + `mv .rockbox/rocks/$name .rockbox/rocks/$r`; } print VIEWERS $line; } @@ -318,11 +323,22 @@ STOP if(-e ".rockbox/rocks/$oname") { # if there's an "overlay" file for the .rock, move that as # well - `mv .rockbox/rocks/$oname .rockbox/$dir`; + `mv .rockbox/rocks/$oname .rockbox/rocks/$dir`; } } } close VIEWERS; + + open CATEGORIES, "$ROOT/apps/plugins/CATEGORIES" or + die "can't open CATEGORIES"; + @rock_targetdirs = ; + close CATEGORIES; + foreach my $line (@rock_targetdirs) { + if ($line =~ /([^,]*),(.*)/) { + my ($plugin, $dir)=($1, $2); + `mv .rockbox/rocks/${plugin}.rock .rockbox/rocks/$dir 2> /dev/null`; + } + } if ($bitmap) { mkdir ".rockbox/icons", 0777; @@ -335,8 +351,8 @@ STOP `cp $ROOT/apps/tagnavi.config .rockbox/`; if($bitmap) { - `cp $ROOT/apps/plugins/sokoban.levels .rockbox/rocks/`; # sokoban levels - `cp $ROOT/apps/plugins/snake2.levels .rockbox/rocks/`; # snake2 levels + `cp $ROOT/apps/plugins/sokoban.levels .rockbox/rocks/games/`; # sokoban levels + `cp $ROOT/apps/plugins/snake2.levels .rockbox/rocks/games/`; # snake2 levels } if($image) {