diff --git a/Main/src/Image.h b/Main/src/Image.h index e95fd019..f14ad061 100644 --- a/Main/src/Image.h +++ b/Main/src/Image.h @@ -252,12 +252,14 @@ TLogTime iwTime; // inspection window size; a "1" is expected in its centre TLogTime iwTimeMin,iwTimeMax; // inspection window possible time range BYTE adjustmentPercentMax; // percentual "speed" in inspection window adjustment + + void Reset(); } profile; protected: const PLogTime logTimes; // absolute logical times since the start of recording DWORD iNextTime,nLogTimes; - TLogTime indexPulses[DEVICE_REVOLUTIONS_MAX]; - BYTE nIndexPulses; + TLogTime indexPulses[DEVICE_REVOLUTIONS_MAX+1]; + BYTE iNextIndexPulse,nIndexPulses; TLogTime currentTime; TCodec codec; TMedium::TType mediumType; @@ -307,7 +309,7 @@ //TSector Scan(BYTE revolutionIndex,PSectorId pOutFoundSectors,PLogTime pOutDataStart); WORD ScanFm(PSectorId pOutFoundSectors,PLogTime pOutIdEnds,TProfile *pOutIdProfiles,TFdcStatus *pOutIdStatuses); WORD ScanMfm(PSectorId pOutFoundSectors,PLogTime pOutIdEnds,TProfile *pOutIdProfiles,TFdcStatus *pOutIdStatuses); - TFdcStatus ReadData(WORD nBytesToRead,LPBYTE buffer); + //TFdcStatus ReadData(WORD nBytesToRead,LPBYTE buffer); TFdcStatus ReadDataFm(WORD nBytesToRead,LPBYTE buffer); TFdcStatus ReadDataMfm(WORD nBytesToRead,LPBYTE buffer); }; @@ -420,6 +422,7 @@ virtual TStdWinError SetMediumTypeAndGeometry(PCFormat pFormat,PCSide sideMap,TSector firstSectorNumber); virtual bool EditSettings(bool initialEditing)=0; virtual TStdWinError Reset()=0; + virtual std::unique_ptr GetTrackDescription(TCylinder cyl,THead head) const; virtual TStdWinError SaveTrack(TCylinder cyl,THead head); virtual TStdWinError FormatTrack(TCylinder cyl,THead head,TSector nSectors,PCSectorId bufferId,PCWORD bufferLength,PCFdcStatus bufferFdcStatus,BYTE gap3,BYTE fillerByte)=0; virtual bool RequiresFormattedTracksVerification() const; diff --git a/Main/src/Image_TrackRW.cpp b/Main/src/Image_TrackRW.cpp index acb7bc52..523cd4e5 100644 --- a/Main/src/Image_TrackRW.cpp +++ b/Main/src/Image_TrackRW.cpp @@ -3,10 +3,11 @@ CImage::CTrackReader::CTrackReader(PLogTime _logTimes,DWORD nLogTimes,PCLogTime indexPulses,BYTE _nIndexPulses,TMedium::TType mediumType,TCodec codec) // ctor : logTimes(_logTimes+1) , nLogTimes(nLogTimes) // "+1" = hidden item represents reference counter - , nIndexPulses( std::min( DEVICE_REVOLUTIONS_MAX, _nIndexPulses ) ) + , iNextIndexPulse(0) , nIndexPulses( std::min( DEVICE_REVOLUTIONS_MAX, _nIndexPulses ) ) , iNextTime(0) , currentTime(0) , nConsecutiveZeros(0) { ::memcpy( this->indexPulses, indexPulses, nIndexPulses*sizeof(TLogTime) ); + this->indexPulses[nIndexPulses]=INT_MAX; // a virtual IndexPulse in infinity logTimes[-1]=1; // initializing the reference counter SetCodec(codec); // setting values associated with the specified Codec SetMediumType(mediumType); // setting values associated with the specified MediumType @@ -39,9 +40,14 @@ // seeks to the specified LogicalTime if (!nLogTimes) return; + if (logTime<0) + logTime=0; + for( iNextIndexPulse=0; iNextIndexPulse=indexPulses[iNextIndexPulse]){ + profile.Reset(); + iNextIndexPulse++; + } + // - reading next bit //switch (method){ //case TMethod::FDD_KEIR_FRASIER: // FDC-like flux reversal decoding from Keir Frasier's Disk-Utilities/libdisk @@ -354,6 +361,22 @@ + + void CImage::CTrackReader::TProfile::Reset(){ + iwTime=iwTimeDefault; + } + + + + + + + + + + + + CImage::CTrackReaderWriter::CTrackReaderWriter(DWORD nLogTimesMax) // ctor : CTrackReader( (PLogTime)::calloc(nLogTimesMax+1,sizeof(TLogTime)), 0, nullptr, 0, TMedium::FLOPPY_DD_350, TCodec::MFM ) // "+1" = hidden item represents reference counter