2020-11-11 21:15:27 +00:00
|
|
|
#pragma once
|
|
|
|
|
2007-08-06 21:38:35 +00:00
|
|
|
#include "6821.h"
|
|
|
|
#include "Common.h"
|
2019-12-19 19:42:30 +00:00
|
|
|
#include "Card.h"
|
2020-10-11 15:08:05 +00:00
|
|
|
#include "SynchronousEventManager.h"
|
2007-08-06 21:38:35 +00:00
|
|
|
|
2019-12-19 19:42:30 +00:00
|
|
|
class CMouseInterface : public Card
|
2007-08-06 21:38:35 +00:00
|
|
|
{
|
|
|
|
public:
|
2019-12-19 19:42:30 +00:00
|
|
|
CMouseInterface(UINT slot);
|
2007-08-06 21:38:35 +00:00
|
|
|
virtual ~CMouseInterface();
|
|
|
|
|
2019-12-19 19:42:30 +00:00
|
|
|
virtual void Init(void) {};
|
|
|
|
virtual void Reset(const bool powerCycle) {};
|
|
|
|
|
2007-08-06 21:38:35 +00:00
|
|
|
void Initialize(LPBYTE pCxRomPeripheral, UINT uSlot);
|
2019-12-19 19:42:30 +00:00
|
|
|
// void Uninitialize();
|
2007-12-01 21:21:40 +00:00
|
|
|
void Reset();
|
2018-03-03 21:27:50 +00:00
|
|
|
static BYTE __stdcall IORead(WORD PC, WORD uAddr, BYTE bWrite, BYTE uValue, ULONG nExecutedCycles);
|
|
|
|
static BYTE __stdcall IOWrite(WORD PC, WORD uAddr, BYTE bWrite, BYTE uValue, ULONG nExecutedCycles);
|
2007-08-06 21:38:35 +00:00
|
|
|
|
2008-05-17 23:20:33 +00:00
|
|
|
void SetPositionRel(long dx, long dy, int* pOutOfBoundsX, int* pOutOfBoundsY);
|
2007-08-06 21:38:35 +00:00
|
|
|
void SetButton(eBUTTON Button, eBUTTONSTATE State);
|
2019-12-19 19:42:30 +00:00
|
|
|
// bool IsActive() { return m_bActive; }
|
2016-02-24 21:51:20 +00:00
|
|
|
bool IsEnabled() { return m_bEnabled; } // NB. m_bEnabled == true implies that m_bActive == true
|
2019-12-19 19:42:30 +00:00
|
|
|
bool IsActiveAndEnabled() { return /*IsActive() &&*/ IsEnabled(); } // todo: just use IsEnabled()
|
2008-05-17 23:20:33 +00:00
|
|
|
void SetEnabled(bool bEnabled) { m_bEnabled = bEnabled; }
|
|
|
|
void GetXY(int& iX, int& iMinX, int& iMaxX, int& iY, int& iMinY, int& iMaxY)
|
|
|
|
{
|
|
|
|
iX = m_iX;
|
|
|
|
iMinX = m_iMinX;
|
|
|
|
iMaxX = m_iMaxX;
|
|
|
|
iY = m_iY;
|
|
|
|
iMinY = m_iMinY;
|
|
|
|
iMaxY = m_iMaxY;
|
|
|
|
}
|
|
|
|
void SetCursorPos(int iX, int iY)
|
|
|
|
{
|
|
|
|
m_iX = iX;
|
|
|
|
m_iY = iY;
|
|
|
|
}
|
2007-08-06 21:38:35 +00:00
|
|
|
|
2019-12-19 19:42:30 +00:00
|
|
|
static std::string GetSnapshotCardName(void);
|
2015-12-05 16:50:27 +00:00
|
|
|
void SaveSnapshot(class YamlSaveHelper& yamlSaveHelper);
|
|
|
|
bool LoadSnapshot(class YamlLoadHelper& yamlLoadHelper, UINT slot, UINT version);
|
2015-02-13 22:40:53 +00:00
|
|
|
|
2007-08-06 21:38:35 +00:00
|
|
|
protected:
|
2019-12-19 19:42:30 +00:00
|
|
|
void InitializeROM(void);
|
2015-02-13 22:40:53 +00:00
|
|
|
void SetSlotRom();
|
2007-08-06 21:38:35 +00:00
|
|
|
void On6821_A(BYTE byData);
|
|
|
|
void On6821_B(BYTE byData);
|
|
|
|
void OnCommand();
|
|
|
|
void OnWrite();
|
2008-06-20 21:35:55 +00:00
|
|
|
void OnMouseEvent(bool bEventVBL=false);
|
2007-12-01 21:21:40 +00:00
|
|
|
void Clear();
|
2007-08-06 21:38:35 +00:00
|
|
|
|
2009-01-09 23:27:29 +00:00
|
|
|
friend void M6821_Listener_A( void* objTo, BYTE byData );
|
|
|
|
friend void M6821_Listener_B( void* objTo, BYTE byData );
|
2007-08-06 21:38:35 +00:00
|
|
|
|
2007-12-02 14:55:32 +00:00
|
|
|
void SetPositionAbs(int x, int y);
|
2008-05-17 23:20:33 +00:00
|
|
|
int ClampX();
|
|
|
|
int ClampY();
|
2007-12-02 14:55:32 +00:00
|
|
|
void SetClampX(int iMinX, int iMaxX);
|
|
|
|
void SetClampY(int iMinY, int iMaxY);
|
2007-08-06 21:38:35 +00:00
|
|
|
|
2020-10-11 15:08:05 +00:00
|
|
|
static int SyncEventCallback(int id, int cycles, ULONG uExecutedCycles);
|
|
|
|
|
2015-12-05 16:50:27 +00:00
|
|
|
void SaveSnapshotMC6821(class YamlSaveHelper& yamlSaveHelper, std::string key);
|
|
|
|
void LoadSnapshotMC6821(class YamlLoadHelper& yamlLoadHelper, std::string key);
|
2007-08-06 21:38:35 +00:00
|
|
|
|
|
|
|
C6821 m_6821;
|
|
|
|
|
|
|
|
int m_nDataLen;
|
|
|
|
BYTE m_byMode;
|
|
|
|
|
|
|
|
BYTE m_by6821B;
|
|
|
|
BYTE m_by6821A;
|
|
|
|
BYTE m_byBuff[8]; // m_byBuff[0] is mode byte
|
|
|
|
int m_nBuffPos;
|
|
|
|
|
|
|
|
BYTE m_byState;
|
|
|
|
int m_nX;
|
|
|
|
int m_nY;
|
2016-02-20 17:57:23 +00:00
|
|
|
bool m_bBtn0;
|
|
|
|
bool m_bBtn1;
|
2007-08-06 21:38:35 +00:00
|
|
|
|
|
|
|
bool m_bVBL;
|
|
|
|
|
|
|
|
//
|
|
|
|
|
2007-12-02 14:55:32 +00:00
|
|
|
int m_iX;
|
|
|
|
int m_iMinX;
|
|
|
|
int m_iMaxX;
|
|
|
|
int m_iY;
|
|
|
|
int m_iMinY;
|
|
|
|
int m_iMaxY;
|
2007-08-06 21:38:35 +00:00
|
|
|
|
2016-02-20 17:57:23 +00:00
|
|
|
bool m_bButtons[2];
|
2007-08-06 21:38:35 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
|
2016-02-24 21:51:20 +00:00
|
|
|
// todo: remove m_bActive:
|
|
|
|
// - instantiate CMouseInterface object when active (and delete when inactive)
|
2019-12-19 19:42:30 +00:00
|
|
|
// bool m_bActive; // Mouse h/w is active within the Apple][ VM
|
2016-02-24 21:51:20 +00:00
|
|
|
bool m_bEnabled; // Windows' mouse events get passed to Apple]['s mouse h/w (m_bEnabled == true implies that m_bActive == true)
|
2007-08-06 21:38:35 +00:00
|
|
|
LPBYTE m_pSlotRom;
|
|
|
|
UINT m_uSlot;
|
2020-10-11 15:08:05 +00:00
|
|
|
|
|
|
|
SyncEvent m_syncEvent;
|
2007-08-06 21:38:35 +00:00
|
|
|
};
|