Search
lxdream.org :: lxdream/src/dreamcast.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/dreamcast.c
changeset 1109:700c5ab26a63
prev1100:50e702af9373
next1119:45602839e067
author nkeynes
date Thu Jun 10 22:13:16 2010 +1000 (13 years ago)
permissions -rw-r--r--
last change Integrate executable wrapping into the user interface
- command-line now loads wrapped by default, -e <bin> to run binary
- add support for .bin executables
- Add useful (internal) error codes
file annotate diff log raw
1.1 --- a/src/dreamcast.c Mon Feb 15 17:27:14 2010 +1000
1.2 +++ b/src/dreamcast.c Thu Jun 10 22:13:16 2010 +1000
1.3 @@ -448,7 +448,7 @@
1.4 return NULL;
1.5 }
1.6
1.7 -int dreamcast_load_state( const gchar *filename )
1.8 +gboolean dreamcast_load_state( const gchar *filename )
1.9 {
1.10 int i,j;
1.11 int module_count;
1.12 @@ -456,13 +456,13 @@
1.13 int have_read[MAX_MODULES];
1.14
1.15 FILE *f = fopen( filename, "r" );
1.16 - if( f == NULL ) return errno;
1.17 + if( f == NULL ) return FALSE;
1.18
1.19 module_count = dreamcast_read_save_state_header(f, error, sizeof(error));
1.20 if( module_count <= 0 ) {
1.21 ERROR( error );
1.22 fclose(f);
1.23 - return 1;
1.24 + return FALSE;
1.25 }
1.26
1.27 for( i=0; i<MAX_MODULES; i++ ) {
1.28 @@ -475,7 +475,7 @@
1.29 if( strncmp(chunk.marker, "BLCK", 4) != 0 ) {
1.30 ERROR( "%s save state is corrupted (missing block header %d)", APP_NAME, i );
1.31 fclose(f);
1.32 - return 2;
1.33 + return FALSE;
1.34 }
1.35
1.36 /* Find the matching module by name */
1.37 @@ -485,11 +485,11 @@
1.38 if( modules[j]->load == NULL ) {
1.39 ERROR( "%s save state is corrupted (no loader for %s)", APP_NAME, modules[j]->name );
1.40 fclose(f);
1.41 - return 2;
1.42 + return FALSE;
1.43 } else if( modules[j]->load(f) != 0 ) {
1.44 ERROR( "%s save state is corrupted (%s failed)", APP_NAME, modules[j]->name );
1.45 fclose(f);
1.46 - return 2;
1.47 + return FALSE;
1.48 }
1.49 break;
1.50 }
1.51 @@ -497,7 +497,7 @@
1.52 if( j == num_modules ) {
1.53 fclose(f);
1.54 ERROR( "%s save state contains unrecognized section", APP_NAME );
1.55 - return 2;
1.56 + return FALSE;
1.57 }
1.58 }
1.59
1.60 @@ -512,7 +512,7 @@
1.61 }
1.62 fclose(f);
1.63 INFO( "Save state read from %s", filename );
1.64 - return 0;
1.65 + return TRUE;
1.66 }
1.67
1.68 int dreamcast_save_state( const gchar *filename )
.