Skip to content

Commit

Permalink
[#57] Support for KryoFlux and associated images (Part 189: Improved …
Browse files Browse the repository at this point in the history
…retrieval of internal track representations)
  • Loading branch information
tomas-nestorovic committed Dec 19, 2023
1 parent 078b7ee commit 6928429
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 7 deletions.
6 changes: 2 additions & 4 deletions Main/src/CapsBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -636,9 +636,7 @@
bool CCapsBase::IsTrackScanned(TCylinder cyl,THead head) const{
// True <=> Track exists and has already been scanned, otherwise False
EXCLUSIVELY_LOCK_THIS_IMAGE();
return cyl<FDD_CYLINDERS_MAX && head<2
&&
internalTracks[cyl][head]!=nullptr;
return GetInternalTrackSafe(cyl,head)!=nullptr;
}

TStdWinError CCapsBase::UnscanTrack(TCylinder cyl,THead head){
Expand Down Expand Up @@ -755,7 +753,7 @@

Revolution::TType CCapsBase::GetDirtyRevolution(RCPhysicalAddress chs,BYTE nSectorsToSkip) const{
// returns the Revolution that has been marked as "dirty"
if (const PCInternalTrack pit=internalTracks[chs.cylinder][chs.head]){
if (const PCInternalTrack pit=GetInternalTrackSafe(chs.cylinder,chs.head)){
while (nSectorsToSkip<pit->nSectors){
const auto &ris=pit->sectors[nSectorsToSkip++];
if (ris.id==chs.sectorId)
Expand Down
1 change: 1 addition & 0 deletions Main/src/CapsBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@
virtual TStdWinError UploadFirmware();
virtual TStdWinError UploadTrack(TCylinder cyl,THead head,CTrackReader tr) const;
void WarnOnAndCorrectExceedingCylinders();
PInternalTrack GetInternalTrackSafe(TCylinder cyl,THead head) const;
void DestroyAllTracks();
TStdWinError VerifyTrack(TCylinder cyl,THead head,const CTrackReaderWriter &trwWritten,bool showDiff,std::unique_ptr<CTrackReaderWriter> *ppOutReadTrack,const volatile bool &cancelled) const;
TStdWinError DetermineMagneticReliabilityByWriting(Medium::TType floppyType,TCylinder cyl,THead head,const volatile bool &cancelled) const;
Expand Down
4 changes: 2 additions & 2 deletions Main/src/SCP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ formatError: ::SetLastError(ERROR_BAD_FORMAT);
return TRUE;
}

CCapsBase::PInternalTrack CSCP::GetInternalTrackSafe(TCylinder cyl,THead head) const{
return cyl<FDD_CYLINDERS_MAX
CCapsBase::PInternalTrack CCapsBase::GetInternalTrackSafe(TCylinder cyl,THead head) const{
return cyl<FDD_CYLINDERS_MAX && head<2
? internalTracks[cyl][head]
: nullptr; // Cylinders beyond FDD_CYLINDERS_MAX are inaccessible
}
Expand Down
1 change: 0 additions & 1 deletion Main/src/SCP.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

DWORD tdhOffsets[84][2]; // Track Data Header offsets

PInternalTrack GetInternalTrackSafe(TCylinder cyl,THead head) const;
TStdWinError SaveAllModifiedTracks(LPCTSTR lpszPathName,CActionProgress &ap) override;
public:
static const TProperties Properties;
Expand Down

0 comments on commit 6928429

Please sign in to comment.