add buffer parameters for menubg_src
[libpicofe.git] / menu.c
diff --git a/menu.c b/menu.c
index 3f9cdec..e7adb5a 100644 (file)
--- a/menu.c
+++ b/menu.c
 #include "plat.h"\r
 #include "posix.h"\r
 \r
+#if defined(__GNUC__) && __GNUC__ >= 7\r
+#pragma GCC diagnostic ignored "-Wformat-truncation"\r
+#endif\r
+\r
 static char static_buff[64];\r
 static int  menu_error_time = 0;\r
 char menu_error_msg[64] = { 0, };\r
+// g_menuscreen is the current output buffer the menu is rendered to.\r
 void *g_menuscreen_ptr;\r
-void *g_menubg_src_ptr;\r
+// g_menubg is the menu background and has the same w/h as g_menuscreen, but\r
+// pp=w. It is filled on menu entry from file or from g_menubg_src if available.\r
 void *g_menubg_ptr;\r
+// g_menubg_src points to a buffer containing a bg image. This is usually either\r
+// the emulator screen buffer or the host frame buffer.\r
+void *g_menubg_src_ptr;\r
 \r
 int g_menuscreen_w;\r
 int g_menuscreen_h;\r
 int g_menuscreen_pp;\r
+int g_menubg_src_w;\r
+int g_menubg_src_h;\r
+int g_menubg_src_pp;\r
 \r
 int g_autostateld_opt;\r
 \r
@@ -264,14 +276,14 @@ void menu_init_base(void)
                for (l = 0; l < 8; l++)\r
                {\r
                        unsigned char fd8x8 = fontdata8x8[c*8+l];\r
-                       if (fd8x8&0x80) *fd  = 0xf0;\r
-                       if (fd8x8&0x40) *fd |= 0x0f; fd++;\r
-                       if (fd8x8&0x20) *fd  = 0xf0;\r
-                       if (fd8x8&0x10) *fd |= 0x0f; fd++;\r
-                       if (fd8x8&0x08) *fd  = 0xf0;\r
-                       if (fd8x8&0x04) *fd |= 0x0f; fd++;\r
-                       if (fd8x8&0x02) *fd  = 0xf0;\r
-                       if (fd8x8&0x01) *fd |= 0x0f; fd++;\r
+                       if (fd8x8&0x80) { *fd  = 0xf0; }\r
+                       if (fd8x8&0x40) { *fd |= 0x0f; }; fd++;\r
+                       if (fd8x8&0x20) { *fd  = 0xf0; }\r
+                       if (fd8x8&0x10) { *fd |= 0x0f; }; fd++;\r
+                       if (fd8x8&0x08) { *fd  = 0xf0; }\r
+                       if (fd8x8&0x04) { *fd |= 0x0f; }; fd++;\r
+                       if (fd8x8&0x02) { *fd  = 0xf0; }\r
+                       if (fd8x8&0x01) { *fd |= 0x0f; }; fd++;\r
                }\r
                fd += 8*2/2; // 2 empty lines\r
        }\r