Anyone running on a windows treo?
I'm wondering if anyone using pocketfrog or PHal is using one of the new treo devices running window mobile. I've gotten reports that there is something strange going on with either the screen drawing or stylus mapping.
They report having to click below my buttons, so it sounds like the stylus has an offset added to it (maybe the values range from 40 to 280 instead of 0 to 240?) It sounds like it is constant across the entire screen, so I don't think it's scaling a x320 screen to the x240 screen.
This is running with phal 0.7.6.
The problem is that the GAPI implementation of the Treo 700w says the screen is 240x320. This isn't true. The screen size is actually 240x240. Their GAPI implementation will scale the 240x320 backbuffer to the 240x240 screen, resulting in weirdness.
I had one customer who ran into this problem. The screen was getting compressed to 240x240, and it seems the stylus input was that way too. In the end, I made him a custom build that took the y-coordinate of the stylus and multiplied it by 4/3 before processing.
-John
Is the stylus being scaled at all time? Or only when using GAPI? (And PocketHAL).
I've sent a test application and haven't heard back yet.
From what I've read in other places, the screen is scaled - but the stylus is not. Hence the need to multiply by 320/240. If both the screen and stylus were scaled, then there wouldn't be a problem, right?
I've also read that including the HI_RES_AWARE resource will 'fix' the problem. I'm not positive if it makes both the screen and stylus 240x240 or if they are both at 240x320...
Let me know of anything what you find. The sooner I know exactly what is going on on the Treo, the sooner I can support it in PocketHAL.
The Travel Collection is still in PF 0.7.0, so it's using GAPI for everything. The QVGA backbuffer is getting scrunched to 240x240, and the stylus input is a constant 240x240. Multiplying the y-coordinate by 4/3 is all it takes to make it work correctly. Unfortunately, it's just not as pretty as it should be.
PHAL uses GAPI for the stylus input, doesn't it? Or am I thinking of the hardware keys?
-John
PocketHAL doesn't do anything with input... But it does use GAPI for screen access on the Treo (and that's a problem).
The behavior you just described is what I was expecting. What happens if you put in the HIRES_AWARE flag? I suspect it doesn't change anything? (As far as I know that flag doesn't affect GAPI, but I might be wrong).
Presto wrote:The Travel Collection is still in PF 0.7.0, so it's using GAPI for everything. The QVGA backbuffer is getting scrunched to 240x240, and the stylus input is a constant 240x240. Multiplying the y-coordinate by 4/3 is all it takes to make it work correctly. Unfortunately, it's just not as pretty as it should be.
PHAL uses GAPI for the stylus input, doesn't it? Or am I thinking of the hardware keys?
-John
What you do to know your game runs on a Treo device?
What happens to graphics? Is it really resized on y?
Or it just shows 240x240 square?
If scrunched means resized - is there any way to avoid this, because it should look awful in games(and also for any bitmap fonts used)!
Are you sure we need to multiply Y-coor by 4/3, not 3/4 for stylus?
Thanks
BIGBEN wrote:What you do to know your game runs on a Treo device?
What happens to graphics? Is it really resized on y?
Or it just shows 240x240 square?
If scrunched means resized - is there any way to avoid this, because it should look awful in games(and also for any bitmap fonts used)!
Are you sure we need to multiply Y-coor by 4/3, not 3/4 for stylus?
Thanks
I made a custom build for the guy to see if it would even work. I don't check for device type. (I state right on my product pages that the game is designed for QVGA and VGA only.)
Yes, only the Y gets resized, so it doesn't maintain perspective. He said my options screen looked all grainy, because there's a lot of text on that one. I'm guessing that the Treo simply drops every 4th row... but I'm not sure on that.
Yes, it's definitely 4/3. I tried 3/4 the first time, because that's what happens to the Y-scale of the screen image. A tap at the bottom of the screen, which is normally 319, is only 239 on the Treo, so multiplying it by 3/4 DECREASES it to 179. But you really want to INCREASE a value of 239 to 319, so it's times 4/3. (which actually only equals 318, but close enough)
-John
Kzinti wrote:PocketHAL doesn't do anything with input... But it does use GAPI for screen access on the Treo (and that's a problem).
The behavior you just described is what I was expecting. What happens if you put in the HIRES_AWARE flag? I suspect it doesn't change anything? (As far as I know that flag doesn't affect GAPI, but I might be wrong).
This is from an MSDN article about 2003SE - but maybe it still holds true.
GAPI Legacy Support
Applications that use GAPI frequently make assumptions about the screen size based on earlier versions of Pocket PC and Smartphone hardware. To preserve backward compatibility with legacy applications, an emulation layer has been added to GAPI. By default, this layer will scale GAPI drawing to fit the screen; however, a high-resolution-aware application can choose to bypass the emulation layer to have complete access to the display hardware.
To bypass the emulation layer, an application should not call GXBeginDraw or GXEndDraw. Instead, it should call ExtEscape with the nEscape parameter equal to GETRAWFRAMEBUFFER and use the returned frame pointer for drawing.
So I'm a bit confused if HI_RES_AWARE alone would fix it or you would need to use the 'ExtEscape'?
Thank you John for clear explanation!
Could you, please, send him a testing version with the following(I can do the small app build):
Draw first raw with red, second with green, then blue
yellow, white, black, magneta, grey.
8 colors repeated on the screen.
So we would know where Treo does the trick, if it just drops the n'th row(I hope), there would be an easy way to avoid it with a small blank row trick...
And it is much better then adding hiresaware, since it will confuse some people if your game runs not resized on a 1/4 of some true-VGA's screen device
fast_rx wrote:So I'm a bit confused if HI_RES_AWARE alone would fix it or you would need to use the 'ExtEscape'?
What you quoted is essentialy saying to not use GAPI and instead use the GETRAWFRAMEBUFFER escape call. This matches my experience: you don't want to use GAPI on non-QVGA Pocket PCs.
Adding the HIRESAWARE flag doesn't change the behaviour of GAPI in any ways.
There is an emulation layer for legacy application, but it only applies to GDI (and not GAPI). That emulation will be disabled by the HIRESAWARE flag. Again this is orthogonal to GAPI functionality.
So what you want to do on the Treo is NOT use GAPI. But then you need to handle a 240x240 display in your game. The alternative solution is to keep using GAPI and scale your vertical stylus input by 4/3.
Well in this case the same thing should happen on other 240x240 devices. Am I right?
In this case GetSystemMetrics(SM_CYSCREEN)should be enough to track this devices.
Kzinti, what should I do to make my game run in PFrog+PHal in not resized 240x240(screen) on Treo?
BIGBEN wrote:Well in this case the same thing should happen on other 240x240 devices. Am I right?
No. I had another guy with an HP hw6515 that is a 240x240 device. It works fine 'as-is' on that device. I've used display->GetHeight everywhere and the only thing I had to change was to make sure menu items don't fall off the bottom of the screen. Of course, I didn't see it with my own eyes - so it could have been scaling the vertical from 320 to 240.
So what you want to do on the Treo is NOT use GAPI. But then you need to handle a 240x240 display in your game.
How do I tell pocketfrog/phal to not use GAPI?
I am handling the screen resolution properly, I think. It works fine on the new arm emulators in the square configuration - I can even run it on the smartphone emulator at 176x240.
I've sent a test to my iPAQ hw6515(240x240) betatester.
The test should look like on an attached pixel on a QVGA device. When the stylus is pressed it saves a screenshot. On stylus move it should show the 3x3 red pixel dot under the stylus (true stylus coordinates used, no multiplication).
The grey square is 32x32 pixels in an output screenshot.
8 colors are repeated in the rows until y==240.
Press any button to quit.
I expect the screenshot wouldn't be the same as the program looks on 240x240 device. So I also ask my betatester to describe "is it looking the same, what differences"
There would be also interesting how it looks on Treo
EDIT: Since the screenshot (I expect) wouldn't be very useful I also asked him to take a digital photo of the device's screen, if he can.
fast_rx wrote:How do I tell pocketfrog/phal to not use GAPI?
I will need to release a new version of PocketHAL. Hopefully I will have time for this during the weekend.
I am currently quite busy with life. We just made an offer on a house and I am trying to get a new position at my company. Busy busy. As soon as I have a few hours to spare, I will update PocketHAL to work properly on the Treo.
I have a fix. Release 0.7.7c is available for registered users. Just drop me an e-mail and I will send you the update.
Thank you very much, Kzinti!
Release 0.7.7c
==============
Windows CE:
- Fixed GAPI emulation issue on Treo 700w. The screen size is now properly
reported as being 240x240 (and not 240x320).
Possibly dumb questions, but I have no Treo to test:
1. Does it mean that we do not need anything special to use this option (so PHAL automatically detects Treo and use this option)?
2. We do not need to include HI_RES_AWARE?
3. I assume, we should convert stylus coordinates on Treo manually (multiply y-coordinate by 4/3) as before?
4. If 3 is true, how to detect Treo 700w?
Thanks again

