Support Hayden dongle (#1312, PR #1325)

This commit is contained in:
TomCh 2024-08-21 22:15:34 +01:00 committed by GitHub
parent 91743eeebc
commit 57ba330072
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 37 additions and 7 deletions

View File

@ -50,7 +50,8 @@ const TCHAR CPageAdvanced::m_gameIOConnectorChoices[] =
"Cortechs Corp - CodeWriter\0" /* Protection key for Dynatech Microsoftware / Cortechs Corp "CodeWriter" */
"Robocom Ltd - Robo 500\0" /* Interface Module for Robocom Ltd's Robo 500 */
"Robocom Ltd - Robo 1000\0" /* Interface Module for Robocom Ltd's Robo 1000 */
"Robocom Ltd - Robo 1500, CAD-2P\0"; /* Interface Module for Robocom Ltd's Robo 1500, Robo Systems CAD-2P */
"Robocom Ltd - Robo 1500, CAD-2P\0" /* Interface Module for Robocom Ltd's Robo 1500, Robo Systems CAD-2P */
"Hayden - Applesoft Compiler\0"; /* Protection key for Hayden's Applsoft Compiler (1981) */
INT_PTR CALLBACK CPageAdvanced::DlgProc(HWND hWnd, UINT message, WPARAM wparam, LPARAM lparam)

View File

@ -29,6 +29,7 @@
- Southwestern Data Systems' datakey for SpeedStar Applesoft Compiler (Matthew D'Asaro Dec 2022)
- Dynatech Microsoftware / Cortechs Corp's protection key for "CodeWriter"
- Robocom Ltd's Interface Module for Robo Graphics 500/1000/1500 & RoboCAD 1/2 (BitStik joystick plugs in on top)
- Hayden's protection key for "Applesoft Compiler"
*/
#include "StdAfx.h"
#include <sstream>
@ -96,6 +97,9 @@ int CopyProtectionDonglePB0(void)
// Returns the copy protection dongle state of PB1. A return value of -1 means not used by copy protection dongle
int CopyProtectionDonglePB1(void)
{
if (copyProtectionDongleType == DT_HAYDENCOMPILER)
return 0; // connected to GND
return -1;
}
@ -118,6 +122,15 @@ int CopyProtectionDonglePB2(void)
// Returns the copy protection dongle state of PDL(n). A return value of -1 means not used by copy protection dongle
int CopyProtectionDonglePDL(UINT pdl)
{
if (copyProtectionDongleType == DT_HAYDENCOMPILER && pdl == 3)
{
static BYTE haydenValue[4] = {0xFF, 0x96, 0x96, 0x50}; // Derived from reverse-engineered Hayden code - although other than 0xFF, actual values are unknown.
UINT haydenDongleMode = ((UINT)MemGetAnnunciator(2) << 1) | (UINT)MemGetAnnunciator(0);
return haydenValue[haydenDongleMode];
}
//
if (copyProtectionDongleType != DT_ROBOCOM500 && copyProtectionDongleType != DT_ROBOCOM1000 && copyProtectionDongleType != DT_ROBOCOM1500)
return -1;
@ -162,7 +175,7 @@ int CopyProtectionDonglePDL(UINT pdl)
// 1: Add SDS SpeedStar dongle
// 2: Add Cortechs Corp CodeWriter protection key
// Add Robocom Ltd - Robo 500/1000/1500 Interface Modules
static const UINT kUNIT_VERSION = 2;
// 3: Add Hayden Compiler protection key
static const std::string& GetSnapshotStructName_SDSSpeedStar(void)
{
@ -194,6 +207,12 @@ static const std::string& GetSnapshotStructName_Robocom1500(void)
return name;
}
static const std::string& GetSnapshotStructName_HaydenCompiler(void)
{
static const std::string name("Hayden - Applesoft Compiler protection key");
return name;
}
void CopyProtectionDongleSaveSnapshot(YamlSaveHelper& yamlSaveHelper)
{
if (copyProtectionDongleType == DT_SDSSPEEDSTAR)
@ -221,13 +240,18 @@ void CopyProtectionDongleSaveSnapshot(YamlSaveHelper& yamlSaveHelper)
yamlSaveHelper.SaveString(SS_YAML_KEY_DEVICE, GetSnapshotStructName_Robocom1500());
// NB. No state for this dongle
}
else if (copyProtectionDongleType == DT_HAYDENCOMPILER)
{
yamlSaveHelper.SaveString(SS_YAML_KEY_DEVICE, GetSnapshotStructName_HaydenCompiler());
// NB. No state for this dongle
}
else
{
_ASSERT(0);
}
}
void CopyProtectionDongleLoadSnapshot(YamlLoadHelper& yamlLoadHelper, UINT version)
void CopyProtectionDongleLoadSnapshot(YamlLoadHelper& yamlLoadHelper, UINT version, UINT kUNIT_VERSION)
{
if (version < 1 || version > kUNIT_VERSION)
{
@ -261,6 +285,10 @@ void CopyProtectionDongleLoadSnapshot(YamlLoadHelper& yamlLoadHelper, UINT versi
{
copyProtectionDongleType = DT_ROBOCOM1500;
}
else if (device == GetSnapshotStructName_HaydenCompiler())
{
copyProtectionDongleType = DT_HAYDENCOMPILER;
}
else
{
_ASSERT(0);

View File

@ -3,7 +3,7 @@
#include "Common.h"
// Must be in the same order as in PageAdvanced.cpp
enum DONGLETYPE { DT_EMPTY, DT_SDSSPEEDSTAR, DT_CODEWRITER, DT_ROBOCOM500, DT_ROBOCOM1000, DT_ROBOCOM1500 };
enum DONGLETYPE { DT_EMPTY, DT_SDSSPEEDSTAR, DT_CODEWRITER, DT_ROBOCOM500, DT_ROBOCOM1000, DT_ROBOCOM1500, DT_HAYDENCOMPILER };
void SetCopyProtectionDongleType(DONGLETYPE type);
DONGLETYPE GetCopyProtectionDongleType(void);
@ -14,4 +14,4 @@ int CopyProtectionDonglePB2(void);
int CopyProtectionDonglePDL(UINT pdl);
void CopyProtectionDongleSaveSnapshot(class YamlSaveHelper& yamlSaveHelper);
void CopyProtectionDongleLoadSnapshot(class YamlLoadHelper& yamlLoadHelper, UINT version);
void CopyProtectionDongleLoadSnapshot(class YamlLoadHelper& yamlLoadHelper, UINT version, UINT kUNIT_VERSION);

View File

@ -72,7 +72,8 @@ static YamlHelper yamlHelper;
#define UNIT_SLOTS_VER 1
#define UNIT_GAME_IO_CONNECTOR_VER 1
// See CopyProtectionDongle.cppS
#define UNIT_GAME_IO_CONNECTOR_VER 3
#define UNIT_MISC_VER 1
@ -341,7 +342,7 @@ static void ParseUnit(void)
}
else if (unit == GetSnapshotUnitGameIOConnectorName())
{
CopyProtectionDongleLoadSnapshot(yamlLoadHelper, unitVersion);
CopyProtectionDongleLoadSnapshot(yamlLoadHelper, unitVersion, UNIT_GAME_IO_CONNECTOR_VER);
}
else if (unit == GetSnapshotUnitMiscName())
{