From c915ff097e1d5773e822276e6da48c8cd2c1ec84 Mon Sep 17 00:00:00 2001 From: tomascz Date: Sat, 29 May 2021 12:38:52 +0100 Subject: [PATCH] [#64] Internal FDD improvements and bugfixes (Part 2: Added a warning triangle next to non-determined latencies) --- Main/res/resource.rc | 4 +++- Main/src/FDD.cpp | 19 +++++++++++++++---- Main/src/FDD.h | 2 +- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/Main/res/resource.rc b/Main/res/resource.rc index da21e14b..f8d9b5fc 100644 --- a/Main/res/resource.rc +++ b/Main/res/resource.rc @@ -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 "Autodetermine",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 diff --git a/Main/src/FDD.cpp b/Main/src/FDD.cpp index 64fe02fd..39e69380 100644 --- a/Main/src/FDD.cpp +++ b/Main/src/FDD.cpp @@ -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){ @@ -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{ @@ -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(); @@ -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){ @@ -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; diff --git a/Main/src/FDD.h b/Main/src/FDD.h index 2de2f2a8..c01e540a 100644 --- a/Main/src/FDD.h +++ b/Main/src/FDD.h @@ -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;