summaryrefslogtreecommitdiffstats
path: root/apps/open_plugin.h
diff options
context:
space:
mode:
Diffstat (limited to 'apps/open_plugin.h')
-rw-r--r--apps/open_plugin.h31
1 files changed, 28 insertions, 3 deletions
diff --git a/apps/open_plugin.h b/apps/open_plugin.h
index 9f20d7ffda..847a834c0c 100644
--- a/apps/open_plugin.h
+++ b/apps/open_plugin.h
@@ -32,33 +32,58 @@
#ifndef __PCTOOL__
/* open_plugin path lookup */
#define OPEN_PLUGIN_DAT PLUGIN_DIR "/plugin.dat"
+#define OPEN_RBPLUGIN_DAT PLUGIN_DIR "/rb_plugins.dat"
#define OPEN_PLUGIN_BUFSZ MAX_PATH
#define OPEN_PLUGIN_NAMESZ 32
+
+enum {
+ OPEN_PLUGIN_LANG_INVALID = (-1),
+ OPEN_PLUGIN_LANG_IGNORE = (-2),
+ OPEN_PLUGIN_LANG_IGNOREALL = (-3),
+ OPEN_PLUGIN_INVALID_ENTRY = (-1),
+ OPEN_PLUGIN_NOT_FOUND = (-2),
+ OPEN_PLUGIN_NEEDS_FLUSHED = (-3),
+};
+
struct open_plugin_entry_t
{
+/* hash lang_id checksum need to be the first items */
uint32_t hash;
int32_t lang_id;
+ uint32_t checksum;
char name[OPEN_PLUGIN_NAMESZ+1];
/*char key[OPEN_PLUGIN_BUFSZ+1];*/
char path[OPEN_PLUGIN_BUFSZ+1];
char param[OPEN_PLUGIN_BUFSZ+1];
};
+#define OPEN_PLUGIN_CHECKSUM (uint32_t) \
+( \
+ (sizeof(struct open_plugin_entry_t) << 16) + \
+ offsetof(struct open_plugin_entry_t, hash) + \
+ offsetof(struct open_plugin_entry_t, lang_id) + \
+ offsetof(struct open_plugin_entry_t, checksum) + \
+ offsetof(struct open_plugin_entry_t, name) + \
+ offsetof(struct open_plugin_entry_t, path) + \
+ offsetof(struct open_plugin_entry_t, param))
+
+#define OPEN_PLUGIN_SEED 0x811C9DC5; //seed, 2166136261;
inline static void open_plugin_get_hash(const char *key, uint32_t *hash)
{
/* Calculate modified FNV1a hash of string */
const uint32_t p = 16777619;
- *hash = 0x811C9DC5; //seed, 2166136261;
+ *hash = OPEN_PLUGIN_SEED;
while(*key)
*hash = (*key++ ^ *hash) * p;
}
#ifndef PLUGIN
-extern struct open_plugin_entry_t open_plugin_entry;
+struct open_plugin_entry_t* open_plugin_get_entry(void);
uint32_t open_plugin_add_path(const char *key, const char *plugin, const char *parameter);
-int open_plugin_get_entry(const char *key, struct open_plugin_entry_t *entry);
+int open_plugin_load_entry(const char *key);
void open_plugin_browse(const char *key);
int open_plugin_run(const char *key);
+void open_plugin_cache_flush(void); /* flush to disk */
#endif
#endif /*ndef __PCTOOL__ */