Skip to content

Commit

Permalink
[#69] GDOS: Minor bugfixes and improvements (Part 1: MGT container is…
Browse files Browse the repository at this point in the history
… a CRawImage organized by cylinders, not requiring its own class)
  • Loading branch information
tomas-nestorovic committed Aug 26, 2021
1 parent 9e9a3bf commit 1802cae
Show file tree
Hide file tree
Showing 9 changed files with 44 additions and 60 deletions.
2 changes: 0 additions & 2 deletions Main/Main.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,6 @@
<ClInclude Include="src\ImageFloppy.h" />
<ClInclude Include="src\ImageRaw.h" />
<ClInclude Include="src\MDOS2.h" />
<ClInclude Include="src\MGT.h" />
<ClInclude Include="src\MSDOS7.h" />
<ClInclude Include="src\OptionalLibAPIs.h" />
<ClInclude Include="src\SCL.h" />
Expand Down Expand Up @@ -297,7 +296,6 @@
<ClCompile Include="src\MDOS2_Boot.cpp" />
<ClCompile Include="src\MDOS2_GKFM.cpp" />
<ClCompile Include="src\MDOS2_FileManager.cpp" />
<ClCompile Include="src\MGT.cpp" />
<ClCompile Include="src\MSDOS7.cpp" />
<ClCompile Include="src\MSDOS7_Boot.cpp" />
<ClCompile Include="src\MSDOS7_FAT.cpp" />
Expand Down
18 changes: 18 additions & 0 deletions Main/src/GDOS.h
Original file line number Diff line number Diff line change
Expand Up @@ -197,4 +197,22 @@
bool UpdateCommandUi(WORD cmd,CCmdUI *pCmdUI) const override;
};




namespace MGT{
LPCTSTR Recognize(PTCHAR);
PImage Instantiate(LPCTSTR);

static constexpr CImage::TProperties Properties={
MAKE_IMAGE_ID('G','D','O','S','_','M','G','T'), // a unique identifier
Recognize, // list of recognized device names
Instantiate,// instantiation function
_T("*.mgt"), // filter
Medium::FLOPPY_DD_ANY, // supported Media
Codec::MFM, // supported Codecs
GDOS_SECTOR_LENGTH_STD, GDOS_SECTOR_LENGTH_STD // Sector supported min and max length
};
}

#endif // GDOS
20 changes: 19 additions & 1 deletion Main/src/GDOS_Boot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
__recognizeDisk__, // recognition function
__instantiate__, // instantiation function
Medium::FLOPPY_DD_ANY,
&CMGT::Properties, // the most common Image to contain data for this DOS (e.g. *.D80 Image for MDOS)
&MGT::Properties, // the most common Image to contain data for this DOS (e.g. *.D80 Image for MDOS)
1, // number of std Formats
StdFormats, // std Formats
Codec::MFM, // a set of Codecs this DOS supports
Expand Down Expand Up @@ -92,3 +92,21 @@
// - empty Directory
//nop (DirectoryEntry set as Empty during formatting - FillerByte happens to have the same value)
}









namespace MGT{
LPCTSTR Recognize(PTCHAR){
static constexpr TCHAR SingleDeviceName[]=_T("MGT image\0");
return SingleDeviceName;
}
PImage Instantiate(LPCTSTR){
return new CImageRaw( &Properties, false );
}
}
2 changes: 1 addition & 1 deletion Main/src/Image.h
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,6 @@
friend class CTrackMapView;
friend class CFileManagerView;

const bool hasEditableSettings;
bool writeProtected;

void Dump() const;
Expand Down Expand Up @@ -630,6 +629,7 @@
static UINT AFX_CDECL SaveAllModifiedTracks_thread(PVOID _pCancelableAction);

const PCProperties properties;
const bool hasEditableSettings;
CMainWindow::CDockableToolBar toolbar;
PDos dos;

Expand Down
6 changes: 5 additions & 1 deletion Main/src/ImageRaw.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#include "stdafx.h"
#include "GDOS.h"

static LPCTSTR Recognize(PTCHAR){
static constexpr TCHAR SingleDeviceName[]=_T("Raw data image\0");
Expand Down Expand Up @@ -326,11 +325,13 @@
if (explicitSides)
return ERROR_SUCCESS;
// - choosing a proper TrackAccessScheme based on commonly known restrictions on emulation
/*
if (dos) // may not exist if creating a new Image
if (dos->properties==&CGDOS::Properties)
trackAccessScheme=TTrackScheme::BY_SIDES;
else
trackAccessScheme=TTrackScheme::BY_CYLINDERS;
*/
// - setting up Medium's Type and geometry
return __setMediumTypeAndGeometry__(pFormat,sideMap,firstSectorNumber);
}
Expand All @@ -341,6 +342,9 @@
bool CImageRaw::EditSettings(bool initialEditing){
// True <=> new settings have been accepted (and adopted by this Image), otherwise False
EXCLUSIVELY_LOCK_THIS_IMAGE();
// - if no editable settings, we are done
if (!hasEditableSettings)
return true;
// - defining the Dialog
class CSettingsDialog sealed:public Utils::CRideDialog{
const bool initialEditing;
Expand Down
40 changes: 0 additions & 40 deletions Main/src/MGT.cpp

This file was deleted.

13 changes: 0 additions & 13 deletions Main/src/MGT.h

This file was deleted.

2 changes: 1 addition & 1 deletion Main/src/editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@
CImage::Known.AddTail( &CIpf::Properties );
CImage::Known.AddTail( &CKryoFluxStreams::Properties );
CImage::Known.AddTail( &MBD::Properties );
CImage::Known.AddTail( &CMGT::Properties );
CImage::Known.AddTail( &MGT::Properties );
CImage::Known.AddTail( &CImageRaw::Properties );
CImage::Known.AddTail( &CSCL::Properties );
CImage::Known.AddTail( &TRD::Properties );
Expand Down
1 change: 0 additions & 1 deletion Main/src/stdafx.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,6 @@ struct TLogTimeInterval{
#include "DialogVerification.h"
#include "ImageFloppy.h"
#include "ImageRaw.h"
#include "MGT.h"
#include "Dsk5.h"
#include "FDD.h"
#include "Dos.h"
Expand Down

0 comments on commit 1802cae

Please sign in to comment.