WOOHOO!! guess what I found...

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

Moderator: MacroQuest Developers

EqMule
Developer
Developer
Posts: 2697
Joined: Fri Jan 03, 2003 9:57 pm
Contact:

Post by EqMule » Wed May 21, 2003 7:44 pm

kaz wrote:there should be a way to programatically send clicks directly to those windows (or cells within them) without sending actual mouse clicks.
hehe you got it, that is the whole point of this and thats why im so excited to finally have found the offsets, now we can do tons of stuff without using click, we just "open" (and grab) whatever we need calling the window procedure directly... it will be superfast, dont even need to move the mouse to the window...

to open for example your inventory the code could look like this:

add to eqlib.cpp

Code: Select all


// *************************************************************************** 
// Function:    EQ Environment manipulation
// Description: Our '/Env' command 
//              Opens or Closes windows 
// Usage:       /Env Open WndInv
//                  will open the inventory 
// by EqMule 
// *************************************************************************** 
	VOID Env(PSPAWNINFO pChar, PCHAR szLine) { 
	CHAR szArg1[MAX_STRING] = {0}; 
	CHAR szArg2[MAX_STRING] = {0}; 
	PEQWINDOW Inventorywnd = *EQADDR_WNDINV; 
	GetArg(szArg1, szLine, 1); 
	GetArg(szArg2, szLine, 2); 
	if ((szArg1[0]!=0) && (szArg2[0]!=0)) 
	{
		if (!_stricmp(szArg1,"open")) 
		{
			Inventorywnd->Open = 01; 
			DebugSpew("Opened %s", szArg2);
			return;
		}else
		{
			Inventorywnd->Open = 00;
			DebugSpew("Closed %s", szArg2);
			return;
		}
	}
	else
	{ 
		WriteChatBuffer("Usage: /env <open>|<close>",USERCOLOR_DEFAULT); 
		DebugSpew("Help invoked or Bad Env command: %s",szLine); 
		return; 
	} 
}

and

Code: Select all

	GetPrivateProfileString("Memory Locations","InventoryWnd","0",szBuffer,MAX_STRING,ClientINI);		EQADDR_WNDINV = (PEQWINDOW*)strtoul(szBuffer,NULL,16);
and

Code: Select all

		{"/env",		"Env"},
and add toMQ.h

Code: Select all

extern "C" EQLIB_API VOID  Env			  (PSPAWNINFO, PCHAR);
and the Structure off course...
as well as

Code: Select all

InventoryWnd=005e0940
in eqgame.ini


I could use some help on expanding this function suggestions are welcome... note though that its just an example, basically i want it to inspire others to develop new things for the windows we can access in this fashion...
Last edited by EqMule on Wed May 21, 2003 9:35 pm, edited 4 times in total.
My status o/
If you like MQ2 and would like to contribute, please do. My goal is 25 donations per month.
So far I've received Image donations for this month's patches.

Bitcoin: 1Aq8ackjQ4f7AUvbUL7BE6oPfT8PmNP4Zq
Krono: PM me.
I can always use characters for testing, PM me if you can donate one.

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

Post by Mckorr » Wed May 21, 2003 7:56 pm

You're gonna give ap50 a heart attack when he sees all the new offsets he's gotta keep updated...

Amadeus
The Maestro
The Maestro
Posts: 2036
Joined: Sat Jun 29, 2002 3:51 pm

Post by Amadeus » Wed May 21, 2003 8:04 pm

Ok...I added the offset comments and also discovered interesting pointers at 0x004 and 0x060 ...I'll post some examples of my thoughts on what they might be at the end of this posting.

Also, 0x010, 0x020, 0x024, 0x028, and 0x02c are all flags. Here were some values and their flag listing for one of my windows. (I could be wrong, but it would be an awefully wild coincidence.) I also noticed that many similar windows had similar flags (go figure).

Code: Select all

