diff --git a/AppleWin/resource/Applewin.rc b/AppleWin/resource/Applewin.rc index 62fb3ec5..17f204e9 100644 --- a/AppleWin/resource/Applewin.rc +++ b/AppleWin/resource/Applewin.rc @@ -98,8 +98,6 @@ BEGIN COMBOBOX IDC_SERIALPORT,45,48,100,100,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP PUSHBUTTON "Monochrome Color...",IDC_MONOCOLOR,15,90,80,14 PUSHBUTTON "Ethernet Settings...",IDC_ETHERNET,15,70,78,14 - CONTROL "The Freeze's non-autostart F8 rom (Apple ][ or ][+ only)",IDC_THE_FREEZES_F8_ROM_FW, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,206,182,10 END IDD_PROPPAGE_INPUT DIALOGEX 0, 0, 210, 221 @@ -195,6 +193,17 @@ BEGIN PUSHBUTTON "Cancel",IDCANCEL,80,75,50,14 END +IDD_PROPPAGE_ADVANCED DIALOGEX 0, 0, 210, 221 +STYLE DS_SETFONT | WS_CHILD | WS_VISIBLE | WS_DISABLED | WS_CAPTION | WS_SYSMENU +CAPTION "Advanced" +FONT 8, "MS Sans Serif", 0, 0, 0x0 +BEGIN + LTEXT "&Clone:",-1,5,29,40,8 + COMBOBOX IDC_CLONETYPE,45,27,100,100,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + CONTROL "The Freeze's non-autostart F8 rom (Apple ][ or ][+ only)",IDC_THE_FREEZES_F8_ROM_FW, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,206,182,10 +END + ///////////////////////////////////////////////////////////////////////////// // diff --git a/AppleWin/resource/resource.h b/AppleWin/resource/resource.h index 9bb1763d..a078bb5c 100644 --- a/AppleWin/resource/resource.h +++ b/AppleWin/resource/resource.h @@ -35,6 +35,7 @@ #define IDC_MB_ENABLE 130 #define IDD_TFE_SETTINGS_DIALOG 131 #define IDR_PRINTDRVR_FW 132 +#define IDD_PROPPAGE_ADVANCED 132 #define IDR_DISK2_FW 133 #define IDR_SSC_FW 134 #define IDR_MOCKINGBOARD_D_FW 135 @@ -77,6 +78,7 @@ #define IDC_SCROLLLOCK_TOGGLE 1043 #define IDC_MOUSE_IN_SLOT4 1044 #define IDC_THE_FREEZES_F8_ROM_FW 1045 +#define IDC_CLONETYPE 1046 #define IDM_EXIT 40001 #define IDM_HELP 40002 #define IDM_ABOUT 40003 @@ -91,7 +93,7 @@ #define _APS_NO_MFC 1 #define _APS_NEXT_RESOURCE_VALUE 137 #define _APS_NEXT_COMMAND_VALUE 40007 -#define _APS_NEXT_CONTROL_VALUE 1046 +#define _APS_NEXT_CONTROL_VALUE 1047 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif diff --git a/AppleWin/source/Applewin.cpp b/AppleWin/source/Applewin.cpp index 5fd4c7b0..160adc3c 100644 --- a/AppleWin/source/Applewin.cpp +++ b/AppleWin/source/Applewin.cpp @@ -4,7 +4,7 @@ AppleWin : An Apple //e emulator for Windows Copyright (C) 1994-1996, Michael O'Brien Copyright (C) 1999-2001, Oliver Schmidt Copyright (C) 2002-2005, Tom Charlesworth -Copyright (C) 2006-2007, Tom Charlesworth, Michael Pohoreski +Copyright (C) 2006-2008, Tom Charlesworth, Michael Pohoreski AppleWin is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -382,6 +382,8 @@ void LoadConfiguration () } } + LOAD(TEXT(REGVALUE_CLONETYPE), &g_uCloneType); + LOAD(TEXT("Joystick 0 Emulation"),&joytype[0]); LOAD(TEXT("Joystick 1 Emulation"),&joytype[1]); LOAD(TEXT("Sound Emulation") ,&soundtype); diff --git a/AppleWin/source/Common.h b/AppleWin/source/Common.h index fa81e23a..904d1e50 100644 --- a/AppleWin/source/Common.h +++ b/AppleWin/source/Common.h @@ -83,6 +83,7 @@ enum AppMode_e #define REGVALUE_SCROLLLOCK_TOGGLE "ScrollLock Toggle" #define REGVALUE_MOUSE_IN_SLOT4 "Mouse in slot 4" #define REGVALUE_THE_FREEZES_F8_ROM "The Freeze's F8 Rom" +#define REGVALUE_CLONETYPE "Clone Type" // Preferences #define REGVALUE_PREF_START_DIR TEXT("Starting Directory") diff --git a/AppleWin/source/PropertySheetPage.cpp b/AppleWin/source/PropertySheetPage.cpp index eada402c..6ccafef6 100644 --- a/AppleWin/source/PropertySheetPage.cpp +++ b/AppleWin/source/PropertySheetPage.cpp @@ -4,8 +4,7 @@ AppleWin : An Apple //e emulator for Windows Copyright (C) 1994-1996, Michael O'Brien Copyright (C) 1999-2001, Oliver Schmidt Copyright (C) 2002-2005, Tom Charlesworth -Copyright (C) 2006-2007, Tom Charlesworth, Michael Pohoreski - +Copyright (C) 2006-2008, Tom Charlesworth, Michael Pohoreski AppleWin is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -24,8 +23,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /* Description: Property Sheet Pages * - * Author: Copyright (c) 2002-2006, Tom Charlesworth - * Spiro Trikaliotis + * Author: Tom Charlesworth + * Spiro Trikaliotis */ #include "StdAfx.h" @@ -97,14 +96,30 @@ TCHAR discchoices[] = TEXT("Authentic Speed\0") const UINT VOLUME_MIN = 0; const UINT VOLUME_MAX = 59; -enum {PG_CONFIG=0, PG_INPUT, PG_SOUND, PG_SAVESTATE, PG_DISK, PG_NUM_SHEETS}; +enum {PG_CONFIG=0, PG_INPUT, PG_SOUND, PG_SAVESTATE, PG_DISK, PG_ADVANCED, PG_NUM_SHEETS}; UINT g_nLastPage = PG_CONFIG; -UINT g_uTheFreezesF8Rom = 0; UINT g_uScrollLockToggle = 0; UINT g_uMouseInSlot4 = 0; +// + +UINT g_uTheFreezesF8Rom = 0; + +#define UNDEFINED ((UINT)-1) +static UINT g_bEnableFreezeDlgButton = UNDEFINED; + +// + +enum {CLONETYPE_DISABLED=0, CLONETYPE_PRAVETS82, CLONETYPE_PRAVETS8A, CLONETYPE_NUM}; +DWORD g_uCloneType = CLONETYPE_DISABLED; + +static TCHAR g_CloneChoices[] = TEXT("Disabled\0") + TEXT("Pravets82\0") // Bulgarian + TEXT("Pravets8A\0"); // Bulgarian + + //=========================================================================== static void FillComboBox (HWND window, int controlid, LPCTSTR choices, int currentchoice) @@ -297,7 +312,12 @@ static BOOL CALLBACK ConfigDlgProc (HWND window, switch (((LPPSHNOTIFY)lparam)->hdr.code) { case PSN_KILLACTIVE: - SetWindowLong(window, DWL_MSGRESULT, FALSE); // Changes are valid + // About to stop being active page + { + DWORD NewCompType = (DWORD) SendDlgItemMessage(window, IDC_COMPUTER, CB_GETCURSEL, 0, 0); + g_bEnableFreezeDlgButton = GetApple2Type(NewCompType)<=A2TYPE_APPLE2PLUS ? TRUE : FALSE; + SetWindowLong(window, DWL_MSGRESULT, FALSE); // Changes are valid + } break; case PSN_APPLY: SetWindowLong(window, DWL_MSGRESULT, PSNRET_NOERROR); // Changes are valid @@ -344,34 +364,6 @@ static BOOL CALLBACK ConfigDlgProc (HWND window, VideoChooseColor(); break; - case IDC_COMPUTER: - { - DWORD NewCompType = (DWORD) SendDlgItemMessage(window,IDC_COMPUTER,CB_GETCURSEL,0,0); - EnableWindow(GetDlgItem(window, IDC_THE_FREEZES_F8_ROM_FW), GetApple2Type(NewCompType)<=A2TYPE_APPLE2PLUS ? TRUE : FALSE); - } - break; - - case IDC_THE_FREEZES_F8_ROM_FW: - { - UINT uNewState = IsDlgButtonChecked(window, IDC_THE_FREEZES_F8_ROM_FW) ? 1 : 0; - LPCSTR pMsg = TEXT("The emulator needs to restart as the ROM configuration has changed.\n") - TEXT("Would you like to restart the emulator now?"); - if (MessageBox(window, - pMsg, - TEXT("Configuration"), - MB_ICONQUESTION | MB_YESNO | MB_SETFOREGROUND) == IDYES) - { - g_uTheFreezesF8Rom = uNewState; - afterclose = WM_USER_RESTART; - PropSheet_PressButton(GetParent(window), PSBTN_OK); - } - else - { - CheckDlgButton(window, IDC_THE_FREEZES_F8_ROM_FW, g_uTheFreezesF8Rom ? BST_CHECKED : BST_UNCHECKED); - } - } - break; - #if 0 case IDC_RECALIBRATE: RegSaveValue(TEXT(""),TEXT("RunningOnOS"),0,0); @@ -424,10 +416,6 @@ static BOOL CALLBACK ConfigDlgProc (HWND window, EnableTrackbar(window, custom); } - g_uTheFreezesF8Rom = IS_APPLE2 ? g_uTheFreezesF8Rom : false; - EnableWindow(GetDlgItem(window, IDC_THE_FREEZES_F8_ROM_FW), IS_APPLE2 ? TRUE : FALSE); - CheckDlgButton(window, IDC_THE_FREEZES_F8_ROM_FW, g_uTheFreezesF8Rom ? BST_CHECKED : BST_UNCHECKED); - afterclose = 0; break; } @@ -1074,6 +1062,115 @@ static BOOL CALLBACK DiskDlgProc (HWND window, return 0; } +//=========================================================================== + +static void AdvancedDlg_OK(HWND window, UINT afterclose) +{ + g_uCloneType = (DWORD)SendDlgItemMessage(window, IDC_CLONETYPE, CB_GETCURSEL, 0, 0); + + SAVE(TEXT(REGVALUE_CLONETYPE), g_uCloneType); + SAVE(TEXT(REGVALUE_THE_FREEZES_F8_ROM),g_uTheFreezesF8Rom); // NB. Can also be disabled on Config page (when Apple2Type changes) + + // + + if (afterclose) + PostMessage(g_hFrameWindow,afterclose,0,0); +} + +static void AdvancedDlg_CANCEL(HWND window) +{ +} + +//--------------------------------------------------------------------------- + +static void InitFreezeDlgButton(HWND window) +{ + if (g_bEnableFreezeDlgButton == UNDEFINED) + EnableWindow(GetDlgItem(window, IDC_THE_FREEZES_F8_ROM_FW), IS_APPLE2 ? TRUE : FALSE); + else + EnableWindow(GetDlgItem(window, IDC_THE_FREEZES_F8_ROM_FW), g_bEnableFreezeDlgButton ? TRUE : FALSE); + + CheckDlgButton(window, IDC_THE_FREEZES_F8_ROM_FW, g_uTheFreezesF8Rom ? BST_CHECKED : BST_UNCHECKED); +} + +static BOOL CALLBACK AdvancedDlgProc (HWND window, + UINT message, + WPARAM wparam, + LPARAM lparam) +{ + static UINT afterclose = 0; + + switch (message) + { + case WM_NOTIFY: + { + // Property Sheet notifications + + switch (((LPPSHNOTIFY)lparam)->hdr.code) + { + case PSN_SETACTIVE: + // About to become the active page + InitFreezeDlgButton(window); + break; + case PSN_KILLACTIVE: + SetWindowLong(window, DWL_MSGRESULT, FALSE); // Changes are valid + break; + case PSN_APPLY: + SetWindowLong(window, DWL_MSGRESULT, PSNRET_NOERROR); // Changes are valid + AdvancedDlg_OK(window, afterclose); + break; + case PSN_QUERYCANCEL: + // Can use this to ask user to confirm cancel + break; + case PSN_RESET: + SoundDlg_CANCEL(window); + break; + } + } + break; + + case WM_COMMAND: + switch (LOWORD(wparam)) + { + case IDC_THE_FREEZES_F8_ROM_FW: + { + UINT uNewState = IsDlgButtonChecked(window, IDC_THE_FREEZES_F8_ROM_FW) ? 1 : 0; + LPCSTR pMsg = TEXT("The emulator needs to restart as the ROM configuration has changed.\n") + TEXT("Would you like to restart the emulator now?"); + if (MessageBox(window, + pMsg, + TEXT("Configuration"), + MB_ICONQUESTION | MB_YESNO | MB_SETFOREGROUND) == IDYES) + { + g_uTheFreezesF8Rom = uNewState; + afterclose = WM_USER_RESTART; + PropSheet_PressButton(GetParent(window), PSBTN_OK); + } + else + { + CheckDlgButton(window, IDC_THE_FREEZES_F8_ROM_FW, g_uTheFreezesF8Rom ? BST_CHECKED : BST_UNCHECKED); + } + } + break; + } + break; + + case WM_INITDIALOG: + { + g_nLastPage = PG_ADVANCED; + + FillComboBox(window, IDC_CLONETYPE, g_CloneChoices, g_uCloneType); + InitFreezeDlgButton(window); + + afterclose = 0; + } + } + + return 0; +} + +//=========================================================================== + static BOOL get_tfename(int number, char **ppname, char **ppdescription) { if (tfe_enumadapter_open()) { @@ -1348,6 +1445,12 @@ void PSP_Init() PropSheetPages[PG_DISK].pszTemplate = MAKEINTRESOURCE(IDD_PROPPAGE_DISK); PropSheetPages[PG_DISK].pfnDlgProc = (DLGPROC)DiskDlgProc; + PropSheetPages[PG_ADVANCED].dwSize = sizeof(PROPSHEETPAGE); + PropSheetPages[PG_ADVANCED].dwFlags = PSP_DEFAULT; + PropSheetPages[PG_ADVANCED].hInstance = g_hInstance; + PropSheetPages[PG_ADVANCED].pszTemplate = MAKEINTRESOURCE(IDD_PROPPAGE_ADVANCED); + PropSheetPages[PG_ADVANCED].pfnDlgProc = (DLGPROC)AdvancedDlgProc; + PROPSHEETHEADER PropSheetHeader; PropSheetHeader.dwSize = sizeof(PROPSHEETHEADER); @@ -1358,6 +1461,7 @@ void PSP_Init() PropSheetHeader.nStartPage = g_nLastPage; PropSheetHeader.ppsp = PropSheetPages; + g_bEnableFreezeDlgButton = UNDEFINED; int i = PropertySheet(&PropSheetHeader); // Result: 0=Cancel, 1=OK } diff --git a/AppleWin/source/PropertySheetPage.h b/AppleWin/source/PropertySheetPage.h index 55febda4..5cd1d3b8 100644 --- a/AppleWin/source/PropertySheetPage.h +++ b/AppleWin/source/PropertySheetPage.h @@ -7,6 +7,7 @@ void ui_tfe_settings_dialog(HWND hwnd); void * get_tfe_interface(void); void get_tfe_enabled(int *tfe_enabled); -extern UINT g_uTheFreezesF8Rom; extern UINT g_uScrollLockToggle; extern UINT g_uMouseInSlot4; +extern UINT g_uTheFreezesF8Rom; +extern DWORD g_uCloneType;