Search
lxdream.org :: lxdream :: r427:00270806b4cf
lxdream 0.9.1
released Jun 29
Download Now
changeset427:00270806b4cf
parent426:8a7a752f1174
child428:338966c8aed0
authornkeynes
dateSun Oct 07 06:21:14 2007 +0000 (16 years ago)
Fix compilation warnings
src/loader.c
src/loader.h
1.1 --- a/src/loader.c Sun Oct 07 06:10:52 2007 +0000
1.2 +++ b/src/loader.c Sun Oct 07 06:21:14 2007 +0000
1.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 the
1.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.16
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 0x80000004
1.21 #define CDI_V3 0x80000005
1.22
1.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.31
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.45
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.53
1.54
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.68
1.69 int file_load_elf_fd( int fd )
1.70 @@ -165,5 +173,6 @@
1.71 }
1.72 }
1.73
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 +0000
2.2 +++ b/src/loader.h Sun Oct 07 06:21:14 2007 +0000
2.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 errno
2.13 */
2.14 -gboolean file_load_bootstrap( gchar *filename );
2.15 +gboolean file_load_bootstrap( const gchar *filename );
2.16
2.17 /**
2.18 * Load a miscellaneous .bin file, as commonly used in demos. No magic
2.19 * applies, file is loaded as is at 8C010000
2.20 */
2.21 -gboolean file_load_binary( gchar *filename );
2.22 +gboolean file_load_binary( const gchar *filename );
2.23
2.24 /**
2.25 * Load a "Self Boot Inducer" .sbi file, also commonly used to package
2.26 * demos. (Actually a ZIP file with a predefined structure
2.27 */
2.28 -gboolean file_load_sbi( gchar *filename );
2.29 +gboolean file_load_sbi( const gchar *filename );
2.30
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.36
2.37 /**
2.38 * Load any of the above file types, using the appropriate magic to determine
2.39 * which is actually applicable
2.40 */
2.41 -gboolean file_load_magic( gchar *filename );
2.42 +gboolean file_load_magic( const gchar *filename );
2.43
2.44 #ifdef __cplusplus
2.45 }
.