Add ability to specify autostart plugin path and argument
rockbox-gerrit-noreply--- via rockbox-cvs <[email protected]>
| Newsgroups | gmane.comp.systems.archos.rockbox.cvs |
|---|---|
| Message-ID | <[email protected]> |
commit 5cf3c6bf9ac612ad0fca58a6d71f3cda0c9bb237 Author: Roman Artiukhin <[email protected]> Date: Mon Feb 16 21:14:38 2026 +0200 Add ability to specify autostart plugin path and argument Extend AUTOROCK define functionality to allow specifying both the autostart plugin path and its argument. Example: #define AUTOROCK VIEWERS_DATA_DIR "/imageviewer.rock" #define AUTOROCK_ARG "/jpegs/sample.jpg" Change-Id: Icc41bceac676e8db17d3a63baefdf96e3023c181 diff --git a/apps/main.c b/apps/main.c index c25847430f..009f2e96ac 100644 --- a/apps/main.c +++ b/apps/main.c @@ -153,7 +153,10 @@ #endif #endif /* SDL */ -/*#define AUTOROCK*/ /* define this to check for "autostart.rock" on boot */ +// #define AUTOROCK /* define this to check for "autostart.rock" on boot */ +/* Alternatively, you can define autostart plugin path and its argument: */ +// #define AUTOROCK VIEWERS_DATA_DIR"/imageviewer.rock" +// #define AUTOROCK_ARG "/jpegs/sample.jpg" static void init(void); /* main(), and various functions called by main() and init() may be @@ -214,17 +217,25 @@ int main(void) #ifdef AUTOROCK { - char filename[MAX_PATH]; - const char *file = + const char *file = ""AUTOROCK; + file = *file + ? file + : #ifdef APPLICATION ROCKBOX_DIR #else PLUGIN_APPS_DIR #endif "/autostart.rock"; - if(file_exists(file)) /* no complaint if it doesn't exist */ + if (file_exists(file)) /* no complaint if it doesn't exist */ { - plugin_load(file, NULL); /* start if it does */ + plugin_load(file, +#ifdef AUTOROCK_ARG + AUTOROCK_ARG +#else + NULL +#endif + ); /* start if it does */ } } #endif /* #ifdef AUTOROCK */ -- rockbox-cvs mailing list [email protected] https://lists.haxx.se/mailman/listinfo/rockbox-cvs