Search
lxdream.org :: lxdream/src/dreamcast.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/dreamcast.c
changeset 180:e6dcf9b65658
prev167:71c0cc416a64
next265:5daf59b7f31b
author nkeynes
date Sun Aug 06 09:43:03 2006 +0000 (17 years ago)
permissions -rw-r--r--
last change Add alignment checks
file annotate diff log raw
1.1 --- a/src/dreamcast.c Mon Jun 19 11:00:42 2006 +0000
1.2 +++ b/src/dreamcast.c Sun Aug 06 09:43:03 2006 +0000
1.3 @@ -1,5 +1,5 @@
1.4 /**
1.5 - * $Id: dreamcast.c,v 1.17 2006-06-19 11:00:40 nkeynes Exp $
1.6 + * $Id: dreamcast.c,v 1.18 2006-07-02 04:59:00 nkeynes Exp $
1.7 * Central switchboard for the system. This pulls all the individual modules
1.8 * together into some kind of coherent structure. This is also where you'd
1.9 * add Naomi support, if I ever get a board to play with...
1.10 @@ -66,8 +66,11 @@
1.11 mem_create_ram_region( 0x00800000, 2 MB, MEM_REGION_AUDIO );
1.12 mem_create_ram_region( 0x00703000, 8 KB, MEM_REGION_AUDIO_SCRATCH );
1.13 mem_create_ram_region( 0x05000000, 8 MB, MEM_REGION_VIDEO );
1.14 - mem_load_rom( dreamcast_get_config_value(CONFIG_BIOS_PATH),
1.15 - 0x00000000, 0x00200000, 0x89f2b1a1 );
1.16 + if( mem_load_rom( dreamcast_get_config_value(CONFIG_BIOS_PATH),
1.17 + 0x00000000, 0x00200000, 0x89f2b1a1 ) == NULL ) {
1.18 + /* Bios wasn't found. Dump an empty ram region in there for something to do */
1.19 + mem_create_ram_region( 0x00000000, 0x00200000, MEM_REGION_BIOS );
1.20 + }
1.21 mem_create_ram_region( 0x00200000, 0x00020000, MEM_REGION_FLASH );
1.22 mem_load_block( dreamcast_get_config_value(CONFIG_FLASH_PATH),
1.23 0x00200000, 0x00020000 );
1.24 @@ -354,7 +357,7 @@
1.25
1.26 /********************************* Save States *****************************/
1.27
1.28 -#define DREAMCAST_SAVE_MAGIC "%!-DreamOn!Save\0"
1.29 +#define DREAMCAST_SAVE_MAGIC "%!-lxDream!Save\0"
1.30 #define DREAMCAST_SAVE_VERSION 0x00010000
1.31
1.32 struct save_state_header {
1.33 @@ -377,15 +380,15 @@
1.34
1.35 fread( &header, sizeof(header), 1, f );
1.36 if( strncmp( header.magic, DREAMCAST_SAVE_MAGIC, 16 ) != 0 ) {
1.37 - ERROR( "Not a DreamOn save state file" );
1.38 + ERROR( "Not a %s save state file", APP_NAME );
1.39 return 1;
1.40 }
1.41 if( header.version != DREAMCAST_SAVE_VERSION ) {
1.42 - ERROR( "DreamOn save state version not supported" );
1.43 + ERROR( "%s save state version not supported", APP_NAME );
1.44 return 1;
1.45 }
1.46 if( header.module_count > MAX_MODULES ) {
1.47 - ERROR( "DreamOn save state is corrupted (bad module count)" );
1.48 + ERROR( "%s save state is corrupted (bad module count)", APP_NAME );
1.49 return 1;
1.50 }
1.51 for( i=0; i<MAX_MODULES; i++ ) {
1.52 @@ -395,12 +398,12 @@
1.53 for( i=0; i<header.module_count; i++ ) {
1.54 fread(tmp, 4, 1, f );
1.55 if( strncmp(tmp, "BLCK", 4) != 0 ) {
1.56 - ERROR( "DreamOn save state is corrupted (missing block header %d)", i );
1.57 + ERROR( "%s save state is corrupted (missing block header %d)", APP_NAME, i );
1.58 return 2;
1.59 }
1.60 len = fread_string(tmp, sizeof(tmp), f );
1.61 if( len > 64 || len < 1 ) {
1.62 - ERROR( "DreamOn save state is corrupted (bad string)" );
1.63 + ERROR( "%s save state is corrupted (bad string)", APP_NAME );
1.64 return 2;
1.65 }
1.66
1.67 @@ -409,17 +412,17 @@
1.68 if( strcmp(modules[j]->name,tmp) == 0 ) {
1.69 have_read[j] = 1;
1.70 if( modules[j]->load == NULL ) {
1.71 - ERROR( "DreamOn save state is corrupted (no loader for %s)", modules[j]->name );
1.72 + ERROR( "%s save state is corrupted (no loader for %s)", APP_NAME, modules[j]->name );
1.73 return 2;
1.74 } else if( modules[j]->load(f) != 0 ) {
1.75 - ERROR( "DreamOn save state is corrupted (%s failed)", modules[j]->name );
1.76 + ERROR( "%s save state is corrupted (%s failed)", APP_NAME, modules[j]->name );
1.77 return 2;
1.78 }
1.79 break;
1.80 }
1.81 }
1.82 if( j == num_modules ) {
1.83 - ERROR( "DreamOn save state contains unrecognized section" );
1.84 + ERROR( "%s save state contains unrecognized section", APP_NAME );
1.85 return 2;
1.86 }
1.87 }
.