2009-02-16 20:19:41 +00:00
/*
2006-02-25 20:50:29 +00:00
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
2009-02-14 03:48:42 +00:00
Copyright ( C ) 2006 - 2009 , Tom Charlesworth , Michael Pohoreski
2006-03-24 06:34:37 +00:00
2006-02-25 20:50:29 +00:00
AppleWin is free software ; you can redistribute it and / or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation ; either version 2 of the License , or
( at your option ) any later version .
AppleWin is distributed in the hope that it will be useful ,
but WITHOUT ANY WARRANTY ; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
GNU General Public License for more details .
You should have received a copy of the GNU General Public License
along with AppleWin ; if not , write to the Free Software
Foundation , Inc . , 59 Temple Place , Suite 330 , Boston , MA 02111 - 1307 USA
*/
/* Description: Property Sheet Pages
*
2008-04-11 21:54:06 +00:00
* Author : Tom Charlesworth
* Spiro Trikaliotis < Spiro . Trikaliotis @ gmx . de >
2006-02-25 20:50:29 +00:00
*/
# include "StdAfx.h"
2010-01-03 18:43:08 +00:00
# include "Harddisk.h"
2006-02-25 20:50:29 +00:00
# include "..\resource\resource.h"
2006-03-24 06:34:37 +00:00
# include "Tfe\Tfesupp.h"
# include "Tfe\Uilib.h"
2006-02-25 20:50:29 +00:00
2007-05-28 11:16:42 +00:00
TCHAR computerchoices [ ] =
2009-02-14 03:48:42 +00:00
TEXT ( " Apple ][ (Original) \0 " )
2007-05-28 11:16:42 +00:00
TEXT ( " Apple ][+ \0 " )
TEXT ( " Apple //e \0 " )
2008-06-20 23:47:25 +00:00
TEXT ( " Enhanced Apple //e \0 " )
TEXT ( " Clone \0 " ) ;
2006-02-25 20:50:29 +00:00
TCHAR * szJoyChoice0 = TEXT ( " Disabled \0 " ) ;
TCHAR * szJoyChoice1 = TEXT ( " PC Joystick #1 \0 " ) ;
TCHAR * szJoyChoice2 = TEXT ( " PC Joystick #2 \0 " ) ;
TCHAR * szJoyChoice3 = TEXT ( " Keyboard (standard) \0 " ) ;
TCHAR * szJoyChoice4 = TEXT ( " Keyboard (centering) \0 " ) ;
TCHAR * szJoyChoice5 = TEXT ( " Mouse \0 " ) ;
2009-12-12 11:04:22 +00:00
static const int g_nMaxJoyChoiceLen = 40 ;
2008-06-20 23:47:25 +00:00
//eApple2Type NewApple2Type = 0;
2009-12-12 11:04:22 +00:00
static DWORD NewApple2Type = 0 ; // TC-FIXME: Also a local NewApple2Type!
static DWORD NewCloneType = 0 ; // TC-FIXME: Also a local NewCloneType!
2006-02-25 20:50:29 +00:00
enum JOY0CHOICE { J0C_DISABLED = 0 , J0C_JOYSTICK1 , J0C_KEYBD_STANDARD , J0C_KEYBD_CENTERING , J0C_MOUSE , J0C_MAX } ;
TCHAR * pszJoy0Choices [ J0C_MAX ] = { szJoyChoice0 ,
szJoyChoice1 , // PC Joystick #1
szJoyChoice3 ,
szJoyChoice4 ,
szJoyChoice5 } ;
int g_nJoy0ChoiceTranlationTbl [ J0C_MAX ] ;
TCHAR joystick0choices [ J0C_MAX * g_nMaxJoyChoiceLen ] ;
enum JOY1CHOICE { J1C_DISABLED = 0 , J1C_JOYSTICK2 , J1C_KEYBD_STANDARD , J1C_KEYBD_CENTERING , J1C_MOUSE , J1C_MAX } ;
TCHAR * pszJoy1Choices [ J1C_MAX ] = { szJoyChoice0 ,
szJoyChoice2 , // PC Joystick #2
szJoyChoice3 ,
szJoyChoice4 ,
szJoyChoice5 } ;
int g_nJoy1ChoiceTranlationTbl [ J1C_MAX ] ;
TCHAR joystick1choices [ J1C_MAX * g_nMaxJoyChoiceLen ] ;
TCHAR soundchoices [ ] = TEXT ( " Disabled \0 " )
TEXT ( " PC Speaker (direct) \0 " )
TEXT ( " PC Speaker (translated) \0 " )
TEXT ( " Sound Card \0 " ) ;
2009-02-18 16:05:39 +00:00
// Must match NUM_VIDEO_MODES!
2006-03-01 00:23:42 +00:00
TCHAR videochoices [ ] =
TEXT ( " Monochrome (Custom) \0 " )
TEXT ( " Color (standard) \0 " )
TEXT ( " Color (text optimized) \0 " )
TEXT ( " Color (TV emulation) \0 " )
TEXT ( " Color (Half-Shift) \0 " )
TEXT ( " Monochrome - Amber \0 " )
TEXT ( " Monochrome - Green \0 " )
TEXT ( " Monochrome - White \0 " )
;
2006-02-25 20:50:29 +00:00
2009-02-18 16:05:39 +00:00
char * g_apVideoModeDesc [ NUM_VIDEO_MODES ] =
{
" Custom " ,
" Std. " ,
" Text " ,
" TV " ,
2009-02-18 16:54:57 +00:00
" HalfPixel " ,
2009-02-18 16:05:39 +00:00
" Amber " ,
" Green " ,
" White "
} ;
2006-02-25 20:50:29 +00:00
TCHAR discchoices [ ] = TEXT ( " Authentic Speed \0 " )
TEXT ( " Enhanced Speed \0 " ) ;
const UINT VOLUME_MIN = 0 ;
const UINT VOLUME_MAX = 59 ;
2008-05-17 23:20:33 +00:00
enum { PG_CONFIG = 0 , PG_INPUT , PG_SOUND , PG_DISK , PG_ADVANCED , PG_NUM_SHEETS } ;
2006-02-25 20:50:29 +00:00
UINT g_nLastPage = PG_CONFIG ;
2009-02-14 03:48:42 +00:00
// TODO: CLEANUP! Move to peripherals.cpp !!!
// g_nConfig_
2007-08-06 21:38:35 +00:00
UINT g_uScrollLockToggle = 0 ;
UINT g_uMouseInSlot4 = 0 ;
2008-05-17 23:20:33 +00:00
UINT g_uMouseShowCrosshair = 0 ;
2008-05-18 18:23:25 +00:00
UINT g_uMouseRestrictToWindow = 0 ;
2007-08-06 21:38:35 +00:00
2008-08-19 21:36:31 +00:00
UINT g_uZ80InSlot5 = 0 ;
2009-01-06 22:02:31 +00:00
2008-04-11 21:54:06 +00:00
//
UINT g_uTheFreezesF8Rom = 0 ;
# define UNDEFINED ((UINT)-1)
static UINT g_bEnableFreezeDlgButton = UNDEFINED ;
//
2009-12-12 11:04:22 +00:00
enum
{
2008-06-20 23:47:25 +00:00
CLONETYPE_PRAVETS82 = 0 ,
2009-01-09 21:59:22 +00:00
CLONETYPE_PRAVETS8M ,
2008-06-20 23:47:25 +00:00
CLONETYPE_PRAVETS8A ,
CLONETYPE_NUM
} ;
2009-12-12 11:04:22 +00:00
DWORD g_uCloneType = CLONETYPE_PRAVETS82 ;
2008-04-11 21:54:06 +00:00
2008-06-20 23:47:25 +00:00
static TCHAR g_CloneChoices [ ] = TEXT ( " Pravets 82 \0 " ) // Bulgarian
2009-01-09 21:59:22 +00:00
TEXT ( " Pravets 8M \0 " ) // Bulgarian
2008-06-20 23:47:25 +00:00
TEXT ( " Pravets 8A \0 " ) ; // Bulgarian
2008-04-11 21:54:06 +00:00
2006-02-25 20:50:29 +00:00
//===========================================================================
2009-12-12 11:04:22 +00:00
static void FillComboBox ( HWND window , int controlid , LPCTSTR choices , int currentchoice )
2006-02-25 20:50:29 +00:00
{
2009-12-12 11:04:22 +00:00
_ASSERT ( choices ) ;
HWND combowindow = GetDlgItem ( window , controlid ) ;
SendMessage ( combowindow , CB_RESETCONTENT , 0 , 0 ) ;
while ( choices & & * choices )
{
SendMessage ( combowindow , CB_ADDSTRING , 0 , ( LPARAM ) ( LPCTSTR ) choices ) ;
choices + = _tcslen ( choices ) + 1 ;
}
SendMessage ( combowindow , CB_SETCURSEL , currentchoice , 0 ) ;
2006-02-25 20:50:29 +00:00
}
//===========================================================================
2009-12-12 11:04:22 +00:00
static void EnableTrackbar ( HWND window , BOOL enable )
2006-02-25 20:50:29 +00:00
{
2009-12-12 11:04:22 +00:00
EnableWindow ( GetDlgItem ( window , IDC_SLIDER_CPU_SPEED ) , enable ) ;
EnableWindow ( GetDlgItem ( window , IDC_0_5_MHz ) , enable ) ;
EnableWindow ( GetDlgItem ( window , IDC_1_0_MHz ) , enable ) ;
EnableWindow ( GetDlgItem ( window , IDC_2_0_MHz ) , enable ) ;
EnableWindow ( GetDlgItem ( window , IDC_MAX_MHz ) , enable ) ;
2006-02-25 20:50:29 +00:00
}
//===========================================================================
static void InitJoystickChoices ( HWND window , int nJoyNum , int nIdcValue )
{
2009-12-12 11:04:22 +00:00
TCHAR * pszMem ;
int nIdx ;
unsigned long i ;
TCHAR * pnzJoystickChoices ;
int * pnJoyTranslationTbl ;
int nJoyTranslationTblSize ;
unsigned short nJC_DISABLED , nJC_JOYSTICK , nJC_KEYBD_STANDARD , nJC_KEYBD_CENTERING , nJC_MAX ;
TCHAR * * ppszJoyChoices ;
int nOtherJoyNum = nJoyNum = = JN_JOYSTICK0 ? JN_JOYSTICK1 : JN_JOYSTICK0 ;
if ( nJoyNum = = JN_JOYSTICK0 )
{
pnzJoystickChoices = joystick0choices ;
pnJoyTranslationTbl = g_nJoy0ChoiceTranlationTbl ;
nJoyTranslationTblSize = sizeof ( g_nJoy0ChoiceTranlationTbl ) ;
nJC_DISABLED = J0C_DISABLED ;
nJC_JOYSTICK = J0C_JOYSTICK1 ;
nJC_KEYBD_STANDARD = J0C_KEYBD_STANDARD ;
nJC_KEYBD_CENTERING = J0C_KEYBD_CENTERING ;
nJC_MAX = J0C_MAX ;
ppszJoyChoices = pszJoy0Choices ;
}
else
{
pnzJoystickChoices = joystick1choices ;
pnJoyTranslationTbl = g_nJoy1ChoiceTranlationTbl ;
nJoyTranslationTblSize = sizeof ( g_nJoy1ChoiceTranlationTbl ) ;
nJC_DISABLED = J1C_DISABLED ;
nJC_JOYSTICK = J1C_JOYSTICK2 ;
nJC_KEYBD_STANDARD = J1C_KEYBD_STANDARD ;
nJC_KEYBD_CENTERING = J1C_KEYBD_CENTERING ;
nJC_MAX = J1C_MAX ;
ppszJoyChoices = pszJoy1Choices ;
}
pszMem = pnzJoystickChoices ;
nIdx = 0 ;
memset ( pnJoyTranslationTbl , - 1 , nJoyTranslationTblSize ) ;
// Build the Joystick choices string list. These first 2 are always selectable.
memcpy ( pszMem , ppszJoyChoices [ nJC_DISABLED ] , strlen ( ppszJoyChoices [ nJC_DISABLED ] ) + 1 ) ;
pszMem + = strlen ( ppszJoyChoices [ nJC_DISABLED ] ) + 1 ;
pnJoyTranslationTbl [ nIdx + + ] = nJC_DISABLED ;
memcpy ( pszMem , ppszJoyChoices [ nJC_JOYSTICK ] , strlen ( ppszJoyChoices [ nJC_JOYSTICK ] ) + 1 ) ;
pszMem + = strlen ( ppszJoyChoices [ nJC_JOYSTICK ] ) + 1 ;
pnJoyTranslationTbl [ nIdx + + ] = nJC_JOYSTICK ;
// Now exclude the other Joystick type (if it exists) from this new list
for ( i = nJC_KEYBD_STANDARD ; i < nJC_MAX ; i + + )
{
2006-02-25 20:50:29 +00:00
if ( ( ( i = = nJC_KEYBD_STANDARD ) | | ( i = = nJC_KEYBD_CENTERING ) ) & &
2009-12-12 11:04:22 +00:00
( ( joytype [ nOtherJoyNum ] = = nJC_KEYBD_STANDARD ) | | ( joytype [ nOtherJoyNum ] = = nJC_KEYBD_CENTERING ) )
2006-02-25 20:50:29 +00:00
)
2009-12-12 11:04:22 +00:00
{
continue ;
}
2006-02-25 20:50:29 +00:00
2009-12-12 11:04:22 +00:00
if ( joytype [ nOtherJoyNum ] ! = i )
2006-02-25 20:50:29 +00:00
{
2009-12-12 11:04:22 +00:00
memcpy ( pszMem , ppszJoyChoices [ i ] , strlen ( ppszJoyChoices [ i ] ) + 1 ) ;
pszMem + = strlen ( ppszJoyChoices [ i ] ) + 1 ;
pnJoyTranslationTbl [ nIdx + + ] = i ;
2006-02-25 20:50:29 +00:00
}
2009-12-12 11:04:22 +00:00
}
2006-02-25 20:50:29 +00:00
2009-12-12 11:04:22 +00:00
* pszMem = 0x00 ; // Doubly null terminated
2006-02-25 20:50:29 +00:00
2009-12-12 11:04:22 +00:00
FillComboBox ( window , nIdcValue , pnzJoystickChoices , joytype [ nJoyNum ] ) ;
2006-02-25 20:50:29 +00:00
}
//===========================================================================
2008-06-20 23:47:25 +00:00
static eApple2Type GetApple2Type ( DWORD NewCompType , DWORD NewCloneType )
2006-02-25 20:50:29 +00:00
{
2008-02-22 21:28:35 +00:00
switch ( NewCompType )
2007-05-28 11:16:42 +00:00
{
2008-02-22 21:28:35 +00:00
case 0 : return A2TYPE_APPLE2 ;
case 1 : return A2TYPE_APPLE2PLUS ;
case 2 : return A2TYPE_APPLE2E ;
case 3 : return A2TYPE_APPLE2EEHANCED ;
2008-06-20 23:47:25 +00:00
case 4 : // Clone
switch ( NewCloneType )
{
case 0 : return A2TYPE_PRAVETS82 ; break ;
2009-01-09 21:59:22 +00:00
case 1 : return A2TYPE_PRAVETS8M ; break ;
case 2 : return A2TYPE_PRAVETS8A ; break ;
2008-06-20 23:47:25 +00:00
}
2008-02-22 21:28:35 +00:00
default : return A2TYPE_APPLE2EEHANCED ;
2007-05-28 11:16:42 +00:00
}
2008-02-22 21:28:35 +00:00
}
2009-02-14 03:48:42 +00:00
// ====================================================================
2009-12-12 11:04:22 +00:00
2009-02-14 03:48:42 +00:00
void Config_Save_Video ( )
{
2009-02-16 19:13:55 +00:00
REGSAVE ( TEXT ( REGVALUE_VIDEO_MODE ) , g_eVideoType ) ;
2009-02-14 03:48:42 +00:00
REGSAVE ( TEXT ( REGVALUE_VIDEO_HALF_SCAN_LINES ) , g_uHalfScanLines ) ;
REGSAVE ( TEXT ( REGVALUE_VIDEO_MONO_COLOR ) , monochrome ) ;
}
// ====================================================================
2009-12-12 11:04:22 +00:00
2009-02-14 03:48:42 +00:00
void Config_Load_Video ( )
{
2009-02-16 19:13:55 +00:00
REGLOAD ( TEXT ( REGVALUE_VIDEO_MODE ) , & g_eVideoType ) ;
2009-02-14 03:48:42 +00:00
REGLOAD ( TEXT ( REGVALUE_VIDEO_HALF_SCAN_LINES ) , & g_uHalfScanLines ) ;
REGLOAD ( TEXT ( REGVALUE_VIDEO_MONO_COLOR ) , & monochrome ) ;
2010-08-17 07:52:23 +00:00
if ( g_eVideoType > = NUM_VIDEO_MODES )
g_eVideoType = VT_COLOR_TVEMU ;
2009-02-14 03:48:42 +00:00
}
2008-02-22 21:28:35 +00:00
static void ConfigDlg_OK ( HWND window , UINT afterclose )
{
DWORD NewCompType = ( DWORD ) SendDlgItemMessage ( window , IDC_COMPUTER , CB_GETCURSEL , 0 , 0 ) ;
2008-11-25 22:33:05 +00:00
DWORD OldApple2Type = g_Apple2Type ;
2008-06-20 23:47:25 +00:00
eApple2Type NewApple2Type = GetApple2Type ( NewCompType , 0 ) ;
2007-05-28 11:16:42 +00:00
2006-02-25 20:50:29 +00:00
DWORD newvidtype = ( DWORD ) SendDlgItemMessage ( window , IDC_VIDEOTYPE , CB_GETCURSEL , 0 , 0 ) ;
DWORD newserialport = ( DWORD ) SendDlgItemMessage ( window , IDC_SERIALPORT , CB_GETCURSEL , 0 , 0 ) ;
2008-06-20 23:47:25 +00:00
if ( OldApple2Type > ( APPLECLONE_MASK | APPLE2E_MASK ) )
OldApple2Type = ( APPLECLONE_MASK | APPLE2E_MASK ) ;
if ( NewApple2Type ! = OldApple2Type )
2006-02-25 20:50:29 +00:00
{
2008-02-22 21:28:35 +00:00
if ( ( afterclose = = WM_USER_RESTART ) | | // Eg. Changing 'Freeze ROM' & user has already OK'd the restart for this
MessageBox ( window ,
2007-08-06 21:38:35 +00:00
TEXT (
" You have changed the emulated computer "
" type. This change will not take effect "
" until the next time you restart the "
" emulator. \n \n "
" Would you like to restart the emulator now? " ) ,
TEXT ( " Configuration " ) ,
MB_ICONQUESTION | MB_YESNO | MB_SETFOREGROUND ) = = IDYES )
{
2006-02-25 20:50:29 +00:00
afterclose = WM_USER_RESTART ;
2007-08-06 21:38:35 +00:00
}
2006-02-25 20:50:29 +00:00
}
2009-02-16 19:13:55 +00:00
if ( g_eVideoType ! = newvidtype )
2006-02-25 20:50:29 +00:00
{
2009-02-16 19:13:55 +00:00
g_eVideoType = newvidtype ;
2006-02-25 20:50:29 +00:00
VideoReinitialize ( ) ;
2006-06-12 22:06:50 +00:00
if ( ( g_nAppMode ! = MODE_LOGO ) & & ( g_nAppMode ! = MODE_DEBUG ) )
2009-02-14 03:48:42 +00:00
{
2006-02-25 20:50:29 +00:00
VideoRedrawScreen ( ) ;
2009-02-14 03:48:42 +00:00
}
2006-02-25 20:50:29 +00:00
}
2007-05-28 11:16:42 +00:00
sg_SSC . CommSetSerialPort ( window , newserialport ) ;
2006-02-25 20:50:29 +00:00
if ( IsDlgButtonChecked ( window , IDC_AUTHENTIC_SPEED ) )
g_dwSpeed = SPEED_NORMAL ;
else
g_dwSpeed = SendDlgItemMessage ( window , IDC_SLIDER_CPU_SPEED , TBM_GETPOS , 0 , 0 ) ;
SetCurrentCLK6502 ( ) ;
2008-06-20 23:47:25 +00:00
if ( NewApple2Type > A2TYPE_CLONE )
2009-12-12 11:04:22 +00:00
NewCloneType = NewApple2Type - A2TYPE_CLONE ; // TC-FIXME: Must be global scope (ie. g_NewCloneType)
2008-06-20 23:47:25 +00:00
2009-01-09 21:59:22 +00:00
if ( ( NewApple2Type = = A2TYPE_PRAVETS82 ) | | ( NewApple2Type = = A2TYPE_PRAVETS8A ) | | ( NewApple2Type = = A2TYPE_PRAVETS8M ) )
2009-01-09 23:27:29 +00:00
REGSAVE ( TEXT ( REGVALUE_APPLE2_TYPE ) , A2TYPE_CLONE ) ;
2008-06-20 23:47:25 +00:00
else
2009-01-09 23:27:29 +00:00
REGSAVE ( TEXT ( REGVALUE_APPLE2_TYPE ) , NewApple2Type ) ;
2008-06-20 23:47:25 +00:00
2009-10-07 21:38:42 +00:00
RegSaveString ( TEXT ( " Configuration " ) ,
TEXT ( REGVALUE_SERIAL_PORT_NAME ) ,
TRUE ,
sg_SSC . GetSerialPortName ( ) ) ;
2009-01-09 23:27:29 +00:00
REGSAVE ( TEXT ( " Custom Speed " ) , IsDlgButtonChecked ( window , IDC_CUSTOM_SPEED ) ) ;
REGSAVE ( TEXT ( " Emulation Speed " ) , g_dwSpeed ) ;
2009-02-14 03:48:42 +00:00
Config_Save_Video ( ) ;
2006-02-25 20:50:29 +00:00
//
if ( afterclose )
2006-05-14 00:44:38 +00:00
PostMessage ( g_hFrameWindow , afterclose , 0 , 0 ) ;
2006-02-25 20:50:29 +00:00
}
static void ConfigDlg_CANCEL ( HWND window )
{
}
//---------------------------------------------------------------------------
2009-12-12 11:04:22 +00:00
static BOOL CALLBACK ConfigDlgProc ( HWND window ,
UINT message ,
WPARAM wparam ,
LPARAM lparam )
{
static UINT afterclose = 0 ;
2006-02-25 20:50:29 +00:00
2009-12-12 11:04:22 +00:00
switch ( message )
2006-02-25 20:50:29 +00:00
{
2009-12-12 11:04:22 +00:00
case WM_NOTIFY :
{
// Property Sheet notifications
2006-02-25 20:50:29 +00:00
2009-12-12 11:04:22 +00:00
switch ( ( ( LPPSHNOTIFY ) lparam ) - > hdr . code )
2008-04-11 21:54:06 +00:00
{
2009-12-12 11:04:22 +00:00
case PSN_KILLACTIVE :
// About to stop being active page
{
DWORD NewCompType = ( DWORD ) SendDlgItemMessage ( window , IDC_COMPUTER , CB_GETCURSEL , 0 , 0 ) ;
g_bEnableFreezeDlgButton = GetApple2Type ( NewCompType , 0 ) < = 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
ConfigDlg_OK ( window , afterclose ) ;
break ;
case PSN_QUERYCANCEL :
// Can use this to ask user to confirm cancel
break ;
case PSN_RESET :
ConfigDlg_CANCEL ( window ) ;
break ;
2008-04-11 21:54:06 +00:00
}
2009-12-12 11:04:22 +00:00
}
break ;
case WM_COMMAND :
switch ( LOWORD ( wparam ) )
{
case IDC_AUTHENTIC_SPEED : // Authentic Machine Speed
SendDlgItemMessage ( window , IDC_SLIDER_CPU_SPEED , TBM_SETPOS , 1 , SPEED_NORMAL ) ;
EnableTrackbar ( window , 0 ) ;
2006-02-25 20:50:29 +00:00
break ;
2009-12-12 11:04:22 +00:00
case IDC_CUSTOM_SPEED : // Select Custom Speed
SetFocus ( GetDlgItem ( window , IDC_SLIDER_CPU_SPEED ) ) ;
EnableTrackbar ( window , 1 ) ;
2006-02-25 20:50:29 +00:00
break ;
2009-12-12 11:04:22 +00:00
case IDC_SLIDER_CPU_SPEED : // CPU speed slider
CheckRadioButton ( window , IDC_AUTHENTIC_SPEED , IDC_CUSTOM_SPEED , IDC_CUSTOM_SPEED ) ;
EnableTrackbar ( window , 1 ) ;
2006-02-25 20:50:29 +00:00
break ;
2009-12-12 11:04:22 +00:00
case IDC_BENCHMARK :
afterclose = WM_USER_BENCHMARK ;
PropSheet_PressButton ( GetParent ( window ) , PSBTN_OK ) ;
2006-02-25 20:50:29 +00:00
break ;
2008-02-22 21:28:35 +00:00
case IDC_ETHERNET :
2009-12-12 11:04:22 +00:00
ui_tfe_settings_dialog ( window ) ;
break ;
case IDC_MONOCOLOR :
VideoChooseColor ( ) ;
break ;
2006-02-25 20:50:29 +00:00
2009-02-14 03:48:42 +00:00
case IDC_CHECK_HALF_SCAN_LINES :
2009-12-12 11:04:22 +00:00
g_uHalfScanLines = IsDlgButtonChecked ( window , IDC_CHECK_HALF_SCAN_LINES ) ? 1 : 0 ;
2009-02-14 03:48:42 +00:00
2006-02-25 20:50:29 +00:00
#if 0
2009-12-12 11:04:22 +00:00
case IDC_RECALIBRATE :
RegSaveValue ( TEXT ( " " ) , TEXT ( " RunningOnOS " ) , 0 , 0 ) ;
if ( MessageBox ( window ,
TEXT ( " The emulator has been set to recalibrate " )
TEXT ( " itself the next time it is started. \n \n " )
TEXT ( " Would you like to restart the emulator now? " ) ,
TEXT ( " Configuration " ) ,
MB_ICONQUESTION | MB_YESNO | MB_SETFOREGROUND ) = = IDYES )
{
afterclose = WM_USER_RESTART ;
PropSheet_PressButton ( GetParent ( window ) , PSBTN_OK ) ;
}
break ;
2006-02-25 20:50:29 +00:00
# endif
2009-12-12 11:04:22 +00:00
} // switch( (LOWORD(wparam))
break ; // WM_COMMAND
2006-02-25 20:50:29 +00:00
2009-12-12 11:04:22 +00:00
case WM_HSCROLL :
CheckRadioButton ( window , IDC_AUTHENTIC_SPEED , IDC_CUSTOM_SPEED , IDC_CUSTOM_SPEED ) ; // FirstButton, LastButton, CheckButton
break ;
2006-02-25 20:50:29 +00:00
2009-12-12 11:04:22 +00:00
case WM_INITDIALOG : //Init general settings dialog
2009-02-18 16:05:39 +00:00
{
2009-12-12 11:04:22 +00:00
g_nLastPage = PG_CONFIG ;
UINT iApple2String = 0 ;
switch ( g_Apple2Type )
{
2009-02-18 16:05:39 +00:00
default :
case A2TYPE_APPLE2 : iApple2String = 0 ; break ;
case A2TYPE_APPLE2PLUS : iApple2String = 1 ; break ;
case A2TYPE_APPLE2E : iApple2String = 2 ; break ;
case A2TYPE_APPLE2EEHANCED : iApple2String = 3 ; break ;
case A2TYPE_PRAVETS82 : iApple2String = 4 ; break ;
case A2TYPE_PRAVETS8M : iApple2String = 5 ; break ;
case A2TYPE_PRAVETS8A : iApple2String = 6 ; break ;
2009-12-12 11:04:22 +00:00
}
if ( iApple2String > 3 )
FillComboBox ( window , IDC_COMPUTER , computerchoices , 4 ) ;
else
FillComboBox ( window , IDC_COMPUTER , computerchoices , iApple2String ) ;
2007-05-28 11:16:42 +00:00
2009-12-12 11:04:22 +00:00
FillComboBox ( window , IDC_VIDEOTYPE , videochoices , g_eVideoType ) ;
CheckDlgButton ( window , IDC_CHECK_HALF_SCAN_LINES , g_uHalfScanLines ? BST_CHECKED : BST_UNCHECKED ) ;
2008-06-20 23:47:25 +00:00
2009-12-12 11:04:22 +00:00
FillComboBox ( window , IDC_SERIALPORT , sg_SSC . GetSerialPortChoices ( ) , sg_SSC . GetSerialPort ( ) ) ;
EnableWindow ( GetDlgItem ( window , IDC_SERIALPORT ) , ! sg_SSC . IsActive ( ) ? TRUE : FALSE ) ;
2009-10-07 21:38:42 +00:00
2009-12-12 11:04:22 +00:00
SendDlgItemMessage ( window , IDC_SLIDER_CPU_SPEED , TBM_SETRANGE , 1 , MAKELONG ( 0 , 40 ) ) ;
SendDlgItemMessage ( window , IDC_SLIDER_CPU_SPEED , TBM_SETPAGESIZE , 0 , 5 ) ;
SendDlgItemMessage ( window , IDC_SLIDER_CPU_SPEED , TBM_SETTICFREQ , 10 , 0 ) ;
SendDlgItemMessage ( window , IDC_SLIDER_CPU_SPEED , TBM_SETPOS , 1 , g_dwSpeed ) ;
2009-10-07 21:38:42 +00:00
2009-12-12 11:04:22 +00:00
{
BOOL custom = 1 ;
if ( g_dwSpeed = = SPEED_NORMAL )
{
custom = 0 ;
REGLOAD ( TEXT ( " Custom Speed " ) , ( DWORD * ) & custom ) ;
}
CheckRadioButton ( window , IDC_AUTHENTIC_SPEED , IDC_CUSTOM_SPEED , custom ? IDC_CUSTOM_SPEED : IDC_AUTHENTIC_SPEED ) ;
SetFocus ( GetDlgItem ( window , custom ? IDC_SLIDER_CPU_SPEED : IDC_AUTHENTIC_SPEED ) ) ;
EnableTrackbar ( window , custom ) ;
}
2008-06-20 23:47:25 +00:00
2009-12-12 11:04:22 +00:00
afterclose = 0 ;
break ;
}
case WM_LBUTTONDOWN :
2008-06-20 23:47:25 +00:00
{
2009-12-12 11:04:22 +00:00
POINT pt = { LOWORD ( lparam ) , HIWORD ( lparam ) } ;
ClientToScreen ( window , & pt ) ;
RECT rect ;
GetWindowRect ( GetDlgItem ( window , IDC_SLIDER_CPU_SPEED ) , & rect ) ;
if ( ( pt . x > = rect . left ) & & ( pt . x < = rect . right ) & &
( pt . y > = rect . top ) & & ( pt . y < = rect . bottom ) )
{
CheckRadioButton ( window , IDC_AUTHENTIC_SPEED , IDC_CUSTOM_SPEED , IDC_CUSTOM_SPEED ) ;
EnableTrackbar ( window , 1 ) ;
SetFocus ( GetDlgItem ( window , IDC_SLIDER_CPU_SPEED ) ) ;
ScreenToClient ( GetDlgItem ( window , IDC_SLIDER_CPU_SPEED ) , & pt ) ;
PostMessage ( GetDlgItem ( window , IDC_SLIDER_CPU_SPEED ) , WM_LBUTTONDOWN , wparam , MAKELONG ( pt . x , pt . y ) ) ;
}
break ;
}
case WM_SYSCOLORCHANGE :
SendDlgItemMessage ( window , IDC_SLIDER_CPU_SPEED , WM_SYSCOLORCHANGE , 0 , 0 ) ;
break ;
2006-02-25 20:50:29 +00:00
}
2009-12-12 11:04:22 +00:00
return 0 ;
2006-02-25 20:50:29 +00:00
}
//===========================================================================
2008-02-22 21:28:35 +00:00
static void InputDlg_OK ( HWND window , UINT afterclose )
2006-02-25 20:50:29 +00:00
{
2008-05-18 18:23:25 +00:00
UINT uNewJoyType0 = SendDlgItemMessage ( window , IDC_JOYSTICK0 , CB_GETCURSEL , 0 , 0 ) ;
UINT uNewJoyType1 = SendDlgItemMessage ( window , IDC_JOYSTICK1 , CB_GETCURSEL , 0 , 0 ) ;
2006-02-25 20:50:29 +00:00
2008-05-18 18:23:25 +00:00
if ( ! JoySetEmulationType ( window , g_nJoy0ChoiceTranlationTbl [ uNewJoyType0 ] , JN_JOYSTICK0 ) )
2006-02-25 20:50:29 +00:00
{
afterclose = 0 ;
return ;
}
2008-05-18 18:23:25 +00:00
if ( ! JoySetEmulationType ( window , g_nJoy1ChoiceTranlationTbl [ uNewJoyType1 ] , JN_JOYSTICK1 ) )
2006-02-25 20:50:29 +00:00
{
afterclose = 0 ;
return ;
}
JoySetTrim ( ( short ) SendDlgItemMessage ( window , IDC_SPIN_XTRIM , UDM_GETPOS , 0 , 0 ) , true ) ;
JoySetTrim ( ( short ) SendDlgItemMessage ( window , IDC_SPIN_YTRIM , UDM_GETPOS , 0 , 0 ) , false ) ;
2008-05-17 23:20:33 +00:00
g_uMouseShowCrosshair = IsDlgButtonChecked ( window , IDC_MOUSE_CROSSHAIR ) ? 1 : 0 ;
2008-05-18 18:23:25 +00:00
g_uMouseRestrictToWindow = IsDlgButtonChecked ( window , IDC_MOUSE_RESTRICT_TO_WINDOW ) ? 1 : 0 ;
2006-02-25 20:50:29 +00:00
2009-01-09 23:27:29 +00:00
REGSAVE ( TEXT ( " Joystick 0 Emulation " ) , joytype [ 0 ] ) ;
REGSAVE ( TEXT ( " Joystick 1 Emulation " ) , joytype [ 1 ] ) ;
REGSAVE ( TEXT ( REGVALUE_PDL_XTRIM ) , JoyGetTrim ( true ) ) ;
REGSAVE ( TEXT ( REGVALUE_PDL_YTRIM ) , JoyGetTrim ( false ) ) ;
REGSAVE ( TEXT ( REGVALUE_SCROLLLOCK_TOGGLE ) , g_uScrollLockToggle ) ;
REGSAVE ( TEXT ( REGVALUE_MOUSE_IN_SLOT4 ) , g_uMouseInSlot4 ) ;
REGSAVE ( TEXT ( REGVALUE_MOUSE_CROSSHAIR ) , g_uMouseShowCrosshair ) ;
REGSAVE ( TEXT ( REGVALUE_MOUSE_RESTRICT_TO_WINDOW ) , g_uMouseRestrictToWindow ) ;
REGSAVE ( TEXT ( REGVALUE_Z80_IN_SLOT5 ) , g_uZ80InSlot5 ) ;
2006-02-25 20:50:29 +00:00
//
if ( afterclose )
2006-05-14 00:44:38 +00:00
PostMessage ( g_hFrameWindow , afterclose , 0 , 0 ) ;
2006-02-25 20:50:29 +00:00
}
static void InputDlg_CANCEL ( HWND window )
{
}
//---------------------------------------------------------------------------
2009-12-12 11:04:22 +00:00
static BOOL CALLBACK InputDlgProc ( HWND window ,
UINT message ,
WPARAM wparam ,
LPARAM lparam )
2006-02-25 20:50:29 +00:00
{
2009-12-12 11:04:22 +00:00
static UINT afterclose = 0 ;
2006-02-25 20:50:29 +00:00
2009-12-12 11:04:22 +00:00
switch ( message )
2006-02-25 20:50:29 +00:00
{
2009-12-12 11:04:22 +00:00
case WM_NOTIFY :
{
// Property Sheet notifications
2006-02-25 20:50:29 +00:00
2009-12-12 11:04:22 +00:00
switch ( ( ( LPPSHNOTIFY ) lparam ) - > hdr . code )
2006-02-25 20:50:29 +00:00
{
2009-12-12 11:04:22 +00:00
case PSN_KILLACTIVE :
SetWindowLong ( window , DWL_MSGRESULT , FALSE ) ; // Changes are valid
break ;
case PSN_APPLY :
SetWindowLong ( window , DWL_MSGRESULT , PSNRET_NOERROR ) ; // Changes are valid
InputDlg_OK ( window , afterclose ) ;
break ;
case PSN_QUERYCANCEL :
// Can use this to ask user to confirm cancel
break ;
case PSN_RESET :
InputDlg_CANCEL ( window ) ;
break ;
/* // Could use this to display PDL() value
case UDN_DELTAPOS :
LPNMUPDOWN lpnmud = ( LPNMUPDOWN ) lparam ;
if ( lpnmud - > hdr . idFrom = = IDC_SPIN_XTRIM )
{
static int x = 0 ;
x = lpnmud - > iPos + lpnmud - > iDelta ;
x = SendDlgItemMessage ( window , IDC_SPIN_XTRIM , UDM_GETPOS , 0 , 0 ) ;
}
else if ( lpnmud - > hdr . idFrom = = IDC_SPIN_YTRIM )
{
static int y = 0 ;
y = lpnmud - > iPos + lpnmud - > iDelta ;
y = SendDlgItemMessage ( window , IDC_SPIN_YTRIM , UDM_GETPOS , 0 , 0 ) ;
}
break ;
*/
2006-02-25 20:50:29 +00:00
}
2009-12-12 11:04:22 +00:00
}
break ;
2006-02-25 20:50:29 +00:00
2009-12-12 11:04:22 +00:00
case WM_COMMAND :
switch ( LOWORD ( wparam ) )
{
case IDC_JOYSTICK0 : // joystick0
if ( HIWORD ( wparam ) = = CBN_SELCHANGE )
2006-02-25 20:50:29 +00:00
{
DWORD newjoytype = ( DWORD ) SendDlgItemMessage ( window , IDC_JOYSTICK0 , CB_GETCURSEL , 0 , 0 ) ;
JoySetEmulationType ( window , g_nJoy0ChoiceTranlationTbl [ newjoytype ] , JN_JOYSTICK0 ) ;
InitJoystickChoices ( window , JN_JOYSTICK1 , IDC_JOYSTICK1 ) ; // Re-init joy1 list
}
break ;
2008-02-22 21:28:35 +00:00
case IDC_JOYSTICK1 : // joystick1
2009-12-12 11:04:22 +00:00
if ( HIWORD ( wparam ) = = CBN_SELCHANGE )
2006-02-25 20:50:29 +00:00
{
DWORD newjoytype = ( DWORD ) SendDlgItemMessage ( window , IDC_JOYSTICK1 , CB_GETCURSEL , 0 , 0 ) ;
JoySetEmulationType ( window , g_nJoy1ChoiceTranlationTbl [ newjoytype ] , JN_JOYSTICK1 ) ;
InitJoystickChoices ( window , JN_JOYSTICK0 , IDC_JOYSTICK0 ) ; // Re-init joy0 list
}
break ;
2008-02-22 21:28:35 +00:00
2007-08-06 21:38:35 +00:00
case IDC_SCROLLLOCK_TOGGLE :
g_uScrollLockToggle = IsDlgButtonChecked ( window , IDC_SCROLLLOCK_TOGGLE ) ? 1 : 0 ;
break ;
2008-02-22 21:28:35 +00:00
case IDC_MOUSE_IN_SLOT4 :
{
UINT uNewState = IsDlgButtonChecked ( window , IDC_MOUSE_IN_SLOT4 ) ? 1 : 0 ;
LPCSTR pMsg = uNewState ?
2009-12-12 11:04:22 +00:00
TEXT ( " The emulator needs to restart as the slot configuration has changed. \n \n " )
TEXT ( " Also Mockingboard/Phasor cards won't be available in slot 4 \n " )
TEXT ( " and the mouse can't be used for joystick emulation. \n \n " )
TEXT ( " Would you like to restart the emulator now? " )
:
TEXT ( " The emulator needs to restart as the slot configuration has changed. \n \n " )
TEXT ( " (Mockingboard/Phasor cards will now be available in slot 4 \n " )
TEXT ( " and the mouse can be used for joystick emulation) \n \n " )
TEXT ( " Would you like to restart the emulator now? " ) ;
2008-02-22 21:28:35 +00:00
if ( MessageBox ( window ,
2009-12-12 11:04:22 +00:00
pMsg ,
TEXT ( " Configuration " ) ,
MB_ICONQUESTION | MB_YESNO | MB_SETFOREGROUND ) = = IDYES )
2008-02-22 21:28:35 +00:00
{
g_uMouseInSlot4 = uNewState ;
2008-05-17 23:20:33 +00:00
if ( uNewState )
{
JoyDisableUsingMouse ( ) ;
InitJoystickChoices ( window , JN_JOYSTICK0 , IDC_JOYSTICK0 ) ;
InitJoystickChoices ( window , JN_JOYSTICK1 , IDC_JOYSTICK1 ) ;
}
2008-02-22 21:28:35 +00:00
afterclose = WM_USER_RESTART ;
PropSheet_PressButton ( GetParent ( window ) , PSBTN_OK ) ;
}
else
{
2009-12-12 11:04:22 +00:00
CheckDlgButton ( window , IDC_MOUSE_IN_SLOT4 , g_uMouseInSlot4 ? BST_CHECKED : BST_UNCHECKED ) ;
2008-02-22 21:28:35 +00:00
}
}
break ;
2009-01-06 22:02:31 +00:00
case IDC_Z80_IN_SLOT5 :
{
UINT uNewState = IsDlgButtonChecked ( window , IDC_Z80_IN_SLOT5 ) ? 1 : 0 ;
LPCSTR pMsg = uNewState ?
2009-12-12 11:04:22 +00:00
TEXT ( " The emulator needs to restart as the slot configuration has changed. \n " )
TEXT ( " Microsoft CP/M SoftCard will be placed in slot 5. \n \n " )
TEXT ( " Would you like to restart the emulator now? " )
:
TEXT ( " The emulator needs to restart as the slot configuration has changed. \n " )
TEXT ( " Microsoft CP/M SoftCard will be removed from slot 5 \n \n " )
TEXT ( " Would you like to restart the emulator now? " ) ;
2009-01-06 22:02:31 +00:00
if ( MessageBox ( window ,
2009-12-12 11:04:22 +00:00
pMsg ,
TEXT ( " Configuration " ) ,
MB_ICONQUESTION | MB_YESNO | MB_SETFOREGROUND ) = = IDYES )
2009-01-06 22:02:31 +00:00
{
g_uZ80InSlot5 = uNewState ;
afterclose = WM_USER_RESTART ;
PropSheet_PressButton ( GetParent ( window ) , PSBTN_OK ) ;
}
else
{
2009-12-12 11:04:22 +00:00
CheckDlgButton ( window , IDC_Z80_IN_SLOT5 , g_uZ80InSlot5 ? BST_CHECKED : BST_UNCHECKED ) ;
2009-01-06 22:02:31 +00:00
}
}
break ;
2008-08-19 21:36:31 +00:00
2006-02-25 20:50:29 +00:00
case IDC_PASTE_FROM_CLIPBOARD :
ClipboardInitiatePaste ( ) ;
break ;
2009-12-12 11:04:22 +00:00
}
break ;
2006-02-25 20:50:29 +00:00
2009-12-12 11:04:22 +00:00
case WM_INITDIALOG : //Init input settings dialog
{
g_nLastPage = PG_INPUT ;
2006-02-25 20:50:29 +00:00
2009-12-12 11:04:22 +00:00
InitJoystickChoices ( window , JN_JOYSTICK0 , IDC_JOYSTICK0 ) ;
InitJoystickChoices ( window , JN_JOYSTICK1 , IDC_JOYSTICK1 ) ;
2006-02-25 20:50:29 +00:00
2009-12-12 11:04:22 +00:00
SendDlgItemMessage ( window , IDC_SPIN_XTRIM , UDM_SETRANGE , 0 , MAKELONG ( 128 , - 127 ) ) ;
SendDlgItemMessage ( window , IDC_SPIN_YTRIM , UDM_SETRANGE , 0 , MAKELONG ( 128 , - 127 ) ) ;
2006-02-25 20:50:29 +00:00
2009-12-12 11:04:22 +00:00
SendDlgItemMessage ( window , IDC_SPIN_XTRIM , UDM_SETPOS , 0 , MAKELONG ( JoyGetTrim ( true ) , 0 ) ) ;
SendDlgItemMessage ( window , IDC_SPIN_YTRIM , UDM_SETPOS , 0 , MAKELONG ( JoyGetTrim ( false ) , 0 ) ) ;
2006-02-25 20:50:29 +00:00
2009-12-12 11:04:22 +00:00
CheckDlgButton ( window , IDC_SCROLLLOCK_TOGGLE , g_uScrollLockToggle ? BST_CHECKED : BST_UNCHECKED ) ;
CheckDlgButton ( window , IDC_MOUSE_IN_SLOT4 , g_uMouseInSlot4 ? BST_CHECKED : BST_UNCHECKED ) ;
CheckDlgButton ( window , IDC_MOUSE_CROSSHAIR , g_uMouseShowCrosshair ? BST_CHECKED : BST_UNCHECKED ) ;
CheckDlgButton ( window , IDC_MOUSE_RESTRICT_TO_WINDOW , g_uMouseRestrictToWindow ? BST_CHECKED : BST_UNCHECKED ) ;
EnableWindow ( GetDlgItem ( window , IDC_MOUSE_CROSSHAIR ) , g_uMouseInSlot4 ? TRUE : FALSE ) ;
EnableWindow ( GetDlgItem ( window , IDC_MOUSE_RESTRICT_TO_WINDOW ) , g_uMouseInSlot4 ? TRUE : FALSE ) ;
CheckDlgButton ( window , IDC_Z80_IN_SLOT5 , g_uZ80InSlot5 ? BST_CHECKED : BST_UNCHECKED ) ;
2008-05-18 18:53:48 +00:00
2009-12-12 11:04:22 +00:00
afterclose = 0 ;
break ;
}
2006-02-25 20:50:29 +00:00
}
2009-12-12 11:04:22 +00:00
return 0 ;
2006-02-25 20:50:29 +00:00
}
//===========================================================================
2008-02-22 21:28:35 +00:00
static void SoundDlg_OK ( HWND window , UINT afterclose , UINT uNewSoundcardType )
2006-02-25 20:50:29 +00:00
{
DWORD newsoundtype = ( DWORD ) SendDlgItemMessage ( window , IDC_SOUNDTYPE , CB_GETCURSEL , 0 , 0 ) ;
DWORD dwSpkrVolume = SendDlgItemMessage ( window , IDC_SPKR_VOLUME , TBM_GETPOS , 0 , 0 ) ;
DWORD dwMBVolume = SendDlgItemMessage ( window , IDC_MB_VOLUME , TBM_GETPOS , 0 , 0 ) ;
if ( ! SpkrSetEmulationType ( window , newsoundtype ) )
{
afterclose = 0 ;
return ;
}
// NB. Volume: 0=Loudest, VOLUME_MAX=Silence
SpkrSetVolume ( dwSpkrVolume , VOLUME_MAX ) ;
MB_SetVolume ( dwMBVolume , VOLUME_MAX ) ;
MB_SetSoundcardType ( ( eSOUNDCARDTYPE ) uNewSoundcardType ) ;
2009-01-09 23:27:29 +00:00
REGSAVE ( TEXT ( " Sound Emulation " ) , soundtype ) ;
REGSAVE ( TEXT ( REGVALUE_SPKR_VOLUME ) , SpkrGetVolume ( ) ) ;
REGSAVE ( TEXT ( REGVALUE_MB_VOLUME ) , MB_GetVolume ( ) ) ;
REGSAVE ( TEXT ( REGVALUE_SOUNDCARD_TYPE ) , ( DWORD ) MB_GetSoundcardType ( ) ) ;
2006-02-25 20:50:29 +00:00
//
if ( afterclose )
2006-05-14 00:44:38 +00:00
PostMessage ( g_hFrameWindow , afterclose , 0 , 0 ) ;
2006-02-25 20:50:29 +00:00
}
static void SoundDlg_CANCEL ( HWND window )
{
}
//---------------------------------------------------------------------------
static BOOL CALLBACK SoundDlgProc ( HWND window ,
2009-12-12 11:04:22 +00:00
UINT message ,
WPARAM wparam ,
LPARAM lparam )
2006-02-25 20:50:29 +00:00
{
2009-12-12 11:04:22 +00:00
static UINT afterclose = 0 ;
static UINT uNewSoundcardType = SC_UNINIT ;
2006-02-25 20:50:29 +00:00
2009-12-12 11:04:22 +00:00
switch ( message )
2006-02-25 20:50:29 +00:00
{
2009-12-12 11:04:22 +00:00
case WM_NOTIFY :
{
// Property Sheet notifications
2006-02-25 20:50:29 +00:00
2009-12-12 11:04:22 +00:00
switch ( ( ( LPPSHNOTIFY ) lparam ) - > hdr . code )
{
case PSN_KILLACTIVE :
SetWindowLong ( window , DWL_MSGRESULT , FALSE ) ; // Changes are valid
break ;
case PSN_APPLY :
SetWindowLong ( window , DWL_MSGRESULT , PSNRET_NOERROR ) ; // Changes are valid
SoundDlg_OK ( window , afterclose , uNewSoundcardType ) ;
break ;
case PSN_QUERYCANCEL :
// Can use this to ask user to confirm cancel
break ;
case PSN_RESET :
SoundDlg_CANCEL ( window ) ;
break ;
}
}
break ;
2006-02-25 20:50:29 +00:00
2009-12-12 11:04:22 +00:00
case WM_COMMAND :
switch ( LOWORD ( wparam ) )
{
2006-02-25 20:50:29 +00:00
case IDC_SPKR_VOLUME :
break ;
case IDC_MB_VOLUME :
break ;
case IDC_MB_ENABLE :
uNewSoundcardType = SC_MOCKINGBOARD ;
EnableWindow ( GetDlgItem ( window , IDC_MB_VOLUME ) , TRUE ) ;
break ;
case IDC_PHASOR_ENABLE :
uNewSoundcardType = SC_PHASOR ;
EnableWindow ( GetDlgItem ( window , IDC_MB_VOLUME ) , TRUE ) ;
break ;
case IDC_SOUNDCARD_DISABLE :
uNewSoundcardType = SC_NONE ;
EnableWindow ( GetDlgItem ( window , IDC_MB_VOLUME ) , FALSE ) ;
break ;
2009-12-12 11:04:22 +00:00
}
break ;
2006-02-25 20:50:29 +00:00
2009-12-12 11:04:22 +00:00
case WM_INITDIALOG :
{
g_nLastPage = PG_SOUND ;
FillComboBox ( window , IDC_SOUNDTYPE , soundchoices , soundtype ) ;
SendDlgItemMessage ( window , IDC_SPKR_VOLUME , TBM_SETRANGE , 1 , MAKELONG ( VOLUME_MIN , VOLUME_MAX ) ) ;
SendDlgItemMessage ( window , IDC_SPKR_VOLUME , TBM_SETPAGESIZE , 0 , 10 ) ;
SendDlgItemMessage ( window , IDC_SPKR_VOLUME , TBM_SETTICFREQ , 10 , 0 ) ;
SendDlgItemMessage ( window , IDC_SPKR_VOLUME , TBM_SETPOS , 1 , SpkrGetVolume ( ) ) ;
SendDlgItemMessage ( window , IDC_MB_VOLUME , TBM_SETRANGE , 1 , MAKELONG ( VOLUME_MIN , VOLUME_MAX ) ) ;
SendDlgItemMessage ( window , IDC_MB_VOLUME , TBM_SETPAGESIZE , 0 , 10 ) ;
SendDlgItemMessage ( window , IDC_MB_VOLUME , TBM_SETTICFREQ , 10 , 0 ) ;
SendDlgItemMessage ( window , IDC_MB_VOLUME , TBM_SETPOS , 1 , MB_GetVolume ( ) ) ;
int nID ;
eSOUNDCARDTYPE SoundcardType = MB_GetSoundcardType ( ) ;
if ( SoundcardType = = SC_MOCKINGBOARD )
nID = IDC_MB_ENABLE ;
else if ( SoundcardType = = SC_PHASOR )
nID = IDC_PHASOR_ENABLE ;
else
nID = IDC_SOUNDCARD_DISABLE ;
CheckRadioButton ( window , IDC_MB_ENABLE , IDC_SOUNDCARD_DISABLE , nID ) ;
if ( g_uMouseInSlot4 )
{
EnableWindow ( GetDlgItem ( window , IDC_PHASOR_ENABLE ) , FALSE ) ;
}
if ( g_uZ80InSlot5 )
{
EnableWindow ( GetDlgItem ( window , IDC_MB_ENABLE ) , FALSE ) ;
}
afterclose = 0 ;
break ;
}
2006-02-25 20:50:29 +00:00
}
2009-12-12 11:04:22 +00:00
return 0 ;
2006-02-25 20:50:29 +00:00
}
//===========================================================================
static void EnableHDD ( HWND window , BOOL bEnable )
{
EnableWindow ( GetDlgItem ( window , IDC_HDD1 ) , bEnable ) ;
EnableWindow ( GetDlgItem ( window , IDC_EDIT_HDD1 ) , bEnable ) ;
EnableWindow ( GetDlgItem ( window , IDC_HDD2 ) , bEnable ) ;
EnableWindow ( GetDlgItem ( window , IDC_EDIT_HDD2 ) , bEnable ) ;
}
//---------------------------------------------------------------------------
2008-02-22 21:28:35 +00:00
static void DiskDlg_OK ( HWND window , UINT afterclose )
2006-02-25 20:50:29 +00:00
{
2009-12-12 11:04:22 +00:00
BOOL newdisktype = ( BOOL ) SendDlgItemMessage ( window , IDC_DISKTYPE , CB_GETCURSEL , 0 , 0 ) ;
2006-02-25 20:50:29 +00:00
if ( newdisktype ! = enhancedisk )
{
if ( MessageBox ( window ,
TEXT ( " You have changed the disk speed setting. " )
TEXT ( " This change will not take effect " )
TEXT ( " until the next time you restart the " )
TEXT ( " emulator. \n \n " )
TEXT ( " Would you like to restart the emulator now? " ) ,
TEXT ( " Configuration " ) ,
MB_ICONQUESTION | MB_YESNO | MB_SETFOREGROUND ) = = IDYES )
afterclose = WM_USER_RESTART ;
}
bool bHDDIsEnabled = IsDlgButtonChecked ( window , IDC_HDD_ENABLE ) ? true : false ;
HD_SetEnabled ( bHDDIsEnabled ) ;
2010-01-17 18:43:06 +00:00
REGSAVE ( TEXT ( REGVALUE_ENHANCE_DISK_SPEED ) , newdisktype ) ;
2009-01-09 23:27:29 +00:00
REGSAVE ( TEXT ( REGVALUE_HDD_ENABLED ) , bHDDIsEnabled ? 1 : 0 ) ;
2010-01-17 18:43:06 +00:00
RegSaveString ( TEXT ( REG_PREFS ) , TEXT ( REGVALUE_PREF_LAST_HARDDISK_1 ) , 1 , HD_GetFullPathName ( HARDDISK_1 ) ) ;
RegSaveString ( TEXT ( REG_PREFS ) , TEXT ( REGVALUE_PREF_LAST_HARDDISK_2 ) , 1 , HD_GetFullPathName ( HARDDISK_2 ) ) ;
2006-02-25 20:50:29 +00:00
//
if ( afterclose )
2006-05-14 00:44:38 +00:00
PostMessage ( g_hFrameWindow , afterclose , 0 , 0 ) ;
2006-02-25 20:50:29 +00:00
}
static void DiskDlg_CANCEL ( HWND window )
{
}
//---------------------------------------------------------------------------
static BOOL CALLBACK DiskDlgProc ( HWND window ,
2009-12-12 11:04:22 +00:00
UINT message ,
WPARAM wparam ,
LPARAM lparam )
2006-02-25 20:50:29 +00:00
{
2009-12-12 11:04:22 +00:00
static UINT afterclose = 0 ;
2006-02-25 20:50:29 +00:00
2009-12-12 11:04:22 +00:00
switch ( message )
2006-02-25 20:50:29 +00:00
{
2009-12-12 11:04:22 +00:00
case WM_NOTIFY :
{
// Property Sheet notifications
2006-02-25 20:50:29 +00:00
2009-12-12 11:04:22 +00:00
switch ( ( ( LPPSHNOTIFY ) lparam ) - > hdr . code )
{
case PSN_KILLACTIVE :
SetWindowLong ( window , DWL_MSGRESULT , FALSE ) ; // Changes are valid
break ;
case PSN_APPLY :
SetWindowLong ( window , DWL_MSGRESULT , PSNRET_NOERROR ) ; // Changes are valid
DiskDlg_OK ( window , afterclose ) ;
break ;
case PSN_QUERYCANCEL :
// Can use this to ask user to confirm cancel
break ;
case PSN_RESET :
DiskDlg_CANCEL ( window ) ;
break ;
}
}
break ;
2006-02-25 20:50:29 +00:00
2009-12-12 11:04:22 +00:00
case WM_COMMAND :
switch ( LOWORD ( wparam ) )
{
2006-02-25 20:50:29 +00:00
case IDC_DISK1 :
2010-01-03 18:43:08 +00:00
DiskSelect ( DRIVE_1 ) ;
SendDlgItemMessage ( window , IDC_EDIT_DISK1 , WM_SETTEXT , 0 , ( LPARAM ) DiskGetFullName ( DRIVE_1 ) ) ;
FrameRefreshStatus ( DRAW_BUTTON_DRIVES ) ;
2006-02-25 20:50:29 +00:00
break ;
2008-06-20 23:47:25 +00:00
2006-02-25 20:50:29 +00:00
case IDC_DISK2 :
2010-01-03 18:43:08 +00:00
DiskSelect ( DRIVE_2 ) ;
SendDlgItemMessage ( window , IDC_EDIT_DISK2 , WM_SETTEXT , 0 , ( LPARAM ) DiskGetFullName ( DRIVE_2 ) ) ;
FrameRefreshStatus ( DRAW_BUTTON_DRIVES ) ;
2006-02-25 20:50:29 +00:00
break ;
2008-06-20 23:47:25 +00:00
2006-02-25 20:50:29 +00:00
case IDC_HDD1 :
if ( IsDlgButtonChecked ( window , IDC_HDD_ENABLE ) )
{
2010-01-03 18:43:08 +00:00
HD_Select ( HARDDISK_1 ) ;
SendDlgItemMessage ( window , IDC_EDIT_HDD1 , WM_SETTEXT , 0 , ( LPARAM ) HD_GetFullName ( HARDDISK_1 ) ) ;
2006-02-25 20:50:29 +00:00
}
break ;
2008-06-20 23:47:25 +00:00
2006-02-25 20:50:29 +00:00
case IDC_HDD2 :
if ( IsDlgButtonChecked ( window , IDC_HDD_ENABLE ) )
{
2010-01-03 18:43:08 +00:00
HD_Select ( HARDDISK_2 ) ;
SendDlgItemMessage ( window , IDC_EDIT_HDD2 , WM_SETTEXT , 0 , ( LPARAM ) HD_GetFullName ( HARDDISK_2 ) ) ;
2006-02-25 20:50:29 +00:00
}
break ;
2008-06-20 23:47:25 +00:00
2006-02-25 20:50:29 +00:00
case IDC_HDD_ENABLE :
EnableHDD ( window , IsDlgButtonChecked ( window , IDC_HDD_ENABLE ) ) ;
break ;
2008-06-20 23:47:25 +00:00
case IDC_CIDERPRESS_BROWSE :
{
2009-01-09 21:59:22 +00:00
string CiderPressLoc = BrowseToFile ( window , TEXT ( " Select path to CiderPress " ) , REGVALUE_CIDERPRESSLOC , TEXT ( " Applications (*.exe) \0 *.exe \0 " ) TEXT ( " All Files \0 *.* \0 " ) ) ;
2008-06-20 23:47:25 +00:00
RegSaveString ( TEXT ( " Configuration " ) , REGVALUE_CIDERPRESSLOC , 1 , CiderPressLoc . c_str ( ) ) ;
SendDlgItemMessage ( window , IDC_CIDERPRESS_FILENAME , WM_SETTEXT , 0 , ( LPARAM ) CiderPressLoc . c_str ( ) ) ;
}
break ;
2009-12-12 11:04:22 +00:00
}
break ;
2006-02-25 20:50:29 +00:00
2009-12-12 11:04:22 +00:00
case WM_INITDIALOG : //Init disk settings dialog
{
g_nLastPage = PG_DISK ;
2006-02-25 20:50:29 +00:00
2009-12-12 11:04:22 +00:00
FillComboBox ( window , IDC_DISKTYPE , discchoices , enhancedisk ) ;
2010-01-03 18:43:08 +00:00
SendDlgItemMessage ( window , IDC_EDIT_DISK1 , WM_SETTEXT , 0 , ( LPARAM ) DiskGetFullName ( DRIVE_1 ) ) ;
SendDlgItemMessage ( window , IDC_EDIT_DISK2 , WM_SETTEXT , 0 , ( LPARAM ) DiskGetFullName ( DRIVE_2 ) ) ;
2006-02-25 20:50:29 +00:00
2010-01-03 18:43:08 +00:00
SendDlgItemMessage ( window , IDC_EDIT_HDD1 , WM_SETTEXT , 0 , ( LPARAM ) HD_GetFullName ( HARDDISK_1 ) ) ;
SendDlgItemMessage ( window , IDC_EDIT_HDD2 , WM_SETTEXT , 0 , ( LPARAM ) HD_GetFullName ( HARDDISK_2 ) ) ;
2006-02-25 20:50:29 +00:00
2009-12-12 11:04:22 +00:00
//
2006-02-25 20:50:29 +00:00
2009-12-12 11:04:22 +00:00
TCHAR PathToCiderPress [ MAX_PATH ] = " " ;
RegLoadString ( TEXT ( " Configuration " ) , REGVALUE_CIDERPRESSLOC , 1 , PathToCiderPress , MAX_PATH ) ;
SendDlgItemMessage ( window , IDC_CIDERPRESS_FILENAME , WM_SETTEXT , 0 , ( LPARAM ) PathToCiderPress ) ;
2008-06-20 23:47:25 +00:00
2009-12-12 11:04:22 +00:00
//
2009-01-06 22:02:31 +00:00
2009-12-12 11:04:22 +00:00
CheckDlgButton ( window , IDC_HDD_ENABLE , HD_CardIsEnabled ( ) ? BST_CHECKED : BST_UNCHECKED ) ;
2006-02-25 20:50:29 +00:00
2009-12-12 11:04:22 +00:00
EnableHDD ( window , IsDlgButtonChecked ( window , IDC_HDD_ENABLE ) ) ;
2006-02-25 20:50:29 +00:00
2009-12-12 11:04:22 +00:00
afterclose = 0 ;
break ;
}
2010-01-03 18:43:08 +00:00
case WM_RBUTTONUP :
{
RECT rect ; // client area
POINT pt ; // location of mouse click
// Get the bounding rectangle of the client area.
GetClientRect ( window , ( LPRECT ) & rect ) ;
// Get the client coordinates for the mouse click.
pt . x = GET_X_LPARAM ( lparam ) ;
pt . y = GET_Y_LPARAM ( lparam ) ;
// If the mouse click took place inside the client
// area, execute the application-defined function
// that displays the shortcut menu.
if ( PtInRect ( ( LPRECT ) & rect , pt ) )
{
// Load the menu template containing the shortcut menu from the application's resources.
HMENU hMenu = LoadMenu ( g_hInstance , MAKEINTRESOURCE ( IDR_MENU_DISK_CFG_POPUP ) ) ; // menu template
_ASSERT ( hMenu ) ;
if ( ! hMenu )
break ;
// Get the first shortcut menu in the menu template.
// This is the menu that TrackPopupMenu displays.
HMENU hMenuTrackPopup = GetSubMenu ( hMenu , 0 ) ; // shortcut menu
// TrackPopup uses screen coordinates, so convert the coordinates of the mouse click to screen coordinates.
ClientToScreen ( window , ( LPPOINT ) & pt ) ;
if ( Disk_IsDriveEmpty ( DRIVE_1 ) )
EnableMenuItem ( hMenu , ID_DISKMENU_EJECT_DISK1 , MF_GRAYED ) ;
if ( Disk_IsDriveEmpty ( DRIVE_2 ) )
EnableMenuItem ( hMenu , ID_DISKMENU_EJECT_DISK2 , MF_GRAYED ) ;
if ( HD_IsDriveUnplugged ( HARDDISK_1 ) )
EnableMenuItem ( hMenu , ID_DISKMENU_UNPLUG_HARDDISK1 , MF_GRAYED ) ;
if ( HD_IsDriveUnplugged ( HARDDISK_2 ) )
EnableMenuItem ( hMenu , ID_DISKMENU_UNPLUG_HARDDISK2 , MF_GRAYED ) ;
// Draw and track the shortcut menu.
int iCommand = TrackPopupMenu (
hMenuTrackPopup
, TPM_LEFTALIGN | TPM_LEFTBUTTON | TPM_RETURNCMD
, pt . x , pt . y
, 0
, window , NULL ) ;
if ( iCommand )
{
TCHAR szText [ 100 ] ;
bool bMsgBox = true ;
if ( iCommand = = ID_DISKMENU_EJECT_DISK1 | | iCommand = = ID_DISKMENU_EJECT_DISK2 )
wsprintf ( szText , " Do you really want to eject the disk in drive-%c ? " , ' 1 ' + iCommand - ID_DISKMENU_EJECT_DISK1 ) ;
else if ( iCommand = = ID_DISKMENU_UNPLUG_HARDDISK1 | | iCommand = = ID_DISKMENU_UNPLUG_HARDDISK2 )
wsprintf ( szText , " Do you really want to unplug harddisk-%c ? " , ' 1 ' + iCommand - ID_DISKMENU_UNPLUG_HARDDISK1 ) ;
else
bMsgBox = false ;
if ( bMsgBox )
{
int nRes = MessageBox ( g_hFrameWindow , szText , TEXT ( " Eject/Unplug Warning " ) , MB_ICONWARNING | MB_YESNO | MB_SETFOREGROUND ) ;
if ( nRes = = IDNO )
iCommand = 0 ;
}
}
switch ( iCommand )
{
case ID_DISKMENU_EJECT_DISK1 :
DiskEject ( DRIVE_1 ) ;
SendDlgItemMessage ( window , IDC_EDIT_DISK1 , WM_SETTEXT , 0 , ( LPARAM ) DiskGetFullName ( DRIVE_1 ) ) ;
break ;
case ID_DISKMENU_EJECT_DISK2 :
DiskEject ( DRIVE_2 ) ;
SendDlgItemMessage ( window , IDC_EDIT_DISK2 , WM_SETTEXT , 0 , ( LPARAM ) DiskGetFullName ( DRIVE_2 ) ) ;
break ;
case ID_DISKMENU_UNPLUG_HARDDISK1 :
HD_Unplug ( HARDDISK_1 ) ;
SendDlgItemMessage ( window , IDC_EDIT_HDD1 , WM_SETTEXT , 0 , ( LPARAM ) HD_GetFullName ( HARDDISK_1 ) ) ;
break ;
case ID_DISKMENU_UNPLUG_HARDDISK2 :
HD_Unplug ( HARDDISK_2 ) ;
SendDlgItemMessage ( window , IDC_EDIT_HDD2 , WM_SETTEXT , 0 , ( LPARAM ) HD_GetFullName ( HARDDISK_2 ) ) ;
break ;
}
if ( iCommand ! = 0 )
FrameRefreshStatus ( DRAW_BUTTON_DRIVES ) ;
}
break ;
}
2006-02-25 20:50:29 +00:00
}
2009-12-12 11:04:22 +00:00
return 0 ;
2006-02-25 20:50:29 +00:00
}
2008-04-11 21:54:06 +00:00
//===========================================================================
2008-06-21 11:48:15 +00:00
static bool g_bSSNewFilename = false ;
2009-01-09 21:59:22 +00:00
static char g_szNewFilename [ MAX_PATH ] ;
2009-01-06 22:02:31 +00:00
static char g_szSSNewDirectory [ MAX_PATH ] ;
2008-06-21 11:48:15 +00:00
static char g_szSSNewFilename [ MAX_PATH ] ;
2008-05-17 23:20:33 +00:00
static void SaveStateUpdate ( )
{
2009-01-06 22:02:31 +00:00
if ( g_bSSNewFilename )
{
Snapshot_SetFilename ( g_szSSNewFilename ) ;
2008-05-17 23:20:33 +00:00
2009-01-06 22:02:31 +00:00
RegSaveString ( TEXT ( REG_CONFIG ) , REGVALUE_SAVESTATE_FILENAME , 1 , Snapshot_GetFilename ( ) ) ;
2008-05-17 23:20:33 +00:00
2009-01-06 22:02:31 +00:00
if ( g_szSSNewDirectory [ 0 ] )
2009-01-09 21:59:22 +00:00
RegSaveString ( TEXT ( " Preferences " ) , REGVALUE_PREF_START_DIR , 1 , g_szSSNewDirectory ) ; RegSaveString ( TEXT ( " Preferences " ) , REGVALUE_PREF_START_DIR , 1 , g_szSSNewDirectory ) ;
2009-01-06 22:02:31 +00:00
}
2008-05-17 23:20:33 +00:00
}
2010-08-01 19:51:11 +00:00
static void GetDiskBaseNameWithAWS ( TCHAR * pszFilename )
{
LPCTSTR pDiskName = DiskGetBaseName ( DRIVE_1 ) ;
if ( pDiskName & & pDiskName [ 0 ] )
{
strcpy ( pszFilename , pDiskName ) ;
strcpy ( & pszFilename [ strlen ( pDiskName ) ] , " .aws " ) ;
}
}
// NB. OK'ing this property sheet will call Snapshot_SetFilename() with this new filename
2008-05-17 23:20:33 +00:00
static int SaveStateSelectImage ( HWND hWindow , TCHAR * pszTitle , bool bSave )
{
TCHAR szDirectory [ MAX_PATH ] = TEXT ( " " ) ;
2010-08-01 19:51:11 +00:00
TCHAR szFilename [ MAX_PATH ] = { 0 } ;
if ( bSave )
2008-05-17 23:20:33 +00:00
{
2010-08-01 19:51:11 +00:00
// Attempt to use drive1's image name as the name for the .aws file
// Else Attempt to use the Prop Sheet's filename
GetDiskBaseNameWithAWS ( szFilename ) ;
if ( szFilename [ 0 ] = = 0 )
{
strcpy ( szFilename , Snapshot_GetFilename ( ) ) ;
}
2008-05-17 23:20:33 +00:00
}
2010-08-01 19:51:11 +00:00
else // Load
2008-05-17 23:20:33 +00:00
{
2010-08-01 19:51:11 +00:00
// Attempt to use the Prop Sheet's filename first
// Else attempt to use drive1's image name as the name for the .aws file
2008-05-17 23:20:33 +00:00
strcpy ( szFilename , Snapshot_GetFilename ( ) ) ;
2010-08-01 19:51:11 +00:00
if ( szFilename [ 0 ] = = 0 )
{
GetDiskBaseNameWithAWS ( szFilename ) ;
}
2008-05-17 23:20:33 +00:00
}
RegLoadString ( TEXT ( " Preferences " ) , REGVALUE_PREF_START_DIR , 1 , szDirectory , MAX_PATH ) ;
2010-08-01 19:51:11 +00:00
2008-05-17 23:20:33 +00:00
//
OPENFILENAME ofn ;
ZeroMemory ( & ofn , sizeof ( OPENFILENAME ) ) ;
ofn . lStructSize = sizeof ( OPENFILENAME ) ;
ofn . hwndOwner = hWindow ;
ofn . hInstance = g_hInstance ;
ofn . lpstrFilter = TEXT ( " Save State files (*.aws) \0 *.aws \0 " )
TEXT ( " All Files \0 *.* \0 " ) ;
ofn . lpstrFile = szFilename ;
ofn . nMaxFile = MAX_PATH ;
ofn . lpstrInitialDir = szDirectory ;
ofn . Flags = OFN_PATHMUSTEXIST | OFN_HIDEREADONLY ;
ofn . lpstrTitle = pszTitle ;
int nRes = bSave ? GetSaveFileName ( & ofn ) : GetOpenFileName ( & ofn ) ;
if ( nRes )
{
2008-06-21 11:48:15 +00:00
strcpy ( g_szSSNewFilename , & szFilename [ ofn . nFileOffset ] ) ;
2009-01-06 22:02:31 +00:00
if ( bSave ) // Only for saving (allow loading of any file for backwards compatibility)
{
// Append .aws if it's not there
const char szAWS_EXT [ ] = " .aws " ;
const UINT uStrLenFile = strlen ( g_szSSNewFilename ) ;
const UINT uStrLenExt = strlen ( szAWS_EXT ) ;
if ( ( uStrLenFile < = uStrLenExt ) | | ( strcmp ( & g_szSSNewFilename [ uStrLenFile - uStrLenExt ] , szAWS_EXT ) ! = 0 ) )
strcpy ( & g_szSSNewFilename [ uStrLenFile ] , szAWS_EXT ) ;
}
2008-06-21 15:02:36 +00:00
2008-05-17 23:20:33 +00:00
szFilename [ ofn . nFileOffset ] = 0 ;
if ( _tcsicmp ( szDirectory , szFilename ) )
2008-06-21 11:48:15 +00:00
strcpy ( g_szSSNewDirectory , szFilename ) ;
2008-05-17 23:20:33 +00:00
}
2009-01-06 22:02:31 +00:00
2008-06-21 11:48:15 +00:00
g_bSSNewFilename = nRes ? true : false ;
2008-05-17 23:20:33 +00:00
return nRes ;
}
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 ) ;
}
//---------------------------------------------------------------------------
2008-04-11 21:54:06 +00:00
static void AdvancedDlg_OK ( HWND window , UINT afterclose )
{
2008-05-17 23:20:33 +00:00
char szFilename [ MAX_PATH ] ;
memset ( szFilename , 0 , sizeof ( szFilename ) ) ;
2008-06-20 23:47:25 +00:00
* ( USHORT * ) szFilename = sizeof ( szFilename ) ;
2008-05-17 23:20:33 +00:00
UINT nLineLength = SendDlgItemMessage ( window , IDC_SAVESTATE_FILENAME , EM_LINELENGTH , 0 , 0 ) ;
SendDlgItemMessage ( window , IDC_SAVESTATE_FILENAME , EM_GETLINE , 0 , ( LPARAM ) szFilename ) ;
nLineLength = nLineLength > sizeof ( szFilename ) - 1 ? sizeof ( szFilename ) - 1 : nLineLength ;
szFilename [ nLineLength ] = 0x00 ;
SaveStateUpdate ( ) ;
2009-01-09 21:59:22 +00:00
RegSaveString ( TEXT ( " Configuration " ) , REGVALUE_PRINTER_FILENAME , 1 , Printer_GetFilename ( ) ) ;
// PrinterStateUpdate();
2008-05-17 23:20:33 +00:00
g_bSaveStateOnExit = IsDlgButtonChecked ( window , IDC_SAVESTATE_ON_EXIT ) ? true : false ;
2009-01-09 23:27:29 +00:00
REGSAVE ( TEXT ( REGVALUE_SAVE_STATE_ON_EXIT ) , g_bSaveStateOnExit ? 1 : 0 ) ;
2008-05-17 23:20:33 +00:00
2009-01-09 21:59:22 +00:00
g_bDumpToPrinter = IsDlgButtonChecked ( window , IDC_DUMPTOPRINTER ) ? true : false ;
2009-01-09 23:27:29 +00:00
REGSAVE ( TEXT ( REGVALUE_DUMP_TO_PRINTER ) , g_bDumpToPrinter ? 1 : 0 ) ;
2009-01-09 21:59:22 +00:00
g_bConvertEncoding = IsDlgButtonChecked ( window , IDC_PRINTER_CONVERT_ENCODING ) ? true : false ;
2009-01-09 23:27:29 +00:00
REGSAVE ( TEXT ( REGVALUE_CONVERT_ENCODING ) , g_bConvertEncoding ? 1 : 0 ) ;
2009-01-05 22:59:26 +00:00
2009-01-09 21:59:22 +00:00
g_bFilterUnprintable = IsDlgButtonChecked ( window , IDC_PRINTER_FILTER_UNPRINTABLE ) ? true : false ;
2009-01-09 23:27:29 +00:00
REGSAVE ( TEXT ( REGVALUE_FILTER_UNPRINTABLE ) , g_bFilterUnprintable ? 1 : 0 ) ;
2009-01-09 21:59:22 +00:00
g_bPrinterAppend = IsDlgButtonChecked ( window , IDC_PRINTER_APPEND ) ? true : false ;
2009-01-09 23:27:29 +00:00
REGSAVE ( TEXT ( REGVALUE_PRINTER_APPEND ) , g_bPrinterAppend ? 1 : 0 ) ;
2008-05-17 23:20:33 +00:00
//
2008-06-20 23:47:25 +00:00
DWORD NewCloneType = ( DWORD ) SendDlgItemMessage ( window , IDC_CLONETYPE , CB_GETCURSEL , 0 , 0 ) ;
2008-04-11 21:54:06 +00:00
2009-01-09 23:27:29 +00:00
REGSAVE ( TEXT ( REGVALUE_CLONETYPE ) , NewCloneType ) ;
REGSAVE ( TEXT ( REGVALUE_THE_FREEZES_F8_ROM ) , g_uTheFreezesF8Rom ) ; // NB. Can also be disabled on Config page (when Apple2Type changes)
2009-01-09 21:59:22 +00:00
Printer_SetIdleLimit ( ( short ) SendDlgItemMessage ( window , IDC_SPIN_PRINTER_IDLE , UDM_GETPOS , 0 , 0 ) ) ;
2009-01-09 23:27:29 +00:00
REGSAVE ( TEXT ( REGVALUE_PRINTER_IDLE_LIMIT ) , Printer_GetIdleLimit ( ) ) ;
2008-04-11 21:54:06 +00:00
2008-06-20 23:47:25 +00:00
eApple2Type NewApple2Clone = GetApple2Type ( 4 , NewCloneType ) ;
if ( g_Apple2Type > = A2TYPE_CLONE )
{
if ( NewApple2Clone ! = g_Apple2Type )
{
if ( ( afterclose = = WM_USER_RESTART ) | | // Eg. Changing 'Freeze ROM' & user has already OK'd the restart for this
MessageBox ( window ,
TEXT (
" You have changed the emulated computer "
" type. This change will not take effect \n "
" until the next time you restart the "
" emulator. \n \n "
" Would you like to restart the emulator now? " ) ,
TEXT ( " Configuration " ) ,
MB_ICONQUESTION | MB_YESNO | MB_SETFOREGROUND ) = = IDYES )
{
afterclose = WM_USER_RESTART ;
}
}
}
else
{
if ( NewApple2Clone ! = ( g_uCloneType + APPLECLONE_MASK | APPLE2E_MASK ) )
2008-06-21 11:48:15 +00:00
{
2008-06-20 23:47:25 +00:00
MessageBox ( window ,
2009-01-06 22:02:31 +00:00
TEXT (
" You have changed the emulated clone type "
" but in order for the changes to take effect \n "
" you shall set the emulated computer type "
" to Clone from the Configuration tab. \n \n " ) ,
TEXT ( " Clone type changed " ) ,
2009-12-12 11:04:22 +00:00
MB_ICONQUESTION | MB_OK | MB_SETFOREGROUND ) ;
2009-01-06 22:02:31 +00:00
g_uCloneType = NewApple2Clone - ( APPLECLONE_MASK | APPLE2E_MASK ) ;
2008-06-21 11:48:15 +00:00
}
2008-06-20 23:47:25 +00:00
}
2009-12-12 11:04:22 +00:00
if ( NewApple2Type > A2TYPE_APPLE2PLUS ) // TC-FIXME: Must be global scope (ie. g_NewApple2Type)
2008-06-20 23:47:25 +00:00
g_uTheFreezesF8Rom = false ;
2008-04-11 21:54:06 +00:00
//
if ( afterclose )
PostMessage ( g_hFrameWindow , afterclose , 0 , 0 ) ;
}
static void AdvancedDlg_CANCEL ( HWND window )
{
}
//---------------------------------------------------------------------------
static BOOL CALLBACK AdvancedDlgProc ( HWND window ,
2009-12-12 11:04:22 +00:00
UINT message ,
WPARAM wparam ,
LPARAM lparam )
2008-04-11 21:54:06 +00:00
{
2009-12-12 11:04:22 +00:00
static UINT afterclose = 0 ;
2008-04-11 21:54:06 +00:00
2009-12-12 11:04:22 +00:00
switch ( message )
2008-04-11 21:54:06 +00:00
{
2009-12-12 11:04:22 +00:00
case WM_NOTIFY :
{
// Property Sheet notifications
2008-04-11 21:54:06 +00:00
2009-12-12 11:04:22 +00:00
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 ;
2008-04-11 21:54:06 +00:00
2009-12-12 11:04:22 +00:00
case WM_COMMAND :
switch ( LOWORD ( wparam ) )
{
2008-05-17 23:20:33 +00:00
case IDC_SAVESTATE_FILENAME :
break ;
case IDC_SAVESTATE_BROWSE :
if ( SaveStateSelectImage ( window , TEXT ( " Select Save State file " ) , true ) )
2008-06-21 11:48:15 +00:00
SendDlgItemMessage ( window , IDC_SAVESTATE_FILENAME , WM_SETTEXT , 0 , ( LPARAM ) g_szSSNewFilename ) ;
2008-05-17 23:20:33 +00:00
break ;
2009-01-09 21:59:22 +00:00
case IDC_DUMP_FILENAME_BROWSE :
{
char PrinterDumpLoc [ MAX_PATH ] = { 0 } ;
strcpy ( PrinterDumpLoc , BrowseToFile ( window , TEXT ( " Select printer dump file " ) , REGVALUE_PRINTER_FILENAME , TEXT ( " Text files (*.txt) \0 *.txt \0 " ) TEXT ( " All Files \0 *.* \0 " ) ) . c_str ( ) ) ;
RegSaveString ( TEXT ( " Configuration " ) , REGVALUE_PRINTER_FILENAME , 1 , PrinterDumpLoc ) ;
SendDlgItemMessage ( window , IDC_DUMP_FILENAME , WM_SETTEXT , 0 , ( LPARAM ) PrinterDumpLoc ) ;
Printer_SetFilename ( PrinterDumpLoc ) ;
}
break ;
2008-05-17 23:20:33 +00:00
case IDC_SAVESTATE_ON_EXIT :
break ;
case IDC_SAVESTATE :
afterclose = WM_USER_SAVESTATE ;
break ;
case IDC_LOADSTATE :
afterclose = WM_USER_LOADSTATE ;
break ;
2009-12-12 11:04:22 +00:00
//
2008-05-17 23:20:33 +00:00
2008-04-11 21:54:06 +00:00
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 " )
2009-12-12 11:04:22 +00:00
TEXT ( " Would you like to restart the emulator now? " ) ;
2008-04-11 21:54:06 +00:00
if ( MessageBox ( window ,
2009-12-12 11:04:22 +00:00
pMsg ,
TEXT ( " Configuration " ) ,
MB_ICONQUESTION | MB_YESNO | MB_SETFOREGROUND ) = = IDYES )
2008-04-11 21:54:06 +00:00
{
g_uTheFreezesF8Rom = uNewState ;
afterclose = WM_USER_RESTART ;
PropSheet_PressButton ( GetParent ( window ) , PSBTN_OK ) ;
}
else
{
2009-12-12 11:04:22 +00:00
CheckDlgButton ( window , IDC_THE_FREEZES_F8_ROM_FW , g_uTheFreezesF8Rom ? BST_CHECKED : BST_UNCHECKED ) ;
2008-04-11 21:54:06 +00:00
}
}
break ;
2009-12-12 11:04:22 +00:00
}
break ;
2008-04-11 21:54:06 +00:00
2009-12-12 11:04:22 +00:00
case WM_INITDIALOG : //Init advanced settings dialog
{
g_nLastPage = PG_ADVANCED ;
2009-01-06 22:02:31 +00:00
2009-12-12 11:04:22 +00:00
SendDlgItemMessage ( window , IDC_SAVESTATE_FILENAME , WM_SETTEXT , 0 , ( LPARAM ) Snapshot_GetFilename ( ) ) ;
2009-01-06 22:02:31 +00:00
2009-12-12 11:04:22 +00:00
CheckDlgButton ( window , IDC_SAVESTATE_ON_EXIT , g_bSaveStateOnExit ? BST_CHECKED : BST_UNCHECKED ) ;
CheckDlgButton ( window , IDC_DUMPTOPRINTER , g_bDumpToPrinter ? BST_CHECKED : BST_UNCHECKED ) ;
CheckDlgButton ( window , IDC_PRINTER_CONVERT_ENCODING , g_bConvertEncoding ? BST_CHECKED : BST_UNCHECKED ) ;
CheckDlgButton ( window , IDC_PRINTER_FILTER_UNPRINTABLE , g_bFilterUnprintable ? BST_CHECKED : BST_UNCHECKED ) ;
CheckDlgButton ( window , IDC_PRINTER_APPEND , g_bPrinterAppend ? BST_CHECKED : BST_UNCHECKED ) ;
SendDlgItemMessage ( window , IDC_SPIN_PRINTER_IDLE , UDM_SETRANGE , 0 , MAKELONG ( 999 , 0 ) ) ;
SendDlgItemMessage ( window , IDC_SPIN_PRINTER_IDLE , UDM_SETPOS , 0 , MAKELONG ( Printer_GetIdleLimit ( ) , 0 ) ) ;
SendDlgItemMessage ( window , IDC_DUMP_FILENAME , WM_SETTEXT , 0 , ( LPARAM ) Printer_GetFilename ( ) ) ;
2008-05-17 23:20:33 +00:00
2009-12-12 11:04:22 +00:00
FillComboBox ( window , IDC_CLONETYPE , g_CloneChoices , g_uCloneType ) ;
InitFreezeDlgButton ( window ) ;
2008-05-17 23:20:33 +00:00
2009-12-12 11:04:22 +00:00
g_szSSNewDirectory [ 0 ] = 0x00 ;
2008-05-17 23:20:33 +00:00
2009-12-12 11:04:22 +00:00
// Need to specific cmd-line switch: -printer-real to enable this control
EnableWindow ( GetDlgItem ( window , IDC_DUMPTOPRINTER ) , g_bEnableDumpToRealPrinter ? TRUE : FALSE ) ;
2009-01-17 15:10:00 +00:00
2009-12-12 11:04:22 +00:00
afterclose = 0 ;
break ;
}
2008-04-11 21:54:06 +00:00
}
2009-12-12 11:04:22 +00:00
return 0 ;
2008-04-11 21:54:06 +00:00
}
//===========================================================================
2006-03-24 06:34:37 +00:00
static BOOL get_tfename ( int number , char * * ppname , char * * ppdescription )
{
2009-12-12 11:04:22 +00:00
if ( tfe_enumadapter_open ( ) )
{
char * pname = NULL ;
char * pdescription = NULL ;
while ( number - - )
{
if ( ! tfe_enumadapter ( & pname , & pdescription ) )
break ;
lib_free ( pname ) ;
lib_free ( pdescription ) ;
}
if ( tfe_enumadapter ( & pname , & pdescription ) )
{
* ppname = pname ;
* ppdescription = pdescription ;
tfe_enumadapter_close ( ) ;
return TRUE ;
}
tfe_enumadapter_close ( ) ;
}
return FALSE ;
2006-03-24 06:34:37 +00:00
}
static int gray_ungray_items ( HWND hwnd )
{
2009-12-12 11:04:22 +00:00
int enable ;
int number ;
int disabled = 0 ;
//resources_get_value("ETHERNET_DISABLED", (void *)&disabled);
REGLOAD ( TEXT ( " Uthernet Disabled " ) , ( DWORD * ) & disabled ) ;
get_disabled_state ( & disabled ) ;
if ( disabled )
{
EnableWindow ( GetDlgItem ( hwnd , IDC_TFE_SETTINGS_ENABLE_T ) , 0 ) ;
EnableWindow ( GetDlgItem ( hwnd , IDC_TFE_SETTINGS_ENABLE ) , 0 ) ;
EnableWindow ( GetDlgItem ( hwnd , IDOK ) , 0 ) ;
SetWindowText ( GetDlgItem ( hwnd , IDC_TFE_SETTINGS_INTERFACE_NAME ) , " " ) ;
SetWindowText ( GetDlgItem ( hwnd , IDC_TFE_SETTINGS_INTERFACE_DESC ) , " " ) ;
enable = 0 ;
}
else
{
enable = SendMessage ( GetDlgItem ( hwnd , IDC_TFE_SETTINGS_ENABLE ) , CB_GETCURSEL , 0 , 0 ) ? 1 : 0 ;
}
EnableWindow ( GetDlgItem ( hwnd , IDC_TFE_SETTINGS_INTERFACE_T ) , enable ) ;
EnableWindow ( GetDlgItem ( hwnd , IDC_TFE_SETTINGS_INTERFACE ) , enable ) ;
if ( enable )
{
char * pname = NULL ;
char * pdescription = NULL ;
number = SendMessage ( GetDlgItem ( hwnd , IDC_TFE_SETTINGS_INTERFACE ) , CB_GETCURSEL , 0 , 0 ) ;
if ( get_tfename ( number , & pname , & pdescription ) )
{
SetWindowText ( GetDlgItem ( hwnd , IDC_TFE_SETTINGS_INTERFACE_NAME ) , pname ) ;
SetWindowText ( GetDlgItem ( hwnd , IDC_TFE_SETTINGS_INTERFACE_DESC ) , pdescription ) ;
lib_free ( pname ) ;
lib_free ( pdescription ) ;
}
}
else
{
SetWindowText ( GetDlgItem ( hwnd , IDC_TFE_SETTINGS_INTERFACE_NAME ) , " " ) ;
SetWindowText ( GetDlgItem ( hwnd , IDC_TFE_SETTINGS_INTERFACE_DESC ) , " " ) ;
}
return disabled ? 1 : 0 ;
2006-03-24 06:34:37 +00:00
}
2009-12-12 11:04:22 +00:00
static uilib_localize_dialog_param tfe_dialog [ ] =
{
{ 0 , IDS_TFE_CAPTION , - 1 } ,
{ IDC_TFE_SETTINGS_ENABLE_T , IDS_TFE_ETHERNET , 0 } ,
{ IDC_TFE_SETTINGS_INTERFACE_T , IDS_TFE_INTERFACE , 0 } ,
{ IDOK , IDS_OK , 0 } ,
{ IDCANCEL , IDS_CANCEL , 0 } ,
{ 0 , 0 , 0 }
2006-03-24 06:34:37 +00:00
} ;
2009-12-12 11:04:22 +00:00
static uilib_dialog_group tfe_leftgroup [ ] =
{
{ IDC_TFE_SETTINGS_ENABLE_T , 0 } ,
{ IDC_TFE_SETTINGS_INTERFACE_T , 0 } ,
{ 0 , 0 }
2006-03-24 06:34:37 +00:00
} ;
2009-12-12 11:04:22 +00:00
static uilib_dialog_group tfe_rightgroup [ ] =
{
{ IDC_TFE_SETTINGS_ENABLE , 0 } ,
{ IDC_TFE_SETTINGS_INTERFACE , 0 } ,
{ 0 , 0 }
2006-03-24 06:34:37 +00:00
} ;
static void init_tfe_dialog ( HWND hwnd )
{
2009-12-12 11:04:22 +00:00
HWND temp_hwnd ;
int active_value ;
2006-03-24 06:34:37 +00:00
2009-12-12 11:04:22 +00:00
int tfe_enable ;
int xsize , ysize ;
2006-03-24 06:34:37 +00:00
2009-12-12 11:04:22 +00:00
char * interface_name = NULL ;
2006-03-24 06:34:37 +00:00
2009-12-12 11:04:22 +00:00
uilib_get_group_extent ( hwnd , tfe_leftgroup , & xsize , & ysize ) ;
uilib_adjust_group_width ( hwnd , tfe_leftgroup ) ;
uilib_move_group ( hwnd , tfe_rightgroup , xsize + 30 ) ;
2006-03-24 06:34:37 +00:00
2009-12-12 11:04:22 +00:00
//resources_get_value("ETHERNET_ACTIVE", (void *)&tfe_enabled);
2006-03-24 06:34:37 +00:00
get_tfe_enabled ( & tfe_enable ) ;
2009-12-12 11:04:22 +00:00
//resources_get_value("ETHERNET_AS_RR", (void *)&tfe_as_rr_net);
active_value = ( tfe_enable ? 1 : 0 ) ;
2006-03-24 06:34:37 +00:00
2009-12-12 11:04:22 +00:00
temp_hwnd = GetDlgItem ( hwnd , IDC_TFE_SETTINGS_ENABLE ) ;
SendMessage ( temp_hwnd , CB_ADDSTRING , 0 , ( LPARAM ) " Disabled " ) ;
SendMessage ( temp_hwnd , CB_ADDSTRING , 0 , ( LPARAM ) " Uthernet " ) ;
SendMessage ( temp_hwnd , CB_SETCURSEL , ( WPARAM ) active_value , 0 ) ;
2006-03-24 06:34:37 +00:00
2009-12-12 11:04:22 +00:00
//resources_get_value("ETHERNET_INTERFACE", (void *)&interface_name);
2006-03-24 06:34:37 +00:00
interface_name = ( char * ) get_tfe_interface ( ) ;
2009-12-12 11:04:22 +00:00
if ( tfe_enumadapter_open ( ) )
{
int cnt = 0 ;
char * pname ;
char * pdescription ;
temp_hwnd = GetDlgItem ( hwnd , IDC_TFE_SETTINGS_INTERFACE ) ;
for ( cnt = 0 ; tfe_enumadapter ( & pname , & pdescription ) ; cnt + + )
{
BOOL this_entry = FALSE ;
2006-03-24 06:34:37 +00:00
2009-12-12 11:04:22 +00:00
if ( strcmp ( pname , interface_name ) = = 0 )
{
this_entry = TRUE ;
}
SetWindowText ( GetDlgItem ( hwnd , IDC_TFE_SETTINGS_INTERFACE_NAME ) , pname ) ;
SetWindowText ( GetDlgItem ( hwnd , IDC_TFE_SETTINGS_INTERFACE_DESC ) , pdescription ) ;
SendMessage ( temp_hwnd , CB_ADDSTRING , 0 , ( LPARAM ) pname ) ;
lib_free ( pname ) ;
lib_free ( pdescription ) ;
if ( this_entry )
{
SendMessage ( GetDlgItem ( hwnd , IDC_TFE_SETTINGS_INTERFACE ) ,
CB_SETCURSEL , ( WPARAM ) cnt , 0 ) ;
}
}
tfe_enumadapter_close ( ) ;
}
if ( gray_ungray_items ( hwnd ) )
{
/* we have a problem: TFE is disabled. Give a message to the user */
MessageBox ( hwnd ,
" TFE support is not available on your system, \n "
" there is some important part missing. Please have a \n "
" look at the VICE knowledge base support page \n "
" \n http://www.vicekb.de.vu/13-005.htm \n \n "
" for possible reasons and to activate networking with VICE. " ,
" TFE support " , MB_ICONINFORMATION | MB_OK ) ;
/* just quit the dialog before it is open */
SendMessage ( hwnd , WM_COMMAND , IDCANCEL , 0 ) ;
}
}
2006-03-24 06:34:37 +00:00
static void save_tfe_dialog ( HWND hwnd )
{
2009-12-12 11:04:22 +00:00
int active_value ;
int tfe_enabled ;
char buffer [ 256 ] ;
buffer [ 255 ] = 0 ;
GetDlgItemText ( hwnd , IDC_TFE_SETTINGS_INTERFACE , buffer , sizeof ( buffer ) - 1 ) ;
2006-03-24 06:34:37 +00:00
// RGJ - Added check for NULL interface so we don't set it active without a valid interface selected
2009-12-12 11:04:22 +00:00
if ( strlen ( buffer ) > 0 )
{
2006-03-24 06:34:37 +00:00
RegSaveString ( TEXT ( " Configuration " ) , TEXT ( " Uthernet Interface " ) , 1 , buffer ) ;
2009-12-12 11:04:22 +00:00
active_value = SendMessage ( GetDlgItem ( hwnd , IDC_TFE_SETTINGS_ENABLE ) , CB_GETCURSEL , 0 , 0 ) ;
2006-03-24 06:34:37 +00:00
tfe_enabled = active_value > = 1 ? 1 : 0 ;
2009-01-09 23:27:29 +00:00
REGSAVE ( TEXT ( " Uthernet Active " ) , tfe_enabled ) ;
2009-12-12 11:04:22 +00:00
}
else
{
2009-01-09 23:27:29 +00:00
REGSAVE ( TEXT ( " Uthernet Active " ) , 0 ) ;
2006-03-24 06:34:37 +00:00
}
}
static BOOL CALLBACK TfeDlgProc ( HWND hwnd , UINT msg , WPARAM wparam , LPARAM lparam )
{
2009-12-12 11:04:22 +00:00
switch ( msg )
{
case WM_COMMAND :
switch ( LOWORD ( wparam ) )
{
case IDOK :
save_tfe_dialog ( hwnd ) ;
/* FALL THROUGH */
case IDCANCEL :
EndDialog ( hwnd , 0 ) ;
return TRUE ;
case IDC_TFE_SETTINGS_INTERFACE :
/* FALL THROUGH */
2006-03-24 06:34:37 +00:00
2009-12-12 11:04:22 +00:00
case IDC_TFE_SETTINGS_ENABLE :
gray_ungray_items ( hwnd ) ;
break ;
}
return FALSE ;
case WM_CLOSE :
EndDialog ( hwnd , 0 ) ;
return TRUE ;
case WM_INITDIALOG :
init_tfe_dialog ( hwnd ) ;
return TRUE ;
}
return FALSE ;
}
2006-03-24 06:34:37 +00:00
void ui_tfe_settings_dialog ( HWND hwnd )
{
2009-12-12 11:04:22 +00:00
DialogBox ( g_hInstance , ( LPCTSTR ) IDD_TFE_SETTINGS_DIALOG , hwnd , TfeDlgProc ) ;
2006-03-24 06:34:37 +00:00
}
2006-02-25 20:50:29 +00:00
//===========================================================================
2008-06-20 23:47:25 +00:00
//Setup
2006-02-25 20:50:29 +00:00
void PSP_Init ( )
{
PROPSHEETPAGE PropSheetPages [ PG_NUM_SHEETS ] ;
PropSheetPages [ PG_CONFIG ] . dwSize = sizeof ( PROPSHEETPAGE ) ;
PropSheetPages [ PG_CONFIG ] . dwFlags = PSP_DEFAULT ;
2006-07-02 09:56:50 +00:00
PropSheetPages [ PG_CONFIG ] . hInstance = g_hInstance ;
2006-02-25 20:50:29 +00:00
PropSheetPages [ PG_CONFIG ] . pszTemplate = MAKEINTRESOURCE ( IDD_PROPPAGE_CONFIG ) ;
PropSheetPages [ PG_CONFIG ] . pfnDlgProc = ( DLGPROC ) ConfigDlgProc ;
PropSheetPages [ PG_INPUT ] . dwSize = sizeof ( PROPSHEETPAGE ) ;
PropSheetPages [ PG_INPUT ] . dwFlags = PSP_DEFAULT ;
2006-07-02 09:56:50 +00:00
PropSheetPages [ PG_INPUT ] . hInstance = g_hInstance ;
2006-02-25 20:50:29 +00:00
PropSheetPages [ PG_INPUT ] . pszTemplate = MAKEINTRESOURCE ( IDD_PROPPAGE_INPUT ) ;
PropSheetPages [ PG_INPUT ] . pfnDlgProc = ( DLGPROC ) InputDlgProc ;
PropSheetPages [ PG_SOUND ] . dwSize = sizeof ( PROPSHEETPAGE ) ;
PropSheetPages [ PG_SOUND ] . dwFlags = PSP_DEFAULT ;
2006-07-02 09:56:50 +00:00
PropSheetPages [ PG_SOUND ] . hInstance = g_hInstance ;
2006-02-25 20:50:29 +00:00
PropSheetPages [ PG_SOUND ] . pszTemplate = MAKEINTRESOURCE ( IDD_PROPPAGE_SOUND ) ;
PropSheetPages [ PG_SOUND ] . pfnDlgProc = ( DLGPROC ) SoundDlgProc ;
PropSheetPages [ PG_DISK ] . dwSize = sizeof ( PROPSHEETPAGE ) ;
PropSheetPages [ PG_DISK ] . dwFlags = PSP_DEFAULT ;
2006-07-02 09:56:50 +00:00
PropSheetPages [ PG_DISK ] . hInstance = g_hInstance ;
2006-02-25 20:50:29 +00:00
PropSheetPages [ PG_DISK ] . pszTemplate = MAKEINTRESOURCE ( IDD_PROPPAGE_DISK ) ;
PropSheetPages [ PG_DISK ] . pfnDlgProc = ( DLGPROC ) DiskDlgProc ;
2008-04-11 21:54:06 +00:00
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 ;
2006-02-25 20:50:29 +00:00
PROPSHEETHEADER PropSheetHeader ;
PropSheetHeader . dwSize = sizeof ( PROPSHEETHEADER ) ;
PropSheetHeader . dwFlags = PSH_NOAPPLYNOW | /* PSH_NOCONTEXTHELP | */ PSH_PROPSHEETPAGE ;
2006-05-14 00:44:38 +00:00
PropSheetHeader . hwndParent = g_hFrameWindow ;
2006-02-25 20:50:29 +00:00
PropSheetHeader . pszCaption = " AppleWin Configuration " ;
PropSheetHeader . nPages = PG_NUM_SHEETS ;
PropSheetHeader . nStartPage = g_nLastPage ;
PropSheetHeader . ppsp = PropSheetPages ;
2008-04-11 21:54:06 +00:00
g_bEnableFreezeDlgButton = UNDEFINED ;
2006-02-25 20:50:29 +00:00
int i = PropertySheet ( & PropSheetHeader ) ; // Result: 0=Cancel, 1=OK
}
DWORD PSP_GetVolumeMax ( )
{
return VOLUME_MAX ;
}
2008-06-21 15:02:36 +00:00
// Called when F11/F12 is pressed
2006-02-25 20:50:29 +00:00
bool PSP_SaveStateSelectImage ( HWND hWindow , bool bSave )
{
2008-06-21 11:48:15 +00:00
g_szSSNewDirectory [ 0 ] = 0x00 ;
2006-02-25 20:50:29 +00:00
if ( SaveStateSelectImage ( hWindow , bSave ? TEXT ( " Select Save State file " )
: TEXT ( " Select Load State file " ) , bSave ) )
{
SaveStateUpdate ( ) ;
return true ;
}
else
{
return false ; // Cancelled
}
}
2008-06-20 23:47:25 +00:00
2009-01-06 22:02:31 +00:00
//===========================================================================
2008-06-20 23:47:25 +00:00
2009-01-09 21:59:22 +00:00
string BrowseToFile ( HWND hWindow , TCHAR * pszTitle , TCHAR * REGVALUE , TCHAR * FILEMASKS )
2008-06-20 23:47:25 +00:00
{
2009-01-09 21:59:22 +00:00
static char PathToFile [ MAX_PATH ] = { 0 } ; //This is a really awkward way to prevent mixing CiderPress and SaveStated values (RAPCS), but it seem the quickest. Here is its Line 1.
strcpy ( PathToFile , Snapshot_GetFilename ( ) ) ; //RAPCS, line 2.
2008-06-20 23:47:25 +00:00
TCHAR szDirectory [ MAX_PATH ] = TEXT ( " " ) ;
2009-01-09 21:59:22 +00:00
TCHAR szFilename [ MAX_PATH ] ;
strcpy ( szFilename , " " ) ;
RegLoadString ( TEXT ( " Configuration " ) , REGVALUE , 1 , szFilename , MAX_PATH ) ;
string PathName = szFilename ;
2008-06-20 23:47:25 +00:00
OPENFILENAME ofn ;
ZeroMemory ( & ofn , sizeof ( OPENFILENAME ) ) ;
2009-01-09 21:59:22 +00:00
2008-06-20 23:47:25 +00:00
ofn . lStructSize = sizeof ( OPENFILENAME ) ;
ofn . hwndOwner = hWindow ;
ofn . hInstance = g_hInstance ;
2009-01-09 21:59:22 +00:00
ofn . lpstrFilter = FILEMASKS ;
/*ofn.lpstrFilter = TEXT("Applications (*.exe)\0*.exe\0")
TEXT ( " Text files (*.txt) \0 *.txt \0 " )
TEXT ( " All Files \0 *.* \0 " ) ; */
ofn . lpstrFile = szFilename ;
2008-06-20 23:47:25 +00:00
ofn . nMaxFile = MAX_PATH ;
ofn . lpstrInitialDir = szDirectory ;
ofn . Flags = OFN_PATHMUSTEXIST | OFN_HIDEREADONLY ;
ofn . lpstrTitle = pszTitle ;
2009-01-09 21:59:22 +00:00
2008-06-20 23:47:25 +00:00
int nRes = GetOpenFileName ( & ofn ) ;
2009-12-12 11:04:22 +00:00
if ( nRes ) // Okay is pressed
2008-06-20 23:47:25 +00:00
{
2009-01-09 21:59:22 +00:00
strcpy ( g_szNewFilename , & szFilename [ ofn . nFileOffset ] ) ;
szFilename [ ofn . nFileOffset ] = 0 ;
if ( _tcsicmp ( szDirectory , szFilename ) )
strcpy ( g_szSSNewDirectory , szFilename ) ;
PathName = szFilename ;
PathName . append ( g_szNewFilename ) ;
2008-06-20 23:47:25 +00:00
}
2009-12-12 11:04:22 +00:00
else // Cancel is pressed
2008-06-20 23:47:25 +00:00
{
2009-01-09 21:59:22 +00:00
RegLoadString ( TEXT ( " Configuration " ) , REGVALUE , 1 , szFilename , MAX_PATH ) ;
PathName = szFilename ;
2008-06-20 23:47:25 +00:00
}
2009-12-12 11:04:22 +00:00
2009-01-09 21:59:22 +00:00
strcpy ( g_szNewFilename , PathToFile ) ; //RAPCS, line 3 (last).
2008-06-20 23:47:25 +00:00
return PathName ;
}