mirror of https://github.com/PCSX2/pcsx2.git
LilyPad: Reverted keyboard messages back to windows messaging.
New method of ensuring thread safety. Device update code should always run in GS thread, even if the emulator really doesn't want to let me (Basically ancient versions of Pcsx2...Or any 3rd party emulators with their own version of MTGS). Updates on PADpoll, PADkeyEvent, or PADupdate, if one is called in the right thread. Updates in thread's WndProc otherwise. Overkill, perhaps, but I prefer to keep things compatible. Removed "Update in GS thread" option. Windows Messaging/Raw Input keyboard event queuing should work a little better. git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1896 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
parent
17b8cd9fa3
commit
fc623d0719
|
@ -45,7 +45,6 @@ const GeneralSettingsBool BoolOptionsInfo[] = {
|
|||
{L"Multitap 1", IDC_MULTITAP1, 0},
|
||||
{L"Multitap 2", IDC_MULTITAP2, 0},
|
||||
|
||||
{L"GS Thread Updates", IDC_GS_THREAD_INPUT, 1},
|
||||
{L"Escape Fullscreen Hack", IDC_ESCAPE_FULLSCREEN_HACK, 1},
|
||||
{L"Disable Screen Saver", IDC_DISABLE_SCREENSAVER, 1},
|
||||
{L"Logging", IDC_DEBUG_FILE, 0},
|
||||
|
@ -818,8 +817,6 @@ int LoadSettings(int force, wchar_t *file) {
|
|||
config.bools[i] = GetPrivateProfileBool(L"General Settings", BoolOptionsInfo[i].name, BoolOptionsInfo[i].defaultValue, file);
|
||||
}
|
||||
|
||||
if (!ps2e) config.GSThreadUpdates = 0;
|
||||
|
||||
config.closeHacks = (u8)GetPrivateProfileIntW(L"General Settings", L"Close Hacks", 0, file);
|
||||
if (config.closeHacks&1) config.closeHacks &= ~2;
|
||||
|
||||
|
@ -1733,10 +1730,6 @@ INT_PTR CALLBACK GeneralDialogProc(HWND hWnd, unsigned int msg, WPARAM wParam, L
|
|||
CheckDlgButton(hWnd, IDC_CLOSE_HACK1, BST_CHECKED * (config.closeHacks&1));
|
||||
CheckDlgButton(hWnd, IDC_CLOSE_HACK2, BST_CHECKED * ((config.closeHacks&2)>>1));
|
||||
|
||||
if (!ps2e) {
|
||||
EnableWindow(GetDlgItem(hWnd, IDC_GS_THREAD_INPUT), 0);
|
||||
}
|
||||
|
||||
if (config.osVersion < 6) EnableWindow(GetDlgItem(hWnd, IDC_VISTA_VOLUME), 0);
|
||||
|
||||
|
||||
|
|
|
@ -41,7 +41,6 @@ public:
|
|||
|
||||
u8 multitap[2];
|
||||
|
||||
u8 GSThreadUpdates;
|
||||
u8 escapeFullscreenHack;
|
||||
u8 disableScreenSaver;
|
||||
u8 debug;
|
||||
|
|
|
@ -156,21 +156,24 @@ void Device::CalcVirtualState() {
|
|||
int val = physicalControlState[i];
|
||||
if (c->type & BUTTON) {
|
||||
virtualControlState[index] = val;
|
||||
if (!(virtualControlState[index]>>15) != !(oldVirtualControlState[index]>>15) && c->vkey) {
|
||||
// Check for alt-F4 to avoid toggling skip mode incorrectly.
|
||||
if (c->vkey == VK_F4) {
|
||||
for (int i=0; i<numPhysicalControls; i++) {
|
||||
if (virtualControlState[physicalControls[i].baseVirtualControlIndex] &&
|
||||
(physicalControls[i].vkey == VK_MENU ||
|
||||
physicalControls[i].vkey == VK_RMENU ||
|
||||
physicalControls[i].vkey == VK_LMENU)) {
|
||||
return;
|
||||
// DirectInput keyboard events only.
|
||||
if (this->api == DI && this->type == KEYBOARD) {
|
||||
if (!(virtualControlState[index]>>15) != !(oldVirtualControlState[index]>>15) && c->vkey) {
|
||||
// Check for alt-F4 to avoid toggling skip mode incorrectly.
|
||||
if (c->vkey == VK_F4) {
|
||||
for (int i=0; i<numPhysicalControls; i++) {
|
||||
if (virtualControlState[physicalControls[i].baseVirtualControlIndex] &&
|
||||
(physicalControls[i].vkey == VK_MENU ||
|
||||
physicalControls[i].vkey == VK_RMENU ||
|
||||
physicalControls[i].vkey == VK_LMENU)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
int event = KEYPRESS;
|
||||
if (!(virtualControlState[index]>>15)) event = KEYRELEASE;
|
||||
QueueKeyEvent(c->vkey, event);
|
||||
}
|
||||
int event = KEYPRESS;
|
||||
if (!(virtualControlState[index]>>15)) event = KEYRELEASE;
|
||||
QueueKeyEvent(c->vkey, event);
|
||||
}
|
||||
}
|
||||
else if (c->type & ABSAXIS) {
|
||||
|
|
|
@ -12,6 +12,10 @@
|
|||
#include "DualShock3.h"
|
||||
#include "HidDevice.h"
|
||||
|
||||
#define WMA_FORCE_UPDATE (WM_APP + 0x537)
|
||||
#define FORCE_UPDATE_WPARAM ((WPARAM)0x74328943)
|
||||
#define FORCE_UPDATE_LPARAM ((LPARAM)0x89437437)
|
||||
|
||||
// LilyPad version.
|
||||
#define VERSION ((0<<8) | 10 | (0<<24))
|
||||
|
||||
|
@ -25,11 +29,15 @@ u8 miceEnabled;
|
|||
int openCount = 0;
|
||||
|
||||
int activeWindow = 0;
|
||||
int windowThreadId = 0;
|
||||
int updateQueued = 0;
|
||||
|
||||
int bufSize = 0;
|
||||
unsigned char outBuf[50];
|
||||
unsigned char inBuf[50];
|
||||
|
||||
// windowThreadId = GetWindowThreadProcessId(hWnd, 0);
|
||||
|
||||
#define MODE_DIGITAL 0x41
|
||||
#define MODE_ANALOG 0x73
|
||||
#define MODE_DS2_NATIVE 0x79
|
||||
|
@ -161,7 +169,7 @@ public:
|
|||
|
||||
// Set to 1 if the state of this pad has been updated since its state
|
||||
// was last queried.
|
||||
u8 stateUpdated;
|
||||
char stateUpdated;
|
||||
|
||||
// initialized and not disabled (and mtap state for slots > 0).
|
||||
u8 enabled;
|
||||
|
@ -358,30 +366,22 @@ void CapSum(ButtonSum *sum) {
|
|||
// Only matters when GS thread updates is disabled (Just like summed pad values
|
||||
// for pads beyond the first slot). Also, it's set to 4 and decremented by 1 on each read,
|
||||
// so it's less likely I'll control state on a PADkeyEvent call.
|
||||
u8 padReadKeyUpdated = 0;
|
||||
char padReadKeyUpdated[4] = {0, 0, 0, 0};
|
||||
|
||||
#define LOCK_DIRECTION 2
|
||||
#define LOCK_BUTTONS 4
|
||||
#define LOCK_BOTH 1
|
||||
|
||||
int deviceUpdateQueued = 0;
|
||||
void QueueDeviceUpdate(int updateList=0) {
|
||||
deviceUpdateQueued = deviceUpdateQueued | 1 | (updateList<<1);
|
||||
};
|
||||
|
||||
|
||||
void Update(unsigned int port, unsigned int slot) {
|
||||
if (deviceUpdateQueued) {
|
||||
UpdateEnabledDevices((deviceUpdateQueued & 0x2)==0x2);
|
||||
deviceUpdateQueued = 0;
|
||||
}
|
||||
if (port > 2) return;
|
||||
u8 *stateUpdated;
|
||||
if (port < 2)
|
||||
char *stateUpdated;
|
||||
if (port < 2) {
|
||||
stateUpdated = &pads[port][slot].stateUpdated;
|
||||
else
|
||||
stateUpdated = &padReadKeyUpdated;
|
||||
if (*stateUpdated) {
|
||||
}
|
||||
else if (port < 6) {
|
||||
stateUpdated = padReadKeyUpdated+port-2;
|
||||
}
|
||||
else return;
|
||||
if (*stateUpdated > 0) {
|
||||
stateUpdated[0] --;
|
||||
return;
|
||||
}
|
||||
|
@ -389,6 +389,21 @@ void Update(unsigned int port, unsigned int slot) {
|
|||
static unsigned int LastCheck = 0;
|
||||
unsigned int t = timeGetTime();
|
||||
if (t - LastCheck < 15) return;
|
||||
|
||||
if (windowThreadId != GetCurrentThreadId()) {
|
||||
if (stateUpdated[0] < 0) {
|
||||
if (!updateQueued) {
|
||||
updateQueued = 1;
|
||||
PostMessage(hWnd, WMA_FORCE_UPDATE, FORCE_UPDATE_WPARAM, FORCE_UPDATE_LPARAM);
|
||||
}
|
||||
}
|
||||
else {
|
||||
stateUpdated[0] --;
|
||||
}
|
||||
return;
|
||||
}
|
||||
updateQueued = 0;
|
||||
|
||||
LastCheck = t;
|
||||
|
||||
int i;
|
||||
|
@ -425,7 +440,7 @@ void Update(unsigned int port, unsigned int slot) {
|
|||
else if ((state>>15) && !(dev->oldVirtualControlState[b->controlIndex]>>15)) {
|
||||
if (cmd == 0x0F) {
|
||||
miceEnabled = !miceEnabled;
|
||||
QueueDeviceUpdate();
|
||||
UpdateEnabledDevices();
|
||||
}
|
||||
else if (cmd == 0x0C) {
|
||||
lockStateChanged[port][slot] |= LOCK_BUTTONS;
|
||||
|
@ -561,11 +576,12 @@ void Update(unsigned int port, unsigned int slot) {
|
|||
pads[i&1][i>>1].sum = s[i&1][i>>1];
|
||||
}
|
||||
pads[port][slot].stateUpdated--;
|
||||
padReadKeyUpdated = 4;
|
||||
padReadKeyUpdated[0] = padReadKeyUpdated[1] = padReadKeyUpdated[2] = 1;
|
||||
*stateUpdated = 0;
|
||||
}
|
||||
|
||||
void CALLBACK PADupdate(int port) {
|
||||
if (config.GSThreadUpdates) Update(port, 0);
|
||||
Update(port+3, 0);
|
||||
}
|
||||
|
||||
inline void SetVibrate(int port, int slot, int motor, u8 val) {
|
||||
|
@ -755,6 +771,14 @@ static const u8 setNativeMode[7] = {0x5A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5A};
|
|||
// changes.
|
||||
ExtraWndProcResult HackWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *output) {
|
||||
switch (uMsg) {
|
||||
case WMA_FORCE_UPDATE:
|
||||
if (wParam == FORCE_UPDATE_WPARAM && lParam == FORCE_UPDATE_LPARAM) {
|
||||
if (updateQueued) {
|
||||
updateQueued = 0;
|
||||
Update(5, 0);
|
||||
}
|
||||
return NO_WND_PROC;
|
||||
}
|
||||
case WM_SETTEXT:
|
||||
if (config.saveStateTitle) {
|
||||
wchar_t text[200];
|
||||
|
@ -775,15 +799,17 @@ ExtraWndProcResult HackWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPara
|
|||
break;
|
||||
case WM_DEVICECHANGE:
|
||||
if (wParam == DBT_DEVNODES_CHANGED) {
|
||||
QueueDeviceUpdate(1);
|
||||
UpdateEnabledDevices(1);
|
||||
}
|
||||
break;
|
||||
case WM_ACTIVATEAPP:
|
||||
// Release any buttons PCSX2 may think are down when
|
||||
// losing/gaining focus.
|
||||
ReleaseModifierKeys();
|
||||
if (!wParam) {
|
||||
ReleaseModifierKeys();
|
||||
}
|
||||
activeWindow = wParam != 0;
|
||||
QueueDeviceUpdate();
|
||||
UpdateEnabledDevices();
|
||||
break;
|
||||
case WM_CLOSE:
|
||||
if (config.closeHacks & 1) {
|
||||
|
@ -885,6 +911,7 @@ s32 CALLBACK PADopen(void *pDsp) {
|
|||
EatWndProc(hWnd, HideCursorProc, 0);
|
||||
}
|
||||
SaveStateChanged();
|
||||
windowThreadId = GetWindowThreadProcessId(hWnd, 0);
|
||||
}
|
||||
|
||||
if (restoreFullScreen) {
|
||||
|
@ -911,14 +938,13 @@ s32 CALLBACK PADopen(void *pDsp) {
|
|||
|
||||
// activeWindow = (GetAncestor(hWnd, GA_ROOT) == GetAncestor(GetForegroundWindow(), GA_ROOT));
|
||||
activeWindow = 1;
|
||||
QueueDeviceUpdate();
|
||||
UpdateEnabledDevices();
|
||||
return 0;
|
||||
}
|
||||
|
||||
void CALLBACK PADclose() {
|
||||
if (openCount && !--openCount) {
|
||||
DEBUG_TEXT_OUT("LilyPad closed\n\n");
|
||||
deviceUpdateQueued = 0;
|
||||
dm->ReleaseInput();
|
||||
ReleaseEatenProc();
|
||||
hWnd = 0;
|
||||
|
@ -987,9 +1013,7 @@ u8 CALLBACK PADpoll(u8 value) {
|
|||
case 0x42:
|
||||
query.response[2] = 0x5A;
|
||||
{
|
||||
if (!config.GSThreadUpdates) {
|
||||
Update(query.port, query.slot);
|
||||
}
|
||||
Update(query.port, query.slot);
|
||||
ButtonSum *sum = &pad->sum;
|
||||
|
||||
u8 b1 = 0xFF, b2 = 0xFF;
|
||||
|
@ -1252,9 +1276,7 @@ keyEvent* CALLBACK PADkeyEvent() {
|
|||
}
|
||||
eventCount = 0;
|
||||
|
||||
if (!config.GSThreadUpdates) {
|
||||
Update(2, 0);
|
||||
}
|
||||
Update(2, 0);
|
||||
static char shiftDown = 0;
|
||||
static char altDown = 0;
|
||||
static keyEvent ev;
|
||||
|
|
|
@ -235,10 +235,9 @@ BEGIN
|
|||
PUSHBUTTON "Test Device",ID_TEST,87,300,57,15
|
||||
PUSHBUTTON "Refresh",ID_REFRESH,153,300,48,15
|
||||
GROUPBOX "Miscellaneous",IDC_STATIC,216,219,201,35
|
||||
CONTROL "Use GS thread",IDC_GS_THREAD_INPUT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,221,230,62,10
|
||||
CONTROL "Disable screensaver",IDC_DISABLE_SCREENSAVER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,221,241,80,10
|
||||
CONTROL "Local volume control",IDC_VISTA_VOLUME,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,336,230,77,10
|
||||
CONTROL "Enable logging",IDC_DEBUG_FILE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,336,241,62,10
|
||||
CONTROL "Disable screensaver",IDC_DISABLE_SCREENSAVER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,221,230,80,10
|
||||
CONTROL "Local volume control",IDC_VISTA_VOLUME,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,221,241,77,10
|
||||
CONTROL "Enable logging",IDC_DEBUG_FILE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,336,230,62,10
|
||||
GROUPBOX "Hacks",IDC_STATIC,216,256,201,46
|
||||
CONTROL "Send escape on window close",IDC_CLOSE_HACK1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,223,266,113,10
|
||||
CONTROL "Exit emulator on window close",IDC_CLOSE_HACK2,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,223,277,112,10
|
||||
|
|
|
@ -21,7 +21,16 @@ wchar_t *WindowsKeyboard::GetPhysicalControlName(PhysicalControl *control) {
|
|||
|
||||
void WindowsKeyboard::UpdateKey(int vkey, int state) {
|
||||
if (vkey > 7 && vkey < 256) {
|
||||
physicalControlState[vkey] = state * FULLY_DOWN;
|
||||
int newState = state * FULLY_DOWN;
|
||||
if (newState != physicalControlState[vkey]) {
|
||||
// Check for alt-F4 to avoid toggling skip mode incorrectly.
|
||||
if (vkey != VK_F4 || !(physicalControls[VK_MENU].vkey || physicalControls[VK_MENU].vkey || physicalControls[VK_MENU].vkey)) {
|
||||
int event = KEYPRESS;
|
||||
if (!newState) event = KEYRELEASE;
|
||||
QueueKeyEvent(vkey, event);
|
||||
}
|
||||
}
|
||||
physicalControlState[vkey] = newState;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -6,18 +6,34 @@
|
|||
#include "WindowsKeyboard.h"
|
||||
#include "WindowsMouse.h"
|
||||
|
||||
ExtraWndProcResult WindowsMessagingWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *output);
|
||||
|
||||
class WindowsMessagingKeyboard;
|
||||
class WindowsMessagingMouse;
|
||||
|
||||
static WindowsMessagingKeyboard *wmk = 0;
|
||||
static WindowsMessagingMouse *wmm = 0;
|
||||
|
||||
class WindowsMessagingKeyboard : public WindowsKeyboard {
|
||||
public:
|
||||
int binding;
|
||||
|
||||
WindowsMessagingKeyboard() : WindowsKeyboard(WM, L"WM Keyboard") {
|
||||
}
|
||||
|
||||
int Activate(InitInfo *initInfo) {
|
||||
binding = initInfo->binding;
|
||||
|
||||
EatWndProc(initInfo->hWndButton, WMKeyboardBindingWndProc, EATPROC_NO_UPDATE_WHILE_UPDATING_DEVICES);
|
||||
// Redundant. Should match the next line.
|
||||
// Deactivate();
|
||||
if (wmk) wmk->Deactivate();
|
||||
HWND hWnd = initInfo->hWnd;
|
||||
if (initInfo->hWndButton) {
|
||||
hWnd = initInfo->hWndButton;
|
||||
}
|
||||
if (!wmm && !EatWndProc(hWnd, WindowsMessagingWndProc, EATPROC_NO_UPDATE_WHILE_UPDATING_DEVICES)) {
|
||||
Deactivate();
|
||||
return 0;
|
||||
}
|
||||
|
||||
wmk = this;
|
||||
InitState();
|
||||
|
||||
active = 1;
|
||||
|
@ -25,54 +41,37 @@ public:
|
|||
}
|
||||
|
||||
void Deactivate() {
|
||||
ReleaseExtraProc(WMKeyboardBindingWndProc);
|
||||
active = 0;
|
||||
FreeState();
|
||||
if (active) {
|
||||
if (!wmm)
|
||||
ReleaseExtraProc(WindowsMessagingWndProc);
|
||||
wmk = 0;
|
||||
active = 0;
|
||||
FreeState();
|
||||
}
|
||||
}
|
||||
|
||||
int Update() {
|
||||
for (int i=10; i<256; i++) {
|
||||
CheckKey(i);
|
||||
}
|
||||
physicalControlState[VK_MENU] = 0;
|
||||
physicalControlState[VK_SHIFT] = 0;
|
||||
physicalControlState[VK_CONTROL] = 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
void CheckKey(int vkey) {
|
||||
UpdateKey(vkey, 1&(((unsigned short)GetAsyncKeyState(vkey))>>15));
|
||||
}
|
||||
|
||||
static ExtraWndProcResult WMKeyboardBindingWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *output) {
|
||||
if (uMsg == WM_KEYDOWN || uMsg == WM_SYSKEYDOWN || uMsg == WM_KEYUP || uMsg == WM_SYSKEYUP || uMsg == WM_CHAR || uMsg == WM_UNICHAR) {
|
||||
return NO_WND_PROC;
|
||||
}
|
||||
return CONTINUE_BLISSFULLY;
|
||||
}
|
||||
};
|
||||
|
||||
ExtraWndProcResult WMMouseWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *output);
|
||||
|
||||
class WindowsMessagingMouse;
|
||||
|
||||
static WindowsMessagingMouse *wmm = 0;
|
||||
|
||||
class WindowsMessagingMouse : public WindowsMouse {
|
||||
public:
|
||||
|
||||
WindowsMessagingMouse() : WindowsMouse(WM, 1, L"WM Mouse") {
|
||||
}
|
||||
|
||||
int Activate(InitInfo *initInfo) {
|
||||
// Redundant. Should match the next line.
|
||||
// Deactivate();
|
||||
if (wmm) wmm->Deactivate();
|
||||
|
||||
HWND hWnd = initInfo->hWnd;
|
||||
if (initInfo->hWndButton) {
|
||||
hWnd = initInfo->hWndButton;
|
||||
}
|
||||
|
||||
if (!EatWndProc(hWnd, WMMouseWndProc, EATPROC_NO_UPDATE_WHILE_UPDATING_DEVICES)) {
|
||||
if (!wmk && !EatWndProc(hWnd, WindowsMessagingWndProc, EATPROC_NO_UPDATE_WHILE_UPDATING_DEVICES)) {
|
||||
Deactivate();
|
||||
return 0;
|
||||
}
|
||||
|
@ -88,65 +87,92 @@ public:
|
|||
|
||||
void Deactivate() {
|
||||
if (active) {
|
||||
ReleaseExtraProc(WMMouseWndProc);
|
||||
if (!wmk)
|
||||
ReleaseExtraProc(WindowsMessagingWndProc);
|
||||
ReleaseMouseCapture();
|
||||
wmm = 0;
|
||||
active = 0;
|
||||
FreeState();
|
||||
}
|
||||
}
|
||||
|
||||
static ExtraWndProcResult WMMouseWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *output) {
|
||||
if (wmm) {
|
||||
if (uMsg == WM_MOUSEMOVE) {
|
||||
POINT p;
|
||||
GetCursorPos(&p);
|
||||
// Need check to prevent cursor movement cascade.
|
||||
if (p.x != wmm->center.x || p.y != wmm->center.y) {
|
||||
wmm->UpdateAxis(0, p.x - wmm->center.x);
|
||||
wmm->UpdateAxis(1, p.y - wmm->center.y);
|
||||
|
||||
SetCursorPos(wmm->center.x, wmm->center.y);
|
||||
}
|
||||
return NO_WND_PROC;
|
||||
}
|
||||
else if (uMsg == WM_LBUTTONDOWN || uMsg == WM_LBUTTONUP) {
|
||||
wmm->UpdateButton(0, uMsg == WM_LBUTTONDOWN);
|
||||
return NO_WND_PROC;
|
||||
}
|
||||
else if (uMsg == WM_RBUTTONDOWN || uMsg == WM_RBUTTONUP) {
|
||||
wmm->UpdateButton(1, uMsg == WM_RBUTTONDOWN);
|
||||
return NO_WND_PROC;
|
||||
}
|
||||
else if (uMsg == WM_MBUTTONDOWN || uMsg == WM_MBUTTONUP) {
|
||||
wmm->UpdateButton(2, uMsg == WM_MBUTTONDOWN);
|
||||
return NO_WND_PROC;
|
||||
}
|
||||
else if (uMsg == WM_XBUTTONDOWN || uMsg == WM_XBUTTONUP) {
|
||||
wmm->UpdateButton(3+((wParam>>16) == XBUTTON2), uMsg == WM_XBUTTONDOWN);
|
||||
return NO_WND_PROC;
|
||||
}
|
||||
else if (uMsg == WM_MOUSEWHEEL) {
|
||||
wmm->UpdateAxis(2, ((int)wParam>>16)/WHEEL_DELTA);
|
||||
return NO_WND_PROC;
|
||||
}
|
||||
else if (uMsg == WM_MOUSEHWHEEL) {
|
||||
wmm->UpdateAxis(3, ((int)wParam>>16)/WHEEL_DELTA);
|
||||
return NO_WND_PROC;
|
||||
}
|
||||
else if (uMsg == WM_SIZE && wmm->active) {
|
||||
WindowsMouse::WindowResized(hWnd);
|
||||
}
|
||||
// Taken care of elsewhere. When binding, killing focus means stop reading input.
|
||||
// When running PCSX2, I release all mouse and keyboard input elsewhere.
|
||||
/*else if (uMsg == WM_KILLFOCUS) {
|
||||
wmm->Deactivate();
|
||||
}//*/
|
||||
}
|
||||
return CONTINUE_BLISSFULLY;
|
||||
}
|
||||
};
|
||||
|
||||
ExtraWndProcResult WindowsMessagingWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *output) {
|
||||
if (wmk) {
|
||||
if (uMsg == WM_KEYDOWN || uMsg == WM_SYSKEYDOWN || uMsg == WM_KEYUP || uMsg == WM_SYSKEYUP) {
|
||||
if (wParam == VK_SHIFT) {
|
||||
wmk->CheckKey(VK_RSHIFT);
|
||||
wmk->CheckKey(VK_LSHIFT);
|
||||
}
|
||||
else if (wParam == VK_CONTROL) {
|
||||
wmk->CheckKey(VK_RCONTROL);
|
||||
wmk->CheckKey(VK_LCONTROL);
|
||||
}
|
||||
else if (wParam == VK_MENU) {
|
||||
wmk->CheckKey(VK_RMENU);
|
||||
wmk->CheckKey(VK_LMENU);
|
||||
}
|
||||
else
|
||||
wmk->UpdateKey(wParam, (uMsg == WM_KEYDOWN || uMsg == WM_SYSKEYDOWN));
|
||||
return NO_WND_PROC;
|
||||
}
|
||||
// Needed to prevent default handling of keys in some situations.
|
||||
else if (uMsg == WM_CHAR || uMsg == WM_UNICHAR) {
|
||||
return NO_WND_PROC;
|
||||
}
|
||||
else if (uMsg == WM_ACTIVATE) {
|
||||
// Not really needed, but doesn't hurt.
|
||||
memset(wmk->physicalControlState, 0, sizeof(int) * wmk->numPhysicalControls);
|
||||
}
|
||||
}
|
||||
if (wmm) {
|
||||
if (uMsg == WM_MOUSEMOVE) {
|
||||
POINT p;
|
||||
GetCursorPos(&p);
|
||||
// Need check to prevent cursor movement cascade.
|
||||
if (p.x != wmm->center.x || p.y != wmm->center.y) {
|
||||
wmm->UpdateAxis(0, p.x - wmm->center.x);
|
||||
wmm->UpdateAxis(1, p.y - wmm->center.y);
|
||||
|
||||
SetCursorPos(wmm->center.x, wmm->center.y);
|
||||
}
|
||||
return NO_WND_PROC;
|
||||
}
|
||||
else if (uMsg == WM_LBUTTONDOWN || uMsg == WM_LBUTTONUP) {
|
||||
wmm->UpdateButton(0, uMsg == WM_LBUTTONDOWN);
|
||||
return NO_WND_PROC;
|
||||
}
|
||||
else if (uMsg == WM_RBUTTONDOWN || uMsg == WM_RBUTTONUP) {
|
||||
wmm->UpdateButton(1, uMsg == WM_RBUTTONDOWN);
|
||||
return NO_WND_PROC;
|
||||
}
|
||||
else if (uMsg == WM_MBUTTONDOWN || uMsg == WM_MBUTTONUP) {
|
||||
wmm->UpdateButton(2, uMsg == WM_MBUTTONDOWN);
|
||||
return NO_WND_PROC;
|
||||
}
|
||||
else if (uMsg == WM_XBUTTONDOWN || uMsg == WM_XBUTTONUP) {
|
||||
wmm->UpdateButton(3+((wParam>>16) == XBUTTON2), uMsg == WM_XBUTTONDOWN);
|
||||
return NO_WND_PROC;
|
||||
}
|
||||
else if (uMsg == WM_MOUSEWHEEL) {
|
||||
wmm->UpdateAxis(2, ((int)wParam>>16)/WHEEL_DELTA);
|
||||
return NO_WND_PROC;
|
||||
}
|
||||
else if (uMsg == WM_MOUSEHWHEEL) {
|
||||
wmm->UpdateAxis(3, ((int)wParam>>16)/WHEEL_DELTA);
|
||||
return NO_WND_PROC;
|
||||
}
|
||||
else if (uMsg == WM_SIZE && wmm->active) {
|
||||
WindowsMouse::WindowResized(hWnd);
|
||||
}
|
||||
// Taken care of elsewhere. When binding, killing focus means stop reading input.
|
||||
// When running PCSX2, I release all mouse and keyboard input elsewhere.
|
||||
/*else if (uMsg == WM_KILLFOCUS) {
|
||||
wmm->Deactivate();
|
||||
}//*/
|
||||
}
|
||||
return CONTINUE_BLISSFULLY;
|
||||
}
|
||||
|
||||
void EnumWindowsMessagingDevices() {
|
||||
dm->AddDevice(new WindowsMessagingKeyboard());
|
||||
|
|
|
@ -45,7 +45,6 @@ void ReleaseEatenProc() {
|
|||
while (numExtraProcs) ReleaseExtraProc(extraProcs[0].proc);
|
||||
}
|
||||
|
||||
extern int deviceUpdateQueued;
|
||||
LRESULT CALLBACK OverrideWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {
|
||||
ExtraWndProcResult res = CONTINUE_BLISSFULLY;
|
||||
LRESULT out = 0;
|
||||
|
@ -58,7 +57,7 @@ LRESULT CALLBACK OverrideWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPa
|
|||
// Note: Second bit of deviceUpdateQueued is only set when I receive a device change
|
||||
// notification, which is handled in the GS thread in one of the extraProcs, so this
|
||||
// is all I need to prevent bad things from happening while updating devices. No mutex needed.
|
||||
if ((deviceUpdateQueued&2) && (extraProcs[i].flags & EATPROC_NO_UPDATE_WHILE_UPDATING_DEVICES)) continue;
|
||||
// if ((deviceUpdateQueued&2) && (extraProcs[i].flags & EATPROC_NO_UPDATE_WHILE_UPDATING_DEVICES)) continue;
|
||||
|
||||
ExtraWndProcResult res2 = extraProcs[i].proc(hWnd, uMsg, wParam, lParam, &out);
|
||||
if (res2 != res) {
|
||||
|
|
|
@ -40,7 +40,6 @@
|
|||
#define IDC_GH2_HACK 1125
|
||||
#define IDC_FORCEFEEDBACK_HACK1 1126
|
||||
#define IDC_VISTA_VOLUME 1126
|
||||
#define IDC_GS_THREAD_INPUT 1128
|
||||
#define IDC_SAVE_STATE_TITLE 1129
|
||||
#define IDC_PAD_LIST 1133
|
||||
#define IDC_COMBO1 1134
|
||||
|
|
Loading…
Reference in New Issue