0x010 = 16777727  (flags: 1 2 4 8 16 32 64 128 256 16777216)
0x020 = 662773176 (flags: 8 16 32 128 256 1024 2048 4096 65536 8388608 16777216 33554432 67108864 536870912)
0x034 = 93597784 (flags: 8 16 64 4096 8192 262144 1048576 8388608 16777216 67108864)
0x038 = 257 (flags: 1 256)
0x03c = 2228253 (flags: 1 4 8 16 131072 2097152)
Finally, I will be updating exts2.cpp to display this struct as well ;)

Anyway...here's what I have so far...

Code: Select all

// 5-15-2003	eqmule/Jaerin
typedef struct _EQWINDOW { 
/*0x000*/	BYTE	 Unknown0x000[4]; 
/*0x004*/	DWORD	*UnknownStruct0x004;
/*0x008*/	DWORD	Unknown0x008; // 2000 seems a common value
/*0x00c*/	DWORD	Unknown0x00c; //500 seems a common value
/*0x010*/	DWORD	Flags1; 
/*0x014*/	BYTE	 Unknown0x014[12];
/*0x020*/	DWORD	Flags2;
/*0x024*/	DWORD	Flags3;
/*0x028*/	DWORD	Flags4;
/*0x02c*/	DWORD	Flags5;
/*0x030*/	DWORD	X; 
/*0x034*/	DWORD	Y; 
/*0x038*/	DWORD	Height; 
/*0x03c*/	DWORD	Width; 
/*0x040*/	BYTE	 Unknown0x040[16]; 
/*0x050*/	BYTE	 Open; //1 open 0 closed 
/*0x051*/	BYTE	 Unknown0x051;
/*0x052*/	BYTE	 Unknown0x052[14];
/*0x060*/	DWORD	*UnknownStruct0x060;
}EQWINDOW, *PEQWINDOW; 
===========================================
Here are some examples of what I found at 0x004 (snippits only..these are really big structs...I think they deal with the graphics of the window (guessing)...check it out and you'll see what I mean.)

Code: Select all

0525123a 00 00 0c 28 a4 02 5c 28 a4 02 4c 29 a4 02 3c 2a  ...(..\(..L)..<*
0525124a a4 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
0525125a 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
0525126a 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
0525127a 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
0525128a 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
0525129a 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
052512aa 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
052512ba 00 00 d4 14 59 00 00 00 00 00 05 00 00 00 15 00  ....Y...........
052512ca 13 00 05 01 08 00 02 00 00 00 80 00 00 00 11 00  ................
052512da 00 00 00 00 00 00 00 f4 5c 00 41 63 74 69 6f 6e  ........\.Action
052512ea 73 5f 54 69 6d 65 72 2e 74 67 61 00 00 00 00 00  s_Timer.tga.....
052512fa 00 00 00 00 00 00 00 00 00 00 d4 14 59 00 00 00  ............Y...
0525130a 00 00 03 00 00 00 00 00 00 00 ff ff ff ff 00 00  ................
0525131a 00 00 00 00 00 00 00 00 00 00 00 00 00 00 d4 14  ................
0525132a 59 00 00 00 00 00 02 00 00 00 00 00 00 00 ff ff  Y...............
0525133a ff ff 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
0525134a 00 00 e8 03 00 00 20 00 00 00 1f 00 00 00 05 00  ...... .........
0525135a 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00  ................
0525136a 00 00 20 00 00 00 15 00 15 00 05 01 08 00 01 00  .. .............
0525137a 00 00 80 00 00 00 01 00 00 00 00 00 00 00 00 f4  ................
0525138a 5c 00 58 00 63 61 74 69 6f 6e 00 69 6d 65 72 2e  \.X.cation.imer.
0525139a 74 67 61 00 00 00 01 00 00 00 d4 14 59 00 00 00  tga.........Y...
===========================================
Here are some examples of what I found at 0x060 (snippits only..these are really big structs...I think they deal with the physical attributes/settings of the windows...check it out and you'll see what I mean.)

Code: Select all

// Inventory window + 0x060 //
02f25a10 04 00 00 00 80 00 00 00 09 00 00 00 00 00 00 00  ................
02f25a20 00 f4 5c 00 49 6e 76 65 6e 74 6f 72 79 00 00 00  ..\.Inventory...
02f25a30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................

Code: Select all

//Bazaar Search Window + 0x060 //
064f2ad8 04 00 00 00 80 00 00 00 14 00 00 00 00 00 00 00  ................
064f2ae8 00 f4 5c 00 42 61 7a 61 61 72 20 53 65 61 72 63  ..\.Bazaar Searc
064f2af8 68 20 57 69 6e 64 6f 77 00 00 00 00 00 00 00 00  h Window........
064f2b08 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
064f2b18 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
064f2b28 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
064f2b38 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
064f2b48 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
064f2b58 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
064f2b68 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
064f2b78 15 00 15 00 06 01 08 00 01 00 00 00 80 00 00 00  ................
064f2b88 05 00 00 00 00 00 00 00 00 f4 5c 00 66 61 6c 73  ..........\.fals
064f2b98 65 00 54 72 61 6e 73 70 61 72 65 6e 74 00 6f 77  e.Transparent.ow
064f2ba8 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
064f2bb8 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
064f2bc8 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
064f2bd8 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
064f2be8 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
064f2bf8 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
064f2c08 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
064f2c18 00 00 00 00 00 00 00 00 15 00 15 00 06 01 08 00  ................
064f2c28 01 00 00 00 80 00 00 00 11 00 00 00 00 00 00 00  ................
064f2c38 00 f4 5c 00 53 74 79 6c 65 5f 54 72 61 6e 73 70  ..\.Style_Transp
064f2c48 61 72 65 6e 74 00 00 00 00 00 00 00 00 00 00 00  arent...........

Jaerin
Developer
Developer
Posts: 133
Joined: Mon Mar 10, 2003 7:37 pm
Contact:

Post by Jaerin » Wed May 21, 2003 8:54 pm

Mckorr wrote:You're gonna give ap50 a heart attack when he sees all the new offsets he's gotta keep updated...
Hey thanks Mckorr...

I'm so glad that all my work around here is appreciated. Considering I'm the one who's posted the offsets for what? The last 4-5 patches at least.

You'll have to excuse me I'm snippy today. My wife had her car broken into today and her purse was stolen.

Jaerin

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

Post by Mckorr » Wed May 21, 2003 9:27 pm

Sorry Jaerin, wasn't trying to be insulting or anything. You're right, you have been on top of offsets for the last half dozen patches or so... so I guess you get the heart attack instead.
MQ2: Think of it as Evolution in action.

fwiggles
a hill giant
a hill giant
Posts: 161
Joined: Mon Jun 17, 2002 8:29 pm

Post by fwiggles » Wed May 21, 2003 10:38 pm

no no no no...i wanna have a heart attack!
[color=red]Latest survey shows that 3 out of 4 people make up 75% of the world's population.[/color]

User avatar
ap50
a snow griffon
a snow griffon
Posts: 425
Joined: Sun Aug 18, 2002 2:29 pm

Post by ap50 » Thu May 22, 2003 3:59 am

You're gonna give ap50 a heart attack when he sees all the new offsets he's gotta keep updated...
As Jaerin says, he's been beating me to the post with the last few patches, doesn't mean I don't TRY to get them first :)

WTG folks, great work.
[color=yellow][size=92][b]Just because you're paranoid, it doesn't mean everyone isn't out to get you![/b][/size][/color]

Jay
a lesser mummy
a lesser mummy
Posts: 59
Joined: Tue Jan 28, 2003 11:37 am

Post by Jay » Thu May 22, 2003 5:42 am

I am about to release the 4-30-03 offsets, You people are just faster then me =( Damn you guys to hell!

=)

Jay

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

Post by Mckorr » Thu May 22, 2003 10:50 am

I'm not doing offsets, got a new toy to work on 8)
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 » Wed Jun 04, 2003 12:38 pm

Any progress on this? Last post is a couple weeks old.

$invpanel is broken (cls offset), and this might be the solution to that problem. Can you please give me an update on what you've found, what works, and what doesn't? Oh, and I don't speak Assembly....

Thanks
MQ2: Think of it as Evolution in action.

kagonis
a hill giant
a hill giant
Posts: 228
Joined: Sat May 24, 2003 8:48 pm

Post by kagonis » Wed Jul 02, 2003 11:34 pm

/bump
I know a while back eqclient crashed when trying to do a simple /echo $invpanel
Not it just seems completely non-functional, all /echo $invpanel does now is echoing it out, it even keeps the $, not making that a @
Ie:
[MacroQuest] $invpanel

I could just do a /cleanup to make sure my inventory is open, but that kinda makes the rest of the maro a lot harder, since then it drops my current target etc.

Just curious as how this is progressing. All your work is greatly appreciated :)

EqMule
Developer
Developer
Posts: 2697
Joined: Fri Jan 03, 2003 9:57 pm
Contact:

Post by EqMule » Thu Jul 03, 2003 5:51 am

im going to resume work on this thing now that im back from vacation, but the mapfile keeps me busu now and currently im working on the AutoMemSpell function, the isenvironment open function is easy to fix, Ill get to it soon.
My status o/
If you like MQ2 and would like to contribute, please do. My goal is 25 donations per month.
So far I've received Image donations for this month's patches.

Bitcoin: 1Aq8ackjQ4f7AUvbUL7BE6oPfT8PmNP4Zq
Krono: PM me.
I can always use characters for testing, PM me if you can donate one.

AMadMonk
a lesser mummy
a lesser mummy
Posts: 77
Joined: Tue Sep 24, 2002 9:16 pm

Post by AMadMonk » Wed Jul 09, 2003 2:44 am

This is frustrating. I decoded all of this like six months ago.

Note that you don't need multiple offsets. The UI elements are kept in a TREE structure. The root of the tree is something like "the whole screen" which might have as a "child" for instance, the "spell gem window" which would have as children the individual gems.

Each of these ui elements has separate invocation methods for various things like mouse movement, left click, right click, drag, etc. Each of the invocation methods takes certain parameters (been a while, I believe it's class objects).

Point is, you don't have to know the offsets for all your elements, just the "root" of the tree. After that, you work your way down the tree (it's aranged with parent/child/sibling links) to known positions (spell gem 3 is always the 3rd sibling of the first child of the spell gem window, for instance).

And yes, many of these, once you have the correct offsets (there is an offset in the window structure that tells you the location of the function to call for various invocation methods -- ie, there's a fixed offset within the ui element for "left click" and so on), you don't have to have "open" to use. That's how, for instance, I could right click inventory items (for clicky proc items) without having to have the inventory screen even open.

Anyway, rambling. Just remember: invocation methods (ie function addresses) are fixed offsets in the ui element structure (which is friggin huge btw), and the whole ui is organized like a tree (which makes sense considering the XML schema that it's rendered from).

Have fun working on newui click. *chuckle*

User avatar
BlueSkies
a ghoul
a ghoul
Posts: 132
Joined: Tue Oct 01, 2002 6:22 pm

Post by BlueSkies » Wed Jul 09, 2003 5:14 am

Erm, thanks, amm, but we knew this already. We're taking the easy road until we can get the code for that together -- and for now, that means offsets for each window class.

If you had all this figured out 6 months ago, why didn't you save everyone a lot of time and post some code?

*shrugs*

[edit] realized this had kinda rude connotations to it -- don't mean to be that way -- just curious as to why you didn't release the code that would have saved us a whole lot of time :P
Live your dreams! Blue Skies everyone

Doodman
a ghoul
a ghoul
Posts: 124
Joined: Thu Jan 02, 2003 12:07 pm

Post by Doodman » Wed Jul 09, 2003 12:07 pm

Point is, you don't have to know the offsets for all your elements, just the "root" of the tree. After that, you work your way down the tree (it's aranged with parent/child/sibling links) to known positions (spell gem 3 is always the 3rd sibling of the first child of the spell gem window, for instance).
What about custom UI's? I'm guessing the order of the items are based on the order of the <Pieces> in the XML file for the window. If so, assuming the the ordering of things will not produce the expected results.

I use a highly modified UI and things are not where they normally are.

I may be off base, but I'd rather raise this now instead of later.