Search
lxdream.org :: lxdream/src/mem.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/mem.c
changeset 543:361ec0a70cf2
prev510:41ce7a074f4e
next561:533f6b478071
next586:2a3ba82cf243
author nkeynes
date Thu Nov 22 11:10:15 2007 +0000 (13 years ago)
permissions -rw-r--r--
last change Re-add "Load Binary" menu item (misplaced in GUI rewrite)
Prevent running with no code loaded
file annotate diff log raw
1.1 --- a/src/mem.c Wed Nov 14 10:21:33 2007 +0000
1.2 +++ b/src/mem.c Thu Nov 22 11:10:15 2007 +0000
1.3 @@ -198,7 +198,7 @@
1.4 FILE *f = fopen(file,"r");
1.5
1.6 if( f == NULL ) {
1.7 - ERROR( "Unable to load file '%s': %s", file, strerror(errno) );
1.8 + WARN( "Unable to load file '%s': %s", file, strerror(errno) );
1.9 return -1;
1.10 }
1.11 fstat( fileno(f), &st );
1.12 @@ -266,8 +266,8 @@
1.13 return mem;
1.14 }
1.15
1.16 -void *mem_load_rom( const gchar *file, uint32_t base, uint32_t size, uint32_t crc,
1.17 - const gchar *region_name )
1.18 +gboolean mem_load_rom( const gchar *file, uint32_t base, uint32_t size, uint32_t crc,
1.19 + const gchar *region_name )
1.20 {
1.21 sh4ptr_t mem;
1.22 uint32_t calc_crc;
1.23 @@ -278,7 +278,7 @@
1.24 mem = mmap( NULL, size, PROT_WRITE|PROT_READ, MAP_ANON|MAP_PRIVATE, -1, 0 );
1.25 if( mem == MAP_FAILED ) {
1.26 ERROR( "Unable to allocate ROM memory: %s (%s)", file, strerror(errno) );
1.27 - return NULL;
1.28 + return FALSE;
1.29 }
1.30 mem_map_region( mem, base, size, file, MEM_FLAG_ROM, size, base );
1.31 } else {
1.32 @@ -295,9 +295,10 @@
1.33 WARN( "Bios CRC Mismatch in %s: %08X (expected %08X)",
1.34 file, calc_crc, crc);
1.35 }
1.36 + return TRUE;
1.37 }
1.38
1.39 - return mem;
1.40 + return FALSE;
1.41 }
1.42
1.43 sh4ptr_t mem_get_region_by_name( const char *name )
.