1.1 --- a/src/loader.c Tue Nov 20 10:27:58 2007 +0000
1.2 +++ b/src/loader.c Thu Dec 20 09:56:07 2007 +0000
1.7 -#include "sh4core.h"
1.8 #include "bootstrap.h"
1.9 #include "dreamcast.h"
1.12 -#include "syscall.h"
1.15 char bootstrap_magic[32] = "SEGA SEGAKATANA SEGA ENTERPRISES";
1.16 char iso_magic[6] = "\001CD001";
1.18 #define CDI_V2 0x80000004
1.19 #define CDI_V3 0x80000005
1.21 -gboolean file_load_elf_fd( int fd );
1.22 +gboolean file_load_elf_fd( const gchar *filename, int fd );
1.25 gboolean file_load_magic( const gchar *filename )
1.27 lseek( fd, 0, SEEK_SET );
1.28 read( fd, load, BOOTSTRAP_SIZE );
1.29 bootstrap_dump( load, TRUE );
1.30 - sh4_set_pc( BOOTSTRAP_LOAD_ADDR + 0x300 );
1.31 - gui_update_state();
1.32 + dreamcast_program_loaded( filename, BOOTSTRAP_LOAD_ADDR + 0x300 );
1.34 /* look for a valid ISO9660 header */
1.35 lseek( fd, 32768, SEEK_SET );
1.37 buf[2] == 'L' && buf[3] == 'F' ) {
1.39 lseek( fd, 0, SEEK_SET );
1.40 - result = file_load_elf_fd( fd );
1.41 + result = file_load_elf_fd( filename, fd );
1.45 @@ -108,25 +104,19 @@
1.49 -void file_load_postload( int pc )
1.50 +void file_load_postload( const gchar *filename, int pc )
1.52 const gchar *bootstrap_file = lxdream_get_config_value(CONFIG_BOOTSTRAP);
1.53 if( bootstrap_file != NULL ) {
1.54 /* Load in a bootstrap before the binary, to initialize everything
1.57 - if( mem_load_block( bootstrap_file, BOOTSTRAP_LOAD_ADDR, BOOTSTRAP_SIZE ) != 0 ) {
1.58 - /* Try it without the bootstrap */
1.61 - sh4_set_pc( BOOTSTRAP_LOAD_ADDR + 0x300 );
1.62 + if( mem_load_block( bootstrap_file, BOOTSTRAP_LOAD_ADDR, BOOTSTRAP_SIZE ) == 0 ) {
1.63 + dreamcast_program_loaded( filename, BOOTSTRAP_LOAD_ADDR+0x300 );
1.71 - gui_update_state();
1.72 + dreamcast_program_loaded( filename, pc );
1.76 @@ -134,14 +124,14 @@
1.78 /* Load the binary itself */
1.79 if( mem_load_block( filename, BINARY_LOAD_ADDR, -1 ) == 0 ) {
1.80 - file_load_postload( BINARY_LOAD_ADDR );
1.81 + file_load_postload( filename, BINARY_LOAD_ADDR );
1.88 -gboolean file_load_elf_fd( int fd )
1.89 +gboolean file_load_elf_fd( const gchar *filename, int fd )
1.97 - file_load_postload( head.e_entry );
1.98 + file_load_postload( filename, head.e_entry );