forked from len0rd/rockbox
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
This commit is contained in:
parent
5b76936a44
commit
fda7d720c0
29 changed files with 266 additions and 72 deletions
|
|
@ -119,7 +119,6 @@ void tree_get_filetypes(const struct filetype** types, int* count)
|
||||||
|
|
||||||
struct file_type {
|
struct file_type {
|
||||||
int icon; /* the icon which shall be used for it, NOICON if unknown */
|
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 */
|
unsigned char attr; /* FILETYPES_MASK >> 8 */
|
||||||
char* plugin; /* Which plugin to use, NULL if unknown, or builtin */
|
char* plugin; /* Which plugin to use, NULL if unknown, or builtin */
|
||||||
char* extension; /* NULL for none */
|
char* extension; /* NULL for none */
|
||||||
|
|
@ -289,7 +288,6 @@ static void read_config(char* config_file)
|
||||||
{
|
{
|
||||||
char line[64], *s, *e;
|
char line[64], *s, *e;
|
||||||
char extension[8], plugin[32];
|
char extension[8], plugin[32];
|
||||||
bool viewer;
|
|
||||||
int fd = open(config_file, O_RDONLY);
|
int fd = open(config_file, O_RDONLY);
|
||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
return;
|
return;
|
||||||
|
|
@ -314,24 +312,15 @@ static void read_config(char* config_file)
|
||||||
|
|
||||||
/* get the plugin */
|
/* get the plugin */
|
||||||
s = e+1;
|
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, ',');
|
e = strchr(s, ',');
|
||||||
if (!e)
|
if (!e)
|
||||||
continue;
|
continue;
|
||||||
*e = '\0';
|
*e = '\0';
|
||||||
|
|
||||||
strcpy(plugin, s);
|
strcpy(plugin, s);
|
||||||
/* ok, store this plugin/extension, check icon after */
|
/* ok, store this plugin/extension, check icon after */
|
||||||
filetypes[filetype_count].extension = filetypes_strdup(extension);
|
filetypes[filetype_count].extension = filetypes_strdup(extension);
|
||||||
filetypes[filetype_count].plugin = filetypes_strdup(plugin);
|
filetypes[filetype_count].plugin = filetypes_strdup(plugin);
|
||||||
filetypes[filetype_count].viewer = viewer;
|
|
||||||
filetypes[filetype_count].attr = heighest_attr +1;
|
filetypes[filetype_count].attr = heighest_attr +1;
|
||||||
filetypes[filetype_count].icon = Icon_Questionmark;
|
filetypes[filetype_count].icon = Icon_Questionmark;
|
||||||
heighest_attr++;
|
heighest_attr++;
|
||||||
|
|
@ -422,8 +411,7 @@ char* filetype_get_plugin(const struct entry* file)
|
||||||
if (filetypes[index].plugin == NULL)
|
if (filetypes[index].plugin == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
snprintf(plugin_name, MAX_PATH, "%s/%s.%s",
|
snprintf(plugin_name, MAX_PATH, "%s/%s.%s",
|
||||||
filetypes[index].viewer? VIEWERS_DIR: PLUGIN_DIR,
|
PLUGIN_DIR, filetypes[index].plugin, ROCK_EXTENSION);
|
||||||
filetypes[index].plugin, ROCK_EXTENSION);
|
|
||||||
return plugin_name;
|
return plugin_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10962,4 +10962,45 @@
|
||||||
*: "of"
|
*: "of"
|
||||||
</voice>
|
</voice>
|
||||||
</phrase>
|
</phrase>
|
||||||
|
<phrase>
|
||||||
|
id: LANG_PLUGIN_GAMES
|
||||||
|
desc: in the main menu
|
||||||
|
user:
|
||||||
|
<source>
|
||||||
|
*: "Games"
|
||||||
|
</source>
|
||||||
|
<dest>
|
||||||
|
*: "Games"
|
||||||
|
</dest>
|
||||||
|
<voice>
|
||||||
|
*: "Games"
|
||||||
|
</voice>
|
||||||
|
</phrase>
|
||||||
|
<phrase>
|
||||||
|
id: LANG_PLUGIN_APPS
|
||||||
|
desc: in the main menu
|
||||||
|
user:
|
||||||
|
<source>
|
||||||
|
*: "Applications"
|
||||||
|
</source>
|
||||||
|
<dest>
|
||||||
|
*: "Applications"
|
||||||
|
</dest>
|
||||||
|
<voice>
|
||||||
|
*: "Applications"
|
||||||
|
</voice>
|
||||||
|
</phrase>
|
||||||
|
<phrase>
|
||||||
|
id: LANG_PLUGIN_DEMOS
|
||||||
|
desc: in the main menu
|
||||||
|
user:
|
||||||
|
<source>
|
||||||
|
*: "Demos"
|
||||||
|
</source>
|
||||||
|
<dest>
|
||||||
|
*: "Demos"
|
||||||
|
</dest>
|
||||||
|
<voice>
|
||||||
|
*: "Demos"
|
||||||
|
</voice>
|
||||||
|
</phrase>
|
||||||
|
|
|
||||||
|
|
@ -116,7 +116,7 @@ MAKE_MENU(manage_settings, ID2P(LANG_MANAGE_MENU), NULL, Icon_Config,
|
||||||
|
|
||||||
static bool show_credits(void)
|
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 the rockbox logo and version untill a button is pressed */
|
||||||
show_logo();
|
show_logo();
|
||||||
|
|
|
||||||
|
|
@ -64,6 +64,8 @@ static int plugin_size = 0;
|
||||||
static bool (*pfn_tsr_exit)(bool reenter) = NULL; /* TSR exit callback */
|
static bool (*pfn_tsr_exit)(bool reenter) = NULL; /* TSR exit callback */
|
||||||
static char current_plugin[MAX_PATH];
|
static char current_plugin[MAX_PATH];
|
||||||
|
|
||||||
|
char *plugin_get_current_filename(void);
|
||||||
|
|
||||||
extern struct thread_entry threads[MAXTHREADS];
|
extern struct thread_entry threads[MAXTHREADS];
|
||||||
|
|
||||||
static const struct plugin_api rockbox_api = {
|
static const struct plugin_api rockbox_api = {
|
||||||
|
|
@ -125,6 +127,7 @@ static const struct plugin_api rockbox_api = {
|
||||||
font_get,
|
font_get,
|
||||||
font_getstringsize,
|
font_getstringsize,
|
||||||
font_get_width,
|
font_get_width,
|
||||||
|
screen_clear_area,
|
||||||
#endif
|
#endif
|
||||||
backlight_on,
|
backlight_on,
|
||||||
backlight_off,
|
backlight_off,
|
||||||
|
|
@ -445,6 +448,7 @@ static const struct plugin_api rockbox_api = {
|
||||||
plugin_get_buffer,
|
plugin_get_buffer,
|
||||||
plugin_get_audio_buffer,
|
plugin_get_audio_buffer,
|
||||||
plugin_tsr,
|
plugin_tsr,
|
||||||
|
plugin_get_current_filename,
|
||||||
#ifdef IRAM_STEAL
|
#ifdef IRAM_STEAL
|
||||||
plugin_iram_init,
|
plugin_iram_init,
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -471,6 +475,8 @@ static const struct plugin_api rockbox_api = {
|
||||||
#endif
|
#endif
|
||||||
show_logo,
|
show_logo,
|
||||||
tree_get_context,
|
tree_get_context,
|
||||||
|
set_current_file,
|
||||||
|
set_dirfilter,
|
||||||
|
|
||||||
#ifdef HAVE_WHEEL_POSITION
|
#ifdef HAVE_WHEEL_POSITION
|
||||||
wheel_status,
|
wheel_status,
|
||||||
|
|
@ -494,13 +500,8 @@ static const struct plugin_api rockbox_api = {
|
||||||
codec_load_file,
|
codec_load_file,
|
||||||
get_codec_filename,
|
get_codec_filename,
|
||||||
get_metadata,
|
get_metadata,
|
||||||
#endif
|
|
||||||
#ifdef HAVE_LCD_BITMAP
|
|
||||||
screen_clear_area,
|
|
||||||
#endif
|
#endif
|
||||||
led,
|
led,
|
||||||
set_current_file,
|
|
||||||
set_dirfilter,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
int plugin_load(const char* plugin, void* parameter)
|
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 */
|
pfn_tsr_exit = exit_callback; /* remember the callback for later */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char *plugin_get_current_filename(void)
|
||||||
|
{
|
||||||
|
return current_plugin;
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -112,12 +112,12 @@
|
||||||
#define PLUGIN_MAGIC 0x526F634B /* RocK */
|
#define PLUGIN_MAGIC 0x526F634B /* RocK */
|
||||||
|
|
||||||
/* increase this every time the api struct changes */
|
/* 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
|
/* update this to latest version if a change to the api struct breaks
|
||||||
backwards compatibility (and please take the opportunity to sort in any
|
backwards compatibility (and please take the opportunity to sort in any
|
||||||
new function which are "waiting" at the end of the function table) */
|
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 */
|
/* plugin return codes */
|
||||||
enum plugin_status {
|
enum plugin_status {
|
||||||
|
|
@ -204,6 +204,8 @@ struct plugin_api {
|
||||||
int (*font_getstringsize)(const unsigned char *str, int *w, int *h,
|
int (*font_getstringsize)(const unsigned char *str, int *w, int *h,
|
||||||
int fontnumber);
|
int fontnumber);
|
||||||
int (*font_get_width)(struct font* pf, unsigned short char_code);
|
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
|
#endif
|
||||||
void (*backlight_on)(void);
|
void (*backlight_on)(void);
|
||||||
void (*backlight_off)(void);
|
void (*backlight_off)(void);
|
||||||
|
|
@ -555,6 +557,7 @@ struct plugin_api {
|
||||||
void* (*plugin_get_buffer)(size_t *buffer_size);
|
void* (*plugin_get_buffer)(size_t *buffer_size);
|
||||||
void* (*plugin_get_audio_buffer)(size_t *buffer_size);
|
void* (*plugin_get_audio_buffer)(size_t *buffer_size);
|
||||||
void (*plugin_tsr)(bool (*exit_callback)(bool reenter));
|
void (*plugin_tsr)(bool (*exit_callback)(bool reenter));
|
||||||
|
char* (*plugin_get_current_filename)(void);
|
||||||
#ifdef IRAM_STEAL
|
#ifdef IRAM_STEAL
|
||||||
void (*plugin_iram_init)(char *iramstart, char *iramcopy, size_t iram_size,
|
void (*plugin_iram_init)(char *iramstart, char *iramcopy, size_t iram_size,
|
||||||
char *iedata, size_t iedata_size);
|
char *iedata, size_t iedata_size);
|
||||||
|
|
@ -590,6 +593,8 @@ struct plugin_api {
|
||||||
#endif
|
#endif
|
||||||
int (*show_logo)(void);
|
int (*show_logo)(void);
|
||||||
struct tree_context* (*tree_get_context)(void);
|
struct tree_context* (*tree_get_context)(void);
|
||||||
|
void (*set_current_file)(char* path);
|
||||||
|
void (*set_dirfilter)(int l_dirfilter);
|
||||||
|
|
||||||
#ifdef HAVE_WHEEL_POSITION
|
#ifdef HAVE_WHEEL_POSITION
|
||||||
int (*wheel_status)(void);
|
int (*wheel_status)(void);
|
||||||
|
|
@ -614,14 +619,8 @@ struct plugin_api {
|
||||||
const char *(*get_codec_filename)(int cod_spec);
|
const char *(*get_codec_filename)(int cod_spec);
|
||||||
bool (*get_metadata)(struct track_info* track, int fd, const char* trackname,
|
bool (*get_metadata)(struct track_info* track, int fd, const char* trackname,
|
||||||
bool v1first);
|
bool v1first);
|
||||||
#endif
|
|
||||||
#ifdef HAVE_LCD_BITMAP
|
|
||||||
void (*screen_clear_area)(struct screen * display, int xstart, int ystart,
|
|
||||||
int width, int height);
|
|
||||||
#endif
|
#endif
|
||||||
void (*led)(bool on);
|
void (*led)(bool on);
|
||||||
void (*set_current_file)(char* path);
|
|
||||||
void (*set_dirfilter)(int l_dirfilter);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* plugin header */
|
/* plugin header */
|
||||||
|
|
|
||||||
91
apps/plugins/CATEGORIES
Normal file
91
apps/plugins/CATEGORIES
Normal file
|
|
@ -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
|
||||||
|
|
@ -24,8 +24,8 @@
|
||||||
PLUGIN_HEADER
|
PLUGIN_HEADER
|
||||||
|
|
||||||
/* save files */
|
/* save files */
|
||||||
#define SCORE_FILE PLUGIN_DIR "/blackjack.score"
|
#define SCORE_FILE PLUGIN_GAMES_DIR "/blackjack.score"
|
||||||
#define SAVE_FILE PLUGIN_DIR "/blackjack.save"
|
#define SAVE_FILE PLUGIN_GAMES_DIR "/blackjack.save"
|
||||||
|
|
||||||
#define NUM_SCORES LCD_HEIGHT/8-2
|
#define NUM_SCORES LCD_HEIGHT/8-2
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -30,8 +30,8 @@
|
||||||
PLUGIN_HEADER
|
PLUGIN_HEADER
|
||||||
|
|
||||||
/* files */
|
/* files */
|
||||||
#define SCORE_FILE PLUGIN_DIR "/bubbles.score"
|
#define SCORE_FILE PLUGIN_GAMES_DIR "/bubbles.score"
|
||||||
#define SAVE_FILE PLUGIN_DIR "/bubbles.save"
|
#define SAVE_FILE PLUGIN_GAMES_DIR "/bubbles.save"
|
||||||
|
|
||||||
/* final game return status */
|
/* final game return status */
|
||||||
#define BB_NONE 5
|
#define BB_NONE 5
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,6 @@ PLUGIN_HEADER
|
||||||
/* this is the plugin entry point */
|
/* this is the plugin entry point */
|
||||||
enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
|
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
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -241,7 +241,7 @@ PLUGIN_HEADER
|
||||||
#define YOFS ((LCD_HEIGHT-8*TILE_HEIGHT)/2)
|
#define YOFS ((LCD_HEIGHT-8*TILE_HEIGHT)/2)
|
||||||
|
|
||||||
/* save files */
|
/* save files */
|
||||||
#define SAVE_FILE PLUGIN_DIR "/chessbox.save"
|
#define SAVE_FILE PLUGIN_GAMES_DIR "/chessbox.save"
|
||||||
|
|
||||||
/* commands enum */
|
/* commands enum */
|
||||||
#define COMMAND_NOP 0
|
#define COMMAND_NOP 0
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,7 @@ struct clock_settings{
|
||||||
extern struct clock_settings clock_settings;
|
extern struct clock_settings clock_settings;
|
||||||
|
|
||||||
/* settings are saved to this location */
|
/* 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_next(struct clock_settings* settings);
|
||||||
void clock_settings_skin_previous(struct clock_settings* settings);
|
void clock_settings_skin_previous(struct clock_settings* settings);
|
||||||
|
|
|
||||||
|
|
@ -559,7 +559,7 @@ unsigned char fire_sprite[FIRE_HEIGHT] = {
|
||||||
#define TARGET_BOTTOM 3
|
#define TARGET_BOTTOM 3
|
||||||
#define TARGET_UFO 4
|
#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
|
/* The time (in ms) for one iteration through the game loop - decrease this
|
||||||
|
|
|
||||||
|
|
@ -178,8 +178,8 @@ PLUGIN_HEADER
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* save files */
|
/* save files */
|
||||||
#define SCORE_FILE PLUGIN_DIR "/jewels.score"
|
#define SCORE_FILE PLUGIN_GAMES_DIR "/jewels.score"
|
||||||
#define SAVE_FILE PLUGIN_DIR "/jewels.save"
|
#define SAVE_FILE PLUGIN_GAMES_DIR "/jewels.save"
|
||||||
|
|
||||||
/* final game return status */
|
/* final game return status */
|
||||||
#define BJ_QUIT_FROM_GAME 4
|
#define BJ_QUIT_FROM_GAME 4
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,23 @@ void configfile_init(struct plugin_api* newrb)
|
||||||
cfg_rb = 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 configfile_save(const char *filename, struct configdata *cfg,
|
||||||
int num_items, int version)
|
int num_items, int version)
|
||||||
{
|
{
|
||||||
|
|
@ -33,7 +50,7 @@ int configfile_save(const char *filename, struct configdata *cfg,
|
||||||
int i;
|
int i;
|
||||||
char buf[MAX_PATH];
|
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);
|
fd = cfg_rb->creat(buf);
|
||||||
if(fd < 0)
|
if(fd < 0)
|
||||||
return fd*10 - 1;
|
return fd*10 - 1;
|
||||||
|
|
@ -78,7 +95,7 @@ int configfile_load(const char *filename, struct configdata *cfg,
|
||||||
int file_version = -1;
|
int file_version = -1;
|
||||||
int tmp;
|
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);
|
fd = cfg_rb->open(buf, O_RDONLY);
|
||||||
if(fd < 0)
|
if(fd < 0)
|
||||||
return fd*10 - 1;
|
return fd*10 - 1;
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
#include "plugin.h"
|
#include "plugin.h"
|
||||||
|
|
||||||
#define GAME_FILE PLUGIN_DIR "/reversi.rev"
|
#define GAME_FILE PLUGIN_GAMES_DIR "/reversi.rev"
|
||||||
|
|
||||||
/* variable button definitions */
|
/* variable button definitions */
|
||||||
#if CONFIG_KEYPAD == RECORDER_PAD
|
#if CONFIG_KEYPAD == RECORDER_PAD
|
||||||
|
|
|
||||||
|
|
@ -477,7 +477,7 @@ figures[BLOCKS_NUM] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Rockbox File System only supports full filenames inc dir */
|
/* 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
|
#define MAX_HIGH_SCORES 5
|
||||||
/* Default High Scores... */
|
/* Default High Scores... */
|
||||||
struct highscore Highest[MAX_HIGH_SCORES];
|
struct highscore Highest[MAX_HIGH_SCORES];
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,6 @@ PLUGIN_HEADER
|
||||||
/* this is the plugin entry point */
|
/* this is the plugin entry point */
|
||||||
enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
|
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
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -130,7 +130,7 @@ PLUGIN_HEADER
|
||||||
#define COLOR_BROWN LCD_RGBPACK(128,64,0)
|
#define COLOR_BROWN LCD_RGBPACK(128,64,0)
|
||||||
#define COLOR_LIGHTBROWN LCD_RGBPACK(255,128,64)
|
#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
|
#define ROCKPAINT_TITLE_FONT 2
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
|
|
|
||||||
|
|
@ -321,8 +321,8 @@ extern const unsigned char snake2_bottom[];
|
||||||
#define SOUTH_EAST 2048
|
#define SOUTH_EAST 2048
|
||||||
#define SOUTH_WEST 4096
|
#define SOUTH_WEST 4096
|
||||||
|
|
||||||
#define LEVELS_FILE PLUGIN_DIR "/snake2.levels"
|
#define LEVELS_FILE PLUGIN_GAMES_DIR "/snake2.levels"
|
||||||
#define HISCORE_FILE PLUGIN_DIR "/snake2.hs"
|
#define HISCORE_FILE PLUGIN_GAMES_DIR "/snake2.hs"
|
||||||
|
|
||||||
int load_all_levels(void)
|
int load_all_levels(void)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -33,8 +33,8 @@ extern const fb_data sokoban_tiles[];
|
||||||
|
|
||||||
#define SOKOBAN_TITLE "Sokoban"
|
#define SOKOBAN_TITLE "Sokoban"
|
||||||
|
|
||||||
#define SOKOBAN_LEVELS_FILE PLUGIN_DIR "/sokoban.levels"
|
#define SOKOBAN_LEVELS_FILE PLUGIN_GAMES_DIR "/sokoban.levels"
|
||||||
#define SOKOBAN_SAVE_FILE PLUGIN_DIR "/sokoban.save"
|
#define SOKOBAN_SAVE_FILE PLUGIN_GAMES_DIR "/sokoban.save"
|
||||||
#define SOKOBAN_SAVE_FOLDER "/games"
|
#define SOKOBAN_SAVE_FOLDER "/games"
|
||||||
|
|
||||||
/* Magnify is the number of pixels for each block.
|
/* Magnify is the number of pixels for each block.
|
||||||
|
|
|
||||||
|
|
@ -162,7 +162,7 @@ static struct plugin_api* rb; /* global api struct pointer */
|
||||||
#define WRAP_GAP 12
|
#define WRAP_GAP 12
|
||||||
#define EXPLOSION_LENGTH 20
|
#define EXPLOSION_LENGTH 20
|
||||||
#define SHOW_COL 0
|
#define SHOW_COL 0
|
||||||
#define HISCORE_FILE PLUGIN_DIR "/astrorocks.hs"
|
#define HISCORE_FILE PLUGIN_GAMES_DIR "/astrorocks.hs"
|
||||||
#define POINT_SIZE 2
|
#define POINT_SIZE 2
|
||||||
#define MAX_NUM_ASTEROIDS 25
|
#define MAX_NUM_ASTEROIDS 25
|
||||||
#define MAX_NUM_MISSILES 6
|
#define MAX_NUM_MISSILES 6
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
#include "plugin.h"
|
#include "plugin.h"
|
||||||
|
|
||||||
#define GAME_FILE PLUGIN_DIR "/sudoku.ss"
|
#define GAME_FILE PLUGIN_GAMES_DIR "/sudoku.ss"
|
||||||
|
|
||||||
/* variable button definitions */
|
/* variable button definitions */
|
||||||
#if CONFIG_KEYPAD == RECORDER_PAD
|
#if CONFIG_KEYPAD == RECORDER_PAD
|
||||||
|
|
|
||||||
|
|
@ -24,8 +24,8 @@
|
||||||
|
|
||||||
PLUGIN_HEADER
|
PLUGIN_HEADER
|
||||||
|
|
||||||
#define SETTINGS_FILE "/.rockbox/viewers/viewer.dat" /* binary file, so dont use .cfg */
|
#define SETTINGS_FILE PLUGIN_APPS_DIR "/viewer.dat" /* binary file, so dont use .cfg */
|
||||||
#define BOOKMARKS_FILE "/.rockbox/viewers/viewer_bookmarks.dat"
|
#define BOOKMARKS_FILE PLUGIN_APPS_DIR "/viewer_bookmarks.dat"
|
||||||
|
|
||||||
#define WRAP_TRIM 44 /* Max number of spaces to trim (arbitrary) */
|
#define WRAP_TRIM 44 /* Max number of spaces to trim (arbitrary) */
|
||||||
#define MAX_COLUMNS 64 /* Max displayable string len (over-estimate) */
|
#define MAX_COLUMNS 64 /* Max displayable string len (over-estimate) */
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
ch8,viewers/chip8,0
|
ch8,viewers/chip8,0
|
||||||
txt,viewers/viewer,1
|
txt,viewers/viewer,1
|
||||||
nfo,viewers/viewer,1
|
nfo,viewers/viewer,1
|
||||||
txt,rocks/text_editor,2
|
txt,apps/text_editor,2
|
||||||
jpg,viewers/jpeg,2
|
jpg,viewers/jpeg,2
|
||||||
jpe,viewers/jpeg,2
|
jpe,viewers/jpeg,2
|
||||||
jpeg,viewers/jpeg,2
|
jpeg,viewers/jpeg,2
|
||||||
|
|
@ -17,15 +17,15 @@ m3u,viewers/iriverify,-
|
||||||
mid,viewers/midiplay,7
|
mid,viewers/midiplay,7
|
||||||
rmi,viewers/midiplay,7
|
rmi,viewers/midiplay,7
|
||||||
rsp,viewers/searchengine,8
|
rsp,viewers/searchengine,8
|
||||||
sok,rocks/sokoban,1
|
sok,games/sokoban,1
|
||||||
pgn,rocks/chessbox,1
|
pgn,games/chessbox,1
|
||||||
ss,rocks/sudoku,1
|
ss,games/sudoku,1
|
||||||
wav,viewers/wav2wv,-
|
wav,viewers/wav2wv,-
|
||||||
wav,viewers/mp3_encoder,-
|
wav,viewers/mp3_encoder,-
|
||||||
wav,viewers/wavplay,10
|
wav,viewers/wavplay,10
|
||||||
wav,viewers/wavview,10
|
wav,viewers/wavview,10
|
||||||
wav,viewers/test_codec,-
|
wav,viewers/test_codec,-
|
||||||
bmp,rocks/rockpaint,11
|
bmp,apps/rockpaint,11
|
||||||
mpg,viewers/mpegplayer,4
|
mpg,viewers/mpegplayer,4
|
||||||
mpeg,viewers/mpegplayer,4
|
mpeg,viewers/mpegplayer,4
|
||||||
iriver,viewers/iriver_flash,3
|
iriver,viewers/iriver_flash,3
|
||||||
|
|
@ -34,6 +34,6 @@ sna,viewers/zxbox,12
|
||||||
tzx,viewers/zxbox,12
|
tzx,viewers/zxbox,12
|
||||||
z80,viewers/zxbox,12
|
z80,viewers/zxbox,12
|
||||||
zzz,viewers/properties,-
|
zzz,viewers/properties,-
|
||||||
colours,rocks/text_editor,11
|
colours,apps/text_editor,11
|
||||||
ssg,rocks/superdom,-
|
ssg,games/superdom,-
|
||||||
link,rocks/shortcuts,-
|
link,viewers/shortcuts,-
|
||||||
|
|
|
||||||
|
|
@ -236,7 +236,7 @@ void calc_scales(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
void load_settings(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) {
|
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);
|
||||||
|
|
@ -252,7 +252,7 @@ void load_settings(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void save_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) {
|
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);
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,6 @@ PLUGIN_HEADER
|
||||||
/* this is the plugin entry point */
|
/* this is the plugin entry point */
|
||||||
enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
|
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
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -279,6 +279,37 @@ static int load_bmarks(void* param)
|
||||||
bookmark_mrb_load();
|
bookmark_mrb_load();
|
||||||
return GO_TO_PREVIOUS;
|
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
|
/* These are all static const'd from apps/menus/ *.c
|
||||||
so little hack so we can use them */
|
so little hack so we can use them */
|
||||||
extern struct menu_item_ex
|
extern struct menu_item_ex
|
||||||
|
|
@ -308,7 +339,7 @@ static const struct root_items items[] = {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
[GO_TO_RECENTBMARKS] = { load_bmarks, NULL, &bookmark_settings_menu },
|
[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);
|
static const int nb_items = sizeof(items)/sizeof(*items);
|
||||||
|
|
|
||||||
|
|
@ -56,8 +56,13 @@
|
||||||
#define WPS_DIR ROCKBOX_DIR "/wps"
|
#define WPS_DIR ROCKBOX_DIR "/wps"
|
||||||
#define THEME_DIR ROCKBOX_DIR "/themes"
|
#define THEME_DIR ROCKBOX_DIR "/themes"
|
||||||
#define ICON_DIR ROCKBOX_DIR "/icons"
|
#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 BACKDROP_DIR ROCKBOX_DIR "/backdrops"
|
||||||
#define REC_BASE_DIR "/"
|
#define REC_BASE_DIR "/"
|
||||||
#define EQS_DIR ROCKBOX_DIR "/eqs"
|
#define EQS_DIR ROCKBOX_DIR "/eqs"
|
||||||
|
|
|
||||||
|
|
@ -213,6 +213,11 @@ sub buildzip {
|
||||||
|
|
||||||
mkdir ".rockbox/langs", 0777;
|
mkdir ".rockbox/langs", 0777;
|
||||||
mkdir ".rockbox/rocks", 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) {
|
if ($recording) {
|
||||||
mkdir ".rockbox/recpresets", 0777;
|
mkdir ".rockbox/recpresets", 0777;
|
||||||
}
|
}
|
||||||
|
|
@ -280,7 +285,7 @@ STOP
|
||||||
|
|
||||||
open VIEWERS, ">.rockbox/viewers.config" or
|
open VIEWERS, ">.rockbox/viewers.config" or
|
||||||
die "can't create .rockbox/viewers.config";
|
die "can't create .rockbox/viewers.config";
|
||||||
mkdir ".rockbox/viewers", 0777;
|
|
||||||
foreach my $line (@viewers) {
|
foreach my $line (@viewers) {
|
||||||
if ($line =~ /([^,]*),([^,]*),/) {
|
if ($line =~ /([^,]*),([^,]*),/) {
|
||||||
my ($ext, $plugin)=($1, $2);
|
my ($ext, $plugin)=($1, $2);
|
||||||
|
|
@ -305,7 +310,7 @@ STOP
|
||||||
if($dir ne "rocks") {
|
if($dir ne "rocks") {
|
||||||
# target is not 'rocks' but the plugins are always in that
|
# target is not 'rocks' but the plugins are always in that
|
||||||
# dir at first!
|
# dir at first!
|
||||||
`mv .rockbox/rocks/$name .rockbox/$r`;
|
`mv .rockbox/rocks/$name .rockbox/rocks/$r`;
|
||||||
}
|
}
|
||||||
print VIEWERS $line;
|
print VIEWERS $line;
|
||||||
}
|
}
|
||||||
|
|
@ -318,11 +323,22 @@ STOP
|
||||||
if(-e ".rockbox/rocks/$oname") {
|
if(-e ".rockbox/rocks/$oname") {
|
||||||
# if there's an "overlay" file for the .rock, move that as
|
# if there's an "overlay" file for the .rock, move that as
|
||||||
# well
|
# well
|
||||||
`mv .rockbox/rocks/$oname .rockbox/$dir`;
|
`mv .rockbox/rocks/$oname .rockbox/rocks/$dir`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
close VIEWERS;
|
close VIEWERS;
|
||||||
|
|
||||||
|
open CATEGORIES, "$ROOT/apps/plugins/CATEGORIES" or
|
||||||
|
die "can't open CATEGORIES";
|
||||||
|
@rock_targetdirs = <CATEGORIES>;
|
||||||
|
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) {
|
if ($bitmap) {
|
||||||
mkdir ".rockbox/icons", 0777;
|
mkdir ".rockbox/icons", 0777;
|
||||||
|
|
@ -335,8 +351,8 @@ STOP
|
||||||
`cp $ROOT/apps/tagnavi.config .rockbox/`;
|
`cp $ROOT/apps/tagnavi.config .rockbox/`;
|
||||||
|
|
||||||
if($bitmap) {
|
if($bitmap) {
|
||||||
`cp $ROOT/apps/plugins/sokoban.levels .rockbox/rocks/`; # sokoban levels
|
`cp $ROOT/apps/plugins/sokoban.levels .rockbox/rocks/games/`; # sokoban levels
|
||||||
`cp $ROOT/apps/plugins/snake2.levels .rockbox/rocks/`; # snake2 levels
|
`cp $ROOT/apps/plugins/snake2.levels .rockbox/rocks/games/`; # snake2 levels
|
||||||
}
|
}
|
||||||
|
|
||||||
if($image) {
|
if($image) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue