mirror of
https://github.com/AppleWin/AppleWin.git
synced 2024-06-08 01:29:42 +00:00
Add support for hardware copy protection dongles
This change adds support for hardware copy protection dongles. Changes: - Add a pulldown menu to the 'Advanced' tab that lets the user select a dongle in use - Add a new file "CopyProgtectionDongles.cpp" that is a place to put drivers for these. - Add a driver for the one known dongle we have now - Speed Star - Modify Memory.cpp to alert the copy protection drivers when AN0-AN3 change - Modify Joystick.cpp to allow PB0-PB2 to be "pushed" by the protection dongle. - Misc.
This commit is contained in:
parent
9358abbb28
commit
d583011494
|
@ -256,6 +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
|
||||
END
|
||||
|
||||
|
||||
|
|
|
@ -113,6 +113,7 @@
|
|||
#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
|
||||
|
@ -137,7 +138,7 @@
|
|||
#define _APS_NO_MFC 1
|
||||
#define _APS_NEXT_RESOURCE_VALUE 149
|
||||
#define _APS_NEXT_COMMAND_VALUE 40012
|
||||
#define _APS_NEXT_CONTROL_VALUE 1082
|
||||
#define _APS_NEXT_CONTROL_VALUE 1083
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -73,6 +73,7 @@ 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_CPYPRTDONGLE_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")
|
||||
|
|
|
@ -31,6 +31,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|||
#include "../Registry.h"
|
||||
#include "../SaveState.h"
|
||||
#include "../CardManager.h"
|
||||
#include "../CopyProtectionDongles.h"
|
||||
#include "../resource/resource.h"
|
||||
|
||||
CPageAdvanced* CPageAdvanced::ms_this = 0; // reinit'd in ctor
|
||||
|
@ -43,6 +44,11 @@ const TCHAR CPageAdvanced::m_CloneChoices[] =
|
|||
TEXT("TK3000 //e\0") // Brazilian
|
||||
TEXT("Base 64A\0"); // Taiwanese
|
||||
|
||||
enum CPYPRTDONGLE { MENUITEM_NONE, MENUITEM_SPEEDSTAR };
|
||||
const TCHAR CPageAdvanced::m_CopyPrtDongleChoices[] =
|
||||
TEXT("None\0")
|
||||
TEXT("SDS DataKey - Speed Star\0"); // Protection dongle for Southwestern Data Systems "Speed Star" Applesoft Compiler
|
||||
|
||||
|
||||
INT_PTR CALLBACK CPageAdvanced::DlgProc(HWND hWnd, UINT message, WPARAM wparam, LPARAM lparam)
|
||||
{
|
||||
|
@ -123,6 +129,13 @@ INT_PTR CPageAdvanced::DlgProcInternal(HWND hWnd, UINT message, WPARAM wparam, L
|
|||
m_PropertySheetHelper.GetConfigNew().m_Apple2Type = NewCloneType;
|
||||
m_PropertySheetHelper.GetConfigNew().m_CpuType = ProbeMainCpuDefault(NewCloneType);
|
||||
}
|
||||
|
||||
case IDC_COMBO_CP_DONGLE:
|
||||
if (HIWORD(wparam) == CBN_SELCHANGE)
|
||||
{
|
||||
const DWORD NewCpyPrtDongleMenuItem = (DWORD)SendDlgItemMessage(hWnd, IDC_COMBO_CP_DONGLE, CB_GETCURSEL, 0, 0);
|
||||
SetCpyPrtDongleType(NewCpyPrtDongleMenuItem);
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
@ -179,6 +192,9 @@ void CPageAdvanced::DlgOK(HWND hWnd)
|
|||
g_bSaveStateOnExit = IsDlgButtonChecked(hWnd, IDC_SAVESTATE_ON_EXIT) ? true : false;
|
||||
REGSAVE(TEXT(REGVALUE_SAVE_STATE_ON_EXIT), g_bSaveStateOnExit ? 1 : 0);
|
||||
|
||||
// Save the copy protection dongle type
|
||||
REGSAVE(TEXT(REGVALUE_CPYPRTDONGLE_TYPE), GetCpyPrtDongleType());
|
||||
|
||||
if (GetCardMgr().IsParallelPrinterCardInstalled())
|
||||
{
|
||||
ParallelPrinterCard* card = GetCardMgr().GetParallelPrinterCard();
|
||||
|
@ -217,6 +233,7 @@ void CPageAdvanced::InitOptions(HWND hWnd)
|
|||
{
|
||||
InitFreezeDlgButton(hWnd);
|
||||
InitCloneDropdownMenu(hWnd);
|
||||
InitCpyPrtDongleDropdownMenu(hWnd);
|
||||
}
|
||||
|
||||
// Advanced->Clone: Menu item to eApple2Type
|
||||
|
@ -282,3 +299,10 @@ void CPageAdvanced::InitCloneDropdownMenu(HWND hWnd)
|
|||
const bool bIsClone = IsClone( m_PropertySheetHelper.GetConfigNew().m_Apple2Type );
|
||||
EnableWindow(GetDlgItem(hWnd, IDC_CLONETYPE), bIsClone ? TRUE : FALSE);
|
||||
}
|
||||
|
||||
void CPageAdvanced::InitCpyPrtDongleDropdownMenu(HWND hWnd)
|
||||
{
|
||||
// Set copy protection dongle menu choice
|
||||
const int nCurrentChoice = GetCpyPrtDongleType();
|
||||
m_PropertySheetHelper.FillComboBox(hWnd, IDC_COMBO_CP_DONGLE, m_CopyPrtDongleChoices, nCurrentChoice);
|
||||
}
|
|
@ -35,9 +35,11 @@ private:
|
|||
int GetCloneMenuItem(void);
|
||||
void InitFreezeDlgButton(HWND hWnd);
|
||||
void InitCloneDropdownMenu(HWND hWnd);
|
||||
void InitCpyPrtDongleDropdownMenu(HWND hWnd);
|
||||
|
||||
static CPageAdvanced* ms_this;
|
||||
static const TCHAR m_CloneChoices[];
|
||||
static const TCHAR m_CopyPrtDongleChoices[];
|
||||
|
||||
const PAGETYPE m_Page;
|
||||
CPropertySheetHelper& m_PropertySheetHelper;
|
||||
|
|
120
source/CopyProtectionDongles.cpp
Normal file
120
source/CopyProtectionDongles.cpp
Normal file
|
@ -0,0 +1,120 @@
|
|||
/*
|
||||
AppleWin : An Apple //e emulator for Windows
|
||||
|
||||
Copyright (C) 1994-1996, Michael O'Brien
|
||||
Copyright (C) 1999-2001, Oliver Schmidt
|
||||
Copyright (C) 2002-2005, Tom Charlesworth
|
||||
Copyright (C) 2006-2007, Tom Charlesworth, Michael Pohoreski
|
||||
|
||||
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
|
||||
*/
|
||||
/*
|
||||
CopyProtectionDongles.cpp
|
||||
|
||||
Emulate hardware copy protection dongles for Apple II
|
||||
|
||||
Currently supported:
|
||||
- Southwestern Data Systems SoftKey for Speed Star Applesoft Compiler
|
||||
|
||||
Matthew D'Asaro Dec 2022
|
||||
*/
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "CopyProtectionDongles.h"
|
||||
|
||||
static DWORD cpyPrtDongleType = 0;
|
||||
|
||||
static bool g_AN0 = 0;
|
||||
static bool g_AN1 = 0;
|
||||
static bool g_AN2 = 0;
|
||||
static bool g_AN3 = 0;
|
||||
|
||||
// Must be in the same order as in PageAdvanced.cpp
|
||||
enum CPYPRTDONGLETYPE { NONE, SDSSPEEDSTAR };
|
||||
|
||||
void SetCpyPrtDongleType(DWORD type)
|
||||
{
|
||||
cpyPrtDongleType = type;
|
||||
}
|
||||
|
||||
DWORD GetCpyPrtDongleType(void)
|
||||
{
|
||||
return cpyPrtDongleType;
|
||||
}
|
||||
|
||||
void CopyProtDongleControl(const UINT uControl)
|
||||
{
|
||||
switch (uControl)
|
||||
{
|
||||
case 0xC058: // AN0 clr
|
||||
g_AN0 = 0;
|
||||
break;
|
||||
case 0xC059: // AN0 set
|
||||
g_AN0 = 1;
|
||||
break;
|
||||
case 0xC05A: // AN1 clr
|
||||
g_AN1 = 0;
|
||||
break;
|
||||
case 0xC05B: // AN1 set
|
||||
g_AN1 = 1;
|
||||
break;
|
||||
case 0xC05C: // AN2 clr
|
||||
g_AN2 = 0;
|
||||
break;
|
||||
case 0xC05D: // AN2 set
|
||||
g_AN2 = 1;
|
||||
break;
|
||||
case 0xC05E: // AN3 clr
|
||||
g_AN3 = 0;
|
||||
break;
|
||||
case 0xC05F: // AN3 set
|
||||
g_AN3 = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// This protection dongle consists of a NAND gate connected with AN1 and AN2 on the inputs
|
||||
// PB2 on the output, and AN0 connected to power it.
|
||||
bool SdsSpeedStar(void)
|
||||
{
|
||||
return !g_AN0 || !(g_AN1 && g_AN2);
|
||||
}
|
||||
|
||||
// Returns the copy protection dongle state of PB0. A return value of -1 means not used by copy protection dongle
|
||||
DWORD CopyProtDonglePB0(void)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Returns the copy protection dongle state of PB1. A return value of -1 means not used by copy protection dongle
|
||||
DWORD CopyProtDonglePB1(void)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Returns the copy protection dongle state of PB2. A return value of -1 means not used by copy protection dongle
|
||||
DWORD CopyProtDonglePB2(void)
|
||||
{
|
||||
switch (cpyPrtDongleType)
|
||||
{
|
||||
case SDSSPEEDSTAR: // Southwestern Data Systems SoftKey for Speed Star Applesoft Compiler
|
||||
return SdsSpeedStar();
|
||||
break;
|
||||
|
||||
default:
|
||||
return -1;
|
||||
break;
|
||||
}
|
||||
}
|
12
source/CopyProtectionDongles.h
Normal file
12
source/CopyProtectionDongles.h
Normal file
|
@ -0,0 +1,12 @@
|
|||
#pragma once
|
||||
|
||||
#include "Common.h"
|
||||
|
||||
|
||||
void SetCpyPrtDongleType(DWORD type);
|
||||
DWORD GetCpyPrtDongleType(void);
|
||||
void CopyProtDongleControl(const UINT uControl);
|
||||
DWORD CopyProtDonglePB0(void);
|
||||
DWORD CopyProtDonglePB1(void);
|
||||
DWORD CopyProtDonglePB2(void);
|
||||
bool SdsSpeedStar(void);
|
|
@ -45,6 +45,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|||
#include "Memory.h"
|
||||
#include "YamlHelper.h"
|
||||
#include "Interface.h"
|
||||
#include "CopyProtectionDongles.h"
|
||||
|
||||
#include "Configuration/PropertySheet.h"
|
||||
|
||||
|
@ -576,6 +577,8 @@ BYTE __stdcall JoyReadButton(WORD pc, WORD address, BYTE, BYTE, ULONG nExecutedC
|
|||
pressed = !swapButtons0and1 ? CheckButton0Pressed() : CheckButton1Pressed();
|
||||
const UINT button0 = !swapButtons0and1 ? 0 : 1;
|
||||
DoAutofire(button0, pressed);
|
||||
if(CopyProtDonglePB0() >= 0) //If a copy protection dongle needs PB0, this overrides the joystick
|
||||
pressed = CopyProtDonglePB0();
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -584,11 +587,15 @@ BYTE __stdcall JoyReadButton(WORD pc, WORD address, BYTE, BYTE, ULONG nExecutedC
|
|||
pressed = !swapButtons0and1 ? CheckButton1Pressed() : CheckButton0Pressed();
|
||||
const UINT button1 = !swapButtons0and1 ? 1 : 0;
|
||||
DoAutofire(button1, pressed);
|
||||
if (CopyProtDonglePB1() >= 0) //If a copy protection dongle needs PB1, this overrides the joystick
|
||||
pressed = CopyProtDonglePB1();
|
||||
}
|
||||
break;
|
||||
|
||||
case 0x63:
|
||||
if (IS_APPLE2 && (joyinfo[joytype[1]] == DEVICE_NONE))
|
||||
if (CopyProtDonglePB2() >= 0) //If a copy protection dongle needs PB2, this overrides the joystick
|
||||
pressed = CopyProtDonglePB2();
|
||||
else if (IS_APPLE2 && (joyinfo[joytype[1]] == DEVICE_NONE))
|
||||
{
|
||||
// Apple II/II+ with no joystick has the "SHIFT key mod"
|
||||
// See Sather's Understanding The Apple II p7-36
|
||||
|
|
|
@ -56,6 +56,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|||
#include "Tape.h"
|
||||
#include "RGBMonitor.h"
|
||||
#include "VidHD.h"
|
||||
#include "CopyProtectionDongles.h"
|
||||
|
||||
#include "z80emu.h"
|
||||
#include "Z80VICE/z80.h"
|
||||
|
@ -730,6 +731,9 @@ BYTE __stdcall IO_Annunciator(WORD programcounter, WORD address, BYTE write, BYT
|
|||
if (address >= 0xC05C && address <= 0xC05D && IsApple2JPlus(GetApple2Type()))
|
||||
NTSC_VideoInitAppleType(); // AN2 switches between Katakana & ASCII video rom chars (GH#773)
|
||||
|
||||
if (address >= 0xC058 && address <= 0xC05F)
|
||||
CopyProtDongleControl(address); // Update AN0 - AN3 state for copy protection dongles
|
||||
|
||||
if (!write)
|
||||
return MemReadFloatingBus(nExecutedCycles);
|
||||
else
|
||||
|
|
|
@ -47,6 +47,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|||
#include "Mockingboard.h"
|
||||
#include "Interface.h"
|
||||
#include "SoundCore.h"
|
||||
#include "CopyProtectionDongles.h"
|
||||
|
||||
#include "Configuration/IPropertySheet.h"
|
||||
#include "Tfe/PCapBackend.h"
|
||||
|
@ -167,6 +168,13 @@ void LoadConfiguration(bool loadImages)
|
|||
else
|
||||
LoadConfigOldJoystick_v1(JN_JOYSTICK1);
|
||||
|
||||
|
||||
DWORD cpyPrtDongleType;
|
||||
if (REGLOAD(TEXT(REGVALUE_CPYPRTDONGLE_TYPE), &cpyPrtDongleType))
|
||||
SetCpyPrtDongleType(cpyPrtDongleType);
|
||||
else
|
||||
SetCpyPrtDongleType(0); // None
|
||||
|
||||
DWORD dwSoundType;
|
||||
REGLOAD_DEFAULT(TEXT(REGVALUE_SOUND_EMULATION), &dwSoundType, REG_SOUNDTYPE_WAVE);
|
||||
switch (dwSoundType)
|
||||
|
|
Loading…
Reference in New Issue
Block a user