1.1 --- a/src/loader.c Tue Jan 16 09:18:32 2007 +0000
1.2 +++ b/src/loader.c Sun Oct 07 06:21:14 2007 +0000
1.5 - * $Id: loader.c,v 1.15 2007-01-16 09:18:32 nkeynes Exp $
1.6 + * $Id: loader.c,v 1.16 2007-10-07 06:21:14 nkeynes Exp $
1.8 * File loading routines, mostly for loading demos without going through the
1.9 * whole procedure of making a CD image for them.
1.11 #include "sh4core.h"
1.12 #include "bootstrap.h"
1.13 #include "dreamcast.h"
1.14 +#include "loader.h"
1.15 +#include "syscall.h"
1.17 char bootstrap_magic[32] = "SEGA SEGAKATANA SEGA ENTERPRISES";
1.18 char iso_magic[6] = "\001CD001";
1.20 #define CDI_V2 0x80000004
1.21 #define CDI_V3 0x80000005
1.23 +int file_load_elf_fd( int fd );
1.26 gboolean file_load_magic( const gchar *filename )
1.32 int fd = open( filename, O_RDONLY );
1.34 if( memcmp( buf, bootstrap_magic, 32 ) == 0 ) {
1.35 /* we have a DC bootstrap */
1.36 if( st.st_size == BOOTSTRAP_SIZE ) {
1.37 - char *load = mem_get_region( BOOTSTRAP_LOAD_ADDR );
1.38 + unsigned char *load = (unsigned char *)mem_get_region( BOOTSTRAP_LOAD_ADDR );
1.39 lseek( fd, 0, SEEK_SET );
1.40 read( fd, load, BOOTSTRAP_SIZE );
1.41 bootstrap_dump( load, TRUE );
1.46 -int file_load_postload( int pc )
1.47 +void file_load_postload( int pc )
1.49 const gchar *bootstrap_file = dreamcast_get_config_value(CONFIG_BOOTSTRAP);
1.50 if( bootstrap_file != NULL ) {
1.51 @@ -125,11 +129,15 @@
1.55 -int file_load_binary( const gchar *filename )
1.56 +gboolean file_load_binary( const gchar *filename )
1.58 /* Load the binary itself */
1.59 - mem_load_block( filename, BINARY_LOAD_ADDR, -1 );
1.60 - file_load_postload( BINARY_LOAD_ADDR );
1.61 + if( mem_load_block( filename, BINARY_LOAD_ADDR, -1 ) == 0 ) {
1.62 + file_load_postload( BINARY_LOAD_ADDR );
1.69 int file_load_elf_fd( int fd )
1.74 - return file_load_postload( head.e_entry );
1.75 + file_load_postload( head.e_entry );