src/lib/util/chdcd.c
| r14531 | r14532 | |
| 387 | 387 | index1 = read_uint64(infile); |
| 388 | 388 | index2 = read_uint64(infile); |
| 389 | 389 | |
| 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); |
| 392 | 394 | outinfo.track[track-1].offset = offset + (UINT32)(index1-index0); |
| 393 | 395 | outinfo.track[track-1].idx0offs = 0; |
| 394 | 396 | outinfo.track[track-1].idx1offs = 0; |
| r14531 | r14532 | |
| 538 | 540 | } while(tok!=NULL && (strrchr(tok,'"')-tok !=(strlen(tok)-1))); |
| 539 | 541 | name = name.delchr('"'); |
| 540 | 542 | } |
| 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); |
| 542 | 545 | |
| 543 | 546 | sz=get_file_size(outinfo.track[trknum].fname); |
| 544 | 547 | |
| r14531 | r14532 | |
| 687 | 690 | outinfo.track[trknum].idx0offs = -1; |
| 688 | 691 | outinfo.track[trknum].idx1offs = 0; |
| 689 | 692 | |
| 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 | |
| 691 | 695 | // printf("trk %d: fname %s offset %d\n", trknum, outinfo.track[trknum].fname.cstr(), outinfo.track[trknum].offset); |
| 692 | 696 | |
| 693 | 697 | cdrom_convert_type_string_to_track_info(token, &outtoc.tracks[trknum]); |
| r14531 | r14532 | |
| 779 | 783 | tlen = get_file_size(outinfo.track[trknum].fname); |
| 780 | 784 | if (tlen == 0) |
| 781 | 785 | { |
| 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); |
| 783 | 787 | return CHDERR_FILE_NOT_FOUND; |
| 784 | 788 | } |
| 785 | 789 | outinfo.track[trknum].offset = outinfo.track[trknum-1].offset + outtoc.tracks[trknum-1].frames * (outtoc.tracks[trknum-1].datasize + outtoc.tracks[trknum-1].subsize); |
| r14531 | r14532 | |
| 790 | 794 | tlen = get_file_size(outinfo.track[trknum].fname); |
| 791 | 795 | if (tlen == 0) |
| 792 | 796 | { |
| 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); |
| 794 | 798 | return CHDERR_FILE_NOT_FOUND; |
| 795 | 799 | } |
| 796 | 800 | tlen /= (outtoc.tracks[trknum].datasize + outtoc.tracks[trknum].subsize); |
| r14531 | r14532 | |
| 825 | 829 | tlen = get_file_size(outinfo.track[trknum].fname); |
| 826 | 830 | if (tlen == 0) |
| 827 | 831 | { |
| 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); |
| 829 | 833 | return CHDERR_FILE_NOT_FOUND; |
| 830 | 834 | } |
| 831 | 835 | tlen /= (outtoc.tracks[trknum].datasize + outtoc.tracks[trknum].subsize); |
| r14531 | r14532 | |
| 908 | 912 | TOKENIZE |
| 909 | 913 | |
| 910 | 914 | /* 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); |
| 912 | 917 | |
| 913 | 918 | /* get either the offset or the length */ |
| 914 | 919 | TOKENIZE |