summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam Wilgus <wilgus.william@gmail.com>2024-12-29 12:17:01 -0500
committerWilliam Wilgus <me.theuser@yahoo.com>2024-12-29 21:25:48 -0500
commitfcbfa494f52b7f1fe15e8112223ff239199bf9ea (patch)
tree28d660332f8cab862bd279a7e5a337296750bec4
parent9ba59477a1b42cad9eeff3678b2f56a6f54e2f75 (diff)
downloadrockbox-fcbfa494f5.tar.gz
rockbox-fcbfa494f5.zip
[Feature] Simulator add F1 help text
give a listing of the keys used in the simulator Change-Id: Ifcb91c59de41c214d050bd175065fabb6cf9eac4
-rw-r--r--firmware/target/hosted/sdl/button-sdl.c88
1 files changed, 88 insertions, 0 deletions
diff --git a/firmware/target/hosted/sdl/button-sdl.c b/firmware/target/hosted/sdl/button-sdl.c
index 369a5b209f..5a4bb34b53 100644
--- a/firmware/target/hosted/sdl/button-sdl.c
+++ b/firmware/target/hosted/sdl/button-sdl.c
@@ -409,12 +409,100 @@ void gui_message_loop(void)
} while(!quit);
}
+#if defined(SIMULATOR)
+static void show_sim_help(void)
+{
+ extern SDL_Window *sdlWindow;
+ extern struct button_map bm[];
+
+ uint32_t flags = SDL_MESSAGEBOX_INFORMATION;
+ static char helptext[4096] = {'\0'};
+
+ if (helptext[0] != '\0')
+ {
+ SDL_ShowSimpleMessageBox(flags, UI_TITLE, helptext, sdlWindow);
+ return;
+ }
+
+ const char *keyname = SDL_GetKeyName(SDLK_HELP);
+ strlcat(helptext, "Rockbox simulator\n[Key] Description\n\n[", sizeof(helptext)-1);
+ /* simulator keys */
+ #define HELPTXT(SDLK,litdesc) \
+ keyname = SDL_GetKeyName(SDLK); \
+ if (keyname[0]) { \
+ strlcat(helptext, keyname, sizeof(helptext)-1); \
+ strlcat(helptext, "] "litdesc"\n[", sizeof(helptext)-1);}
+ /*HELPTXT(, "");*/
+ HELPTXT(SDLK_HELP, "display this window");
+ HELPTXT(SDLK_KP_0, "screendump");
+ HELPTXT(SDLK_F5, "screendump");
+ HELPTXT(SDLK_TAB, "hide device background");
+ HELPTXT(SDLK_0, "zoom display level 1/2");
+ HELPTXT(SDLK_1, "zoom display level 1");
+ HELPTXT(SDLK_2, "zoom display level 2");
+ HELPTXT(SDLK_3, "zoom display level 3");
+ HELPTXT(SDLK_4, "toggle display quality");
+ HELPTXT(USB_KEY, "toggle USB");
+
+#ifdef HAVE_HEADPHONE_DETECTION
+ HELPTXT(SDLK_p, "toggle headphone");
+#endif
+#ifdef HAVE_LINEOUT_DETECTION
+ HELPTXT(SDLK_p, "toggle lineout");
+#endif
+#ifdef HAVE_HOTSWAP
+ HELPTXT(EXT_KEY, "toggle external drive");
+#endif
+#if (CONFIG_PLATFORM & PLATFORM_PANDORA)
+ HELPTXT(SDLK_LCTRL, "shutdown");
+#endif
+#ifdef HAS_BUTTON_HOLD
+ HELPTXT(SDLK_h, "toggle hold button");
+#endif
+#ifdef HAS_REMOTE_BUTTON_HOLD
+ HELPTXT(SDLK_j, "toggle remote hold button");
+#endif
+#if defined(IRIVER_H100_SERIES) || defined (IRIVER_H300_SERIES)
+ HELPTXT(SDLK_t, "toggle remote type");
+#endif
+#ifdef HAVE_TOUCHSCREEN
+ HELPTXT(SDLK_F4, "toggle touch mode");
+#endif
+
+ /* device specific keymap */
+ for (int i = 0; bm[i].button; i++)
+ {
+ keyname = SDL_GetKeyName(bm[i].button);
+ strlcat(helptext, keyname, sizeof(helptext)-1);
+ strlcat(helptext, "] ", sizeof(helptext)-1);
+ strlcat(helptext, bm[i].description, sizeof(helptext)-1);
+ strlcat(helptext, "\n[", sizeof(helptext)-1);
+ }
+
+ /* last one doesn't use the macro */
+ keyname = SDL_GetKeyName(SDLK_F1);
+ strlcat(helptext, keyname, sizeof(helptext)-1);
+ strlcat(helptext, "] display this window\n\n", sizeof(helptext)-1);
+
+strlcat(helptext, "Note: If you don't have a keypad\n" \
+ "alternate keys are in uisimulator/buttonmap\n\n", sizeof(helptext)-1);
+
+ DEBUGF("[%u] characters\n%s", (unsigned int)strlen(helptext), helptext);
+ SDL_ShowSimpleMessageBox(flags, UI_TITLE, helptext, sdlWindow);
+}
+#endif
+
static void button_event(int key, bool pressed)
{
int new_btn = 0;
switch (key)
{
#ifdef SIMULATOR
+ case SDLK_HELP:
+ case SDLK_F1:
+ if (!pressed)
+ show_sim_help();
+ return;
case SDLK_TAB:
if (!pressed)
{