bustiiing / blazingstars

Automatically exported from code.google.com/p/blazingstars
0 stars 0 forks source link

Any pot size command would just set to zero my bet amounts. #14

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Set any of the pot bets shortcuts (I used numbers from 1 to 4)
2. Try it on any pot

What is the expected output? What do you see instead?

I'd expect the pot amount to be the (rounded) percentage (say 50%) of the 
pot, but I get that any of the pot bets commands delete the amount in the 
bet amounts.

What version of the product are you using? On what operating system?
latest svn version (0.9.7b) on 10.6

Please provide any additional information below.

I tried it with all supported themes, with no luck. I'm exploring the source 
code now, to try to understand what is the amount of the pot read by the 
OCR code.

Ps: Great software! I was waiting for this one!

Original issue reported on code.google.com by luca.hel...@gmail.com on 25 Dec 2009 at 8:48

GoogleCodeExporter commented 8 years ago
Hi, Luca, thanks for the report.

A couple of things to check:

1).  Try making the window you're playing in larger.  Pot sized betting often 
fails
at small window sizes;  this is a known issue (see issue 1).
2).  Check the console when you try it.  There's a fair amount of NSLogging 
going on
there, and you should see if BlazingStars is correctly getting the BetSize.

Original comment by steven.h...@gmail.com on 25 Dec 2009 at 8:58

GoogleCodeExporter commented 8 years ago
Hi Steven,

wow, that was a quick reply!

All my tables have the standard size. In the console it appears as the bet 
sizes are all 
correct, including the size of the bet that is supposed to go in the betting 
amount, 
i.e., I see 

25/12/09 22.24.53   BlazingStars[96315] Attempting to set value: 60.00

which is what I'd expect for the key I pressed, after which i see

25/12/09 22.24.53   BlazingStars[96315] String is now: 60
25/12/09 22.24.53   BlazingStars[96315] Num of events in queue: 1
25/12/09 22.24.53   BlazingStars[96315] Flushing queue!
25/12/09 22.24.53   BlazingStars[96315] Character: 6
25/12/09 22.24.53   BlazingStars[96315] Character: 0
25/12/09 22.24.53   BlazingStars[96315] Number of events in mainQueue: 0  
Number of events in currentQueue: 0
25/12/09 22.24.53   BlazingStars[96315] Flushing the queue!
25/12/09 22.24.53   BlazingStars[96315] Error status for main queue: 0.  Error 
status for current queue: 0.

And something happens in the bet amount (I see something gets written, but soon 
after that, it gets also deleted).

Any idea?

Luca.

Original comment by luca.hel...@gmail.com on 25 Dec 2009 at 9:45

GoogleCodeExporter commented 8 years ago
Hmm.  Thanks for the info, Luca. I don't immediately know what might be causing 
that. Let me see if I 
can replicate it, and maybe something will occur to me. I'll get back to you as 
soon as I can.  (What you 
have told me suggests that it's not the OCR that's failing, but the interaction 
with the client. You don't 
have any programs that interact with the keyboard running, like some sort of 
text expanded or something, 
do you?)

Cheers,
Steven 

Original comment by steven.h...@gmail.com on 25 Dec 2009 at 10:35

GoogleCodeExporter commented 8 years ago
I went on in experimenting today. I ran a debug version of blazing stars under 
gdb, 
and put a breakpoint on line 540 of HKDispatchController. I wanted to see the 
numbers being entered in the bet amount. Well... that didn't work as expected. 
No 
characters are written in there. 
I have quick silver, that catches a couple of CMD-KEY to move my poker tables 
around, but besides that nothing else interacts with the keyboard, beside my 
fingers.... 

The bug is there also when QuickSilver is switched off. It seems like the lines

    UniChar buffer;
    keyEventDown = CGEventCreateKeyboardEvent(NULL, 1, true);
    keyEventUp = CGEventCreateKeyboardEvent(NULL, 1, false);
    CGEventSetFlags(keyEventDown,0);        
    CGEventSetFlags(keyEventUp,0);      
    for (int i = 0; i < [valueToSet length]; i++) {
        [valueToSet getCharacters:&buffer range:NSMakeRange(i, 1)];
        NSLog(@"Character: %c",buffer);
        CGEventKeyboardSetUnicodeString(keyEventDown, 1, &buffer);
        CGEventPost(kCGSessionEventTap, keyEventDown);
        CGEventKeyboardSetUnicodeString(keyEventUp, 1, &buffer);
        CGEventPost(kCGSessionEventTap, keyEventUp);
    }

just don't write anything in there. I see the amount that was in there being 
cleared, 
but nothing gets written (which, I suppose, should be achieved with the lines 
above). 

If you have any suggestion on what else to pin down, I'd be more than willing 
to help.

Luca.

Original comment by luca.hel...@gmail.com on 26 Dec 2009 at 5:38

GoogleCodeExporter commented 8 years ago
Luca,

Thanks for your help tracking this down. If I can impose on you just a little 
more, I'll write a program to 
test the core logic of putting the bet amount into the box, verify that it 
works on my machine, and then 
attach it to this issue, probably tomorrow (tonight if I have spare time). If 
you could test it, that would be 
great...