I'm betting the fix is that PHAL will now use a 240x240 backbuffer, rather than 240x320. Since the screen isn't being resized, you shouldn't need to do anything with the stylus input.
In essence, it should work like other square screens now. Kzinti can answer that for sure, but I can't imagine him doing it any other way.
-John
The way it works now is that I ask GDI what the screen dimensions are. Then I ask GAPI. If the results are different, I don't use GAPI. This is done to ensure that stylus input and screen dimensions always match.
So on the Treo, PocketHAL will now report a 240x240 display. You don't need to do anything with the stylus coordinates.
As far as I know, the HI_RES_AWARE flag only does something on Pocket PCs with screen dimensions different then 240x320. (And it doesn't do anything on Smartphones). I am pretty confident the flag doesn't do anything on the Treo.
Thanks for explanation,
Finally I've got reply from my iPAQ hw6515 betatester.
The app that I posted here(based on
previous PocketHal) running OK on his device.
Just down area is cropped.
Stylus position is OK (the same as on QVGA - no mult needed).
Currently updating !PyroManiA! for 240x240 support with new PHal

Kzinti wrote:The way it works now is that I ask GDI what the screen dimensions are. Then I ask GAPI. If the results are different, I don't use GAPI. This is done to ensure that stylus input and screen dimensions always match.
So on the Treo, PocketHAL will now report a 240x240 display. You don't need to do anything with the stylus coordinates.
As far as I know, the HI_RES_AWARE flag only does something on Pocket PCs with screen dimensions different then 240x320. (And it doesn't do anything on Smartphones). I am pretty confident the flag doesn't do anything on the Treo.
but this would broke current applications which work correctly work with treo, isn't it? ( if any ;) )
Kak wrote:but this would broke current applications which work correctly work with treo, isn't it? ( if any ;) )
Err no. Since they would already be broken. The stylus input range doesn't match the screen dimensions reported by the Treo's GAPI anyways.
I can see why some would want to run in the 320x240 scaled to 240x240 mode - if they handle the input scaling. I wouldn't, but maybe some games would look/play ok like that.
I have prepared a test version of lejjo with the new pocketHAL and can't get anyone to test it. I've posted over at treocentral.com asking for someone to test it out and no responses. I guess they are too busy complaining about apps that don't work right.

Hi,
As a sidenote, does anyone here know what the OEM string for the Treo is?
Sincerely
Johan
Kzinti,
Screen rotation isn't handled correctly for square screens (as well as VGA ones, I suppose).
My version of pocketFrog has this in the game.cpp
- Code:
//fixme: don't use hard coded values for width and height
void Game::DeviceToLogical( Point& P ) const
{
switch (m_config.orientation)
{
case ORIENTATION_ROTATE90CCW:
swap( P.x, P.y );
P.x = 319 - P.x;
break;
...
This obviously makes an offset on the stylus for square screens.
Where should we be getting this value? I assume I wouldn't want to call GetDisplay->GetWidth() every time, any downside to adding a variable to the game class to store the height/width?
"Palm Treo 700w" is the OEM String Johan...
Doesnt the HI_RES_AWARE need to be used for the new WM5 Smartphones with QVGA. I cant get support to work in Gapidraw with 3.01 on these Smartphones and they are getting big, is PF working with it before or now after this change? Do you know if it works with GD 3.5 or your new version Johan?
fast_rx,
I think Thierry's dropped support for PF and is focusing entirely on PHAL now. You should make the change and submit it to Frank, who's running the SourceForge project for PF now. Though I think Thierry could still tell you the proper way to get the correct value from PHAL.
-John
Birdiestyle, pocketFrog was working with square screen devices before this last PHal rev. The problem was specific to the Treo... This was without the HI_RES_AWARE flag (unless you want to run in VGA, I believe).
As for the fix for the stylus orentation mapping, here's what I did (warning, I don't even try to adhere to any variable naming convention):
added to game.h in the private section
- Code:
int styluswidth, stylusheight;
added this to the END of Game::Init in game.cpp
- Code:
stylusheight = m_display->GetHeight();
styluswidth = m_display->GetWidth();
if (m_config.orientation == ORIENTATION_ROTATE90CW || m_config.orientation == ORIENTATION_ROTATE90CCW)
swap( stylusheight, styluswidth );
Changed DeviceToLogical in game.cpp
- Code:
void Game::DeviceToLogical( Point& P ) const
{
switch (m_config.orientation)
{
case ORIENTATION_ROTATE90CCW:
swap( P.x, P.y );
P.x = stylusheight - 1 - P.x;
break;
case ORIENTATION_ROTATE90CW:
swap( P.x, P.y );
P.y = styluswidth - 1 - P.y;
break;
case ORIENTATION_ROTATE180:
P.x = styluswidth - 1 - P.x;
P.y = stylusheight - 1 - P.y;
break;
}
}
It may be no better than just using m_display->GetHeight() in the DeviceToLogical function, but I didn't.
(edit: I didn't have the swap for landscape)
Eventually, I'll get around to submitting a mod to the sourceforge...
Thanks....Im referring to Smartphones with QVGA. Not pocket pc phones with my question? I figured out the Treo stuff for GD and posted in the GD forums originally...
Im hoping we can get one good solid build of PF at some point that we can all go from(the SourceForge was a great idea but I never know where its at and it always seems some things havent quite had time to be added that are really needed).
There's no emulation mode for smartphones that trick the program from thinking it's in 176x220 mode - so why would it need any flag for the resolution?
Don't they have touchscreens? So it seems like any QVGA device would act the same. What am I missing?
Im not sure... I guess, since I was debugging using beta testers and not having the phone, I was unable to determine what exactly was going on. I tried it both ways, but supposedly with GD3.01 It would draw the game images with like a back border around it, or something, though I have QVGA support built in which checks using getsystemmetrics to see if the screen is actually QVGA and should use it completely.... Maybe PH/PF has always supported this correctly, thats what Im asking I guess...
???
Birdiestyle wrote:Thanks....Im referring to Smartphones with QVGA.
Smartphones don't have an emulation layer like Pocket PCs do. Using the HI_RES_AWARE flag does nothing on a QVGA Smartphone. The display is always reported as 240x320, even through GAPI.
Good enough.. Must be a GD 3.01 problem then?!?!
Thanks
So, does anyone here have a Treo 700w?
I don't know for sure yet, but I'm guessing that when it compresses the 240x320 pixels into 240x240, it's skipping one of the rows. I wrote a tiny program that shows the following image. If any of the colors turn out to be solid, we'll know which row it's skipping. I doubt it's a smooth rescaling, since one of my customers reported that the text appeared rather grainy. The setup program is here:
http://www.pocketadventures.com/TreoTest_Setup.exe
Thanks,
-John
Well, as an FYI, here's what happens on the Treo 700w when it resizes a 240x320 GAPI application. It does a pixel averaging on rows 0&1, 4&5, 8&9, 12&13, etc, and leaves the other rows as they are. The results look like this (before and after):

Thank you very much Johan for your contribution! My tester is still silent.
You tested the latest PocketHal (that was to fix this problem)? So the problem is still open.

No, PocketHAL is fixed. PocketHAL will report a 240x240 display on the Treo. Presto mentionned he was using GAPI.
Mmm... strange, I'll doublecheck that I've correctly rebuilt the PocketFrog lib (I'm sure I did), since my Treo user reported problems with latest !PyroManiA! demo (uses the latest PocketHAL).
PocketFrog might not work properly for stylus input.
If you add the Palm Treo 700w to pocketpc.cpp
- Code:
{ PocketPC::MODEL_TREO_700W, _T("Palm Treo 700w") },
and pocketpc.h
- Code:
MODEL_TREO_700W,
then add the following function to game.cpp
- Code:
bool Game::IsTreo()
{
#if defined(FROG_PPC)
return (PocketPC::GetModel() == PocketPC::MODEL_TREO_700W);
#else
return false;
#endif
}
and game.h
- Code:
bool IsTreo();
Then you can call IsTreo() from your derived game class and save the result in a boolean at initialization.
- Code:
bool MyGame::GameInit()
{
srand(::GetTickCount());
bTreo = IsTreo();
...
Then, in your StylusUp(), StylusDown() and StylusMove() functions you can use something like:
- Code:
void MyGame::StylusDown(Point stylus)
{
if(bTreo)
pScreenMgr->StylusDown(Point(stylus.x, (stylus.y*4)/3));
else
pScreenMgr->StylusDown(stylus);
}
I did not have to scale the stylus after PHal was changed to give you a 240x240 display... Or are you saying you're letting it run in compatibility mode and need to scale the stylus?
The only changes I made was to get rid of the hardcoded 240's and 320's in the device to logical functions I mention above, and everything was reported to work fine by the beta tester.
Isn't there more 240x240 devices coming out? I'm wondering how many of them are going to cause problems.
I wonder, is there actually a whole solution for square devices?
As far as I see:
In treo 700w we set hires aware flag and getting nice 240x240 screen. In hp 63xx we don't set anything and get this 240x240 screen right away. So, I should have two versions, totally equal, except for this hires aware flag? OMG..
That funny Palm. These guys always manage to cause maximum problems to developers

.
I figured out my problems...
I made such a stupid mistake.

While building my game I used the old PHAL.lib
It's all because of laziness - once I moved the PocketHal.lib files in the \lib folder (where PFrog.lib files are) from the \lib\win32 - I was so lazy to add another one directory in the library files menu.
So patching with new PHal hadn't affected all those old files.

But now I've got good performance gain upgrading from 0.7.5 to 0.7.7c.
I'm really thankful for this Treo issue.
Sorry for complaining about PHAL