Search
lxdream.org :: lxdream/src/pvr2/pvr2mem.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/pvr2/pvr2mem.c
changeset 309:e2750808d02c
prev285:4fefedafebc6
next310:00cd8897ad5e
author nkeynes
date Sun Jan 21 11:29:17 2007 +0000 (12 years ago)
permissions -rw-r--r--
last change Add method to dump vram to file in a form directly usable by testdata
file annotate diff log raw
1.1 --- a/src/pvr2/pvr2mem.c Mon Jan 15 10:10:51 2007 +0000
1.2 +++ b/src/pvr2/pvr2mem.c Sun Jan 21 11:29:17 2007 +0000
1.3 @@ -1,5 +1,5 @@
1.4 /**
1.5 - * $Id: pvr2mem.c,v 1.2 2007-01-15 10:10:51 nkeynes Exp $
1.6 + * $Id: pvr2mem.c,v 1.3 2007-01-21 11:29:17 nkeynes Exp $
1.7 *
1.8 * PVR2 (Video) VRAM handling routines (mainly for the 64-bit region)
1.9 *
1.10 @@ -16,6 +16,8 @@
1.11 * GNU General Public License for more details.
1.12 */
1.13 #include "pvr2.h"
1.14 +#include <stdio.h>
1.15 +#include <errno.h>
1.16
1.17 extern char *video_base;
1.18
1.19 @@ -217,6 +219,30 @@
1.20 }
1.21 }
1.22
1.23 +void pvr2_vram64_dump_file( sh4addr_t addr, uint32_t length, gchar *filename )
1.24 +{
1.25 + uint32_t tmp[length>>2];
1.26 + FILE *f = fopen(filename, "wo");
1.27 + unsigned int i, j;
1.28 +
1.29 + if( f == NULL ) {
1.30 + ERROR( "Unable to write to dump file '%s' (%s)", filename, strerror(errno) );
1.31 + return;
1.32 + }
1.33 + pvr2_vram64_read( tmp, addr, length );
1.34 + fprintf( f, "%08X\n", addr );
1.35 + for( i =0; i<length>>2; i+=8 ) {
1.36 + for( j=i; j<i+8; j++ ) {
1.37 + if( j < length )
1.38 + fprintf( f, " %08X", tmp[j] );
1.39 + else
1.40 + fprintf( f, " " );
1.41 + }
1.42 + fprintf( f, "\n" );
1.43 + }
1.44 + fclose(f);
1.45 +}
1.46 +
1.47 void pvr2_vram64_dump( sh4addr_t addr, uint32_t length, FILE *f )
1.48 {
1.49 char tmp[length];
.