Two Plus Two Publishing LLC Two Plus Two Publishing LLC
 

Go Back   Two Plus Two Poker Forums > Internet Poker > Software

Notices

Software Discussions about gambling-related and poker software.

Reply
 
Thread Tools Display Modes
Old 04-18-2012, 07:21 AM   #1
mme
old hand
 
mme's Avatar
 
Join Date: May 2009
Location: true anti-HUD ahabs
Posts: 1,413
(programming challenge) how does PokerTracker (et al) get data for their zoom HUDs?

i had a conversation with stars support/security recently on the subject. HUDs are allowed, but there s no obvious way to get the required data for them. so i wondered how PokerTracker (and others) are doing this. all i have is the somewhat cryptic sttement from stars that while they can not disclose what PT does they don't mind them doing so. and that intercepting messages (on the windows client) is not considered a breach their ToS. chances are i am overlooking something obvious, but poking around in the client i could not get much of the required information:

- from the log file one could potentially take number of players being dealt in a hand and their seat numbers
- from tables child window with class name "PokerStarsNoteSelectorClass" one can get the list of players seated (in cash-game this list may contain players from other tables and players who already left)
- hand histories are useless for the task because they get send from server to client no sooner than when a hand is completed. for zoom poker this means that the user may be seated many hands away when this happens.

the missing piece of information is a mapping from player names to seat numbers. so here comes the challenge: how to obtain data regarding this from the client ? as a note: any form of OCR is ruled out for, as i hope obvious reasons. and yes, all code here should be open source.


to make a start, here is what i found out about the "PokerStarsNoteSelectorClass" child window:
it behaves like a standard ComboBox, that is you can send CB_* messages to it as defined in comctrl.h.

- (CB_GETCOUNT, wParam 0, lParam 0) will get you the number of items in the notes box
- (CB_GETLBTEXTLEN, wParam indexItem, lParam 0) will get you the text length of the specified item
- (CB_GETLBTEXT, wParam indexItem, lParam buffer) will get you the actual item text, crossing application boundaries (love or hate windows for that)


whenever i find out something more i will update this thread. hopefully other interested coders will join the challenge to make it a real fun project. feel free to comment or ask questions. i will try my best to answer them.

Last edited by mme; 04-18-2012 at 07:28 AM. Reason: wording
mme is offline   Reply With Quote
Old 04-18-2012, 08:26 AM   #2
grinder
 
Clar17y's Avatar
 
Join Date: Feb 2007
Location: Breakeven
Posts: 685
Re: (programming challenge) how does PokerTracker (et al) get data for their zoom HUDs?

I always assumed that the hand history file was updated as the hand was being played?
*edit* - Read somewhere that programs are using the chat box

Last edited by Clar17y; 04-18-2012 at 08:50 AM.
Clar17y is offline   Reply With Quote
Old 04-18-2012, 11:53 AM   #3
mme
old hand
 
mme's Avatar
 
Join Date: May 2009
Location: true anti-HUD ahabs
Posts: 1,413
Re: (programming challenge) how does PokerTracker (et al) get data for their zoom HUDs?

Quote:
Originally Posted by Clar17y View Post
I always assumed that the hand history file was updated as the hand was being played?
no. the hand gets written to disk when the hand is finished. i would even assume that the text is sent from the server to the client so that nothing is in memory that could be read before it the hand is actually over. note that this is an assumption so far, i could be wrong.

Quote:
Originally Posted by Clar17y View Post
*edit* - Read somewhere that programs are using the chat box
this was possible up to some point when stars closed this hole and stopped using a standard editbox. they started drawing the text by hand using the ExTextOut() api. this got attacked as well by clever coders (using api hooking or so called detouring). so to my knowledge there is currently no reliable way to read the text in the chatbox programmatically.
mme is offline   Reply With Quote
Old 04-18-2012, 11:59 AM   #4
mme
old hand
 
mme's Avatar
 
Join Date: May 2009
Location: true anti-HUD ahabs
Posts: 1,413
Re: (programming challenge) how does PokerTracker (et al) get data for their zoom HUDs?

when i am at it, some more notes on "PokerStarsNoteSelectorClass". i forgot to mention that the list of players is ordered A-Z. so there is no information to be taken regarding where a player is seated. for a small chance i threw a CB_GETITEMDATA message at the box to see if stars has any data associated with individual items via CB_SETITEMDATA. nope ..that would have been too easy.
mme is offline   Reply With Quote
Old 04-18-2012, 01:02 PM   #5
journeyman
 
Join Date: Jul 2008
Posts: 213
Re: (programming challenge) how does PokerTracker (et al) get data for their zoom HUDs?

On OS X:

The data comes mostly from the hand history files.

Additional data from PokerStars preferences allows one to determine a player's "preferred seat". Once this is know, the locations of the other players can be determined from the most recent hand history file.

Even more additional data comes from the window title.

For Zoom Poker, this is clearly insufficient. We use screen scraping to determine who is it at which table. It is not a perfect solution.
stevemcleod is offline   Reply With Quote
Old 04-18-2012, 01:28 PM   #6
mme
old hand
 
mme's Avatar
 
Join Date: May 2009
Location: true anti-HUD ahabs
Posts: 1,413
Re: (programming challenge) how does PokerTracker (et al) get data for their zoom HUDs?

Quote:
Originally Posted by stevemcleod View Post
[...] We use screen scraping to determine who is it at which table. It is not a perfect solution.
welcome copilot,

yes, OSX is a completely different beast when compared to windows. PT does not have a HUD for zoom there because it is impossible on the unix breed of OSes to get the required data by other means than screen scaping or OCR'ing. just out of curiosity (and if you feel like answering): how do you grab players off the table? i'm in contact with the guys from fpdb and they have plans to generate a hash from player name images and use these hashes as keys to their database. does this sound like a good idea to you?
mme is offline   Reply With Quote
Old 04-18-2012, 01:42 PM   #7
mme
old hand
 
mme's Avatar
 
Join Date: May 2009
Location: true anti-HUD ahabs
Posts: 1,413
Re: (programming challenge) how does PokerTracker (et al) get data for their zoom HUDs?

and then another question: PT (and other) programms seem to have found ways to get the data by other means then scraping that work more reliable. i for one feel it is pretty hard to justify putting mac users to a disadvantage. do you have a comment on this?
mme is offline   Reply With Quote
Old 04-18-2012, 02:25 PM   #8
mme
old hand
 
mme's Avatar
 
Join Date: May 2009
Location: true anti-HUD ahabs
Posts: 1,413
Re: (programming challenge) how does PokerTracker (et al) get data for their zoom HUDs?

to continue, here is the listing required to read out player names from noteboxes on all tables (in pseudo code):

Code:
//find all tables
foreach hwnd in (WINAPI)EnumWindows(0):
    if (WINAPI)GetClassName(hwnd) == "PokerStarsTableFrameClass":
        //find notebox       
        foreach hwndChild in (WINAPI)EnumChildWindows(hwnd):
            if (WINAPI)GetClassName(hwnd) == "PokerStarsNoteSelectorClass":
                //retrieve player names
                nItems = (WINAPI)SendMessageTimeout(hwndChild, CB_GETCOUNT, 0, 0)
                foreach index in nItems:
                    nChars = (WINAPI)SendMessageTimeout(hwndChild, CB_GETLBTEXTLEN, index, 0)
                    returnBuffer = CreateBuffer(nChars+1)
                    (WINAPI)SendMessageTimeout(hwndChild, CB_GETLBTEXT, index, returnBuffer)
                    //do whatevs now with player name as present in returnBuffer

Last edited by mme; 04-18-2012 at 02:28 PM. Reason: wording
mme is offline   Reply With Quote
Old 04-18-2012, 06:43 PM   #9
veteran
 
SretiCentV's Avatar
 
Join Date: Oct 2006
Location: In the rear with the gear
Posts: 3,232
Re: (programming challenge) how does PokerTracker (et al) get data for their zoom HUDs?

Thanks for posting what you have mme. There are so few people who know this kind of stuff and few if any share their secrets
SretiCentV is offline   Reply With Quote
Old 04-18-2012, 08:18 PM   #10
_Pooh_Bah_
 
Join Date: Feb 2005
Location: UK
Posts: 9,773
Re: (programming challenge) how does PokerTracker (et al) get data for their zoom HUDs?

beat: was hoping SretiCentV was going to spill the beans how hem does it

I'm pretty sure the hand history text is indeed built up in Stars program memory as the hand progresses. I'd love to figure out how to read it, in a convenient open manner.

Many years ago I studied Juk's FPHG 1.0, and re-made it for Stars, not for any actual use but for an experiment - and the client does indeed produce HH files in memory for observed tables. My efforts were poor though and it just produced some of the hands, certainly not all. It also produced "half-hands" but I had no idea if the4y were "in progress" (I couldn't match them up with on screen events) or just more likely bad search techniques! I don't know what I'm doing examining a memory dump, so I didn't - just binary searching it for strings in ahk is the opposite of ideal I'm sure! But we know PT3 does a "memory grabber" for observed hands on normal tables, if you know what you're doing it's prob not too hard to extend that to find the current seated players in the memory. We can guess it's almost certainly "searching" due to updates causing PT4 beta to miss players now and again. We also know this can't work on OSX since it doesn't allow processes to examine the memory of other processes so readily as Windows.

very interesting topic!
_dave_ is online now   Reply With Quote
Old 04-18-2012, 09:10 PM   #11
Carpal \'Tunnel
 
jukofyork's Avatar
 
Join Date: Sep 2004
Location: York, UK.
Posts: 10,841
Re: (programming challenge) how does PokerTracker (et al) get data for their zoom HUDs?

Quote:
Originally Posted by _dave_ View Post
very interesting topic!
Yeah for sure!

Finding the names of seated players without a HH seems even harder (ie: before any hand have been generated - which applies SNGs and "rush" type cash).

I've tried all sorts on Party; from opening up the notes windows (too slow/crap) to using the lobby list (too slow to update) to hooking TextOut() type calls (too hard to figure out which table they were sent to).

After reading mme's post though it gives me hope that there is some way of doing this on Party (the ability to have coloured notes on classic tables would be awesome!).

Juk

Last edited by jukofyork; 04-19-2012 at 01:40 PM. Reason: Spelling mistakes doh.
jukofyork is offline   Reply With Quote
Old 04-18-2012, 09:35 PM   #12
veteran
 
SretiCentV's Avatar
 
Join Date: Oct 2006
Location: In the rear with the gear
Posts: 3,232
Re: (programming challenge) how does PokerTracker (et al) get data for their zoom HUDs?

Quote:
Originally Posted by _dave_ View Post
beat: was hoping SretiCentV was going to spill the beans how hem does it
not if you knew what my contract looks like!
SretiCentV is offline   Reply With Quote
Old 04-19-2012, 04:08 AM   #13
mme
old hand
 
mme's Avatar
 
Join Date: May 2009
Location: true anti-HUD ahabs
Posts: 1,413
Re: (programming challenge) how does PokerTracker (et al) get data for their zoom HUDs?

nice comments ty, back to the challenge.

being able to read player names i went through the client to see if there is any functionality in the client that relies on seats.

first candidate i found is "prefered seat". maybe changing prefered seat triggers some messages one could intercept? nope. i remember some point where seat order changed at runtime when adjusting this setting but this no longer works. seat order remains the same, the setting takes effect next time you start the client. well played stars. again, this would have been too easy.

so back to the tables. double clicking a seat selects a player in the notes box. the same can be triggered via seat context menu selecting "Note". deducing what player is seated on what seat should not be too hard. programmatically double click a seat (via the windows SendInput api), check what player name is selected in the notes box by sending CB_GETCURSEL to the box and query the box for the player name given the index it returns. if CB_GETCURSEL returns CB_ERR you found heros seat because heros name is not in the box. this works for zoom tables and zoom tables only (assuming there is never a zoom table with fewer than N-max players) because for zoom the notes box never contains player names from other tables (at least according to my checks). but this method has some serious downsides:

- you have to know where seats are located in the first place
- you actually have to move the mouse to the position you want to click (stars client has a check for this in place and ignores mouse cklicks when the mouse pointer is not at the click position)
- it may or may not work when windows overlapp and may only work for the current foreground window

i haven't checked in detail because this method is far from ideal for another reason: having to move the mouse around programmatically is enough to rule it out for any serious project. you usually end up accidently flipping windows around and cause all kinds of other unintended damage to your users. user presses mouse button on something, your programm starts moving the mouse around ..boom! here we go ..you may have to answer a call from a pissed off user. lesson learned: never move the mouse around programmatically unless you have a very good reason for doing so and the user is informed in detail about what you are doing.
mme is offline   Reply With Quote
Old 04-19-2012, 08:21 AM   #14
grinder
 
msim's Avatar
 
Join Date: Apr 2011
Location: Compiler, Croatia
Posts: 535
Re: (programming challenge) how does PokerTracker (et al) get data for their zoom HUDs?

Its ironic that all of that stuff is allowed but probably the best in that field are kids who love to piss Blizzard off.

Think i v told you everything with this.
msim is offline   Reply With Quote
Old 04-20-2012, 03:53 AM   #15
mme
old hand
 
mme's Avatar
 
Join Date: May 2009
Location: true anti-HUD ahabs
Posts: 1,413
Re: (programming challenge) how does PokerTracker (et al) get data for their zoom HUDs?

Quote:
Originally Posted by msim View Post
Its ironic that all of that stuff is allowed but probably the best in that field are kids who love to piss Blizzard off.

Think i v told you everything with this.
it's ironic that this and more is possible. but even more ironic is that legitimate services are put to a disadvantage vs illegitimate services by stars in a systematic way. just thinking that ripping data off the client for data mining on windows is possible while HUDs on mac have to go the OCR path is enough to make me puke.
mme is offline   Reply With Quote

Reply
      

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



All times are GMT -4. The time now is 05:23 PM.


Powered by vBulletin®
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.6.0 ©2011, Crawlability, Inc.
Copyright 2008-2010, Two Plus Two Interactive