Skip to content

Commit

Permalink
[#57] Support for KryoFlux and associated images (Part 5: CT RAW imag…
Browse files Browse the repository at this point in the history
…es, read-only at the moment)
  • Loading branch information
tomas-nestorovic committed Oct 30, 2020
1 parent 63f21ab commit 4a6069e
Show file tree
Hide file tree
Showing 5 changed files with 94 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Main/Main.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@
<ClInclude Include="src\BackgroundAction.h" />
<ClInclude Include="src\BSDOS.h" />
<ClInclude Include="src\CapsBase.h" />
<ClInclude Include="src\CtRaw.h" />
<ClInclude Include="src\Debug.h" />
<ClInclude Include="src\DialogEmptySpaceFilling.h" />
<ClInclude Include="src\DialogFormatting.h" />
Expand Down Expand Up @@ -242,6 +243,7 @@
<ClCompile Include="src\BSDOS_FAT.cpp" />
<ClCompile Include="src\BSDOS_FileManager.cpp" />
<ClCompile Include="src\CapsBase.cpp" />
<ClCompile Include="src\CtRaw.cpp" />
<ClCompile Include="src\Debug.cpp" />
<ClCompile Include="src\DialogRealDeviceSelection.cpp" />
<ClCompile Include="src\DialogVerification.cpp" />
Expand Down
6 changes: 6 additions & 0 deletions Main/Main.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,9 @@
<ClInclude Include="src\CapsBase.h">
<Filter>Header Files\Image</Filter>
</ClInclude>
<ClInclude Include="src\CtRaw.h">
<Filter>Header Files\Image</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="src\editor.cpp">
Expand Down Expand Up @@ -413,6 +416,9 @@
<ClCompile Include="src\CapsBase.cpp">
<Filter>Source Files\Image</Filter>
</ClCompile>
<ClCompile Include="src\CtRaw.cpp">
<Filter>Source Files\Image</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="res\resource.rc">
Expand Down
60 changes: 60 additions & 0 deletions Main/src/CtRaw.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#include "stdafx.h"
#include "CapsBase.h"
#include "CtRaw.h"

static LPCTSTR Recognize(PTCHAR){
static const char SingleDeviceName[]=_T("CT Raw\0");
return SingleDeviceName;
}
static PImage Instantiate(LPCTSTR){
return new CCtRaw;
}
const CImage::TProperties CCtRaw::Properties={
MAKE_IMAGE_ID('C','A','P','S','_','R','A','W'), // a unique identifier
Recognize, // list of recognized device names
Instantiate, // instantiation function
_T("*.raw"), // filter
TMedium::FLOPPY_ANY, // supported Media
1,2*6144 // Sector supported min and max length
};







#define INI_CTRAW _T("CtRaw")

CCtRaw::CCtRaw()
// ctor
// - base
: CCapsBase(&Properties,true) {
canBeModified=false; // modifications not possible at the moment
}






BOOL CCtRaw::OnSaveDocument(LPCTSTR lpszPathName){
// True <=> this Image has been successfully saved, otherwise False
::SetLastError(ERROR_NOT_SUPPORTED);
return FALSE;
}

TStdWinError CCtRaw::MarkSectorAsDirty(RCPhysicalAddress chs,BYTE nSectorsToSkip,PCFdcStatus pFdcStatus){
// marks Sector on a given PhysicalAddress as "dirty", plus sets it the given FdcStatus; returns Windows standard i/o error
return ERROR_NOT_SUPPORTED;
}

TStdWinError CCtRaw::FormatTrack(TCylinder cyl,THead head,TSector nSectors,PCSectorId bufferId,PCWORD bufferLength,PCFdcStatus bufferFdcStatus,BYTE gap3,BYTE fillerByte){
// formats given Track {Cylinder,Head} to the requested NumberOfSectors, each with corresponding Length and FillerByte as initial content; returns Windows standard i/o error
return ERROR_NOT_SUPPORTED;
}

TStdWinError CCtRaw::UnformatTrack(TCylinder cyl,THead head){
// unformats given Track {Cylinder,Head}; returns Windows standard i/o error
return ERROR_NOT_SUPPORTED;
}
24 changes: 24 additions & 0 deletions Main/src/CtRaw.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#ifndef CTRAW_H
#define CTRAW_H

class CCtRaw sealed:public CCapsBase{
public:
static const TProperties Properties;

CCtRaw();

//BOOL OnOpenDocument(LPCTSTR lpszPathName) override;
BOOL OnSaveDocument(LPCTSTR lpszPathName) override;
//TCylinder GetCylinderCount() const override;
//THead GetNumberOfFormattedSides(TCylinder cyl) const override;
//TSector ScanTrack(TCylinder cyl,THead head,PSectorId bufferId=nullptr,PWORD bufferLength=nullptr,PINT startTimesNanoseconds=nullptr,PBYTE pAvgGap3=nullptr) const override;
//void GetTrackData(TCylinder cyl,THead head,PCSectorId bufferId,PCBYTE bufferNumbersOfSectorsToSkip,TSector nSectors,bool silentlyRecoverFromErrors,PSectorData *outBufferData,PWORD outBufferLengths,TFdcStatus *outFdcStatuses) override;
TStdWinError MarkSectorAsDirty(RCPhysicalAddress chs,BYTE nSectorsToSkip,PCFdcStatus pFdcStatus) override;
//TStdWinError SetMediumTypeAndGeometry(PCFormat pFormat,PCSide sideMap,TSector firstSectorNumber) override;
//void EditSettings() override;
//TStdWinError Reset() override;
TStdWinError FormatTrack(TCylinder cyl,THead head,TSector nSectors,PCSectorId bufferId,PCWORD bufferLength,PCFdcStatus bufferFdcStatus,BYTE gap3,BYTE fillerByte) override;
TStdWinError UnformatTrack(TCylinder cyl,THead head) override;
};

#endif // CTRAW_H
2 changes: 2 additions & 0 deletions Main/src/editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include "BSDOS.h"
#include "CapsBase.h"
#include "IPF.h"
#include "CtRaw.h"

CRideApp::CRecentFileListEx::CRecentFileListEx(const CRecentFileList &rStdMru)
// ctor
Expand Down Expand Up @@ -174,6 +175,7 @@
cfPerformedDropEffect=::RegisterClipboardFormat(CFSTR_PERFORMEDDROPEFFECT);
cfPasteSucceeded=::RegisterClipboardFormat(CFSTR_PASTESUCCEEDED);
// - registering recognizable Image types and known DOSes (in alphabetical order)
CImage::known.AddTail( (PVOID)&CCtRaw::Properties );
CImage::known.AddTail( (PVOID)&D80::Properties );
CImage::known.AddTail( (PVOID)&CDsk5::Properties );
CImage::known.AddTail( (PVOID)&CIpf::Properties );
Expand Down

0 comments on commit 4a6069e

Please sign in to comment.