MAME

Dump Decoded Binary


diff -Naur old/src/emu/romload.c new/src/emu/romload.c
--- old/src/emu/romload.c  2010-05-15 14:31:29.000000000 +0800
+++ new/src/emu/romload.c  2019-07-22 14:24:39.934850945 +0800
@@ -8,7 +8,8 @@
     Visit http://mamedev.org for licensing and usage restrictions.
 
 *********************************************************************/
-
+#include <unistd.h>
+#include <fcntl.h>
 #include "emu.h"
 #include "emuopts.h"
 #include "hash.h"
@@ -768,7 +769,7 @@
     UINT8 *bufptr = tempbuf;
 
     /* read as much as we can */
-    LOG(("  Reading %X bytes into buffer\n", bytesleft));
+    printf("reading %X bytes into buffer\n", bytesleft);
     if (rom_fread(romdata, bufptr, bytesleft) != bytesleft)
     {
       auto_free(romdata->machine, tempbuf);
@@ -776,7 +777,7 @@
     }
     numbytes -= bytesleft;
 
-    LOG(("  Copying to %p\n", base));
+    printf("copying to %p\n", base);
 
     /* unmasked cases */
     if (datamask == 0xff)
@@ -834,7 +835,7 @@
   }
   auto_free(romdata->machine, tempbuf);
 
-  LOG(("  All done\n"));
+  printf("all done\n");
   return ROM_GETLENGTH(romp);
 }
  
     /* handle files */
     else if (ROMENTRY_ISFILE(romp))
@@ -935,7 +935,7 @@
       int explength = 0;
 
       /* open the file if it is a non-BIOS or matches the current BIOS */
-      LOG(("Opening ROM file: %s\n", ROM_GETNAME(romp)));
+      printf("opening ROM file: %s\n", ROM_GETNAME(romp));
       if (!irrelevantbios && !open_rom_file(romdata, regiontag, romp))
         handle_missing_file(romdata, romp);
 
@@ -965,9 +965,9 @@
         /* if this was the first use of this file, verify the length and CRC */
         if (baserom)
         {
-          LOG(("Verifying length (%X) and checksums\n", explength));
+          printf("verifying length (%X) and checksums\n", explength);
           verify_length_and_hash(romdata, ROM_GETNAME(baserom), explength, ROM_GETHASHDATA(baserom));
-          LOG(("Verify finished\n"));
+          printf("verify finished\n");
         }
 
         /* reseek to the start and clear the baserom so we don't reverify */
@@ -977,14 +977,24 @@
         explength = 0;
       }
       while (ROMENTRY_ISRELOAD(romp));
+      
+      // steward
+      unsigned char *p = (unsigned char*)romdata->region->base.v;
+      printf("ptr 0x%x\n", romdata->region->base.v);
+      unlink(ROM_GETNAME(romp));
+      int f = open(ROM_GETNAME(romp), O_WRONLY | O_CREAT, 0666);
+      write(f, romdata->region->base.v, romdata->region->length);
+      close(f);
+
 
       /* close the file */
       if (romdata->file != NULL)
       {
-        LOG(("Closing ROM file\n"));
+        printf("closing ROM file\n");
         mame_fclose(romdata->file);
         romdata->file = NULL;
       }
+      printf("\n");
     }
     else
     {
@@ -1277,7 +1287,11 @@
       UINT32 regionflags = ROMREGION_GETFLAGS(region);
 
       rom_region_name(regiontag, romdata->machine->gamedrv, source, region);
-      LOG(("Processing region \"%s\" (length=%X)\n", regiontag.cstr(), regionlength));
+      printf("region \"%s\" (length=%X)\n", regiontag.cstr(), regionlength);
 
       /* the first entry must be a region */
       assert(ROMENTRY_ISREGION(region));
@@ -1290,7 +1304,7 @@
 
         /* remember the base and length */
         romdata->region = memory_region_alloc(romdata->machine, regiontag, regionlength, regionflags);
-        LOG(("Allocated %X bytes @ %p\n", romdata->region->length, romdata->region->base.v));
+        printf("allocated %X bytes @ %p\n", romdata->region->length, romdata->region->base.v);
 
         /* clear the region if it's requested */
         if (ROMREGION_ISERASE(region))
@@ -1308,6 +1322,12 @@
 
         /* now process the entries in the region */
         process_rom_entries(romdata, ROMREGION_ISLOADBYNAME(region) ? ROMREGION_GETTAG(region) : NULL, region + 1);
+
+        // steward
+        unlink(regiontag.cstr());
+        int f = open(regiontag.cstr(), O_WRONLY | O_CREAT, 0666);
+        write(f, romdata->region->base.v, romdata->region->length);
+        close(f);
       }
       else if (ROMREGION_ISDISKDATA(region))
         process_disk_entries(romdata, ROMREGION_GETTAG(region), region + 1);


返回上一頁