Open Plugins search by langids

On language change Stored plugins may fail to run due
to hashing on lang dependent string

allows searching by langid when the supplied key is LANG_PTR

Fixes error on hash flush where previous entry was not restored

Adds routine to update file in-place (for ATA targets)
Other targets make a temp file to copy entries

breaking changes:
ROCKBOXDIR is no longer hashed since
/.rockbox directory may soon be able to be changed
packed attribute added to op data structure -- oops

Change-Id: Ieead26609559b9c5bdadc6a95227cb2bfbb9f71c
This commit is contained in:
William Wilgus 2021-10-13 23:45:00 -04:00
parent 6fb942d8ff
commit 15ee740060
3 changed files with 214 additions and 82 deletions

View file

@ -32,17 +32,28 @@
#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_NOT_FOUND = (-1),
OPEN_PLUGIN_NEEDS_FLUSHED = (-2)
};
struct open_plugin_entry_t
{
/* hash and lang_id need to be the first items */
uint32_t hash;
int32_t lang_id;
char name[OPEN_PLUGIN_NAMESZ+1];
/*char key[OPEN_PLUGIN_BUFSZ+1];*/
char path[OPEN_PLUGIN_BUFSZ+1];
char param[OPEN_PLUGIN_BUFSZ+1];
};
}__attribute__((packed));
inline static void open_plugin_get_hash(const char *key, uint32_t *hash)
{