diff --git a/resource/Applewin.rc b/resource/Applewin.rc index 26de9f3d..6d69937b 100644 --- a/resource/Applewin.rc +++ b/resource/Applewin.rc @@ -256,8 +256,8 @@ BEGIN COMBOBOX IDC_CLONETYPE,35,185,100,100,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP CONTROL "The Free&ze's non-autostart F8 rom (Apple ][ or ][+ only)",IDC_THE_FREEZES_F8_ROM_FW, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,201,194,10 - LTEXT "&Copy Protection Dongle:",IDC_STATIC,5,220,82,8 - COMBOBOX IDC_COMBO_CP_DONGLE,89,218,100,100,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + LTEXT "&Game I/O Connector:",IDC_STATIC,5,220,82,8 + COMBOBOX IDC_COMBO_GAME_IO_CONNECTOR,89,218,100,100,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP END diff --git a/resource/resource.h b/resource/resource.h index d230cb09..b41b5a9f 100644 --- a/resource/resource.h +++ b/resource/resource.h @@ -113,7 +113,6 @@ #define IDC_COMBO_DISK1 1080 #define IDC_COMBO_DISK2 1081 #define IDC_CHECK_FS_SHOW_SUBUNIT_STATUS 1082 -#define IDC_COMBO_CP_DONGLE 1082 #define IDC_CHECK_VERTICAL_BLEND 1083 #define IDC_CHECK_50HZ_VIDEO 1084 #define IDC_COMBO_DISK1_SLOT5 1085 @@ -123,6 +122,7 @@ #define IDC_CHECK_VIDHD_IN_SLOT3 1089 #define IDC_CHECK_TFE_VIRTUAL_DNS 1090 #define IDC_TFE_NPCAP_INFO 1091 +#define IDC_COMBO_GAME_IO_CONNECTOR 1092 #define IDM_EXIT 40001 #define IDM_HELP 40002 #define IDM_ABOUT 40003 diff --git a/source/Card.h b/source/Card.h index fe606079..e42b7794 100644 --- a/source/Card.h +++ b/source/Card.h @@ -27,7 +27,7 @@ enum SS_CARDTYPE CT_Uthernet2, }; -enum SLOTS { SLOT0=0, SLOT1, SLOT2, SLOT3, SLOT4, SLOT5, SLOT6, SLOT7, NUM_SLOTS, SLOT_AUX }; +enum SLOTS { SLOT0=0, SLOT1, SLOT2, SLOT3, SLOT4, SLOT5, SLOT6, SLOT7, NUM_SLOTS, SLOT_AUX, GAME_IO_CONNECTOR }; class YamlSaveHelper; class YamlLoadHelper; diff --git a/source/Common.h b/source/Common.h index 70940355..8bede813 100644 --- a/source/Common.h +++ b/source/Common.h @@ -73,7 +73,6 @@ enum AppMode_e #define REGVALUE_MB_VOLUME "Mockingboard Volume" #define REGVALUE_SAVESTATE_FILENAME "Save State Filename" #define REGVALUE_SAVE_STATE_ON_EXIT "Save State On Exit" -#define REGVALUE_COPYPROTECTIONDONGLE_TYPE "Copy Protection Dongle Type" #define REGVALUE_HDD_ENABLED "Harddisk Enable" // Deprecated from 1.30.5 #define REGVALUE_JOYSTICK0_EMU_TYPE "Joystick0 Emu Type v3" // GH#434: Added at 1.26.3.0 (previously was "Joystick0 Emu Type") #define REGVALUE_JOYSTICK1_EMU_TYPE "Joystick1 Emu Type v3" // GH#434: Added at 1.26.3.0 (previously was "Joystick1 Emu Type") @@ -117,6 +116,8 @@ enum AppMode_e #define REG_CONFIG_SLOT_AUX "Slot Auxiliary" #define REG_CONFIG_SLOT "Slot " #define REGVALUE_CARD_TYPE "Card type" +#define REG_CONFIG_GAME_IO_CONNECTOR "Game I/O Connector" +#define REGVALUE_GAME_IO_TYPE "Game I/O type" #define REGVALUE_LAST_DISK_1 "Last Disk Image 1" #define REGVALUE_LAST_DISK_2 "Last Disk Image 2" #define REGVALUE_LAST_HARDDISK_1 "Last Harddisk Image 1" diff --git a/source/Configuration/PageAdvanced.cpp b/source/Configuration/PageAdvanced.cpp index 1ea6e885..0a34a914 100644 --- a/source/Configuration/PageAdvanced.cpp +++ b/source/Configuration/PageAdvanced.cpp @@ -44,9 +44,9 @@ const TCHAR CPageAdvanced::m_CloneChoices[] = TEXT("TK3000 //e\0") // Brazilian TEXT("Base 64A\0"); // Taiwanese -enum COPYPROTECTIONDONGLECHOICE { MENUITEM_NONE, MENUITEM_SPEEDSTAR }; -const TCHAR CPageAdvanced::m_CopyProtectionDongleChoices[] = - TEXT("None\0") +//enum GAMEIOCONNECTOR_CHOICE { MENUITEM_EMPTY, MENUITEM_SPEEDSTAR }; +const TCHAR CPageAdvanced::m_gameIOConnectorChoices[] = + TEXT("Empty\0") TEXT("SDS DataKey - Speed Star\0"); // Protection dongle for Southwestern Data Systems "Speed Star" Applesoft Compiler @@ -130,11 +130,11 @@ INT_PTR CPageAdvanced::DlgProcInternal(HWND hWnd, UINT message, WPARAM wparam, L m_PropertySheetHelper.GetConfigNew().m_CpuType = ProbeMainCpuDefault(NewCloneType); } - case IDC_COMBO_CP_DONGLE: + case IDC_COMBO_GAME_IO_CONNECTOR: if (HIWORD(wparam) == CBN_SELCHANGE) { - const DWORD NewCopyProtectionDongleMenuItem = (DWORD)SendDlgItemMessage(hWnd, IDC_COMBO_CP_DONGLE, CB_GETCURSEL, 0, 0); - SetCopyProtectionDongleType(NewCopyProtectionDongleMenuItem); + const DONGLETYPE newCopyProtectionDongleMenuItem = (DONGLETYPE)SendDlgItemMessage(hWnd, IDC_COMBO_GAME_IO_CONNECTOR, CB_GETCURSEL, 0, 0); + SetCopyProtectionDongleType(newCopyProtectionDongleMenuItem); } break; } @@ -193,7 +193,7 @@ void CPageAdvanced::DlgOK(HWND hWnd) REGSAVE(TEXT(REGVALUE_SAVE_STATE_ON_EXIT), g_bSaveStateOnExit ? 1 : 0); // Save the copy protection dongle type - REGSAVE(TEXT(REGVALUE_COPYPROTECTIONDONGLE_TYPE), GetCopyProtectionDongleType()); + RegSetConfigGameIOConnectorNewDongleType(GAME_IO_CONNECTOR, GetCopyProtectionDongleType()); if (GetCardMgr().IsParallelPrinterCardInstalled()) { @@ -233,7 +233,7 @@ void CPageAdvanced::InitOptions(HWND hWnd) { InitFreezeDlgButton(hWnd); InitCloneDropdownMenu(hWnd); - InitCopyProtectionDongleDropdownMenu(hWnd); + InitGameIOConnectorDropdownMenu(hWnd); } // Advanced->Clone: Menu item to eApple2Type @@ -300,9 +300,9 @@ void CPageAdvanced::InitCloneDropdownMenu(HWND hWnd) EnableWindow(GetDlgItem(hWnd, IDC_CLONETYPE), bIsClone ? TRUE : FALSE); } -void CPageAdvanced::InitCopyProtectionDongleDropdownMenu(HWND hWnd) +void CPageAdvanced::InitGameIOConnectorDropdownMenu(HWND hWnd) { // Set copy protection dongle menu choice const int nCurrentChoice = GetCopyProtectionDongleType(); - m_PropertySheetHelper.FillComboBox(hWnd, IDC_COMBO_CP_DONGLE, m_CopyProtectionDongleChoices, nCurrentChoice); + m_PropertySheetHelper.FillComboBox(hWnd, IDC_COMBO_GAME_IO_CONNECTOR, m_gameIOConnectorChoices, nCurrentChoice); } diff --git a/source/Configuration/PageAdvanced.h b/source/Configuration/PageAdvanced.h index ef59d157..e4b28ba0 100644 --- a/source/Configuration/PageAdvanced.h +++ b/source/Configuration/PageAdvanced.h @@ -35,11 +35,11 @@ private: int GetCloneMenuItem(void); void InitFreezeDlgButton(HWND hWnd); void InitCloneDropdownMenu(HWND hWnd); - void InitCopyProtectionDongleDropdownMenu(HWND hWnd); + void InitGameIOConnectorDropdownMenu(HWND hWnd); static CPageAdvanced* ms_this; static const TCHAR m_CloneChoices[]; - static const TCHAR m_CopyProtectionDongleChoices[]; + static const TCHAR m_gameIOConnectorChoices[]; const PAGETYPE m_Page; CPropertySheetHelper& m_PropertySheetHelper; diff --git a/source/CopyProtectionDongles.cpp b/source/CopyProtectionDongles.cpp index a26d6cd3..f86ec3d8 100644 --- a/source/CopyProtectionDongles.cpp +++ b/source/CopyProtectionDongles.cpp @@ -4,7 +4,7 @@ Copyright (C) 1994-1996, Michael O'Brien Copyright (C) 1999-2001, Oliver Schmidt Copyright (C) 2002-2005, Tom Charlesworth - Copyright (C) 2006-2007, Tom Charlesworth, Michael Pohoreski + Copyright (C) 2006-2022, Tom Charlesworth, Michael Pohoreski AppleWin is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -35,17 +35,14 @@ #include "CopyProtectionDongles.h" #include "Memory.h" -static DWORD copyProtectionDongleType = 0; +static DONGLETYPE copyProtectionDongleType = DT_EMPTY; -// Must be in the same order as in PageAdvanced.cpp -enum COPYPROTECTIONDONGLETYPE { NONE, SDSSPEEDSTAR }; - -void SetCopyProtectionDongleType(DWORD type) +void SetCopyProtectionDongleType(DONGLETYPE type) { copyProtectionDongleType = type; } -DWORD GetCopyProtectionDongleType(void) +DONGLETYPE GetCopyProtectionDongleType(void) { return copyProtectionDongleType; } @@ -74,7 +71,7 @@ int CopyProtectionDonglePB2(void) { switch (copyProtectionDongleType) { - case SDSSPEEDSTAR: // Southwestern Data Systems SoftKey for Speed Star Applesoft Compiler + case DT_SDSSPEEDSTAR: // Southwestern Data Systems SoftKey for Speed Star Applesoft Compiler return SdsSpeedStar(); break; diff --git a/source/CopyProtectionDongles.h b/source/CopyProtectionDongles.h index 4104c7ce..bb50a7bf 100644 --- a/source/CopyProtectionDongles.h +++ b/source/CopyProtectionDongles.h @@ -2,9 +2,11 @@ #include "Common.h" +// Must be in the same order as in PageAdvanced.cpp +enum DONGLETYPE { DT_EMPTY, DT_SDSSPEEDSTAR }; -void SetCopyProtectionDongleType(DWORD type); -DWORD GetCopyProtectionDongleType(void); +void SetCopyProtectionDongleType(DONGLETYPE type); +DONGLETYPE GetCopyProtectionDongleType(void); int CopyProtectionDonglePB0(void); int CopyProtectionDonglePB1(void); int CopyProtectionDonglePB2(void); diff --git a/source/Registry.cpp b/source/Registry.cpp index 63b46f59..3dc2579e 100644 --- a/source/Registry.cpp +++ b/source/Registry.cpp @@ -155,6 +155,9 @@ void RegSaveValue (LPCTSTR section, LPCTSTR key, BOOL peruser, DWORD value) { //=========================================================================== static inline std::string RegGetSlotSection(UINT slot) { + if (slot == GAME_IO_CONNECTOR) + return std::string(REG_CONFIG_GAME_IO_CONNECTOR); + return (slot == SLOT_AUX) ? std::string(REG_CONFIG_SLOT_AUX) : (std::string(REG_CONFIG_SLOT) + (char)('0' + slot)); @@ -197,6 +200,8 @@ void RegDeleteConfigSlotSection(UINT slot) void RegSetConfigSlotNewCardType(UINT slot, SS_CARDTYPE type) { + _ASSERT(slot != GAME_IO_CONNECTOR); + RegDeleteConfigSlotSection(slot); std::string regSection; @@ -204,3 +209,17 @@ void RegSetConfigSlotNewCardType(UINT slot, SS_CARDTYPE type) RegSaveValue(regSection.c_str(), REGVALUE_CARD_TYPE, TRUE, type); } + +void RegSetConfigGameIOConnectorNewDongleType(UINT slot, DONGLETYPE type) +{ + _ASSERT(slot == GAME_IO_CONNECTOR); + if (slot != GAME_IO_CONNECTOR) + return; + + RegDeleteConfigSlotSection(slot); + + std::string regSection; + regSection = RegGetConfigSlotSection(slot); + + RegSaveValue(regSection.c_str(), REGVALUE_GAME_IO_TYPE, TRUE, type); +} diff --git a/source/Registry.h b/source/Registry.h index 0f014c12..10210d23 100644 --- a/source/Registry.h +++ b/source/Registry.h @@ -1,5 +1,6 @@ #pragma once #include "Card.h" +#include "CopyProtectionDongles.h" #define REGLOAD(a, b) RegLoadValue(TEXT(REG_CONFIG), (a), TRUE, (b)) #define REGLOAD_DEFAULT(a, b, c) RegLoadValue(TEXT(REG_CONFIG), (a), TRUE, (b), (c)) @@ -14,4 +15,5 @@ void RegSaveValue (LPCTSTR section, LPCTSTR key, BOOL peruser, DWORD value); std::string RegGetConfigSlotSection(UINT slot); void RegDeleteConfigSlotSection(UINT slot); -void RegSetConfigSlotNewCardType(UINT slot, enum SS_CARDTYPE type); +void RegSetConfigSlotNewCardType(UINT slot, SS_CARDTYPE type); +void RegSetConfigGameIOConnectorNewDongleType(UINT slot, DONGLETYPE type); diff --git a/source/Utilities.cpp b/source/Utilities.cpp index 9c6106d4..f636180c 100644 --- a/source/Utilities.cpp +++ b/source/Utilities.cpp @@ -168,12 +168,12 @@ void LoadConfiguration(bool loadImages) else LoadConfigOldJoystick_v1(JN_JOYSTICK1); - DWORD copyProtectionDongleType; - if (REGLOAD(TEXT(REGVALUE_COPYPROTECTIONDONGLE_TYPE), ©ProtectionDongleType)) - SetCopyProtectionDongleType(copyProtectionDongleType); + std::string regSection = RegGetConfigSlotSection(GAME_IO_CONNECTOR); + if (RegLoadValue(regSection.c_str(), REGVALUE_GAME_IO_TYPE, TRUE, ©ProtectionDongleType)) + SetCopyProtectionDongleType((DONGLETYPE)copyProtectionDongleType); else - SetCopyProtectionDongleType(0); // None + SetCopyProtectionDongleType(DT_EMPTY); DWORD dwSoundType; REGLOAD_DEFAULT(TEXT(REGVALUE_SOUND_EMULATION), &dwSoundType, REG_SOUNDTYPE_WAVE);