mirror of
https://github.com/AppleWin/AppleWin.git
synced 2026-04-21 23:16:39 +00:00
Support 2nd Disk][ in slot-5, via command line: - -s5 diskii - -s5d1 \<imagefile\> - -s5d2 \<imagefile\> NB. there's currently no Configuration UI support, except the Drive icons' tooltips show what's in slot-5 & slot-6 (for drive-n). So there's no way to eject the disks or insert new disks. The use-case I'm supporting it Wasteland which just has the 4 disks in the 4 drives. Improved card management: - Added `class Card` (in Card.h) which all other cards (that exist as classes) derive from (eg. LC,SSC,Mouse,Disk2). - Added `class CardManager` (in CardManager.cpp\h) which now manages the 8 slots (and aux slot). - Added `class Disk2CardManager` (in Disk2CardManager.cpp\h) which provides methods for operations that act on all Disk2 instances at the same time. - Currently limited to just 1x SSC and 1x Mouse card (why would you need more?). This simplifies things, meaning there's no need to have dedicated SSCManager / MouseCardManager objects. - Currently the 2nd Disk2 card can only be put into slot-5. This limitation is just due to the complexity of the Configuration UI. Having a more general drop-down per slot UI would remove this limitation.
This commit is contained in:
@@ -24,6 +24,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "../Applewin.h"
|
||||
#include "../CardManager.h"
|
||||
#include "../Disk.h" // Drive_e, Disk_Status_e
|
||||
#include "../Frame.h"
|
||||
#include "../Registry.h"
|
||||
@@ -89,14 +90,14 @@ BOOL CPageDisk::DlgProcInternal(HWND hWnd, UINT message, WPARAM wparam, LPARAM l
|
||||
case IDC_COMBO_DISK1:
|
||||
if (HIWORD(wparam) == CBN_SELCHANGE)
|
||||
{
|
||||
HandleDiskCombo(hWnd, DRIVE_1, LOWORD(wparam));
|
||||
HandleFloppyDriveCombo(hWnd, DRIVE_1, LOWORD(wparam));
|
||||
FrameRefreshStatus(DRAW_BUTTON_DRIVES);
|
||||
}
|
||||
break;
|
||||
case IDC_COMBO_DISK2:
|
||||
if (HIWORD(wparam) == CBN_SELCHANGE)
|
||||
{
|
||||
HandleDiskCombo(hWnd, DRIVE_2, LOWORD(wparam));
|
||||
HandleFloppyDriveCombo(hWnd, DRIVE_2, LOWORD(wparam));
|
||||
FrameRefreshStatus(DRAW_BUTTON_DRIVES);
|
||||
}
|
||||
break;
|
||||
@@ -130,23 +131,12 @@ BOOL CPageDisk::DlgProcInternal(HWND hWnd, UINT message, WPARAM wparam, LPARAM l
|
||||
|
||||
case WM_INITDIALOG:
|
||||
{
|
||||
m_PropertySheetHelper.FillComboBox(hWnd, IDC_DISKTYPE, m_discchoices, sg_Disk2Card.GetEnhanceDisk() ? 1 : 0);
|
||||
m_PropertySheetHelper.FillComboBox(hWnd, IDC_COMBO_DISK1, m_defaultDiskOptions, -1);
|
||||
m_PropertySheetHelper.FillComboBox(hWnd, IDC_COMBO_DISK2, m_defaultDiskOptions, -1);
|
||||
m_PropertySheetHelper.FillComboBox(hWnd, IDC_DISKTYPE, m_discchoices, g_CardMgr.GetDisk2CardMgr().GetEnhanceDisk() ? 1 : 0);
|
||||
|
||||
if (!sg_Disk2Card.GetFullName(DRIVE_1).empty())
|
||||
{
|
||||
SendDlgItemMessage(hWnd, IDC_COMBO_DISK1, CB_INSERTSTRING, 0, (LPARAM)sg_Disk2Card.GetFullName(DRIVE_1).c_str());
|
||||
SendDlgItemMessage(hWnd, IDC_COMBO_DISK1, CB_SETCURSEL, 0, 0);
|
||||
}
|
||||
if (g_CardMgr.QuerySlot(SLOT6) == CT_Disk2)
|
||||
InitComboFloppyDrive(hWnd, SLOT6);
|
||||
|
||||
if (!sg_Disk2Card.GetFullName(DRIVE_2).empty())
|
||||
{
|
||||
SendDlgItemMessage(hWnd, IDC_COMBO_DISK2, CB_INSERTSTRING, 0, (LPARAM)sg_Disk2Card.GetFullName(DRIVE_2).c_str());
|
||||
SendDlgItemMessage(hWnd, IDC_COMBO_DISK2, CB_SETCURSEL, 0, 0);
|
||||
}
|
||||
|
||||
InitComboHDD(hWnd);
|
||||
InitComboHDD(hWnd, SLOT7);
|
||||
|
||||
TCHAR PathToCiderPress[MAX_PATH];
|
||||
RegLoadString(TEXT(REG_CONFIG), REGVALUE_CIDERPRESSLOC, 1, PathToCiderPress, MAX_PATH, TEXT(""));
|
||||
@@ -166,7 +156,27 @@ BOOL CPageDisk::DlgProcInternal(HWND hWnd, UINT message, WPARAM wparam, LPARAM l
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void CPageDisk::InitComboHDD(HWND hWnd)
|
||||
void CPageDisk::InitComboFloppyDrive(HWND hWnd, UINT slot)
|
||||
{
|
||||
Disk2InterfaceCard* pDisk2Card = dynamic_cast<Disk2InterfaceCard*>(g_CardMgr.GetObj(slot));
|
||||
|
||||
m_PropertySheetHelper.FillComboBox(hWnd, IDC_COMBO_DISK1, m_defaultDiskOptions, -1);
|
||||
m_PropertySheetHelper.FillComboBox(hWnd, IDC_COMBO_DISK2, m_defaultDiskOptions, -1);
|
||||
|
||||
if (!pDisk2Card->GetFullName(DRIVE_1).empty())
|
||||
{
|
||||
SendDlgItemMessage(hWnd, IDC_COMBO_DISK1, CB_INSERTSTRING, 0, (LPARAM)pDisk2Card->GetFullName(DRIVE_1).c_str());
|
||||
SendDlgItemMessage(hWnd, IDC_COMBO_DISK1, CB_SETCURSEL, 0, 0);
|
||||
}
|
||||
|
||||
if (!pDisk2Card->GetFullName(DRIVE_2).empty())
|
||||
{
|
||||
SendDlgItemMessage(hWnd, IDC_COMBO_DISK2, CB_INSERTSTRING, 0, (LPARAM)pDisk2Card->GetFullName(DRIVE_2).c_str());
|
||||
SendDlgItemMessage(hWnd, IDC_COMBO_DISK2, CB_SETCURSEL, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void CPageDisk::InitComboHDD(HWND hWnd, UINT /*slot*/)
|
||||
{
|
||||
m_PropertySheetHelper.FillComboBox(hWnd, IDC_COMBO_HDD1, m_defaultHDDOptions, -1);
|
||||
m_PropertySheetHelper.FillComboBox(hWnd, IDC_COMBO_HDD2, m_defaultHDDOptions, -1);
|
||||
@@ -187,9 +197,9 @@ void CPageDisk::InitComboHDD(HWND hWnd)
|
||||
void CPageDisk::DlgOK(HWND hWnd)
|
||||
{
|
||||
const bool bNewEnhanceDisk = SendDlgItemMessage(hWnd, IDC_DISKTYPE,CB_GETCURSEL, 0, 0) ? true : false;
|
||||
if (bNewEnhanceDisk != sg_Disk2Card.GetEnhanceDisk())
|
||||
if (bNewEnhanceDisk != g_CardMgr.GetDisk2CardMgr().GetEnhanceDisk())
|
||||
{
|
||||
sg_Disk2Card.SetEnhanceDisk(bNewEnhanceDisk);
|
||||
g_CardMgr.GetDisk2CardMgr().SetEnhanceDisk(bNewEnhanceDisk);
|
||||
REGSAVE(TEXT(REGVALUE_ENHANCE_DISK_SPEED), (DWORD)bNewEnhanceDisk);
|
||||
}
|
||||
|
||||
@@ -288,8 +298,12 @@ void CPageDisk::HandleHDDCombo(HWND hWnd, UINT driveSelected, UINT comboSelected
|
||||
}
|
||||
}
|
||||
|
||||
void CPageDisk::HandleDiskCombo(HWND hWnd, UINT driveSelected, UINT comboSelected)
|
||||
void CPageDisk::HandleFloppyDriveCombo(HWND hWnd, UINT driveSelected, UINT comboSelected)
|
||||
{
|
||||
Disk2InterfaceCard* pDisk2Card = (g_CardMgr.QuerySlot(SLOT6) == CT_Disk2)
|
||||
? dynamic_cast<Disk2InterfaceCard*>(g_CardMgr.GetObj(SLOT6))
|
||||
: NULL;
|
||||
|
||||
// Search from "select floppy drive"
|
||||
DWORD dwOpenDialogIndex = (DWORD)SendDlgItemMessage(hWnd, comboSelected, CB_FINDSTRINGEXACT, -1, (LPARAM)&m_defaultDiskOptions[0]);
|
||||
DWORD dwComboSelection = (DWORD)SendDlgItemMessage(hWnd, comboSelected, CB_GETCURSEL, 0, 0);
|
||||
@@ -299,7 +313,8 @@ void CPageDisk::HandleDiskCombo(HWND hWnd, UINT driveSelected, UINT comboSelecte
|
||||
if (dwComboSelection == dwOpenDialogIndex)
|
||||
{
|
||||
EnableDisk(hWnd, FALSE); // Prevent multiple Selection dialogs to be triggered
|
||||
bool bRes = sg_Disk2Card.UserSelectNewDiskImage(driveSelected);
|
||||
bool bRes = false;
|
||||
if (pDisk2Card) bRes = pDisk2Card->UserSelectNewDiskImage(driveSelected);
|
||||
EnableDisk(hWnd, TRUE);
|
||||
|
||||
if (!bRes)
|
||||
@@ -316,13 +331,15 @@ void CPageDisk::HandleDiskCombo(HWND hWnd, UINT driveSelected, UINT comboSelecte
|
||||
SendDlgItemMessage(hWnd, comboSelected, CB_DELETESTRING, 0, 0);
|
||||
}
|
||||
|
||||
SendDlgItemMessage(hWnd, comboSelected, CB_INSERTSTRING, 0, (LPARAM)sg_Disk2Card.GetFullName(driveSelected).c_str());
|
||||
std::string fullname;
|
||||
if (pDisk2Card) fullname = pDisk2Card->GetFullName(driveSelected);
|
||||
SendDlgItemMessage(hWnd, comboSelected, CB_INSERTSTRING, 0, (LPARAM)fullname.c_str());
|
||||
SendDlgItemMessage(hWnd, comboSelected, CB_SETCURSEL, 0, 0);
|
||||
|
||||
// If the FD was in the other combo, remove now
|
||||
DWORD comboOther = (comboSelected == IDC_COMBO_DISK1) ? IDC_COMBO_DISK2 : IDC_COMBO_DISK1;
|
||||
|
||||
DWORD duplicated = (DWORD)SendDlgItemMessage(hWnd, comboOther, CB_FINDSTRINGEXACT, -1, (LPARAM)sg_Disk2Card.GetFullName(driveSelected).c_str());
|
||||
DWORD duplicated = (DWORD)SendDlgItemMessage(hWnd, comboOther, CB_FINDSTRINGEXACT, -1, (LPARAM)fullname.c_str());
|
||||
if (duplicated != CB_ERR)
|
||||
{
|
||||
SendDlgItemMessage(hWnd, comboOther, CB_DELETESTRING, duplicated, 0);
|
||||
@@ -337,7 +354,7 @@ void CPageDisk::HandleDiskCombo(HWND hWnd, UINT driveSelected, UINT comboSelecte
|
||||
if (RemovalConfirmation(uCommand))
|
||||
{
|
||||
// Eject selected disk
|
||||
sg_Disk2Card.EjectDisk(driveSelected);
|
||||
if (pDisk2Card) pDisk2Card->EjectDisk(driveSelected);
|
||||
// Remove drive from list
|
||||
SendDlgItemMessage(hWnd, comboSelected, CB_DELETESTRING, 0, 0);
|
||||
}
|
||||
@@ -357,7 +374,7 @@ void CPageDisk::HandleHDDSwap(HWND hWnd)
|
||||
if (!HD_ImageSwap())
|
||||
return;
|
||||
|
||||
InitComboHDD(hWnd);
|
||||
InitComboHDD(hWnd, SLOT7);
|
||||
}
|
||||
|
||||
UINT CPageDisk::RemovalConfirmation(UINT uCommand)
|
||||
|
||||
Reference in New Issue
Block a user