Multi mouse working in Windows
This commit is contained in:
@@ -289,7 +289,7 @@ void zstart ()
|
|||||||
puts("May or may not be complete");
|
puts("May or may not be complete");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef __MSDOS__
|
#ifdef __SDL__
|
||||||
MultiMouseInit();
|
MultiMouseInit();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -393,6 +393,11 @@ void DrawScreen()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C" void MultiMouseInit();
|
||||||
|
extern "C" void MultiMouseShutdown();
|
||||||
|
extern BYTE device1,device2;
|
||||||
|
extern BYTE GUIOn;
|
||||||
|
extern BYTE GUIOn2;
|
||||||
DWORD InputEn=0;
|
DWORD InputEn=0;
|
||||||
|
|
||||||
BOOL InputAcquire(void)
|
BOOL InputAcquire(void)
|
||||||
@@ -402,7 +407,8 @@ BOOL InputAcquire(void)
|
|||||||
if (JoystickInput[2]) JoystickInput[2]->Acquire();
|
if (JoystickInput[2]) JoystickInput[2]->Acquire();
|
||||||
if (JoystickInput[3]) JoystickInput[3]->Acquire();
|
if (JoystickInput[3]) JoystickInput[3]->Acquire();
|
||||||
if (JoystickInput[4]) JoystickInput[4]->Acquire();
|
if (JoystickInput[4]) JoystickInput[4]->Acquire();
|
||||||
if (MouseInput) MouseInput->Acquire();
|
if (device1 && device2 && !GUIOn2) MultiMouseInit();
|
||||||
|
else if (MouseInput) MouseInput->Acquire();
|
||||||
if (KeyboardInput) KeyboardInput->Acquire();
|
if (KeyboardInput) KeyboardInput->Acquire();
|
||||||
InputEn = 1;
|
InputEn = 1;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@@ -410,13 +416,15 @@ BOOL InputAcquire(void)
|
|||||||
|
|
||||||
BOOL InputDeAcquire(void)
|
BOOL InputDeAcquire(void)
|
||||||
{
|
{
|
||||||
if (MouseInput) { MouseInput->Unacquire(); }
|
|
||||||
if (KeyboardInput) KeyboardInput->Unacquire();
|
if (KeyboardInput) KeyboardInput->Unacquire();
|
||||||
if (JoystickInput[0]) JoystickInput[0]->Unacquire();
|
if (JoystickInput[0]) JoystickInput[0]->Unacquire();
|
||||||
if (JoystickInput[1]) JoystickInput[1]->Unacquire();
|
if (JoystickInput[1]) JoystickInput[1]->Unacquire();
|
||||||
if (JoystickInput[2]) JoystickInput[2]->Unacquire();
|
if (JoystickInput[2]) JoystickInput[2]->Unacquire();
|
||||||
if (JoystickInput[3]) JoystickInput[3]->Unacquire();
|
if (JoystickInput[3]) JoystickInput[3]->Unacquire();
|
||||||
if (JoystickInput[4]) JoystickInput[4]->Unacquire();
|
if (JoystickInput[4]) JoystickInput[4]->Unacquire();
|
||||||
|
if (device1 && device2 && !GUIOn2) MultiMouseShutdown();
|
||||||
|
else if (MouseInput) MouseInput->Unacquire();
|
||||||
InputEn = 0;
|
InputEn = 0;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@@ -424,8 +432,6 @@ BOOL InputDeAcquire(void)
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
void initwinvideo();
|
void initwinvideo();
|
||||||
void DosExit(void);
|
void DosExit(void);
|
||||||
extern BYTE GUIOn;
|
|
||||||
extern BYTE GUIOn2;
|
|
||||||
extern BYTE EMUPause;
|
extern BYTE EMUPause;
|
||||||
extern BYTE cfgsoundon;
|
extern BYTE cfgsoundon;
|
||||||
extern BYTE StereoSound;
|
extern BYTE StereoSound;
|
||||||
@@ -479,18 +485,8 @@ BOOL InputRead(void)
|
|||||||
{
|
{
|
||||||
DIMOUSESTATE dims;
|
DIMOUSESTATE dims;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
aquireagain:;
|
|
||||||
hr=MouseInput->GetDeviceState(sizeof(DIMOUSESTATE),&dims);
|
hr=MouseInput->GetDeviceState(sizeof(DIMOUSESTATE),&dims);
|
||||||
|
|
||||||
if (hr==DIERR_INPUTLOST)
|
|
||||||
{
|
|
||||||
hr=MouseInput->Acquire();
|
|
||||||
if (SUCCEEDED(hr))
|
|
||||||
{
|
|
||||||
goto aquireagain;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (SUCCEEDED(hr))
|
if (SUCCEEDED(hr))
|
||||||
{
|
{
|
||||||
MouseMoveX=(float)dims.lX;
|
MouseMoveX=(float)dims.lX;
|
||||||
@@ -657,7 +653,7 @@ LRESULT CALLBACK Main_Proc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||||||
shiftpr=false;
|
shiftpr=false;
|
||||||
break;
|
break;
|
||||||
case WM_MOUSEMOVE:
|
case WM_MOUSEMOVE:
|
||||||
if (MouseInput) MouseInput->Acquire();
|
if (MouseInput && GUIOn2) MouseInput->Acquire();
|
||||||
break;
|
break;
|
||||||
case WM_MOVE:
|
case WM_MOVE:
|
||||||
break;
|
break;
|
||||||
@@ -1827,11 +1823,22 @@ void Start60HZ(void)
|
|||||||
|
|
||||||
InitSemaphore();
|
InitSemaphore();
|
||||||
|
|
||||||
|
if (device1 && device2)
|
||||||
|
{
|
||||||
|
MouseInput->Unacquire();
|
||||||
|
MultiMouseInit();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Stop60HZ(void)
|
void Stop60HZ(void)
|
||||||
{
|
{
|
||||||
T60HZEnabled=0;
|
T60HZEnabled=0;
|
||||||
|
if (device1 && device2)
|
||||||
|
{
|
||||||
|
MultiMouseShutdown();
|
||||||
|
MouseInput->Acquire();
|
||||||
|
}
|
||||||
ShutdownSemaphore();
|
ShutdownSemaphore();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2096,22 +2103,29 @@ void initwinvideo(void)
|
|||||||
hMainWindow = CreateWindow( "ZSNES", WinName, WS_VISIBLE|WS_POPUP,X,Y, //WS_OVERLAPPED "ZSNES"
|
hMainWindow = CreateWindow( "ZSNES", WinName, WS_VISIBLE|WS_POPUP,X,Y, //WS_OVERLAPPED "ZSNES"
|
||||||
WindowWidth,WindowHeight,NULL,NULL,hInst,NULL);
|
WindowWidth,WindowHeight,NULL,NULL,hInst,NULL);
|
||||||
|
|
||||||
CheckPriority();
|
|
||||||
CheckAlwaysOnTop();
|
|
||||||
CheckScreenSaver();
|
|
||||||
|
|
||||||
if (!hMainWindow)
|
if (!hMainWindow)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Hide the cursor
|
||||||
|
ShowCursor(0);
|
||||||
|
|
||||||
|
// Set window attributes
|
||||||
ShowWindow(hMainWindow, SW_SHOWNORMAL);
|
ShowWindow(hMainWindow, SW_SHOWNORMAL);
|
||||||
SetWindowText(hMainWindow,"ZSNES");
|
SetWindowText(hMainWindow,"ZSNES");
|
||||||
|
|
||||||
|
// Run ZSNES Windows GUI callback functions to set initial values
|
||||||
|
CheckPriority();
|
||||||
|
CheckAlwaysOnTop();
|
||||||
|
CheckScreenSaver();
|
||||||
|
|
||||||
|
// Init various DirectX subsystems
|
||||||
InitInput();
|
InitInput();
|
||||||
InitSound();
|
InitSound();
|
||||||
TestJoy();
|
TestJoy();
|
||||||
|
|
||||||
if (debugger) InitDebugger(); // Start debugger
|
if (debugger) InitDebugger(); // Start debugger such that it is at this point
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2906,8 +2920,6 @@ void WinUpdateDevices()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extern unsigned char device1, device2;
|
|
||||||
|
|
||||||
int GetMouseX(void)
|
int GetMouseX(void)
|
||||||
{
|
{
|
||||||
InputRead();
|
InputRead();
|
||||||
|
|||||||
Reference in New Issue
Block a user