Original comment by steven.h...@gmail.com on 26 Dec 2009 at 6:56

GoogleCodeExporter commented 8 years ago
Could it be a localization issue? Luca is in Italy (not Tunisia...:-) ). In 
Italy
there 60.00 is written 60,00. Perhaps PokerStars is expecting the bet to be 
written
in Italian format? 

This would explain why the bet size gets entered but then immediately 
disappears.

Original comment by steve.mc...@gmail.com on 26 Dec 2009 at 10:01

GoogleCodeExporter commented 8 years ago
LoL...

I thought about that Steve, but the code is such that the amount entered is 
always an 
integer (i.e., the last 3 characters of the float, which is formatted as %.2f, 
are stripped 
away).  This should rule out me being in Italy as a possible problem (even if 
now I'd 
rather be in Tunisia... the weather is so much nicer there... ;-) ...).

I've seen this threads on mac dev that seems related to my issue... maybe you 
can 
understand better than me what they are talking about (it didn't make too much 
sense to me):

http://lists.apple.com/archives/Quartz-dev/2006/Apr/msg00048.html

Steven, I usually play from 12 to 28 tables at the same time, and being able to 
check 
or fold without my mouse was already a wonderful christmas gift... so feel free 
to to 
impose anything you see fit. 

Besides, I'm always happy to learn more programming stuff... 

;)

Luca.

Ps: I'd be more than happy to contribute to the project. If you want I can take 
over 
the measurements of a couple of themes... 

Original comment by luca.hel...@gmail.com on 26 Dec 2009 at 11:33

GoogleCodeExporter commented 8 years ago
Steve, I know that PSB is a little buggy,  but can you replicate what's going 
on with Luca?  I can't 
replicate it here, so I'm reduced to writing a test program.

Luca,  I'll see what I can do tomorrow when I get home, and get back to you 
soon. As to contributing,  
that would be great. When I have a spare moment, I'll make a wiki page to 
instruct how to measure the 
themes. 

Original comment by steven.h...@gmail.com on 27 Dec 2009 at 12:29

GoogleCodeExporter commented 8 years ago
I can't replicate.

Luca, can you post a screenshot showing how you've configured the keys for "Pot 
Bets"?

Original comment by steve.mc...@gmail.com on 27 Dec 2009 at 2:41

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
This fixed my problem. But I don't know why. ;-)

Index: HKDispatchController.m
====================================================
===============
--- HKDispatchController.m  (revision 17)
+++ HKDispatchController.m  (working copy)
@@ -544,9 +544,9 @@
        [valueToSet getCharacters:&buffer range:NSMakeRange(i, 1)];
        NSLog(@"Character: %c",buffer);
        CGEventKeyboardSetUnicodeString(keyEventDown, 1, &buffer);
-       CGEventPost(kCGSessionEventTap, keyEventDown);
+       CGEventPost(kCGAnnotatedSessionEventTap, keyEventDown);
        CGEventKeyboardSetUnicodeString(keyEventUp, 1, &buffer);
-       CGEventPost(kCGSessionEventTap, keyEventUp);
+       CGEventPost(kCGAnnotatedSessionEventTap, keyEventUp);
    }
 }

Original comment by luca.hel...@gmail.com on 30 Dec 2009 at 5:45

GoogleCodeExporter commented 8 years ago
Hmm.  Session and Annotated session have given me fits since I started on this. 
 I
seem to recall testing AnnotatedSession before, but I'll test this and see what 
I can
come up with.  Thanks for the assistance, Luca!

Original comment by steven.h...@gmail.com on 30 Dec 2009 at 7:20

GoogleCodeExporter commented 8 years ago
Okay, I've committed a change with kCGAnnotatedSessionEventTap throughout 
setBetSize;
 it's working all right on my machine, but it should be tested.  Give it a shot,
Luca! :-)

Original comment by steven.h...@gmail.com on 30 Dec 2009 at 7:47

GoogleCodeExporter commented 8 years ago
It works like a charm on my machine now... even though I have no idea what the 
meaning of "Annotated" session is. I tried skimming through the documentation, 
but 
MacDev center is pretty obscure in this respect (or maybe I just need some more 
Objective C experience... my C++ background here doesn't help...).

Thanks for your patience, steven. I'll do some heavy duty testing tonight. 
Yesterday I 
made my first session with 24 open tables (after trying the above change). 
Blazing 
stars froze 4 times in 2 hours of grinding. I have a couple of scripts that 
move 
window around  and they interact with the keyboard. I fear that this could be 
the 
issue... 

I "solved" it by creating a new script that kills BlazingStars and restarts it 
with another  
keystroke combination... If I can, I'll try to send you the logs when it 
happens again.

:)

L.

Original comment by luca.hel...@gmail.com on 30 Dec 2009 at 8:03

GoogleCodeExporter commented 8 years ago
I'm closing this issue for now, since no new problems have been reported.

Original comment by steven.h...@gmail.com on 5 Jan 2010 at 10:32