Index: apps/plugins/CATEGORIES
===================================================================
--- apps/plugins/CATEGORIES	(revision 16290)
+++ apps/plugins/CATEGORIES	(working copy)
@@ -1,3 +1,4 @@
+settings_dumper,apps
 autostart,apps
 matrix,demos
 alpine_cdc,apps
Index: apps/plugins/settings_dumper.c
===================================================================
--- apps/plugins/settings_dumper.c	(revision 0)
+++ apps/plugins/settings_dumper.c	(revision 0)
@@ -0,0 +1,140 @@
+/***************************************************************************
+ *             __________               __   ___.
+ *   Open      \______   \ ____   ____ |  | _\_ |__   _______  ___
+ *   Source     |       _//  _ \_/ ___\|  |/ /| __ \ /  _ \  \/  /
+ *   Jukebox    |    |   (  <_> )  \___|    < | \_\ (  <_> > <  <
+ *   Firmware   |____|_  /\____/ \___  >__|_ \|___  /\____/__/\_ \
+ *                     \/            \/     \/    \/            \/
+ * $Id: helloworld.c 12807 2007-03-16 21:56:08Z amiconn $
+ *
+ * Copyright (C) 2002 Bj�rn Stenberg
+ *
+ * All files in this archive are subject to the GNU General Public License.
+ * See the file COPYING in the source tree root for full license agreement.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+#include "plugin.h"
+
+/* welcome to the example rockbox plugin */
+
+/* This macros must always be included. Should be placed at the top by
+   convention, although the actual position doesn't matter */
+PLUGIN_HEADER
+
+/* here is a global api struct pointer. while not strictly necessary,
+   it's nice not to have to pass the api pointer in all function calls
+   in the plugin */
+static struct plugin_api* rb;
+
+/* this is the plugin entry point */
+enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
+{
+    const struct settings_list *settings, *s;
+    int count;
+    int fd, i;
+    
+    /* if you don't use the parameter, you can do like
+       this to avoid the compiler warning about it */
+    (void)parameter;
+
+    /* if you are using a global api pointer, don't forget to copy it!
+       otherwise you will get lovely "I04: IllInstr" errors... :-) */
+    rb = api;
+    fd = rb->open("/settings.xml", O_CREAT|O_WRONLY|O_TRUNC);
+    if (fd < 0)
+        return PLUGIN_ERROR;
+    settings = rb->get_settings(&count);
+    
+    rb->fdprintf(fd, "<settings>\n");
+    for (i=0;i<count;i++)
+    {
+        s = &settings[i];
+        if ((s->flags&F_T_SOUND) == F_T_SOUND)
+        {
+            rb->fdprintf(fd, "\t<setting name=\"%s\" type=\"sound\" />\n",
+                         s->cfg_name);
+        }
+        else if ((s->flags&F_BOOL_SETTING) == F_BOOL_SETTING)
+        {
+            char def[32];
+            if (s->default_val.int_ == 0)
+                rb->strcpy(def, "off");
+            else rb->strcpy(def, "on");
+                
+            rb->fdprintf(fd, "\t<setting name=\"%s\" type=\"enum\" default=\"%s\">\n"
+                             "\t\t<option>%s</option>\n"
+                             "\t\t<option>%s</option>\n"
+                             "\t</setting>\n",
+                             s->cfg_name, def, "on", "off");
+        }
+        else if ((s->flags&F_T_UCHARPTR) == F_T_UCHARPTR)
+        {
+            rb->fdprintf(fd, "\t<setting name=\"%s\" type=\"filename\" default=\"%s\" ",
+                             s->cfg_name, s->default_val.charptr);
+            /*
+            if (s->filename_setting->prefix)
+                rb->fdprintf(fd, "prefix=\"%s\" ", s->filename_setting->prefix);
+            if (s->filename_setting->suffix)
+                rb->fdprintf(fd, "suffix=\"%s\" ", s->filename_setting->suffix);
+            */
+            rb->fdprintf(fd, "max_length=\"%d\" />\n", s->filename_setting->max_len);
+        }
+        else if ((s->flags&F_RGB) == F_RGB)
+        {
+            rb->fdprintf(fd, "\t<setting name=\"%s\" type=\"color\" default=\"%06x\">\n",
+                             s->cfg_name, s->default_val.int_&0x00ffffff);
+            
+        }
+        else if ((s->flags&F_CHOICE_SETTING) == F_CHOICE_SETTING)
+        {
+            int j = 0;
+            char temp[512], *start, *e, *items[128];
+            rb->strcpy(temp, s->cfg_vals);
+            start = temp;
+            while (start)
+            {
+                items[j] = start;
+                e = rb->strchr(start, ',');
+                if (e)
+                {
+                    *e = '\0';
+                    start = e+1;
+                }
+                else break;
+                j++;
+            }
+            rb->fdprintf(fd, "\t<setting name=\"%s\" type=\"enum\" default=\"%s\">\n",
+                             s->cfg_name, items[s->default_val.int_]);
+            for (j=0;j<s->choice_setting->count;j++)
+            {
+                rb->fdprintf(fd, "\t\t<option>%s</option>\n", items[j]);
+            }
+            rb->fdprintf(fd, "\t</setting>\n");
+        }
+        else if ((s->flags&F_INT_SETTING) == F_INT_SETTING)
+        {
+            rb->fdprintf(fd, "\t<setting name=\"%s\" type=\"int\" default=\"%d\" min=\"%d\" max=\"%d\" step=\"%d\" />\n",
+                         s->cfg_name, s->default_val.int_, s->int_setting->min,
+                         s->int_setting->max, s->int_setting->step);
+        }
+        else if ((s->flags&F_TABLE_SETTING) == F_TABLE_SETTING)
+        {
+            int j;
+            rb->fdprintf(fd, "\t<setting name=\"%s\" type=\"enum\" default=\"%d\">\n",
+                         s->cfg_name, s->default_val.int_);
+            for (j=0;j<s->table_setting->count;j++)
+            {
+                rb->fdprintf(fd, "\t\t<option>%d</option>\n", s->table_setting->values[j]);
+            }
+            rb->fdprintf(fd, "\t</setting>\n");
+        }
+    }
+    rb->fdprintf(fd, "</settings>\n");
+    rb->close(fd);
+    
+    
+    return PLUGIN_OK;
+}
Index: apps/plugins/SOURCES
===================================================================
--- apps/plugins/SOURCES	(revision 16290)
+++ apps/plugins/SOURCES	(working copy)
@@ -1,5 +1,5 @@
 #if !defined(OLYMPUS_MROBE_100) && !defined(COWON_D2)
