Add (debug) cmd line switch: -hdc-firmware-v1 (#1277)

. use this to force all attached HDCs to use the old v1 firmware
This commit is contained in:
tomcw 2024-03-02 21:16:28 +00:00
parent 25ce998c9a
commit 9c1304686c
6 changed files with 26 additions and 3 deletions

View File

@ -226,5 +226,11 @@
<br><br> <br><br>
-screenshot-and-exit<br> -screenshot-and-exit<br>
For testing. Use in combination with -load-state.<br><br> For testing. Use in combination with -load-state.<br><br>
-hdc-firmware-v1<br>
Force all attached hard disk controllers to use the old v1 firmware (as per pre-AppleWin 1.30.17).
<ul>
<li>NB. Switch likely to be removed after a few releases.</li>
</ul>
<br><br>
</body> </body>
</html> </html>

View File

@ -253,10 +253,14 @@ bool ProcessCmdLine(LPSTR lpCmdLine)
lpNextArg = GetNextArg(lpNextArg); lpNextArg = GetNextArg(lpNextArg);
g_cmdLine.uHarddiskNumBlocks = atoi(lpCmdLine); g_cmdLine.uHarddiskNumBlocks = atoi(lpCmdLine);
if (g_cmdLine.uHarddiskNumBlocks > kHarddiskMaxNumBlocks) if (g_cmdLine.uHarddiskNumBlocks > kHarddiskMaxNumBlocks)
{
g_cmdLine.uHarddiskNumBlocks = kHarddiskMaxNumBlocks; g_cmdLine.uHarddiskNumBlocks = kHarddiskMaxNumBlocks;
}
else else
{
if (g_cmdLine.uHarddiskNumBlocks < 0) if (g_cmdLine.uHarddiskNumBlocks < 0)
g_cmdLine.uHarddiskNumBlocks = 0; g_cmdLine.uHarddiskNumBlocks = 0;
}
} }
else if (strcmp(lpCmdLine, "-load-state") == 0) else if (strcmp(lpCmdLine, "-load-state") == 0)
{ {
@ -627,10 +631,14 @@ bool ProcessCmdLine(LPSTR lpCmdLine)
{ {
g_cmdLine.supportExtraMBCardTypes = true; g_cmdLine.supportExtraMBCardTypes = true;
} }
else if (strcmp(lpCmdLine, "-no-disk2-stepper-defer") == 0) // a debug switch (likely to be removed in a future version) else if (strcmp(lpCmdLine, "-no-disk2-stepper-defer") == 0) // a debug switch added at 1.30.11 / GH#1110 (likely to be removed in a future version)
{ {
g_cmdLine.noDisk2StepperDefer = true; g_cmdLine.noDisk2StepperDefer = true;
} }
else if (strcmp(lpCmdLine, "-hdc-firmware-v1") == 0) // a debug switch added at 1.30.18 / GH#1277 (likely to be removed in a future version)
{
g_cmdLine.useHdcFirmwareV1 = true;
}
else // unsupported else // unsupported
{ {
LogFileOutput("Unsupported arg: %s\n", lpCmdLine); LogFileOutput("Unsupported arg: %s\n", lpCmdLine);

View File

@ -34,6 +34,7 @@ struct CmdLine
enableDumpToRealPrinter = false; enableDumpToRealPrinter = false;
supportExtraMBCardTypes = false; supportExtraMBCardTypes = false;
noDisk2StepperDefer = false; noDisk2StepperDefer = false;
useHdcFirmwareV1 = false;
szSnapshotName = NULL; szSnapshotName = NULL;
szScreenshotFilename = NULL; szScreenshotFilename = NULL;
uHarddiskNumBlocks = 0; uHarddiskNumBlocks = 0;
@ -78,6 +79,7 @@ struct CmdLine
bool enableDumpToRealPrinter; bool enableDumpToRealPrinter;
bool supportExtraMBCardTypes; bool supportExtraMBCardTypes;
bool noDisk2StepperDefer; // debug bool noDisk2StepperDefer; // debug
bool useHdcFirmwareV1; // debug
SS_CARDTYPE slotInsert[NUM_SLOTS]; SS_CARDTYPE slotInsert[NUM_SLOTS];
SlotInfo slotInfo[NUM_SLOTS]; SlotInfo slotInfo[NUM_SLOTS];
LPCSTR szImageName_drive[NUM_SLOTS][NUM_DRIVES]; LPCSTR szImageName_drive[NUM_SLOTS][NUM_DRIVES];

View File

@ -131,7 +131,7 @@ Overview
HarddiskInterfaceCard::HarddiskInterfaceCard(UINT slot) : HarddiskInterfaceCard::HarddiskInterfaceCard(UINT slot) :
Card(CT_GenericHDD, slot) Card(CT_GenericHDD, slot), m_userNumBlocks(0), m_useHdcFirmwareV1(false)
{ {
if (m_slot != SLOT5 && m_slot != SLOT7) // fixme if (m_slot != SLOT5 && m_slot != SLOT7) // fixme
ThrowErrorInvalidSlot(); ThrowErrorInvalidSlot();
@ -166,7 +166,8 @@ void HarddiskInterfaceCard::InitializeIO(LPBYTE pCxRomPeripheral)
{ {
const DWORD HARDDISK_FW_SIZE = APPLE_SLOT_SIZE; const DWORD HARDDISK_FW_SIZE = APPLE_SLOT_SIZE;
BYTE* pData = GetFrame().GetResource(IDR_HDDRVR_V2_FW, "FIRMWARE", HARDDISK_FW_SIZE); const WORD id = m_useHdcFirmwareV1 ? IDR_HDDRVR_FW : IDR_HDDRVR_V2_FW;
BYTE* pData = GetFrame().GetResource(id, "FIRMWARE", HARDDISK_FW_SIZE);
if (pData == NULL) if (pData == NULL)
return; return;

View File

@ -101,6 +101,7 @@ public:
bool IsDriveUnplugged(const int iDrive); bool IsDriveUnplugged(const int iDrive);
void LoadLastDiskImage(const int iDrive); void LoadLastDiskImage(const int iDrive);
void SetUserNumBlocks(UINT numBlocks) { m_userNumBlocks = numBlocks; } void SetUserNumBlocks(UINT numBlocks) { m_userNumBlocks = numBlocks; }
void UseHdcFirmwareV1(void) { m_useHdcFirmwareV1 = true; }
void GetLightStatus(Disk_Status_e* pDisk1Status); void GetLightStatus(Disk_Status_e* pDisk1Status);
bool ImageSwap(void); bool ImageSwap(void);
@ -130,6 +131,7 @@ private:
BYTE m_command; BYTE m_command;
UINT64 m_notBusyCycle; UINT64 m_notBusyCycle;
UINT m_userNumBlocks; UINT m_userNumBlocks;
bool m_useHdcFirmwareV1;
bool m_saveDiskImage; // Save the DiskImage name to Registry bool m_saveDiskImage; // Save the DiskImage name to Registry

View File

@ -803,7 +803,11 @@ static void RepeatInitialization(void)
if (GetCardMgr().QuerySlot(i) == CT_Disk2 && g_cmdLine.slotInfo[i].isDiskII13) if (GetCardMgr().QuerySlot(i) == CT_Disk2 && g_cmdLine.slotInfo[i].isDiskII13)
dynamic_cast<Disk2InterfaceCard&>(GetCardMgr().GetRef(i)).SetFirmware13Sector(); dynamic_cast<Disk2InterfaceCard&>(GetCardMgr().GetRef(i)).SetFirmware13Sector();
if (GetCardMgr().QuerySlot(i) == CT_GenericHDD) if (GetCardMgr().QuerySlot(i) == CT_GenericHDD)
{
dynamic_cast<HarddiskInterfaceCard&>(GetCardMgr().GetRef(i)).SetUserNumBlocks(g_cmdLine.uHarddiskNumBlocks); dynamic_cast<HarddiskInterfaceCard&>(GetCardMgr().GetRef(i)).SetUserNumBlocks(g_cmdLine.uHarddiskNumBlocks);
if (g_cmdLine.useHdcFirmwareV1)
dynamic_cast<HarddiskInterfaceCard&>(GetCardMgr().GetRef(i)).UseHdcFirmwareV1();
}
} }
// Create window after inserting/removing VidHD card (as it affects width & height) // Create window after inserting/removing VidHD card (as it affects width & height)