ProcessCmdLine()

. Display MessageBox with all unsupported commands that were passed in.
. MessageBox yes/no response will either continue or exit AppleWin.
Changed -left-control-alt-buttons to -left-alt-control-buttons (for consistency with -right-alt-control-buttons) (#743)
. The MessageBox will now confirm whether you typed it correctly or not.
Fixed DHIRESON/OFF typo in comment!
This commit is contained in:
tomcw 2020-01-18 16:42:49 +00:00
parent 78337c06bb
commit ddbc1a8aa9
2 changed files with 29 additions and 7 deletions

View File

@ -1232,7 +1232,7 @@ static void ExceptionHandler(const char* pError)
//---------------------------------------------------------------------------
static void ProcessCmdLine(LPSTR lpCmdLine);
static bool ProcessCmdLine(LPSTR lpCmdLine);
static void GetAppleWinVersion(void);
static void OneTimeInitialization(HINSTANCE passinstance);
static void RepeatInitialization(void);
@ -1300,7 +1300,9 @@ static CmdLine g_cmdLine;
int APIENTRY WinMain(HINSTANCE passinstance, HINSTANCE, LPSTR lpCmdLine, int)
{
ProcessCmdLine(lpCmdLine);
if (!ProcessCmdLine(lpCmdLine))
return 0;
GetAppleWinVersion();
OneTimeInitialization(passinstance);
@ -1357,9 +1359,10 @@ int APIENTRY WinMain(HINSTANCE passinstance, HINSTANCE, LPSTR lpCmdLine, int)
return 0;
}
static void ProcessCmdLine(LPSTR lpCmdLine)
static bool ProcessCmdLine(LPSTR lpCmdLine)
{
const std::string strCmdLine(lpCmdLine); // Keep a copy for log ouput
std::string strUnsupported;
while (*lpCmdLine)
{
@ -1576,12 +1579,12 @@ static void ProcessCmdLine(LPSTR lpCmdLine)
{
JoySetHookAltKeys(false);
}
else if (strcmp(lpCmdLine, "-left-control-alt-buttons") == 0)
else if (strcmp(lpCmdLine, "-left-alt-control-buttons") == 0) // GH#743
{
JoySetButtonVirtualKey(0, VK_CONTROL);
JoySetButtonVirtualKey(1, VK_MENU);
}
else if (strcmp(lpCmdLine, "-right-alt-control-buttons") == 0)
else if (strcmp(lpCmdLine, "-right-alt-control-buttons") == 0) // GH#743
{
JoySetButtonVirtualKey(0, VK_MENU | KF_EXTENDED);
JoySetButtonVirtualKey(1, VK_CONTROL | KF_EXTENDED);
@ -1683,12 +1686,31 @@ static void ProcessCmdLine(LPSTR lpCmdLine)
else // unsupported
{
LogFileOutput("Unsupported arg: %s\n", lpCmdLine);
strUnsupported += lpCmdLine;
strUnsupported += "\n";
}
lpCmdLine = lpNextArg;
}
LogFileOutput("CmdLine: %s\n", strCmdLine.c_str());
bool ok = true;
if (!strUnsupported.empty())
{
std::string msg("Unsupported commands:\n\n");
msg += strUnsupported;
msg += "\n";
msg += "Continue running AppleWin?";
int res = MessageBox(GetDesktopWindow(), // NB. g_hFrameWindow is not yet valid
msg.c_str(),
"AppleWin Command Line",
MB_ICONSTOP | MB_SETFOREGROUND | MB_YESNO);
ok = (res != IDNO);
}
return ok;
}
static void GetAppleWinVersion(void)

View File

@ -108,8 +108,8 @@ VIDEO SOFT SWITCHES
$C055 R/W PAGE2ON Select page2 display (or aux video memory)
$C056 R/W HIRESOFF Select low resolution graphics
$C057 R/W HIRESON Select high resolution graphics
$C05E R/W DHIRESOFF Select single (7M) resolution graphics
$C05F R/W DHIRESON Select double (14M) resolution graphics
$C05E R/W DHIRESON Select double (14M) resolution graphics
$C05F R/W DHIRESOFF Select single (7M) resolution graphics
SOFT SWITCH STATUS FLAGS
$C010 R7 AKD 1=key pressed 0=keys free (clears strobe)