From ef7739160b0d1d1c125d4d753827ce7b4216b171 Mon Sep 17 00:00:00 2001 From: William Wilgus Date: Sun, 8 Feb 2026 13:58:36 -0500 Subject: [PATCH] [BugFix] open_plugins allow more than one entry with a plugin / parameter you should be able to have multiple parameters to a single plugin you can do this from outsid the plugin, but not from within the plugin this makes it possible to have several entries with the same plugin and a different parameter for each entry it now also updates the name of the entry to the name of the parameter instead of the name of the plugin (unless user edited it) Change-Id: Ifb52b21e3b8ed3257364635b5d92e7c21a35a199 --- apps/plugins/open_plugins.c | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/apps/plugins/open_plugins.c b/apps/plugins/open_plugins.c index c7007b1bd0..edf4273a3c 100644 --- a/apps/plugins/open_plugins.c +++ b/apps/plugins/open_plugins.c @@ -176,12 +176,18 @@ static void op_entry_set_checksum(void) (op_entry.lang_id <= OPEN_PLUGIN_LANG_INVALID ? 0 : LANG_LAST_INDEX_IN_ARRAY); } -static void op_entry_set_name(void) +static bool op_entry_set_name(void) { char tmp_buf[OPEN_PLUGIN_NAMESZ+1]; rb->strlcpy(tmp_buf, op_entry.name, OPEN_PLUGIN_NAMESZ); + uint32_t crc = rb->crc_32(tmp_buf, sizeof(tmp_buf), 0xffffffff); + if (rb->kbd_input(tmp_buf, OPEN_PLUGIN_NAMESZ, NULL) >= 0) + { rb->strlcpy(op_entry.name, tmp_buf, OPEN_PLUGIN_NAMESZ); + return crc != rb->crc_32(tmp_buf, sizeof(tmp_buf), 0xffffffff); + } + return false; } static int op_entry_set_path(void) @@ -392,10 +398,10 @@ static uint32_t op_entry_add_path(const char *key, const char *plugin, const cha rb->strlcpy(op_entry.param, parameter, OPEN_PLUGIN_BUFSZ); /* hash on the parameter path if it is a file */ - if (op_entry.lang_id <0 && key == op_entry.path && + if (op_entry.lang_id <0 && (key == op_entry.path || key == NULL) && rb->file_exists(op_entry.param)) { - open_plugin_get_hash(op_entry.path, &newhash); + open_plugin_get_hash(op_entry.param, &newhash); op_entry.hash = newhash; } } @@ -692,6 +698,7 @@ static void edit_menu(int selection) { int selected_item; bool exit = false; + bool name_set = false; int action = 0; if (!op_entry_read(fd_dat, selection, op_entry_sz)) @@ -713,11 +720,22 @@ static void edit_menu(int selection) { case ACTION_STD_OK: if (selected_item == 0) - op_entry_set_name(); + { + name_set = op_entry_set_name(); + } else if (selected_item == 2) op_entry_set_path(); else if (selected_item == 4) + { op_entry_set_param(); + /* if user already set the name they probably don't want us to change it */ + if (!name_set && op_entry.lang_id < 0 && rb->file_exists(op_entry.param)) + { + char *slash=strrchr(op_entry.param, '/'); + if(slash) + rb->strlcpy(op_entry.name, slash+1, OPEN_PLUGIN_NAMESZ); + } + } else exit = true;