Input needed on /click after 26/27 Aug Patch

A forum for feature requests/discussions and user submitted patches that improve MQ2

Moderator: MacroQuest Developers

Mckorr
Developer
Developer
Posts: 2326
Joined: Fri Oct 18, 2002 1:16 pm
Location: Texas

Post by Mckorr » Fri Aug 29, 2003 1:38 pm

It's gotta be in the _MOUSESPOOF struct. Could use some help there, since I definately suck at them things. Is Neal_Thorpayt still around? He's the one that figured out the whole click thing to begin with.

I keep thinking it should be simple: trace what happens in EQ when you push the left or right mouse buttons, and then make our program issue that same call. I just can't seem to figure out how to do it.
MQ2: Think of it as Evolution in action.

Rand
a lesser mummy
a lesser mummy
Posts: 44
Joined: Sun Jun 08, 2003 8:37 am

Post by Rand » Fri Aug 29, 2003 2:02 pm

Mckorr wrote:

Code: Select all

			   case MD_Button0Click:
				   rgdod[*pdwInOut].dwData = 0x80;
				   rgdod[*pdwInOut].dwOfs = DIMOFS_BUTTON0;
				   gMouseData->mdType = MD_Button0;
				   gMouseData->dwData = 0x00;
				   bRemoveItem = FALSE;
				   bLoop = FALSE;
				   break;

Excerpt from the DInput detours. Two things catch my eye. First, that these functions rely on the _MOUSESPOOF struct. Second, those two hard coded addresses, 0x80 and 0x00. The 0x00 is related to MOUSESPOOF, but what about the 0x80? That is part of a call to the DirectInput function itself.
The 0x80 is the code for "right button down". A few line lower in the 'case MD_Button1' you have the code that add a 'right button up' in the event queue.

http://msdn.microsoft.com/library/defau ... ceData.asp

http://msdn.microsoft.com/library/defau ... ctdata.asp

When I tried to fix it for the euro EQ I added some code to dump the rgdod array to the telnet server. I could see all the mouse event when I moved & clicked with my mouse, but when I added my event EQ ignored them.
That 's why I think they use a different path for the input. They may use an action map. I will try to dump the uAppData field and read te doc about actionmap ...

Mckorr
Developer
Developer
Posts: 2326
Joined: Fri Oct 18, 2002 1:16 pm
Location: Texas

Post by Mckorr » Fri Aug 29, 2003 2:15 pm

ZOOM WHEEL

Our mouse structure is wrong. It doesn't take into account the Z axis, which in EQ's case is the wheel zoom in/out, which is currently enabled by default.

Code: Select all

typedef struct _MOUSEINFO {
	DWORD X;
	DWORD Y;
	DWORD SpeedX;
	DWORD SpeedY;
} MOUSEINFO, *PMOUSEINFO;
MQ2: Think of it as Evolution in action.

motd2k
a ghoul
a ghoul
Posts: 141
Joined: Fri Oct 25, 2002 9:46 am

Post by motd2k » Fri Aug 29, 2003 3:12 pm

I'm trying to get the non-detoured version of this working. You're right.. 0x80 refers to a mouse button in a 'pressed' state. If you look at memory at 0x6A5783(clicks offset+0x2) you'll see the button state for the left mouse button. Write 0x80 there and you get a click... try it in your debugger. Write 0x80 then 0x0 in quick succession and you'll simulate a single left click. This is where im struggling.

At the moment i'm able to write 0x80 just fine, but then I need to transfer control back to EQ for long enough for it to recognise this and put the button down, then transfer control back to MQ for it to 'raise' the button. How do I do this? Anyone, anything?! Tried sleep(100) between the two, but that doesn't give controll back to EQ to recognise the click.

MOTD

Mckorr
Developer
Developer
Posts: 2326
Joined: Fri Oct 18, 2002 1:16 pm
Location: Texas

Post by Mckorr » Fri Aug 29, 2003 3:38 pm

Okay, about the only thing I've managed to do so far is clean out some of the glut left over from the old detoured mouse movement. So far no joy on actually instituting a click :(

Let me edit that a bit: I do know where in the code to put in a nondetoured solution for the click. Now we just have to find a way to make it do it.
MQ2: Think of it as Evolution in action.

Valerian
a grimling bloodguard
a grimling bloodguard
Posts: 709
Joined: Sun Jul 28, 2002 3:29 am

Post by Valerian » Fri Aug 29, 2003 5:54 pm

at one point, I considered making a new global variable to set for when we start a click, which would be the equivalent of a macropause... checking in the Pulse() (or somewhere) for the time, and if (gOurMouseEvent) { DoOurMouseUp(); gOurMouseEvent=NULL; }

anyway, may think of doing it that way.

motd2k
a ghoul
a ghoul
Posts: 141
Joined: Fri Oct 25, 2002 9:46 am

Post by motd2k » Fri Aug 29, 2003 8:21 pm

0x755289 would appear interesting too, seems to be some kind of flag for a 'held' left mouse button, i.e. to drag something or create a hotkey.


MOTD

motd2k
a ghoul
a ghoul
Posts: 141
Joined: Fri Oct 25, 2002 9:46 am

Post by motd2k » Fri Aug 29, 2003 9:43 pm

offset update...

Code: Select all

Clicks=006A5780
Clicks in CVS is out by a byte.

Structure is follows:-

Code: Select all

typedef struct _MOUSECLICKS {
   BYTE		leftclickconfirm;
   BYTE		rightclickconfirm;
   BYTE		rightclick;
   BYTE		leftclick;
} MOUSECLICKS, *PMOUSECLICKS;
Write an 0x80 to either rightclick or leftclick and wait for the corresponding confirm to become 0x80 too.

