Previous 15994 Revisions Next

r14532 Sunday 19th February, 2012 at 15:40:16 UTC by Miodrag Milanović
Sync with MAME r15453 (no whatsnew)
[src/lib/util]chdcd.c chdcd.h

src/lib/util/chdcd.c
r14531r14532
387387            index1 = read_uint64(infile);
388388            index2 = read_uint64(infile);
389389
390//              printf("Track %d: sector size %d mode %x index0 %llx index1 %llx index2 %llx (pregap %d sectors, length %d sectors)\n", track, size, mode, index0, index1, index2, (UINT32)(index1-index0)/size, (UINT32)(index2-index1)/size);
391            outinfo.track[track-1].fname.cpy(path.cstr()).cat(tocfname);
390                printf("Track %d: sector size %d mode %x index0 %llx index1 %llx index2 %llx (pregap %d sectors, length %d sectors)\n", track, size, mode, index0, index1, index2, (UINT32)(index1-index0)/size, (UINT32)(index2-index1)/size);
391//            outinfo.track[track-1].fname.cpy(path.cstr()).cat(tocfname);
392                strncpy(outinfo.track[track-1].fname, path.cstr(), 256);
393                strncat(outinfo.track[track-1].fname, tocfname, 256);
392394            outinfo.track[track-1].offset = offset + (UINT32)(index1-index0);
393395            outinfo.track[track-1].idx0offs = 0;
394396            outinfo.track[track-1].idx1offs = 0;
r14531r14532
538540         } while(tok!=NULL && (strrchr(tok,'"')-tok !=(strlen(tok)-1)));
539541         name = name.delchr('"');
540542      }
541      outinfo.track[trknum].fname.cpy(path.cstr()).cat(name);
543        strncpy(outinfo.track[trknum].fname, path.cstr(), 256);
544        strncat(outinfo.track[trknum].fname, name, 256);
542545
543546      sz=get_file_size(outinfo.track[trknum].fname);
544547
r14531r14532
687690            outinfo.track[trknum].idx0offs = -1;
688691            outinfo.track[trknum].idx1offs = 0;
689692
690            outinfo.track[trknum].fname.cpy(lastfname); // default filename to the last one
693            strncpy(outinfo.track[trknum].fname, lastfname, 256); // default filename to the last one
694
691695//              printf("trk %d: fname %s offset %d\n", trknum, outinfo.track[trknum].fname.cstr(), outinfo.track[trknum].offset);
692696
693697            cdrom_convert_type_string_to_track_info(token, &outtoc.tracks[trknum]);
r14531r14532
779783               tlen = get_file_size(outinfo.track[trknum].fname);
780784               if (tlen == 0)
781785               {
782                  printf("ERROR: couldn't find bin file [%s]\n", outinfo.track[trknum-1].fname.cstr());
786                  printf("ERROR: couldn't find bin file [%s]\n", outinfo.track[trknum-1].fname);
783787                  return CHDERR_FILE_NOT_FOUND;
784788               }
785789               outinfo.track[trknum].offset = outinfo.track[trknum-1].offset + outtoc.tracks[trknum-1].frames * (outtoc.tracks[trknum-1].datasize + outtoc.tracks[trknum-1].subsize);
r14531r14532
790794               tlen = get_file_size(outinfo.track[trknum].fname);
791795               if (tlen == 0)
792796               {
793                  printf("ERROR: couldn't find bin file [%s]\n", outinfo.track[trknum-1].fname.cstr());
797                  printf("ERROR: couldn't find bin file [%s]\n", outinfo.track[trknum-1].fname);
794798                  return CHDERR_FILE_NOT_FOUND;
795799               }
796800               tlen /= (outtoc.tracks[trknum].datasize + outtoc.tracks[trknum].subsize);
r14531r14532
825829               tlen = get_file_size(outinfo.track[trknum].fname);
826830               if (tlen == 0)
827831               {
828                  printf("ERROR: couldn't find bin file [%s]\n", outinfo.track[trknum].fname.cstr());
832                  printf("ERROR: couldn't find bin file [%s]\n", outinfo.track[trknum].fname);
829833                  return CHDERR_FILE_NOT_FOUND;
830834               }
831835               tlen /= (outtoc.tracks[trknum].datasize + outtoc.tracks[trknum].subsize);
r14531r14532
908912            TOKENIZE
909913
910914            /* keep the filename */
911            outinfo.track[trknum].fname.cpy(path.cstr()).cat(token);
915                strncpy(outinfo.track[trknum].fname, path.cstr(), 256);
916                strncat(outinfo.track[trknum].fname, token, 256);
912917
913918            /* get either the offset or the length */
914919            TOKENIZE
src/lib/util/chdcd.h
r14531r14532
1717struct chdcd_track_input_entry
1818{
1919   chdcd_track_input_entry() { reset(); }
20   void reset() { fname.reset(); offset = idx0offs = idx1offs = 0; swap = false; }
20   void reset() { fname[0] = '\0'; offset = idx0offs = idx1offs = 0; swap = false; }
2121
22   astring fname;      // filename for each track
22   char fname[1024];      // filename for each track
2323   UINT32 offset;      // offset in the data file for each track
2424   bool swap;         // data needs to be byte swapped
2525   UINT32 idx0offs;

Previous 15994 Revisions Next


© 1998-2018 The MESS Team