+static void gp2x_fceu_darken_reset(void)\r
+{\r
+ txt_xmin = 320; txt_xmax = 0;\r
+ txt_ymin = 240; txt_ymax = 0;\r
+}\r
+\r
+static void gp2x_fceu_copy_bg(void)\r
+{\r
+ if (menu_bg)\r
+ memcpy(gp2x_screen, menu_bg, 320*240*2);\r
+ else memset(gp2x_screen, 0, 320*240*2);\r
+ gp2x_fceu_darken_reset();\r
+}\r
+\r
+static void gp2x_fceu_darken_text_bg(void)\r
+{\r
+ int x, y, xmin, xmax, ymax;\r
+ unsigned short *screen = gp2x_screen;\r
+\r
+ xmin = txt_xmin - 3;\r
+ if (xmin < 0) xmin = 0;\r
+ xmax = txt_xmax + 2;\r
+ if (xmax > 319) xmax = 319;\r
+\r
+ y = txt_ymin - 3;\r
+ if (y < 0) y = 0;\r
+ ymax = txt_ymax + 2;\r
+ if (ymax > 239) ymax = 239;\r
+\r
+ for (x = xmin; x <= xmax; x++)\r
+ screen[y*320+x] = 0xa514;\r
+ for (y++; y < ymax; y++)\r
+ {\r
+ screen[y*320+xmin] = 0xffff;\r
+ for (x = xmin+1; x < xmax; x++)\r
+ {\r
+ unsigned int p = screen[y*320+x];\r
+ if (p != 0xffff)\r
+ screen[y*320+x] = ((p&0xf79e)>>1) - ((p&0xc618)>>3);\r
+ }\r
+ screen[y*320+xmax] = 0xffff;\r
+ }\r
+ for (x = xmin; x <= xmax; x++)\r
+ screen[y*320+x] = 0xffff;\r
+}\r
+\r
+static void gp2x_fceu_darken_all(void)\r