HDD: Added a swap HDD function to the Config->Disk UI (#585)

This commit is contained in:
tomcw 2018-12-09 11:48:22 +00:00
parent d0f03fc90c
commit b17f880e6d
9 changed files with 74 additions and 41 deletions

View File

@ -1,23 +1,13 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Disk Settings</title>
</head>
<body style="background-color: rgb(255, 255, 255); font-family: verdana;" alink="#008000" link="#008000" vlink="#008000">
<h2 style="color: rgb(0, 128, 0);">Disk Settings</h2>
<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>
Here you can choose the speed at which the system can access
@ -26,14 +16,14 @@ 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.</p>
would&nbsp;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
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>
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>
<h3>Hard disk Controller Settings:</h3>
@ -42,16 +32,20 @@ A hard disk controller (or interface) card can be plugged in to slot 7 by checki
See <a href="ddi-harddisk.html">Hard disk Images</a> for more details.
</p>
<p><strong>Swap:</strong><br>
Swap the hard disk images.<br>
WARNING! If done during image access this could result in undefined behavior (eg. Apple II program crash) or data corruption on the image.
</p>
<p><strong>HDD 1/2 drop-down menus:</strong><br>
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>
<strong>Path to CiderPress:</strong><br>
connect to the emulated hard disk controller card. You can also unplug images from this menu.
</p>
<p><strong>Path to CiderPress:</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>
</body>
</html>

View File

@ -3,7 +3,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Transferring Disk Images</title>
<title>Hard Disk Images</title>
</head>
@ -20,8 +20,9 @@
Just check <span style="font-style: italic;">Enable hard disk controller in slot 7</span>.</p>
<p>There is provision to connect two hard disks to this card.
This is done by using .hdv files on your PC.
This is done by using .hdv or 800KB .2mg files on your PC.
Each hard disk can have a maximum capacity of 32MB.</p>
NB. The hard disk controller supports both fixed-disk types (up to 32MB) and 3.5" floppy types (800KB).
<p>On booting, the Apple will <span style="text-decoration: underline;">always</span>
attempt to
@ -33,9 +34,6 @@ interface card in it).</p>
<p>To boot a floppy disk with the hard disk card enabled, either hold down the Open-Apple key during an Apple II restart or
issue PR#6 from an AppleSoft prompt.</p>
<p>You can download sample .hdv
images from Asimov (eg. <a target="_blank" href="ftp://public.asimov.net/pub/apple_II/">ftp://public.asimov.net/pub/apple_II/images/utility/misc/hardpc.zip</a>).</p>
<p style="font-weight: bold;">Warnings:</p>
<ul>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 34 KiB

View File

@ -175,6 +175,7 @@ BEGIN
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 "&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

View File

@ -66,6 +66,7 @@
#define IDC_EDIT_HDD1 1019
#define IDC_EDIT_HDD2 1020
#define IDC_HDD_ENABLE 1021
#define IDC_HDD_SWAP 1022
#define IDC_SPIN_XTRIM 1026
#define IDC_SPIN_YTRIM 1027
#define IDC_PHASOR_ENABLE 1029

View File

@ -115,7 +115,9 @@ BOOL CPageDisk::DlgProcInternal(HWND hWnd, UINT message, WPARAM wparam, LPARAM l
case IDC_HDD_ENABLE:
EnableHDD(hWnd, IsDlgButtonChecked(hWnd, IDC_HDD_ENABLE));
break;
case IDC_HDD_SWAP:
HandleHDDSwap(hWnd);
break;
case IDC_CIDERPRESS_BROWSE:
{
std::string CiderPressLoc = m_PropertySheetHelper.BrowseToFile(hWnd, TEXT("Select path to CiderPress"), REGVALUE_CIDERPRESSLOC, TEXT("Applications (*.exe)\0*.exe\0") TEXT("All Files\0*.*\0") );
@ -131,8 +133,6 @@ BOOL CPageDisk::DlgProcInternal(HWND hWnd, UINT message, WPARAM wparam, LPARAM l
m_PropertySheetHelper.FillComboBox(hWnd, IDC_DISKTYPE, m_discchoices, Disk_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_COMBO_HDD1, m_defaultHDDOptions, -1);
m_PropertySheetHelper.FillComboBox(hWnd, IDC_COMBO_HDD2, m_defaultHDDOptions, -1);
if (strlen(DiskGetFullName(DRIVE_1)) > 0)
{
@ -146,17 +146,7 @@ BOOL CPageDisk::DlgProcInternal(HWND hWnd, UINT message, WPARAM wparam, LPARAM l
SendDlgItemMessage(hWnd, IDC_COMBO_DISK2, CB_SETCURSEL, 0, 0);
}
if (strlen(HD_GetFullName(HARDDISK_1)) > 0)
{
SendDlgItemMessage(hWnd, IDC_COMBO_HDD1, CB_INSERTSTRING, 0, (LPARAM)HD_GetFullName(HARDDISK_1));
SendDlgItemMessage(hWnd, IDC_COMBO_HDD1, CB_SETCURSEL, 0, 0);
}
if (strlen(HD_GetFullName(HARDDISK_2)) > 0)
{
SendDlgItemMessage(hWnd, IDC_COMBO_HDD2, CB_INSERTSTRING, 0, (LPARAM)HD_GetFullName(HARDDISK_2));
SendDlgItemMessage(hWnd, IDC_COMBO_HDD2, CB_SETCURSEL, 0, 0);
}
InitComboHDD(hWnd);
TCHAR PathToCiderPress[MAX_PATH] = "";
RegLoadString(TEXT(REG_CONFIG), REGVALUE_CIDERPRESSLOC, 1, PathToCiderPress,MAX_PATH);
@ -176,6 +166,24 @@ BOOL CPageDisk::DlgProcInternal(HWND hWnd, UINT message, WPARAM wparam, LPARAM l
return FALSE;
}
void CPageDisk::InitComboHDD(HWND hWnd)
{
m_PropertySheetHelper.FillComboBox(hWnd, IDC_COMBO_HDD1, m_defaultHDDOptions, -1);
m_PropertySheetHelper.FillComboBox(hWnd, IDC_COMBO_HDD2, m_defaultHDDOptions, -1);
if (strlen(HD_GetFullName(HARDDISK_1)) > 0)
{
SendDlgItemMessage(hWnd, IDC_COMBO_HDD1, CB_INSERTSTRING, 0, (LPARAM)HD_GetFullName(HARDDISK_1));
SendDlgItemMessage(hWnd, IDC_COMBO_HDD1, CB_SETCURSEL, 0, 0);
}
if (strlen(HD_GetFullName(HARDDISK_2)) > 0)
{
SendDlgItemMessage(hWnd, IDC_COMBO_HDD2, CB_INSERTSTRING, 0, (LPARAM)HD_GetFullName(HARDDISK_2));
SendDlgItemMessage(hWnd, IDC_COMBO_HDD2, CB_SETCURSEL, 0, 0);
}
}
void CPageDisk::DlgOK(HWND hWnd)
{
const bool bNewEnhanceDisk = SendDlgItemMessage(hWnd, IDC_DISKTYPE,CB_GETCURSEL, 0, 0) ? true : false;
@ -207,6 +215,7 @@ void CPageDisk::EnableHDD(HWND hWnd, BOOL bEnable)
{
EnableWindow(GetDlgItem(hWnd, IDC_COMBO_HDD1), bEnable);
EnableWindow(GetDlgItem(hWnd, IDC_COMBO_HDD2), bEnable);
EnableWindow(GetDlgItem(hWnd, IDC_HDD_SWAP), bEnable);
}
void CPageDisk::EnableDisk(HWND hWnd, BOOL bEnable)
@ -340,19 +349,34 @@ void CPageDisk::HandleDiskCombo(HWND hWnd, UINT driveSelected, UINT comboSelecte
}
}
void CPageDisk::HandleHDDSwap(HWND hWnd)
{
if (!RemovalConfirmation(IDC_HDD_SWAP))
return;
if (!HD_ImageSwap())
return;
InitComboHDD(hWnd);
}
UINT CPageDisk::RemovalConfirmation(UINT uCommand)
{
TCHAR szText[100];
const size_t strLen = sizeof(szText)-1;
bool bMsgBox = true;
if (uCommand == IDC_COMBO_DISK1 || uCommand == IDC_COMBO_DISK2)
wsprintf(szText, "Do you really want to eject the disk in drive-%c ?", '1' + uCommand - IDC_COMBO_DISK1);
_snprintf(szText, strLen, "Do you really want to eject the disk in drive-%c ?", '1' + uCommand - IDC_COMBO_DISK1);
else if (uCommand == IDC_COMBO_HDD1 || uCommand == IDC_COMBO_HDD2)
wsprintf(szText, "Do you really want to unplug harddisk-%c ?", '1' + uCommand - IDC_COMBO_HDD1);
_snprintf(szText, strLen, "Do you really want to unplug harddisk-%c ?", '1' + uCommand - IDC_COMBO_HDD1);
else if (uCommand == IDC_HDD_SWAP)
_snprintf(szText, strLen, "Do you really want to swap the harddisk images?");
else
bMsgBox = false;
szText[strLen] = 0;
if (bMsgBox)
{
int nRes = MessageBox(g_hFrameWindow, szText, TEXT("Eject/Unplug Warning"), MB_ICONWARNING | MB_YESNO | MB_SETFOREGROUND);

View File

@ -25,10 +25,12 @@ protected:
private:
void InitOptions(HWND hWnd);
void InitComboHDD(HWND hWnd);
void EnableHDD(HWND hWnd, BOOL bEnable);
void EnableDisk(HWND hWnd, BOOL bEnable);
void HandleHDDCombo(HWND hWnd, UINT driveSelected, UINT comboSelected);
void HandleDiskCombo(HWND hWnd, UINT driveSelected, UINT comboSelected);
void HandleHDDSwap(HWND hWnd);
UINT RemovalConfirmation(UINT uCommand);
static CPageDisk* ms_this;

View File

@ -695,6 +695,18 @@ void HD_GetLightStatus (Disk_Status_e *pDisk1Status_)
}
}
bool HD_ImageSwap(void)
{
std::swap(g_HardDisk[HARDDISK_1], g_HardDisk[HARDDISK_2]);
HD_SaveLastDiskImage(HARDDISK_1);
HD_SaveLastDiskImage(HARDDISK_2);
FrameRefreshStatus(DRAW_LEDS, false);
return true;
}
//===========================================================================
#define SS_YAML_VALUE_CARD_HDD "Generic HDD"

View File

@ -45,6 +45,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// 1.19.0.0 Hard Disk Status/Indicator Light
void HD_GetLightStatus (Disk_Status_e *pDisk1Status_);
bool HD_ImageSwap(void);
std::string HD_GetSnapshotCardName(void);
void HD_SaveSnapshot(class YamlSaveHelper& yamlSaveHelper);