revision 427:00270806b4cf
summary |
tree |
shortlog |
changelog |
graph |
changeset |
raw | bz2 | zip | gz changeset | 427:00270806b4cf |
parent | 426:8a7a752f1174 |
child | 428:338966c8aed0 |
author | nkeynes |
date | Sun Oct 07 06:21:14 2007 +0000 (16 years ago) |
Fix compilation warnings
src/loader.c | view | annotate | diff | log | ||
src/loader.h | view | annotate | diff | log |
1.1 --- a/src/loader.c Sun Oct 07 06:10:52 2007 +00001.2 +++ b/src/loader.c Sun Oct 07 06:21:14 2007 +00001.3 @@ -1,5 +1,5 @@1.4 /**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.7 *1.8 * File loading routines, mostly for loading demos without going through the1.9 * whole procedure of making a CD image for them.1.10 @@ -28,6 +28,8 @@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.19 @@ -44,10 +46,12 @@1.20 #define CDI_V2 0x800000041.21 #define CDI_V3 0x800000051.23 +int file_load_elf_fd( int fd );1.24 +1.25 +1.26 gboolean file_load_magic( const gchar *filename )1.27 {1.28 char buf[32];1.29 - uint32_t tmpa[2];1.30 struct stat st;1.32 int fd = open( filename, O_RDONLY );1.33 @@ -68,7 +72,7 @@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.42 @@ -103,7 +107,7 @@1.43 return TRUE;1.44 }1.46 -int file_load_postload( int pc )1.47 +void file_load_postload( int pc )1.48 {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.52 }1.55 -int file_load_binary( const gchar *filename )1.56 +gboolean file_load_binary( const gchar *filename )1.57 {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.63 + return TRUE;1.64 + } else {1.65 + return FALSE;1.66 + }1.67 }1.69 int file_load_elf_fd( int fd )1.70 @@ -165,5 +173,6 @@1.71 }1.72 }1.74 - return file_load_postload( head.e_entry );1.75 + file_load_postload( head.e_entry );1.76 + return 0;1.77 }
2.1 --- a/src/loader.h Sun Oct 07 06:10:52 2007 +00002.2 +++ b/src/loader.h Sun Oct 07 06:21:14 2007 +00002.3 @@ -1,5 +1,5 @@2.4 /**2.5 - * $Id: loader.h,v 1.1 2005-12-24 08:02:14 nkeynes Exp $2.6 + * $Id: loader.h,v 1.2 2007-10-07 06:21:14 nkeynes Exp $2.7 *2.8 * Interface declarations for the binary loader routines (loader.c, elf.c)2.9 *2.10 @@ -39,30 +39,30 @@2.11 * for any other reason.2.12 * @return TRUE on success, otherwise FALSE and errno2.13 */2.14 -gboolean file_load_bootstrap( gchar *filename );2.15 +gboolean file_load_bootstrap( const gchar *filename );2.17 /**2.18 * Load a miscellaneous .bin file, as commonly used in demos. No magic2.19 * applies, file is loaded as is at 8C0100002.20 */2.21 -gboolean file_load_binary( gchar *filename );2.22 +gboolean file_load_binary( const gchar *filename );2.24 /**2.25 * Load a "Self Boot Inducer" .sbi file, also commonly used to package2.26 * demos. (Actually a ZIP file with a predefined structure2.27 */2.28 -gboolean file_load_sbi( gchar *filename );2.29 +gboolean file_load_sbi( const gchar *filename );2.31 /**2.32 * Load an ELF executable binary file. Origin is file-dependent.2.33 */2.34 -gboolean file_load_elf( gchar *filename );2.35 +gboolean file_load_elf( const gchar *filename );2.37 /**2.38 * Load any of the above file types, using the appropriate magic to determine2.39 * which is actually applicable2.40 */2.41 -gboolean file_load_magic( gchar *filename );2.42 +gboolean file_load_magic( const gchar *filename );2.44 #ifdef __cplusplus2.45 }
.