Rockbox open source high quality audio player as a Music Player Daemon
mpris rockbox mpd libadwaita audio rust zig deno
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

[Feature] Simulator add F1 help text

give a listing of the keys used in the simulator

Change-Id: Ifcb91c59de41c214d050bd175065fabb6cf9eac4

authored by

William Wilgus and committed by
William Wilgus
fcbfa494 9ba59477

+88
+88
firmware/target/hosted/sdl/button-sdl.c
··· 409 409 } while(!quit); 410 410 } 411 411 412 + #if defined(SIMULATOR) 413 + static void show_sim_help(void) 414 + { 415 + extern SDL_Window *sdlWindow; 416 + extern struct button_map bm[]; 417 + 418 + uint32_t flags = SDL_MESSAGEBOX_INFORMATION; 419 + static char helptext[4096] = {'\0'}; 420 + 421 + if (helptext[0] != '\0') 422 + { 423 + SDL_ShowSimpleMessageBox(flags, UI_TITLE, helptext, sdlWindow); 424 + return; 425 + } 426 + 427 + const char *keyname = SDL_GetKeyName(SDLK_HELP); 428 + strlcat(helptext, "Rockbox simulator\n[Key] Description\n\n[", sizeof(helptext)-1); 429 + /* simulator keys */ 430 + #define HELPTXT(SDLK,litdesc) \ 431 + keyname = SDL_GetKeyName(SDLK); \ 432 + if (keyname[0]) { \ 433 + strlcat(helptext, keyname, sizeof(helptext)-1); \ 434 + strlcat(helptext, "] "litdesc"\n[", sizeof(helptext)-1);} 435 + /*HELPTXT(, "");*/ 436 + HELPTXT(SDLK_HELP, "display this window"); 437 + HELPTXT(SDLK_KP_0, "screendump"); 438 + HELPTXT(SDLK_F5, "screendump"); 439 + HELPTXT(SDLK_TAB, "hide device background"); 440 + HELPTXT(SDLK_0, "zoom display level 1/2"); 441 + HELPTXT(SDLK_1, "zoom display level 1"); 442 + HELPTXT(SDLK_2, "zoom display level 2"); 443 + HELPTXT(SDLK_3, "zoom display level 3"); 444 + HELPTXT(SDLK_4, "toggle display quality"); 445 + HELPTXT(USB_KEY, "toggle USB"); 446 + 447 + #ifdef HAVE_HEADPHONE_DETECTION 448 + HELPTXT(SDLK_p, "toggle headphone"); 449 + #endif 450 + #ifdef HAVE_LINEOUT_DETECTION 451 + HELPTXT(SDLK_p, "toggle lineout"); 452 + #endif 453 + #ifdef HAVE_HOTSWAP 454 + HELPTXT(EXT_KEY, "toggle external drive"); 455 + #endif 456 + #if (CONFIG_PLATFORM & PLATFORM_PANDORA) 457 + HELPTXT(SDLK_LCTRL, "shutdown"); 458 + #endif 459 + #ifdef HAS_BUTTON_HOLD 460 + HELPTXT(SDLK_h, "toggle hold button"); 461 + #endif 462 + #ifdef HAS_REMOTE_BUTTON_HOLD 463 + HELPTXT(SDLK_j, "toggle remote hold button"); 464 + #endif 465 + #if defined(IRIVER_H100_SERIES) || defined (IRIVER_H300_SERIES) 466 + HELPTXT(SDLK_t, "toggle remote type"); 467 + #endif 468 + #ifdef HAVE_TOUCHSCREEN 469 + HELPTXT(SDLK_F4, "toggle touch mode"); 470 + #endif 471 + 472 + /* device specific keymap */ 473 + for (int i = 0; bm[i].button; i++) 474 + { 475 + keyname = SDL_GetKeyName(bm[i].button); 476 + strlcat(helptext, keyname, sizeof(helptext)-1); 477 + strlcat(helptext, "] ", sizeof(helptext)-1); 478 + strlcat(helptext, bm[i].description, sizeof(helptext)-1); 479 + strlcat(helptext, "\n[", sizeof(helptext)-1); 480 + } 481 + 482 + /* last one doesn't use the macro */ 483 + keyname = SDL_GetKeyName(SDLK_F1); 484 + strlcat(helptext, keyname, sizeof(helptext)-1); 485 + strlcat(helptext, "] display this window\n\n", sizeof(helptext)-1); 486 + 487 + strlcat(helptext, "Note: If you don't have a keypad\n" \ 488 + "alternate keys are in uisimulator/buttonmap\n\n", sizeof(helptext)-1); 489 + 490 + DEBUGF("[%u] characters\n%s", (unsigned int)strlen(helptext), helptext); 491 + SDL_ShowSimpleMessageBox(flags, UI_TITLE, helptext, sdlWindow); 492 + } 493 + #endif 494 + 412 495 static void button_event(int key, bool pressed) 413 496 { 414 497 int new_btn = 0; 415 498 switch (key) 416 499 { 417 500 #ifdef SIMULATOR 501 + case SDLK_HELP: 502 + case SDLK_F1: 503 + if (!pressed) 504 + show_sim_help(); 505 + return; 418 506 case SDLK_TAB: 419 507 if (!pressed) 420 508 {