Mckorr
Developer
Developer
Posts: 2326
Joined: Fri Oct 18, 2002 1:16 pm
Location: Texas

Post by Mckorr » Sat Aug 30, 2003 10:32 am

Good job, will start investigating how best to integrate that into the code.
MQ2: Think of it as Evolution in action.

motd2k
a ghoul
a ghoul
Posts: 141
Joined: Fri Oct 25, 2002 9:46 am

Post by motd2k » Sat Aug 30, 2003 10:42 am

I have a fudged version up and running, created two functions /lclickup and /lclickdown. Called in a macro they simulate a left click perfectly. Just trying to combine those two into one function, but like others before me am struggling with passing control back to EQ to allow it to process the mousedown before having MQ send the mouseup.

Also, in a strange reversal, my click functions only work if EQ DOESN'T have the mouse in exclusive mode (i.e. Ctrl-Alt-R in EQW). Could this be todo with the click detour still being in place in my source?



MOTD

Mckorr
Developer
Developer
Posts: 2326
Joined: Fri Oct 18, 2002 1:16 pm
Location: Texas

Post by Mckorr » Sat Aug 30, 2003 1:52 pm

Code: Select all

typedef struct _MOUSECLICKS { 
   BYTE      leftclickconfirm; 
   BYTE      rightclickconfirm; 
   BYTE      rightclick; 
   BYTE      leftclick; 
} MOUSECLICKS, *PMOUSECLICKS;
If that struct is correct, wouldn't we be able to do something like this:

Code: Select all

	if (szArg1[0]!=0) { 
		if (!strnicmp(szArg1, "left", 4)) {
			while (EQADDR_CLICKS->leftclickconfirm!=0x80) EQADDR_CLICKS->leftclick=0x80;
			EQADDR_CLICKS->leftclick=0x00;
		} else if (!strnicmp(szArg1, "right", 5)) { 
            while (EQADDR_CLICKS->leftclickconfirm!=0x80) EQADDR_CLICKS->leftclick=0x80;
			EQADDR_CLICKS->leftclick=0x00;
		} else { 
			WriteChatBuffer("Usage: /click <left|right>",USERCOLOR_DEFAULT); 
			DebugSpew("Bad command: %s",szLine); 
			return; 
		} 
MQ2: Think of it as Evolution in action.

Mckorr
Developer
Developer
Posts: 2326
Joined: Fri Oct 18, 2002 1:16 pm
Location: Texas

Post by Mckorr » Sat Aug 30, 2003 3:22 pm

Code: Select all

// *************************************************************************** 
// Function: Click 
// Description: Our '/click' command 
// Clicks the mouse button (calls EQ's mouse up commands) 
// Usage: /click left|right [<mouseloc>] 
// *************************************************************************** 
VOID Click(PSPAWNINFO pChar, PCHAR szLine) { 
	CHAR szArg1[MAX_STRING] = {0}; 
	PCHAR szMouseLoc;
	PMOUSECLICKS mouseclick=EQADDR_CLICKS;


	GetArg(szArg1, szLine, 1); //left or right 
	szMouseLoc = GetNextArg(szLine, 1); //location to click
	

	//parse location for click location (szMouseLoc) here 
	if (szMouseLoc && szMouseLoc[0]!=0)
	{
		if (!ParseMouseLoc(GetCharInfo(), szMouseLoc))
		{
			DebugSpew("Invalid mouse loc to click, aborting: %s",szMouseLoc);
			return;
		}
	} 

	if (szArg1[0]!=0) { 
		if (!strnicmp(szArg1, "left", 4)) {
			while (mouseclick->leftclickconfirm=0x00) {
				mouseclick->leftclick=0x80;
			}
			mouseclick->leftclick=0x00;
		} else if (!strnicmp(szArg1, "right", 5)) { 
			while (mouseclick->leftclickconfirm=0x00) {
				mouseclick->leftclick=0x80;
			}
			mouseclick->leftclick=0x00;
		} else { 
			WriteChatBuffer("Usage: /click <left|right>",USERCOLOR_DEFAULT); 
			DebugSpew("Bad command: %s",szLine); 
			return; 
		} 
	}
}
Just showing you where I'm heading. This does not work. For a right click I get an exception error at the offset for DirectInput Mouse, 007670BC. Well, not exactly at that address, but enough references to that address are nearby that it looks like a conflict with DirectX. This is after I've removed the detours for mouse functions. Will reinstall the detours and see where it goes from there.
Last edited by Mckorr on Sat Aug 30, 2003 3:47 pm, edited 1 time in total.
MQ2: Think of it as Evolution in action.

Mckorr
Developer
Developer
Posts: 2326
Joined: Fri Oct 18, 2002 1:16 pm
Location: Texas

Post by Mckorr » Sat Aug 30, 2003 3:46 pm

k, with or without detours the above click code causes a crash which appears to be a conflict with DirectInput.

Tried both with and without mouse detours installed, and in both full screen and windowed mode :(

Wish I could figure out why the detoured version doesn't work. Think I'll put the nondetoured to the side for a bit, take another stab at the detoured.
MQ2: Think of it as Evolution in action.

Valerian
a grimling bloodguard
a grimling bloodguard
Posts: 709
Joined: Sun Jul 28, 2002 3:29 am

Post by Valerian » Sat Aug 30, 2003 4:00 pm

we've got it fudged together into a working /click, only problem is EQ can't have the mouse... must release mouse for /click to work.

Consilium
Contributing Member
Contributing Member
Posts: 100
Joined: Wed Oct 02, 2002 10:42 pm

woot

Post by Consilium » Sat Aug 30, 2003 5:28 pm

Seems like a strange work around but.>.. whatever works !! woot click back
-SH
+Student
digitalsavior.com