-// ------------ debug menu ------------
-
-char *debugString(void);
-void PicoDrawShowSpriteStats(unsigned short *screen, int stride);
-void PicoDrawShowPalette(unsigned short *screen, int stride);
-
-static void draw_main_debug(void)
-{
- char *p, *str = debugString();
- int len, line;
-
- menu_draw_begin();
-
- p = str;
- for (line = 0; line < 24; line++)
- {
- while (*p && *p != '\n') p++;
- len = p - str;
- if (len > 55) len = 55;
- smalltext_out16_lim(1, line*10, str, 0xffff, len);
- if (*p == 0) break;
- p++; str = p;
- }
-}
-
-static void draw_frame_debug(void)
-{
- char layer_str[48] = "layers: ";
- if (PicoDrawMask & PDRAW_LAYERB_ON) memcpy(layer_str + 8, "B", 1);
- if (PicoDrawMask & PDRAW_LAYERA_ON) memcpy(layer_str + 10, "A", 1);
- if (PicoDrawMask & PDRAW_SPRITES_LOW_ON) memcpy(layer_str + 12, "spr_lo", 6);
- if (PicoDrawMask & PDRAW_SPRITES_HI_ON) memcpy(layer_str + 19, "spr_hi", 6);
-
- memset(psp_screen, 0, 512*272*2);
- emu_forcedFrame(0);
- smalltext_out16(4, 264, layer_str, 0xffff);
-}
-
-static void debug_menu_loop(void)
-{
- int inp, mode = 0;
-
- while (1)
- {
- switch (mode)
- {
- case 0: draw_main_debug(); break;
- case 1: draw_frame_debug(); break;
- case 2: menu_draw_begin();
- PicoDrawShowSpriteStats((unsigned short *)psp_screen+512*16+80, 512); break;
- case 3: memset(psp_screen, 0, 512*272*2);
- PicoDrawShowPalette(psp_screen, 512); break;
- }
- menu_draw_end();
-
- inp = wait_for_input(BTN_X|BTN_CIRCLE|BTN_L|BTN_R|BTN_UP|BTN_DOWN|BTN_LEFT|BTN_RIGHT, 0);
- if (inp & (BTN_X|BTN_CIRCLE)) return;
- if (inp & BTN_L) { mode--; if (mode < 0) mode = 3; }
- if (inp & BTN_R) { mode++; if (mode > 3) mode = 0; }
- if (mode == 1) {
- if (inp & BTN_LEFT) PicoDrawMask ^= PDRAW_LAYERB_ON;
- if (inp & BTN_RIGHT) PicoDrawMask ^= PDRAW_LAYERA_ON;
- if (inp & BTN_DOWN) PicoDrawMask ^= PDRAW_SPRITES_LOW_ON;
- if (inp & BTN_UP) PicoDrawMask ^= PDRAW_SPRITES_HI_ON;
- }
- }
-}
-