PocketHAL on Motorola Q

Posted:
Jul 5, 2006 @ 12:54am
by Ludimate
Hi,
I've found (through a customer) that PocketHAL is exhibiting the problem mentioned in this article about GAPI on the new Motorola Q (which is a Windows Mobile 5.0 Smartphone) :
http://www.modaco.com/index.php?act=ST& ... 41988&st=0
Although the screen is 320x240, PocketHAL reports it as 176x220 (apparently as provided by GAPI) and the 176x220 displays in the left side of the screen with everything else black. On the Landscape 320x240 emulator, everything displays fine in glorious landscape full screen.
Naturally this mess is not PocketHAL's fault, but would there be a way of PocketHAL bypassing GAPI if it detects such weirdness? Even a BitBlt could be better than the left-side area+black which is now displayed. The other alternative would be using DirectX, which allows direct screen access.
- Thierry, any chance on a workaround for this problem?
Thanks and Best Regards,
Jorge Diogo
http://Ludimate.com

Posted:
Jul 5, 2006 @ 6:16am
by Kzinti
I suppose it fails because the Motorola Q returns "33" as the pixel format instead of "1".
Here is an updated version that should work. Just in case, I have enabled the logging mechanism. This will dump a file named "Log_PHAL.txt" in the root of the file system.
Can you provide your tester/user with this version and retrieve the log file?

Posted:
Jul 5, 2006 @ 1:16pm
by Ludimate
The user was very kind and returned the results very quickly. He says the display now shows full screen but it is rotated 90 degrees right:
= = = = = = = = = = = = = = = = = = = = = = = = = =
PocketHAL (Version 0.7.7)
Display::Create( hwnd = 7C08FFA0, W:0, H:0, O:0, S:2 )
Initializing display...
VideoDetect::DetectDrivers()
GDIDriver: Detect()
GDIDriver: Found W:320, H:240, D:16
GAPI: Detect()
GAPI: Loading GX.DLL
GAPI: Calling GXOpenDisplay( 7C08FFA0, GX_FULLSCREEN )
GAPI: Calling GXGetDisplayProperties()
GAPI: Detecting orientation
GAPI: Native orientation is 0
GAPI: Calling GXIsDisplayDRAMBuffer() @ 029C1538
GAPI: GXIsDisplayDRAMBuffer() returned TRUE
GAPI: Detecting PocketPC model
OEM String: "MotoQ"
GAPI: framebuffer address unknown, calculating offset
GAPI: Offset is 0
GAPI: Calling GXBeginDraw() to retrieve framebuffer
GAPI: framebuffer at 4a700000
GAPI: Calling GXEndDraw()
GAPI: Final framebuffer address = 4a700000
GAPI: Calling GXCloseDisplay()
DriverVGA: Detect()
DriverVGA: Raw info: W:240, H:320, X:2, Y:480, FB:4A500000
DriverVGA: Native orientation is 0
DriverVGA: Found W:240, H:320, D:16
DriverVGA: Offset is 0
DriverVGA: Final framebuffer address = 4a500000
CreateDriver( 00000009 )
Initializing video driver...
DriverVGA: Initialize()
Driver initialized!
Success, returning display params to caller (W:240, H:320, O:0, S:2)
= = = = = = = = = = = = = = = = = = = = = = = = = =
Not sure if this helps, I found from another test that on the Motorola Q, ChangeDisplaySettingsEx returns DMDO_90 in dmDisplayOrientation as its native orientation.
Also, the QVGA Landscape 320x240 emulator from Microsoft lists this:
= = = = = = = = = = = = = = = = = = = = = = = = = =
PocketHAL (Version 0.7.7)
Display::Create( hwnd = 7C07FFC0, W:0, H:0, O:0, S:2 )
Initializing display...
VideoDetect::DetectDrivers()
GDIDriver: Detect()
GDIDriver: Found W:320, H:240, D:32
CreateDriver( 00000001 )
Initializing video driver...
GDIDriver: Initialize()
Driver initialized!
Success, returning display params to caller (W:320, H:240, O:0, S:2)
= = = = = = = = = = = = = = = = = = = = = = = = = =
Thanks,
Jorge Diogo

Posted:
Jul 5, 2006 @ 5:24pm
by Kzinti
So as PocketTV mentionned, the screen is rotated 90 degrees (and not reported as such). I unfortunately have no way of detecting if this is 90 degrees clockwise or counterclockwise. So here is a new version that might work (or might display the image upside down).
Please let me know if this version works properly or not.

Posted:
Sep 17, 2006 @ 9:46pm
by Bapdude
I'm using the latest PocketHal_7_7_e with the Motorola-Q fix. However, the display is all messed up. Instead of showing the entire display (320x240), I only see a small section in the very middle.
Is there something I need to add/remove from my code to get PocketHal to display correctly on the Motorola Q?
Thanks...

Posted:
Sep 20, 2006 @ 10:37pm
by Bapdude
Oops...you may be right.
If that's the case, I don't see any other hard-coded screen values in the framework (game.cpp) related to blitting. There are some hard-coded values in
Game::DeviceToLogical but this is for stylus translations for different screen orientations.
Any idea what Kzinti is talking about? I'm clueless at this point, so any suggestions would be greatly appreciated!
Thanks...


Posted:
Sep 21, 2006 @ 2:43pm
by Presto
I've recently been through the PF screen size code to get my games working on square screen devices. The FROG_PC section is definitely only for the PC build. It uses GetSystemMetrics for the PPC sizes, which is a few lines above what you were looking at (should be line 86). It could be that the GetSystemMetrics is reporting the screen size as 176x220.
For my own code, I added a GetOEMString function, so I can adjust things based on certain models. You might want to override the GetSystemMetrics() calls if the model is "MotoQ".
As a quick test, you should be able to comment out the GetSystemMetrics line and add one that reports the screen size as 320x240.
Good luck.
-John

Posted:
Sep 21, 2006 @ 4:33pm
by Kzinti
Oh yes... That's probably the problem. Did you add the "HI RES AWARE" flag to your resources? (ie: "CEUX")? If you don't, PocketHAL might operate in 176x220 mode instead of 320x240.