1.1 --- a/src/dcload.c Thu May 15 10:22:39 2008 +0000
1.2 +++ b/src/dcload.c Sun Sep 07 11:08:10 2008 +0000
1.6 for( i=0; i<MAX_OPEN_FDS; i++ ) {
1.7 - if( open_fds[i] == -1 ) {
1.10 + if( open_fds[i] == -1 ) {
1.18 switch( sh4r.r[4] ) {
1.21 - if( fd < 0 || fd >= MAX_OPEN_FDS || open_fds[fd] == -1 ) {
1.24 - sh4ptr_t buf = mem_get_region( sh4r.r[6] );
1.25 - int length = sh4r.r[7];
1.26 - sh4r.r[0] = read( open_fds[fd], buf, length );
1.30 + if( fd < 0 || fd >= MAX_OPEN_FDS || open_fds[fd] == -1 ) {
1.33 + sh4ptr_t buf = mem_get_region( sh4r.r[6] );
1.34 + int length = sh4r.r[7];
1.35 + sh4r.r[0] = read( open_fds[fd], buf, length );
1.40 - if( fd < 0 || fd >= MAX_OPEN_FDS || open_fds[fd] == -1 ) {
1.43 - sh4ptr_t buf = mem_get_region( sh4r.r[6] );
1.44 - int length = sh4r.r[7];
1.45 - sh4r.r[0] = write( open_fds[fd], buf, length );
1.49 + if( fd < 0 || fd >= MAX_OPEN_FDS || open_fds[fd] == -1 ) {
1.52 + sh4ptr_t buf = mem_get_region( sh4r.r[6] );
1.53 + int length = sh4r.r[7];
1.54 + sh4r.r[0] = write( open_fds[fd], buf, length );
1.59 - if( fd < 0 || fd >= MAX_OPEN_FDS || open_fds[fd] == -1 ) {
1.62 - sh4r.r[0] = lseek( open_fds[fd], sh4r.r[6], sh4r.r[7] );
1.66 + if( fd < 0 || fd >= MAX_OPEN_FDS || open_fds[fd] == -1 ) {
1.69 + sh4r.r[0] = lseek( open_fds[fd], sh4r.r[6], sh4r.r[7] );
1.73 -/* Secure access only */
1.74 + /* Secure access only */
1.76 - if( dcload_allow_unsafe ) {
1.77 - fd = dcload_alloc_fd();
1.81 - char *filename = (char *)mem_get_region( sh4r.r[5] );
1.82 - int realfd = open( filename, sh4r.r[6] );
1.83 - open_fds[fd] = realfd;
1.84 - sh4r.r[0] = realfd;
1.87 - ERROR( "Denying access to local filesystem" );
1.91 + if( dcload_allow_unsafe ) {
1.92 + fd = dcload_alloc_fd();
1.96 + char *filename = (char *)mem_get_region( sh4r.r[5] );
1.97 + int realfd = open( filename, sh4r.r[6] );
1.98 + open_fds[fd] = realfd;
1.99 + sh4r.r[0] = realfd;
1.102 + ERROR( "Denying access to local filesystem" );
1.107 - if( dcload_allow_unsafe ) {
1.109 - if( fd < 0 || fd >= MAX_OPEN_FDS || open_fds[fd] == -1 ) {
1.112 - if( open_fds[fd] > 2 ) {
1.113 - sh4r.r[0] = close( open_fds[fd] );
1.115 - /* Don't actually close real fds 0-2 */
1.118 - open_fds[fd] = -1;
1.122 + if( dcload_allow_unsafe ) {
1.124 + if( fd < 0 || fd >= MAX_OPEN_FDS || open_fds[fd] == -1 ) {
1.127 + if( open_fds[fd] > 2 ) {
1.128 + sh4r.r[0] = close( open_fds[fd] );
1.130 + /* Don't actually close real fds 0-2 */
1.133 + open_fds[fd] = -1;
1.138 - if( dcload_allow_unsafe ) {
1.139 - dreamcast_shutdown();
1.140 - exit( sh4r.r[5] );
1.142 - dreamcast_stop();
1.144 + if( dcload_allow_unsafe ) {
1.145 + dreamcast_shutdown();
1.146 + exit( sh4r.r[5] );
1.148 + dreamcast_stop();