Skip to content

Commit

Permalink
[#64] Internal FDD improvements and bugfixes (Part 2: Added a warning…
Browse files Browse the repository at this point in the history
… triangle next to non-determined latencies)
  • Loading branch information
tomas-nestorovic committed May 29, 2021
1 parent 63ec96d commit c915ff0
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 6 deletions.
4 changes: 3 additions & 1 deletion Main/res/resource.rc
Original file line number Diff line number Diff line change
Expand Up @@ -1343,8 +1343,10 @@ BEGIN
LTEXT "&Gap 3:",IDC_STATIC,71,105,22,8
EDITTEXT ID_GAP,110,103,35,12,ES_AUTOHSCROLL | NOT WS_BORDER,
WS_EX_STATICEDGE
LTEXT "W",ID_INSTRUCTION,156,89,17,16,NOT WS_VISIBLE | NOT
WS_GROUP
CONTROL "<a id=""ID_AUTO"">Autodetermine</a>",ID_AUTO,"SysLink",
0x0,156,89,45,11
0x0,156,89,62,11
LTEXT "Calibrate head:",IDC_STATIC,7,124,48,8,NOT WS_GROUP
CONTROL "Never",ID_NONE,"Button",BS_AUTORADIOBUTTON | WS_GROUP,
70,124,74,10
Expand Down
19 changes: 15 additions & 4 deletions Main/src/FDD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -465,8 +465,8 @@ Utils::Information("--- EVERYTHING OK ---");
::wsprintf( buf, INI_FDD _T("_%c_%d"), driveLetter, floppyType );
}

void CFDD::TFddHead::TProfile::Load(TCHAR driveLetter,Medium::TType floppyType,TLogTime defaultNanosecondsPerByte){
// loads the Profile for specified Drive and FloppyType
bool CFDD::TFddHead::TProfile::Load(TCHAR driveLetter,Medium::TType floppyType,TLogTime defaultNanosecondsPerByte){
// True <=> explicit Profile for specified Drive/FloppyType exists and loaded, otherwise False
TCHAR iniSection[16];
GetFddProfileName( iniSection, driveLetter, floppyType );
switch (floppyType){
Expand All @@ -486,6 +486,7 @@ Utils::Information("--- EVERYTHING OK ---");
}
oneByteLatency=app.GetProfileInt( iniSection, INI_LATENCY_1BYTE, defaultNanosecondsPerByte );
gap3Latency=app.GetProfileInt( iniSection, INI_LATENCY_GAP3, oneByteLatency*FDD_350_SECTOR_GAP3*4/5 ); // "4/5" = giving the FDC 20% tolerance for Gap3
return app.GetProfileInt( iniSection, INI_LATENCY_CONTROLLER, -1 )>0; // True <=> previously determined values used, otherwise False
}

void CFDD::TFddHead::TProfile::Save(TCHAR driveLetter,Medium::TType floppyType) const{
Expand Down Expand Up @@ -1554,7 +1555,13 @@ Utils::Information(buf);}
EnableDlgItem( ID_40D80, initialEditing );
}
// . loading the Profile associated with the current drive and FloppyType
profile.Load( fdd->GetDriveLetter(), fdd->floppyType, fdd->EstimateNanosecondsPerOneByte() );
const RECT rcWarning=MapDlgItemClientRect(ID_INSTRUCTION);
RECT rcMessage=MapDlgItemClientRect(ID_AUTO);
if (ShowDlgItem( ID_INSTRUCTION, !profile.Load( fdd->GetDriveLetter(), fdd->floppyType, fdd->EstimateNanosecondsPerOneByte() ) ))
rcMessage.left=rcWarning.right;
else
rcMessage.left=rcWarning.left;
SetDlgItemPos( ID_AUTO, rcMessage );
__exchangeLatency__( &CDataExchange(this,FALSE) );
// . forcing redrawing (as the new text may be shorter than the original text, leaving the original partly visible)
GetDlgItem(ID_MEDIUM)->Invalidate();
Expand All @@ -1575,6 +1582,10 @@ Utils::Information(buf);}
ID_INFORMATION,
L'\xf0ea', (HFONT)Utils::CRideFont(FONT_WEBDINGS,175,false,true).Detach()
);
SetDlgItemSingleCharUsingFont( // a warning that pre-compensation not up-to-date
ID_INSTRUCTION,
L'\xf0ea', (HFONT)Utils::CRideFont(FONT_WEBDINGS,175,false,true).Detach()
);
__refreshMediumInformation__();
}
void __exchangeLatency__(CDataExchange* pDX){
Expand Down Expand Up @@ -1672,7 +1683,7 @@ Utils::Information(buf);}
// . showing the Dialog and processing its result
if (d.DoModal()==IDOK){
__informationWithCheckableShowNoMore__( _T("Windows is NOT a real-time system! Computed latency will be valid only if using the floppy drive in very similar conditions as when they were computed (current conditions)!"), INI_MSG_LATENCY );
if (Utils::InformationOkCancel(_T("Insert an empty disk and hit OK."))){
if (Utils::InformationOkCancel(_T("Insert an empty disk that you don't mind writing to, and hit OK."))){
// : composing a parallel multi-action
CBackgroundMultiActionCancelable bmac( THREAD_PRIORITY_TIME_CRITICAL );
Medium::TType floppyType=Medium::UNKNOWN;
Expand Down
2 changes: 1 addition & 1 deletion Main/src/FDD.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@

TProfile();

void Load(TCHAR driveLetter,Medium::TType floppyType,TLogTime defaultNanosecondsPerByte);
bool Load(TCHAR driveLetter,Medium::TType floppyType,TLogTime defaultNanosecondsPerByte);
void Save(TCHAR driveLetter,Medium::TType floppyType) const;
} profile;

Expand Down

0 comments on commit c915ff0

Please sign in to comment.