Version 1.14.1.2

. Change: Removed crosshairs in mouse-mode
. Change: Hide Windows' mouse cursor when over Apple's screen (in mouse-mode)
. Fix: Use mouse position delta (fixes GEOS)
This commit is contained in:
tomch 2007-12-02 14:55:32 +00:00
parent 73f2f63298
commit 637155954e
5 changed files with 119 additions and 84 deletions

View File

@ -17,6 +17,11 @@ Restrictions/bugs:
- SSI263 emulation is very basic: there is no attempt to emulate rate, inflection or filters. - SSI263 emulation is very basic: there is no attempt to emulate rate, inflection or filters.
- During Mockingboard playback, Speaker emulation isn't precise - During Mockingboard playback, Speaker emulation isn't precise
1.14.1.2 - 2 Dec 2007 (beta)
----------------------------
. Change: Removed crosshairs in mouse-mode
. Change: Hide Windows' mouse cursor when over Apple's screen (in mouse-mode)
. Fix: Use mouse position delta (fixes GEOS)
1.14.1.1 - 13 Aug 2007 (beta) 1.14.1.1 - 13 Aug 2007 (beta)
----------------------------- -----------------------------

View File

@ -210,8 +210,8 @@ DISK_ICON ICON "DISK.ICO"
// //
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,14,1,1 FILEVERSION 1,14,1,2
PRODUCTVERSION 1,14,1,1 PRODUCTVERSION 1,14,1,2
FILEFLAGSMASK 0x3fL FILEFLAGSMASK 0x3fL
#ifdef _DEBUG #ifdef _DEBUG
FILEFLAGS 0x1L FILEFLAGS 0x1L
@ -229,12 +229,12 @@ BEGIN
VALUE "Comments", "http://applewin.berlios.de" VALUE "Comments", "http://applewin.berlios.de"
VALUE "CompanyName", "Michael O'Brien, Oliver Schmidt, Tom Charlesworth" VALUE "CompanyName", "Michael O'Brien, Oliver Schmidt, Tom Charlesworth"
VALUE "FileDescription", "Apple //e Emulator for Windows" VALUE "FileDescription", "Apple //e Emulator for Windows"
VALUE "FileVersion", "1, 14, 1, 1" VALUE "FileVersion", "1, 14, 1, 2"
VALUE "InternalName", "APPLEWIN" VALUE "InternalName", "APPLEWIN"
VALUE "LegalCopyright", "© 1994-2007 Michael O'Brien, Oliver Schmidt, Tom Charlesworth, Michael Pohoreski, Nick Westgate, Linards Ticmanis" VALUE "LegalCopyright", "© 1994-2007 Michael O'Brien, Oliver Schmidt, Tom Charlesworth, Michael Pohoreski, Nick Westgate, Linards Ticmanis"
VALUE "OriginalFilename", "APPLEWIN.EXE" VALUE "OriginalFilename", "APPLEWIN.EXE"
VALUE "ProductName", "Apple //e Emulator" VALUE "ProductName", "Apple //e Emulator"
VALUE "ProductVersion", "1, 14, 1, 1" VALUE "ProductVersion", "1, 14, 1, 2"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"

View File

@ -55,7 +55,6 @@ static HBITMAP diskbitmap[ NUM_DISK_STATUS ];
static HBITMAP buttonbitmap[BUTTONS]; static HBITMAP buttonbitmap[BUTTONS];
//static BOOL active = 0;
static bool g_bAppActive = false; static bool g_bAppActive = false;
static HBRUSH btnfacebrush = (HBRUSH)0; static HBRUSH btnfacebrush = (HBRUSH)0;
static HPEN btnfacepen = (HPEN)0; static HPEN btnfacepen = (HPEN)0;
@ -82,6 +81,11 @@ static int viewporty = VIEWPORTY;
static LPDIRECTDRAW directdraw = (LPDIRECTDRAW)0; static LPDIRECTDRAW directdraw = (LPDIRECTDRAW)0;
static LPDIRECTDRAWSURFACE surface = (LPDIRECTDRAWSURFACE)0; static LPDIRECTDRAWSURFACE surface = (LPDIRECTDRAWSURFACE)0;
static UINT g_uPrevMouseX = 0;
static UINT g_uPrevMouseY = 0;
static bool g_bShowingCursor = true;
static bool g_bOldShowingCursor = true; // Used during MODE_PAUSE
void DrawStatusArea (HDC passdc, BOOL drawflags); void DrawStatusArea (HDC passdc, BOOL drawflags);
void ProcessButtonClick (int button); void ProcessButtonClick (int button);
void ProcessDiskPopupMenu(HWND hwnd, POINT pt, const int iDrive); void ProcessDiskPopupMenu(HWND hwnd, POINT pt, const int iDrive);
@ -623,10 +627,23 @@ LRESULT CALLBACK FrameWndProc (
case MODE_RUNNING: case MODE_RUNNING:
g_nAppMode = MODE_PAUSED; g_nAppMode = MODE_PAUSED;
SoundCore_SetFade(FADE_OUT); SoundCore_SetFade(FADE_OUT);
g_bOldShowingCursor = g_bShowingCursor;
if (sg_Mouse.Active() && !g_bShowingCursor)
{
int nCount = ShowCursor(1);
_ASSERT(nCount >= 0);
g_bShowingCursor = true;
}
break; break;
case MODE_PAUSED: case MODE_PAUSED:
g_nAppMode = MODE_RUNNING; g_nAppMode = MODE_RUNNING;
SoundCore_SetFade(FADE_IN); SoundCore_SetFade(FADE_IN);
if (sg_Mouse.Active() && !g_bOldShowingCursor)
{
int nCount = ShowCursor(0);
_ASSERT(nCount < 0);
g_bShowingCursor = false;
}
break; break;
case MODE_STEPPING: case MODE_STEPPING:
DebuggerInputConsoleChar( DEBUG_EXIT_KEY ); DebuggerInputConsoleChar( DEBUG_EXIT_KEY );
@ -699,17 +716,17 @@ LRESULT CALLBACK FrameWndProc (
} }
else else
{ {
if (sg_Mouse.Active()) JoySetButton(BUTTON0, BUTTON_DOWN);
sg_Mouse.SetButton(BUTTON0, BUTTON_DOWN);
else
JoySetButton(BUTTON0, BUTTON_DOWN);
} }
} }
else if ( ((x < buttonx) && JoyUsingMouse() && ((g_nAppMode == MODE_RUNNING) || (g_nAppMode == MODE_STEPPING))) || else if ( ((x < buttonx) && JoyUsingMouse() && ((g_nAppMode == MODE_RUNNING) || (g_nAppMode == MODE_STEPPING))) )
(sg_Mouse.Active()) )
{ {
SetUsingCursor(1); SetUsingCursor(1);
} }
else if (sg_Mouse.Active())
{
sg_Mouse.SetButton(BUTTON0, BUTTON_DOWN);
}
DebuggerMouseClick( x, y ); DebuggerMouseClick( x, y );
} }
RelayEvent(WM_LBUTTONDOWN,wparam,lparam); RelayEvent(WM_LBUTTONDOWN,wparam,lparam);
@ -730,10 +747,11 @@ LRESULT CALLBACK FrameWndProc (
} }
else if (usingcursor) else if (usingcursor)
{ {
if (sg_Mouse.Active()) JoySetButton(BUTTON0, BUTTON_UP);
sg_Mouse.SetButton(BUTTON0, BUTTON_UP); }
else else if (sg_Mouse.Active())
JoySetButton(BUTTON0, BUTTON_UP); {
sg_Mouse.SetButton(BUTTON0, BUTTON_UP);
} }
RelayEvent(WM_LBUTTONUP,wparam,lparam); RelayEvent(WM_LBUTTONUP,wparam,lparam);
break; break;
@ -763,12 +781,36 @@ LRESULT CALLBACK FrameWndProc (
else if (usingcursor) else if (usingcursor)
{ {
DrawCrosshairs(x,y); DrawCrosshairs(x,y);
if (sg_Mouse.Active()) JoySetPosition(x-viewportx-2, VIEWPORTCX-4, y-viewporty-2, VIEWPORTCY-4);
sg_Mouse.SetPosition(x-viewportx-2, VIEWPORTCX-4, y-viewporty-2, VIEWPORTCY-4);
else
JoySetPosition(x-viewportx-2, VIEWPORTCX-4, y-viewporty-2, VIEWPORTCY-4);
} }
else if (sg_Mouse.Active() && (g_nAppMode == MODE_RUNNING))
{
if ((x >= viewportx+2) &&
(x < buttonx) &&
(y >= viewporty+2) &&
(y <= viewporty+VIEWPORTCY-1))
{
if (g_bShowingCursor)
{
int nCount = ShowCursor(0);
_ASSERT(nCount < 0);
g_bShowingCursor = false;
}
sg_Mouse.SetPositionRel(x-g_uPrevMouseX, y-g_uPrevMouseY);
}
else
{
if (!g_bShowingCursor)
{
int nCount = ShowCursor(1);
_ASSERT(nCount >= 0);
g_bShowingCursor = true;
}
}
}
RelayEvent(WM_MOUSEMOVE,wparam,lparam); RelayEvent(WM_MOUSEMOVE,wparam,lparam);
g_uPrevMouseX = x;
g_uPrevMouseY = y;
break; break;
} }

View File

@ -103,9 +103,9 @@ void CMouseInterface::Initialize(LPBYTE pCxRomPeripheral, UINT uSlot)
// //
SetSlotRom();
RegisterIoHandler(uSlot, &CMouseInterface::IORead, &CMouseInterface::IOWrite, NULL, NULL, this, NULL);
m_bActive = true; m_bActive = true;
SetSlotRom(); // Pre: m_bActive == true
RegisterIoHandler(uSlot, &CMouseInterface::IORead, &CMouseInterface::IOWrite, NULL, NULL, this, NULL);
} }
void CMouseInterface::Uninitialize() void CMouseInterface::Uninitialize()
@ -122,15 +122,16 @@ void CMouseInterface::Reset()
// //
m_nX = 0;
m_nY = 0;
m_iX = 0; m_iX = 0;
m_iMinX = 0; m_iMinX = 0;
m_iMaxX = 1023; m_iMaxX = 1023;
m_iRangeX = 0;
m_iY = 0; m_iY = 0;
m_iMinY = 0; m_iMinY = 0;
m_iMaxY = 1023; m_iMaxY = 1023;
m_iRangeY = 0;
m_bButtons[0] = m_bButtons[1] = FALSE; m_bButtons[0] = m_bButtons[1] = FALSE;
@ -285,7 +286,7 @@ void CMouseInterface::OnCommand()
break; break;
case MOUSE_HOME: case MOUSE_HOME:
m_nDataLen = 1; m_nDataLen = 1;
SetPosition( 0, 0 ); SetPositionAbs( 0, 0 );
break; break;
case MOUSE_TIME: // 0x90 case MOUSE_TIME: // 0x90
switch( m_byBuff[0] & 0x0C ) switch( m_byBuff[0] & 0x0C )
@ -321,21 +322,21 @@ void CMouseInterface::OnWrite()
nMin = ( m_byBuff[3] << 8 ) | m_byBuff[1]; nMin = ( m_byBuff[3] << 8 ) | m_byBuff[1];
nMax = ( m_byBuff[4] << 8 ) | m_byBuff[2]; nMax = ( m_byBuff[4] << 8 ) | m_byBuff[2];
if ( m_byBuff[0] & 1 ) // Clamp Y if ( m_byBuff[0] & 1 ) // Clamp Y
ClampY( nMin, nMax ); SetClampY( nMin, nMax );
else // Clamp X else // Clamp X
ClampX( nMin, nMax ); SetClampX( nMin, nMax );
break; break;
case MOUSE_POS: case MOUSE_POS:
m_nX = ( m_byBuff[2] << 8 ) | m_byBuff[1]; m_nX = ( m_byBuff[2] << 8 ) | m_byBuff[1];
m_nY = ( m_byBuff[4] << 8 ) | m_byBuff[3]; m_nY = ( m_byBuff[4] << 8 ) | m_byBuff[3];
SetPosition( m_nX, m_nY ); SetPositionAbs( m_nX, m_nY );
break; break;
case MOUSE_INIT: case MOUSE_INIT:
m_nX = 0; m_nX = 0;
m_nY = 0; m_nY = 0;
ClampX( 0, 1023 ); SetClampX( 0, 1023 );
ClampY( 0, 1023 ); SetClampY( 0, 1023 );
SetPosition( 0, 0 ); SetPositionAbs( 0, 0 );
break; break;
} }
} }
@ -386,74 +387,61 @@ void CMouseInterface::Clear()
m_nY = 0; m_nY = 0;
m_bBtn0 = 0; m_bBtn0 = 0;
m_bBtn1 = 0; m_bBtn1 = 0;
SetPosition( 0, 0 ); SetPositionAbs( 0, 0 );
// CpuIrqDeassert(IS_MOUSE); // CpuIrqDeassert(IS_MOUSE);
} }
//=========================================================================== //===========================================================================
void CMouseInterface::ClampX(int iMinX, int iMaxX) void CMouseInterface::ClampX()
{
if ( m_iX > m_iMaxX )
m_iX = m_iMaxX;
else if ( m_iX < m_iMinX )
m_iX = m_iMinX;
}
void CMouseInterface::ClampY()
{
if ( m_iY > m_iMaxY )
m_iY = m_iMaxY;
else if ( m_iY < m_iMinY )
m_iY = m_iMinY;
}
void CMouseInterface::SetClampX(int iMinX, int iMaxX)
{ {
if ( iMinX < 0 || iMinX > iMaxX ) if ( iMinX < 0 || iMinX > iMaxX )
return; return;
m_iMaxX = iMaxX; m_iMaxX = iMaxX;
m_iMinX = iMinX; m_iMinX = iMinX;
if ( m_iX > m_iMaxX ) m_iX = m_iMaxX; else if ( m_iX < m_iMinX ) m_iX = m_iMinX; ClampX();
} }
void CMouseInterface::ClampY(int iMinY, int iMaxY) void CMouseInterface::SetClampY(int iMinY, int iMaxY)
{ {
if ( iMinY < 0 || iMinY > iMaxY ) if ( iMinY < 0 || iMinY > iMaxY )
return; return;
m_iMaxY = iMaxY; m_iMaxY = iMaxY;
m_iMinY = iMinY; m_iMinY = iMinY;
if ( m_iY > m_iMaxY ) m_iY = m_iMaxY; else if ( m_iY < m_iMinX ) m_iY = m_iMinY; ClampY();
} }
void CMouseInterface::SetPosition(int xvalue, int yvalue) void CMouseInterface::SetPositionAbs(int x, int y)
{ {
if ((m_iRangeX == 0) || (m_iRangeY == 0)) m_iX = x;
{ m_iY = y;
m_nX = m_iX = m_iMinX;
m_nY = m_iY = m_iMinY;
return;
}
#if NDEBUG
m_iX = (UINT) ((xvalue*m_iMaxX) / m_iRangeX);
m_iY = (UINT) ((yvalue*m_iMaxY) / m_iRangeY);
#else
if (m_iMaxX <= m_iRangeX)
{
m_iX = (UINT) ((xvalue*m_iMaxX) / m_iRangeX);
m_iY = (UINT) ((yvalue*m_iMaxY) / m_iRangeY);
}
else
{
// m_iX = (UINT) ((xvalue*m_iRangeX) / m_iMaxX);
// m_iY = (UINT) ((yvalue*m_iRangeY) / m_iMaxY);
m_iX = xvalue;
m_iY = yvalue;
}
#endif
} }
void CMouseInterface::SetPosition(int xvalue, int xrange, int yvalue, int yrange) void CMouseInterface::SetPositionRel(int dx, int dy)
{ {
m_iRangeX = (UINT) xrange; m_iX += dx;
m_iRangeY = (UINT) yrange; ClampX();
#if NDEBUG m_iY += dy;
#else ClampY();
if (m_iMaxX > m_iRangeX)
{
xvalue = (int) ( ((float)xvalue / (float)m_iRangeX) * (float)m_iMaxX );
yvalue = (int) ( ((float)yvalue / (float)m_iRangeY) * (float)m_iMaxY );
}
#endif
SetPosition(xvalue, yvalue);
OnMouseEvent(); OnMouseEvent();
} }

View File

@ -19,7 +19,7 @@ public:
static BYTE __stdcall IORead(WORD PC, WORD uAddr, BYTE bWrite, BYTE uValue, ULONG nCyclesLeft); static BYTE __stdcall IORead(WORD PC, WORD uAddr, BYTE bWrite, BYTE uValue, ULONG nCyclesLeft);
static BYTE __stdcall IOWrite(WORD PC, WORD uAddr, BYTE bWrite, BYTE uValue, ULONG nCyclesLeft); static BYTE __stdcall IOWrite(WORD PC, WORD uAddr, BYTE bWrite, BYTE uValue, ULONG nCyclesLeft);
void SetPosition(int xvalue, int xrange, int yvalue, int yrange); void SetPositionRel(int dx, int dy);
void SetButton(eBUTTON Button, eBUTTONSTATE State); void SetButton(eBUTTON Button, eBUTTONSTATE State);
bool Active() { return m_bActive; } bool Active() { return m_bActive; }
void SetVBlank(bool bVBL); void SetVBlank(bool bVBL);
@ -36,9 +36,11 @@ protected:
friend WRITE_HANDLER( M6821_Listener_B ); friend WRITE_HANDLER( M6821_Listener_B );
//friend CALLBACK_HANDLER( MouseHandler ); //friend CALLBACK_HANDLER( MouseHandler );
void SetPosition(int xvalue, int yvalue); void SetPositionAbs(int x, int y);
void ClampX(int iMinX, int iMaxX); void ClampX();
void ClampY(int iMinY, int iMaxY); void ClampY();
void SetClampX(int iMinX, int iMaxX);
void SetClampY(int iMinY, int iMaxY);
C6821 m_6821; C6821 m_6821;
@ -61,14 +63,12 @@ protected:
// //
UINT m_iX; int m_iX;
UINT m_iRangeX; int m_iMinX;
UINT m_iMinX; int m_iMaxX;
UINT m_iMaxX; int m_iY;
UINT m_iY; int m_iMinY;
UINT m_iRangeY; int m_iMaxY;
UINT m_iMinY;
UINT m_iMaxY;
BOOL m_bButtons[2]; BOOL m_bButtons[2];