-
+settings_dumper.c
 /* plugins common to all models */
 battery_bench.c
 chessclock.c
Index: apps/settings_list.c
===================================================================
--- apps/settings_list.c	(revision 16290)
+++ apps/settings_list.c	(working copy)
@@ -1188,7 +1188,23 @@

 const int nb_settings = sizeof(settings)/sizeof(*settings);
+
+const struct settings_list* get_settings(int *count)
+{
+    *count = nb_settings;
+    return settings;
+}
Index: apps/plugin.c
===================================================================
--- apps/plugin.c	(revision 16290)
+++ apps/plugin.c	(working copy)
@@ -66,7 +66,7 @@
 static char current_plugin[MAX_PATH];
 
 char *plugin_get_current_filename(void);
-
+const struct settings_list* get_settings(int *count);
 extern struct thread_entry threads[MAXTHREADS];
 
 static const struct plugin_api rockbox_api = {
@@ -592,6 +592,7 @@
     dsp_configure,
     dsp_process,
 #endif /* CONFIG_CODEC == SWCODEC */
+    get_settings,
 };
 
 int plugin_load(const char* plugin, void* parameter)
Index: apps/plugin.h
===================================================================
--- apps/plugin.h	(revision 16290)
+++ apps/plugin.h	(working copy)
@@ -80,6 +80,7 @@
 #include "color_picker.h"
 #include "buffering.h"
 #include "tagcache.h"
+#include "settings_list.h"
 
 #ifdef HAVE_ALBUMART
 #include "albumart.h"
@@ -731,6 +732,7 @@
     int (*dsp_process)(struct dsp_config *dsp, char *dest,
                        const char *src[], int count);
 #endif /* CONFIG_CODEC == SWCODEC */
+    const struct settings_list* (*get_settings)(int *count);
 };
 
 /* plugin header */
