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
This commit is contained in:
Maurus Cuelenaere 2009-10-28 23:31:42 +00:00
parent 97881c1a62
commit d789e41884
3 changed files with 13 additions and 2 deletions

View file

@ -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:

View file

@ -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 },

View file

@ -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 {