// ------------ debug menu ------------\r
\r
char *debugString(void);\r
+void PicoDrawShowSpriteStats(unsigned short *screen);\r
+void PicoDrawShowPalette(unsigned short *screen);\r
\r
-static void draw_debug(void)\r
+static void draw_main_debug(void)\r
{\r
char *p, *str = debugString();\r
int len, line;\r
if (*p == 0) break;\r
p++; str = p;\r
}\r
- menu_flip();\r
+}\r
+\r
+static void draw_frame_debug(void)\r
+{\r
+ char layer_str[48] = "layers: ";\r
+ if (PicoDrawMask & PDRAW_LAYERB_ON) memcpy(layer_str + 8, "B", 1);\r
+ if (PicoDrawMask & PDRAW_LAYERA_ON) memcpy(layer_str + 10, "A", 1);\r
+ if (PicoDrawMask & PDRAW_SPRITES_LOW_ON) memcpy(layer_str + 12, "spr_lo", 6);\r
+ if (PicoDrawMask & PDRAW_SPRITES_HI_ON) memcpy(layer_str + 19, "spr_hi", 6);\r
+\r
+ memset(gp2x_screen, 0, 320*240*2);\r
+ emu_forcedFrame();\r
+ smalltext_out16(4, 232, layer_str, 0xffff);\r
}\r
\r
static void debug_menu_loop(void)\r
{\r
- draw_debug();\r
- wait_for_input(GP2X_B|GP2X_X);\r
+ int inp, mode = 0;\r
+\r
+ while (1)\r
+ {\r
+ switch (mode)\r
+ {\r
+ case 0: draw_main_debug(); break;\r
+ case 1: draw_frame_debug(); break;\r
+ case 2: PicoDrawShowSpriteStats(gp2x_screen); break;\r
+ case 3: PicoDrawShowPalette(gp2x_screen); break;\r
+ }\r
+ menu_flip();\r
+\r
+ inp = wait_for_input(GP2X_B|GP2X_X|GP2X_L|GP2X_R|GP2X_UP|GP2X_DOWN|GP2X_LEFT|GP2X_RIGHT);\r
+ if (inp & (GP2X_B|GP2X_X)) return;\r
+ if (inp & GP2X_L) { mode--; if (mode < 0) mode = 3; }\r
+ if (inp & GP2X_R) { mode++; if (mode > 3) mode = 0; }\r
+ if (mode == 1) {\r
+ if (inp & GP2X_LEFT) PicoDrawMask ^= PDRAW_LAYERB_ON;\r
+ if (inp & GP2X_RIGHT) PicoDrawMask ^= PDRAW_LAYERA_ON;\r
+ if (inp & GP2X_DOWN) PicoDrawMask ^= PDRAW_SPRITES_LOW_ON;\r
+ if (inp & GP2X_UP) PicoDrawMask ^= PDRAW_SPRITES_HI_ON;\r
+ }\r
+ }\r
}\r
\r
// ------------ patch/gg menu ------------\r