Config GUI for DiskII card in slot-5 & improved slot config in Registry (#975, #977, PR #978)

Change to using Registry's 'Configuration\Slot n' for disk ii image pathnames (was 'Preferences').
Delete Registry's 'Configuration\Slot n' section each time there's a change of card.
Add same functionality to conf.ini.
LoadConfiguration(): load from the new Slot-n section (or otherwise the old legacy key).
Only update Registry's 'Starting Directory' for s6,d1.
Update help doc.
This commit is contained in:
TomCh 2021-08-29 11:39:51 +01:00 committed by GitHub
parent 1b4f15ae50
commit 7b55e994ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 272 additions and 131 deletions

View File

@ -9,26 +9,35 @@
<hr size="4"><img style="width: 344px; height: 460px; float: right;" src="img/disk.png" alt="Disk settings" hspace="5" vspace="5">
<h3>Floppy Controller Settings:</h3>
<p><strong>Disk Access Speed:</strong><br>
<p><strong>Enhanced disk access speed:</strong><br>
Here you can choose the speed at which the system can access
an emulated floppy disk drive.
By default, you would want "Enhanced Speed" so that data can
be accessed as fast as possible. However, it is also possible that
certain programs might depend on the "Authentic Speed" to function
properly. This is the speed at which the real hardware
would&nbsp;access data from your drives.
would access data from your drives.
</p>
<p><strong>Disk 1/2 drop-down menus:</strong><br>
These menus allow you to select floppy disk images (.dsk files) to
'insert' into the
<p><strong>Disk 1/2 drop-down menus (slot 6):</strong><br>
These menus allow you to select floppy disk images to 'insert' into the
emulated floppy drives 1 and 2. This can also be done during emulation by <a href="toolbar.html">using the toolbar</a> or using the F3/F4 keys. Diskettes can be swapped by pressing F5 during emulation. You can also eject images from this menu.
</p>
<p><strong>Enable Disk II controller in slot 5:</strong><br>
A floppy controller card can be plugged into slot 5 by checking this box.
</p>
<p><strong>Disk 1/2 drop-down menus (slot 5):</strong><br>
You can select floppy disk images to 'insert' into the
emulated floppy drives 1 and 2.
</p>
<br>
<h3>Hard disk Controller Settings:</h3>
<p><strong>Enable hard disk controller in slot 7:</strong><br>
A hard disk controller (or interface) card can be plugged in to slot 7 by checking this box.
A hard disk controller (or interface) card can be plugged into slot 7 by checking this box.
See <a href="ddi-harddisk.html">Hard disk Images</a> for more details.
</p>
@ -41,8 +50,10 @@ WARNING! If done during image access this could result in undefined behavior (eg
These menus allow you to select hard disk images (eg. .hdv files) to
connect to the emulated hard disk controller card. You can also unplug images from this menu.
</p>
<br>
<p><strong>Path to CiderPress:</strong><br>
<p><strong>CiderPress path:</strong><br>
Use this to specify where CiderPress is installed.<br>
The right mouse button context menu on either of the drive icons allows you to open CiderPress with the image in the drive.
</p>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 32 KiB

View File

@ -173,23 +173,31 @@ STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_VISIBLE | WS_DISABLED | WS_CAPTIO
CAPTION "Disk"
FONT 8, "MS Shell Dlg", 0, 0, 0x0
BEGIN
GROUPBOX "Floppy Disk Drives",IDC_STATIC,5,7,200,72
LTEXT "&Disk access speed:",IDC_STATIC,12,21,64,8
COMBOBOX IDC_DISKTYPE,80,18,100,100,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "Disk 1:",IDC_STATIC,10,41,23,8
LTEXT "Disk 2:",IDC_STATIC,10,58,23,8
COMBOBOX IDC_COMBO_DISK1,40,40,150,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_COMBO_DISK2,40,57,150,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
GROUPBOX "Hard Disk Drives",IDC_STATIC,5,83,200,64
CONTROL "&Enable hard disk controller in slot 7",IDC_HDD_ENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,96,122,10
PUSHBUTTON "Swap",IDC_HDD_SWAP,156,92,40,14
LTEXT "HDD 1:",IDC_STATIC,11,113,23,8
LTEXT "HDD 2:",IDC_STATIC,11,130,23,8
COMBOBOX IDC_COMBO_HDD1,46,112,150,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_COMBO_HDD2,46,128,150,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "&Path to CiderPress:",IDC_STATIC,7,155,74,8
EDITTEXT IDC_CIDERPRESS_FILENAME,7,165,143,12,ES_AUTOHSCROLL | ES_READONLY
PUSHBUTTON "&Browse...",IDC_CIDERPRESS_BROWSE,156,164,50,14
GROUPBOX "Floppy Disk Drives",IDC_STATIC,5,7,200,125
CONTROL "&Enhanced disk access speed (all drives)",IDC_ENHANCE_DISK_ENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,19,150,10
LTEXT "Disk 1:",IDC_STATIC,10,36,23,8
LTEXT "Disk 2:",IDC_STATIC,10,53,23,8
COMBOBOX IDC_COMBO_DISK1,40,35,150,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_COMBO_DISK2,40,52,150,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
CONTROL "Enable &Disk II controller in slot 5",IDC_DISKII_SLOT5_ENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,76,122,10
LTEXT "Disk 1:",IDC_STATIC,11,93,23,8
LTEXT "Disk 2:",IDC_STATIC,11,110,23,8
COMBOBOX IDC_COMBO_DISK1_SLOT5,40,92,150,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_COMBO_DISK2_SLOT5,40,108,150,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
GROUPBOX "Hard Disk Drives",IDC_STATIC,5,133,200,64
CONTROL "Enable &hard disk controller in slot 7",IDC_HDD_ENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,146,122,10
PUSHBUTTON "Swap",IDC_HDD_SWAP,156,146,40,14
LTEXT "HDD 1:",IDC_STATIC,11,163,23,8
LTEXT "HDD 2:",IDC_STATIC,11,180,23,8
COMBOBOX IDC_COMBO_HDD1,46,162,150,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_COMBO_HDD2,46,178,150,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "&CiderPress path:",IDC_STATIC,7,205,60,8
EDITTEXT IDC_CIDERPRESS_FILENAME,62,203,95,12,ES_AUTOHSCROLL | ES_READONLY
PUSHBUTTON "&Browse...",IDC_CIDERPRESS_BROWSE,161,202,50,14
END
IDD_TFE_SETTINGS_DIALOG DIALOGEX 0, 0, 270, 100

View File

@ -14,7 +14,7 @@
#define IDC_CUSTOM_SPEED 110
#define IDC_SLIDER_CPU_SPEED 111
#define IDD_PROPPAGE_SOUND 112
#define IDC_DISKTYPE 113
#define IDC_ENHANCE_DISK_ENABLE 113
#define IDC_JOYSTICK1 115
#define IDD_PROPPAGE_DISK 116
#define IDC_BENCHMARK 117
@ -61,17 +61,10 @@
#define IDC_MB_VOLUME 1010
#define IDC_SAVESTATE_BROWSE 1011
#define IDC_MONOCOLOR 1012
#define IDC_HDD1 1013
#define IDC_HDD2 1014
#define IDC_DISK1 1015
#define IDC_DISK2 1016
#define IDC_EDIT_DISK1 1017
#define IDC_EDIT_DISK2 1018
#define IDC_PASTE_FROM_CLIPBOARD 1018
#define IDC_EDIT_HDD1 1019
#define IDC_EDIT_HDD2 1020
#define IDC_DISKII_SLOT5_ENABLE 1020
#define IDC_HDD_ENABLE 1021
#define IDC_HDD_SWAP 1022
#define IDC_PASTE_FROM_CLIPBOARD 1023
#define IDC_SPIN_XTRIM 1026
#define IDC_SPIN_YTRIM 1027
#define IDC_PHASOR_ENABLE 1029
@ -123,6 +116,8 @@
#define IDC_CHECK_FS_SHOW_SUBUNIT_STATUS 1082
#define IDC_CHECK_VERTICAL_BLEND 1083
#define IDC_CHECK_50HZ_VIDEO 1084
#define IDC_COMBO_DISK1_SLOT5 1085
#define IDC_COMBO_DISK2_SLOT5 1086
#define IDM_EXIT 40001
#define IDM_HELP 40002
#define IDM_ABOUT 40003

View File

@ -109,16 +109,11 @@ enum AppMode_e
#define REGVALUE_WINDOW_SCALE "Window Scale"
#define REGVALUE_UTHERNET_ACTIVE "Uthernet Active"
#define REGVALUE_UTHERNET_INTERFACE "Uthernet Interface"
#define REGVALUE_SLOT0 "Slot 0"
#define REGVALUE_SLOT1 "Slot 1"
#define REGVALUE_SLOT2 "Slot 2"
#define REGVALUE_SLOT3 "Slot 3"
#define REGVALUE_SLOT4 "Slot 4"
#define REGVALUE_SLOT5 "Slot 5"
#define REGVALUE_SLOT6 "Slot 6"
#define REGVALUE_SLOT7 "Slot 7"
#define REGVALUE_SLOTAUX "Slot Auxilary"
#define REGVALUE_SLOT4 "Slot 4" // GH#977: Deprecated from 1.30.4
#define REGVALUE_SLOT5 "Slot 5" // GH#977: Deprecated from 1.30.4
#define REGVALUE_VERSION "Version"
#define REG_CONFIG_SLOT "Slot "
#define REGVALUE_CARD_TYPE "Card type"
// Preferences
#define REG_PREFS "Preferences"

View File

@ -34,10 +34,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
CPageDisk* CPageDisk::ms_this = 0; // reinit'd in ctor
const TCHAR CPageDisk::m_discchoices[] =
TEXT("Authentic Speed\0")
TEXT("Enhanced Speed\0");
const TCHAR CPageDisk::m_defaultDiskOptions[] =
TEXT("Select Disk...\0")
TEXT("Eject Disk\0");
@ -78,6 +74,12 @@ INT_PTR CPageDisk::DlgProcInternal(HWND hWnd, UINT message, WPARAM wparam, LPARA
// Can use this to ask user to confirm cancel
break;
case PSN_RESET:
// Support 'Cancel' case for Slot-5 DiskII enabled/disabled - needed as the Disk2InterfaceCard object is created on toggling the checkbox. See [*1]
if (m_PropertySheetHelper.GetConfigOld().m_Slot[SLOT5] != m_PropertySheetHelper.GetConfigNew().m_Slot[SLOT5])
{
if (m_PropertySheetHelper.GetConfigOld().m_Slot[SLOT5] == CT_Disk2 || m_PropertySheetHelper.GetConfigNew().m_Slot[SLOT5] == CT_Disk2)
m_PropertySheetHelper.SetSlot(SLOT5, m_PropertySheetHelper.GetConfigOld().m_Slot[SLOT5]);
}
DlgCANCEL(hWnd);
break;
}
@ -87,17 +89,42 @@ INT_PTR CPageDisk::DlgProcInternal(HWND hWnd, UINT message, WPARAM wparam, LPARA
case WM_COMMAND:
switch (LOWORD(wparam))
{
case IDC_DISKII_SLOT5_ENABLE:
{
const BOOL checked = IsDlgButtonChecked(hWnd, IDC_DISKII_SLOT5_ENABLE) ? TRUE : FALSE;
m_PropertySheetHelper.GetConfigNew().m_Slot[SLOT5] = checked ? CT_Disk2 : CT_Empty;
// NB. Unusual as it creates slot object when checkbox is toggled (instead of after OK)
// Needed as we need a Disk2InterfaceCard object so that images can be inserted/ejected [*1]
m_PropertySheetHelper.SetSlot(SLOT5, m_PropertySheetHelper.GetConfigNew().m_Slot[SLOT5]);
InitOptions(hWnd);
EnableFloppyDrive(hWnd, checked, SLOT5);
}
break;
case IDC_COMBO_DISK1:
if (HIWORD(wparam) == CBN_SELCHANGE)
{
HandleFloppyDriveCombo(hWnd, DRIVE_1, LOWORD(wparam));
HandleFloppyDriveCombo(hWnd, DRIVE_1, LOWORD(wparam), IDC_COMBO_DISK2, SLOT6);
GetFrame().FrameRefreshStatus(DRAW_BUTTON_DRIVES | DRAW_DISK_STATUS);
}
break;
case IDC_COMBO_DISK2:
if (HIWORD(wparam) == CBN_SELCHANGE)
{
HandleFloppyDriveCombo(hWnd, DRIVE_2, LOWORD(wparam));
HandleFloppyDriveCombo(hWnd, DRIVE_2, LOWORD(wparam), IDC_COMBO_DISK1, SLOT6);
GetFrame().FrameRefreshStatus(DRAW_BUTTON_DRIVES | DRAW_DISK_STATUS);
}
break;
case IDC_COMBO_DISK1_SLOT5:
if (HIWORD(wparam) == CBN_SELCHANGE)
{
HandleFloppyDriveCombo(hWnd, DRIVE_1, LOWORD(wparam), IDC_COMBO_DISK2_SLOT5, SLOT5);
GetFrame().FrameRefreshStatus(DRAW_BUTTON_DRIVES | DRAW_DISK_STATUS);
}
break;
case IDC_COMBO_DISK2_SLOT5:
if (HIWORD(wparam) == CBN_SELCHANGE)
{
HandleFloppyDriveCombo(hWnd, DRIVE_2, LOWORD(wparam), IDC_COMBO_DISK1_SLOT5, SLOT5);
GetFrame().FrameRefreshStatus(DRAW_BUTTON_DRIVES | DRAW_DISK_STATUS);
}
break;
@ -130,12 +157,13 @@ INT_PTR CPageDisk::DlgProcInternal(HWND hWnd, UINT message, WPARAM wparam, LPARA
case WM_INITDIALOG:
{
m_PropertySheetHelper.FillComboBox(hWnd, IDC_DISKTYPE, m_discchoices, GetCardMgr().GetDisk2CardMgr().GetEnhanceDisk() ? 1 : 0);
CheckDlgButton(hWnd, IDC_ENHANCE_DISK_ENABLE, GetCardMgr().GetDisk2CardMgr().GetEnhanceDisk() ? BST_CHECKED : BST_UNCHECKED);
if (GetCardMgr().QuerySlot(SLOT6) == CT_Disk2)
InitComboFloppyDrive(hWnd, SLOT6);
const UINT slot = SLOT6;
if (GetCardMgr().QuerySlot(slot) == CT_Disk2) // NB. SLOT6 not setup in m_PropertySheetHelper.GetConfigNew().m_Slot[]
InitComboFloppyDrive(hWnd, slot);
else
EnableFloppyDrive(hWnd, FALSE);
EnableFloppyDrive(hWnd, FALSE, slot); // disable if slot6 is empty (or has some other card in it)
InitComboHDD(hWnd, SLOT7);
@ -147,7 +175,7 @@ INT_PTR CPageDisk::DlgProcInternal(HWND hWnd, UINT message, WPARAM wparam, LPARA
EnableHDD(hWnd, IsDlgButtonChecked(hWnd, IDC_HDD_ENABLE));
InitOptions(hWnd);
InitOptions(hWnd); // init for slot-5
break;
}
@ -161,19 +189,22 @@ void CPageDisk::InitComboFloppyDrive(HWND hWnd, UINT slot)
{
Disk2InterfaceCard& disk2Card = dynamic_cast<Disk2InterfaceCard&>(GetCardMgr().GetRef(slot));
m_PropertySheetHelper.FillComboBox(hWnd, IDC_COMBO_DISK1, m_defaultDiskOptions, -1);
m_PropertySheetHelper.FillComboBox(hWnd, IDC_COMBO_DISK2, m_defaultDiskOptions, -1);
const UINT idcComboDisk1 = (slot == SLOT6) ? IDC_COMBO_DISK1 : IDC_COMBO_DISK1_SLOT5;
const UINT idcComboDisk2 = (slot == SLOT6) ? IDC_COMBO_DISK2 : IDC_COMBO_DISK2_SLOT5;
m_PropertySheetHelper.FillComboBox(hWnd, idcComboDisk1, m_defaultDiskOptions, -1);
m_PropertySheetHelper.FillComboBox(hWnd, idcComboDisk2, m_defaultDiskOptions, -1);
if (!disk2Card.GetFullName(DRIVE_1).empty())
{
SendDlgItemMessage(hWnd, IDC_COMBO_DISK1, CB_INSERTSTRING, 0, (LPARAM)disk2Card.GetFullName(DRIVE_1).c_str());
SendDlgItemMessage(hWnd, IDC_COMBO_DISK1, CB_SETCURSEL, 0, 0);
SendDlgItemMessage(hWnd, idcComboDisk1, CB_INSERTSTRING, 0, (LPARAM)disk2Card.GetFullName(DRIVE_1).c_str());
SendDlgItemMessage(hWnd, idcComboDisk1, CB_SETCURSEL, 0, 0);
}
if (!disk2Card.GetFullName(DRIVE_2).empty())
{
SendDlgItemMessage(hWnd, IDC_COMBO_DISK2, CB_INSERTSTRING, 0, (LPARAM)disk2Card.GetFullName(DRIVE_2).c_str());
SendDlgItemMessage(hWnd, IDC_COMBO_DISK2, CB_SETCURSEL, 0, 0);
SendDlgItemMessage(hWnd, idcComboDisk2, CB_INSERTSTRING, 0, (LPARAM)disk2Card.GetFullName(DRIVE_2).c_str());
SendDlgItemMessage(hWnd, idcComboDisk2, CB_SETCURSEL, 0, 0);
}
}
@ -213,7 +244,7 @@ void CPageDisk::DlgOK(HWND hWnd)
RegSaveString(TEXT(REG_CONFIG), REGVALUE_CIDERPRESSLOC, 1, szFilename);
}
const bool bNewEnhanceDisk = SendDlgItemMessage(hWnd, IDC_DISKTYPE,CB_GETCURSEL, 0, 0) ? true : false;
const bool bNewEnhanceDisk = IsDlgButtonChecked(hWnd, IDC_ENHANCE_DISK_ENABLE) ? true : false;
if (bNewEnhanceDisk != GetCardMgr().GetDisk2CardMgr().GetEnhanceDisk())
{
GetCardMgr().GetDisk2CardMgr().SetEnhanceDisk(bNewEnhanceDisk);
@ -231,8 +262,22 @@ void CPageDisk::DlgOK(HWND hWnd)
void CPageDisk::InitOptions(HWND hWnd)
{
// Nothing to do:
// - no changes made on any other pages affect this page
// Changes made on other pages that affect this page:
// . slot-5: MB add/removed
// . slot-5: DiskII enabled/disabled
const UINT slot = SLOT5;
const SS_CARDTYPE cardInSlot5 = m_PropertySheetHelper.GetConfigNew().m_Slot[slot];
CheckDlgButton(hWnd, IDC_DISKII_SLOT5_ENABLE, (cardInSlot5 == CT_Disk2) ? BST_CHECKED : BST_UNCHECKED);
const BOOL enable = (cardInSlot5 == CT_Disk2 || cardInSlot5 == CT_Empty) ? TRUE : FALSE;
EnableWindow(GetDlgItem(hWnd, IDC_DISKII_SLOT5_ENABLE), enable);
if (cardInSlot5 == CT_Disk2)
InitComboFloppyDrive(hWnd, slot);
else
EnableFloppyDrive(hWnd, FALSE, slot); // disable if slot5 is empty (or has some other card in it)
}
void CPageDisk::EnableHDD(HWND hWnd, BOOL bEnable)
@ -242,10 +287,20 @@ void CPageDisk::EnableHDD(HWND hWnd, BOOL bEnable)
EnableWindow(GetDlgItem(hWnd, IDC_HDD_SWAP), bEnable);
}
void CPageDisk::EnableFloppyDrive(HWND hWnd, BOOL bEnable)
void CPageDisk::EnableFloppyDrive(HWND hWnd, BOOL bEnable, UINT slot)
{
EnableWindow(GetDlgItem(hWnd, IDC_COMBO_DISK1), bEnable);
EnableWindow(GetDlgItem(hWnd, IDC_COMBO_DISK2), bEnable);
_ASSERT(slot == SLOT6 || slot == SLOT5);
if (slot == SLOT6)
{
EnableWindow(GetDlgItem(hWnd, IDC_COMBO_DISK1), bEnable);
EnableWindow(GetDlgItem(hWnd, IDC_COMBO_DISK2), bEnable);
}
else if (slot == SLOT5)
{
EnableWindow(GetDlgItem(hWnd, IDC_COMBO_DISK1_SLOT5), bEnable);
EnableWindow(GetDlgItem(hWnd, IDC_COMBO_DISK2_SLOT5), bEnable);
}
}
void CPageDisk::HandleHDDCombo(HWND hWnd, UINT driveSelected, UINT comboSelected)
@ -296,8 +351,7 @@ void CPageDisk::HandleHDDCombo(HWND hWnd, UINT driveSelected, UINT comboSelected
{
if (dwComboSelection > 1)
{
UINT uCommand = (driveSelected == 0) ? IDC_COMBO_HDD1 : IDC_COMBO_HDD2;
if (RemovalConfirmation(uCommand))
if (RemovalConfirmation(comboSelected))
{
// Unplug selected disk
HD_Unplug(driveSelected);
@ -312,15 +366,17 @@ void CPageDisk::HandleHDDCombo(HWND hWnd, UINT driveSelected, UINT comboSelected
}
}
void CPageDisk::HandleFloppyDriveCombo(HWND hWnd, UINT driveSelected, UINT comboSelected)
void CPageDisk::HandleFloppyDriveCombo(HWND hWnd, UINT driveSelected, UINT comboSelected, UINT comboOther, UINT slot)
{
if (GetCardMgr().QuerySlot(SLOT6) != CT_Disk2)
_ASSERT(slot == SLOT6 || slot == SLOT5);
if (m_PropertySheetHelper.GetConfigNew().m_Slot[slot] != CT_Disk2)
{
_ASSERT(0); // Shouldn't come here, as the combo is disabled
return;
}
Disk2InterfaceCard& disk2Card = dynamic_cast<Disk2InterfaceCard&>(GetCardMgr().GetRef(SLOT6));
Disk2InterfaceCard& disk2Card = dynamic_cast<Disk2InterfaceCard&>(GetCardMgr().GetRef(slot));
// Search from "select floppy drive"
DWORD dwOpenDialogIndex = (DWORD)SendDlgItemMessage(hWnd, comboSelected, CB_FINDSTRINGEXACT, -1, (LPARAM)&m_defaultDiskOptions[0]);
@ -330,9 +386,9 @@ void CPageDisk::HandleFloppyDriveCombo(HWND hWnd, UINT driveSelected, UINT combo
if (dwComboSelection == dwOpenDialogIndex)
{
EnableFloppyDrive(hWnd, FALSE); // Prevent multiple Selection dialogs to be triggered
EnableFloppyDrive(hWnd, FALSE, slot); // Prevent multiple Selection dialogs to be triggered
bool bRes = disk2Card.UserSelectNewDiskImage(driveSelected);
EnableFloppyDrive(hWnd, TRUE);
EnableFloppyDrive(hWnd, TRUE, slot);
if (!bRes)
{
@ -353,8 +409,6 @@ void CPageDisk::HandleFloppyDriveCombo(HWND hWnd, UINT driveSelected, UINT combo
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)fullname.c_str());
if (duplicated != CB_ERR)
{
@ -366,8 +420,7 @@ void CPageDisk::HandleFloppyDriveCombo(HWND hWnd, UINT driveSelected, UINT combo
{
if (dwComboSelection > 1)
{
UINT uCommand = (driveSelected == 0) ? IDC_COMBO_DISK1 : IDC_COMBO_DISK2;
if (RemovalConfirmation(uCommand))
if (RemovalConfirmation(comboSelected))
{
// Eject selected disk
disk2Card.EjectDisk(driveSelected);
@ -398,8 +451,21 @@ UINT CPageDisk::RemovalConfirmation(UINT uCommand)
TCHAR szText[100];
bool bMsgBox = true;
bool isDisk = false;
UINT drive = 0;
if (uCommand == IDC_COMBO_DISK1 || uCommand == IDC_COMBO_DISK2)
StringCbPrintf(szText, sizeof(szText), "Do you really want to eject the disk in drive-%c ?", '1' + uCommand - IDC_COMBO_DISK1);
{
isDisk = true;
drive = uCommand - IDC_COMBO_DISK1;
}
else if (uCommand == IDC_COMBO_DISK1_SLOT5 || uCommand == IDC_COMBO_DISK2_SLOT5)
{
isDisk = true;
drive = uCommand - IDC_COMBO_DISK1_SLOT5;
}
if (isDisk)
StringCbPrintf(szText, sizeof(szText), "Do you really want to eject the disk in drive-%c ?", '1' + drive);
else if (uCommand == IDC_COMBO_HDD1 || uCommand == IDC_COMBO_HDD2)
StringCbPrintf(szText, sizeof(szText), "Do you really want to unplug harddisk-%c ?", '1' + uCommand - IDC_COMBO_HDD1);
else if (uCommand == IDC_HDD_SWAP)

View File

@ -28,14 +28,13 @@ private:
void InitComboFloppyDrive(HWND hWnd, UINT slot);
void InitComboHDD(HWND hWnd, UINT slot);
void EnableHDD(HWND hWnd, BOOL bEnable);
void EnableFloppyDrive(HWND hWnd, BOOL bEnable);
void EnableFloppyDrive(HWND hWnd, BOOL bEnable, UINT slot);
void HandleHDDCombo(HWND hWnd, UINT driveSelected, UINT comboSelected);
void HandleFloppyDriveCombo(HWND hWnd, UINT driveSelected, UINT comboSelected);
void HandleFloppyDriveCombo(HWND hWnd, UINT driveSelected, UINT comboSelected, UINT comboOther, UINT slot);
void HandleHDDSwap(HWND hWnd);
UINT RemovalConfirmation(UINT uCommand);
static CPageDisk* ms_this;
static const TCHAR m_discchoices[];
static const TCHAR m_defaultDiskOptions[];
static const TCHAR m_defaultHDDOptions[];

View File

@ -128,23 +128,15 @@ void CPropertySheetHelper::SetSlot(UINT slot, SS_CARDTYPE newCardType)
// Two paths:
// 1) Via Config dialog: card not inserted yet
// 2) Snapshot_LoadState_v2(): card already inserted
if (GetCardMgr().QuerySlot(slot) != newCardType)
GetCardMgr().Insert(slot, newCardType);
if (GetCardMgr().QuerySlot(slot) == newCardType)
return;
std::string slotText;
switch (slot)
{
case 0: slotText = REGVALUE_SLOT0; break;
case 1: slotText = REGVALUE_SLOT1; break;
case 2: slotText = REGVALUE_SLOT2; break;
case 3: slotText = REGVALUE_SLOT3; break;
case 4: slotText = REGVALUE_SLOT4; break;
case 5: slotText = REGVALUE_SLOT5; break;
case 6: slotText = REGVALUE_SLOT6; break;
case 7: slotText = REGVALUE_SLOT7; break;
}
GetCardMgr().Insert(slot, newCardType);
REGSAVE(slotText.c_str(), (DWORD)newCardType);
RegDeleteConfigSlotSection(slot);
std::string& regSection = RegGetConfigSlotSection(slot);
RegSaveValue(regSection.c_str(), REGVALUE_CARD_TYPE, TRUE, newCardType);
}
// Used by:
@ -395,6 +387,7 @@ void CPropertySheetHelper::SaveCurrentConfig(void)
m_ConfigOld.m_CpuType = GetMainCpu();
m_ConfigOld.m_Slot[SLOT4] = GetCardMgr().QuerySlot(SLOT4);
m_ConfigOld.m_Slot[SLOT5] = GetCardMgr().QuerySlot(SLOT5);
m_ConfigOld.m_Slot[SLOT6] = GetCardMgr().QuerySlot(SLOT6); // CPageDisk::HandleFloppyDriveCombo() needs this to be CT_Disk2 (temp, as will replace with PR #955)
m_ConfigOld.m_bEnableHDD = HD_CardIsEnabled();
m_ConfigOld.m_bEnableTheFreezesF8Rom = GetPropertySheet().GetTheFreezesF8Rom();
m_ConfigOld.m_videoRefreshRate = GetVideo().GetVideoRefreshRate();
@ -414,8 +407,8 @@ void CPropertySheetHelper::RestoreCurrentConfig(void)
// NB. clone-type is encoded in g_Apple2Type
SetApple2Type(m_ConfigOld.m_Apple2Type);
SetMainCpu(m_ConfigOld.m_CpuType);
GetCardMgr().Insert(SLOT4, m_ConfigOld.m_Slot[SLOT4]);
GetCardMgr().Insert(SLOT5, m_ConfigOld.m_Slot[SLOT5]);
SetSlot(SLOT4, m_ConfigOld.m_Slot[SLOT4]);
SetSlot(SLOT5, m_ConfigOld.m_Slot[SLOT5]);
HD_SetEnabled(m_ConfigOld.m_bEnableHDD);
GetPropertySheet().SetTheFreezesF8Rom(m_ConfigOld.m_bEnableTheFreezesF8Rom);
m_ConfigNew.m_videoRefreshRate = m_ConfigOld.m_videoRefreshRate; // Not SetVideoRefreshRate(), as this re-inits much Video/NTSC state!

View File

@ -29,15 +29,15 @@ public:
void SaveCurrentConfig(void);
const std::string & GetSSNewFilename(void) { return m_szSSNewFilename; }
// const CConfigNeedingRestart& GetConfigOld(void) { return m_ConfigOld; }
const CConfigNeedingRestart& GetConfigOld(void) { return m_ConfigOld; }
CConfigNeedingRestart& GetConfigNew(void) { return m_ConfigNew; }
bool IsConfigChanged(void) { return m_ConfigNew != m_ConfigOld; }
void SetDoBenchmark(void) { m_bDoBenchmark = true; }
void ApplyNewConfig(const CConfigNeedingRestart& ConfigNew, const CConfigNeedingRestart& ConfigOld);
void ConfigSaveApple2Type(eApple2Type apple2Type);
void SetSlot(UINT slot, SS_CARDTYPE newCardType);
private:
void SetSlot(UINT slot, SS_CARDTYPE newCardType);
bool IsOkToSaveLoadState(HWND hWnd, const bool bConfigChanged);
bool IsOkToRestart(HWND hWnd);
void SaveComputerType(eApple2Type NewApple2Type);

View File

@ -165,16 +165,18 @@ void Disk2InterfaceCard::LoadLastDiskImage(const int drive)
{
_ASSERT(drive == DRIVE_1 || drive == DRIVE_2);
const TCHAR *pRegKey = (drive == DRIVE_1)
? TEXT(REGVALUE_PREF_LAST_DISK_1)
: TEXT(REGVALUE_PREF_LAST_DISK_2);
const std::string regKey = (drive == DRIVE_1)
? REGVALUE_PREF_LAST_DISK_1
: REGVALUE_PREF_LAST_DISK_2;
TCHAR sFilePath[MAX_PATH];
if (RegLoadString(TEXT(REG_PREFS), pRegKey, 1, sFilePath, MAX_PATH, TEXT("")))
char pathname[MAX_PATH];
std::string& regSection = RegGetConfigSlotSection(m_slot);
if (RegLoadString(regSection.c_str(), regKey.c_str(), TRUE, pathname, MAX_PATH, TEXT("")))
{
m_saveDiskImage = false;
// Pass in ptr to local copy of filepath, since RemoveDisk() sets DiskPathFilename = ""
InsertDisk(drive, sFilePath, IMAGE_USE_FILES_WRITE_PROTECT_STATUS, IMAGE_DONT_CREATE);
InsertDisk(drive, pathname, IMAGE_USE_FILES_WRITE_PROTECT_STATUS, IMAGE_DONT_CREATE);
m_saveDiskImage = true;
}
}
@ -185,28 +187,34 @@ void Disk2InterfaceCard::SaveLastDiskImage(const int drive)
{
_ASSERT(drive == DRIVE_1 || drive == DRIVE_2);
if (m_slot != 6) // DiskII cards in other slots don't save image to Registry
return;
if (!m_saveDiskImage)
return;
const std::string & pFileName = DiskGetFullPathName(drive);
std::string& regSection = RegGetConfigSlotSection(m_slot);
RegSaveValue(regSection.c_str(), REGVALUE_CARD_TYPE, TRUE, CT_Disk2);
if (drive == DRIVE_1)
RegSaveString(TEXT(REG_PREFS), TEXT(REGVALUE_PREF_LAST_DISK_1), TRUE, pFileName);
else
RegSaveString(TEXT(REG_PREFS), TEXT(REGVALUE_PREF_LAST_DISK_2), TRUE, pFileName);
const std::string regKey = (drive == DRIVE_1)
? REGVALUE_PREF_LAST_DISK_1
: REGVALUE_PREF_LAST_DISK_2;
const std::string& pathName = DiskGetFullPathName(drive);
RegSaveString(regSection.c_str(), regKey.c_str(), TRUE, pathName);
//
// For now, only update 'Starting Directory' for slot6 & drive1
// . otherwise you'll get inconsistent results if you set drive1, then drive2 (and the images were in different folders)
if (m_slot != SLOT6 || drive != DRIVE_1)
return;
TCHAR szPathName[MAX_PATH];
StringCbCopy(szPathName, MAX_PATH, pFileName.c_str());
TCHAR* slash = _tcsrchr(szPathName, TEXT(PATH_SEPARATOR));
StringCbCopy(szPathName, MAX_PATH, pathName.c_str());
TCHAR* slash = _tcsrchr(szPathName, PATH_SEPARATOR);
if (slash != NULL)
{
slash[1] = '\0';
RegSaveString(TEXT(REG_PREFS), TEXT(REGVALUE_PREF_START_DIR), 1, szPathName);
RegSaveString(REG_PREFS, REGVALUE_PREF_START_DIR, 1, szPathName);
}
}

View File

@ -98,8 +98,6 @@ void Disk2CardManager::LoadLastDiskImage(void)
{
for (UINT i = 0; i < NUM_SLOTS; i++)
{
if (i != SLOT6) continue; // FIXME
if (GetCardMgr().QuerySlot(i) == CT_Disk2)
{
dynamic_cast<Disk2InterfaceCard&>(GetCardMgr().GetRef(i)).LoadLastDiskImage(DRIVE_1);

View File

@ -1728,7 +1728,7 @@ void MemInitializeIO(void)
// NB. I/O handlers setup via tfe_init() & update_tfe_interface()
}
// Apple//e: Auxilary slot contains Extended 80 Column card or RamWorksIII card
// Apple//e: Auxiliary slot contains Extended 80 Column card or RamWorksIII card
if (GetCardMgr().QuerySlot(SLOT4) == CT_MouseInterface)
{

View File

@ -33,18 +33,25 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
namespace _ini {
//===========================================================================
BOOL RegLoadString(LPCTSTR section, LPCTSTR key, BOOL peruser, LPTSTR buffer, DWORD chars)
BOOL RegLoadString(LPCTSTR section, LPCTSTR key, BOOL /*peruser*/, LPTSTR buffer, DWORD chars)
{
DWORD n = GetPrivateProfileString(section, key, NULL, buffer, chars, g_sConfigFile.c_str());
return n > 0;
}
//===========================================================================
void RegSaveString(LPCTSTR section, LPCTSTR key, BOOL peruser, const std::string& buffer)
void RegSaveString(LPCTSTR section, LPCTSTR key, BOOL /*peruser*/, const std::string& buffer)
{
BOOL updated = WritePrivateProfileString(section, key, buffer.c_str(), g_sConfigFile.c_str());
_ASSERT(updated || GetLastError() == 0);
}
//===========================================================================
void RegDeleteString(LPCTSTR section, BOOL /*peruser*/)
{
BOOL updated = WritePrivateProfileString(section, NULL, NULL, g_sConfigFile.c_str());
_ASSERT(updated || GetLastError() == 0);
}
}
//===========================================================================
@ -64,7 +71,7 @@ BOOL RegLoadString (LPCTSTR section, LPCTSTR key, BOOL peruser, LPTSTR buffer, D
0,
KEY_READ,
&keyhandle);
if (status == 0)
if (status == ERROR_SUCCESS)
{
DWORD type;
DWORD size = chars;
@ -127,7 +134,7 @@ void RegSaveString (LPCTSTR section, LPCTSTR key, BOOL peruser, const std::strin
(LPSECURITY_ATTRIBUTES)NULL,
&keyhandle,
&disposition);
if (status == 0)
if (status == ERROR_SUCCESS)
{
RegSetValueEx(
keyhandle,
@ -147,3 +154,50 @@ void RegSaveValue (LPCTSTR section, LPCTSTR key, BOOL peruser, DWORD value) {
RegSaveString(section, key, peruser, buffer);
}
//===========================================================================
static std::string& RegGetSlotSection(UINT slot)
{
static std::string section;
section = REG_CONFIG_SLOT;
section += (char)('0' + slot);
return section;
}
std::string& RegGetConfigSlotSection(UINT slot)
{
static std::string section;
section = REG_CONFIG "\\";
section += RegGetSlotSection(slot);
return section;
}
void RegDeleteConfigSlotSection(UINT slot)
{
BOOL peruser = TRUE;
if (!g_sConfigFile.empty())
{
std::string section = REG_CONFIG "\\";
section += RegGetSlotSection(slot);
return _ini::RegDeleteString(section.c_str(), peruser);
}
TCHAR fullkeyname[256];
StringCbPrintf(fullkeyname, 256, TEXT("Software\\AppleWin\\CurrentVersion\\%s"), REG_CONFIG);
HKEY keyhandle;
LSTATUS status = RegOpenKeyEx(
(peruser ? HKEY_CURRENT_USER : HKEY_LOCAL_MACHINE),
fullkeyname,
0,
KEY_READ,
&keyhandle);
if (status == ERROR_SUCCESS)
{
std::string& keySlot = RegGetSlotSection(slot);
if (RegDeleteKey(keyhandle, keySlot.c_str()) != ERROR_SUCCESS)
_ASSERT(0);
}
RegCloseKey(keyhandle);
}

View File

@ -10,3 +10,6 @@ BOOL RegLoadValue (LPCTSTR section, LPCTSTR key, BOOL peruser, DWORD* value);
BOOL RegLoadValue (LPCTSTR section, LPCTSTR key, BOOL peruser, DWORD* value, DWORD defaultValue);
void RegSaveString (LPCTSTR section, LPCTSTR key, BOOL peruser, const std::string & buffer);
void RegSaveValue (LPCTSTR section, LPCTSTR key, BOOL peruser, DWORD value);
std::string& RegGetConfigSlotSection(UINT slot);
void RegDeleteConfigSlotSection(UINT slot);

View File

@ -234,9 +234,6 @@ void LoadConfiguration(void)
g_bPrinterAppend = dwTmp ? true : false;
if(REGLOAD(TEXT(REGVALUE_HDD_ENABLED), &dwTmp)) // TODO: Change to REGVALUE_SLOT7
HD_SetEnabled(dwTmp ? true : false);
if(REGLOAD(TEXT(REGVALUE_PDL_XTRIM), &dwTmp))
JoySetTrim((short)dwTmp, true);
if(REGLOAD(TEXT(REGVALUE_PDL_YTRIM), &dwTmp))
@ -259,10 +256,24 @@ void LoadConfiguration(void)
if(REGLOAD(TEXT(REGVALUE_MOUSE_RESTRICT_TO_WINDOW), &dwTmp))
GetPropertySheet().SetMouseRestrictToWindow(dwTmp);
if(REGLOAD(TEXT(REGVALUE_SLOT4), &dwTmp))
GetCardMgr().Insert(4, (SS_CARDTYPE)dwTmp);
if(REGLOAD(TEXT(REGVALUE_SLOT5), &dwTmp))
GetCardMgr().Insert(5, (SS_CARDTYPE)dwTmp);
for (UINT slot = SLOT0; slot <= SLOT7; slot++)
{
std::string& regSection = RegGetConfigSlotSection(slot);
if (RegLoadValue(regSection.c_str(), REGVALUE_CARD_TYPE, TRUE, &dwTmp))
{
GetCardMgr().Insert(slot, (SS_CARDTYPE)dwTmp);
}
else // legacy (AppleWin 1.30.3 or earlier)
{
if (slot == SLOT4 && REGLOAD(TEXT(REGVALUE_SLOT4), &dwTmp))
GetCardMgr().Insert(SLOT4, (SS_CARDTYPE)dwTmp);
else if (slot == SLOT5 && REGLOAD(TEXT(REGVALUE_SLOT5), &dwTmp))
GetCardMgr().Insert(SLOT5, (SS_CARDTYPE)dwTmp);
else if (slot == SLOT7 && REGLOAD(TEXT(REGVALUE_HDD_ENABLED), &dwTmp))
HD_SetEnabled(dwTmp ? true : false);
}
}
//