-#endif\r
-#if 0\r
- // debug\r
- {\r
- #define BYTE unsigned char\r
- #define WORD unsigned short\r
- struct\r
- {\r
- BYTE IDLength; /* 00h Size of Image ID field */\r
- BYTE ColorMapType; /* 01h Color map type */\r
- BYTE ImageType; /* 02h Image type code */\r
- WORD CMapStart; /* 03h Color map origin */\r
- WORD CMapLength; /* 05h Color map length */\r
- BYTE CMapDepth; /* 07h Depth of color map entries */\r
- WORD XOffset; /* 08h X origin of image */\r
- WORD YOffset; /* 0Ah Y origin of image */\r
- WORD Width; /* 0Ch Width of image */\r
- WORD Height; /* 0Eh Height of image */\r
- BYTE PixelDepth; /* 10h Image pixel size */\r
- BYTE ImageDescriptor; /* 11h Image descriptor byte */\r
- } __attribute__((packed)) TGAHEAD;\r
- static unsigned short oldscr[320*240];\r
- FILE *f; char name[128]; int i;\r
-\r
- memset(&TGAHEAD, 0, sizeof(TGAHEAD));\r
- TGAHEAD.ImageType = 2;\r
- TGAHEAD.Width = 320;\r
- TGAHEAD.Height = 240;\r
- TGAHEAD.PixelDepth = 16;\r
- TGAHEAD.ImageDescriptor = 2<<4; // image starts at top-left\r
-\r
- #define CONV(X) (((X>>1)&0x7fe0)|(X&0x1f)) // 555?\r
-\r
- for (i = 0; i < 320*240; i++)\r
- if(oldscr[i] != CONV(((unsigned short *)gp2x_screen)[i])) break;\r
- if (i < 320*240)\r
- {\r
- for (i = 0; i < 320*240; i++)\r
- oldscr[i] = CONV(((unsigned short *)gp2x_screen)[i]);\r
- sprintf(name, "%05i.tga", Pico.m.frame_count);\r
- f = fopen(name, "wb");\r
- if (!f) { printf("!f\n"); exit(1); }\r
- fwrite(&TGAHEAD, 1, sizeof(TGAHEAD), f);\r
- fwrite(oldscr, 1, 320*240*2, f);\r
- fclose(f);\r
- }\r
- }\r
-#endif\r