diff --git a/DiscImageCreator/DiscImageCreator.cpp b/DiscImageCreator/DiscImageCreator.cpp index 5332ede..845c410 100644 --- a/DiscImageCreator/DiscImageCreator.cpp +++ b/DiscImageCreator/DiscImageCreator.cpp @@ -130,7 +130,7 @@ int soundBeep(int nRet) int exec(_TCHAR* argv[], PEXEC_TYPE pExecType, PEXT_ARG pExtArg, _TCHAR* pszFullPath) { - BOOL bRet = TRUE; + BOOL bRet = FALSE; SetLastError(NO_ERROR); if (*pExecType == sub) { @@ -147,39 +147,6 @@ int exec(_TCHAR* argv[], PEXEC_TYPE pExecType, PEXT_ARG pExtArg, _TCHAR* pszFull OutputLastErrorNumAndString(_T(__FUNCTION__), __LINE__); return FALSE; } -#if 0 - DWORD dwSize = 0; - GET_LENGTH_INFORMATION tLenInf; - DeviceIoControl(devData.hDevice, IOCTL_DISK_GET_LENGTH_INFO, NULL, 0, &tLenInf, sizeof(tLenInf), &dwSize, NULL ); - OutputString(_T("%llx\n"), tLenInf.Length.QuadPart); -#define LODWORD(l) ((DWORD)(((UINT64)(l)) & 0xffffffff)) -#define HIDWORD(l) ((DWORD)((((UINT64)(l)) >> 32) & 0xffffffff)) - OutputString(_T("%x\n"), LODWORD(tLenInf.Length.QuadPart)); - OutputString(_T("%x\n"), HIDWORD(tLenInf.Length.QuadPart)); - if (!LockFile(devData.hDevice, 0, 0, 0, 0)) { - OutputLastErrorNumAndString(_T(__FUNCTION__), __LINE__); - return FALSE; - } - DWORD dwReturned = 0; - CDROM_EXCLUSIVE_ACCESS exclusive; - exclusive.RequestType = ExclusiveAccessQueryState; - exclusive.Flags = 0; - - CDROM_EXCLUSIVE_LOCK_STATE lockstate = { 0 }; - bRet = DeviceIoControl(devData.hDevice, IOCTL_CDROM_EXCLUSIVE_ACCESS, - &exclusive, sizeof(CDROM_EXCLUSIVE_ACCESS), &lockstate, - sizeof(CDROM_EXCLUSIVE_LOCK_STATE), &dwReturned, NULL); - printf("RequestType %u, Flags %u\n", exclusive.RequestType, exclusive.Flags); - printf("LockState %u, CallerName %s\n", lockstate.LockState, lockstate.CallerName); - - CDROM_EXCLUSIVE_LOCK lock; - exclusive.RequestType = ExclusiveAccessLockDevice; - lock.Access = exclusive; - bRet = DeviceIoControl(devData.hDevice, IOCTL_CDROM_EXCLUSIVE_ACCESS, - &lock, sizeof(CDROM_EXCLUSIVE_LOCK), &lock, - sizeof(CDROM_EXCLUSIVE_LOCK), &dwReturned, NULL); - printf("RequestType %u, CallerName %s\n", lock.Access.RequestType, lock.CallerName); -#endif // 1st: set TimeOutValue here (because use ScsiPassThroughDirect) if (pExtArg->byScanProtectViaFile) { devData.dwTimeOutValue = pExtArg->dwTimeoutNum; @@ -227,164 +194,172 @@ int exec(_TCHAR* argv[], PEXEC_TYPE pExecType, PEXT_ARG pExtArg, _TCHAR* pszFull } else { ReadDriveInformation(pExecType, pExtArg, &devData, pDisc, s_dwSpeed); - if (*pExecType != dvd) { - if (!ReadTOC(pExtArg, pExecType, &devData, pDisc)) { - throw FALSE; - } - } - if (discData.SCSI.wCurrentMedia == ProfileCdrom || - discData.SCSI.wCurrentMedia == ProfileCdRecordable || - discData.SCSI.wCurrentMedia == ProfileCdRewritable || - (discData.SCSI.wCurrentMedia == ProfileInvalid && (*pExecType == gd))) { - if (!pExtArg->byC2) { - OutputString( - _T("[WARNING] /c2 isn't set. The result of ripping may be incorrect if c2 error exists.\n")); - } - // 6th: open ccd here (because use ReadTOCFull and from there) - if (*pExecType == cd && !pExtArg->byReverse) { - if (NULL == (fpCcd = CreateOrOpenFile(pszFullPath, NULL, - NULL, NULL, NULL, _T(".ccd"), _T(WFLAG), 0, 0))) { - OutputLastErrorNumAndString(_T(__FUNCTION__), __LINE__); + if (*pExecType == cd || *pExecType == gd || *pExecType == data || *pExecType == audio) { + if (discData.SCSI.wCurrentMedia == ProfileCdrom || + discData.SCSI.wCurrentMedia == ProfileCdRecordable || + discData.SCSI.wCurrentMedia == ProfileCdRewritable || + (discData.SCSI.wCurrentMedia == ProfileInvalid && (*pExecType == gd))) { + if (!pExtArg->byC2) { + OutputString( + _T("[WARNING] /c2 isn't set. The result of ripping may be incorrect if c2 error exists.\n")); + } + if (!ReadTOC(pExtArg, pExecType, &devData, pDisc)) { throw FALSE; } - } - if (discData.SCSI.wCurrentMedia == ProfileCdrom) { - ReadDiscInformation(pExtArg, &devData); - } - else if (discData.SCSI.wCurrentMedia == ProfileCdRecordable || - discData.SCSI.wCurrentMedia == ProfileCdRewritable) { - ReadTOCAtip(pExtArg, &devData); - } - InitMainDataHeader(pExecType, pExtArg, &mainHeader, s_nStartLBA); - if (!InitSubData(pExecType, &pDisc)) { - throw FALSE; - } - if (!InitTocFullData(pExecType, &pDisc)) { - throw FALSE; - } - if (!InitTocTextData(pExecType, &devData, &pDisc)) { - throw FALSE; - } - if (!InitProtectData(&pDisc)) { - throw FALSE; - } - make_scrambled_table(); - make_crc_table(); - MakeCrc16CCITTTable(); -#if 0 - MakeCrc6ITUTable(); -#endif - CDFLAG::_READ_CD::_ERROR_FLAGS c2 = CDFLAG::_READ_CD::NoC2; - ReadCDForCheckingByteOrder(pExtArg, &devData, &c2); - if (pExtArg->byC2 && devData.FEATURE.byC2ErrorData && c2 != CDFLAG::_READ_CD::NoC2) { - if (!InitC2ErrorData(pExtArg, - &pC2ErrorPerSector, CD_RAW_SECTOR_WITH_C2_AND_SUBCODE_SIZE, &c2ErrorContext)) { + // 6th: open ccd here (because use ReadTOCFull and from there) + if (*pExecType == cd && !pExtArg->byReverse) { + if (NULL == (fpCcd = CreateOrOpenFile(pszFullPath, NULL, + NULL, NULL, NULL, _T(".ccd"), _T(WFLAG), 0, 0))) { + OutputLastErrorNumAndString(_T(__FUNCTION__), __LINE__); + throw FALSE; + } + } + if (discData.SCSI.wCurrentMedia == ProfileCdrom) { + ReadDiscInformation(pExtArg, &devData); + } + else if (discData.SCSI.wCurrentMedia == ProfileCdRecordable || + discData.SCSI.wCurrentMedia == ProfileCdRewritable) { + ReadTOCAtip(pExtArg, &devData); + } + InitMainDataHeader(pExecType, pExtArg, &mainHeader, s_nStartLBA); + if (!InitSubData(pExecType, &pDisc)) { throw FALSE; } - if (NULL == (fpC2 = CreateOrOpenFile( - pszFullPath, NULL, NULL, NULL, NULL, _T(".c2"), _T("wb"), 0, 0))) { - OutputLastErrorNumAndString(_T(__FUNCTION__), __LINE__); + if (!InitTocFullData(pExecType, &pDisc)) { throw FALSE; } - } - pDisc->SUB.nSubchOffset = 0xff; - if (*pExecType != data) { - if (!ReadCDForSearchingOffset(pExecType, pExtArg, &devData, pDisc)) { + if (!InitTocTextData(pExecType, &devData, &pDisc)) { throw FALSE; } - } - if (pDisc->SUB.nSubchOffset && pExtArg->dwSubAddionalNum == 0) { - OutputString( - _T("[WARNING] Subch offset exists in this drive. Changed /s 0 to /s 1.\n")); - pExtArg->dwSubAddionalNum = 1; - } - if (/**pExecType == data && (pExtArg->byD8 || devData.byPlxtrDrive) ||*/ - (*pExecType != data && *pExecType != gd)) { - if (!ReadCDForCheckingReadInOut(pExtArg, &devData, pDisc)) { + if (!InitProtectData(&pDisc)) { throw FALSE; } - } - DISC_PER_SECTOR discPerSector = { 0 }; - memcpy(&discPerSector.mainHeader, &mainHeader, sizeof(MAIN_HEADER)); - if (!ReadTOCFull(pExtArg, &devData, &discData, &discPerSector, fpCcd)) { - throw FALSE; - } - if (!pExtArg->byReverse) { - // Typically, CD+G data is included in audio only disc - // But exceptionally, WonderMega Collection (SCD)(mixed disc) exists CD+G data. - if (!ReadCDForCheckingSubRtoW(pExtArg, &devData, pDisc)) { + make_scrambled_table(); + make_crc_table(); + MakeCrc16CCITTTable(); +#if 0 + MakeCrc6ITUTable(); +#endif + CDFLAG::_READ_CD::_ERROR_FLAGS c2 = CDFLAG::_READ_CD::NoC2; + ReadCDForCheckingByteOrder(pExtArg, &devData, &c2); + if (pExtArg->byC2 && devData.FEATURE.byC2ErrorData && c2 != CDFLAG::_READ_CD::NoC2) { + if (!InitC2ErrorData(pExtArg, + &pC2ErrorPerSector, CD_RAW_SECTOR_WITH_C2_AND_SUBCODE_SIZE, &c2ErrorContext)) { + throw FALSE; + } + if (NULL == (fpC2 = CreateOrOpenFile( + pszFullPath, NULL, NULL, NULL, NULL, _T(".c2"), _T("wb"), 0, 0))) { + OutputLastErrorNumAndString(_T(__FUNCTION__), __LINE__); + throw FALSE; + } + } +// if (*pExecType != data) { + if (!ReadCDForSearchingOffset(pExecType, pExtArg, &devData, pDisc)) { + throw FALSE; + } +// } + if (pDisc->SUB.nSubChannelOffset && pExtArg->dwSubAddionalNum == 0) { + OutputString( + _T("[WARNING] SubChannel Offset exists in this drive. Changed /s 0 to /s 1.\n")); + pExtArg->dwSubAddionalNum = 1; + } + if (/**pExecType == data && (pExtArg->byD8 || devData.byPlxtrDrive) ||*/ + (*pExecType != data && *pExecType != gd)) { + if (!ReadCDForCheckingReadInOut(pExtArg, &devData, pDisc)) { + throw FALSE; + } + } + DISC_PER_SECTOR discPerSector = { 0 }; + memcpy(&discPerSector.mainHeader, &mainHeader, sizeof(MAIN_HEADER)); + if (!ReadTOCFull(pExtArg, &devData, &discData, &discPerSector, fpCcd)) { throw FALSE; } - if (pDisc->SCSI.trackType != TRACK_TYPE::audioOnly) { - if (!ReadCDForFileSystem(pExtArg, &devData, pDisc)) { + if (!pDisc->SCSI.bMultiSession && pExtArg->byRawDump) { + OutputString( + _T("[WARNING] This disc isn't Multi-Session. /raw is ignored.\n")); + pExtArg->byRawDump = FALSE; + } + if (!pExtArg->byReverse) { + // Typically, CD+G data is included in audio only disc + // But exceptionally, WonderMega Collection (SCD)(mixed disc) exists CD+G data. + if (!ReadCDForCheckingSubRtoW(pExtArg, &devData, pDisc)) { throw FALSE; } - if (pExtArg->byScanProtectViaSector) { - if (!ReadCDForScanningProtectViaSector(pExtArg, &devData, pDisc)) { + if (pDisc->SCSI.trackType != TRACK_TYPE::audioOnly) { + if (!ReadCDForFileSystem(pExtArg, &devData, pDisc)) { throw FALSE; } + if (pExtArg->byScanProtectViaSector) { + if (!ReadCDForScanningProtectViaSector(pExtArg, &devData, pDisc)) { + throw FALSE; + } + } + if ((pExtArg->byScanProtectViaFile || pExtArg->byScanProtectViaSector) && + pDisc->PROTECT.byExist == PROTECT_TYPE::no) { + OutputString( + _T("[WARNING] Protection can't be detected. /sf, /ss is ignored.\n")); + pExtArg->byScanProtectViaFile = FALSE; + pExtArg->byScanProtectViaSector = FALSE; + } } -#if 1 - if ((pExtArg->byScanProtectViaFile || pExtArg->byScanProtectViaSector) && - pDisc->PROTECT.byExist == PROTECT_TYPE::no) { - OutputString( - _T("[WARNING] Protection can't be detected. /sf or/and /ss is ignored.\n")); - pExtArg->byScanProtectViaFile = FALSE; - pExtArg->byScanProtectViaSector = FALSE; + } + if (*pExecType == cd) { + bRet = ReadCDAll(pExecType, pExtArg, &devData, pDisc, &discPerSector + , pC2ErrorPerSector, c2, pszFullPath, fpCcd, fpC2); + } + else if (*pExecType == gd) { + if (!ReadCDForGDTOC(pExtArg, &devData, pDisc)) { + throw FALSE; } -#endif + bRet = ReadCDPartial(pExecType, pExtArg, &devData, pDisc, &discPerSector, pC2ErrorPerSector + , c2, pszFullPath, FIRST_LBA_FOR_GD, 549149 + 1, CDFLAG::_READ_CD::CDDA, fpC2); } - } - if (*pExecType == cd) { - bRet = ReadCDAll(pExecType, pExtArg, &devData, pDisc, &discPerSector - , pC2ErrorPerSector, c2, pszFullPath, fpCcd, fpC2); - } - else if (*pExecType == gd) { - if (!ReadCDForGDTOC(pExtArg, &devData, pDisc)) { - throw FALSE; + else if (*pExecType == data) { + bRet = ReadCDPartial(pExecType, pExtArg, &devData, pDisc, &discPerSector, pC2ErrorPerSector + , c2, pszFullPath, s_nStartLBA, s_nEndLBA, CDFLAG::_READ_CD::All, fpC2); + } + else if (*pExecType == audio) { + bRet = ReadCDPartial(pExecType, pExtArg, &devData, pDisc, &discPerSector, pC2ErrorPerSector + , c2, pszFullPath, s_nStartLBA, s_nEndLBA, CDFLAG::_READ_CD::CDDA, fpC2); } - bRet = ReadCDPartial(pExecType, pExtArg, &devData, pDisc, &discPerSector, pC2ErrorPerSector - , c2, pszFullPath, FIRST_LBA_FOR_GD, 549149 + 1, CDFLAG::_READ_CD::CDDA, fpC2); - } - else if (*pExecType == data) { - bRet = ReadCDPartial(pExecType, pExtArg, &devData, pDisc, &discPerSector, pC2ErrorPerSector - , c2, pszFullPath, s_nStartLBA, s_nEndLBA, CDFLAG::_READ_CD::All, fpC2); } - else if (*pExecType == audio) { - bRet = ReadCDPartial(pExecType, pExtArg, &devData, pDisc, &discPerSector, pC2ErrorPerSector - , c2, pszFullPath, s_nStartLBA, s_nEndLBA, CDFLAG::_READ_CD::CDDA, fpC2); + else { + OutputString(_T("Wrong command. The disc isn't CD, CD-R, CD-RW, GD\n")); } } - else if (discData.SCSI.wCurrentMedia == ProfileDvdRom || - discData.SCSI.wCurrentMedia == ProfileDvdRecordable || - discData.SCSI.wCurrentMedia == ProfileDvdRam || - discData.SCSI.wCurrentMedia == ProfileDvdRewritable || - discData.SCSI.wCurrentMedia == ProfileDvdRWSequential || - discData.SCSI.wCurrentMedia == ProfileDvdDashRDualLayer || - discData.SCSI.wCurrentMedia == ProfileDvdDashRLayerJump || - discData.SCSI.wCurrentMedia == ProfileDvdPlusRW || -// discData.SCSI.wCurrentMedia == ProfileInvalid || - discData.SCSI.wCurrentMedia == ProfileDvdPlusR) { - bRet = ReadDVDStructure(pExtArg, &devData, &discData); - FlushLog(); + else if (*pExecType == dvd) { + if (discData.SCSI.wCurrentMedia == ProfileDvdRom || + discData.SCSI.wCurrentMedia == ProfileDvdRecordable || + discData.SCSI.wCurrentMedia == ProfileDvdRam || + discData.SCSI.wCurrentMedia == ProfileDvdRewritable || + discData.SCSI.wCurrentMedia == ProfileDvdRWSequential || + discData.SCSI.wCurrentMedia == ProfileDvdDashRDualLayer || + discData.SCSI.wCurrentMedia == ProfileDvdDashRLayerJump || + discData.SCSI.wCurrentMedia == ProfileDvdPlusRW || + discData.SCSI.wCurrentMedia == ProfileDvdPlusR) { + bRet = ReadDVDStructure(pExtArg, &devData, &discData); - if (pExtArg->byCmi) { - bRet = ReadDVDForCMI(pExtArg, &devData, &discData); - } - if (bRet) { - if (argv[5] && !_tcsncmp(argv[5], _T("raw"), 3)) { + if (pExtArg->byCmi) { + bRet = ReadDVDForCMI(pExtArg, &devData, &discData); + } + if (bRet) { + if (argv[5] && !_tcsncmp(argv[5], _T("raw"), 3)) { #if 0 - bRet = ReadDVDRaw(&devData, &discData, szVendorId, pszFullPath); + bRet = ReadDVDRaw(&devData, &discData, szVendorId, pszFullPath); #endif - } - else { - bRet = ReadDVD(pExtArg, &devData, &discData, pszFullPath); + } + else { + bRet = ReadDVD(pExtArg, &devData, &discData, pszFullPath); + } } } + else { + OutputString(_T("Wrong command. The disc isn't DVD, DVD-R, DVD-RW\n")); + } } - if (bRet && (*pExecType == cd || *pExecType == dvd || *pExecType == gd)) { - bRet = ReadWriteDat(pExecType, pszFullPath, discData.SCSI.toc.LastTrack, s_szDrive, s_szDir, s_szFname); - } + } + if (bRet && (*pExecType == cd || *pExecType == dvd || *pExecType == gd)) { + bRet = ReadWriteDat(pExecType, pszFullPath, discData.SCSI.toc.LastTrack, s_szDrive, s_szDir, s_szFname); } } catch (BOOL bErr) { @@ -406,12 +381,6 @@ int exec(_TCHAR* argv[], PEXEC_TYPE pExecType, PEXT_ARG pExtArg, _TCHAR* pszFull TerminateLogFile(pExecType, pExtArg); #endif } -#if 0 - if (!UnlockFile(devData.hDevice, 0, 0, 0, 0)) { - OutputLastErrorNumAndString(_T(__FUNCTION__), __LINE__); - return FALSE; - } -#endif if (devData.hDevice && !CloseHandle(devData.hDevice)) { OutputLastErrorNumAndString(_T(__FUNCTION__), __LINE__); return FALSE; @@ -689,9 +658,6 @@ int checkArg(int argc, _TCHAR* argv[], PEXEC_TYPE pExecType, PEXT_ARG pExtArg, _ else if (cmdLen == 4 && !_tcsncmp(argv[i - 1], _T("/raw"), 4)) { pExtArg->byRawDump = TRUE; } - else if (cmdLen == 2 && !_tcsncmp(argv[i - 1], _T("/r"), 2)) { - pExtArg->byReverse = TRUE; - } else if (cmdLen == 3 && !_tcsncmp(argv[i - 1], _T("/np"), 3)) { pExtArg->bySkipSubP = TRUE; } @@ -835,6 +801,9 @@ int checkArg(int argc, _TCHAR* argv[], PEXEC_TYPE pExecType, PEXT_ARG pExtArg, _ return FALSE; } } + else if (cmdLen == 2 && !_tcsncmp(argv[i - 1], _T("/r"), 2)) { + pExtArg->byReverse = TRUE; + } else if (cmdLen == 3 && !_tcsncmp(argv[i - 1], _T("/sf"), 3)) { if (!SetOptionSf(argc, argv, pExtArg, &i)) { return FALSE; @@ -875,6 +844,10 @@ int checkArg(int argc, _TCHAR* argv[], PEXEC_TYPE pExecType, PEXT_ARG pExtArg, _ *pExecType = fd; printAndSetPath(argv[3], pszFullPath); } + else { + OutputErrorString(_T("Invalid argument\n")); + return FALSE; + } } else if (argc == 3) { cmdLen = _tcslen(argv[1]); @@ -897,6 +870,10 @@ int checkArg(int argc, _TCHAR* argv[], PEXEC_TYPE pExecType, PEXT_ARG pExtArg, _ *pExecType = sub; printAndSetPath(argv[2], pszFullPath); } + else { + OutputErrorString(_T("Invalid argument\n")); + return FALSE; + } } else { if (argc > 1) { @@ -935,13 +912,13 @@ void printUsage(void) OutputString( _T("Usage\n") _T("\tcd [/q] [/a (val)]\n") - _T("\t [/be (str) or /d8] [/c2 (val1) (val2) (val3)] [/f] [/m] [/p] [/r]\n") + _T("\t [/be (str) or /d8] [/c2 (val1) (val2) (val3)] [/f] [/m] [/p]\n") _T("\t [/raw] [/sf (val)] [/ss] [/np] [/nq] [/nr] [/ns] [/s (val)]\n") - _T("\t\tRipping a CD from a to z\n") + _T("\t\tRipping a CD from A to Z\n") _T("\t\tFor PLEXTOR or drive that can scramble ripping\n") _T("\tdata \n") _T("\t [/q] [/be (str) or /d8] [/c2 (val1) (val2) (val3)] [/sf (val)]\n") - _T("\t [/ss] [/np] [/nq] [/nr] [/ns] [/s (val)]\n") + _T("\t [/ss] [/r] [/np] [/nq] [/nr] [/ns] [/s (val)]\n") _T("\t\tRipping a CD from start to end (using 'all' flag)\n") _T("\t\tFor no PLEXTOR or drive that can't scramble ripping\n") _T("\taudio \n") @@ -951,12 +928,12 @@ void printUsage(void) _T("\t\tFor dumping a lead-in, lead-out mainly\n") _T("\tgd [/q] [/be (str) or /d8]\n") _T("\t [/c2 (val1) (val2) (val3)] [/np] [/nq] [/nr] [/ns] [/s (val)]\n") - _T("\t\tRipping a HD area of GD from a to z\n") + _T("\t\tRipping a HD area of GD from A to Z\n") _T("\tdvd [/c] [/f] [/q]\n") ); _tsystem(_T("pause")); OutputString( - _T("\t\tRipping a DVD from a to z\n") + _T("\t\tRipping a DVD from A to Z\n") _T("\tfd \n") _T("\t\tRipping a floppy disk\n") _T("\tstop \n") @@ -972,32 +949,32 @@ void printUsage(void) _T("\tsub \n") _T("\t\tParse CloneCD sub file and output to readable format\n") _T("Option (generic)\n") + _T("\t/f\tUse 'Force Unit Access' flag to defeat the cache (very slow)\n") _T("\t/q\tDisable beep\n") _T("Option (for CD read mode)\n") _T("\t/a\tAdd CD offset manually (Only Audio CD)\n") _T("\t\t\tval\tsamples value\n") - _T("\t/be\tUse 0xbe as ReadCD command forcibly\n") + _T("\t/be\tUse 0xbe as the opcode for Reading CD forcibly\n") _T("\t\t\tstr\t raw: sub channel mode is raw (default)\n") _T("\t\t\t \tpack: sub channel mode is pack\n") - _T("\t/d8\tUse 0xd8 as ReadCD command forcibly\n") ); _tsystem(_T("pause")); OutputString( - _T("\t/c2\tContinue to read cd to recover C2 error existing sector\n") + _T("\t/d8\tUse 0xd8 as the opcode for Reading CD forcibly\n") + _T("\t/c2\tContinue reading CD to recover C2 error existing sector\n") _T("\t\t\tval1\tvalue to reread (default: 1024)\n") _T("\t\t\tval2\tvalue to fix a C2 error (default: 4096)\n") _T("\t\t\tval3\tvalue to reread speed (default: 4)\n") - _T("\t/f\tUse 'Force Unit Access' flag to defeat the cache (very slow)\n") - _T("\t/m\tIf MCN exists in the first pregap sector of the track, use this\n") - _T("\t\t\tFor some PC-Engine discs\n") - _T("\t/p\tRipping AMSF from 00:00:00 to 00:01:74\n") + _T("\t/m\tUse if MCN exists in the first pregap sector of the track\n") + _T("\t\t\tFor some PC-Engine\n") + _T("\t/p\tRipping the AMSF from 00:00:00 to 00:01:74\n") _T("\t\t\tFor SagaFrontier Original Sound Track (Disc 3) etc.\n") _T("\t\t\tSupport drive: PLEXTOR PX-W5224, PREMIUM, PREMIUM2\n") _T("\t\t\t PX-704, 708, 712, 714, 716, 755, 760\n") - _T("\t/r\tReverse reading CD (including data track)\n") - _T("\t\t\tFor Alpha-Disc, very slow\n") - _T("\t/raw\tReading CD all (=including lead-in/out)\n") - _T("\t\t\tFor raw dumping\n") + _T("\t/r\tRead CD from the reverse\n") + _T("\t\t\tFor Alpha-Disc, Tages (very slow)\n") + _T("\t/raw\tRead the lead-out of 1st session and the lead-in of 2nd session\n") + _T("\t\t\tFor Multi-session\n") _T("\t/sf\tScan file to detect protect. If reading error exists,\n") _T("\t \tcontinue reading and ignore c2 error on specific sector\n") _T("\t\t\tFor CodeLock, LaserLock, RingProtect, RingPROTECH\n") @@ -1015,17 +992,17 @@ void printUsage(void) _T("\t/nr\tNot fix SubRtoW\n") _T("\t/nl\tNot fix SubQ (RMSF, AMSF, CRC) (LBA 14100 - 16199)\n") _T("\t \t (LBA 42000 - 44399)\n") - _T("\t\t\tFor PlayStation LibCrypt discs\n") + _T("\t\t\tFor PlayStation LibCrypt\n") _T("\t/ns\tNot fix SubQ (RMSF, AMSF, CRC) (LBA 0 - 7, 5000 - 18799)\n") _T("\t \t or (LBA 30800 - 34799)\n") _T("\t \t or (LBA 40000 - 45799)\n") _T("\t\t\tFor SecuROM\n") - _T("\t/s\tIf it reads subchannel precisely, use this\n") + _T("\t/s\tUse if it reads subchannel precisely\n") _T("\t\t\tval\t0: no read next sub (fast, but lack precision)\n") _T("\t\t\t \t1: read next sub (normal, this val is default)\n") _T("\t\t\t \t2: read next & next next sub (slow, precision)\n") _T("Option (for DVD)\n") - _T("\t/c\tLog Copyright Management Information (Only DVD)\n") + _T("\t/c\tLog Copyright Management Information\n") ); _tsystem(_T("pause")); } @@ -1069,34 +1046,7 @@ int _tmain(int argc, _TCHAR* argv[]) return EXIT_FAILURE; } #endif - int nRet = TRUE; - HANDLE hMutex = CreateMutex(NULL, FALSE, _T("DiscImageCreator")); - if (!hMutex || - GetLastError() == ERROR_INVALID_HANDLE || - GetLastError() == ERROR_ALREADY_EXISTS) { - OutputLastErrorNumAndString(_T(__FUNCTION__), __LINE__); - return EXIT_FAILURE; - } -#if 0 - HANDLE hSnapshot; - if ((hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0)) != INVALID_HANDLE_VALUE) { - PROCESSENTRY32 pe32; - pe32.dwSize = sizeof(PROCESSENTRY32); - - if (Process32First(hSnapshot,&pe32)) { - do { - if (!_tcscmp(pe32.szExeFile, _T("IsoBuster.exe"))) { - OutputErrorString(_T("Please close %s\n"), pe32.szExeFile); - CloseHandle(hSnapshot); - soundBeep(FALSE); - return FALSE; - } - } while(Process32Next(hSnapshot,&pe32)); - } - CloseHandle(hSnapshot); - } -#endif - nRet = printSeveralInfo(); + int nRet = printSeveralInfo(); if (nRet) { EXEC_TYPE execType; EXT_ARG extArg = { 0 }; @@ -1125,10 +1075,6 @@ int _tmain(int argc, _TCHAR* argv[]) _tcsftime(szBuf, sizeof(szBuf) / sizeof(szBuf[0]), _T("%Y-%m-%d(%a) %H:%M:%S"), ts); OutputString(_T("End time: %s\n"), szBuf); } - if (!CloseHandle(hMutex)) { - OutputLastErrorNumAndString(_T(__FUNCTION__), __LINE__); - nRet = FALSE; - } if (!extArg.byQuiet) { nRet = soundBeep(nRet); } diff --git a/DiscImageCreator/check.cpp b/DiscImageCreator/check.cpp index ce4e671..1d72433 100644 --- a/DiscImageCreator/check.cpp +++ b/DiscImageCreator/check.cpp @@ -1155,7 +1155,7 @@ VOID CheckAndFixSubQ( // LBA[208052, 0x32cb4], Audio, 2ch, Copy NG, Pre-emphasis No, Track[56], Idx[01], RMSF[03:15:35], AMSF[46:16:00], RtoW[0, 0, 0, 0] // LBA[208053, 0x32cb5], Audio, 2ch, Copy NG, Pre-emphasis No, Track[56], Idx[01], RMSF[03:15:36], AMSF[46:16:03], RtoW[0, 0, 0, 0] // LBA[208054, 0x32cb6], Audio, 2ch, Copy NG, Pre-emphasis No, Track[56], Idx[01], RMSF[03:15:37], AMSF[46:16:04], RtoW[0, 0, 0, 0] - BOOL bAMSF = IsValidSubQAMSF(pExecType, pDisc->SUB.byIndex0InTrack1, pSubQ, lpSubcode, nLBA); + BOOL bAMSF = IsValidSubQAMSF(pExecType, pExtArg->byPre, pSubQ, lpSubcode, nLBA); BOOL bAFrame = IsValidSubQAFrame(lpSubcode, nLBA); if (-76 < nLBA) { @@ -1400,7 +1400,7 @@ VOID CheckAndFixSubQ( lpSubcode[18] = 0; } - if (!IsValidSubQAMSF(pExecType, pDisc->SUB.byIndex0InTrack1, pSubQ, lpSubcode, nLBA)) { + if (!IsValidSubQAMSF(pExecType, pExtArg->byPre, pSubQ, lpSubcode, nLBA)) { BYTE byFrame = 0; BYTE bySecond = 0; BYTE byMinute = 0; @@ -1664,7 +1664,7 @@ VOID CheckAndFixSubChannel( BOOL bSecuRom ) { - if (pDisc->SUB.nSubchOffset) { + if (pDisc->SUB.nSubChannelOffset) { SetTmpSubQDataFromBuffer(&pDiscPerSector->subQ.next, pDiscPerSector->subcode.next); if (1 <= pExtArg->dwSubAddionalNum) { SetTmpSubQDataFromBuffer(&pDiscPerSector->subQ.nextNext, pDiscPerSector->subcode.nextNext); @@ -1742,36 +1742,30 @@ BOOL ContainsC2Error( return bRet; } -BOOL SupportIndex0InTrack1( +VOID SupportIndex0InTrack1( PEXT_ARG pExtArg, - PDEVICE pDevice, - PDISC pDisc + PDEVICE pDevice ) { - BOOL bRet = TRUE; - if (pDevice->byPlxtrDrive == PLXTR_DRIVE_TYPE::PX760A || - pDevice->byPlxtrDrive == PLXTR_DRIVE_TYPE::PX755A || - pDevice->byPlxtrDrive == PLXTR_DRIVE_TYPE::PX716AL || - pDevice->byPlxtrDrive == PLXTR_DRIVE_TYPE::PX716A || - pDevice->byPlxtrDrive == PLXTR_DRIVE_TYPE::PX714A || - pDevice->byPlxtrDrive == PLXTR_DRIVE_TYPE::PX712A || - pDevice->byPlxtrDrive == PLXTR_DRIVE_TYPE::PX708A2 || - pDevice->byPlxtrDrive == PLXTR_DRIVE_TYPE::PX708A || - pDevice->byPlxtrDrive == PLXTR_DRIVE_TYPE::PX704A || - pDevice->byPlxtrDrive == PLXTR_DRIVE_TYPE::PREMIUM2 || - pDevice->byPlxtrDrive == PLXTR_DRIVE_TYPE::PREMIUM || - pDevice->byPlxtrDrive == PLXTR_DRIVE_TYPE::PXW5224A) { - pDisc->SUB.byIndex0InTrack1 = TRUE; - } - else { + if (pDevice->byPlxtrDrive != PLXTR_DRIVE_TYPE::PX760A && + pDevice->byPlxtrDrive != PLXTR_DRIVE_TYPE::PX755A && + pDevice->byPlxtrDrive != PLXTR_DRIVE_TYPE::PX716AL && + pDevice->byPlxtrDrive != PLXTR_DRIVE_TYPE::PX716A && + pDevice->byPlxtrDrive != PLXTR_DRIVE_TYPE::PX714A && + pDevice->byPlxtrDrive != PLXTR_DRIVE_TYPE::PX712A && + pDevice->byPlxtrDrive != PLXTR_DRIVE_TYPE::PX708A2 && + pDevice->byPlxtrDrive != PLXTR_DRIVE_TYPE::PX708A && + pDevice->byPlxtrDrive != PLXTR_DRIVE_TYPE::PX704A && + pDevice->byPlxtrDrive != PLXTR_DRIVE_TYPE::PREMIUM2 && + pDevice->byPlxtrDrive != PLXTR_DRIVE_TYPE::PREMIUM && + pDevice->byPlxtrDrive != PLXTR_DRIVE_TYPE::PXW5224A) { OutputString( _T("This drive doesn't support to rip from 00:00:00 to 00:01:74 AMSF. /p option is ignored\n")); pExtArg->byPre = FALSE; } - return bRet; } -BOOL ExecCheckingSubchannnel( +BOOL IsCheckingSubChannel( PEXT_ARG pExtArg, PDISC pDisc, INT nLBA diff --git a/DiscImageCreator/check.h b/DiscImageCreator/check.h index 4331448..b0f542c 100644 --- a/DiscImageCreator/check.h +++ b/DiscImageCreator/check.h @@ -79,13 +79,12 @@ BOOL ContainsDiffByte( UINT i ); -BOOL SupportIndex0InTrack1( +VOID SupportIndex0InTrack1( PEXT_ARG pExtArg, - PDEVICE pDevice, - PDISC pDisc + PDEVICE pDevice ); -BOOL ExecCheckingSubchannnel( +BOOL IsCheckingSubChannel( PEXT_ARG pExtArg, PDISC pDisc, INT nLBA diff --git a/DiscImageCreator/execScsiCmd.cpp b/DiscImageCreator/execScsiCmd.cpp index f35cc87..967548f 100644 --- a/DiscImageCreator/execScsiCmd.cpp +++ b/DiscImageCreator/execScsiCmd.cpp @@ -206,6 +206,7 @@ BOOL ReadTOCFull( ReadTOCText(pExtArg, pDevice, pDisc, fpCcd); } } + pDisc->SCSI.bMultiSession = fullToc.LastCompleteSession > 1 ? TRUE : FALSE; WORD wFullTocLenFix = wTocEntriesAll + sizeof(CDROM_TOC_FULL_TOC_DATA); // 4 byte padding @@ -794,7 +795,7 @@ BOOL ReadDriveInformation( IsValidPlextorDrive(pDevice); if ((PLXTR_DRIVE_TYPE)pDevice->byPlxtrDrive != PLXTR_DRIVE_TYPE::No) { if (pExtArg->byPre) { - SupportIndex0InTrack1(pExtArg, pDevice, pDisc); + SupportIndex0InTrack1(pExtArg, pDevice); } ReadEeprom(pExtArg, pDevice); SetSpeedRead(pExtArg, pDevice, TRUE); @@ -896,6 +897,13 @@ BOOL ReadDirectoryRecordDetail( CHAR szCurDirName[MAX_FNAME_FOR_VOLUME] = { 0 }; LPBYTE lpDirRec = lpBuf + uiOfs; if (lpDirRec[0] >= MIN_LEN_DR) { + if (lpDirRec[0] == MIN_LEN_DR && uiOfs > 0 && uiOfs % DISC_RAW_READ_SIZE == 0) { + // SimCity 3000 (USA) + OutputVolDescLogA( + "Direcory record size of the %d sector maybe incorrect. Skip the reading of this sector\n", nLBA); + nSectorNum++; + break; + } DWORD dwExtentPos = GetSizeOrDwordForVolDesc(lpDirRec + 2) / byLogicalBlkCoef; DWORD dwDataLen = GetSizeOrDwordForVolDesc(lpDirRec + 10); OutputFsDirectoryRecord( diff --git a/DiscImageCreator/execScsiCmdforCD.cpp b/DiscImageCreator/execScsiCmdforCD.cpp index 448319a..b708254 100644 --- a/DiscImageCreator/execScsiCmdforCD.cpp +++ b/DiscImageCreator/execScsiCmdforCD.cpp @@ -18,6 +18,54 @@ // These global variable is set at prngcd.cpp extern unsigned char scrambled_table[2352]; +BOOL GetLBAForSubChannelOffset( + PEXT_ARG pExtArg, + PDEVICE pDevice, + PDISC pDisc, + LPBYTE lpCmd, + INT nLBA, + LPBYTE lpBuf, + DWORD dwBufLen +) +{ + BOOL bRet = TRUE; + LPBYTE pBuf = NULL; + LPBYTE lpBufTmp = NULL; + if (!GetAlignedCallocatedBuffer(pDevice, &pBuf, + dwBufLen, &lpBufTmp, _T(__FUNCTION__), __LINE__)) { + return FALSE; + } + memcpy(lpBufTmp, lpBuf, dwBufLen); + BYTE lpSubcode[CD_RAW_READ_SUBCODE_SIZE] = { 0 }; + for (;;) { + if (dwBufLen == CD_RAW_READ_SUBCODE_SIZE) { + AlignRowSubcode(lpBufTmp, lpSubcode); + } + else if (dwBufLen == CD_RAW_SECTOR_WITH_SUBCODE_SIZE) { + AlignRowSubcode(lpBufTmp + CD_RAW_SECTOR_SIZE, lpSubcode); + } + else if (dwBufLen == CD_RAW_SECTOR_WITH_C2_294_AND_SUBCODE_SIZE) { + AlignRowSubcode(lpBufTmp + CD_RAW_SECTOR_SIZE + CD_RAW_READ_C2_294_SIZE, lpSubcode); + } + OutputCDSub96Align(lpSubcode, nLBA); + + if ((lpSubcode[12] & 0x0f) == ADR_ENCODES_CURRENT_POSITION) { + pDisc->SUB.nSubChannelOffset = MSFtoLBA(BcdToDec(lpSubcode[19]), + BcdToDec(lpSubcode[20]), BcdToDec(lpSubcode[21])) - 150 - nLBA; + break; + } + else { + if (!ExecReadCD(pExtArg, pDevice, lpCmd, ++nLBA + , lpBufTmp, dwBufLen, _T(__FUNCTION__), __LINE__)) { + bRet = FALSE; + break; + } + } + } + FreeAndNull(pBuf); + return bRet; +} + BOOL ExecSearchingOffset( PEXEC_TYPE pExecType, PEXT_ARG pExtArg, @@ -29,8 +77,7 @@ BOOL ExecSearchingOffset( DWORD dwBufSize, BOOL bGetDriveOffset, INT nDriveSampleOffset, - INT nDriveOffset, - BOOL bSubchOffset + INT nDriveOffset ) { if (!ExecReadCD(pExtArg, pDevice, lpCmd, nLBA @@ -91,22 +138,13 @@ BOOL ExecSearchingOffset( } if (dwBufSize == CD_RAW_SECTOR_WITH_SUBCODE_SIZE || dwBufSize == CD_RAW_SECTOR_WITH_C2_294_AND_SUBCODE_SIZE) { - BYTE lpSubcode[CD_RAW_READ_SUBCODE_SIZE] = { 0 }; - if (dwBufSize == CD_RAW_SECTOR_WITH_SUBCODE_SIZE) { - AlignRowSubcode(lpBuf + CD_RAW_SECTOR_SIZE, lpSubcode); - } - else if (dwBufSize == CD_RAW_SECTOR_WITH_C2_294_AND_SUBCODE_SIZE) { - AlignRowSubcode(lpBuf + CD_RAW_SECTOR_SIZE + CD_RAW_READ_C2_294_SIZE, lpSubcode); - } - OutputCDSub96Align(lpSubcode, nLBA); - if (bSubchOffset) { - pDisc->SUB.nSubchOffset = MSFtoLBA(BcdToDec(lpSubcode[19]), - BcdToDec(lpSubcode[20]), BcdToDec(lpSubcode[21])) - 150 - nLBA; + if (!GetLBAForSubChannelOffset(pExtArg, pDevice, pDisc, lpCmd, nLBA, lpBuf, dwBufSize)) { + return FALSE; } } if (!pExtArg->byD8 && !pDevice->byPlxtrDrive && *pExecType != gd) { - if (pDisc->SUB.nSubchOffset != 0xff) { - OutputDiscLogA("\tSubch Offset: %d\n", pDisc->SUB.nSubchOffset); + if (pDisc->SUB.nSubChannelOffset != 0xff) { + OutputDiscLogA("\tSubChannel Offset: %d\n", pDisc->SUB.nSubChannelOffset); } } else { @@ -131,47 +169,11 @@ BOOL ExecSearchingOffset( } } OutputCDOffset(pExtArg, pDisc, bGetDriveOffset - , nDriveSampleOffset, nDriveOffset, pDisc->SUB.nSubchOffset); + , nDriveSampleOffset, nDriveOffset, pDisc->SUB.nSubChannelOffset); } return TRUE; } -INT GetLBAForSubOffset( - PEXT_ARG pExtArg, - PDEVICE pDevice, - LPBYTE lpCmd, - INT nLBA, - LPBYTE lpBuf, - DWORD dwBufLen - ) -{ - for (;;) { - if (!ExecReadCD(pExtArg, pDevice, lpCmd, nLBA - , lpBuf, dwBufLen, _T(__FUNCTION__), __LINE__)) { - break; - } - // check for sub offset - BYTE lpSubcode[CD_RAW_READ_SUBCODE_SIZE] = { 0 }; - if (dwBufLen == CD_RAW_READ_SUBCODE_SIZE) { - AlignRowSubcode(lpBuf, lpSubcode); - } - else if (dwBufLen == CD_RAW_SECTOR_WITH_SUBCODE_SIZE) { - AlignRowSubcode(lpBuf + CD_RAW_SECTOR_SIZE, lpSubcode); - } -#if 0 - OutputCDSub96Align(lpSubcode, nLBA); -#endif - if ((lpSubcode[12] & 0x0f) == ADR_ENCODES_CURRENT_POSITION) { - break; - } - else { - nLBA++; - REVERSE_BYTES(&lpCmd[2], &nLBA); - } - } - return nLBA; -} - BOOL ReadCDForSearchingOffset( PEXEC_TYPE pExecType, PEXT_ARG pExtArg, @@ -229,7 +231,7 @@ BOOL ReadCDForSearchingOffset( LPBYTE pBuf = NULL; LPBYTE lpBuf = NULL; if (!GetAlignedCallocatedBuffer(pDevice, &pBuf, - CD_RAW_SECTOR_WITH_C2_294_AND_SUBCODE_SIZE, &lpBuf, _T(__FUNCTION__), __LINE__)) { + CD_RAW_SECTOR_WITH_C2_AND_SUBCODE_SIZE, &lpBuf, _T(__FUNCTION__), __LINE__)) { return FALSE; } if (*pExecType == gd) { @@ -241,36 +243,33 @@ BOOL ReadCDForSearchingOffset( SetReadD8Command(pDevice, &cdb, 1, CDFLAG::_PLXTR_READ_CDDA::NoSub); memcpy(lpCmd, &cdb, CDB12GENERIC_LENGTH); - lpCmd[10] = (BYTE)CDFLAG::_PLXTR_READ_CDDA::Raw; INT nLBA = pDisc->SCSI.nFirstLBAofDataTrack; - nLBA += GetLBAForSubOffset(pExtArg, pDevice, lpCmd, 0, lpBuf, CD_RAW_READ_SUBCODE_SIZE); ZeroMemory(lpBuf, CD_RAW_SECTOR_WITH_C2_294_AND_SUBCODE_SIZE); - lpCmd[10] = (BYTE)CDFLAG::_PLXTR_READ_CDDA::NoSub; if (pDisc->SCSI.trackType != TRACK_TYPE::audioOnly) { if (!ExecSearchingOffset(pExecType, pExtArg, pDevice, pDisc, lpCmd, nLBA, lpBuf - , CD_RAW_SECTOR_SIZE, bGetDriveOffset, nDriveSampleOffset, nDriveOffset, FALSE)) { + , CD_RAW_SECTOR_SIZE, bGetDriveOffset, nDriveSampleOffset, nDriveOffset)) { bRet = FALSE; } } lpCmd[10] = (BYTE)CDFLAG::_PLXTR_READ_CDDA::MainQ; if (!ExecSearchingOffset(pExecType, pExtArg, pDevice, pDisc, lpCmd, nLBA, lpBuf - , CD_RAW_SECTOR_SIZE + 16, bGetDriveOffset, nDriveSampleOffset, nDriveOffset, FALSE)) { + , CD_RAW_SECTOR_SIZE + 16, bGetDriveOffset, nDriveSampleOffset, nDriveOffset)) { // not return FALSE } lpCmd[10] = (BYTE)CDFLAG::_PLXTR_READ_CDDA::MainPack; if (!ExecSearchingOffset(pExecType, pExtArg, pDevice, pDisc, lpCmd, nLBA, lpBuf - , CD_RAW_SECTOR_WITH_SUBCODE_SIZE, bGetDriveOffset, nDriveSampleOffset, nDriveOffset, TRUE)) { + , CD_RAW_SECTOR_WITH_SUBCODE_SIZE, bGetDriveOffset, nDriveSampleOffset, nDriveOffset)) { bRet = FALSE; } lpCmd[10] = (BYTE)CDFLAG::_PLXTR_READ_CDDA::Raw; if (!ExecSearchingOffset(pExecType, pExtArg, pDevice, pDisc, lpCmd, nLBA, lpBuf - , CD_RAW_READ_SUBCODE_SIZE, bGetDriveOffset, nDriveSampleOffset, nDriveOffset, FALSE)) { + , CD_RAW_READ_SUBCODE_SIZE, bGetDriveOffset, nDriveSampleOffset, nDriveOffset)) { // not return FALSE } lpCmd[10] = (BYTE)CDFLAG::_PLXTR_READ_CDDA::MainC2Raw; if (!ExecSearchingOffset(pExecType, pExtArg, pDevice, pDisc, lpCmd, nLBA, lpBuf - , CD_RAW_SECTOR_WITH_C2_294_AND_SUBCODE_SIZE, bGetDriveOffset, nDriveSampleOffset, nDriveOffset, TRUE)) { + , CD_RAW_SECTOR_WITH_C2_294_AND_SUBCODE_SIZE, bGetDriveOffset, nDriveSampleOffset, nDriveOffset)) { pExtArg->byC2 = FALSE; pDevice->FEATURE.byC2ErrorData = FALSE; // not return FALSE @@ -278,17 +277,15 @@ BOOL ReadCDForSearchingOffset( } else { CDFLAG::_READ_CD::_EXPECTED_SECTOR_TYPE flg = CDFLAG::_READ_CD::CDDA; -// if (*pExecType == data) { -// flg = CDFLAG::_READ_CD::All; -// } + if (*pExecType == data) { + flg = CDFLAG::_READ_CD::All; + } CDB::_READ_CD cdb = { 0 }; SetReadCDCommand(NULL, pDevice, &cdb, flg - , 1, CDFLAG::_READ_CD::NoC2, CDFLAG::_READ_CD::NoSub, FALSE); + , 1, CDFLAG::_READ_CD::NoC2, CDFLAG::_READ_CD::Raw, FALSE); memcpy(lpCmd, &cdb, CDB12GENERIC_LENGTH); - lpCmd[10] = (BYTE)CDFLAG::_READ_CD::Raw; INT nLBA = pDisc->SCSI.nFirstLBAofDataTrack; - nLBA += GetLBAForSubOffset(pExtArg, pDevice, lpCmd, 0, lpBuf, CD_RAW_SECTOR_WITH_SUBCODE_SIZE); ZeroMemory(lpBuf, CD_RAW_SECTOR_WITH_C2_294_AND_SUBCODE_SIZE); if (pExtArg->byC2 && pDevice->FEATURE.byC2ErrorData) { @@ -297,23 +294,23 @@ BOOL ReadCDForSearchingOffset( memcpy(lpCmd, &cdb, CDB12GENERIC_LENGTH); if (pDisc->SCSI.trackType != TRACK_TYPE::audioOnly) { if (!ExecSearchingOffset(pExecType, pExtArg, pDevice, pDisc, lpCmd, nLBA, lpBuf - , CD_RAW_SECTOR_WITH_C2_294_SIZE, bGetDriveOffset, nDriveSampleOffset, nDriveOffset, FALSE)) { + , CD_RAW_SECTOR_WITH_C2_294_SIZE, bGetDriveOffset, nDriveSampleOffset, nDriveOffset)) { // not return FALSE } } lpCmd[10] = (BYTE)CDFLAG::_READ_CD::Raw; if (!ExecSearchingOffset(pExecType, pExtArg, pDevice, pDisc, lpCmd, nLBA, lpBuf - , CD_RAW_SECTOR_WITH_C2_294_AND_SUBCODE_SIZE, bGetDriveOffset, nDriveSampleOffset, nDriveOffset, TRUE)) { + , CD_RAW_SECTOR_WITH_C2_294_AND_SUBCODE_SIZE, bGetDriveOffset, nDriveSampleOffset, nDriveOffset)) { bRet = FALSE; } lpCmd[10] = (BYTE)CDFLAG::_READ_CD::Q; if (!ExecSearchingOffset(pExecType, pExtArg, pDevice, pDisc, lpCmd, nLBA, lpBuf - , CD_RAW_SECTOR_WITH_C2_294_SIZE + 16, bGetDriveOffset, nDriveSampleOffset, nDriveOffset, FALSE)) { + , CD_RAW_SECTOR_WITH_C2_294_SIZE + 16, bGetDriveOffset, nDriveSampleOffset, nDriveOffset)) { // not return FALSE } lpCmd[10] = (BYTE)CDFLAG::_READ_CD::Pack; if (!ExecSearchingOffset(pExecType, pExtArg, pDevice, pDisc, lpCmd, nLBA, lpBuf - , CD_RAW_SECTOR_WITH_C2_294_AND_SUBCODE_SIZE, bGetDriveOffset, nDriveSampleOffset, nDriveOffset, TRUE)) { + , CD_RAW_SECTOR_WITH_C2_294_AND_SUBCODE_SIZE, bGetDriveOffset, nDriveSampleOffset, nDriveOffset)) { // not return FALSE } if (!bRet) { @@ -323,23 +320,23 @@ BOOL ReadCDForSearchingOffset( memcpy(lpCmd, &cdb, CDB12GENERIC_LENGTH); if (pDisc->SCSI.trackType != TRACK_TYPE::audioOnly) { if (!ExecSearchingOffset(pExecType, pExtArg, pDevice, pDisc, lpCmd, nLBA, lpBuf - , CD_RAW_SECTOR_WITH_C2_SIZE, bGetDriveOffset, nDriveSampleOffset, nDriveOffset, FALSE)) { + , CD_RAW_SECTOR_WITH_C2_SIZE, bGetDriveOffset, nDriveSampleOffset, nDriveOffset)) { // not return FALSE } } lpCmd[10] = (BYTE)CDFLAG::_READ_CD::Raw; if (!ExecSearchingOffset(pExecType, pExtArg, pDevice, pDisc, lpCmd, nLBA, lpBuf - , CD_RAW_SECTOR_WITH_C2_AND_SUBCODE_SIZE, bGetDriveOffset, nDriveSampleOffset, nDriveOffset, TRUE)) { + , CD_RAW_SECTOR_WITH_C2_AND_SUBCODE_SIZE, bGetDriveOffset, nDriveSampleOffset, nDriveOffset)) { bRet = FALSE; } lpCmd[10] = (BYTE)CDFLAG::_READ_CD::Q; if (!ExecSearchingOffset(pExecType, pExtArg, pDevice, pDisc, lpCmd, nLBA, lpBuf - , CD_RAW_SECTOR_WITH_C2_SIZE + 16, bGetDriveOffset, nDriveSampleOffset, nDriveOffset, FALSE)) { + , CD_RAW_SECTOR_WITH_C2_SIZE + 16, bGetDriveOffset, nDriveSampleOffset, nDriveOffset)) { // not return FALSE } lpCmd[10] = (BYTE)CDFLAG::_READ_CD::Pack; if (!ExecSearchingOffset(pExecType, pExtArg, pDevice, pDisc, lpCmd, nLBA, lpBuf - , CD_RAW_SECTOR_WITH_C2_AND_SUBCODE_SIZE, bGetDriveOffset, nDriveSampleOffset, nDriveOffset, TRUE)) { + , CD_RAW_SECTOR_WITH_C2_AND_SUBCODE_SIZE, bGetDriveOffset, nDriveSampleOffset, nDriveOffset)) { // not return FALSE } } @@ -348,14 +345,14 @@ BOOL ReadCDForSearchingOffset( if (*pExecType != data && pDisc->SCSI.trackType != TRACK_TYPE::audioOnly) { lpCmd[10] = (BYTE)CDFLAG::_READ_CD::NoSub; if (!ExecSearchingOffset(pExecType, pExtArg, pDevice, pDisc, lpCmd, nLBA, lpBuf - , CD_RAW_SECTOR_SIZE, bGetDriveOffset, nDriveSampleOffset, nDriveOffset, FALSE)) { + , CD_RAW_SECTOR_SIZE, bGetDriveOffset, nDriveSampleOffset, nDriveOffset)) { // not return FALSE } } lpCmd[10] = (BYTE)CDFLAG::_READ_CD::Raw; for(INT n = 1; n <= 10; n++) { if (!ExecSearchingOffset(pExecType, pExtArg, pDevice, pDisc, lpCmd, nLBA, lpBuf - , CD_RAW_SECTOR_WITH_SUBCODE_SIZE, bGetDriveOffset, nDriveSampleOffset, nDriveOffset, TRUE)) { + , CD_RAW_SECTOR_WITH_SUBCODE_SIZE, bGetDriveOffset, nDriveSampleOffset, nDriveOffset)) { if (n == 10) { bRet = FALSE; break; @@ -372,12 +369,12 @@ BOOL ReadCDForSearchingOffset( } lpCmd[10] = (BYTE)CDFLAG::_READ_CD::Q; if (!ExecSearchingOffset(pExecType, pExtArg, pDevice, pDisc, lpCmd, nLBA, lpBuf - , CD_RAW_SECTOR_SIZE + 16, bGetDriveOffset, nDriveSampleOffset, nDriveOffset, FALSE)) { + , CD_RAW_SECTOR_SIZE + 16, bGetDriveOffset, nDriveSampleOffset, nDriveOffset)) { // not return FALSE } lpCmd[10] = (BYTE)CDFLAG::_READ_CD::Pack; if (!ExecSearchingOffset(pExecType, pExtArg, pDevice, pDisc, lpCmd, nLBA, lpBuf - , CD_RAW_SECTOR_WITH_SUBCODE_SIZE, bGetDriveOffset, nDriveSampleOffset, nDriveOffset, TRUE)) { + , CD_RAW_SECTOR_WITH_SUBCODE_SIZE, bGetDriveOffset, nDriveSampleOffset, nDriveOffset)) { // not return FALSE } } @@ -521,7 +518,7 @@ BOOL ReadCDForCheckingSubQAdr( OutputCDSub96Align(lpSubcode, nLBA); #endif if (nLBA == nTmpLBA) { - // this func is used to get a subch offset + // this func is used to get a SubChannel Offset SetTmpSubQDataFromBuffer(&pDiscPerSector->subQ.present, lpSubcode); BYTE byCtl = (BYTE)((lpSubcode[12] >> 4) & 0x0f); *byMode = GetMode(lpBuf2, 0, byCtl, unscrambled); @@ -1569,6 +1566,8 @@ BOOL ReadCDForRereadingSector( } while (uiC2ErrorLBACnt > 0) { + OutputC2ErrorLogA( + "Reread times: %4u, needs to reread sector num: %d\n", uiCnt + 1, uiC2ErrorLBACnt); if (uiCnt == pExtArg->dwMaxRereadNum) { OutputString(_T("\nReread reached max: %u"), uiCnt); bProcessRet = RETURNED_FALSE; @@ -1762,8 +1761,8 @@ BOOL ReadCDForCheckingSecuROM( OutputLogA(standardOut | fileDisc, "Detected intentional subchannel in LBA -1 => SecuROM Type3 (a.k.a. NEW)\n"); OutputIntentionalSubchannel(-1, &pDiscPerSector->subcode.present[12]); pDisc->PROTECT.byExist = securomV3; - if (pDisc->SUB.nSubchOffset) { - pDisc->SUB.nSubchOffset -= 1; + if (pDisc->SUB.nSubChannelOffset) { + pDisc->SUB.nSubChannelOffset -= 1; } pDiscPerSector->subQ.prev.nRelativeTime = -1; pDiscPerSector->subQ.prev.nAbsoluteTime = 149; @@ -1835,19 +1834,10 @@ BOOL ReadCDAll( FILE* fpImg = NULL; _TCHAR pszOutReverseScmFile[_MAX_PATH] = { 0 }; _TCHAR pszOutScmFile[_MAX_PATH] = { 0 }; - if (pExtArg->byReverse) { - if (NULL == (fpImg = CreateOrOpenFile(pszPath, _T("_reverse"), - pszOutReverseScmFile, NULL, NULL, _T(".scm"), _T("wb"), 0, 0))) { - OutputLastErrorNumAndString(_T(__FUNCTION__), __LINE__); - return FALSE; - } - } - else { - if (NULL == (fpImg = CreateOrOpenFile(pszPath, NULL, - pszOutScmFile, NULL, NULL, _T(".scm"), _T("wb"), 0, 0))) { - OutputLastErrorNumAndString(_T(__FUNCTION__), __LINE__); - return FALSE; - } + if (NULL == (fpImg = CreateOrOpenFile(pszPath, NULL, + pszOutScmFile, NULL, NULL, _T(".scm"), _T("wb"), 0, 0))) { + OutputLastErrorNumAndString(_T(__FUNCTION__), __LINE__); + return FALSE; } BOOL bRet = TRUE; FILE* fpCue = NULL; @@ -1937,7 +1927,7 @@ BOOL ReadCDAll( BYTE lpPrevSubcode[CD_RAW_READ_SUBCODE_SIZE] = { 0 }; // to get prevSubQ - if (pDisc->SUB.nSubchOffset) { + if (pDisc->SUB.nSubChannelOffset) { if (!ExecReadCD(pExtArg, pDevice, lpCmd, -2, pDiscPerSector->data.present, pDevice->TRANSFER.dwAllBufLen, _T(__FUNCTION__), __LINE__)) { throw FALSE; @@ -1999,29 +1989,9 @@ BOOL ReadCDAll( /* } */ - INT nLBA = nFirstLBA; // This value switches by /r option. + INT nLBA = nFirstLBA; - if (pExtArg->byReverse) { - SetCDOffset(pExecType, pExtArg->byBe, pDevice->byPlxtrDrive, pDisc, nLastLBA, pDisc->SCSI.nFirstLBAofDataTrack); - byCurrentTrackNum = pDisc->SCSI.byLastDataTrackNum; - nFirstLBA = pDisc->SCSI.nFirstLBAofDataTrack; - nLastLBA = pDisc->SCSI.nLastLBAofDataTrack + 1; - nLBA = nLastLBA; - if (pDisc->MAIN.nCombinedOffset > 0) { - pDiscPerSector->subQ.prev.nAbsoluteTime = 149 + nLastLBA; - } - else if (pDisc->MAIN.nCombinedOffset < 0) { - pDiscPerSector->subQ.prev.nAbsoluteTime = 150 + nLastLBA + pDisc->MAIN.nAdjustSectorNum; - } - else { - pDiscPerSector->subQ.prev.nAbsoluteTime = 149 + nLastLBA; - } - pDiscPerSector->subQ.prev.byCtl = pDisc->SUB.lpEndCtlList[pDisc->SCSI.byLastDataTrackNum - 1]; - pDiscPerSector->subQ.prev.byAdr = ADR_ENCODES_CURRENT_POSITION; - pDiscPerSector->subQ.prev.byTrackNum = pDisc->SCSI.byLastDataTrackNum; - pDiscPerSector->subQ.prev.byIndex = pDisc->MAIN.nOffsetStart < 0 ? (BYTE)0 : (BYTE)1; - } - else if (pDisc->SUB.byIndex0InTrack1) { + if (pExtArg->byPre) { nFirstLBAForSub = PREGAP_START_LBA; nFirstLBA = PREGAP_START_LBA; nLBA = nFirstLBA; @@ -2031,7 +2001,7 @@ BOOL ReadCDAll( FlushLog(); UINT uiC2ErrorLBACnt = 0; - BOOL bReadOK = pDisc->SUB.byIndex0InTrack1 ? FALSE : TRUE; + BOOL bReadOK = pExtArg->byPre ? FALSE : TRUE; while (nFirstLBA < nLastLBA) { BOOL bProcessRet = ProcessReadCD(pExecType, pExtArg, pDevice, pDisc @@ -2057,13 +2027,8 @@ BOOL ReadCDAll( #endif } else if (bProcessRet == RETURNED_SKIP_LBA) { - if (pExtArg->byReverse) { - nLBA = pDisc->SCSI.nFirstLBAof2ndSession - SESSION_TO_SESSION_SKIP_LBA; - } - else { - nLBA = pDisc->MAIN.nFixFirstLBAof2ndSession - 1; - nFirstLBA = nLBA; - } + nLBA = pDisc->MAIN.nFixFirstLBAof2ndSession - 1; + nFirstLBA = nLBA; } else if (bProcessRet == RETURNED_CONTINUE) { ProcessReturnedContinue(pExecType, pExtArg, pDevice, pDisc, pDiscPerSector @@ -2074,7 +2039,7 @@ BOOL ReadCDAll( } if (bProcessRet != RETURNED_CONTINUE && bProcessRet != RETURNED_SKIP_LBA) { - if (pDisc->SUB.nSubchOffset) { + if (pDisc->SUB.nSubChannelOffset) { if (!(pExtArg->byScanProtectViaFile && pDisc->PROTECT.byExist && (pDisc->PROTECT.ERROR_SECTOR.nExtentPos <= nLBA && nLBA <= pDisc->PROTECT.ERROR_SECTOR.nExtentPos + pDisc->PROTECT.ERROR_SECTOR.nSectorSize))) { @@ -2091,7 +2056,7 @@ BOOL ReadCDAll( } SetTmpSubQDataFromBuffer(&pDiscPerSector->subQ.present, pDiscPerSector->subcode.present); - if (pDisc->SUB.byIndex0InTrack1 && PREGAP_START_LBA <= nLBA && nLBA <= -76) { + if (pExtArg->byPre && PREGAP_START_LBA <= nLBA && nLBA <= -76) { if (pDiscPerSector->subQ.present.byTrackNum == 1 && pDiscPerSector->subQ.present.nAbsoluteTime == 0) { pDiscPerSector->subQ.prev.nRelativeTime = pDiscPerSector->subQ.present.nRelativeTime + 1; @@ -2114,24 +2079,22 @@ BOOL ReadCDAll( } if (bReadOK) { if (nFirstLBAForSub <= nLBA && nLBA < pDisc->SCSI.nAllLength) { - if (ExecCheckingSubchannnel(pExtArg, pDisc, nLBA)) { + if (IsCheckingSubChannel(pExtArg, pDisc, nLBA)) { BOOL bLibCrypt = IsValidLibCryptSector(pExtArg->byLibCrypt, nLBA); BOOL bSecuRom = IsValidIntentionalSubSector(pExtArg->byIntentionalSub, pDisc, nLBA); - if (!pExtArg->byReverse) { - CheckAndFixSubChannel(pExecType, pExtArg, pDevice, pDisc - , pDiscPerSector, byCurrentTrackNum, nLBA, bLibCrypt, bSecuRom); - BYTE lpSubcodeRaw[CD_RAW_READ_SUBCODE_SIZE] = { 0 }; - // fix raw subchannel - AlignColumnSubcode(pDiscPerSector->subcode.present, lpSubcodeRaw); + CheckAndFixSubChannel(pExecType, pExtArg, pDevice, pDisc + , pDiscPerSector, byCurrentTrackNum, nLBA, bLibCrypt, bSecuRom); + BYTE lpSubcodeRaw[CD_RAW_READ_SUBCODE_SIZE] = { 0 }; + // fix raw subchannel + AlignColumnSubcode(pDiscPerSector->subcode.present, lpSubcodeRaw); #if 0 - OutputCDSub96Align(pDiscPerSector->subcode.present, nLBA); + OutputCDSub96Align(pDiscPerSector->subcode.present, nLBA); #endif #if 0 - OutputCDSub96Raw(standardOut, lpSubcodeRaw, nLBA); + OutputCDSub96Raw(standardOut, lpSubcodeRaw, nLBA); #endif - WriteSubChannel(pDisc, lpSubcodeRaw, - pDiscPerSector->subcode.present, nLBA, byCurrentTrackNum, fpSub, fpParse); - } + WriteSubChannel(pDisc, lpSubcodeRaw, + pDiscPerSector->subcode.present, nLBA, byCurrentTrackNum, fpSub, fpParse); CheckAndFixMainHeader(pExtArg, pDisc , pDiscPerSector, nLBA, byCurrentTrackNum, nMainDataType); SetTrackAttribution(pExtArg, pDisc, nLBA, @@ -2145,32 +2108,26 @@ BOOL ReadCDAll( WriteC2(pExtArg, pDisc, pDiscPerSector->data.present + pDevice->TRANSFER.dwBufC2Offset, nLBA, fpC2); } } - // for DEBUG begin +#if 0 else { BYTE lpSubcodeRaw[CD_RAW_READ_SUBCODE_SIZE] = { 0 }; AlignColumnSubcode(pDiscPerSector->subcode.present, lpSubcodeRaw); OutputCDSubToLog(pDisc, pDiscPerSector->subcode.present, lpSubcodeRaw, nLBA, byCurrentTrackNum, fpParse); } - // for DEBUG end - if (pDisc->SUB.nSubchOffset) { +#endif + if (pDisc->SUB.nSubChannelOffset) { memcpy(lpPrevSubcode, pDiscPerSector->subcode.next, CD_RAW_READ_SUBCODE_SIZE); } } - if (pExtArg->byReverse) { - OutputString(_T("\rCreated img (LBA) %6d/%6d"), nLBA, pDisc->SCSI.nFirstLBAofDataTrack); - nLBA--; - } - else { - OutputString(_T("\rCreated img (LBA) %6d/%6d"), nLBA, pDisc->SCSI.nAllLength - 1); - if (nFirstLBA == -76) { - nLBA = nFirstLBA; - if (!bReadOK) { - bReadOK = TRUE; - } + OutputString(_T("\rCreated img (LBA) %6d/%6d"), nLBA, pDisc->SCSI.nAllLength - 1); + if (nFirstLBA == -76) { + nLBA = nFirstLBA; + if (!bReadOK) { + bReadOK = TRUE; } - nLBA++; } + nLBA++; nFirstLBA++; } OutputString(_T("\n")); @@ -2181,40 +2138,38 @@ BOOL ReadCDAll( FcloseAndNull(fpSub); FlushLog(); - if (!pExtArg->byReverse) { - if (pDisc->SCSI.toc.FirstTrack == pDisc->SCSI.toc.LastTrack) { - // [3DO] Jurassic Park Interactive (Japan) - if (pDisc->SUB.lpFirstLBAListOnSub[0][2] == -1) { - pDisc->SUB.lpFirstLBAListOnSub[0][1] = pDisc->SCSI.lpLastLBAListOnToc[0]; - } + if (pDisc->SCSI.toc.FirstTrack == pDisc->SCSI.toc.LastTrack) { + // [3DO] Jurassic Park Interactive (Japan) + if (pDisc->SUB.lpFirstLBAListOnSub[0][2] == -1) { + pDisc->SUB.lpFirstLBAListOnSub[0][1] = pDisc->SCSI.lpLastLBAListOnToc[0]; } - for (INT i = 0; i < pDisc->SCSI.toc.LastTrack; i++) { - if (pDisc->PROTECT.byExist == cds300 && i == pDisc->SCSI.toc.LastTrack - 1) { - break; - } - BOOL bErr = FALSE; - LONG lLine = 0; - if (pDisc->SUB.lpFirstLBAListOnSub[i][1] == -1) { + } + for (INT i = 0; i < pDisc->SCSI.toc.LastTrack; i++) { + if (pDisc->PROTECT.byExist == cds300 && i == pDisc->SCSI.toc.LastTrack - 1) { + break; + } + BOOL bErr = FALSE; + LONG lLine = 0; + if (pDisc->SUB.lpFirstLBAListOnSub[i][1] == -1) { + bErr = TRUE; + lLine = __LINE__; + } + else if ((pDisc->SCSI.toc.TrackData[i].Control & AUDIO_DATA_TRACK) == AUDIO_DATA_TRACK) { + if (pDisc->SUB.lpFirstLBAListOfDataTrackOnSub[i] == -1) { bErr = TRUE; lLine = __LINE__; } - else if ((pDisc->SCSI.toc.TrackData[i].Control & AUDIO_DATA_TRACK) == AUDIO_DATA_TRACK) { - if (pDisc->SUB.lpFirstLBAListOfDataTrackOnSub[i] == -1) { - bErr = TRUE; - lLine = __LINE__; - } - else if (pDisc->SUB.lpLastLBAListOfDataTrackOnSub[i] == -1) { - bErr = TRUE; - lLine = __LINE__; - } - } - if (bErr) { - OutputErrorString( - _T("[L:%ld] Internal error. Failed to analyze the subchannel. Track[%02u]/[%02u]\n"), - lLine, i + 1, pDisc->SCSI.toc.LastTrack); - throw FALSE; + else if (pDisc->SUB.lpLastLBAListOfDataTrackOnSub[i] == -1) { + bErr = TRUE; + lLine = __LINE__; } } + if (bErr) { + OutputErrorString( + _T("[L:%ld] Internal error. Failed to analyze the subchannel. Track[%02u]/[%02u]\n"), + lLine, i + 1, pDisc->SCSI.toc.LastTrack); + throw FALSE; + } } if (pExtArg->byC2 && pDevice->FEATURE.byC2ErrorData) { if (!ReadCDForRereadingSector(pExecType, pExtArg, pDevice, pDisc @@ -2223,42 +2178,7 @@ BOOL ReadCDAll( } } FcloseAndNull(fpImg); - - if (!pExtArg->byReverse) { - OutputTocWithPregap(pDisc); - } - else { - FILE* fpImg_r = NULL; - if (NULL == (fpImg_r = CreateOrOpenFile( - pszPath, _T("_reverse"), NULL, NULL, NULL, _T(".scm"), _T("rb"), 0, 0))) { - OutputLastErrorNumAndString(_T(__FUNCTION__), __LINE__); - throw FALSE; - } - if (NULL == (fpImg = CreateOrOpenFile( - pszPath, NULL, pszOutScmFile, NULL, NULL, _T(".scm"), _T("wb"), 0, 0))) { - OutputLastErrorNumAndString(_T(__FUNCTION__), __LINE__); - throw FALSE; - } - OutputString(_T("Reversing _reverse.scm to .scm\n")); - BYTE rBuf[CD_RAW_SECTOR_SIZE] = { 0 }; - DWORD dwRoop = GetFileSize(0, fpImg_r) - CD_RAW_SECTOR_SIZE * 2; - LONG lSeek = CD_RAW_SECTOR_SIZE - (LONG)pDisc->MAIN.uiMainDataSlideSize; - fseek(fpImg_r, -lSeek, SEEK_END); - fread(rBuf, sizeof(BYTE), (size_t)lSeek, fpImg_r); - fwrite(rBuf, sizeof(BYTE), (size_t)lSeek, fpImg); - fseek(fpImg_r, -lSeek, SEEK_CUR); - for (DWORD i = 0; i < dwRoop; i += CD_RAW_SECTOR_SIZE) { - fseek(fpImg_r, -CD_RAW_SECTOR_SIZE, SEEK_CUR); - fread(rBuf, sizeof(BYTE), CD_RAW_SECTOR_SIZE, fpImg_r); - fwrite(rBuf, sizeof(BYTE), CD_RAW_SECTOR_SIZE, fpImg); - fseek(fpImg_r, -CD_RAW_SECTOR_SIZE, SEEK_CUR); - } - rewind(fpImg_r); - fread(rBuf, sizeof(BYTE), pDisc->MAIN.uiMainDataSlideSize, fpImg_r); - fwrite(rBuf, sizeof(BYTE), pDisc->MAIN.uiMainDataSlideSize, fpImg); - FcloseAndNull(fpImg); - FcloseAndNull(fpImg_r); - } + OutputTocWithPregap(pDisc); _TCHAR pszNewPath[_MAX_PATH] = { 0 }; _tcsncpy(pszNewPath, pszOutScmFile, sizeof(pszNewPath) / sizeof(pszNewPath[0])); @@ -2299,32 +2219,15 @@ BOOL ReadCDAll( ExecEccEdc(pExtArg->byScanProtectViaFile, pszImgPath, pDisc->PROTECT.ERROR_SECTOR); } - if (pExtArg->byReverse) { - _TCHAR pszNewPath2[_MAX_PATH] = { 0 }; - FILE* fpBin = CreateOrOpenFile(pszPath, NULL, pszNewPath2, NULL, NULL, _T(".bin"), - _T("wb"), pDisc->SCSI.byFirstDataTrackNum, pDisc->SCSI.byFirstDataTrackNum); - if (!fpBin) { - OutputLastErrorNumAndString(_T(__FUNCTION__), __LINE__); - throw FALSE; - } - OutputString(_T("Copying .img to %s\n"), pszNewPath2); - if (!CopyFile(pszNewPath, pszNewPath2, FALSE)) { - OutputLastErrorNumAndString(_T(__FUNCTION__), __LINE__); - throw FALSE; - } - FcloseAndNull(fpBin); + _TCHAR pszImgName[_MAX_FNAME] = { 0 }; + if (NULL == (fpImg = CreateOrOpenFile( + pszPath, NULL, NULL, pszImgName, NULL, _T(".img"), _T("rb"), 0, 0))) { + OutputLastErrorNumAndString(_T(__FUNCTION__), __LINE__); + throw FALSE; } - else { - _TCHAR pszImgName[_MAX_FNAME] = { 0 }; - if (NULL == (fpImg = CreateOrOpenFile( - pszPath, NULL, NULL, pszImgName, NULL, _T(".img"), _T("rb"), 0, 0))) { - OutputLastErrorNumAndString(_T(__FUNCTION__), __LINE__); - throw FALSE; - } - if (!CreateBinCueCcd(pExtArg, pDisc, pszPath, pszImgName, - pDevice->FEATURE.byCanCDText, fpImg, fpCue, fpCueForImg, fpCcd)) { - throw FALSE; - } + if (!CreateBinCueCcd(pExtArg, pDisc, pszPath, pszImgName, + pDevice->FEATURE.byCanCDText, fpImg, fpCue, fpCueForImg, fpCcd)) { + throw FALSE; } } catch (BOOL ret) { @@ -2376,8 +2279,13 @@ BOOL ReadCDPartial( _tcsncpy(szExt, _T(".bin"), size); } _TCHAR pszBinPath[_MAX_PATH] = { 0 }; - FILE* fpBin = - CreateOrOpenFile(pszPath, NULL, pszBinPath, NULL, NULL, szExt, _T("wb"), 0, 0); + FILE* fpBin = NULL; + if (pExtArg->byReverse) { + fpBin = CreateOrOpenFile(pszPath, _T("_reverse"), pszBinPath, NULL, NULL, szExt, _T("wb"), 0, 0); + } + else { + fpBin = CreateOrOpenFile(pszPath, NULL, pszBinPath, NULL, NULL, szExt, _T("wb"), 0, 0); + } if (!fpBin) { OutputLastErrorNumAndString(_T(__FUNCTION__), __LINE__); return FALSE; @@ -2395,17 +2303,18 @@ BOOL ReadCDPartial( try { // init start - if (NULL == (fpParse = CreateOrOpenFile( - pszPath, szPlusFnameTxt, NULL, NULL, NULL, _T(".txt"), _T(WFLAG), 0, 0))) { - OutputLastErrorNumAndString(_T(__FUNCTION__), __LINE__); - throw FALSE; - } - if (NULL == (fpSub = CreateOrOpenFile( - pszPath, szPlusFnameSub, NULL, NULL, NULL, _T(".sub"), _T("wb"), 0, 0))) { - OutputLastErrorNumAndString(_T(__FUNCTION__), __LINE__); - throw FALSE; + if (!pExtArg->byReverse) { + if (NULL == (fpParse = CreateOrOpenFile( + pszPath, szPlusFnameTxt, NULL, NULL, NULL, _T(".txt"), _T(WFLAG), 0, 0))) { + OutputLastErrorNumAndString(_T(__FUNCTION__), __LINE__); + throw FALSE; + } + if (NULL == (fpSub = CreateOrOpenFile( + pszPath, szPlusFnameSub, NULL, NULL, NULL, _T(".sub"), _T("wb"), 0, 0))) { + OutputLastErrorNumAndString(_T(__FUNCTION__), __LINE__); + throw FALSE; + } } - // store main+(c2)+sub data if (!GetAlignedCallocatedBuffer(pDevice, &pBuf, pDevice->TRANSFER.dwAllBufLen, &pDiscPerSector->data.present, _T(__FUNCTION__), __LINE__)) { @@ -2448,7 +2357,7 @@ BOOL ReadCDPartial( _T("Set OpCode: %#02x, SubCode: %x(%s)\n"), lpCmd[0], lpCmd[10], szSubCode); BYTE lpPrevSubcode[CD_RAW_READ_SUBCODE_SIZE] = { 0 }; - if (pDisc->SUB.nSubchOffset) { // confirmed PXS88T, TS-H353A + if (pDisc->SUB.nSubChannelOffset) { // confirmed PXS88T, TS-H353A if (!ExecReadCD(pExtArg, pDevice, lpCmd, nStart - 2, pDiscPerSector->data.present, pDevice->TRANSFER.dwAllBufLen, _T(__FUNCTION__), __LINE__)) { if (nStart == 0) { @@ -2530,19 +2439,23 @@ BOOL ReadCDPartial( , pDisc->MAIN.nOffsetStart, pDisc->MAIN.nOffsetEnd, pDisc->MAIN.nFixStartLBA, pDisc->MAIN.nFixEndLBA); #endif INT nLastLBA = nEnd + pDisc->MAIN.nOffsetEnd; - INT nLBA = nStart + pDisc->MAIN.nOffsetStart; + INT nFirstLBA = nStart + pDisc->MAIN.nOffsetStart - 1; + INT nLBA = nFirstLBA; + if (pExtArg->byReverse) { + nLBA = nLastLBA; + } // init end FlushLog(); UINT uiC2ErrorLBACnt = 0; INT nStoreLBA = 0; INT nRetryCnt = 1; - while (nLBA < nLastLBA) { + while (nFirstLBA < nLastLBA) { BOOL bProcessRet = ProcessReadCD(pExecType, pExtArg, pDevice, pDisc , pDiscPerSector, pC2ErrorPerSector, uiC2ErrorLBACnt, lpCmd, nLBA); if (pC2ErrorPerSector && bProcessRet == RETURNED_EXIST_C2_ERROR) { OutputErrorString( - _T("\rLBA[%06d, %#07x] Detected C2 error \n"), nLBA, nLBA); + _T("\rLBA[%06d, %#07x] Detected C2 error \n"), nLBA, nLBA); SetC2ErrorData(pC2ErrorPerSector, nLBA, &uiC2ErrorLBACnt, TRUE); if (uiC2ErrorLBACnt == pExtArg->dwMaxC2ErrorNum) { OutputErrorString(_T("C2 error Max: %u\n"), uiC2ErrorLBACnt); @@ -2550,7 +2463,12 @@ BOOL ReadCDPartial( } } else if (bProcessRet == RETURNED_SKIP_LBA) { - nLBA = pDisc->MAIN.nFixFirstLBAof2ndSession - 1; + if (pExtArg->byReverse) { + nLBA = pDisc->SCSI.nFirstLBAof2ndSession - SESSION_TO_SESSION_SKIP_LBA; + } + else { + nLBA = pDisc->MAIN.nFixFirstLBAof2ndSession - 1; + } } else if (bProcessRet == RETURNED_CONTINUE) { ProcessReturnedContinue(pExecType, pExtArg, pDevice, pDisc, pDiscPerSector @@ -2598,7 +2516,7 @@ BOOL ReadCDPartial( } if (bProcessRet != RETURNED_CONTINUE && bProcessRet != RETURNED_SKIP_LBA) { - if (pDisc->SUB.nSubchOffset) { + if (pDisc->SUB.nSubChannelOffset) { if (!(pExtArg->byScanProtectViaFile && pDisc->PROTECT.byExist && (pDisc->PROTECT.ERROR_SECTOR.nExtentPos <= nLBA && nLBA <= pDisc->PROTECT.ERROR_SECTOR.nExtentPos + pDisc->PROTECT.ERROR_SECTOR.nSectorSize))) { @@ -2614,19 +2532,21 @@ BOOL ReadCDPartial( SetTmpSubQDataFromBuffer(&pDiscPerSector->subQ.present, pDiscPerSector->subcode.present); if (nStart <= nLBA && nLBA < nEnd) { - if (ExecCheckingSubchannnel(pExtArg, pDisc, nLBA)) { - CheckAndFixSubChannel(pExecType, pExtArg, pDevice, pDisc - , pDiscPerSector, byCurrentTrackNum, nLBA, FALSE, FALSE); - BYTE lpSubcodeRaw[CD_RAW_READ_SUBCODE_SIZE] = { 0 }; - // fix raw subchannel - AlignColumnSubcode(pDiscPerSector->subcode.present, lpSubcodeRaw); + BYTE lpSubcodeRaw[CD_RAW_READ_SUBCODE_SIZE] = { 0 }; + if (!pExtArg->byReverse) { + if (IsCheckingSubChannel(pExtArg, pDisc, nLBA)) { + CheckAndFixSubChannel(pExecType, pExtArg, pDevice, pDisc + , pDiscPerSector, byCurrentTrackNum, nLBA, FALSE, FALSE); + // fix raw subchannel + AlignColumnSubcode(pDiscPerSector->subcode.present, lpSubcodeRaw); #if 0 - OutputCDSub96Align(pDiscPerSector->subcode.present, nLBA); + OutputCDSub96Align(pDiscPerSector->subcode.present, nLBA); #endif - WriteSubChannel(pDisc, lpSubcodeRaw, - pDiscPerSector->subcode.present, nLBA, byCurrentTrackNum, fpSub, fpParse); - CheckAndFixMainHeader(pExtArg, pDisc - , pDiscPerSector, nLBA, byCurrentTrackNum, nMainDataType); + WriteSubChannel(pDisc, lpSubcodeRaw, + pDiscPerSector->subcode.present, nLBA, byCurrentTrackNum, fpSub, fpParse); + CheckAndFixMainHeader(pExtArg, pDisc + , pDiscPerSector, nLBA, byCurrentTrackNum, nMainDataType); + } if (*pExecType == gd) { byCurrentTrackNum = pDiscPerSector->subQ.present.byTrackNum; } @@ -2642,13 +2562,21 @@ BOOL ReadCDPartial( if (pExtArg->byC2 && pDevice->FEATURE.byC2ErrorData) { WriteC2(pExtArg, pDisc, pDiscPerSector->data.present + pDevice->TRANSFER.dwBufC2Offset, nLBA, fpC2); } - if (pDisc->SUB.nSubchOffset) { + if (pDisc->SUB.nSubChannelOffset) { memcpy(lpPrevSubcode, pDiscPerSector->subcode.next, CD_RAW_READ_SUBCODE_SIZE); } } - OutputString(_T("\rCreating bin from %d to %d (LBA) %6d"), - nStart + pDisc->MAIN.nOffsetStart, nEnd + pDisc->MAIN.nOffsetEnd, nLBA); - nLBA++; + if (pExtArg->byReverse) { + OutputString(_T("\rCreating bin from %d to %d (LBA) %6d") + , nEnd + pDisc->MAIN.nOffsetEnd, nStart + pDisc->MAIN.nOffsetStart - 1, nLBA); + nLBA--; + } + else { + OutputString(_T("\rCreating bin from %d to %d (LBA) %6d"), + nStart + pDisc->MAIN.nOffsetStart, nEnd + pDisc->MAIN.nOffsetEnd, nLBA); + nLBA++; + } + nFirstLBA++; } OutputString(_T("\n")); if (pExtArg->byC2 && pDevice->FEATURE.byC2ErrorData) { @@ -2665,6 +2593,41 @@ BOOL ReadCDPartial( } } FcloseAndNull(fpBin); + if (pExtArg->byReverse) { + FILE* fpBin_r = NULL; + if (NULL == (fpBin_r = CreateOrOpenFile( + pszPath, _T("_reverse"), NULL, NULL, NULL, szExt, _T("rb"), 0, 0))) { + OutputLastErrorNumAndString(_T(__FUNCTION__), __LINE__); + throw FALSE; + } + if (NULL == (fpBin = CreateOrOpenFile( + pszPath, NULL, NULL, NULL, NULL, szExt, _T("wb"), 0, 0))) { + OutputLastErrorNumAndString(_T(__FUNCTION__), __LINE__); + throw FALSE; + } + OutputString(_T("Reversing _reverse%s to %s\n"), szExt, szExt); + BYTE rBuf[CD_RAW_SECTOR_SIZE] = { 0 }; + DWORD dwRoop = GetFileSize(0, fpBin_r) - CD_RAW_SECTOR_SIZE * 3; + LONG lSeek = CD_RAW_SECTOR_SIZE - (LONG)pDisc->MAIN.uiMainDataSlideSize; + fseek(fpBin_r, -lSeek, SEEK_END); + fread(rBuf, sizeof(BYTE), (size_t)lSeek, fpBin_r); + fwrite(rBuf, sizeof(BYTE), (size_t)lSeek, fpBin); + fseek(fpBin_r, -CD_RAW_SECTOR_SIZE, SEEK_CUR); + + for (DWORD i = 0; i < dwRoop; i += CD_RAW_SECTOR_SIZE) { + fseek(fpBin_r, -CD_RAW_SECTOR_SIZE, SEEK_CUR); + fread(rBuf, sizeof(BYTE), CD_RAW_SECTOR_SIZE, fpBin_r); + fwrite(rBuf, sizeof(BYTE), CD_RAW_SECTOR_SIZE, fpBin); + fseek(fpBin_r, -CD_RAW_SECTOR_SIZE, SEEK_CUR); + } + fseek(fpBin_r, -CD_RAW_SECTOR_SIZE, SEEK_CUR); + fread(rBuf, sizeof(BYTE), pDisc->MAIN.uiMainDataSlideSize, fpBin_r); + fwrite(rBuf, sizeof(BYTE), pDisc->MAIN.uiMainDataSlideSize, fpBin); + + FcloseAndNull(fpBin); + FcloseAndNull(fpBin_r); + } + if (*pExecType == data) { if ((pExtArg->byD8 || pDevice->byPlxtrDrive) && !pExtArg->byBe) { if (NULL == (fpBin = CreateOrOpenFile( @@ -2675,7 +2638,7 @@ BOOL ReadCDPartial( DescrambleMainChannelPartial(nStart, nEnd - 1, scrambled_table, fpBin); FcloseAndNull(fpBin); } - ExecEccEdc(pExtArg->byScanProtectViaFile, pszBinPath, pDisc->PROTECT.ERROR_SECTOR); + ExecEccEdc(pExtArg->byScanProtectViaFile, pszPath, pDisc->PROTECT.ERROR_SECTOR); } else if (*pExecType == gd) { _TCHAR pszImgPath[_MAX_PATH] = { 0 }; diff --git a/DiscImageCreator/execScsiCmdforDVD.cpp b/DiscImageCreator/execScsiCmdforDVD.cpp index 94cdc21..bd5b1ea 100644 --- a/DiscImageCreator/execScsiCmdforDVD.cpp +++ b/DiscImageCreator/execScsiCmdforDVD.cpp @@ -87,7 +87,6 @@ BOOL ReadDVDForFileSystem( } nLBA = 256; OutputFsVolumeDescriptorSequence(lpBuf, nLBA); - FlushLog(); return TRUE; } @@ -125,6 +124,8 @@ BOOL ReadDVD( if (!ReadDVDForFileSystem(pExtArg, pDevice, pDisc, &cdb, lpBuf)) { throw FALSE; } + FlushLog(); + BYTE byScsiStatus = 0; dwTransferLen = pDevice->dwMaxTransferLength / DISC_RAW_READ_SIZE; REVERSE_BYTES(&cdb.TransferLength, &dwTransferLen); @@ -284,7 +285,7 @@ BOOL ReadDVDForCMI( cdb.OperationCode = SCSIOP_READ_DVD_STRUCTURE; cdb.Format = DvdMaxDescriptor; REVERSE_BYTES_SHORT(&cdb.AllocationLength, &wSize); - OutputDiscLogA("\tCopyright Management Information\n"); + OutputDiscLogA(OUTPUT_DHYPHEN_PLUS_STR(CopyrightManagementInformation)); BOOL bRet = TRUE; BYTE byScsiStatus = 0; @@ -299,7 +300,7 @@ BOOL ReadDVDForCMI( OutputDVDCopyrightManagementInformation( (PDVD_COPYRIGHT_MANAGEMENT_DESCRIPTOR)(pBuf + sizeof(DVD_DESCRIPTOR_HEADER)), nLBA); OutputString( - _T("\rOutputting CMI log(LBA) %8u/%8u"), nLBA, pDisc->SCSI.nAllLength - 1); + _T("\rWriting CMI log(LBA) %8u/%8u"), nLBA, pDisc->SCSI.nAllLength - 1); } OutputString(_T("\n")); return bRet; @@ -331,41 +332,66 @@ BOOL ReadDVDStructure( REVERSE_SHORT(&pDescHeader->Length); WORD wDataSize = pDescHeader->Length - sizeof(pDescHeader->Length); WORD wEntrySize = wDataSize / sizeof(DVD_STRUCTURE_LIST_ENTRY); + UCHAR ucBCAFlag = FALSE; + BOOL bCPRM = FALSE; - OutputVolDescLogA(OUTPUT_DHYPHEN_PLUS_STR(DVDStructure)); - OutputDriveLogA(OUTPUT_DHYPHEN_PLUS_STR(DVDStructureList)); + OutputDiscLogA(OUTPUT_DHYPHEN_PLUS_STR(DVDStructure)); for (WORD i = 0; i < wEntrySize; i++) { PDVD_STRUCTURE_LIST_ENTRY pEntry = ((PDVD_STRUCTURE_LIST_ENTRY)pDescHeader->Data + i); WORD wFormatLen = MAKEWORD(pEntry->FormatLength[1], pEntry->FormatLength[0]); - OutputDriveLogA( - "\t\tFormatCode: %02x, Sendable: %3s, Readable: %3s, FormatLength: %u\n", + OutputDiscLogA( + "FormatCode: %02x, Sendable: %3s, Readable: %3s, FormatLength: %u\n", pEntry->FormatCode, BOOLEAN_TO_STRING_YES_NO_A(pEntry->Sendable), BOOLEAN_TO_STRING_YES_NO_A(pEntry->Readable), wFormatLen); - if (wFormatLen == 0 || pEntry->FormatCode == 0x05 || pEntry->FormatCode == 0xff) { + if (pEntry->FormatCode == 0xff) { + OutputDiscLogA("Skiped\n\n"); + break; + } + else if (pEntry->FormatCode == 0x02 && pDisc->SCSI.wCurrentMedia != ProfileDvdRom) { + OutputDiscLogA("Skiped because of DVD-ROM only\n\n"); continue; } - else if ((0x08 <= pEntry->FormatCode && pEntry->FormatCode <= 0x0B) && + else if (pEntry->FormatCode == 0x03 && !ucBCAFlag) { + OutputDiscLogA("Skiped because of no BCA data\n\n"); + continue; + } + else if (pEntry->FormatCode == 0x05) { + OutputDiscLogA("Skiped. If you see the detailed, use /c option\n\n"); + continue; + } + else if ((pEntry->FormatCode == 0x06 || pEntry->FormatCode == 0x07) && !bCPRM) { + OutputDiscLogA("Skiped because of DVD with CPRM only\n\n"); + continue; + } + else if ((0x08 <= pEntry->FormatCode && pEntry->FormatCode <= 0x0b) && pDisc->SCSI.wCurrentMedia != ProfileDvdRam) { + OutputDiscLogA("Skiped because of DVD-RAM only\n\n"); + continue; + } + else if ((0x0c <= pEntry->FormatCode && pEntry->FormatCode <= 0x10) && + (pDisc->SCSI.wCurrentMedia != ProfileDvdRecordable) && + (pDisc->SCSI.wCurrentMedia != ProfileDvdRWSequential)) { + OutputDiscLogA("Skiped because of DVD-R, RW only\n\n"); continue; } - else if (((0x0C <= pEntry->FormatCode && - pEntry->FormatCode <= 0x11) || pEntry->FormatCode == 0x30) && - ((pDisc->SCSI.wCurrentMedia != ProfileDvdRecordable) && - (pDisc->SCSI.wCurrentMedia != ProfileDvdRWSequential) && + else if ((pEntry->FormatCode == 0x11 || pEntry->FormatCode == 0x30) && (pDisc->SCSI.wCurrentMedia != ProfileDvdPlusRW) && - (pDisc->SCSI.wCurrentMedia != ProfileDvdPlusR))) { + (pDisc->SCSI.wCurrentMedia != ProfileDvdPlusR)) { + OutputDiscLogA("Skiped because of DVD+R, RW only\n\n"); continue; } else if ((0x20 <= pEntry->FormatCode && pEntry->FormatCode <= 0x24) && pDisc->SCSI.wCurrentMedia != ProfileDvdDashRDualLayer) { + OutputDiscLogA("Skiped because of DVD-R DL only\n\n"); continue; } else if ((pEntry->FormatCode == 0xc0) && pDisc->SCSI.wCurrentMedia != ProfileDvdRewritable) { + OutputDiscLogA("Skiped because of DVD-R Rewritable only\n\n"); continue; } @@ -381,17 +407,18 @@ BOOL ReadDVDStructure( if (!ScsiPassThroughDirect(pExtArg, pDevice, &cdb, CDB12GENERIC_LENGTH, lpFormat, wFormatLen, &byScsiStatus, _T(__FUNCTION__), __LINE__) || byScsiStatus >= SCSISTAT_CHECK_CONDITION) { - OutputErrorString(_T("Failure - Format %02x\n"), pEntry->FormatCode); + OutputLogA(standardError | fileDisc, "FormatCode: %02x failed\n", pEntry->FormatCode); } else { DWORD dwSectorLen = 0; - OutputDVDStructureFormat(pEntry->FormatCode, + OutputDVDStructureFormat(pEntry->FormatCode, &ucBCAFlag, &bCPRM, wFormatLen - sizeof(DVD_DESCRIPTOR_HEADER), lpFormat + sizeof(DVD_DESCRIPTOR_HEADER), &dwSectorLen); if (pEntry->FormatCode == DvdPhysicalDescriptor) { pDisc->SCSI.nAllLength = (INT)dwSectorLen; } } + OutputDiscLogA("\n"); FreeAndNull(lpFormat); } return TRUE; diff --git a/DiscImageCreator/init.cpp b/DiscImageCreator/init.cpp index ade07ff..e8e42d6 100644 --- a/DiscImageCreator/init.cpp +++ b/DiscImageCreator/init.cpp @@ -117,6 +117,8 @@ BOOL InitTocFullData( OutputLastErrorNumAndString(_T(__FUNCTION__), __LINE__); return FALSE; } + (*pDisc)->SCSI.nFirstLBAofLeadout = -1; + (*pDisc)->SCSI.nFirstLBAof2ndSession = -1; return TRUE; } @@ -318,6 +320,7 @@ BOOL InitSubData( catch (BOOL bErr) { bRet = bErr; } + (*pDisc)->SUB.nSubChannelOffset = 0xff; return bRet; } diff --git a/DiscImageCreator/output.cpp b/DiscImageCreator/output.cpp index 477e2d8..677e164 100644 --- a/DiscImageCreator/output.cpp +++ b/DiscImageCreator/output.cpp @@ -661,19 +661,18 @@ VOID WriteMainChannel( INT sLBA = pDisc->MAIN.nFixStartLBA; INT eLBA = pDisc->MAIN.nFixEndLBA; if (pExtArg->byReverse) { - sLBA = pDisc->MAIN.nFixEndLBA; - eLBA = pDisc->MAIN.nFixStartLBA; + fwrite(lpBuf, sizeof(BYTE), CD_RAW_SECTOR_SIZE, fpImg); } - if (sLBA <= nLBA && nLBA < eLBA) { + else if (sLBA <= nLBA && nLBA < eLBA) { // first sector if (nLBA == sLBA) { - fwrite(lpBuf + pDisc->MAIN.uiMainDataSlideSize, sizeof(BYTE), + fwrite(lpBuf + pDisc->MAIN.uiMainDataSlideSize, sizeof(BYTE), CD_RAW_SECTOR_SIZE - pDisc->MAIN.uiMainDataSlideSize, fpImg); - if (!pExtArg->byReverse && pDisc->SUB.lpFirstLBAListOnSub) { + if (pDisc->SUB.lpFirstLBAListOnSub) { pDisc->SUB.lpFirstLBAListOnSub[0][0] = -150; pDisc->SUB.lpFirstLBAListOnSub[0][1] = nLBA - sLBA; } - if (!pExtArg->byReverse && pDisc->SUB.lpFirstLBAListOnSubSync) { + if (pDisc->SUB.lpFirstLBAListOnSubSync) { pDisc->SUB.lpFirstLBAListOnSubSync[0][0] = -150; pDisc->SUB.lpFirstLBAListOnSubSync[0][1] = nLBA - sLBA; } @@ -757,8 +756,10 @@ VOID WriteSubChannel( FILE* fpParse ) { - fwrite(lpSubcode, sizeof(BYTE), CD_RAW_READ_SUBCODE_SIZE, fpSub); - OutputCDSubToLog(pDisc, lpSubcode, lpSubcodeRaw, nLBA, byCurrentTrackNum, fpParse); + if (fpSub && fpParse) { + fwrite(lpSubcode, sizeof(BYTE), CD_RAW_READ_SUBCODE_SIZE, fpSub); + OutputCDSubToLog(pDisc, lpSubcode, lpSubcodeRaw, nLBA, byCurrentTrackNum, fpParse); + } } VOID WriteErrorBuffer( @@ -1180,8 +1181,8 @@ VOID DescrambleMainChannelAll( nFirstLBA -= nSkipLBA; nLastLBA -= nSkipLBA; } - if (pDisc->SUB.byIndex0InTrack1) { - nFirstLBA += 150; + if (pExtArg->byPre) { + nFirstLBA += 75; nLastLBA += 150; } if (!pExtArg->byReverse) { @@ -1506,7 +1507,7 @@ BOOL CreateBinCueCcd( INT nLBA = pDisc->SUB.lpFirstLBAListOnSub[i - 1][0] == -1 ? pDisc->SUB.lpFirstLBAListOnSub[i - 1][1] : pDisc->SUB.lpFirstLBAListOnSub[i - 1][0]; - if (pDisc->SUB.byIndex0InTrack1) { + if (pExtArg->byPre) { if (i == pDisc->SCSI.toc.FirstTrack) { nLBA += 150 - abs(pDisc->MAIN.nAdjustSectorNum); } @@ -1520,7 +1521,7 @@ BOOL CreateBinCueCcd( INT nNextLBA = pDisc->SUB.lpFirstLBAListOnSub[i][0] == -1 ? pDisc->SUB.lpFirstLBAListOnSub[i][1] : pDisc->SUB.lpFirstLBAListOnSub[i][0]; - if (pDisc->SUB.byIndex0InTrack1) { + if (pExtArg->byPre) { nNextLBA += 150; } bRet = CreateBin(pExtArg, pDisc, i, nNextLBA, nLBA, fpImg, fpBin); @@ -1532,7 +1533,7 @@ BOOL CreateBinCueCcd( nLBA = pDisc->SUB.lpFirstLBAListOnSubSync[i - 1][0] == -1 ? pDisc->SUB.lpFirstLBAListOnSubSync[i - 1][1] : pDisc->SUB.lpFirstLBAListOnSubSync[i - 1][0]; - if (pDisc->SUB.byIndex0InTrack1) { + if (pExtArg->byPre) { if (i == pDisc->SCSI.toc.FirstTrack) { nLBA += 150 - abs(pDisc->MAIN.nAdjustSectorNum); } @@ -1546,7 +1547,7 @@ BOOL CreateBinCueCcd( nNextLBA = pDisc->SUB.lpFirstLBAListOnSubSync[i][0] == -1 ? pDisc->SUB.lpFirstLBAListOnSubSync[i][1] : pDisc->SUB.lpFirstLBAListOnSubSync[i][0]; - if (pDisc->SUB.byIndex0InTrack1) { + if (pExtArg->byPre) { nNextLBA += 150; } bRet = CreateBin(pExtArg, pDisc, i, nNextLBA, nLBA, fpImg, fpBinSync); diff --git a/DiscImageCreator/outputScsiCmdLog.cpp b/DiscImageCreator/outputScsiCmdLog.cpp index 8477d61..bde4892 100644 --- a/DiscImageCreator/outputScsiCmdLog.cpp +++ b/DiscImageCreator/outputScsiCmdLog.cpp @@ -897,14 +897,9 @@ VOID OutputGetConfigurationFeatureFirmwareDate( ) { OutputDriveLogA( - "\tFeatureFirmwareDate: %04ld-%02u-%02u %02u:%02u:%02u\n", - MAKELONG(MAKEWORD(pFirmwareDate->Year[3], pFirmwareDate->Year[2]), - MAKEWORD(pFirmwareDate->Year[1], pFirmwareDate->Year[0])), - MAKEWORD(pFirmwareDate->Month[1], pFirmwareDate->Month[0]), - MAKEWORD(pFirmwareDate->Day[1], pFirmwareDate->Day[0]), - MAKEWORD(pFirmwareDate->Hour[1], pFirmwareDate->Hour[0]), - MAKEWORD(pFirmwareDate->Minute[1], pFirmwareDate->Minute[0]), - MAKEWORD(pFirmwareDate->Seconds[1], pFirmwareDate->Seconds[0])); + "\tFeatureFirmwareDate: %.4s-%.2s-%.2s %.2s:%.2s:%.2s\n" + , pFirmwareDate->Year, pFirmwareDate->Month, pFirmwareDate->Day + , pFirmwareDate->Hour, pFirmwareDate->Minute, pFirmwareDate->Seconds); } VOID OutputGetConfigurationFeatureAACS( diff --git a/DiscImageCreator/outputScsiCmdLogforCD.cpp b/DiscImageCreator/outputScsiCmdLogforCD.cpp index e0afe52..b6f63d6 100644 --- a/DiscImageCreator/outputScsiCmdLogforCD.cpp +++ b/DiscImageCreator/outputScsiCmdLogforCD.cpp @@ -91,16 +91,16 @@ VOID OutputFsDirectoryRecord( "\t\tExtended Attribute Record Length: %u\n" "\t\t Location of Extent: %lu\n" "\t\t Data Length: %lu\n" - "\t\t Recording Date and Time: %u-%02u-%02u %02u:%02u:%02u +%02u\n" + "\t\t Recording Date and Time: %u-%02u-%02u %02u:%02u:%02u %+03d:%02u\n" "\t\t File Flags: %u (%s)\n" "\t\t File Unit Size: %u\n" "\t\t Interleave Gap Size: %u\n" "\t\t Volume Sequence Number: %u\n" "\t\t Length of File Identifier: %u\n" "\t\t File Identifier: " - , lpBuf[0], lpBuf[1], dwExtentPos, dwDataLen, lpBuf[18] + 1900, lpBuf[19] - , lpBuf[20], lpBuf[21], lpBuf[22], lpBuf[23], lpBuf[24], lpBuf[25], str - , lpBuf[26], lpBuf[27], vsn, lpBuf[32]); + , lpBuf[0], lpBuf[1], dwExtentPos, dwDataLen, lpBuf[18] + 1900, lpBuf[19], lpBuf[20] + , lpBuf[21], lpBuf[22], lpBuf[23], (CHAR)lpBuf[24] / 4, (CHAR)lpBuf[24] % 4 * 15 + , lpBuf[25], str, lpBuf[26], lpBuf[27], vsn, lpBuf[32]); for (INT n = 0; n < lpBuf[32]; n++) { OutputVolDescLogA("%c", lpBuf[33 + n]); fname[n] = (CHAR)lpBuf[33 + n]; @@ -283,52 +283,21 @@ VOID OutputFsVolumeDescriptorForTime( LPBYTE lpBuf ) { - CHAR year[4][4] = { "0" }; - CHAR month[4][2] = { "0" }; - CHAR day[4][2] = { "0" }; - CHAR hour[4][2] = { "0" }; - CHAR time[4][2] = { "0" }; - CHAR second[4][2] = { "0" }; - CHAR milisecond[4][2] = { "0" }; - strncpy(year[0], (LPCH)&lpBuf[813], sizeof(year[0])); - strncpy(month[0], (LPCH)&lpBuf[817], sizeof(month[0])); - strncpy(day[0], (LPCH)&lpBuf[819], sizeof(day[0])); - strncpy(hour[0], (LPCH)&lpBuf[821], sizeof(hour[0])); - strncpy(time[0], (LPCH)&lpBuf[823], sizeof(time[0])); - strncpy(second[0], (LPCH)&lpBuf[825], sizeof(second[0])); - strncpy(milisecond[0], (LPCH)&lpBuf[827], sizeof(milisecond[0])); - strncpy(year[1], (LPCH)&lpBuf[830], sizeof(year[1])); - strncpy(month[1], (LPCH)&lpBuf[834], sizeof(month[1])); - strncpy(day[1], (LPCH)&lpBuf[836], sizeof(day[1])); - strncpy(hour[1], (LPCH)&lpBuf[838], sizeof(hour[1])); - strncpy(time[1], (LPCH)&lpBuf[840], sizeof(time[1])); - strncpy(second[1], (LPCH)&lpBuf[842], sizeof(second[1])); - strncpy(milisecond[1], (LPCH)&lpBuf[844], sizeof(milisecond[1])); - strncpy(year[2], (LPCH)&lpBuf[847], sizeof(year[2])); - strncpy(month[2], (LPCH)&lpBuf[851], sizeof(month[2])); - strncpy(day[2], (LPCH)&lpBuf[853], sizeof(day[2])); - strncpy(hour[2], (LPCH)&lpBuf[855], sizeof(hour[2])); - strncpy(time[2], (LPCH)&lpBuf[857], sizeof(time[2])); - strncpy(second[2], (LPCH)&lpBuf[859], sizeof(second[2])); - strncpy(milisecond[2], (LPCH)&lpBuf[861], sizeof(milisecond[2])); - strncpy(year[3], (LPCH)&lpBuf[864], sizeof(year[3])); - strncpy(month[3], (LPCH)&lpBuf[868], sizeof(month[3])); - strncpy(day[3], (LPCH)&lpBuf[870], sizeof(day[3])); - strncpy(hour[3], (LPCH)&lpBuf[872], sizeof(hour[3])); - strncpy(time[3], (LPCH)&lpBuf[874], sizeof(time[3])); - strncpy(second[3], (LPCH)&lpBuf[876], sizeof(second[3])); - strncpy(milisecond[3], (LPCH)&lpBuf[878], sizeof(milisecond[3])); OutputVolDescLogA( - "\t Volume Creation Date and Time: %.4s-%.2s-%.2s %.2s:%.2s:%.2s.%.2s +%u\n" - "\t Volume Modification Date and Time: %.4s-%.2s-%.2s %.2s:%.2s:%.2s.%.2s +%u\n" - "\t Volume Expiration Date and Time: %.4s-%.2s-%.2s %.2s:%.2s:%.2s.%.2s +%u\n" - "\t Volume Effective Date and Time: %.4s-%.2s-%.2s %.2s:%.2s:%.2s.%.2s +%u\n" + "\t Volume Creation Date and Time: %.4s-%.2s-%.2s %.2s:%.2s:%.2s.%.2s %+03d:%02u\n" + "\t Volume Modification Date and Time: %.4s-%.2s-%.2s %.2s:%.2s:%.2s.%.2s %+03d:%02u\n" + "\t Volume Expiration Date and Time: %.4s-%.2s-%.2s %.2s:%.2s:%.2s.%.2s %+03d:%02u\n" + "\t Volume Effective Date and Time: %.4s-%.2s-%.2s %.2s:%.2s:%.2s.%.2s %+03d:%02u\n" "\t File Structure Version: %u\n" "\t Application Use: ", - year[0], month[0], day[0], hour[0], time[0], second[0], milisecond[0], lpBuf[829], - year[1], month[1], day[1], hour[1], time[1], second[1], milisecond[1], lpBuf[846], - year[2], month[2], day[2], hour[2], time[2], second[2], milisecond[2], lpBuf[863], - year[3], month[3], day[3], hour[3], time[3], second[3], milisecond[3], lpBuf[880], + &lpBuf[813], &lpBuf[817], &lpBuf[819], &lpBuf[821], &lpBuf[823] + , &lpBuf[825], &lpBuf[827], (CHAR)lpBuf[829] / 4, (CHAR)lpBuf[829] % 4 * 15, + &lpBuf[830], &lpBuf[834], &lpBuf[836], &lpBuf[838], &lpBuf[840] + , &lpBuf[842], &lpBuf[844], (CHAR)lpBuf[846] / 4, (CHAR)lpBuf[846] % 4 * 15, + &lpBuf[847], &lpBuf[851], &lpBuf[853], &lpBuf[855], &lpBuf[857] + , &lpBuf[859], &lpBuf[861], (CHAR)lpBuf[863] / 4, (CHAR)lpBuf[863] % 4 * 15, + &lpBuf[864], &lpBuf[868], &lpBuf[870], &lpBuf[872], &lpBuf[874] + , &lpBuf[876], &lpBuf[878], (CHAR)lpBuf[880] / 4, (CHAR)lpBuf[880] % 4 * 15, lpBuf[881]); for (INT i = 883; i <= 1394; i++) { OutputVolDescLogA("%x", lpBuf[i]); @@ -507,10 +476,8 @@ VOID OutputFsVolumePartitionDescriptor( "\t System Use: ", str[0], str[1], - MAKELONG(MAKEWORD(lpBuf[76], lpBuf[77]), - MAKEWORD(lpBuf[78], lpBuf[79])), - MAKELONG(MAKEWORD(lpBuf[84], lpBuf[85]), - MAKEWORD(lpBuf[86], lpBuf[87]))); + MAKELONG(MAKEWORD(lpBuf[76], lpBuf[77]), MAKEWORD(lpBuf[78], lpBuf[79])), + MAKELONG(MAKEWORD(lpBuf[84], lpBuf[85]), MAKEWORD(lpBuf[86], lpBuf[87]))); for (INT i = 88; i < 2048; i++) { OutputVolDescLogA("%x", lpBuf[i]); } @@ -1186,7 +1153,7 @@ VOID OutputCDOffset( BOOL bGetDriveOffset, INT nDriveSampleOffset, INT nDriveOffset, - INT nSubchOffset + INT nSubChannelOffset ) { OutputDiscLogA(STR_DOUBLE_HYPHEN_B "Offset "); @@ -1233,8 +1200,8 @@ VOID OutputCDOffset( pDisc->MAIN.nCombinedOffset / CD_RAW_SECTOR_SIZE - 1; } OutputDiscLogA("\tOverread sector: %d\n", pDisc->MAIN.nAdjustSectorNum); - if (nSubchOffset != 0xff) { - OutputDiscLogA("\tSubch Offset: %d\n", nSubchOffset); + if (nSubChannelOffset != 0xff) { + OutputDiscLogA("\tSubChannel Offset: %d\n", nSubChannelOffset); } } diff --git a/DiscImageCreator/outputScsiCmdLogforCD.h b/DiscImageCreator/outputScsiCmdLogforCD.h index dbc9f3d..b96cc06 100644 --- a/DiscImageCreator/outputScsiCmdLogforCD.h +++ b/DiscImageCreator/outputScsiCmdLogforCD.h @@ -110,7 +110,7 @@ VOID OutputCDOffset( BOOL bGetDriveOffset, INT nDriveSampleOffset, INT nDriveOffset, - INT nSubchOffset + INT nSubChannelOffset ); VOID OutputCDC2Error296( diff --git a/DiscImageCreator/outputScsiCmdLogforDVD.cpp b/DiscImageCreator/outputScsiCmdLogforDVD.cpp index 690bb78..5115cf8 100644 --- a/DiscImageCreator/outputScsiCmdLogforDVD.cpp +++ b/DiscImageCreator/outputScsiCmdLogforDVD.cpp @@ -9,10 +9,26 @@ VOID OutputFsRecordingDateAndTime( LPBYTE lpBuf ) { + WORD sTime = MAKEWORD(lpBuf[0], lpBuf[1]); + CHAR cTimeZone = sTime >> 12 & 0x0f; + OutputVolDescLogA("\tRecording Date and Time: "); + if (cTimeZone == 0) { + OutputVolDescLogA("UTC "); + } + else if (cTimeZone == 1) { + OutputVolDescLogA("LocalTime "); + } + else if (cTimeZone == 2) { + OutputVolDescLogA("OriginalTime "); + } + else { + OutputVolDescLogA("Reserved "); + } + SHORT nTime = sTime & 0xfff; OutputVolDescLogA( - "\tRecording Date and Time: 0x%x %u-%02u-%02u %02u:%02u:%02u.%u.%u.%u\n", - MAKEWORD(lpBuf[0], lpBuf[1]), MAKEWORD(lpBuf[2], lpBuf[3]), lpBuf[4], - lpBuf[5], lpBuf[6], lpBuf[7], lpBuf[8], lpBuf[9], lpBuf[10], lpBuf[11]); + "%+03d%02d %u-%02u-%02u %02u:%02u:%02u.%02u.%02u.%02u\n", + nTime / 60, nTime % 60, MAKEWORD(lpBuf[2], lpBuf[3]), lpBuf[4], lpBuf[5], + lpBuf[6], lpBuf[7], lpBuf[8], lpBuf[9], lpBuf[10], lpBuf[11]); } VOID OutputFsRegid( @@ -47,12 +63,11 @@ VOID OutputFsBootDescriptor( LPBYTE lpBuf ) { - OutputVolDescLogA( - "\t========== Architecture Type ==========\n"); + OutputVolDescLogA(OUTPUT_DHYPHEN_PLUS_STR(Architecture Type)); OutputFsRegid(lpBuf + 8); - OutputVolDescLogA( - "\t========== Boot Identifier ==========\n"); + OutputVolDescLogA(OUTPUT_DHYPHEN_PLUS_STR(Boot Identifier)); OutputFsRegid(lpBuf + 8); + OutputVolDescLogA( "\tBoot Extent Location: %lu\n" "\t Boot Extent Length: %lu\n" @@ -105,8 +120,7 @@ VOID OutputFsVolumeStructureDescriptorFormat( INT nLBA ) { - OutputVolDescLogA( - "========== Volume Recognition Sequence, LBA[%06d, %#07x] ==========\n" + OutputVolDescLogA(OUTPUT_DHYPHEN_PLUS_STR_WITH_LBA_F(Volume Recognition Sequence) "\t Structure Type: %u\n" "\t Standard Identifier: %.5s\n" "\t Structure Version: %u\n" @@ -301,8 +315,7 @@ VOID OutputFsUnallocatedSpaceDescriptor( , MAKELONG(MAKEWORD(lpBuf[16], lpBuf[17]), MAKEWORD(lpBuf[18], lpBuf[19])), N_AD); if (0 < N_AD) { - OutputVolDescLogA( - "\t========== Allocation Descriptors ==========\n"); + OutputVolDescLogA(OUTPUT_DHYPHEN_PLUS_STR(Allocation Descriptors)); for (INT i = 0; i < N_AD * 8; i += 8) { OutputFsExtentDescriptor(lpBuf + 24 + i); } @@ -436,7 +449,7 @@ VOID OutputFsVolumeDescriptorPointer( { OutputVolDescLogA( "\tVolume Descriptor Sequence Number: %lu\n" - "\t========== Next Volume Descriptor Sequence Extent ==========\n", + OUTPUT_DHYPHEN_PLUS_STR(Next Volume Descriptor Sequence Extent), MAKELONG(MAKEWORD(lpBuf[16], lpBuf[17]), MAKEWORD(lpBuf[18], lpBuf[19]))); OutputFsExtentDescriptor(lpBuf + 20); } @@ -445,9 +458,9 @@ VOID OutputFsAnchorVolumeDescriptorPointer( LPBYTE lpBuf ) { - OutputVolDescLogA("\t========== Main Volume Descriptor Sequence Extent ==========\n"); + OutputVolDescLogA(OUTPUT_DHYPHEN_PLUS_STR(Main Volume Descriptor Sequence Extent)); OutputFsExtentDescriptor(lpBuf + 16); - OutputVolDescLogA("\t========== Reserve Volume Descriptor Sequence Extent ==========\n"); + OutputVolDescLogA(OUTPUT_DHYPHEN_PLUS_STR(Reserve Volume Descriptor Sequence Extent)); OutputFsExtentDescriptor(lpBuf + 24); } @@ -540,114 +553,94 @@ VOID OutputFsVolumeDescriptorSequence( } switch (wTagId) { case 1: - OutputVolDescLogA( - "========== Primary Volume Descriptor, LBA[%06d, %#07x] ==========\n", nLBA, nLBA); + OutputVolDescLogA(OUTPUT_DHYPHEN_PLUS_STR_WITH_LBA_F(Primary Volume Descriptor), nLBA, nLBA); OutputFsDescriptorTag(lpBuf); OutputFsPrimaryVolumeDescriptorForUDF(lpBuf); break; case 2: - OutputVolDescLogA( - "========== Anchor Volume Descriptor Pointer, LBA[%06d, %#07x] ==========\n", nLBA, nLBA); + OutputVolDescLogA(OUTPUT_DHYPHEN_PLUS_STR_WITH_LBA_F(Anchor Volume Descriptor Pointer), nLBA, nLBA); OutputFsDescriptorTag(lpBuf); OutputFsAnchorVolumeDescriptorPointer(lpBuf); break; case 3: - OutputVolDescLogA( - "========== Volume Descriptor Pointer, LBA[%06d, %#07x] ==========\n", nLBA, nLBA); + OutputVolDescLogA(OUTPUT_DHYPHEN_PLUS_STR_WITH_LBA_F(Volume Descriptor Pointer), nLBA, nLBA); OutputFsDescriptorTag(lpBuf); OutputFsVolumeDescriptorPointer(lpBuf); break; case 4: - OutputVolDescLogA( - "========== Implementation Use Volume Descriptor, LBA[%06d, %#07x] ==========\n", nLBA, nLBA); + OutputVolDescLogA(OUTPUT_DHYPHEN_PLUS_STR_WITH_LBA_F(Implementation Use Volume Descriptor), nLBA, nLBA); OutputFsDescriptorTag(lpBuf); OutputFsImplementationUseVolumeDescriptor(lpBuf); break; case 5: - OutputVolDescLogA( - "========== Partition Descriptor, LBA[%06d, %#07x] ==========\n", nLBA, nLBA); + OutputVolDescLogA(OUTPUT_DHYPHEN_PLUS_STR_WITH_LBA_F(Partition Descriptor), nLBA, nLBA); OutputFsDescriptorTag(lpBuf); OutputFsPartitionDescriptor(lpBuf); break; case 6: - OutputVolDescLogA( - "========== Logical Volume Descriptor, LBA[%06d, %#07x] ==========\n", nLBA, nLBA); + OutputVolDescLogA(OUTPUT_DHYPHEN_PLUS_STR_WITH_LBA_F(Logical Volume Descriptor), nLBA, nLBA); OutputFsDescriptorTag(lpBuf); OutputFsLogicalVolumeDescriptor(lpBuf); break; case 7: - OutputVolDescLogA( - "========== Unallocated Space Descriptor, LBA[%06d, %#07x] ==========\n", nLBA, nLBA); + OutputVolDescLogA(OUTPUT_DHYPHEN_PLUS_STR_WITH_LBA_F(Unallocated Space Descriptor), nLBA, nLBA); OutputFsDescriptorTag(lpBuf); OutputFsUnallocatedSpaceDescriptor(lpBuf); break; case 8: - OutputVolDescLogA( - "========== Terminating Descriptor, LBA[%06d, %#07x] ==========\n", nLBA, nLBA); + OutputVolDescLogA(OUTPUT_DHYPHEN_PLUS_STR_WITH_LBA_F(Terminating Descriptor), nLBA, nLBA); OutputFsDescriptorTag(lpBuf); OutputFsTerminatingDescriptor(lpBuf); break; case 9: - OutputVolDescLogA( - "========== Logical Volume Integrity Descriptor, LBA[%06d, %#07x] ==========\n", nLBA, nLBA); + OutputVolDescLogA(OUTPUT_DHYPHEN_PLUS_STR_WITH_LBA_F(Logical Volume Integrity Descriptor), nLBA, nLBA); OutputFsDescriptorTag(lpBuf); OutputFsLogicalVolumeIntegrityDescriptor(lpBuf); break; case 256: - OutputVolDescLogA( - "========== File Set Descriptor, LBA[%06d, %#07x] ==========\n", nLBA, nLBA); + OutputVolDescLogA(OUTPUT_DHYPHEN_PLUS_STR_WITH_LBA_F(File Set Descriptor), nLBA, nLBA); OutputFsDescriptorTag(lpBuf); OutputFsFileSetDescriptor(lpBuf); break; case 257: - OutputVolDescLogA( - "========== File Identifier Descriptor, LBA[%06d, %#07x] ==========\n", nLBA, nLBA); + OutputVolDescLogA(OUTPUT_DHYPHEN_PLUS_STR_WITH_LBA_F(File Identifier Descriptor), nLBA, nLBA); OutputFsDescriptorTag(lpBuf); break; case 258: - OutputVolDescLogA( - "========== Allocation Extent Descriptor, LBA[%06d, %#07x] ==========\n", nLBA, nLBA); + OutputVolDescLogA(OUTPUT_DHYPHEN_PLUS_STR_WITH_LBA_F(Allocation Extent Descriptor), nLBA, nLBA); OutputFsDescriptorTag(lpBuf); break; case 259: - OutputVolDescLogA( - "========== Indirect Entry, LBA[%06d, %#07x] ==========\n", nLBA, nLBA); + OutputVolDescLogA(OUTPUT_DHYPHEN_PLUS_STR_WITH_LBA_F(Indirect Entry), nLBA, nLBA); break; case 260: - OutputVolDescLogA( - "========== Terminal Entry, LBA[%06d, %#07x] ==========\n", nLBA, nLBA); + OutputVolDescLogA(OUTPUT_DHYPHEN_PLUS_STR_WITH_LBA_F(Terminal Entry), nLBA, nLBA); break; case 261: - OutputVolDescLogA( - "========== File Entry, LBA[%06d, %#07x] ==========\n", nLBA, nLBA); + OutputVolDescLogA(OUTPUT_DHYPHEN_PLUS_STR_WITH_LBA_F(File Entry), nLBA, nLBA); break; case 262: - OutputVolDescLogA( - "========== Extended Attribute Header Descriptor, LBA[%06d, %#07x] ==========\n", nLBA, nLBA); + OutputVolDescLogA(OUTPUT_DHYPHEN_PLUS_STR_WITH_LBA_F(Extended Attribute Header Descriptor), nLBA, nLBA); break; case 263: - OutputVolDescLogA( - "========== Unallocated Space Entry, LBA[%06d, %#07x] ==========\n", nLBA, nLBA); + OutputVolDescLogA(OUTPUT_DHYPHEN_PLUS_STR_WITH_LBA_F(Unallocated Space Entry), nLBA, nLBA); break; case 264: - OutputVolDescLogA( - "========== Space Bitmap Descriptor, LBA[%06d, %#07x] ==========\n", nLBA, nLBA); + OutputVolDescLogA(OUTPUT_DHYPHEN_PLUS_STR_WITH_LBA_F(Space Bitmap Descriptor), nLBA, nLBA); break; case 265: - OutputVolDescLogA( - "========== Partition Integrity Entry, LBA[%06d, %#07x] ==========\n", nLBA, nLBA); + OutputVolDescLogA(OUTPUT_DHYPHEN_PLUS_STR_WITH_LBA_F(Partition Integrity Entry), nLBA, nLBA); break; case 266: - OutputVolDescLogA( - "========== Extended File Entry, LBA[%06d, %#07x] ==========\n", nLBA, nLBA); + OutputVolDescLogA(OUTPUT_DHYPHEN_PLUS_STR_WITH_LBA_F(Extended File Entry), nLBA, nLBA); break; } return; } -// end for DVD VOID OutputDVDLayerDescriptor( PDVD_FULL_LAYER_DESCRIPTOR dvdLayer, + LPBYTE lpBcaFlag, LPDWORD lpdwSectorLength ) { @@ -693,22 +686,21 @@ VOID OutputDVDLayerDescriptor( REVERSE_LONG(&dwEndDataSector); REVERSE_LONG(&dwEndLayerZeroSector); - OutputVolDescLogA( - "\t========== PhysicalFormatInformation ==========\n" - "\t\t BookVersion: %u\n" - "\t\t BookType: %s\n" - "\t\t MinimumRate: %s\n" - "\t\t DiskSize: %s\n" - "\t\t LayerType: %s\n" - "\t\t TrackPath: %s\n" - "\t\t NumberOfLayers: %s\n" - "\t\t TrackDensity: %s\n" - "\t\t LinearDensity: %s\n" - "\t\tStartingDataSector: %8lu (%#lx)\n" - "\t\t EndDataSector: %8lu (%#lx)\n" - "\t\tEndLayerZeroSector: %8lu (%#lx)\n" - "\t\t BCAFlag: %s\n" - "\t\t MediaSpecific: ", + OutputDiscLogA(OUTPUT_DHYPHEN_PLUS_STR(PhysicalFormatInformation) + "\t BookVersion: %u\n" + "\t BookType: %s\n" + "\t MinimumRate: %s\n" + "\t DiskSize: %s\n" + "\t LayerType: %s\n" + "\t TrackPath: %s\n" + "\t NumberOfLayers: %s\n" + "\t TrackDensity: %s\n" + "\t LinearDensity: %s\n" + "\tStartingDataSector: %7lu (%#lx)\n" + "\t EndDataSector: %7lu (%#lx)\n" + "\tEndLayerZeroSector: %7lu (%#lx)\n" + "\t BCAFlag: %s\n" + "\t MediaSpecific: \n", dvdLayer->commonHeader.BookVersion, lpBookType[dvdLayer->commonHeader.BookType], lpMaximumRate[dvdLayer->commonHeader.MinimumRate], @@ -722,64 +714,60 @@ VOID OutputDVDLayerDescriptor( dwEndDataSector, dwEndDataSector, dwEndLayerZeroSector, dwEndLayerZeroSector, dvdLayer->commonHeader.BCAFlag == 0 ? "No" : "Exist"); + *lpBcaFlag = dvdLayer->commonHeader.BCAFlag; - for (WORD k = 0; k < sizeof(dvdLayer->MediaSpecific); k++) { - OutputVolDescLogA("%02x", dvdLayer->MediaSpecific[k]); - } - OutputVolDescLogA("\n"); + OutputCDMain(fileDisc, dvdLayer->MediaSpecific, 0, sizeof(dvdLayer->MediaSpecific)); if (dvdLayer->commonHeader.TrackPath) { DWORD dwEndLayerZeroSectorLen = dwEndLayerZeroSector - dwStartingDataSector + 1; DWORD dwEndLayerOneSectorLen = dwEndLayerZeroSector - (~dwEndDataSector & 0xffffff) + 1; *lpdwSectorLength = dwEndLayerZeroSectorLen + dwEndLayerOneSectorLen; - OutputDiscLogA( - "========== SectorLength ==========\n" - "\t LayerZeroSector: %8lu (%#lx)\n" - "\t+ LayerOneSector: %8lu (%#lx)\n" + OutputDiscLogA(OUTPUT_DHYPHEN_PLUS_STR(SectorLength) + "\t LayerZeroSector: %7lu (%#lx)\n" + "\t+ LayerOneSector: %7lu (%#lx)\n" "\t------------------------------------\n" - "\t LayerAllSector: %8lu (%#lx)\n" + "\t LayerAllSector: %7lu (%#lx)\n" , dwEndLayerZeroSectorLen, dwEndLayerZeroSectorLen , dwEndLayerOneSectorLen, dwEndLayerOneSectorLen , *lpdwSectorLength, *lpdwSectorLength); } else { *lpdwSectorLength = dwEndDataSector - dwStartingDataSector + 1; - OutputDiscLogA( - "========== SectorLength ==========\n" - "\tLayerZeroSector: %8lu (%#lx)\n", *lpdwSectorLength, *lpdwSectorLength); + OutputDiscLogA(OUTPUT_DHYPHEN_PLUS_STR(SectorLength) + "\tLayerZeroSector: %7lu (%#lx)\n", *lpdwSectorLength, *lpdwSectorLength); } } VOID OutputDVDCopyrightDescriptor( - PDVD_COPYRIGHT_DESCRIPTOR dvdCopyright + PDVD_COPYRIGHT_DESCRIPTOR dvdCopyright, + LPBOOL lpbCPRM ) { - OutputVolDescLogA( - "\t========== CopyrightInformation ==========\n" - "\t\t CopyrightProtectionType: "); + OutputDiscLogA(OUTPUT_DHYPHEN_PLUS_STR(CopyrightInformation) + "\t CopyrightProtectionType: "); switch (dvdCopyright->CopyrightProtectionType) { case 0: - OutputVolDescLogA("No\n"); + OutputDiscLogA("No\n"); break; case 1: - OutputVolDescLogA("CSS/CPPM\n"); + OutputDiscLogA("CSS/CPPM\n"); break; case 2: - OutputVolDescLogA("CPRM\n"); + OutputDiscLogA("CPRM\n"); + *lpbCPRM = TRUE; break; case 3: - OutputVolDescLogA("AACS with HD DVD content\n"); + OutputDiscLogA("AACS with HD DVD content\n"); break; case 10: - OutputVolDescLogA("AACS with BD content\n"); + OutputDiscLogA("AACS with BD content\n"); break; default: - OutputVolDescLogA("Unknown: %02x\n", dvdCopyright->CopyrightProtectionType); + OutputDiscLogA("Unknown: %02x\n", dvdCopyright->CopyrightProtectionType); break; } - OutputVolDescLogA( - "\t\tRegionManagementInformation: %02x\n" - , dvdCopyright->RegionManagementInformation); + OutputDiscLogA( + "\tRegionManagementInformation: %02x\n", dvdCopyright->RegionManagementInformation); } VOID OutputDVDCommonInfo( @@ -788,9 +776,9 @@ VOID OutputDVDCommonInfo( ) { for (WORD k = 0; k < wFormatLength; k++) { - OutputVolDescLogA("%02x", lpFormat[k]); + OutputDiscLogA("%02x", lpFormat[k]); } - OutputVolDescLogA("\n"); + OutputDiscLogA("\n"); } @@ -798,10 +786,8 @@ VOID OutputDVDDiskKeyDescriptor( PDVD_DISK_KEY_DESCRIPTOR dvdDiskKey ) { - OutputVolDescLogA( - "\t========== DiskKeyData ==========\n\t\t"); - OutputDVDCommonInfo(dvdDiskKey->DiskKeyData, - sizeof(dvdDiskKey->DiskKeyData)); + OutputDiscLogA(OUTPUT_DHYPHEN_PLUS_STR(DiskKeyData)); + OutputCDMain(fileDisc, dvdDiskKey->DiskKeyData, 0, sizeof(dvdDiskKey->DiskKeyData)); } VOID OutputDVDBCADescriptor( @@ -809,18 +795,16 @@ VOID OutputDVDBCADescriptor( WORD wFormatLength ) { - OutputVolDescLogA( - "\t========== BCAInformation ==========\n\t"); - OutputDVDCommonInfo(dvdBca->BCAInformation, wFormatLength); + OutputDiscLogA(OUTPUT_DHYPHEN_PLUS_STR(BCAInformation)); + OutputCDMain(fileDisc, dvdBca->BCAInformation, 0, wFormatLength); } VOID OutputDVDManufacturerDescriptor( PDVD_MANUFACTURER_DESCRIPTOR dvdManufacturer ) { - OutputVolDescLogA( - "\t========== ManufacturingInformation ==========\n\t\t"); - OutputDVDCommonInfo(dvdManufacturer->ManufacturingInformation, + OutputDiscLogA(OUTPUT_DHYPHEN_PLUS_STR(ManufacturingInformation)); + OutputCDMain(fileDisc, dvdManufacturer->ManufacturingInformation, 0, sizeof(dvdManufacturer->ManufacturingInformation)); } @@ -829,7 +813,7 @@ VOID OutputDVDMediaId( WORD wFormatLength ) { - OutputVolDescLogA("\tMedia ID: "); + OutputDiscLogA(OUTPUT_DHYPHEN_PLUS_STR(Media ID)); OutputDVDCommonInfo(lpFormat, wFormatLength); } @@ -838,14 +822,14 @@ VOID OutputDVDMediaKeyBlock( WORD wFormatLength ) { - OutputVolDescLogA( + OutputDiscLogA(OUTPUT_DHYPHEN_PLUS_STR(MediaKeyBlock) "\tMedia Key Block Total Packs: %u" "\tmedia key block: ", lpFormat[3]); for (WORD k = 0; k < wFormatLength; k++) { - OutputVolDescLogA("%02x", lpFormat[k]); + OutputDiscLogA("%02x", lpFormat[k]); } - OutputVolDescLogA("\n"); + OutputDiscLogA("\n"); } VOID OutputDVDRamDds( @@ -853,7 +837,7 @@ VOID OutputDVDRamDds( WORD wFormatLength ) { - OutputVolDescLogA("\tDVD-RAM DDS: "); + OutputDiscLogA(OUTPUT_DHYPHEN_PLUS_STR(DVD-RAM DDS)"\t"); OutputDVDCommonInfo(lpFormat, wFormatLength); } @@ -861,15 +845,14 @@ VOID OutputDVDRamMediumStatus( PDVD_RAM_MEDIUM_STATUS dvdRamMeium ) { - OutputVolDescLogA( - "\t========== DVDRamMediumStatus ==========\n" - "\t\t PersistentWriteProtect: %s\n" - "\t\t CartridgeWriteProtect: %s\n" - "\t\t MediaSpecificWriteInhibit: %s\n" - "\t\t CartridgeNotSealed: %s\n" - "\t\t MediaInCartridge: %s\n" - "\t\t DiscTypeIdentification: %x\n" - "\t\tMediaSpecificWriteInhibitInformation: %s\n", + OutputDiscLogA(OUTPUT_DHYPHEN_PLUS_STR(DVDRamMediumStatus) + "\t PersistentWriteProtect: %s\n" + "\t CartridgeWriteProtect: %s\n" + "\t MediaSpecificWriteInhibit: %s\n" + "\t CartridgeNotSealed: %s\n" + "\t MediaInCartridge: %s\n" + "\t DiscTypeIdentification: %x\n" + "\tMediaSpecificWriteInhibitInformation: %s\n", BOOLEAN_TO_STRING_YES_NO_A(dvdRamMeium->PersistentWriteProtect), BOOLEAN_TO_STRING_YES_NO_A(dvdRamMeium->CartridgeWriteProtect), BOOLEAN_TO_STRING_YES_NO_A(dvdRamMeium->MediaSpecificWriteInhibit), @@ -883,11 +866,10 @@ VOID OutputDVDRamSpareArea( PDVD_RAM_SPARE_AREA_INFORMATION dvdRamSpare ) { - OutputVolDescLogA( - "\t========== DVDRamSpareAreaInformation ==========\n" - "\t\t FreePrimarySpareSectors: %lu\n" - "\t\t FreeSupplementalSpareSectors: %lu\n" - "\t\tAllocatedSupplementalSpareSectors: %lu\n", + OutputDiscLogA(OUTPUT_DHYPHEN_PLUS_STR(DVDRamSpareAreaInformation) + "\t FreePrimarySpareSectors: %lu\n" + "\t FreeSupplementalSpareSectors: %lu\n" + "\tAllocatedSupplementalSpareSectors: %lu\n", MAKELONG( MAKEWORD(dvdRamSpare->FreePrimarySpareSectors[3], dvdRamSpare->FreePrimarySpareSectors[2]), MAKEWORD(dvdRamSpare->FreePrimarySpareSectors[1], dvdRamSpare->FreePrimarySpareSectors[0])), @@ -903,9 +885,8 @@ VOID OutputDVDRamRecordingType( PDVD_RAM_RECORDING_TYPE dvdRamRecording ) { - OutputVolDescLogA( - "\t========== DVDRamRecordingType ==========\n" - "\t\tRealTimeData: %s\n", + OutputDiscLogA(OUTPUT_DHYPHEN_PLUS_STR(DVDRamRecordingType) + "\tRealTimeData: %s\n", BOOLEAN_TO_STRING_YES_NO_A(dvdRamRecording->RealTimeData)); } @@ -914,8 +895,11 @@ VOID OutputDVDRmdLastBorderOut( WORD wFormatLength ) { - OutputVolDescLogA("\tRMD in last border-out: "); - OutputDVDCommonInfo(lpFormat, wFormatLength); + OutputDiscLogA(OUTPUT_DHYPHEN_PLUS_STR(RMD in last border-out)); + INT nRoop = wFormatLength / DISC_RAW_READ_SIZE; + for (BYTE i = 0; i < nRoop; i++) { + OutputCDMain(fileDisc, lpFormat + DISC_RAW_READ_SIZE * i, 0, DISC_RAW_READ_SIZE); + } } VOID OutputDVDRecordingManagementAreaData( @@ -923,84 +907,77 @@ VOID OutputDVDRecordingManagementAreaData( WORD wFormatLength ) { - OutputVolDescLogA( - "\t========== DVDRecordingManagementAreaData ==========\n" - "\t\tLastRecordedRMASectorNumber: %lu\n" - "\t\t RMDBytes: ", + OutputDiscLogA(OUTPUT_DHYPHEN_PLUS_STR(DVDRecordingManagementAreaData) + "\tLastRecordedRMASectorNumber: %lu\n" + "\t RMDBytes: \n", MAKELONG(MAKEWORD(dvdRecordingMan->LastRecordedRMASectorNumber[3], dvdRecordingMan->LastRecordedRMASectorNumber[2]), MAKEWORD(dvdRecordingMan->LastRecordedRMASectorNumber[1], dvdRecordingMan->LastRecordedRMASectorNumber[0]))); - for (WORD k = 0; k < wFormatLength; k++) { - OutputVolDescLogA("%02x", dvdRecordingMan->RMDBytes[k]); + UINT nRoop = (wFormatLength - sizeof(DVD_RECORDING_MANAGEMENT_AREA_DATA)) / DISC_RAW_READ_SIZE; + for (BYTE i = 0; i < nRoop; i++) { + OutputCDMain(fileDisc, dvdRecordingMan->RMDBytes + DISC_RAW_READ_SIZE * i, 0, DISC_RAW_READ_SIZE); } - OutputVolDescLogA("\n"); } VOID OutputDVDPreRecordedInformation( PDVD_PRERECORDED_INFORMATION dvdPreRecorded ) { - OutputVolDescLogA( - "\t========== DVDPreRecordedInformation ==========\n" - "\t\t FieldID_1: %u\n" - "\t\t DiscApplicatiowCode: %u\n" - "\t\t DiscPhysicalCode: %u\n" - "\t\tLastAddressOfDataRecordableArea: %lu\n" - "\t\t ExtensiowCode: %u\n" - "\t\t PartVers1on: %u\n" - "\t\t FieldID_2: %u\n" - "\t\t OpcSuggestedCode: %u\n" - "\t\t WavelengthCode: %u\n" - "\t\t WriteStrategyCode: %lu\n" - "\t\t FieldID_3: %u\n" - "\t\t ManufacturerId_3: %c%c%c%c%c%c\n" - "\t\t FieldID_4: %u\n" - "\t\t ManufacturerId_4: %c%c%c%c%c%c\n" - "\t\t FieldID_5: %u\n" - "\t\t ManufacturerId_5: %c%c%c%c%c%c\n", + OutputDiscLogA(OUTPUT_DHYPHEN_PLUS_STR(DVDPreRecordedInformation) + "\t FieldID_1: %02x\n" + "\t DiscApplicatiowCode: %02x\n" + "\t DiscPhysicalCode: %02x\n" + "\tLastAddressOfDataRecordableArea: %lu\n" + "\t ExtensiowCode: %02x\n" + "\t PartVers1on: %02x\n" + "\t FieldID_2: %02x\n" + "\t OpcSuggestedCode: %02x\n" + "\t WavelengthCode: %02x\n" + "\t WriteStrategyCode: %02x%02x%02x%02x\n" + "\t FieldID_3: %02x\n" + "\t ManufacturerId_3: %02x%02x%02x%02x%02x%02x\n" + "\t FieldID_4: %02x\n" + "\t ManufacturerId_4: %02x%02x%02x%02x%02x%02x\n" + "\t FieldID_5: %02x\n" + "\t ManufacturerId_5: %02x%02x%02x%02x%02x%02x\n", dvdPreRecorded->FieldID_1, dvdPreRecorded->DiscApplicationCode, dvdPreRecorded->DiscPhysicalCode, - MAKELONG(MAKEWORD(0, dvdPreRecorded->LastAddressOfDataRecordableArea[2]), - MAKEWORD(dvdPreRecorded->LastAddressOfDataRecordableArea[1], dvdPreRecorded->LastAddressOfDataRecordableArea[0])), + MAKELONG(MAKEWORD(dvdPreRecorded->LastAddressOfDataRecordableArea[0] + , dvdPreRecorded->LastAddressOfDataRecordableArea[1]), + MAKEWORD(dvdPreRecorded->LastAddressOfDataRecordableArea[2], 0)), dvdPreRecorded->ExtensionCode, dvdPreRecorded->PartVers1on, dvdPreRecorded->FieldID_2, dvdPreRecorded->OpcSuggestedCode, dvdPreRecorded->WavelengthCode, - MAKELONG(MAKEWORD(dvdPreRecorded->WriteStrategyCode[3], dvdPreRecorded->WriteStrategyCode[2]), - MAKEWORD(dvdPreRecorded->WriteStrategyCode[1], dvdPreRecorded->WriteStrategyCode[0])), + dvdPreRecorded->WriteStrategyCode[0], dvdPreRecorded->WriteStrategyCode[1], + dvdPreRecorded->WriteStrategyCode[2], dvdPreRecorded->WriteStrategyCode[3], dvdPreRecorded->FieldID_3, - dvdPreRecorded->ManufacturerId_3[5], dvdPreRecorded->ManufacturerId_3[4], - dvdPreRecorded->ManufacturerId_3[3], dvdPreRecorded->ManufacturerId_3[2], - dvdPreRecorded->ManufacturerId_3[1], dvdPreRecorded->ManufacturerId_3[0], + dvdPreRecorded->ManufacturerId_3[0], dvdPreRecorded->ManufacturerId_3[1], + dvdPreRecorded->ManufacturerId_3[2], dvdPreRecorded->ManufacturerId_3[3], + dvdPreRecorded->ManufacturerId_3[4], dvdPreRecorded->ManufacturerId_3[5], dvdPreRecorded->FieldID_4, - dvdPreRecorded->ManufacturerId_4[5], dvdPreRecorded->ManufacturerId_4[4], - dvdPreRecorded->ManufacturerId_4[3], dvdPreRecorded->ManufacturerId_4[2], - dvdPreRecorded->ManufacturerId_4[1], dvdPreRecorded->ManufacturerId_4[0], + dvdPreRecorded->ManufacturerId_4[0], dvdPreRecorded->ManufacturerId_4[1], + dvdPreRecorded->ManufacturerId_4[2], dvdPreRecorded->ManufacturerId_4[3], + dvdPreRecorded->ManufacturerId_4[4], dvdPreRecorded->ManufacturerId_4[5], dvdPreRecorded->FieldID_5, - dvdPreRecorded->ManufacturerId_5[5], dvdPreRecorded->ManufacturerId_5[4], - dvdPreRecorded->ManufacturerId_5[3], dvdPreRecorded->ManufacturerId_5[2], - dvdPreRecorded->ManufacturerId_5[1], dvdPreRecorded->ManufacturerId_5[0]); + dvdPreRecorded->ManufacturerId_5[0], dvdPreRecorded->ManufacturerId_5[1], + dvdPreRecorded->ManufacturerId_5[2], dvdPreRecorded->ManufacturerId_5[3], + dvdPreRecorded->ManufacturerId_5[4], dvdPreRecorded->ManufacturerId_5[5]); } VOID OutputDVDUniqueDiscIdentifer( PDVD_UNIQUE_DISC_IDENTIFIER dvdUnique ) { - OutputVolDescLogA( - "\t========== DVDUniqueDiscIdentifer ==========\n" - "\t\tRandomNumber: %u\n" - "\t\t YMD HMS: %04ld-%02u-%02u %02u:%02u:%02u\n", - MAKEWORD(dvdUnique->RandomNumber[1], dvdUnique->RandomNumber[0]), - MAKELONG(MAKEWORD(dvdUnique->Year[3], dvdUnique->Year[2]), - MAKEWORD(dvdUnique->Year[1], dvdUnique->Year[0])), - MAKEWORD(dvdUnique->Month[1], dvdUnique->Month[0]), - MAKEWORD(dvdUnique->Day[1], dvdUnique->Day[0]), - MAKEWORD(dvdUnique->Hour[1], dvdUnique->Hour[0]), - MAKEWORD(dvdUnique->Minute[1], dvdUnique->Minute[0]), - MAKEWORD(dvdUnique->Second[1], dvdUnique->Second[0])); + OutputDiscLogA(OUTPUT_DHYPHEN_PLUS_STR(DVDUniqueDiscIdentifer) + "\t RandomNumber: %u\n" + "\tDate and Time: %.4s-%.2s-%.2s %.2s:%.2s:%.2s\n" + , MAKEWORD(dvdUnique->RandomNumber[1], dvdUnique->RandomNumber[0]) + , dvdUnique->Year, dvdUnique->Month, dvdUnique->Day + , dvdUnique->Hour, dvdUnique->Minute, dvdUnique->Second); } VOID OutputDVDAdipInformation( @@ -1008,7 +985,7 @@ VOID OutputDVDAdipInformation( WORD wFormatLength ) { - OutputVolDescLogA("\tADIP information: "); + OutputDiscLogA(OUTPUT_DHYPHEN_PLUS_STR(ADIP information)"\t"); OutputDVDCommonInfo(lpFormat, wFormatLength); } @@ -1016,10 +993,9 @@ VOID OutputDVDDualLayerRecordingInformation( PDVD_DUAL_LAYER_RECORDING_INFORMATION dvdDualLayer ) { - OutputVolDescLogA( - "\t========== DVDDualLayerRecordingInformation ==========\n" - "\t\tLayer0SectorsImmutable: %s\n" - "\t\t Layer0Sectors: %lu\n", + OutputDiscLogA(OUTPUT_DHYPHEN_PLUS_STR(DVDDualLayerRecordingInformation) + "\tLayer0SectorsImmutable: %s\n" + "\t Layer0Sectors: %lu\n", BOOLEAN_TO_STRING_YES_NO_A(dvdDualLayer->Layer0SectorsImmutable), MAKELONG(MAKEWORD(dvdDualLayer->Layer0Sectors[3], dvdDualLayer->Layer0Sectors[2]), MAKEWORD(dvdDualLayer->Layer0Sectors[1], dvdDualLayer->Layer0Sectors[0]))); @@ -1028,10 +1004,9 @@ VOID OutputDVDDualLayerMiddleZone( PDVD_DUAL_LAYER_MIDDLE_ZONE_START_ADDRESS dvdDualLayerMiddle ) { - OutputVolDescLogA( - "\t========== DVDDualLayerMiddleZoneStartAddress ==========\n" - "\t\t InitStatus: %s\n" - "\t\tShiftedMiddleAreaStartAddress: %lu\n", + OutputDiscLogA(OUTPUT_DHYPHEN_PLUS_STR(DVDDualLayerMiddleZoneStartAddress) + "\t InitStatus: %s\n" + "\tShiftedMiddleAreaStartAddress: %lu\n", BOOLEAN_TO_STRING_YES_NO_A(dvdDualLayerMiddle->InitStatus), MAKELONG(MAKEWORD(dvdDualLayerMiddle->ShiftedMiddleAreaStartAddress[3], dvdDualLayerMiddle->ShiftedMiddleAreaStartAddress[2]), @@ -1043,9 +1018,8 @@ VOID OutputDVDDualLayerJumpInterval( PDVD_DUAL_LAYER_JUMP_INTERVAL_SIZE dvdDualLayerJump ) { - OutputVolDescLogA( - "\t========== DVDDualLayerJumpIntervalSize ==========\n" - "\t\tJumpIntervalSize: %lu\n", + OutputDiscLogA(OUTPUT_DHYPHEN_PLUS_STR(DVDDualLayerJumpIntervalSize) + "\tJumpIntervalSize: %lu\n", MAKELONG(MAKEWORD(dvdDualLayerJump->JumpIntervalSize[3], dvdDualLayerJump->JumpIntervalSize[2]), MAKEWORD(dvdDualLayerJump->JumpIntervalSize[1], @@ -1056,9 +1030,8 @@ VOID OutputDVDDualLayerManualLayerJump( PDVD_DUAL_LAYER_MANUAL_LAYER_JUMP dvdDualLayerMan ) { - OutputVolDescLogA( - "\t========== DVDDualLayerManualLayerJump ==========\n" - "\t\tManualJumpLayerAddress: %lu\n", + OutputDiscLogA(OUTPUT_DHYPHEN_PLUS_STR(DVDDualLayerManualLayerJump) + "\tManualJumpLayerAddress: %lu\n", MAKELONG(MAKEWORD(dvdDualLayerMan->ManualJumpLayerAddress[3], dvdDualLayerMan->ManualJumpLayerAddress[2]), MAKEWORD(dvdDualLayerMan->ManualJumpLayerAddress[1], @@ -1069,9 +1042,8 @@ VOID OutputDVDDualLayerRemapping( PDVD_DUAL_LAYER_REMAPPING_INFORMATION dvdDualLayerRemapping ) { - OutputVolDescLogA( - "\t========== DVDDualLayerRemappingInformation ==========\n" - "\t\tManualJumpLayerAddress: %lu\n", + OutputDiscLogA(OUTPUT_DHYPHEN_PLUS_STR(DVDDualLayerRemappingInformation) + "\tManualJumpLayerAddress: %lu\n", MAKELONG(MAKEWORD(dvdDualLayerRemapping->RemappingAddress[3], dvdDualLayerRemapping->RemappingAddress[2]), MAKEWORD(dvdDualLayerRemapping->RemappingAddress[1], @@ -1082,11 +1054,10 @@ VOID OutputDVDDiscControlBlockHeader( PDVD_DISC_CONTROL_BLOCK_HEADER dvdDiscCtrlBlk ) { - OutputVolDescLogA( - "\t========== DVDDiscControlBlockHeader ==========\n" - "\t\tContentDescriptor: %lu\n" - "\t\t AsByte: %lu\n" - "\t\t VendorId: ", + OutputDiscLogA(OUTPUT_DHYPHEN_PLUS_STR(DVDDiscControlBlockHeader) + "\tContentDescriptor: %lu\n" + "\t AsByte: %lu\n" + "\t VendorId: ", MAKELONG(MAKEWORD(dvdDiscCtrlBlk->ContentDescriptor[3], dvdDiscCtrlBlk->ContentDescriptor[2]), MAKEWORD(dvdDiscCtrlBlk->ContentDescriptor[1], @@ -1096,20 +1067,19 @@ VOID OutputDVDDiscControlBlockHeader( MAKEWORD(dvdDiscCtrlBlk->ProhibitedActions.AsByte[1], dvdDiscCtrlBlk->ProhibitedActions.AsByte[0]))); for (WORD k = 0; k < sizeof(dvdDiscCtrlBlk->VendorId); k++) { - OutputVolDescLogA("%c", dvdDiscCtrlBlk->VendorId[k]); + OutputDiscLogA("%c", dvdDiscCtrlBlk->VendorId[k]); } - OutputVolDescLogA("\n"); + OutputDiscLogA("\n"); } VOID OutputDVDDiscControlBlockWriteInhibit( PDVD_DISC_CONTROL_BLOCK_WRITE_INHIBIT dvdDiscCtrlBlkWrite ) { - OutputVolDescLogA( - "\t========== DVDDiscControlBlockWriteInhibit ==========\n" - "\t\t UpdateCount: %lu\n" - "\t\t AsByte: %lu\n" - "\t\t UpdatePassword: ", + OutputDiscLogA(OUTPUT_DHYPHEN_PLUS_STR(DVDDiscControlBlockWriteInhibit) + "\t UpdateCount: %lu\n" + "\t AsByte: %lu\n" + "\t UpdatePassword: ", MAKELONG(MAKEWORD(dvdDiscCtrlBlkWrite->UpdateCount[3], dvdDiscCtrlBlkWrite->UpdateCount[2]), MAKEWORD(dvdDiscCtrlBlkWrite->UpdateCount[1], dvdDiscCtrlBlkWrite->UpdateCount[0])), MAKELONG(MAKEWORD(dvdDiscCtrlBlkWrite->WriteProtectActions.AsByte[3], @@ -1117,33 +1087,32 @@ VOID OutputDVDDiscControlBlockWriteInhibit( MAKEWORD(dvdDiscCtrlBlkWrite->WriteProtectActions.AsByte[1], dvdDiscCtrlBlkWrite->WriteProtectActions.AsByte[0]))); for (WORD k = 0; k < sizeof(dvdDiscCtrlBlkWrite->UpdatePassword); k++) { - OutputVolDescLogA("%c", dvdDiscCtrlBlkWrite->UpdatePassword[k]); + OutputDiscLogA("%c", dvdDiscCtrlBlkWrite->UpdatePassword[k]); } - OutputVolDescLogA("\n"); + OutputDiscLogA("\n"); } VOID OutputDVDDiscControlBlockSession( PDVD_DISC_CONTROL_BLOCK_SESSION dvdDiscCtrlBlkSession ) { - OutputVolDescLogA( - "\t========== DVDDiscControlBlockSession ==========\n" - "\t\tSessionNumber: %u\n" - "\t\t DiscID: \n", + OutputDiscLogA(OUTPUT_DHYPHEN_PLUS_STR(DVDDiscControlBlockSession) + "\tSessionNumber: %u\n" + "\t DiscID: \n", MAKEWORD(dvdDiscCtrlBlkSession->SessionNumber[1], dvdDiscCtrlBlkSession->SessionNumber[0])); for (WORD k = 0; k < sizeof(dvdDiscCtrlBlkSession->DiscID); k++) { - OutputVolDescLogA("%c", dvdDiscCtrlBlkSession->DiscID[k]); + OutputDiscLogA("%c", dvdDiscCtrlBlkSession->DiscID[k]); } - OutputVolDescLogA("\n"); + OutputDiscLogA("\n"); for (DWORD j = 0; j < sizeof(dvdDiscCtrlBlkSession->SessionItem); j++) { - OutputVolDescLogA( - "\t\t SessionItem: %lu\n" - "\t\t\t AsByte: ", j); + OutputDiscLogA( + "\t SessionItem: %lu\n" + "\t\t AsByte: ", j); for (WORD k = 0; k < sizeof(dvdDiscCtrlBlkSession->SessionItem[j].AsByte); k++) { - OutputVolDescLogA("%c", dvdDiscCtrlBlkSession->SessionItem[j].AsByte[k]); + OutputDiscLogA("%c", dvdDiscCtrlBlkSession->SessionItem[j].AsByte[k]); } - OutputVolDescLogA("\n"); + OutputDiscLogA("\n"); } } @@ -1152,20 +1121,19 @@ VOID OutputDVDDiscControlBlockList( WORD wFormatLength ) { - OutputVolDescLogA( - "\t========== DVDDiscControlBlockListT ==========\n" - "\t\tReadabldDCBs: %s\n" - "\t\tWritableDCBs: %s\n", + OutputDiscLogA(OUTPUT_DHYPHEN_PLUS_STR(DVDDiscControlBlockListT) + "\tReadabldDCBs: %s\n" + "\tWritableDCBs: %s\n", BOOLEAN_TO_STRING_YES_NO_A(dvdDiscCtrlBlkList->ReadabldDCBs), BOOLEAN_TO_STRING_YES_NO_A(dvdDiscCtrlBlkList->WritableDCBs)); - OutputVolDescLogA( - "\t\tDVD_DISC_CONTROL_BLOCK_LIST_DCB: "); + OutputDiscLogA( + "\tDVD_DISC_CONTROL_BLOCK_LIST_DCB: "); for (WORD k = 0; k < wFormatLength - sizeof(DVD_DISC_CONTROL_BLOCK_LIST); k++) { - OutputVolDescLogA("%lu", + OutputDiscLogA("%lu", MAKELONG(MAKEWORD(dvdDiscCtrlBlkList->Dcbs[k].DcbIdentifier[3], dvdDiscCtrlBlkList->Dcbs[k].DcbIdentifier[2]), MAKEWORD(dvdDiscCtrlBlkList->Dcbs[k].DcbIdentifier[1], dvdDiscCtrlBlkList->Dcbs[k].DcbIdentifier[0]))); } - OutputVolDescLogA("\n"); + OutputDiscLogA("\n"); } @@ -1174,7 +1142,7 @@ VOID OutputDVDMtaEccBlock( WORD wFormatLength ) { - OutputVolDescLogA("\tMTA ECC Block: "); + OutputDiscLogA(OUTPUT_DHYPHEN_PLUS_STR(MTA ECC Block)"\t"); OutputDVDCommonInfo(lpFormat, wFormatLength); } @@ -1182,12 +1150,11 @@ VOID OutputDVDWriteProtectionStatus( PDVD_WRITE_PROTECTION_STATUS dvdWrite ) { - OutputVolDescLogA( - "\t========== DVDWriteProtectionStatus ==========\n" - "\t\tSoftwareWriteProtectUntilPowerdown: %s\n" - "\t\t MediaPersistentWriteProtect: %s\n" - "\t\t CartridgeWriteProtect: %s\n" - "\t\t MediaSpecificWriteProtect: %s\n", + OutputDiscLogA(OUTPUT_DHYPHEN_PLUS_STR(DVDWriteProtectionStatus) + "\tSoftwareWriteProtectUntilPowerdown: %s\n" + "\t MediaPersistentWriteProtect: %s\n" + "\t CartridgeWriteProtect: %s\n" + "\t MediaSpecificWriteProtect: %s\n", BOOLEAN_TO_STRING_YES_NO_A(dvdWrite->SoftwareWriteProtectUntilPowerdown), BOOLEAN_TO_STRING_YES_NO_A(dvdWrite->MediaPersistentWriteProtect), BOOLEAN_TO_STRING_YES_NO_A(dvdWrite->CartridgeWriteProtect), @@ -1199,7 +1166,7 @@ VOID OutputDVDAACSVolumeIdentifier( WORD wFormatLength ) { - OutputVolDescLogA("\tAACS Volume Identifiers: "); + OutputDiscLogA(OUTPUT_DHYPHEN_PLUS_STR(AACS Volume Identifiers)"\t"); OutputDVDCommonInfo(lpFormat, wFormatLength); } @@ -1208,7 +1175,7 @@ VOID OutputDVDPreRecordedAACSMediaSerialNumber( WORD wFormatLength ) { - OutputVolDescLogA("\tPreRecorded AACS Media Serial Number: "); + OutputDiscLogA(OUTPUT_DHYPHEN_PLUS_STR(PreRecorded AACS Media Serial Number)"\t"); OutputDVDCommonInfo(lpFormat, wFormatLength); } @@ -1217,7 +1184,7 @@ VOID OutputDVDAACSMediaIdentifier( WORD wFormatLength ) { - OutputVolDescLogA("\tAACS Media Identifier: "); + OutputDiscLogA(OUTPUT_DHYPHEN_PLUS_STR(AACS Media Identifier)"\t"); OutputDVDCommonInfo(lpFormat, wFormatLength); } @@ -1226,7 +1193,7 @@ VOID OutputDVDAACSMediaKeyBlock( WORD wFormatLength ) { - OutputVolDescLogA("\tAACS Media Key Block: "); + OutputDiscLogA(OUTPUT_DHYPHEN_PLUS_STR(AACS Media Key Block)"\t"); OutputDVDCommonInfo(lpFormat, wFormatLength); } @@ -1234,7 +1201,7 @@ VOID OutputDVDListOfRecognizedFormatLayers( PDVD_LIST_OF_RECOGNIZED_FORMAT_LAYERS_TYPE_CODE dvdListOf ) { - OutputVolDescLogA( + OutputDiscLogA( "\t\tNumberOfRecognizedFormatLayers: %u\n" "\t\t OnlineFormatlayer: %u\n" "\t\t DefaultFormatLayer: %u\n", @@ -1245,6 +1212,8 @@ VOID OutputDVDListOfRecognizedFormatLayers( VOID OutputDVDStructureFormat( BYTE byFormatCode, + LPBYTE lpBcaFlag, + LPBOOL lpbCPRM, WORD wFormatLength, LPBYTE lpFormat, LPDWORD lpdwSectorLength @@ -1253,10 +1222,10 @@ VOID OutputDVDStructureFormat( switch (byFormatCode) { case DvdPhysicalDescriptor: case 0x10: - OutputDVDLayerDescriptor((PDVD_FULL_LAYER_DESCRIPTOR)lpFormat, lpdwSectorLength); + OutputDVDLayerDescriptor((PDVD_FULL_LAYER_DESCRIPTOR)lpFormat, lpBcaFlag, lpdwSectorLength); break; case DvdCopyrightDescriptor: - OutputDVDCopyrightDescriptor((PDVD_COPYRIGHT_DESCRIPTOR)lpFormat); + OutputDVDCopyrightDescriptor((PDVD_COPYRIGHT_DESCRIPTOR)lpFormat, lpbCPRM); break; case DvdDiskKeyDescriptor: OutputDVDDiskKeyDescriptor((PDVD_DISK_KEY_DESCRIPTOR)lpFormat); @@ -1361,7 +1330,7 @@ VOID OutputDVDStructureFormat( break; // formats 0x91 through 0xFE are not yet defined default: - OutputVolDescLogA("\tUnknown: %02x\n", byFormatCode); + OutputDiscLogA("\tUnknown: %02x\n", byFormatCode); break; } } @@ -1371,42 +1340,41 @@ VOID OutputDVDCopyrightManagementInformation( INT nLBA ) { - OutputVolDescLogA("\t\tLBA %7u, ", nLBA); + OutputDiscLogA(STR_LBA, nLBA, nLBA); if ((dvdCopyright->CPR_MAI & 0x80) == 0x80) { - OutputVolDescLogA("CPM exists"); if ((dvdCopyright->CPR_MAI & 0x40) == 0x40) { switch (dvdCopyright->CPR_MAI & 0x0f) { case 0: - OutputVolDescLogA(", the sector is scrambled by CSS"); + OutputDiscLogA("This sector is scrambled by CSS"); break; case 0x01: - OutputVolDescLogA(", the sector is encrypted by CPPM"); + OutputDiscLogA("This sector is encrypted by CPPM"); break; default: - OutputVolDescLogA(", reserved"); + OutputDiscLogA("reserved"); } } else { - OutputVolDescLogA(", CSS or CPPM doesn't exist in this sector"); + OutputDiscLogA("CSS or CPPM doesn't exist in this sector"); } switch (dvdCopyright->CPR_MAI & 0x30) { case 0: - OutputVolDescLogA(", copying is permitted without restriction\n"); + OutputDiscLogA(", copying is permitted without restriction\n"); break; case 0x10: - OutputVolDescLogA(", reserved\n"); + OutputDiscLogA(", reserved\n"); break; case 0x20: - OutputVolDescLogA(", one generation of copies may be made\n"); + OutputDiscLogA(", one generation of copies may be made\n"); break; case 0x30: - OutputVolDescLogA(", no copying is permitted\n"); + OutputDiscLogA(", no copying is permitted\n"); break; default: - OutputVolDescLogA("\n"); + OutputDiscLogA("\n"); } } else { - OutputVolDescLogA("CPM doesn't exist\n"); + OutputDiscLogA("No protected sector\n"); } } diff --git a/DiscImageCreator/outputScsiCmdLogforDVD.h b/DiscImageCreator/outputScsiCmdLogforDVD.h index 7e937be..77bd18f 100644 --- a/DiscImageCreator/outputScsiCmdLogforDVD.h +++ b/DiscImageCreator/outputScsiCmdLogforDVD.h @@ -15,6 +15,8 @@ VOID OutputFsVolumeRecognitionSequence( VOID OutputDVDStructureFormat( BYTE byFormatCode, + LPBYTE lpBcaFlag, + LPBOOL lpbCPRM, WORD wFormatLength, LPBYTE lpFormat, LPDWORD lpdwSectorLength diff --git a/DiscImageCreator/set.cpp b/DiscImageCreator/set.cpp index f062fe8..6ecc986 100644 --- a/DiscImageCreator/set.cpp +++ b/DiscImageCreator/set.cpp @@ -197,8 +197,6 @@ VOID SetAndOutputTocFull( fullToc->FirstCompleteSession, fullToc->LastCompleteSession); BOOL bFirst2ndSession = TRUE; - pDisc->SCSI.nFirstLBAofLeadout = -1; - pDisc->SCSI.nFirstLBAof2ndSession = -1; UCHAR ucTmpLastTrack = 0; for (WORD a = 0; a < wTocEntries; a++) { diff --git a/DiscImageCreator/struct.h b/DiscImageCreator/struct.h index 563c9a7..572b0e5 100644 --- a/DiscImageCreator/struct.h +++ b/DiscImageCreator/struct.h @@ -127,6 +127,7 @@ typedef struct _DISC { BYTE byLastDataTrackNum; // get at CDROM_READ_TOC_EX_FORMAT_TOC BYTE byCdi; // get at CDROM_READ_TOC_EX_FORMAT_FULL_TOC BYTE padding1; + BOOL bMultiSession; // get at CDROM_READ_TOC_EX_FORMAT_FULL_TOC LPBYTE lpSessionNumList; // get at CDROM_READ_TOC_EX_FORMAT_FULL_TOC INT nFirstLBAofLeadout; // get at CDROM_READ_TOC_EX_FORMAT_FULL_TOC INT nFirstLBAof2ndSession; // get at CDROM_READ_TOC_EX_FORMAT_FULL_TOC @@ -151,16 +152,13 @@ typedef struct _DISC { BOOL bPathType; // use path table record } MAIN; struct _SUB { - BYTE byDesync; - BYTE byIndex0InTrack1; - BYTE byCatalog; - BYTE padding1; - INT nSubchOffset; + INT nSubChannelOffset; INT nFirstLBAForMCN[3][2]; INT nRangeLBAForMCN[3][2]; INT nPrevMCNSector; + BYTE byDesync; + BYTE byCatalog; CHAR szCatalog[META_CATALOG_SIZE]; - BYTE padding[2]; INT nFirstLBAForISRC[3][2]; INT nRangeLBAForISRC[3][2]; INT nPrevISRCSector; diff --git a/Doc/ChangeLog.txt b/Doc/ChangeLog.txt index 027d301..b76cc15 100644 --- a/Doc/ChangeLog.txt +++ b/Doc/ChangeLog.txt @@ -400,3 +400,14 @@ http://www.mediafire.com/?mhif8c7s3iayqac/ - changed: Some log message - changed: the max size to search the exe file when use /sf option (1024 -> 4096) - fixed: Disc that the session 2 starts from the track 2 + +*2017-10-10 +- changed: /r option is used only by data command +- changed: /raw option is used only by the multi-session disc +- changed: Enable multiple execution +- fixed: Getting the subchannel offsets (Resident Evil 2 Disc 2 (Eu)) +- fixed: Descrambling from 00:01:00 to 00:01:74 when used /p option +- fixed: GMT of the CD log, UTC of the DVD log +- improved: Checking argument (cd, dvd) +- improved: Reading directory record (SimCity 3000 (USA)) +- improved: Reading DVD structure diff --git a/Doc/ReadMe.txt b/Doc/ReadMe.txt index 655216e..66c66a9 100644 --- a/Doc/ReadMe.txt +++ b/Doc/ReadMe.txt @@ -74,78 +74,102 @@ * Bug report To: http://forum.redump.org/topic/10483/discimagecreator/ + or + To: https://github.com/saramibreak/DiscImageCreator/issues * Gratitude Thank's redump.org users. ========================== Supported/Unsupported Disc ========================= -* Supported Disc (I tested these) - - Apple Macintosh - - Audio CD - - Bandai Playdia - - DVD-Video - - Fujitsu FM Towns series - - IBM PC compatible - - NEC PC-98 series CD - - NEC PC-Engine CD - - NEC PC-FX - - Panasonic 3DO Interactive Multiplayer - - Philips CD-i - - Sega Dreamcast - - Sega Mega-CD - - Sega Saturn - - Sony PlayStation - - Sony PlayStation 2 - - SNK Neo Geo CD - - VCD - -* Support WIP (Because I haven't enough to test) - - Protected Disc - bad(error) sector => SafeDisc, SmartE, Cactus Data Shield 300 - ProtectCD-VOB - weak sector => SafeDisc v2 or higher - unique data on subchannel => LibCrypt, SecuROM(v1 - v4.8x) - Intensional(deliberate) C1/C2 error => Cactus Data Shield 200 - characteristic track => CD Lock - Fake TOC => Cactus Data Shield 100 - Pregap => Key2Audio - read errors? => PhenoProtect - -* Supported Disc? (I haven't tested these yet) - - Acorn Archimedes - - Bandai / Apple Pippin - - Commodore Amiga CD - - Commodore Amiga CD32 - - Commodore Amiga CDTV - - Mattel HyperScan - - Microsoft Xbox - - Microsoft Xbox 360 - - NEC PC-88 series CD - - Sharp X68000 CD - - Tandy / Memorex Visual Information System - - Tao iKTV CD - - Tomy Kiss-Site CD - - VM Labs NUON DVD - - VTech V.Flash +* Supported Disc + CD + - Apple Macintosh + - Audio CD + - Bandai Playdia + - Bandai / Apple Pippin + - Commodore Amiga CD + - Commodore Amiga CD32 + - Commodore Amiga CDTV + - Fujitsu FM Towns series + - IBM PC compatible + - Mattel HyperScan + - NEC PC-88 series CD + - NEC PC-98 series CD + - NEC PC-FX + - NEC PC Engine CD - TurboGrafx-CD + - Palm OS + - Panasonic 3DO Interactive Multiplayer + - Philips CD-i + - Photo CD + - Sega Mega-CD + - Sega Saturn + - Sharp X68000 CD + - SNK Neo Geo CD + - Sony PlayStation + - Tandy / Memorex Visual Information System + - Tao iKTV CD + - Tomy Kiss-Site CD + - Video CD + - VTech V.Flash + + GD + - Namco / Sega / Nintendo Triforce + - Sega Dreamcast + - Sega Chihiro + - Sega Naomi + + DVD + - DVD-Video + - IBM PC compatible + - Sony PlayStation 2 + - VM Labs NUON DVD + - Sega Lindbergh + + Protected Disc + - SafeDisc, SmartE, Cactus Data Shield 300, ProtectCD-VOB [bad(error) sector] + - SafeDisc v2 or higher [weak sector] + - LibCrypt, SecuROM(v1 - v4.8x) [unique data on subchannel] + - Cactus Data Shield 200 [Intensional(deliberate) C1/C2 error] + - CD Lock [characteristic track] + - Cactus Data Shield 100 [Fake TOC] + - Key2Audio [Pregap] + - PhenoProtect [read errors?] * Probably Unsupported Disc - no signal sector => LaserLock, RingPROTECH, ProRing - The result doesn't match at each drives. - read error => CodeLock - Compared to CloneCD or CD Manipulator, a plextor detects double errors. + DVD + - Microsoft Xbox + - Microsoft Xbox 360 + => see this. http://forum.redump.org/topic/6073/xbox-1-360-dumping-instructions/ + + Protected Disc + - LaserLock, RingPROTECH, ProRing [no signal sector] + => The result doesn't match at each drives. + - CodeLock [read error] + => Compared to CloneCD or CD Manipulator, a plextor detects double errors. * Unsupported Disc - - Protected Disc - different frequency => SecuROM(v5 or higher), StarForce, CD-Cops - These needs DPM(Data position measurement). cue, ccd doesn't support DPM. - To store DPM, you need to use the Alcohol 120/52% (http://www.alcohol-soft.com/) - duplicated(double, triple) sector => Alpha-ROM, ROOT, TAGES - It can read in reverse, but specifications are not decided in redump.org - - HD DVD & Blu-ray Disc - I don't have a drive, so I can't test. - - Nintendo GameCube & Wii - I don't implement a code to decrypt. (if you have a supported drive, - you can rip a "encrypted" image.) + Protected Disc + - SecuROM(v5 or higher), StarForce, CD-Cops [different frequency] + => These needs DPM(Data position measurement). cue, ccd doesn't support DPM. + To store it, you need to use the Alcohol 120/52% (http://www.alcohol-soft.com/) + - Alpha-ROM, ROOT, TAGES [duplicated(double, triple) sector] + => It can read in reverse, but specifications are not decided in redump.org + + Nintendo GameCube & Wii + => I don't implement a code to decrypt. To decrypt, you need to use RawDump or friidump. + (if you have a supported drive, you can rip a "encrypted" image with this app.) + + HD DVD + => I don't have a drive, so I can't test. + + Blu-ray Disc + - Microsoft Xbox One + - Sony PlayStation 3 + - Sony PlayStation 4 + => I don't have a drive, so I can't test. + + Nintendo Wii U + => I don't know the details. ============================= Ripping information ============================= * Preparation @@ -214,7 +238,7 @@ .c2 store the c2 error. 1bit expresses 1byte. .ccd - store the CD information. Original format is CloneCD (http://www.slysoft.com/en/clonecd.html) + store the CD information. Original format is CloneCD (https://www.redfox.bz/ja/clonecd.html) .cue store the CD information. Original format is CDRWIN (https://web.archive.org/web/20111008191852/http://www.goldenhawk.com/cdrwin.htm) .dat @@ -234,19 +258,19 @@ _drive.txt store the drive information returned by SCSI command. _mainError.txt - store the disc main error information getting read disc. + store the error message. _mainInfo.txt - store the disc main info information getting read disc. + store the main sector as text data. _sub.txt store the parsed sub channel file as text data. _subError.txt - store the disc sub error information getting read disc. + store the subchannel error. _subInfo.txt - store the disc sub info information getting read disc. + store the subchannel when the track number changes. _subIntention.txt - store subchannel for securom getting read disc. + store the subchannel data for securom. _volDesc.txt - store the volume descriptor, path table, directory table of CD as text data. + store the volume descriptor, path table and directory table as text data. ========================= Drive information (I tested) ======================== Vendor Model Firmware(*1) Lead-in Lead-out Scrambled GD-ROM(*2) Wii-ROM