/[gxemul]/upstream/0.4.4/src/file.c
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /upstream/0.4.4/src/file.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 32 by dpavlin, Mon Oct 8 16:20:58 2007 UTC revision 34 by dpavlin, Mon Oct 8 16:21:17 2007 UTC
# Line 1  Line 1 
1  /*  /*
2   *  Copyright (C) 2003-2006  Anders Gavare.  All rights reserved.   *  Copyright (C) 2003-2007  Anders Gavare.  All rights reserved.
3   *   *
4   *  Redistribution and use in source and binary forms, with or without   *  Redistribution and use in source and binary forms, with or without
5   *  modification, are permitted provided that the following conditions are met:   *  modification, are permitted provided that the following conditions are met:
# Line 25  Line 25 
25   *  SUCH DAMAGE.   *  SUCH DAMAGE.
26   *   *
27   *   *
28   *  $Id: file.c,v 1.135 2006/10/27 04:21:15 debug Exp $   *  $Id: file.c,v 1.140 2007/02/10 14:29:54 debug Exp $
29   *   *
30   *  This file contains functions which load executable images into (emulated)   *  This file contains functions which load executable images into (emulated)
31   *  memory. File formats recognized so far are:   *  memory. File formats recognized so far are:
# Line 1405  static void file_load_elf(struct machine Line 1405  static void file_load_elf(struct machine
1405                          ok = 1;                          ok = 1;
1406                  }                  }
1407                  break;                  break;
1408          case ARCH_AVR32:          /*  case ARCH_AVR32:
1409                  switch (emachine) {                  switch (emachine) {
1410                  case 6317:                  case 6317:
1411                          ok = 1;                          ok = 1;
# Line 1428  static void file_load_elf(struct machine Line 1428  static void file_load_elf(struct machine
1428                  case EM_IA_64:                  case EM_IA_64:
1429                          ok = 1;                          ok = 1;
1430                  }                  }
1431                  break;                  break;  */
1432          case ARCH_M68K:          case ARCH_M68K:
1433                  switch (emachine) {                  switch (emachine) {
1434                  case EM_68K:                  case EM_68K:
# Line 1462  static void file_load_elf(struct machine Line 1462  static void file_load_elf(struct machine
1462                          ok = 1;                          ok = 1;
1463                  }                  }
1464                  break;                  break;
1465          case ARCH_X86:          /*  case ARCH_X86:
1466                  switch (emachine) {                  switch (emachine) {
1467                  case EM_386:                  case EM_386:
1468                  case EM_486:                  case EM_486:
# Line 1474  static void file_load_elf(struct machine Line 1474  static void file_load_elf(struct machine
1474                          ok = 1;                          ok = 1;
1475                          break;                          break;
1476                  }                  }
1477                  break;                  break;  */
1478          default:          default:
1479                  fatal("file.c: INTERNAL ERROR: Unimplemented arch!\n");                  fatal("file.c: INTERNAL ERROR: Unimplemented arch!\n");
1480          }          }
# Line 2086  void file_load(struct machine *machine, Line 2086  void file_load(struct machine *machine,
2086                      "floppy image. Maybe you forgot the\n-d switch?\n");                      "floppy image. Maybe you forgot the\n-d switch?\n");
2087    
2088          /*          /*
2089             *  Ugly hack for Dreamcast:  When booting from a Dreamcast CDROM
2090             *  image, a temporary file is extracted into /tmp/gxemul.*, but this
2091             *  is a "scrambled" raw binary. This code unscrambles it, and loads
2092             *  it as a raw binary.
2093             */
2094            if (machine->machine_type == MACHINE_DREAMCAST &&
2095                strncmp(filename, "/tmp/gxemul.", 12) == 0) {
2096                    char *tmp_filename = malloc(strlen(filename) + 100);
2097                    snprintf(tmp_filename, strlen(filename) + 100,
2098                        "%s.descrambled", filename);
2099                    debug("descrambling into %s\n", tmp_filename);
2100                    dreamcast_descramble(filename, tmp_filename);
2101    
2102                    snprintf(tmp_filename, strlen(filename) + 100,
2103                        "0x8c010000:%s.descrambled", filename);
2104                    debug("loading descrambled Dreamcast binary\n");
2105                    file_load_raw(machine, mem, tmp_filename, entrypointp);
2106                    free(tmp_filename);
2107    
2108                    /*  Hack: Start a "boot from CDROM" sequence:  */
2109                    *entrypointp = 0x8c000080;
2110                    goto ret;
2111            }
2112    
2113            /*
2114           *  Last resort:  symbol definitions from nm (or nm -S):           *  Last resort:  symbol definitions from nm (or nm -S):
2115           *           *
2116           *  If the buf contains typical 'binary' characters, then print           *  If the buf contains typical 'binary' characters, then print

Legend:
Removed from v.32  
changed lines
  Added in v.34

  ViewVC Help
Powered by ViewVC 1.1.26