summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaurus Cuelenaere <mcuelenaere@gmail.com>2009-10-28 23:31:42 +0000
committerMaurus Cuelenaere <mcuelenaere@gmail.com>2009-10-28 23:31:42 +0000
commitd789e418847a527ffcfb90ed3443fb05efa2da04 (patch)
treefdc0c5a012ead2faed48fe8434167104a4620737
parent97881c1a62612e6fd716bd2feabeb1a333159d0d (diff)
Add support for running Lua games/apps from the Plugins menu
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23390 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/filetree.c13
-rw-r--r--apps/filetypes.c1
-rw-r--r--apps/filetypes.h1
3 files changed, 13 insertions, 2 deletions
diff --git a/apps/filetree.c b/apps/filetree.c
index 3b31358321..945b9ac504 100644
--- a/apps/filetree.c
+++ b/apps/filetree.c
@@ -344,7 +344,8 @@ int ft_load(struct tree_context* c, const char* tempdir)
(*c->dirfilter == SHOW_CFG && (dptr->attr & FILE_ATTR_MASK) != FILE_ATTR_CFG) ||
(*c->dirfilter == SHOW_LNG && (dptr->attr & FILE_ATTR_MASK) != FILE_ATTR_LNG) ||
(*c->dirfilter == SHOW_MOD && (dptr->attr & FILE_ATTR_MASK) != FILE_ATTR_MOD) ||
- (*c->dirfilter == SHOW_PLUGINS && (dptr->attr & FILE_ATTR_MASK) != FILE_ATTR_ROCK))
+ (*c->dirfilter == SHOW_PLUGINS && (dptr->attr & FILE_ATTR_MASK) != FILE_ATTR_ROCK &&
+ (dptr->attr & FILE_ATTR_MASK) != FILE_ATTR_LUA))
{
i--;
continue;
@@ -582,13 +583,21 @@ int ft_enter(struct tree_context* c)
/* plugin file */
case FILE_ATTR_ROCK:
+ case FILE_ATTR_LUA:
{
+ char *plugin = buf, *argument = NULL;
int ret;
+
+ if ((file->attr & FILE_ATTR_MASK) == FILE_ATTR_LUA) {
+ plugin = VIEWERS_DIR "/lua.rock"; /* Use a #define here ? */
+ argument = buf;
+ }
+
if (global_settings.party_mode && audio_status()) {
splash(HZ, ID2P(LANG_PARTY_MODE));
break;
}
- ret = plugin_load(buf,NULL);
+ ret = plugin_load(plugin, argument);
switch (ret)
{
case PLUGIN_GOTO_WPS:
diff --git a/apps/filetypes.c b/apps/filetypes.c
index 2c737ce883..b442a9ec2c 100644
--- a/apps/filetypes.c
+++ b/apps/filetypes.c
@@ -102,6 +102,7 @@ static const struct filetype inbuilt_filetypes[] = {
#endif
{ "lng", FILE_ATTR_LNG, Icon_Language, LANG_LANGUAGE },
{ "rock",FILE_ATTR_ROCK,Icon_Plugin, VOICE_EXT_ROCK },
+ { "lua", FILE_ATTR_LUA, Icon_Plugin, VOICE_EXT_ROCK },
#ifdef HAVE_LCD_BITMAP
{ "fnt", FILE_ATTR_FONT,Icon_Font, VOICE_EXT_FONT },
{ "kbd", FILE_ATTR_KBD, Icon_Keyboard, VOICE_EXT_KBD },
diff --git a/apps/filetypes.h b/apps/filetypes.h
index d3846b03bf..068ec3b259 100644
--- a/apps/filetypes.h
+++ b/apps/filetypes.h
@@ -43,6 +43,7 @@
#define FILE_ATTR_CUE 0x0E00 /* cuesheet file */
#define FILE_ATTR_SBS 0x0F00 /* statusbar file */
#define FILE_ATTR_RSBS 0x1000 /* remote statusbar file */
+#define FILE_ATTR_LUA 0x1100 /* Lua rockbox plugin */
#define FILE_ATTR_MASK 0xFF00 /* which bits tree.c uses for file types */
struct filetype {