summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorWilliam Wilgus <wilgus.william@gmail.com>2022-12-10 02:44:04 -0500
committerWilliam Wilgus <me.theuser@yahoo.com>2022-12-16 09:05:06 -0500
commit6f54bb63fc1f0da06330806321fbba50b1364907 (patch)
tree28ac6750b6df247f5020b81f92bb5efe664af952 /apps
parent626be18da0bd3774164ef85d21268e89fd7aa682 (diff)
downloadrockbox-6f54bb63fc1f0da06330806321fbba50b1364907.tar.gz
rockbox-6f54bb63fc1f0da06330806321fbba50b1364907.zip
open_plugin.c access open_plugin_entry through a function
just a few updates to open_plugin save a bit of space by granting access through a getter function Change-Id: I2c0eaa1ade867510798b213006064ee1c00aa016
Diffstat (limited to 'apps')
-rw-r--r--apps/open_plugin.c144
-rw-r--r--apps/open_plugin.h5
-rw-r--r--apps/root_menu.c17
3 files changed, 108 insertions, 58 deletions
diff --git a/apps/open_plugin.c b/apps/open_plugin.c
index 58c3058fce..49d727b4c9 100644
--- a/apps/open_plugin.c
+++ b/apps/open_plugin.c
@@ -32,11 +32,9 @@
32#include "logf.h" 32#include "logf.h"
33 33
34#define ROCK_EXT "rock" 34#define ROCK_EXT "rock"
35#define ROCK_LEN 5 35#define ROCK_LEN sizeof(ROCK_EXT)
36#define OP_EXT "opx" 36#define OP_EXT "opx"
37#define OP_LEN 4 37#define OP_LEN sizeof(OP_EXT)
38
39struct open_plugin_entry_t open_plugin_entry = {0};
40 38
41static const uint32_t open_plugin_csum = OPEN_PLUGIN_CHECKSUM; 39static const uint32_t open_plugin_csum = OPEN_PLUGIN_CHECKSUM;
42 40
@@ -44,7 +42,7 @@ static const int op_entry_sz = sizeof(struct open_plugin_entry_t);
44 42
45static const char* strip_rockbox_root(const char *path) 43static const char* strip_rockbox_root(const char *path)
46{ 44{
47 int dlen = strlen(ROCKBOX_DIR); 45 int dlen = ROCKBOX_DIR_LEN;
48 if (strncmp(path, ROCKBOX_DIR, dlen) == 0) 46 if (strncmp(path, ROCKBOX_DIR, dlen) == 0)
49 path+= dlen; 47 path+= dlen;
50 return path; 48 return path;
@@ -55,11 +53,14 @@ static inline void op_clear_entry(struct open_plugin_entry_t *entry)
55 if (entry == NULL) 53 if (entry == NULL)
56 return; 54 return;
57 memset(entry, 0, op_entry_sz); 55 memset(entry, 0, op_entry_sz);
58 entry->lang_id = -1; 56 entry->lang_id = OPEN_PLUGIN_LANG_INVALID;
59} 57}
60 58
61static int op_entry_checksum(struct open_plugin_entry_t *entry) 59static int op_entry_checksum(struct open_plugin_entry_t *entry)
62{ 60{
61/*Note: since we use langids as checksums everytime someone moves the lang file
62* around it could mess with our indexing so invalidate entries when this occurs
63*/
63 if (entry == NULL || entry->checksum != open_plugin_csum + 64 if (entry == NULL || entry->checksum != open_plugin_csum +
64 (entry->lang_id <= OPEN_PLUGIN_LANG_INVALID ? 0 : LANG_LAST_INDEX_IN_ARRAY)) 65 (entry->lang_id <= OPEN_PLUGIN_LANG_INVALID ? 0 : LANG_LAST_INDEX_IN_ARRAY))
65 { 66 {
@@ -117,7 +118,7 @@ static int op_find_entry(int fd, struct open_plugin_entry_t *entry,
117#endif 118#endif
118 (ret > OPEN_PLUGIN_NOT_FOUND && op_entry_checksum(entry) <= 0)) 119 (ret > OPEN_PLUGIN_NOT_FOUND && op_entry_checksum(entry) <= 0))
119 { 120 {
120 splash(HZ * 2, "OpenPlugin Invalid entry"); 121 splashf(HZ * 2, "%s Invalid entry", str(LANG_OPEN_PLUGIN));
121 ret = OPEN_PLUGIN_NOT_FOUND; 122 ret = OPEN_PLUGIN_NOT_FOUND;
122 } 123 }
123 if (ret == OPEN_PLUGIN_NOT_FOUND) 124 if (ret == OPEN_PLUGIN_NOT_FOUND)
@@ -215,7 +216,7 @@ static int op_update_dat(struct open_plugin_entry_t *entry, bool clear)
215 return 0; 216 return 0;
216} 217}
217 218
218static int op_get_entry(uint32_t hash, int32_t lang_id, 219static int op_load_entry(uint32_t hash, int32_t lang_id,
219 struct open_plugin_entry_t *entry, const char *dat_file) 220 struct open_plugin_entry_t *entry, const char *dat_file)
220{ 221{
221 int opret = OPEN_PLUGIN_NOT_FOUND; 222 int opret = OPEN_PLUGIN_NOT_FOUND;
@@ -238,7 +239,8 @@ static int op_get_entry(uint32_t hash, int32_t lang_id,
238 } 239 }
239 240
240 /* if another entry is loaded; flush it to disk before we destroy it */ 241 /* if another entry is loaded; flush it to disk before we destroy it */
241 op_update_dat(&open_plugin_entry, true); 242
243 op_update_dat(open_plugin_get_entry(), true);
242 244
243 logf("OP get_entry hash: %x lang id: %d db: %s", hash, lang_id, dat_file); 245 logf("OP get_entry hash: %x lang id: %d db: %s", hash, lang_id, dat_file);
244 246
@@ -252,17 +254,41 @@ static int op_get_entry(uint32_t hash, int32_t lang_id,
252 return opret; 254 return opret;
253} 255}
254 256
257/******************************************************************************/
258/******************************************************************************/
259/* ************************************************************************** */
260/* * PUBLIC INTERFACE FUNCTIONS * *********************************************/
261/* ************************************************************************** */
262/******************************************************************************/
263/******************************************************************************/
264
265/* open_plugin_get_entry()
266* returns the internal open_plugin_entry
267*/
268struct open_plugin_entry_t * open_plugin_get_entry(void)
269{
270 /* holds entry data to load/run/store */
271 static struct open_plugin_entry_t open_plugin_entry = {0};
272 return &open_plugin_entry;
273}
274
275/* open_plugin_add_path()
276* adds a plugin path and calling parameters to open_plugin_entry
277* hash of the key is created for later recall of the plugin path and parameters
278* returns hash of the key or 0 on error
279*/
255uint32_t open_plugin_add_path(const char *key, const char *plugin, const char *parameter) 280uint32_t open_plugin_add_path(const char *key, const char *plugin, const char *parameter)
256{ 281{
257 int len; 282 size_t len;
258 uint32_t hash; 283 uint32_t hash;
259 int32_t lang_id; 284 int32_t lang_id;
260 char *pos = "\0"; 285 char *pos = "\0";
286 struct open_plugin_entry_t *op_entry = open_plugin_get_entry();
261 287
262 if(key == NULL) 288 if(key == NULL)
263 { 289 {
264 logf("OP add_path No Key, *Clearing entry*"); 290 logf("OP add_path No Key, *Clearing entry*");
265 op_clear_entry(&open_plugin_entry); 291 op_clear_entry(op_entry);
266 return 0; 292 return 0;
267 } 293 }
268 294
@@ -271,37 +297,37 @@ uint32_t open_plugin_add_path(const char *key, const char *plugin, const char *p
271 logf("OP add_path key: %s lang id: %d", skey, lang_id); 297 logf("OP add_path key: %s lang id: %d", skey, lang_id);
272 open_plugin_get_hash(strip_rockbox_root(skey), &hash); 298 open_plugin_get_hash(strip_rockbox_root(skey), &hash);
273 299
274 if(open_plugin_entry.hash != hash) 300 if(op_entry->hash != hash)
275 { 301 {
276 logf("OP add_path *Flush entry*"); 302 logf("OP add_path *Flush entry*");
277 /* the entry in ram needs saved */ 303 /* the entry in ram needs saved */
278 op_update_dat(&open_plugin_entry, true); 304 op_update_dat(op_entry, true);
279 } 305 }
280 306
281 if (plugin) 307 if (plugin)
282 { 308 {
283 open_plugin_entry.hash = hash; 309 op_entry->hash = hash;
284 open_plugin_entry.lang_id = lang_id; 310 op_entry->lang_id = lang_id;
285 open_plugin_entry.checksum = open_plugin_csum + 311 op_entry->checksum = open_plugin_csum +
286 (lang_id <= OPEN_PLUGIN_LANG_INVALID ? 0 : LANG_LAST_INDEX_IN_ARRAY); 312 (lang_id <= OPEN_PLUGIN_LANG_INVALID ? 0 : LANG_LAST_INDEX_IN_ARRAY);
287 /* name */ 313 /* name */
288 if (path_basename(plugin, (const char **)&pos) == 0) 314 if (path_basename(plugin, (const char **)&pos) == 0)
289 pos = "\0"; 315 pos = "\0";
290 316
291 len = strlcpy(open_plugin_entry.name, pos, OPEN_PLUGIN_NAMESZ); 317 len = strlcpy(op_entry->name, pos, OPEN_PLUGIN_NAMESZ);
292 if (len > ROCK_LEN && strcasecmp(&(pos[len-ROCK_LEN]), "." ROCK_EXT) == 0) 318 if (len > ROCK_LEN && strcasecmp(&(pos[len-ROCK_LEN]), "." ROCK_EXT) == 0)
293 { 319 {
294 /* path */ 320 /* path */
295 strmemccpy(open_plugin_entry.path, plugin, OPEN_PLUGIN_BUFSZ); 321 strmemccpy(op_entry->path, plugin, OPEN_PLUGIN_BUFSZ);
296 322
297 if(!parameter) 323 if(!parameter)
298 parameter = ""; 324 parameter = "";
299 strmemccpy(open_plugin_entry.param, parameter, OPEN_PLUGIN_BUFSZ); 325 strmemccpy(op_entry->param, parameter, OPEN_PLUGIN_BUFSZ);
300 goto retnhash; 326 goto retnhash;
301 } 327 }
302 else if (len > OP_LEN && strcasecmp(&(pos[len-OP_LEN]), "." OP_EXT) == 0) 328 else if (len > OP_LEN && strcasecmp(&(pos[len-OP_LEN]), "." OP_EXT) == 0)
303 { 329 {
304 op_get_entry(0, OPEN_PLUGIN_LANG_IGNORE, &open_plugin_entry, plugin); 330 op_load_entry(0, OPEN_PLUGIN_LANG_IGNORE, op_entry, plugin);
305 goto retnhash; 331 goto retnhash;
306 } 332 }
307 } 333 }
@@ -309,33 +335,37 @@ uint32_t open_plugin_add_path(const char *key, const char *plugin, const char *p
309 logf("OP add_path Invalid, *Clearing entry*"); 335 logf("OP add_path Invalid, *Clearing entry*");
310 if (lang_id != LANG_SHORTCUTS) /* from shortcuts menu */ 336 if (lang_id != LANG_SHORTCUTS) /* from shortcuts menu */
311 splashf(HZ * 2, str(LANG_OPEN_PLUGIN_NOT_A_PLUGIN), pos); 337 splashf(HZ * 2, str(LANG_OPEN_PLUGIN_NOT_A_PLUGIN), pos);
312 op_clear_entry(&open_plugin_entry); 338 op_clear_entry(op_entry);
313 hash = 0; 339 hash = 0;
314 340
315retnhash: 341retnhash:
316 logf("OP add_path name: %s %s %s", 342 logf("OP add_path name: %s %s %s",
317 open_plugin_entry.name, 343 op_entry->name, op_entry->path, op_entry->param);
318 open_plugin_entry.path,
319 open_plugin_entry.param);
320 return hash; 344 return hash;
321} 345}
322 346
347/* open_plugin_browse()
348* allows fthe user to browse for a plugin to set to a supplied key
349* if key is a lang_id that is used otherwise a hash of the key is created
350* for later recall of the plugin path
351*/
323void open_plugin_browse(const char *key) 352void open_plugin_browse(const char *key)
324{ 353{
325 logf("OP browse"); 354 logf("%s", __func__);
326 struct browse_context browse; 355 struct browse_context browse;
327 char tmp_buf[OPEN_PLUGIN_BUFSZ+1]; 356 char tmp_buf[OPEN_PLUGIN_BUFSZ+1];
328 open_plugin_get_entry(key, &open_plugin_entry); 357 open_plugin_load_entry(key);
358 struct open_plugin_entry_t *op_entry = open_plugin_get_entry();
329 359
330 logf("OP browse key: %s name: %s", 360 logf("OP browse key: %s name: %s",
331 (key ? P2STR((unsigned char *)key):"No Key") ,open_plugin_entry.name); 361 (key ? P2STR((unsigned char *)key):"No Key"), open_plugin_entry.name);
332 logf("OP browse %s %s", open_plugin_entry.path, open_plugin_entry.param); 362 logf("OP browse %s %s", op_entry->path, op_entry->param);
333 363
334 if (open_plugin_entry.path[0] == '\0') 364 if (op_entry->path[0] == '\0')
335 strcpy(open_plugin_entry.path, PLUGIN_DIR"/"); 365 strcpy(op_entry->path, PLUGIN_DIR"/");
336 366
337 browse_context_init(&browse, SHOW_ALL, BROWSE_SELECTONLY, "", 367 browse_context_init(&browse, SHOW_ALL, BROWSE_SELECTONLY, "",
338 Icon_Plugin, open_plugin_entry.path, NULL); 368 Icon_Plugin, op_entry->path, NULL);
339 369
340 browse.buf = tmp_buf; 370 browse.buf = tmp_buf;
341 browse.bufsize = OPEN_PLUGIN_BUFSZ; 371 browse.bufsize = OPEN_PLUGIN_BUFSZ;
@@ -344,45 +374,59 @@ void open_plugin_browse(const char *key)
344 open_plugin_add_path(key, tmp_buf, NULL); 374 open_plugin_add_path(key, tmp_buf, NULL);
345} 375}
346 376
347int open_plugin_get_entry(const char *key, struct open_plugin_entry_t *entry) 377/* open_plugin_load_entry()
378* recall of the plugin path and parameters based on supplied key
379* returns the index in OPEN_PLUGIN_DAT where the entry was found (>= 0)
380* if the entry was found but has not been saved returns OPEN_PLUGIN_NEEDS_FLUSHED
381* otherwise returns OPEN_PLUGIN_NOT_FOUND (< 0) if key was not found
382*/
383int open_plugin_load_entry(const char *key)
348{ 384{
349 if (key == NULL || entry == NULL) 385 if (key == NULL)
350 return OPEN_PLUGIN_NOT_FOUND; 386 key = ID2P(LANG_OPEN_PLUGIN_NOT_A_PLUGIN); /* won't be found */
387
388 struct open_plugin_entry_t *op_entry = open_plugin_get_entry();
351 int opret; 389 int opret;
352 uint32_t hash = 0; 390 uint32_t hash = 0;
353 int32_t lang_id = P2ID((unsigned char *)key); 391 int32_t lang_id = P2ID((unsigned char *)key);
354 const char* skey = P2STR((unsigned char *)key); /* string|LANGPTR => string */ 392 const char* skey = P2STR((unsigned char *)key); /* string|LANGPTR => string */
355 393
394 /*Note: P2ID() returns -1 if key isnt a valid lang_id */
356 if (lang_id <= OPEN_PLUGIN_LANG_INVALID) 395 if (lang_id <= OPEN_PLUGIN_LANG_INVALID)
357 open_plugin_get_hash(strip_rockbox_root(skey), &hash); /* in open_plugin.h */ 396 open_plugin_get_hash(strip_rockbox_root(skey), &hash); /* in open_plugin.h */
358 397
359 opret = op_get_entry(hash, lang_id, entry, OPEN_PLUGIN_DAT); 398 opret = op_load_entry(hash, lang_id, op_entry, OPEN_PLUGIN_DAT);
360 logf("OP entry hash: %x lang id: %d ret: %d key: %s", hash, lang_id, opret, skey); 399 logf("OP entry hash: %x lang id: %d ret: %d key: %s", hash, lang_id, opret, skey);
361 400
362 if (opret == OPEN_PLUGIN_NOT_FOUND && lang_id > OPEN_PLUGIN_LANG_INVALID) 401 if (opret == OPEN_PLUGIN_NOT_FOUND && lang_id > OPEN_PLUGIN_LANG_INVALID)
363 { /* try rb defaults */ 402 { /* try rb defaults */
364 opret = op_get_entry(hash, lang_id, entry, OPEN_RBPLUGIN_DAT); 403 opret = op_load_entry(hash, lang_id, op_entry, OPEN_RBPLUGIN_DAT);
365 logf("OP rb_entry hash: %x lang id: %d ret: %d key: %s", hash, lang_id, opret, skey); 404 logf("OP rb_entry hash: %x lang id: %d ret: %d key: %s", hash, lang_id, opret, skey);
366 /* add to the user plugin.dat file if found */ 405 /* add to the user plugin.dat file if found */
367 op_update_dat(entry, false); 406 op_update_dat(op_entry, false);
368 407
369 } 408 }
370 logf("OP entry ret: %s", (opret == OPEN_PLUGIN_NOT_FOUND ? "Not Found":"Found")); 409 logf("OP entry ret: %s", (opret == OPEN_PLUGIN_NOT_FOUND ? "Not Found":"Found"));
371 return opret; 410 return opret;
372} 411}
373 412
413/* open_plugin_run()
414* recall of the plugin path and parameters based on supplied key
415* runs the plugin using plugin_load see plugin_load for return values
416*/
374int open_plugin_run(const char *key) 417int open_plugin_run(const char *key)
375{ 418{
376 int ret = 0; 419 int ret = 0;
377 int opret = open_plugin_get_entry(key, &open_plugin_entry); 420 int opret = open_plugin_load_entry(key);
421 struct open_plugin_entry_t *op_entry = open_plugin_get_entry();
378 if (opret == OPEN_PLUGIN_NEEDS_FLUSHED) 422 if (opret == OPEN_PLUGIN_NEEDS_FLUSHED)
379 op_update_dat(&open_plugin_entry, false); 423 op_update_dat(op_entry, false);
380 const char *path = open_plugin_entry.path; 424 const char *path = op_entry->path;
381 const char *param = open_plugin_entry.param; 425 const char *param = op_entry->param;
382 426
383 logf("OP run key: %s ret: %d name: %s", 427 logf("OP run key: %s ret: %d name: %s",
384 (key ? P2STR((unsigned char *)key):"No Key"), opret, open_plugin_entry.name); 428 (key ? P2STR((unsigned char *)key):"No Key"), opret, op_entry->name);
385 logf("OP run: %s %s %s", open_plugin_entry.name, path, param); 429 logf("OP run: %s %s %s", op_entry->name, path, param);
386 430
387 if (param[0] == '\0') 431 if (param[0] == '\0')
388 param = NULL; 432 param = NULL;
@@ -392,24 +436,28 @@ int open_plugin_run(const char *key)
392 ret = plugin_load(path, param); 436 ret = plugin_load(path, param);
393 437
394 if (ret != GO_TO_PLUGIN) 438 if (ret != GO_TO_PLUGIN)
395 op_clear_entry(&open_plugin_entry); 439 op_clear_entry(op_entry);
396 440
397 return ret; 441 return ret;
398} 442}
399 443
444/* open_plugin_cache_flush()
445* saves the current open_plugin_entry to disk
446*/
400void open_plugin_cache_flush(void) 447void open_plugin_cache_flush(void)
401{ 448{
402 logf("OP *cache flush*"); 449 logf("%s", __func__);
450 struct open_plugin_entry_t *op_entry = open_plugin_get_entry();
403 /* start_in_screen == 0 is 'Previous Screen' it is actually 451 /* start_in_screen == 0 is 'Previous Screen' it is actually
404 * defined as (GO_TO_PREVIOUS = -2) + 2 for *Legacy?* reasons AFAICT */ 452 * defined as (GO_TO_PREVIOUS = -2) + 2 for *Legacy?* reasons AFAICT */
405 if (global_settings.start_in_screen == 0 && 453 if (global_settings.start_in_screen == 0 &&
406 global_status.last_screen == GO_TO_PLUGIN && 454 global_status.last_screen == GO_TO_PLUGIN &&
407 open_plugin_entry.lang_id > OPEN_PLUGIN_LANG_INVALID) 455 op_entry->lang_id > OPEN_PLUGIN_LANG_INVALID)
408 { 456 {
409 /* flush the last item as LANG_PREVIOUS_SCREEN if the user wants to resume */ 457 /* flush the last item as LANG_PREVIOUS_SCREEN if the user wants to resume */
410 open_plugin_entry.lang_id = LANG_PREVIOUS_SCREEN; 458 op_entry->lang_id = LANG_PREVIOUS_SCREEN;
411 } 459 }
412 op_update_dat(&open_plugin_entry, true); 460 op_update_dat(op_entry, true);
413} 461}
414 462
415#endif /* ndef __PCTOOL__ */ 463#endif /* ndef __PCTOOL__ */
diff --git a/apps/open_plugin.h b/apps/open_plugin.h
index 62e3662849..847a834c0c 100644
--- a/apps/open_plugin.h
+++ b/apps/open_plugin.h
@@ -64,7 +64,6 @@ struct open_plugin_entry_t
64 offsetof(struct open_plugin_entry_t, lang_id) + \ 64 offsetof(struct open_plugin_entry_t, lang_id) + \
65 offsetof(struct open_plugin_entry_t, checksum) + \ 65 offsetof(struct open_plugin_entry_t, checksum) + \
66 offsetof(struct open_plugin_entry_t, name) + \ 66 offsetof(struct open_plugin_entry_t, name) + \
67 /*offsetof(struct open_plugin_entry_t, key)+*/ \
68 offsetof(struct open_plugin_entry_t, path) + \ 67 offsetof(struct open_plugin_entry_t, path) + \
69 offsetof(struct open_plugin_entry_t, param)) 68 offsetof(struct open_plugin_entry_t, param))
70 69
@@ -79,9 +78,9 @@ inline static void open_plugin_get_hash(const char *key, uint32_t *hash)
79} 78}
80 79
81#ifndef PLUGIN 80#ifndef PLUGIN
82extern struct open_plugin_entry_t open_plugin_entry; 81struct open_plugin_entry_t* open_plugin_get_entry(void);
83uint32_t open_plugin_add_path(const char *key, const char *plugin, const char *parameter); 82uint32_t open_plugin_add_path(const char *key, const char *plugin, const char *parameter);
84int open_plugin_get_entry(const char *key, struct open_plugin_entry_t *entry); 83int open_plugin_load_entry(const char *key);
85void open_plugin_browse(const char *key); 84void open_plugin_browse(const char *key);
86int open_plugin_run(const char *key); 85int open_plugin_run(const char *key);
87void open_plugin_cache_flush(void); /* flush to disk */ 86void open_plugin_cache_flush(void); /* flush to disk */
diff --git a/apps/root_menu.c b/apps/root_menu.c
index 89afae8c25..49e579903f 100644
--- a/apps/root_menu.c
+++ b/apps/root_menu.c
@@ -760,9 +760,11 @@ static int load_plugin_screen(char *key)
760 760
761 while(loops-- > 0) /* just to keep things from getting out of hand */ 761 while(loops-- > 0) /* just to keep things from getting out of hand */
762 { 762 {
763 int opret = open_plugin_get_entry(key, &open_plugin_entry); 763
764 char *path = open_plugin_entry.path; 764 int opret = open_plugin_load_entry(key);
765 char *param = open_plugin_entry.param; 765 struct open_plugin_entry_t *op_entry = open_plugin_get_entry();
766 char *path = op_entry->path;
767 char *param = op_entry->param;
766 if (param[0] == '\0') 768 if (param[0] == '\0')
767 param = NULL; 769 param = NULL;
768 if (path[0] == '\0' && key) 770 if (path[0] == '\0' && key)
@@ -792,8 +794,8 @@ static int load_plugin_screen(char *key)
792 if (opret != OPEN_PLUGIN_NEEDS_FLUSHED || last_screen != GO_TO_WPS) 794 if (opret != OPEN_PLUGIN_NEEDS_FLUSHED || last_screen != GO_TO_WPS)
793 { 795 {
794 /* Keep the entry in case of GO_TO_PREVIOUS */ 796 /* Keep the entry in case of GO_TO_PREVIOUS */
795 open_plugin_entry.hash = 0; /*remove hash -- prevents flush to disk */ 797 op_entry->hash = 0; /*remove hash -- prevents flush to disk */
796 open_plugin_entry.lang_id = LANG_PREVIOUS_SCREEN; 798 op_entry->lang_id = LANG_PREVIOUS_SCREEN;
797 /*open_plugin_add_path(NULL, NULL, NULL);// clear entry */ 799 /*open_plugin_add_path(NULL, NULL, NULL);// clear entry */
798 } 800 }
799 break; 801 break;
@@ -962,8 +964,9 @@ void root_menu(void)
962 char *key; 964 char *key;
963 if (global_status.last_screen == GO_TO_SHORTCUTMENU) 965 if (global_status.last_screen == GO_TO_SHORTCUTMENU)
964 { 966 {
965 if (open_plugin_entry.lang_id == LANG_OPEN_PLUGIN) 967 struct open_plugin_entry_t *op_entry = open_plugin_get_entry();
966 open_plugin_entry.lang_id = LANG_SHORTCUTS; 968 if (op_entry->lang_id == LANG_OPEN_PLUGIN)
969 op_entry->lang_id = LANG_SHORTCUTS;
967 shortcut_origin = last_screen; 970 shortcut_origin = last_screen;
968 key = ID2P(LANG_SHORTCUTS); 971 key = ID2P(LANG_SHORTCUTS);
969 } 972 }