summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Gordon <rockbox@jdgordon.info>2007-08-06 13:42:52 +0000
committerJonathan Gordon <rockbox@jdgordon.info>2007-08-06 13:42:52 +0000
commitfda7d720c05b4a756f045e0c0f4afe9630edb5c5 (patch)
tree35bb19611d47bcb05a49529a73ccc5d66a50476e
parent5b76936a44de3c7ecd568300f26b5e6421901285 (diff)
downloadrockbox-fda7d720c05b4a756f045e0c0f4afe9630edb5c5.tar.gz
rockbox-fda7d720c05b4a756f045e0c0f4afe9630edb5c5.zip
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
-rw-r--r--apps/filetypes.c16
-rw-r--r--apps/lang/english.lang43
-rw-r--r--apps/menus/main_menu.c2
-rw-r--r--apps/plugin.c16
-rw-r--r--apps/plugin.h15
-rw-r--r--apps/plugins/CATEGORIES91
-rw-r--r--apps/plugins/blackjack.c4
-rw-r--r--apps/plugins/bubbles.c4
-rw-r--r--apps/plugins/chessbox.c2
-rw-r--r--apps/plugins/chessbox/chessbox.c2
-rw-r--r--apps/plugins/clock/clock_settings.h2
-rw-r--r--apps/plugins/invadrox.c2
-rw-r--r--apps/plugins/jewels.c4
-rw-r--r--apps/plugins/lib/configfile.c21
-rw-r--r--apps/plugins/reversi/reversi-gui.h2
-rw-r--r--apps/plugins/rockblox.c2
-rw-r--r--apps/plugins/rockboy.c2
-rw-r--r--apps/plugins/rockpaint.c2
-rw-r--r--apps/plugins/snake2.c4
-rw-r--r--apps/plugins/sokoban.c4
-rw-r--r--apps/plugins/spacerocks.c2
-rw-r--r--apps/plugins/sudoku/sudoku.h2
-rw-r--r--apps/plugins/viewer.c4
-rw-r--r--apps/plugins/viewers.config16
-rw-r--r--apps/plugins/vu_meter.c4
-rw-r--r--apps/plugins/zxbox.c2
-rw-r--r--apps/root_menu.c33
-rw-r--r--apps/settings.h9
-rwxr-xr-xtools/buildzip.pl26
29 files changed, 266 insertions, 72 deletions
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)
119 119
120struct file_type { 120struct file_type {
121 int icon; /* the icon which shall be used for it, NOICON if unknown */ 121 int icon; /* the icon which shall be used for it, NOICON if unknown */
122 bool viewer; /* true if the rock is in viewers, false if in rocks */
123 unsigned char attr; /* FILETYPES_MASK >> 8 */ 122 unsigned char attr; /* FILETYPES_MASK >> 8 */
124 char* plugin; /* Which plugin to use, NULL if unknown, or builtin */ 123 char* plugin; /* Which plugin to use, NULL if unknown, or builtin */
125 char* extension; /* NULL for none */ 124 char* extension; /* NULL for none */
@@ -289,7 +288,6 @@ static void read_config(char* config_file)
289{ 288{
290 char line[64], *s, *e; 289 char line[64], *s, *e;
291 char extension[8], plugin[32]; 290 char extension[8], plugin[32];
292 bool viewer;
293 int fd = open(config_file, O_RDONLY); 291 int fd = open(config_file, O_RDONLY);
294 if (fd < 0) 292 if (fd < 0)
295 return; 293 return;
@@ -314,24 +312,15 @@ static void read_config(char* config_file)
314 312
315 /* get the plugin */ 313 /* get the plugin */
316 s = e+1; 314 s = e+1;
317 e = strchr(s, '/');
318 if (!e)
319 continue;
320 *e = '\0';
321 if (!strcasecmp("viewers", s))
322 viewer = true;
323 else
324 viewer = false;
325 s = e+1;
326 e = strchr(s, ','); 315 e = strchr(s, ',');
327 if (!e) 316 if (!e)
328 continue; 317 continue;
329 *e = '\0'; 318 *e = '\0';
319
330 strcpy(plugin, s); 320 strcpy(plugin, s);
331 /* ok, store this plugin/extension, check icon after */ 321 /* ok, store this plugin/extension, check icon after */
332 filetypes[filetype_count].extension = filetypes_strdup(extension); 322 filetypes[filetype_count].extension = filetypes_strdup(extension);
333 filetypes[filetype_count].plugin = filetypes_strdup(plugin); 323 filetypes[filetype_count].plugin = filetypes_strdup(plugin);
334 filetypes[filetype_count].viewer = viewer;
335 filetypes[filetype_count].attr = heighest_attr +1; 324 filetypes[filetype_count].attr = heighest_attr +1;
336 filetypes[filetype_count].icon = Icon_Questionmark; 325 filetypes[filetype_count].icon = Icon_Questionmark;
337 heighest_attr++; 326 heighest_attr++;
@@ -422,8 +411,7 @@ char* filetype_get_plugin(const struct entry* file)
422 if (filetypes[index].plugin == NULL) 411 if (filetypes[index].plugin == NULL)
423 return NULL; 412 return NULL;
424 snprintf(plugin_name, MAX_PATH, "%s/%s.%s", 413 snprintf(plugin_name, MAX_PATH, "%s/%s.%s",
425 filetypes[index].viewer? VIEWERS_DIR: PLUGIN_DIR, 414 PLUGIN_DIR, filetypes[index].plugin, ROCK_EXTENSION);
426 filetypes[index].plugin, ROCK_EXTENSION);
427 return plugin_name; 415 return plugin_name;
428} 416}
429 417
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 @@
10962 *: "of" 10962 *: "of"
10963 </voice> 10963 </voice>
10964</phrase> 10964</phrase>
10965 10965<phrase>
10966 id: LANG_PLUGIN_GAMES
10967 desc: in the main menu
10968 user:
10969 <source>
10970 *: "Games"
10971 </source>
10972 <dest>
10973 *: "Games"
10974 </dest>
10975 <voice>
10976 *: "Games"
10977 </voice>
10978</phrase>
10979<phrase>
10980 id: LANG_PLUGIN_APPS
10981 desc: in the main menu
10982 user:
10983 <source>
10984 *: "Applications"
10985 </source>
10986 <dest>
10987 *: "Applications"
10988 </dest>
10989 <voice>
10990 *: "Applications"
10991 </voice>
10992</phrase>
10993<phrase>
10994 id: LANG_PLUGIN_DEMOS
10995 desc: in the main menu
10996 user:
10997 <source>
10998 *: "Demos"
10999 </source>
11000 <dest>
11001 *: "Demos"
11002 </dest>
11003 <voice>
11004 *: "Demos"
11005 </voice>
11006</phrase>
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,
116 116
117static bool show_credits(void) 117static bool show_credits(void)
118{ 118{
119 if (plugin_load(PLUGIN_DIR "/credits.rock",NULL) != PLUGIN_OK) 119 if (plugin_load(VIEWERS_DIR "/credits.rock",NULL) != PLUGIN_OK)
120 { 120 {
121 /* show the rockbox logo and version untill a button is pressed */ 121 /* show the rockbox logo and version untill a button is pressed */
122 show_logo(); 122 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;
64static bool (*pfn_tsr_exit)(bool reenter) = NULL; /* TSR exit callback */ 64static bool (*pfn_tsr_exit)(bool reenter) = NULL; /* TSR exit callback */
65static char current_plugin[MAX_PATH]; 65static char current_plugin[MAX_PATH];
66 66
67char *plugin_get_current_filename(void);
68
67extern struct thread_entry threads[MAXTHREADS]; 69extern struct thread_entry threads[MAXTHREADS];
68 70
69static const struct plugin_api rockbox_api = { 71static const struct plugin_api rockbox_api = {
@@ -125,6 +127,7 @@ static const struct plugin_api rockbox_api = {
125 font_get, 127 font_get,
126 font_getstringsize, 128 font_getstringsize,
127 font_get_width, 129 font_get_width,
130 screen_clear_area,
128#endif 131#endif
129 backlight_on, 132 backlight_on,
130 backlight_off, 133 backlight_off,
@@ -445,6 +448,7 @@ static const struct plugin_api rockbox_api = {
445 plugin_get_buffer, 448 plugin_get_buffer,
446 plugin_get_audio_buffer, 449 plugin_get_audio_buffer,
447 plugin_tsr, 450 plugin_tsr,
451 plugin_get_current_filename,
448#ifdef IRAM_STEAL 452#ifdef IRAM_STEAL
449 plugin_iram_init, 453 plugin_iram_init,
450#endif 454#endif
@@ -471,6 +475,8 @@ static const struct plugin_api rockbox_api = {
471#endif 475#endif
472 show_logo, 476 show_logo,
473 tree_get_context, 477 tree_get_context,
478 set_current_file,
479 set_dirfilter,
474 480
475#ifdef HAVE_WHEEL_POSITION 481#ifdef HAVE_WHEEL_POSITION
476 wheel_status, 482 wheel_status,
@@ -495,12 +501,7 @@ static const struct plugin_api rockbox_api = {
495 get_codec_filename, 501 get_codec_filename,
496 get_metadata, 502 get_metadata,
497#endif 503#endif
498#ifdef HAVE_LCD_BITMAP
499 screen_clear_area,
500#endif
501 led, 504 led,
502 set_current_file,
503 set_dirfilter,
504}; 505};
505 506
506int plugin_load(const char* plugin, void* parameter) 507int plugin_load(const char* plugin, void* parameter)
@@ -734,3 +735,8 @@ void plugin_tsr(bool (*exit_callback)(bool))
734{ 735{
735 pfn_tsr_exit = exit_callback; /* remember the callback for later */ 736 pfn_tsr_exit = exit_callback; /* remember the callback for later */
736} 737}
738
739char *plugin_get_current_filename(void)
740{
741 return current_plugin;
742}
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 @@
112#define PLUGIN_MAGIC 0x526F634B /* RocK */ 112#define PLUGIN_MAGIC 0x526F634B /* RocK */
113 113
114/* increase this every time the api struct changes */ 114/* increase this every time the api struct changes */
115#define PLUGIN_API_VERSION 70 115#define PLUGIN_API_VERSION 71
116 116
117/* update this to latest version if a change to the api struct breaks 117/* update this to latest version if a change to the api struct breaks
118 backwards compatibility (and please take the opportunity to sort in any 118 backwards compatibility (and please take the opportunity to sort in any
119 new function which are "waiting" at the end of the function table) */ 119 new function which are "waiting" at the end of the function table) */
120#define PLUGIN_MIN_API_VERSION 69 120#define PLUGIN_MIN_API_VERSION 71
121 121
122/* plugin return codes */ 122/* plugin return codes */
123enum plugin_status { 123enum plugin_status {
@@ -204,6 +204,8 @@ struct plugin_api {
204 int (*font_getstringsize)(const unsigned char *str, int *w, int *h, 204 int (*font_getstringsize)(const unsigned char *str, int *w, int *h,
205 int fontnumber); 205 int fontnumber);
206 int (*font_get_width)(struct font* pf, unsigned short char_code); 206 int (*font_get_width)(struct font* pf, unsigned short char_code);
207 void (*screen_clear_area)(struct screen * display, int xstart, int ystart,
208 int width, int height);
207#endif 209#endif
208 void (*backlight_on)(void); 210 void (*backlight_on)(void);
209 void (*backlight_off)(void); 211 void (*backlight_off)(void);
@@ -555,6 +557,7 @@ struct plugin_api {
555 void* (*plugin_get_buffer)(size_t *buffer_size); 557 void* (*plugin_get_buffer)(size_t *buffer_size);
556 void* (*plugin_get_audio_buffer)(size_t *buffer_size); 558 void* (*plugin_get_audio_buffer)(size_t *buffer_size);
557 void (*plugin_tsr)(bool (*exit_callback)(bool reenter)); 559 void (*plugin_tsr)(bool (*exit_callback)(bool reenter));
560 char* (*plugin_get_current_filename)(void);
558#ifdef IRAM_STEAL 561#ifdef IRAM_STEAL
559 void (*plugin_iram_init)(char *iramstart, char *iramcopy, size_t iram_size, 562 void (*plugin_iram_init)(char *iramstart, char *iramcopy, size_t iram_size,
560 char *iedata, size_t iedata_size); 563 char *iedata, size_t iedata_size);
@@ -590,6 +593,8 @@ struct plugin_api {
590#endif 593#endif
591 int (*show_logo)(void); 594 int (*show_logo)(void);
592 struct tree_context* (*tree_get_context)(void); 595 struct tree_context* (*tree_get_context)(void);
596 void (*set_current_file)(char* path);
597 void (*set_dirfilter)(int l_dirfilter);
593 598
594#ifdef HAVE_WHEEL_POSITION 599#ifdef HAVE_WHEEL_POSITION
595 int (*wheel_status)(void); 600 int (*wheel_status)(void);
@@ -615,13 +620,7 @@ struct plugin_api {
615 bool (*get_metadata)(struct track_info* track, int fd, const char* trackname, 620 bool (*get_metadata)(struct track_info* track, int fd, const char* trackname,
616 bool v1first); 621 bool v1first);
617#endif 622#endif
618#ifdef HAVE_LCD_BITMAP
619 void (*screen_clear_area)(struct screen * display, int xstart, int ystart,
620 int width, int height);
621#endif
622 void (*led)(bool on); 623 void (*led)(bool on);
623 void (*set_current_file)(char* path);
624 void (*set_dirfilter)(int l_dirfilter);
625}; 624};
626 625
627/* plugin header */ 626/* 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 @@
1alpine_cdc,apps
2battery_bench,apps
3blackjack,games
4bounce,demos
5brickmania,games
6bubbles,games
7calculator,apps
8calendar,apps
9chessbox,games
10chessclock,apps
11chip8,viewers
12chopper,games
13clock,apps
14credits,viewers
15cube,demos
16demystify,demos
17dice,games
18dict,apps
19doom,games
20disktidy,apps
21euroconverter,apps
22fire,demos
23fireworks,demos
24firmware_flash,apps
25flipit,games
26grayscale,demos
27helloworld,demos
28invadrox,games
29iriver_flash,apps
30iriverify,viewers
31jackpot,games
32jewels,games
33jpeg,viewers
34logo,demos
35mandelbrot,games
36maze,games
37mazezam,games
38mem_mon,apps
39metronome,apps
40midi2wav,viewers
41midiplay,viewers
42minesweeper,games
43mosaique,demos
44mp3_encoder,apps
45mpegplayer,viewers
46nim,games
47oscilloscope,demos
48pacbox,games
49plasma,demos
50pong,games
51properties,viewers
52random_folder_advance_config,apps
53reversi,games
54rockblox,games
55rockbox_flash,viewers
56rockboy,viewers
57rocklife,games
58rockpaint,apps
59search,viewers
60searchengine,viewers
61shortcuts,viewers
62sliding_puzzle,games
63snake2,games
64snake,games
65snow,demos
66sokoban,games
67solitaire,games
68sort,viewers
69spacerocks,games
70splitedit,apps
71star,games
72starfield,demos
73stats,apps
74stopwatch,apps
75test_codec,viewers
76test_disk,test
77test_fps,test
78test_sampr,test
79test_scanrate,test
80text_editor,apps
81vbrfix,viewers
82video,viewers
83viewer,viewers
84vu_meter,demos
85wav2wv,viewers
86wavplay,viewers
87wavrecord,apps
88wavview,viewers
89wormlet,games
90xobox,games
91zxbox,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 @@
24PLUGIN_HEADER 24PLUGIN_HEADER
25 25
26/* save files */ 26/* save files */
27#define SCORE_FILE PLUGIN_DIR "/blackjack.score" 27#define SCORE_FILE PLUGIN_GAMES_DIR "/blackjack.score"
28#define SAVE_FILE PLUGIN_DIR "/blackjack.save" 28#define SAVE_FILE PLUGIN_GAMES_DIR "/blackjack.save"
29 29
30#define NUM_SCORES LCD_HEIGHT/8-2 30#define NUM_SCORES LCD_HEIGHT/8-2
31 31
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 @@
30PLUGIN_HEADER 30PLUGIN_HEADER
31 31
32/* files */ 32/* files */
33#define SCORE_FILE PLUGIN_DIR "/bubbles.score" 33#define SCORE_FILE PLUGIN_GAMES_DIR "/bubbles.score"
34#define SAVE_FILE PLUGIN_DIR "/bubbles.save" 34#define SAVE_FILE PLUGIN_GAMES_DIR "/bubbles.save"
35 35
36/* final game return status */ 36/* final game return status */
37#define BB_NONE 5 37#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
29/* this is the plugin entry point */ 29/* this is the plugin entry point */
30enum plugin_status plugin_start(struct plugin_api* api, void* parameter) 30enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
31{ 31{
32 return run_overlay(api, parameter, "/.rockbox/rocks/chessbox.ovl", "ChessBox"); 32 return run_overlay(api, parameter, PLUGIN_GAMES_DIR "/chessbox.ovl", "ChessBox");
33} 33}
34#endif 34#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
241#define YOFS ((LCD_HEIGHT-8*TILE_HEIGHT)/2) 241#define YOFS ((LCD_HEIGHT-8*TILE_HEIGHT)/2)
242 242
243/* save files */ 243/* save files */
244#define SAVE_FILE PLUGIN_DIR "/chessbox.save" 244#define SAVE_FILE PLUGIN_GAMES_DIR "/chessbox.save"
245 245
246/* commands enum */ 246/* commands enum */
247#define COMMAND_NOP 0 247#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{
78extern struct clock_settings clock_settings; 78extern struct clock_settings clock_settings;
79 79
80/* settings are saved to this location */ 80/* settings are saved to this location */
81#define settings_filename "/.rockbox/rocks/.clock_settings" 81#define settings_filename PLUGIN_GAMES_DIR "/.clock_settings"
82 82
83void clock_settings_skin_next(struct clock_settings* settings); 83void clock_settings_skin_next(struct clock_settings* settings);
84void clock_settings_skin_previous(struct clock_settings* settings); 84void 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] = {
559#define TARGET_BOTTOM 3 559#define TARGET_BOTTOM 3
560#define TARGET_UFO 4 560#define TARGET_UFO 4
561 561
562#define HISCOREFILE "/.rockbox/rocks/invadrox.high" 562#define HISCOREFILE PLUGIN_GAMES_DIR "/invadrox.high"
563 563
564 564
565/* The time (in ms) for one iteration through the game loop - decrease this 565/* 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
178#endif 178#endif
179 179
180/* save files */ 180/* save files */
181#define SCORE_FILE PLUGIN_DIR "/jewels.score" 181#define SCORE_FILE PLUGIN_GAMES_DIR "/jewels.score"
182#define SAVE_FILE PLUGIN_DIR "/jewels.save" 182#define SAVE_FILE PLUGIN_GAMES_DIR "/jewels.save"
183 183
184/* final game return status */ 184/* final game return status */
185#define BJ_QUIT_FROM_GAME 4 185#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)
26 cfg_rb = newrb; 26 cfg_rb = newrb;
27} 27}
28 28
29void get_cfg_filename(char* buf, int buf_len, const char* filename)
30{
31 char *s;
32 cfg_rb->strcpy(buf, cfg_rb->plugin_get_current_filename());
33 s = cfg_rb->strrchr(buf, '/');
34 if (!s) /* should never happen */
35 {
36 cfg_rb->snprintf(buf, buf_len, "/.rockbox/rocks/%s", filename);
37 }
38 else
39 {
40 s++;
41 *s = '\0';
42 cfg_rb->strcat(s, filename);
43 }
44}
45
29int configfile_save(const char *filename, struct configdata *cfg, 46int configfile_save(const char *filename, struct configdata *cfg,
30 int num_items, int version) 47 int num_items, int version)
31{ 48{
@@ -33,7 +50,7 @@ int configfile_save(const char *filename, struct configdata *cfg,
33 int i; 50 int i;
34 char buf[MAX_PATH]; 51 char buf[MAX_PATH];
35 52
36 cfg_rb->snprintf(buf, MAX_PATH, "/.rockbox/rocks/%s", filename); 53 get_cfg_filename(buf, MAX_PATH, filename);
37 fd = cfg_rb->creat(buf); 54 fd = cfg_rb->creat(buf);
38 if(fd < 0) 55 if(fd < 0)
39 return fd*10 - 1; 56 return fd*10 - 1;
@@ -78,7 +95,7 @@ int configfile_load(const char *filename, struct configdata *cfg,
78 int file_version = -1; 95 int file_version = -1;
79 int tmp; 96 int tmp;
80 97
81 cfg_rb->snprintf(buf, MAX_PATH, "/.rockbox/rocks/%s", filename); 98 get_cfg_filename(buf, MAX_PATH, filename);
82 fd = cfg_rb->open(buf, O_RDONLY); 99 fd = cfg_rb->open(buf, O_RDONLY);
83 if(fd < 0) 100 if(fd < 0)
84 return fd*10 - 1; 101 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 @@
22 22
23#include "plugin.h" 23#include "plugin.h"
24 24
25#define GAME_FILE PLUGIN_DIR "/reversi.rev" 25#define GAME_FILE PLUGIN_GAMES_DIR "/reversi.rev"
26 26
27/* variable button definitions */ 27/* variable button definitions */
28#if CONFIG_KEYPAD == RECORDER_PAD 28#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] = {
477}; 477};
478 478
479/* Rockbox File System only supports full filenames inc dir */ 479/* Rockbox File System only supports full filenames inc dir */
480#define HIGH_SCORE "/.rockbox/rocks/rockblox.score" 480#define HIGH_SCORE PLUGIN_GAMES_DIR "/rockblox.score"
481#define MAX_HIGH_SCORES 5 481#define MAX_HIGH_SCORES 5
482/* Default High Scores... */ 482/* Default High Scores... */
483struct highscore Highest[MAX_HIGH_SCORES]; 483struct 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
29/* this is the plugin entry point */ 29/* this is the plugin entry point */
30enum plugin_status plugin_start(struct plugin_api* api, void* parameter) 30enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
31{ 31{
32 return run_overlay(api, parameter, "/.rockbox/viewers/rockboy.ovl", "RockBoy"); 32 return run_overlay(api, parameter, PLUGIN_GAMES_DIR "/rockboy.ovl", "RockBoy");
33} 33}
34#endif 34#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
130#define COLOR_BROWN LCD_RGBPACK(128,64,0) 130#define COLOR_BROWN LCD_RGBPACK(128,64,0)
131#define COLOR_LIGHTBROWN LCD_RGBPACK(255,128,64) 131#define COLOR_LIGHTBROWN LCD_RGBPACK(255,128,64)
132 132
133#define SPLASH_SCREEN PLUGIN_DIR "/rockpaint/splash.bmp" 133#define SPLASH_SCREEN PLUGIN_APPS_DIR "/rockpaint/splash.bmp"
134#define ROCKPAINT_TITLE_FONT 2 134#define ROCKPAINT_TITLE_FONT 2
135 135
136/*********************************************************************** 136/***********************************************************************
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[];
321#define SOUTH_EAST 2048 321#define SOUTH_EAST 2048
322#define SOUTH_WEST 4096 322#define SOUTH_WEST 4096
323 323
324#define LEVELS_FILE PLUGIN_DIR "/snake2.levels" 324#define LEVELS_FILE PLUGIN_GAMES_DIR "/snake2.levels"
325#define HISCORE_FILE PLUGIN_DIR "/snake2.hs" 325#define HISCORE_FILE PLUGIN_GAMES_DIR "/snake2.hs"
326 326
327int load_all_levels(void) 327int load_all_levels(void)
328{ 328{
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[];
33 33
34#define SOKOBAN_TITLE "Sokoban" 34#define SOKOBAN_TITLE "Sokoban"
35 35
36#define SOKOBAN_LEVELS_FILE PLUGIN_DIR "/sokoban.levels" 36#define SOKOBAN_LEVELS_FILE PLUGIN_GAMES_DIR "/sokoban.levels"
37#define SOKOBAN_SAVE_FILE PLUGIN_DIR "/sokoban.save" 37#define SOKOBAN_SAVE_FILE PLUGIN_GAMES_DIR "/sokoban.save"
38#define SOKOBAN_SAVE_FOLDER "/games" 38#define SOKOBAN_SAVE_FOLDER "/games"
39 39
40/* Magnify is the number of pixels for each block. 40/* 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 */
162#define WRAP_GAP 12 162#define WRAP_GAP 12
163#define EXPLOSION_LENGTH 20 163#define EXPLOSION_LENGTH 20
164#define SHOW_COL 0 164#define SHOW_COL 0
165#define HISCORE_FILE PLUGIN_DIR "/astrorocks.hs" 165#define HISCORE_FILE PLUGIN_GAMES_DIR "/astrorocks.hs"
166#define POINT_SIZE 2 166#define POINT_SIZE 2
167#define MAX_NUM_ASTEROIDS 25 167#define MAX_NUM_ASTEROIDS 25
168#define MAX_NUM_MISSILES 6 168#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 @@
22 22
23#include "plugin.h" 23#include "plugin.h"
24 24
25#define GAME_FILE PLUGIN_DIR "/sudoku.ss" 25#define GAME_FILE PLUGIN_GAMES_DIR "/sudoku.ss"
26 26
27/* variable button definitions */ 27/* variable button definitions */
28#if CONFIG_KEYPAD == RECORDER_PAD 28#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 @@
24 24
25PLUGIN_HEADER 25PLUGIN_HEADER
26 26
27#define SETTINGS_FILE "/.rockbox/viewers/viewer.dat" /* binary file, so dont use .cfg */ 27#define SETTINGS_FILE PLUGIN_APPS_DIR "/viewer.dat" /* binary file, so dont use .cfg */
28#define BOOKMARKS_FILE "/.rockbox/viewers/viewer_bookmarks.dat" 28#define BOOKMARKS_FILE PLUGIN_APPS_DIR "/viewer_bookmarks.dat"
29 29
30#define WRAP_TRIM 44 /* Max number of spaces to trim (arbitrary) */ 30#define WRAP_TRIM 44 /* Max number of spaces to trim (arbitrary) */
31#define MAX_COLUMNS 64 /* Max displayable string len (over-estimate) */ 31#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 @@
1ch8,viewers/chip8,0 1ch8,viewers/chip8,0
2txt,viewers/viewer,1 2txt,viewers/viewer,1
3nfo,viewers/viewer,1 3nfo,viewers/viewer,1
4txt,rocks/text_editor,2 4txt,apps/text_editor,2
5jpg,viewers/jpeg,2 5jpg,viewers/jpeg,2
6jpe,viewers/jpeg,2 6jpe,viewers/jpeg,2
7jpeg,viewers/jpeg,2 7jpeg,viewers/jpeg,2
@@ -17,15 +17,15 @@ m3u,viewers/iriverify,-
17mid,viewers/midiplay,7 17mid,viewers/midiplay,7
18rmi,viewers/midiplay,7 18rmi,viewers/midiplay,7
19rsp,viewers/searchengine,8 19rsp,viewers/searchengine,8
20sok,rocks/sokoban,1 20sok,games/sokoban,1
21pgn,rocks/chessbox,1 21pgn,games/chessbox,1
22ss,rocks/sudoku,1 22ss,games/sudoku,1
23wav,viewers/wav2wv,- 23wav,viewers/wav2wv,-
24wav,viewers/mp3_encoder,- 24wav,viewers/mp3_encoder,-
25wav,viewers/wavplay,10 25wav,viewers/wavplay,10
26wav,viewers/wavview,10 26wav,viewers/wavview,10
27wav,viewers/test_codec,- 27wav,viewers/test_codec,-
28bmp,rocks/rockpaint,11 28bmp,apps/rockpaint,11
29mpg,viewers/mpegplayer,4 29mpg,viewers/mpegplayer,4
30mpeg,viewers/mpegplayer,4 30mpeg,viewers/mpegplayer,4
31iriver,viewers/iriver_flash,3 31iriver,viewers/iriver_flash,3
@@ -34,6 +34,6 @@ sna,viewers/zxbox,12
34tzx,viewers/zxbox,12 34tzx,viewers/zxbox,12
35z80,viewers/zxbox,12 35z80,viewers/zxbox,12
36zzz,viewers/properties,- 36zzz,viewers/properties,-
37colours,rocks/text_editor,11 37colours,apps/text_editor,11
38ssg,rocks/superdom,- 38ssg,games/superdom,-
39link,rocks/shortcuts,- 39link,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)
236} 236}
237 237
238void load_settings(void) { 238void load_settings(void) {
239 int fp = rb->open("/.rockbox/rocks/.vu_meter", O_RDONLY); 239 int fp = rb->open(PLUGIN_DEMOS_DIR "/.vu_meter", O_RDONLY);
240 if(fp>=0) { 240 if(fp>=0) {
241 rb->read(fp, &vumeter_settings, sizeof(struct saved_settings)); 241 rb->read(fp, &vumeter_settings, sizeof(struct saved_settings));
242 rb->close(fp); 242 rb->close(fp);
@@ -252,7 +252,7 @@ void load_settings(void) {
252} 252}
253 253
254void save_settings(void) { 254void save_settings(void) {
255 int fp = rb->creat("/.rockbox/rocks/.vu_meter"); 255 int fp = rb->creat(PLUGIN_DEMOS_DIR "/.vu_meter");
256 if(fp >= 0) { 256 if(fp >= 0) {
257 rb->write (fp, &vumeter_settings, sizeof(struct saved_settings)); 257 rb->write (fp, &vumeter_settings, sizeof(struct saved_settings));
258 rb->close(fp); 258 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
26/* this is the plugin entry point */ 26/* this is the plugin entry point */
27enum plugin_status plugin_start(struct plugin_api* api, void* parameter) 27enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
28{ 28{
29 return run_overlay(api, parameter, "/.rockbox/viewers/zxbox.ovl", "ZXBox"); 29 return run_overlay(api, parameter, PLUGIN_APPS_DIR "/zxbox.ovl", "ZXBox");
30} 30}
31#endif 31#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)
279 bookmark_mrb_load(); 279 bookmark_mrb_load();
280 return GO_TO_PREVIOUS; 280 return GO_TO_PREVIOUS;
281} 281}
282static int plugins_menu(void* param)
283{
284 (void)param;
285 MENUITEM_STRINGLIST(plugins_menu_items, ID2P(LANG_PLUGINS), NULL,
286 ID2P(LANG_PLUGIN_GAMES),
287 ID2P(LANG_PLUGIN_APPS), ID2P(LANG_PLUGIN_DEMOS));
288 char *folder;
289 int retval = GO_TO_PREVIOUS;
290 int selection = 0, current = 0;
291 while (retval == GO_TO_PREVIOUS)
292 {
293 selection = do_menu(&plugins_menu_items, &current);
294 switch (selection)
295 {
296 case 0:
297 folder = PLUGIN_GAMES_DIR;
298 break;
299 case 1:
300 folder = PLUGIN_APPS_DIR;
301 break;
302 case 2:
303 folder = PLUGIN_DEMOS_DIR;
304 break;
305 default:
306 return selection;
307 }
308 retval = rockbox_browse(folder, SHOW_PLUGINS);
309 }
310 return retval;
311}
312
282/* These are all static const'd from apps/menus/ *.c 313/* These are all static const'd from apps/menus/ *.c
283 so little hack so we can use them */ 314 so little hack so we can use them */
284extern struct menu_item_ex 315extern struct menu_item_ex
@@ -308,7 +339,7 @@ static const struct root_items items[] = {
308#endif 339#endif
309 340
310 [GO_TO_RECENTBMARKS] = { load_bmarks, NULL, &bookmark_settings_menu }, 341 [GO_TO_RECENTBMARKS] = { load_bmarks, NULL, &bookmark_settings_menu },
311 [GO_TO_BROWSEPLUGINS] = { browser, (void*)GO_TO_BROWSEPLUGINS, NULL }, 342 [GO_TO_BROWSEPLUGINS] = { plugins_menu, NULL, NULL },
312 343
313}; 344};
314static const int nb_items = sizeof(items)/sizeof(*items); 345static 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 @@
56#define WPS_DIR ROCKBOX_DIR "/wps" 56#define WPS_DIR ROCKBOX_DIR "/wps"
57#define THEME_DIR ROCKBOX_DIR "/themes" 57#define THEME_DIR ROCKBOX_DIR "/themes"
58#define ICON_DIR ROCKBOX_DIR "/icons" 58#define ICON_DIR ROCKBOX_DIR "/icons"
59#define PLUGIN_DIR ROCKBOX_DIR "/rocks" 59
60#define VIEWERS_DIR ROCKBOX_DIR "/viewers" 60#define PLUGIN_DIR ROCKBOX_DIR "/rocks"
61#define PLUGIN_GAMES_DIR PLUGIN_DIR "/games"
62#define PLUGIN_APPS_DIR PLUGIN_DIR "/apps"
63#define PLUGIN_DEMOS_DIR PLUGIN_DIR "/demos"
64#define VIEWERS_DIR PLUGIN_DIR "/viewers"
65
61#define BACKDROP_DIR ROCKBOX_DIR "/backdrops" 66#define BACKDROP_DIR ROCKBOX_DIR "/backdrops"
62#define REC_BASE_DIR "/" 67#define REC_BASE_DIR "/"
63#define EQS_DIR ROCKBOX_DIR "/eqs" 68#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 {
213 213
214 mkdir ".rockbox/langs", 0777; 214 mkdir ".rockbox/langs", 0777;
215 mkdir ".rockbox/rocks", 0777; 215 mkdir ".rockbox/rocks", 0777;
216 mkdir ".rockbox/rocks/games", 0777;
217 mkdir ".rockbox/rocks/apps", 0777;
218 mkdir ".rockbox/rocks/demos", 0777;
219 mkdir ".rockbox/rocks/viewers", 0777;
220
216 if ($recording) { 221 if ($recording) {
217 mkdir ".rockbox/recpresets", 0777; 222 mkdir ".rockbox/recpresets", 0777;
218 } 223 }
@@ -280,7 +285,7 @@ STOP
280 285
281 open VIEWERS, ">.rockbox/viewers.config" or 286 open VIEWERS, ">.rockbox/viewers.config" or
282 die "can't create .rockbox/viewers.config"; 287 die "can't create .rockbox/viewers.config";
283 mkdir ".rockbox/viewers", 0777; 288
284 foreach my $line (@viewers) { 289 foreach my $line (@viewers) {
285 if ($line =~ /([^,]*),([^,]*),/) { 290 if ($line =~ /([^,]*),([^,]*),/) {
286 my ($ext, $plugin)=($1, $2); 291 my ($ext, $plugin)=($1, $2);
@@ -305,7 +310,7 @@ STOP
305 if($dir ne "rocks") { 310 if($dir ne "rocks") {
306 # target is not 'rocks' but the plugins are always in that 311 # target is not 'rocks' but the plugins are always in that
307 # dir at first! 312 # dir at first!
308 `mv .rockbox/rocks/$name .rockbox/$r`; 313 `mv .rockbox/rocks/$name .rockbox/rocks/$r`;
309 } 314 }
310 print VIEWERS $line; 315 print VIEWERS $line;
311 } 316 }
@@ -318,11 +323,22 @@ STOP
318 if(-e ".rockbox/rocks/$oname") { 323 if(-e ".rockbox/rocks/$oname") {
319 # if there's an "overlay" file for the .rock, move that as 324 # if there's an "overlay" file for the .rock, move that as
320 # well 325 # well
321 `mv .rockbox/rocks/$oname .rockbox/$dir`; 326 `mv .rockbox/rocks/$oname .rockbox/rocks/$dir`;
322 } 327 }
323 } 328 }
324 } 329 }
325 close VIEWERS; 330 close VIEWERS;
331
332 open CATEGORIES, "$ROOT/apps/plugins/CATEGORIES" or
333 die "can't open CATEGORIES";
334 @rock_targetdirs = <CATEGORIES>;
335 close CATEGORIES;
336 foreach my $line (@rock_targetdirs) {
337 if ($line =~ /([^,]*),(.*)/) {
338 my ($plugin, $dir)=($1, $2);
339 `mv .rockbox/rocks/${plugin}.rock .rockbox/rocks/$dir 2> /dev/null`;
340 }
341 }
326 342
327 if ($bitmap) { 343 if ($bitmap) {
328 mkdir ".rockbox/icons", 0777; 344 mkdir ".rockbox/icons", 0777;
@@ -335,8 +351,8 @@ STOP
335 `cp $ROOT/apps/tagnavi.config .rockbox/`; 351 `cp $ROOT/apps/tagnavi.config .rockbox/`;
336 352
337 if($bitmap) { 353 if($bitmap) {
338 `cp $ROOT/apps/plugins/sokoban.levels .rockbox/rocks/`; # sokoban levels 354 `cp $ROOT/apps/plugins/sokoban.levels .rockbox/rocks/games/`; # sokoban levels
339 `cp $ROOT/apps/plugins/snake2.levels .rockbox/rocks/`; # snake2 levels 355 `cp $ROOT/apps/plugins/snake2.levels .rockbox/rocks/games/`; # snake2 levels
340 } 356 }
341 357
342 if($image) { 358 if($image) {