forked from len0rd/rockbox
Added screen_dump() for future use
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@3554 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
1b8c6626b3
commit
a97de95ed9
1 changed files with 70 additions and 1 deletions
71
apps/misc.c
71
apps/misc.c
|
@ -16,7 +16,10 @@
|
||||||
* KIND, either express or implied.
|
* KIND, either express or implied.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
#include "string.h"
|
||||||
|
#include "config.h"
|
||||||
|
#include "file.h"
|
||||||
|
#include "lcd.h"
|
||||||
#include "sprintf.h"
|
#include "sprintf.h"
|
||||||
#define ONE_KILOBYTE 1024
|
#define ONE_KILOBYTE 1024
|
||||||
#define ONE_MEGABYTE (1024*1024)
|
#define ONE_MEGABYTE (1024*1024)
|
||||||
|
@ -59,3 +62,69 @@ int main(int argc, char **argv)
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef SCREENDUMP
|
||||||
|
extern unsigned char lcd_framebuffer[LCD_WIDTH][LCD_HEIGHT/8];
|
||||||
|
static unsigned char bmpheader[] =
|
||||||
|
{
|
||||||
|
0x42, 0x4d, 0x3e, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x00,
|
||||||
|
0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x40, 0x00,
|
||||||
|
0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04,
|
||||||
|
0x00, 0x00, 0xc4, 0x0e, 0x00, 0x00, 0xc4, 0x0e, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xd0, 0x80, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00
|
||||||
|
};
|
||||||
|
|
||||||
|
static unsigned char buf[112*8];
|
||||||
|
static unsigned char buf2[112*8];
|
||||||
|
static char dummy[2] = {0, 0};
|
||||||
|
static int fileindex = 0;
|
||||||
|
|
||||||
|
void screen_dump(void)
|
||||||
|
{
|
||||||
|
int f;
|
||||||
|
int i, shift;
|
||||||
|
int x, y;
|
||||||
|
char filename[MAX_PATH];
|
||||||
|
|
||||||
|
i = 0;
|
||||||
|
for(y = 0;y < LCD_HEIGHT/8;y++)
|
||||||
|
{
|
||||||
|
for(x = 0;x < LCD_WIDTH;x++)
|
||||||
|
{
|
||||||
|
buf[i++] = lcd_framebuffer[x][y];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
memset(buf2, 0, sizeof(buf2));
|
||||||
|
|
||||||
|
for(y = 0;y < 64;y++)
|
||||||
|
{
|
||||||
|
shift = y & 7;
|
||||||
|
|
||||||
|
for(x = 0;x < 112/8;x++)
|
||||||
|
{
|
||||||
|
for(i = 0;i < 8;i++)
|
||||||
|
{
|
||||||
|
buf2[y*112/8+x] |= ((buf[y/8*112+x*8+i] >> shift)
|
||||||
|
& 0x01) << (7-i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
snprintf(filename, MAX_PATH, "/dump%03d.bmp", fileindex++);
|
||||||
|
f = creat(filename, O_WRONLY);
|
||||||
|
if(f >= 0)
|
||||||
|
{
|
||||||
|
write(f, bmpheader, sizeof(bmpheader));
|
||||||
|
|
||||||
|
for(i = 63;i >= 0;i--)
|
||||||
|
{
|
||||||
|
write(f, &buf2[i*14], 14);
|
||||||
|
write(f, dummy, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
close(f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue