Fixed not being able to select Pravets82, improved code robustness & improved UX when loading an unsupported Apple2Type config (fixes #415)
This commit is contained in:
parent
e3a99ecf9f
commit
eb21f34ace
3 changed files with 44 additions and 7 deletions
|
@ -500,13 +500,36 @@ void LoadConfiguration(void)
|
|||
|
||||
if (REGLOAD(TEXT(REGVALUE_APPLE2_TYPE), &dwComputerType))
|
||||
{
|
||||
if ((dwComputerType >= A2TYPE_MAX) || (dwComputerType >= A2TYPE_UNDEFINED && dwComputerType < A2TYPE_CLONE))
|
||||
const DWORD dwLoadedComputerType = dwComputerType;
|
||||
|
||||
if ( (dwComputerType >= A2TYPE_MAX) ||
|
||||
(dwComputerType >= A2TYPE_UNDEFINED && dwComputerType < A2TYPE_CLONE) ||
|
||||
(dwComputerType >= A2TYPE_CLONE_A2_MAX && dwComputerType < A2TYPE_CLONE_A2E) )
|
||||
dwComputerType = A2TYPE_APPLE2EENHANCED;
|
||||
|
||||
// Remap the bad Pravets models (before AppleWin v1.26)
|
||||
if (dwComputerType == A2TYPE_BAD_PRAVETS82) dwComputerType = A2TYPE_PRAVETS82;
|
||||
if (dwComputerType == A2TYPE_BAD_PRAVETS8M) dwComputerType = A2TYPE_PRAVETS8M;
|
||||
|
||||
// Remap the bad Pravets models (at AppleWin v1.26) - GH#415
|
||||
if (dwComputerType == A2TYPE_CLONE) dwComputerType = A2TYPE_PRAVETS82;
|
||||
|
||||
if (dwLoadedComputerType != dwComputerType)
|
||||
{
|
||||
char sText[ 100 ];
|
||||
_snprintf( sText, sizeof(sText)-1, "Unsupported Apple2Type(%d). Changing to %d", dwLoadedComputerType, dwComputerType);
|
||||
|
||||
MessageBox(
|
||||
GetDesktopWindow(), // NB. g_hFrameWindow is not yet valid
|
||||
sText,
|
||||
"Load Configuration",
|
||||
MB_ICONSTOP | MB_SETFOREGROUND);
|
||||
|
||||
LogFileOutput("%s\n", sText);
|
||||
|
||||
REGSAVE(TEXT(REGVALUE_APPLE2_TYPE), dwComputerType);
|
||||
}
|
||||
|
||||
apple2Type = (eApple2Type) dwComputerType;
|
||||
}
|
||||
else // Support older AppleWin registry entries
|
||||
|
|
|
@ -175,16 +175,21 @@ enum eApple2Type {
|
|||
A2TYPE_UNDEFINED,
|
||||
A2TYPE_APPLE2C=APPLE2C_MASK,
|
||||
A2TYPE_APPLE2D=APPLE2D_MASK,
|
||||
//
|
||||
// Clones start here:
|
||||
|
||||
// ][ clones start here:
|
||||
A2TYPE_CLONE=APPLECLONE_MASK,
|
||||
A2TYPE_PRAVETS=APPLECLONE_MASK,
|
||||
A2TYPE_PRAVETS82=A2TYPE_PRAVETS, // Apple ][ clone
|
||||
A2TYPE_PRAVETS8M, // Apple ][ clone
|
||||
A2TYPE_BAD_PRAVETS82=A2TYPE_PRAVETS|APPLE2E_MASK, // Wrongly tagged as Apple //e clone (< AppleWin 1.26)
|
||||
A2TYPE_BAD_PRAVETS8M, // Wrongly tagged as Apple //e clone (< AppleWin 1.26)
|
||||
A2TYPE_PRAVETS82, // Apple ][ clone
|
||||
// (Gap for more Apple ][ clones)
|
||||
A2TYPE_CLONE_A2_MAX,
|
||||
|
||||
// //e clones start here:
|
||||
A2TYPE_CLONE_A2E=A2TYPE_CLONE|APPLE2E_MASK,
|
||||
A2TYPE_BAD_PRAVETS82=A2TYPE_CLONE|APPLE2E_MASK, // Wrongly tagged as Apple //e clone (< AppleWin 1.26)
|
||||
A2TYPE_BAD_PRAVETS8M, // Wrongly tagged as Apple //e clone (< AppleWin 1.26)
|
||||
A2TYPE_PRAVETS8A, // Apple //e clone
|
||||
A2TYPE_TK30002E, // Apple //e enhanced clone
|
||||
// (Gap for more Apple //e clones)
|
||||
A2TYPE_MAX
|
||||
};
|
||||
|
||||
|
|
|
@ -237,6 +237,15 @@ int CPageAdvanced::GetCloneMenuItem(void)
|
|||
int nMenuItem = MENUITEM_CLONEMIN;
|
||||
switch (type)
|
||||
{
|
||||
case A2TYPE_CLONE: // Set as generic clone type from Config page
|
||||
{
|
||||
// Need to set a real clone type & CPU in case the user never touches the clone menu
|
||||
nMenuItem = MENUITEM_CLONEMIN;
|
||||
const eApple2Type NewCloneType = GetCloneType(MENUITEM_CLONEMIN);
|
||||
m_PropertySheetHelper.GetConfigNew().m_Apple2Type = GetCloneType(NewCloneType);
|
||||
m_PropertySheetHelper.GetConfigNew().m_CpuType = ProbeMainCpuDefault(NewCloneType);
|
||||
}
|
||||
break;
|
||||
case A2TYPE_PRAVETS82: nMenuItem = MENUITEM_PRAVETS82; break;
|
||||
case A2TYPE_PRAVETS8M: nMenuItem = MENUITEM_PRAVETS8M; break;
|
||||
case A2TYPE_PRAVETS8A: nMenuItem = MENUITEM_PRAVETS8A; break;
|
||||
|
|
Loading…
Add table
Reference in a new issue