Search
lxdream.org :: lxdream/src/pvr2/pvr2.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/pvr2/pvr2.c
changeset 295:6637664291a8
prev284:808617ee7135
next304:2855cf8709a5
author nkeynes
date Tue Jan 16 10:34:46 2007 +0000 (13 years ago)
permissions -rw-r--r--
last change Bug 24: Initial implementation of "save scene" function
file annotate diff log raw
1.1 --- a/src/pvr2/pvr2.c Mon Jan 15 08:32:09 2007 +0000
1.2 +++ b/src/pvr2/pvr2.c Tue Jan 16 10:34:46 2007 +0000
1.3 @@ -1,5 +1,5 @@
1.4 /**
1.5 - * $Id: pvr2.c,v 1.39 2007-01-15 08:32:09 nkeynes Exp $
1.6 + * $Id: pvr2.c,v 1.40 2007-01-16 10:34:46 nkeynes Exp $
1.7 *
1.8 * PVR2 (Video) Core module implementation and MMIO registers.
1.9 *
1.10 @@ -69,7 +69,7 @@
1.11 uint32_t irq_vpos1;
1.12 uint32_t irq_vpos2;
1.13 uint32_t odd_even_field; /* 1 = odd, 0 = even */
1.14 -
1.15 + gchar *save_next_render_filename;
1.16 /* timing */
1.17 uint32_t dot_clock;
1.18 uint32_t total_lines;
1.19 @@ -123,6 +123,7 @@
1.20 texcache_init();
1.21 pvr2_reset();
1.22 pvr2_ta_reset();
1.23 + pvr2_state.save_next_render_filename = NULL;
1.24 }
1.25
1.26 static void pvr2_reset( void )
1.27 @@ -150,13 +151,17 @@
1.28 {
1.29 fwrite( &pvr2_state, sizeof(pvr2_state), 1, f );
1.30 pvr2_ta_save_state( f );
1.31 + pvr2_yuv_save_state( f );
1.32 }
1.33
1.34 static int pvr2_load_state( FILE *f )
1.35 {
1.36 if( fread( &pvr2_state, sizeof(pvr2_state), 1, f ) != 1 )
1.37 return 1;
1.38 - return pvr2_ta_load_state(f);
1.39 + if( pvr2_ta_load_state(f) ) {
1.40 + return 1;
1.41 + }
1.42 + return pvr2_yuv_load_state(f);
1.43 }
1.44
1.45 /**
1.46 @@ -202,6 +207,17 @@
1.47 return pvr2_state.frame_count;
1.48 }
1.49
1.50 +gboolean pvr2_save_next_scene( const gchar *filename )
1.51 +{
1.52 + if( pvr2_state.save_next_render_filename != NULL ) {
1.53 + g_free( pvr2_state.save_next_render_filename );
1.54 + }
1.55 + pvr2_state.save_next_render_filename = g_strdup(filename);
1.56 + return TRUE;
1.57 +}
1.58 +
1.59 +
1.60 +
1.61 /**
1.62 * Display the next frame, copying the current contents of video ram to
1.63 * the window. If the video configuration has changed, first recompute the
1.64 @@ -288,9 +304,15 @@
1.65 val &= 0x00000007; /* Do stuff? */
1.66 MMIO_WRITE( PVR2, reg, val );
1.67 break;
1.68 - case RENDER_START:
1.69 - if( val == 0xFFFFFFFF || val == 0x00000001 )
1.70 - pvr2_render_scene();
1.71 + case RENDER_START: /* Don't really care what value */
1.72 + if( pvr2_state.save_next_render_filename != NULL ) {
1.73 + if( pvr2_render_save_scene(pvr2_state.save_next_render_filename) == 0 ) {
1.74 + INFO( "Saved scene to %s", pvr2_state.save_next_render_filename);
1.75 + }
1.76 + g_free( pvr2_state.save_next_render_filename );
1.77 + pvr2_state.save_next_render_filename = NULL;
1.78 + }
1.79 + pvr2_render_scene();
1.80 break;
1.81 case RENDER_POLYBASE:
1.82 MMIO_WRITE( PVR2, reg, val&0x00F00000 );
.