new code to collect/use more stats, some debug tools

git-svn-id: file:///home/notaz/opt/svn/PicoDrive/platform@520 be3aeb3a-fb24-0410-a615-afba39da0efa
This commit is contained in:
notaz 2008-07-04 15:06:09 +00:00
parent 4306047f67
commit 2707a9cbaa

View file

@ -432,8 +432,10 @@ rescan:
// ------------ debug menu ------------ // ------------ debug menu ------------
char *debugString(void); char *debugString(void);
void PicoDrawShowSpriteStats(unsigned short *screen);
void PicoDrawShowPalette(unsigned short *screen);
static void draw_debug(void) static void draw_main_debug(void)
{ {
char *p, *str = debugString(); char *p, *str = debugString();
int len, line; int len, line;
@ -450,13 +452,47 @@ static void draw_debug(void)
if (*p == 0) break; if (*p == 0) break;
p++; str = p; p++; str = p;
} }
menu_flip(); }
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(gp2x_screen, 0, 320*240*2);
emu_forcedFrame();
smalltext_out16(4, 232, layer_str, 0xffff);
} }
static void debug_menu_loop(void) static void debug_menu_loop(void)
{ {
draw_debug(); int inp, mode = 0;
wait_for_input(GP2X_B|GP2X_X);
while (1)
{
switch (mode)
{
case 0: draw_main_debug(); break;
case 1: draw_frame_debug(); break;
case 2: PicoDrawShowSpriteStats(gp2x_screen); break;
case 3: PicoDrawShowPalette(gp2x_screen); break;
}
menu_flip();
inp = wait_for_input(GP2X_B|GP2X_X|GP2X_L|GP2X_R|GP2X_UP|GP2X_DOWN|GP2X_LEFT|GP2X_RIGHT);
if (inp & (GP2X_B|GP2X_X)) return;
if (inp & GP2X_L) { mode--; if (mode < 0) mode = 3; }
if (inp & GP2X_R) { mode++; if (mode > 3) mode = 0; }
if (mode == 1) {
if (inp & GP2X_LEFT) PicoDrawMask ^= PDRAW_LAYERB_ON;
if (inp & GP2X_RIGHT) PicoDrawMask ^= PDRAW_LAYERA_ON;
if (inp & GP2X_DOWN) PicoDrawMask ^= PDRAW_SPRITES_LOW_ON;
if (inp & GP2X_UP) PicoDrawMask ^= PDRAW_SPRITES_HI_ON;
}
}
} }
// ------------ patch/gg menu ------------ // ------------ patch/gg menu ------------