diff --git a/Main/src/CapsBase.cpp b/Main/src/CapsBase.cpp index 2833c691..3f3490a5 100644 --- a/Main/src/CapsBase.cpp +++ b/Main/src/CapsBase.cpp @@ -1076,7 +1076,7 @@ if (!params.verifyBadSectors) // remove Events that relate to Bad Sectors for( auto i=nSectors; i>0; ){ const TPhysicalAddress chs={ cyl, head, ids[--i] }; - if (dos->GetSectorStatus(chs)==CDos::TSectorStatus::BAD){ + if (dos->GetSectorStatus(chs)==TSectorStatus::BAD){ peTrack.RemoveConsecutiveBeforeEnd( idEnds[i] ); peTrack.RemoveConsecutiveBeforeEnd( dataEnds[i] ); } diff --git a/Main/src/DialogVerification.cpp b/Main/src/DialogVerification.cpp index 557be34a..deb05dec 100644 --- a/Main/src/DialogVerification.cpp +++ b/Main/src/DialogVerification.cpp @@ -388,7 +388,7 @@ CDos::CFatPath::PItem pItem; DWORD nItems; for( rFatPath.GetItems(pItem,nItems); nItems--; pItem++ ) if (pItem->value) // if Sector cross-linked ... - dos->ModifyStdSectorStatus( pItem->chs, CDos::TSectorStatus::EMPTY ); // ... reverting its reservation, setting it Empty again + dos->ModifyStdSectorStatus( pItem->chs, TSectorStatus::EMPTY ); // ... reverting its reservation, setting it Empty again } } fatTransaction( vp.dos, fatPath ); // . checking that the File's FatPath is unique @@ -443,7 +443,7 @@ } } // | reserving the found empty healthy Sector by marking it Bad so that it's excluded from available empty Sectors - if (vp.dos->ModifyStdSectorStatus( pItem->chs, CDos::TSectorStatus::BAD )) + if (vp.dos->ModifyStdSectorStatus( pItem->chs, TSectorStatus::BAD )) pItem->value=1; // Sector succesfully reserved else return vp.TerminateAll(ERROR_NOT_SUPPORTED); // DOS unable to reserve the above Sector @@ -583,10 +583,10 @@ TSectorId bufferId[(TSector)-1]; const TSector nSectors=vp.dos->GetListOfStdSectors( chs.cylinder, chs.head, bufferId ); // . verifying whether officially Occupied or Reserved Sectors are actually affiliated to any File - CDos::TSectorStatus statuses[(TSector)-1]; + TSectorStatus statuses[(TSector)-1]; vp.dos->GetSectorStatuses( chs.cylinder, chs.head, nSectors, bufferId, statuses ); for( TSector s=0; sModifyStdSectorStatus( chs, CDos::TSectorStatus::EMPTY ); + vp.dos->ModifyStdSectorStatus( chs, TSectorStatus::EMPTY ); vp.fReport.CloseProblem(true); } break; @@ -669,7 +669,7 @@ return vp.TerminateAll(ERROR_OPEN_FAILED); // errors shouldn't occur at this moment, but just to be sure if (nItems!=1) return vp.TerminateAll(ERROR_OPEN_FAILED); // errors shouldn't occur at this moment, but just to be sure - vp.dos->ModifyStdSectorStatus( pItem->chs, CDos::TSectorStatus::EMPTY ); + vp.dos->ModifyStdSectorStatus( pItem->chs, TSectorStatus::EMPTY ); // : associating the lost Sector with the temporary File pItem->chs=chs; vp.dos->ModifyFileFatPath( file, fatPath ); @@ -697,11 +697,11 @@ TSectorId bufferId[(TSector)-1]; const TSector nSectors=vp.dos->GetListOfStdSectors( chs.cylinder, chs.head, bufferId ); // . determining whether the Track contains some Empty Sectors - CDos::TSectorStatus statuses[(TSector)-1]; + TSectorStatus statuses[(TSector)-1]; vp.dos->GetSectorStatuses( chs.cylinder, chs.head, nSectors, bufferId, statuses ); bool trackContainsEmptySectors=false; // assumption for( TSector s=0; sBufferTrackData( chs.cylinder, chs.head, Revolution::ANY_GOOD, bufferId, sectorIdAndPositionIdentity, nSectors ); // . determining healthiness of Empty Sectors for( TSector s=0; sGetHealthySectorData(chs)){ const CString msg=Utils::SimpleFormat( _T("On %s, empty sector with %s is bad but is not marked so in the FAT."), chs.GetTrackIdDesc(vp.dos->formatBoot.nHeads), chs.sectorId.ToString() ); @@ -719,7 +719,7 @@ case IDNO: continue; } - vp.dos->ModifyStdSectorStatus( chs, CDos::TSectorStatus::BAD ); + vp.dos->ModifyStdSectorStatus( chs, TSectorStatus::BAD ); vp.fReport.CloseProblem(true); } } diff --git a/Main/src/Dos.cpp b/Main/src/Dos.cpp index c16e368a..cfb5a948 100644 --- a/Main/src/Dos.cpp +++ b/Main/src/Dos.cpp @@ -267,7 +267,7 @@ reportError:Utils::Information(buf); chs.sectorId=ids[--n]; d.dos->ModifyStdSectorStatus( chs, - d.dos->image->GetHealthySectorData(chs) ? CDos::TSectorStatus::EMPTY : CDos::TSectorStatus::BAD + d.dos->image->GetHealthySectorData(chs) ? TSectorStatus::EMPTY : TSectorStatus::BAD ); } @@ -702,7 +702,7 @@ reportError:Utils::Information(buf); - CDos::TSectorStatus CDos::GetSectorStatus(RCPhysicalAddress chs) const{ + TSectorStatus CDos::GetSectorStatus(RCPhysicalAddress chs) const{ // determines and returns the Status of the Sector on the specified PhysicalAddress TSectorStatus result; GetSectorStatuses( chs.cylinder, chs.head, 1, &chs.sectorId, &result ); @@ -712,13 +712,13 @@ reportError:Utils::Information(buf); LPCTSTR CDos::GetSectorStatusText(RCPhysicalAddress chs) const{ // determines and returns the Status of the Sector on the specified PhysicalAddress switch (GetSectorStatus(chs)){ - case CDos::TSectorStatus::SYSTEM: return _T("System"); - case CDos::TSectorStatus::UNAVAILABLE: return _T("Unavailable"); - case CDos::TSectorStatus::SKIPPED: return _T("Skipped"); - case CDos::TSectorStatus::BAD: return _T("Bad"); - case CDos::TSectorStatus::OCCUPIED: return _T("Occupied"); - case CDos::TSectorStatus::RESERVED: return _T("Reserved"); - case CDos::TSectorStatus::EMPTY: return _T("Empty"); + case TSectorStatus::SYSTEM: return _T("System"); + case TSectorStatus::UNAVAILABLE: return _T("Unavailable"); + case TSectorStatus::SKIPPED: return _T("Skipped"); + case TSectorStatus::BAD: return _T("Bad"); + case TSectorStatus::OCCUPIED: return _T("Occupied"); + case TSectorStatus::RESERVED: return _T("Reserved"); + case TSectorStatus::EMPTY: return _T("Empty"); default: return _T("Unknown"); } } diff --git a/Main/src/Dos.h b/Main/src/Dos.h index c776f32e..7431c2a7 100644 --- a/Main/src/Dos.h +++ b/Main/src/Dos.h @@ -32,17 +32,6 @@ typedef PVOID PFile; typedef LPCVOID PCFile; - typedef enum TSectorStatus:COLORREF{ // each value must be bigger than the biggest possible Sector length (typically 16384) - SYSTEM =0xff40ff, // e.g. reserved for root Directory - UNAVAILABLE =0x707070, // Sectors that are not included in FAT (e.g. beyond the FAT, or FAT Sector error) - SKIPPED =0xb8b8b8, // e.g. deleted Files in TR-DOS - BAD =0x0000ff, - OCCUPIED =0xffcc99, - RESERVED =0xffff99, // e.g. zero-length File in MDOS, or File with error during importing - EMPTY =0xffffff, // reported as unallocated - UNKNOWN =0x00ffff // any Sector whose ID doesn't match any ID from the standard format, e.g. ID={2,1,0,3} for an MDOS Sector - } *PSectorStatus; - typedef class CPathString sealed:protected CString{ mutable CString unicode; diff --git a/Main/src/Image_Dump.cpp b/Main/src/Image_Dump.cpp index 0348c5e7..cd1116df 100644 --- a/Main/src/Image_Dump.cpp +++ b/Main/src/Image_Dump.cpp @@ -356,7 +356,7 @@ || p.acceptance.anyErrorsOnUnknownSectors && !dp.dos->IsStdSector(p.chs) || - p.acceptance.anyErrorsOnEmptySectors && dp.dos->GetSectorStatus(p.chs)==CDos::TSectorStatus::EMPTY + p.acceptance.anyErrorsOnEmptySectors && dp.dos->GetSectorStatus(p.chs)==TSectorStatus::EMPTY ) ) ){ diff --git a/Main/src/ViewTrackMap.cpp b/Main/src/ViewTrackMap.cpp index 2759e903..4b0580b2 100644 --- a/Main/src/ViewTrackMap.cpp +++ b/Main/src/ViewTrackMap.cpp @@ -320,10 +320,9 @@ longestTrackNanoseconds=nNanosecondsOnTrack; outdated|=showTimed; } + const Utils::TClientRect rc(m_hWnd); if (outdated) if (fitLongestTrackInWindow){ - CRect rc; - GetClientRect(&rc); zoomLengthFactor = showTimed ? TTrackLength::FromTime(longestTrackNanoseconds,nNanosecondsPerByte).GetZoomFactorToFitWidth(rc.Width()) : longestTrack.GetZoomFactorToFitWidth(rc.Width()); @@ -334,12 +333,10 @@ // - basic drawing CClientDC dc(this); OnPrepareDC(&dc); - CRect rc; - GetClientRect(&rc); ::SetBkMode(dc,TRANSPARENT); const HGDIOBJ font0=::SelectObject(dc,Utils::CRideFont::Std); TCHAR buf[16]; - // : drawing Cylinder and Side numbers + // : drawing Cylinder and Head numbers const int y=TRACK0_Y+trackNumber*TRACK_HEIGHT; if (const THead head=ti.head) ::wsprintf(buf,_T("\t\t%d"),head); @@ -354,15 +351,14 @@ const HGDIOBJ hBrush0=::SelectObject(dc,Utils::CRideBrush::White); if (displayType==TDisplayType::STATUS){ // drawing Sector Statuses - CDos::TSectorStatus statuses[(TSector)-1]; + TSectorStatus statuses[(TSector)-1]; DOS->GetSectorStatuses( ti.cylinder, ti.head, ti.nSectors, ti.bufferId, statuses ); for( TSector s=0; s>zoomLengthFactor); // "1+" = to correctly display a zero-length Sector if (iScrollXScanTrack(cyl,head,nullptr,bufferId,bufferLength); rsp.sectors.nTotally+=nSectors; - CDos::TSectorStatus statuses[(TSector)-1]; + TSectorStatus statuses[(TSector)-1]; for( rsp.dos->GetSectorStatuses(cyl,head,nSectors,bufferId,statuses); nSectors--; ) switch (statuses[nSectors]){ - case CDos::TSectorStatus::SYSTEM :rsp.sectors.nSystem++; break; - case CDos::TSectorStatus::BAD :rsp.sectors.nBad++; break; - case CDos::TSectorStatus::OCCUPIED :rsp.sectors.nOccupied++; break; - case CDos::TSectorStatus::RESERVED :rsp.sectors.nReserved++; break; - case CDos::TSectorStatus::EMPTY :rsp.sectors.nFree++; break; - case CDos::TSectorStatus::SKIPPED : - case CDos::TSectorStatus::UNAVAILABLE:rsp.sectors.nInaccessible++; break; - case CDos::TSectorStatus::UNKNOWN :rsp.sectors.nUnknown++; break; + case TSectorStatus::SYSTEM :rsp.sectors.nSystem++; break; + case TSectorStatus::BAD :rsp.sectors.nBad++; break; + case TSectorStatus::OCCUPIED :rsp.sectors.nOccupied++; break; + case TSectorStatus::RESERVED :rsp.sectors.nReserved++; break; + case TSectorStatus::EMPTY :rsp.sectors.nFree++; break; + case TSectorStatus::SKIPPED : + case TSectorStatus::UNAVAILABLE:rsp.sectors.nInaccessible++; break; + case TSectorStatus::UNKNOWN :rsp.sectors.nUnknown++; break; #ifdef _DEBUG default: ASSERT(FALSE); // unknown Status #endif diff --git a/Main/src/ViewTrackMap.h b/Main/src/ViewTrackMap.h index ef4b326b..942f62d3 100644 --- a/Main/src/ViewTrackMap.h +++ b/Main/src/ViewTrackMap.h @@ -1,6 +1,17 @@ #ifndef TRACKMAPVIEW_H #define TRACKMAPVIEW_H + typedef enum TSectorStatus:BYTE{ + SYSTEM, // e.g. reserved for root Directory + UNAVAILABLE,// Sectors that are not included in FAT (e.g. beyond the FAT, or FAT Sector error) + SKIPPED, // e.g. deleted Files in TR-DOS + BAD, + OCCUPIED, + RESERVED, // e.g. zero-length File in MDOS, or File with error during importing + EMPTY, // reported as unallocated + UNKNOWN // any Sector whose ID doesn't match any ID from the standard format, e.g. ID={2,1,0,3} for an MDOS Sector + } *PSectorStatus; + #define TRACK_MAP_TAB_LABEL _T("Track map") #define TRACK_MAP_COLORS_COUNT 256 @@ -30,6 +41,7 @@ DATA_OK_ONLY=ID_TRACKMAP_DATA, DATA_ALL =ID_TRACKMAP_BAD_DATA } displayType; + HBRUSH statusBrushes[TSectorStatus::UNKNOWN+1]; HBRUSH rainbowBrushes[TRACK_MAP_COLORS_COUNT]; struct TTrackScanner sealed{ static UINT AFX_CDECL Thread(PVOID _pBackgroundAction);