From d511effa5a427671b62d2430df3e5b03b94fbfb2 Mon Sep 17 00:00:00 2001 From: tomch Date: Fri, 22 Feb 2008 21:28:35 +0000 Subject: [PATCH] . Change: Moved 'Mouse interface in slot 4' from Configuration to Input config page . Added support for The Freeze's F8 cracking ROM . Added -f8rom cmd line switch to allow loading a custom 2K Rom at $F800 --- Applewin.vcproj | 8 +- docs/History.txt | 5 ++ resource/Applewin.rc | 7 +- resource/resource.h | 4 +- source/Applewin.cpp | 66 +++++++++++----- source/Applewin.h | 2 + source/Common.h | 3 +- source/Memory.cpp | 33 +++++++- source/PropertySheetPage.cpp | 144 +++++++++++++++++++++++------------ source/PropertySheetPage.h | 1 + source/StdAfx.h | 1 + 11 files changed, 199 insertions(+), 75 deletions(-) diff --git a/Applewin.vcproj b/Applewin.vcproj index 9a6d6771..8610bfae 100644 --- a/Applewin.vcproj +++ b/Applewin.vcproj @@ -74,7 +74,7 @@ /> + + diff --git a/docs/History.txt b/docs/History.txt index 35d4d676..9ea27b8f 100644 --- a/docs/History.txt +++ b/docs/History.txt @@ -21,6 +21,11 @@ Restrictions/bugs: ---------------------------- . Change: Removed crosshairs in mouse-mode . Change: Hide Windows' mouse cursor when over Apple's screen (in mouse-mode) +. Change: Moved 'Mouse interface in slot 4' from Configuration to Input config page +. Added -f8rom cmd line switch to allow loading a custom 2K Rom at $F800 +. Added support for "The Freeze's" F8 ROM (Apple][ & Apple][+ only) + - It's a non-autostart ROM (was used for cracking). Use 'C600G' command to boot floppy + - It added extended output in the Monitor's 'L' command. . Fix: Use mouse position delta (fixes GEOS) 1.14.1.1 - 13 Aug 2007 (beta) diff --git a/resource/Applewin.rc b/resource/Applewin.rc index bf3b6adc..62fb3ec5 100644 --- a/resource/Applewin.rc +++ b/resource/Applewin.rc @@ -98,7 +98,8 @@ 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 "Mouse interface in slot 4",IDC_MOUSE_IN_SLOT4,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,206,106,10 + 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 @@ -121,6 +122,7 @@ BEGIN CONTROL "Scroll Lock acts as toggle for full-speed CPU",IDC_SCROLLLOCK_TOGGLE, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,9,114,166,10 LTEXT "(Shift+Insert during emulation)",IDC_STATIC,89,166,94,8 + CONTROL "Mouse interface in slot 4",IDC_MOUSE_IN_SLOT4,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,9,128,106,10 END IDD_PROPPAGE_SOUND DIALOGEX 0, 0, 210, 221 @@ -231,7 +233,7 @@ BEGIN VALUE "FileDescription", "Apple //e Emulator for Windows" VALUE "FileVersion", "1, 14, 1, 2" VALUE "InternalName", "APPLEWIN" - VALUE "LegalCopyright", "© 1994-2007 Michael O'Brien, Oliver Schmidt, Tom Charlesworth, Michael Pohoreski, Nick Westgate, Linards Ticmanis" + VALUE "LegalCopyright", "© 1994-2008 Michael O'Brien, Oliver Schmidt, Tom Charlesworth, Michael Pohoreski, Nick Westgate, Linards Ticmanis" VALUE "OriginalFilename", "APPLEWIN.EXE" VALUE "ProductName", "Apple //e Emulator" VALUE "ProductVersion", "1, 14, 1, 2" @@ -277,6 +279,7 @@ IDR_APPLE2_ROM ROM "Apple2.rom" IDR_APPLE2_PLUS_ROM ROM "Apple2_Plus.rom" IDR_APPLE2E_ROM ROM "Apple2e.rom" IDR_APPLE2E_ENHANCED_ROM ROM "Apple2e_Enhanced.rom" +IDR_FREEZES_F8_ROM ROM "FREEZES_NON-AUTOSTART_F8_ROM.rom" ///////////////////////////////////////////////////////////////////////////// // diff --git a/resource/resource.h b/resource/resource.h index 45fddaf6..9bb1763d 100644 --- a/resource/resource.h +++ b/resource/resource.h @@ -39,6 +39,7 @@ #define IDR_SSC_FW 134 #define IDR_MOCKINGBOARD_D_FW 135 #define IDR_MOUSEINTERFACE_FW 136 +#define IDR_FREEZES_F8_ROM 137 #define IDC_KEYB_BUFFER_ENABLE 1005 #define IDC_SAVESTATE 1006 #define IDC_SAVESTATE_ON_EXIT 1007 @@ -75,6 +76,7 @@ #define IDC_ETHERNET 1042 #define IDC_SCROLLLOCK_TOGGLE 1043 #define IDC_MOUSE_IN_SLOT4 1044 +#define IDC_THE_FREEZES_F8_ROM_FW 1045 #define IDM_EXIT 40001 #define IDM_HELP 40002 #define IDM_ABOUT 40003 @@ -89,7 +91,7 @@ #define _APS_NO_MFC 1 #define _APS_NEXT_RESOURCE_VALUE 137 #define _APS_NEXT_COMMAND_VALUE 40007 -#define _APS_NEXT_CONTROL_VALUE 1045 +#define _APS_NEXT_CONTROL_VALUE 1046 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif diff --git a/source/Applewin.cpp b/source/Applewin.cpp index 80141f7d..5fd4c7b0 100644 --- a/source/Applewin.cpp +++ b/source/Applewin.cpp @@ -28,6 +28,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include "StdAfx.h" #pragma hdrstop +#include #include "MouseInterface.h" char VERSIONSTRING[] = "xx.yy.zz.ww"; @@ -68,7 +69,10 @@ bool g_bDisableDirectSound = false; CSuperSerialCard sg_SSC; CMouseInterface sg_Mouse; -UINT g_Slot4 = CT_Mockingboard; // CT_Mockingboard or CT_MouseInterface +UINT g_Slot4 = CT_Mockingboard; // CT_Mockingboard or CT_MouseInterface + +HANDLE g_hCustomRomF8 = INVALID_HANDLE_VALUE; // Cmd-line specified custom ROM at $F800..$FFFF +static bool g_bCustomRomF8Failed = false; // Set if custom ROM file failed //=========================================================================== @@ -398,9 +402,8 @@ void LoadConfiguration () DWORD dwTmp; - if(LOAD(TEXT(REGVALUE_MOUSE_IN_SLOT4), &dwTmp)) - g_uMouseInSlot4 = dwTmp; - g_Slot4 = g_uMouseInSlot4 ? CT_MouseInterface : CT_Mockingboard; + if(LOAD(TEXT(REGVALUE_THE_FREEZES_F8_ROM), &dwTmp)) + g_uTheFreezesF8Rom = dwTmp; if(LOAD(TEXT(REGVALUE_SPKR_VOLUME), &dwTmp)) SpkrSetVolume(dwTmp, PSP_GetVolumeMax()); @@ -431,6 +434,10 @@ void LoadConfiguration () if(LOAD(TEXT(REGVALUE_SCROLLLOCK_TOGGLE), &dwTmp)) g_uScrollLockToggle = dwTmp; + if(LOAD(TEXT(REGVALUE_MOUSE_IN_SLOT4), &dwTmp)) + g_uMouseInSlot4 = dwTmp; + g_Slot4 = g_uMouseInSlot4 ? CT_MouseInterface : CT_Mockingboard; + // char szFilename[MAX_PATH] = {0}; @@ -497,6 +504,14 @@ void RegisterExtensions () //=========================================================================== +LPSTR GetCurrArg(LPSTR lpCmdLine) +{ + if(*lpCmdLine == '\"') + lpCmdLine++; + + return lpCmdLine; +} + LPSTR GetNextArg(LPSTR lpCmdLine) { int bInQuotes = 0; @@ -555,19 +570,15 @@ int APIENTRY WinMain (HINSTANCE passinstance, HINSTANCE, LPSTR lpCmdLine, int) if(strcmp(lpCmdLine, "-d1") == 0) { - lpCmdLine = lpNextArg; - lpNextArg = GetNextArg(lpCmdLine); + lpCmdLine = GetCurrArg(lpNextArg); + lpNextArg = GetNextArg(lpNextArg); szImageName_drive1 = lpCmdLine; - if(*szImageName_drive1 == '\"') - szImageName_drive1++; } else if(strcmp(lpCmdLine, "-d2") == 0) { - lpCmdLine = lpNextArg; - lpNextArg = GetNextArg(lpCmdLine); + lpCmdLine = GetCurrArg(lpNextArg); + lpNextArg = GetNextArg(lpNextArg); szImageName_drive2 = lpCmdLine; - if(*szImageName_drive2 == '\"') - szImageName_drive2++; } else if(strcmp(lpCmdLine, "-f") == 0) { @@ -588,8 +599,8 @@ int APIENTRY WinMain (HINSTANCE passinstance, HINSTANCE, LPSTR lpCmdLine, int) #ifdef RAMWORKS else if(strcmp(lpCmdLine, "-r") == 0) // RamWorks size [1..127] { - lpCmdLine = lpNextArg; - lpNextArg = GetNextArg(lpCmdLine); + lpCmdLine = GetCurrArg(lpNextArg); + lpNextArg = GetNextArg(lpNextArg); g_uMaxExPages = atoi(lpCmdLine); if (g_uMaxExPages > 127) g_uMaxExPages = 128; @@ -597,6 +608,14 @@ int APIENTRY WinMain (HINSTANCE passinstance, HINSTANCE, LPSTR lpCmdLine, int) g_uMaxExPages = 1; } #endif + else if(strcmp(lpCmdLine, "-f8rom") == 0) // Use custom 2K ROM at [$F800..$FFFF] + { + lpCmdLine = GetCurrArg(lpNextArg); + lpNextArg = GetNextArg(lpNextArg); + g_hCustomRomF8 = CreateFile(lpCmdLine, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_READONLY, NULL); + if ((g_hCustomRomF8 == INVALID_HANDLE_VALUE) || (GetFileSize(g_hCustomRomF8, NULL) != 0x800)) + g_bCustomRomF8Failed = true; + } lpCmdLine = lpNextArg; } @@ -653,9 +672,9 @@ int APIENTRY WinMain (HINSTANCE passinstance, HINSTANCE, LPSTR lpCmdLine, int) //----- - // Initialize COM - // . NB. DSInit() is done when g_hFrameWindow is created (WM_CREATE) - CoInitialize( NULL ); + // Initialize COM - so we can use CoCreateInstance + // . NB. DSInit() & DirectInputInit are done when g_hFrameWindow is created (WM_CREATE) + CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); bool bSysClkOK = SysClk_InitTimer(); // DO ONE-TIME INITIALIZATION @@ -695,6 +714,8 @@ int APIENTRY WinMain (HINSTANCE passinstance, HINSTANCE, LPSTR lpCmdLine, int) MemInitialize(); VideoInitialize(); FrameCreateWindow(); + // Need to test if it's safe to call ResetMachineState(). In the meantime, just call DiskReset(): + DiskReset(); // Switch from a booting A][+ to a non-autostart A][, so need to turn off floppy motor if (!bSysClkOK) { @@ -702,6 +723,12 @@ int APIENTRY WinMain (HINSTANCE passinstance, HINSTANCE, LPSTR lpCmdLine, int) PostMessage(g_hFrameWindow, WM_DESTROY, 0, 0); // Close everything down } + if (g_bCustomRomF8Failed) + { + MessageBox(g_hFrameWindow, "Failed to load custom F8 rom (not found or not exactly 2KB)", TEXT("AppleWin Error"), MB_OK); + PostMessage(g_hFrameWindow, WM_DESTROY, 0, 0); // Close everything down + } + tfe_init(); Snapshot_Startup(); // Do this after everything has been init'ed @@ -734,7 +761,7 @@ int APIENTRY WinMain (HINSTANCE passinstance, HINSTANCE, LPSTR lpCmdLine, int) tfe_shutdown(); - if(g_fh) + if (g_fh) { fprintf(g_fh,"*** Logging ended\n\n"); fclose(g_fh); @@ -742,5 +769,8 @@ int APIENTRY WinMain (HINSTANCE passinstance, HINSTANCE, LPSTR lpCmdLine, int) RiffFinishWriteFile(); + if (g_hCustomRomF8 != INVALID_HANDLE_VALUE) + CloseHandle(g_hCustomRomF8); + return 0; } diff --git a/source/Applewin.h b/source/Applewin.h index a66b413a..35348a94 100644 --- a/source/Applewin.h +++ b/source/Applewin.h @@ -35,4 +35,6 @@ extern bool g_bDisableDirectSound; // Cmd line switch: don't init DS (so n extern UINT g_Slot4; // Mockingboard or Mouse in slot4 +extern HANDLE g_hCustomRomF8; // NULL if no custom rom + void SetCurrentCLK6502(); diff --git a/source/Common.h b/source/Common.h index cd63a235..fa81e23a 100644 --- a/source/Common.h +++ b/source/Common.h @@ -72,7 +72,7 @@ enum AppMode_e #define REGVALUE_SPKR_VOLUME "Speaker Volume" #define REGVALUE_MB_VOLUME "Mockingboard Volume" #define REGVALUE_SOUNDCARD_TYPE "Soundcard Type" -#define REGVALUE_KEYB_BUFFER_ENABLE "Keyboard Buffer Enable" +//#define REGVALUE_KEYB_BUFFER_ENABLE "Keyboard Buffer Enable" #define REGVALUE_SAVESTATE_FILENAME "Save State Filename" #define REGVALUE_SAVE_STATE_ON_EXIT "Save State On Exit" #define REGVALUE_HDD_ENABLED "Harddisk Enable" @@ -82,6 +82,7 @@ enum AppMode_e #define REGVALUE_PDL_YTRIM "PDL Y-Trim" #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" // Preferences #define REGVALUE_PREF_START_DIR TEXT("Starting Directory") diff --git a/source/Memory.cpp b/source/Memory.cpp index db84f860..71612622 100644 --- a/source/Memory.cpp +++ b/source/Memory.cpp @@ -990,7 +990,38 @@ void MemInitialize() } _ASSERT(ROM_SIZE == Apple2RomSize); - memcpy(memrom, pData, Apple2RomSize); // ROM at $D000...$FFFF + memcpy(memrom, pData, Apple2RomSize); // ROM at $D000...$FFFF + + const UINT F8RomSize = 0x800; + if (g_hCustomRomF8 != INVALID_HANDLE_VALUE) + { + SetFilePointer(g_hCustomRomF8, 0, NULL, FILE_BEGIN); + DWORD uNumBytesRead; + BOOL bRes = ReadFile(g_hCustomRomF8, memrom+Apple2RomSize-F8RomSize, F8RomSize, &uNumBytesRead, NULL); + if (uNumBytesRead != F8RomSize) + { + memcpy(memrom, pData, Apple2RomSize); // ROM at $D000...$FFFF + bRes = FALSE; + } + + if (!bRes) + { + MessageBox( g_hFrameWindow, "Failed to read custom F8 rom", TEXT("AppleWin Error"), MB_OK ); + CloseHandle(g_hCustomRomF8); + g_hCustomRomF8 = INVALID_HANDLE_VALUE; + // Failed, so use default rom... + } + } + + if (g_uTheFreezesF8Rom) + { + hResInfo = FindResource(NULL, MAKEINTRESOURCE(IDR_FREEZES_F8_ROM), "ROM"); + + if (hResInfo && (SizeofResource(NULL, hResInfo) == 0x800) && (hResData = LoadResource(NULL, hResInfo)) && (pData = (BYTE*) LockResource(hResData))) + { + memcpy(memrom+Apple2RomSize-F8RomSize, pData, F8RomSize); + } + } // diff --git a/source/PropertySheetPage.cpp b/source/PropertySheetPage.cpp index ccf170ff..eada402c 100644 --- a/source/PropertySheetPage.cpp +++ b/source/PropertySheetPage.cpp @@ -101,6 +101,7 @@ enum {PG_CONFIG=0, PG_INPUT, PG_SOUND, PG_SAVESTATE, PG_DISK, PG_NUM_SHEETS}; UINT g_nLastPage = PG_CONFIG; +UINT g_uTheFreezesF8Rom = 0; UINT g_uScrollLockToggle = 0; UINT g_uMouseInSlot4 = 0; @@ -205,28 +206,30 @@ static void InitJoystickChoices(HWND window, int nJoyNum, int nIdcValue) //=========================================================================== -static void ConfigDlg_OK(HWND window, BOOL afterclose) +static eApple2Type GetApple2Type(DWORD NewCompType) { - eApple2Type NewApple2Type; - + switch (NewCompType) { - DWORD newcomptype = (DWORD) SendDlgItemMessage(window,IDC_COMPUTER,CB_GETCURSEL,0,0); - - switch (newcomptype) - { - case 0: NewApple2Type = A2TYPE_APPLE2; break; - case 1: NewApple2Type = A2TYPE_APPLE2PLUS; break; - case 2: NewApple2Type = A2TYPE_APPLE2E; break; - case 3: NewApple2Type = A2TYPE_APPLE2EEHANCED; break; - } + case 0: return A2TYPE_APPLE2; + case 1: return A2TYPE_APPLE2PLUS; + case 2: return A2TYPE_APPLE2E; + case 3: return A2TYPE_APPLE2EEHANCED; + default: return A2TYPE_APPLE2EEHANCED; } +} + +static void ConfigDlg_OK(HWND window, UINT afterclose) +{ + DWORD NewCompType = (DWORD) SendDlgItemMessage(window,IDC_COMPUTER,CB_GETCURSEL,0,0); + eApple2Type NewApple2Type = GetApple2Type(NewCompType); DWORD newvidtype = (DWORD)SendDlgItemMessage(window,IDC_VIDEOTYPE,CB_GETCURSEL,0,0); DWORD newserialport = (DWORD)SendDlgItemMessage(window,IDC_SERIALPORT,CB_GETCURSEL,0,0); if (NewApple2Type != g_Apple2Type) { - if (MessageBox(window, + 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 " @@ -237,6 +240,9 @@ static void ConfigDlg_OK(HWND window, BOOL afterclose) MB_ICONQUESTION | MB_YESNO | MB_SETFOREGROUND) == IDYES) { afterclose = WM_USER_RESTART; + + if (NewApple2Type > A2TYPE_APPLE2PLUS) + g_uTheFreezesF8Rom = false; } } @@ -262,7 +268,7 @@ static void ConfigDlg_OK(HWND window, BOOL afterclose) SAVE(TEXT("Custom Speed") ,IsDlgButtonChecked(window,IDC_CUSTOM_SPEED)); SAVE(TEXT("Emulation Speed") ,g_dwSpeed); SAVE(TEXT("Video Emulation") ,videotype); - SAVE(TEXT(REGVALUE_MOUSE_IN_SLOT4),g_uMouseInSlot4); + SAVE(TEXT(REGVALUE_THE_FREEZES_F8_ROM),g_uTheFreezesF8Rom); // @@ -280,7 +286,7 @@ static BOOL CALLBACK ConfigDlgProc (HWND window, UINT message, WPARAM wparam, LPARAM lparam) { - static BOOL afterclose = 0; + static UINT afterclose = 0; switch (message) { @@ -327,39 +333,42 @@ static BOOL CALLBACK ConfigDlgProc (HWND window, case IDC_BENCHMARK: afterclose = WM_USER_BENCHMARK; - PropSheet_PressButton(GetParent(window), PSBTN_OK); + PropSheet_PressButton(GetParent(window), PSBTN_OK); break; - case IDC_ETHERNET: - ui_tfe_settings_dialog(window); - break; + case IDC_ETHERNET: + ui_tfe_settings_dialog(window); + break; case IDC_MONOCOLOR: VideoChooseColor(); break; - case IDC_MOUSE_IN_SLOT4: - UINT uNewState = IsDlgButtonChecked(window, IDC_MOUSE_IN_SLOT4) ? 1 : 0; - LPCSTR pMsg = uNewState ? - TEXT("The emulator needs to restart as the slot configuration has changed.\n") - TEXT("Also Mockingboard/Phasor cards won't be available in slot 4.\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("(Mockingboard/Phasor cards will now be available in slot 4.)\n\n") - TEXT("Would you like to restart the emulator now?"); - if (MessageBox(window, - pMsg, - TEXT("Configuration"), - MB_ICONQUESTION | MB_YESNO | MB_SETFOREGROUND) == IDYES) + 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: { - g_uMouseInSlot4 = uNewState; - afterclose = WM_USER_RESTART; - PropSheet_PressButton(GetParent(window), PSBTN_OK); - } - else - { - CheckDlgButton(window, IDC_MOUSE_IN_SLOT4, g_uMouseInSlot4 ? BST_CHECKED : BST_UNCHECKED); + 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; @@ -415,7 +424,9 @@ static BOOL CALLBACK ConfigDlgProc (HWND window, EnableTrackbar(window, custom); } - CheckDlgButton(window, IDC_MOUSE_IN_SLOT4, g_uMouseInSlot4 ? BST_CHECKED : BST_UNCHECKED); + 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; @@ -449,7 +460,7 @@ static BOOL CALLBACK ConfigDlgProc (HWND window, //=========================================================================== -static void InputDlg_OK(HWND window, BOOL afterclose) +static void InputDlg_OK(HWND window, UINT afterclose) { DWORD newjoytype0 = (DWORD)SendDlgItemMessage(window,IDC_JOYSTICK0,CB_GETCURSEL,0,0); DWORD newjoytype1 = (DWORD)SendDlgItemMessage(window,IDC_JOYSTICK1,CB_GETCURSEL,0,0); @@ -478,6 +489,7 @@ static void InputDlg_OK(HWND window, BOOL afterclose) SAVE(TEXT(REGVALUE_PDL_XTRIM),JoyGetTrim(true)); SAVE(TEXT(REGVALUE_PDL_YTRIM),JoyGetTrim(false)); SAVE(TEXT(REGVALUE_SCROLLLOCK_TOGGLE),g_uScrollLockToggle); + SAVE(TEXT(REGVALUE_MOUSE_IN_SLOT4),g_uMouseInSlot4); // SAVE(TEXT(REGVALUE_KEYB_BUFFER_ENABLE),KeybGetBufferMode() ? 1 : 0); // @@ -497,7 +509,7 @@ static BOOL CALLBACK InputDlgProc (HWND window, WPARAM wparam, LPARAM lparam) { - static BOOL afterclose = 0; + static UINT afterclose = 0; switch (message) { @@ -553,7 +565,8 @@ static BOOL CALLBACK InputDlgProc (HWND window, InitJoystickChoices(window, JN_JOYSTICK1, IDC_JOYSTICK1); // Re-init joy1 list } break; - case IDC_JOYSTICK1: // joystick1 + + case IDC_JOYSTICK1: // joystick1 if(HIWORD(wparam) == CBN_SELCHANGE) { DWORD newjoytype = (DWORD)SendDlgItemMessage(window,IDC_JOYSTICK1,CB_GETCURSEL,0,0); @@ -561,12 +574,42 @@ static BOOL CALLBACK InputDlgProc (HWND window, InitJoystickChoices(window, JN_JOYSTICK0, IDC_JOYSTICK0); // Re-init joy0 list } break; + case IDC_SCROLLLOCK_TOGGLE: g_uScrollLockToggle = IsDlgButtonChecked(window, IDC_SCROLLLOCK_TOGGLE) ? 1 : 0; break; + + case IDC_MOUSE_IN_SLOT4: + { + UINT uNewState = IsDlgButtonChecked(window, IDC_MOUSE_IN_SLOT4) ? 1 : 0; + LPCSTR pMsg = uNewState ? + TEXT("The emulator needs to restart as the slot configuration has changed.\n") + TEXT("Also Mockingboard/Phasor cards won't be available in slot 4.\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("(Mockingboard/Phasor cards will now be available in slot 4.)\n\n") + TEXT("Would you like to restart the emulator now?"); + if (MessageBox(window, + pMsg, + TEXT("Configuration"), + MB_ICONQUESTION | MB_YESNO | MB_SETFOREGROUND) == IDYES) + { + g_uMouseInSlot4 = uNewState; + afterclose = WM_USER_RESTART; + PropSheet_PressButton(GetParent(window), PSBTN_OK); + } + else + { + CheckDlgButton(window, IDC_MOUSE_IN_SLOT4, g_uMouseInSlot4 ? BST_CHECKED : BST_UNCHECKED); + } + } + break; + case IDC_PASTE_FROM_CLIPBOARD: ClipboardInitiatePaste(); break; + // case IDC_KEYB_BUFFER_ENABLE: // break; } @@ -586,6 +629,7 @@ static BOOL CALLBACK InputDlgProc (HWND window, SendDlgItemMessage(window, IDC_SPIN_YTRIM, UDM_SETPOS, 0, MAKELONG(JoyGetTrim(false),0)); 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_KEYB_BUFFER_ENABLE, KeybGetBufferMode() ? BST_CHECKED : BST_UNCHECKED); } } @@ -595,7 +639,7 @@ static BOOL CALLBACK InputDlgProc (HWND window, //=========================================================================== -static void SoundDlg_OK(HWND window, BOOL afterclose, UINT uNewSoundcardType) +static void SoundDlg_OK(HWND window, UINT afterclose, UINT uNewSoundcardType) { DWORD newsoundtype = (DWORD)SendDlgItemMessage(window,IDC_SOUNDTYPE,CB_GETCURSEL,0,0); @@ -636,7 +680,7 @@ static BOOL CALLBACK SoundDlgProc (HWND window, WPARAM wparam, LPARAM lparam) { - static BOOL afterclose = 0; + static UINT afterclose = 0; static UINT uNewSoundcardType = SC_UNINIT; switch (message) @@ -740,7 +784,7 @@ static void SaveStateUpdate() RegSaveString(TEXT("Preferences"),REGVALUE_PREF_START_DIR,1,g_szNewDirectory); } -static void SaveStateDlg_OK(HWND window, BOOL afterclose) +static void SaveStateDlg_OK(HWND window, UINT afterclose) { char szFilename[MAX_PATH]; @@ -830,7 +874,7 @@ static BOOL CALLBACK SaveStateDlgProc (HWND window, WPARAM wparam, LPARAM lparam) { - static BOOL afterclose = 0; + static UINT afterclose = 0; switch (message) { @@ -907,7 +951,7 @@ static void EnableHDD(HWND window, BOOL bEnable) //--------------------------------------------------------------------------- -static void DiskDlg_OK(HWND window, BOOL afterclose) +static void DiskDlg_OK(HWND window, UINT afterclose) { BOOL newdisktype = (BOOL) SendDlgItemMessage(window,IDC_DISKTYPE,CB_GETCURSEL,0,0); @@ -949,7 +993,7 @@ static BOOL CALLBACK DiskDlgProc (HWND window, WPARAM wparam, LPARAM lparam) { - static BOOL afterclose = 0; + static UINT afterclose = 0; switch (message) { diff --git a/source/PropertySheetPage.h b/source/PropertySheetPage.h index ab32beca..55febda4 100644 --- a/source/PropertySheetPage.h +++ b/source/PropertySheetPage.h @@ -7,5 +7,6 @@ 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; diff --git a/source/StdAfx.h b/source/StdAfx.h index 88b44a19..8a12ecd1 100644 --- a/source/StdAfx.h +++ b/source/StdAfx.h @@ -1,4 +1,5 @@ //#define WIN32_LEAN_AND_MEAN +#define _WIN32_WINNT 0x0400 // For CoInitializeEx() to get defined in objbase.h // Mouse Wheel is not supported on Win95. // If we didn't care about supporting Win95 (compile/run-time errors)