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
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?
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
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.
Hi,
The user reports that it's now full screen, but upside-down - so it should be into the other direction...
Here's the Log_PHAL.txt in case it helps:
====================================
PocketHAL (Version 0.7.7)
Display::Create( hwnd = 7C0838D0, 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( 7C0838D0, 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
DriverVGA: Motorola Q detected, overriding orientation to ORIENTATION_ROTATE90CCW
CreateDriver( 00000009 )
Initializing video driver...
DriverVGA: Initialize()
Driver initialized!
RotationDriver: Initialize()
Success, returning display params to caller (W:320, H:240, O:0, S:2)
====================================
Thanks,
Jorge Diogo
Thanks for your help, here is the fixed version (with banner).
Registered users (that made a donation in the past) can get the banner-free version by dropping me an email (thierry / at / droneship.com).
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...
What is the width/height returned by PocketHAL? The screen is really 320x240, not 240x320.
Have you tried the firework.exe sample (or minimal.exe) to see if it has the problem?
Are you using PocketFrog?
Yes, I am using PocketFrog. I tried 'firework.exe' and it looks perfect on the Motorola Q (fills the entire screen 320x240). So, the problem is definitely with PocketFrog.
As I mentioned before, I had to remove the
m_config.orientation from my code; otherwise, it would cause an exception error on the Motorola Q. So, I'm assuming it's using the default orientation (native?).
To draw the intro screen from my previous post, I use the following commands:
- Code:
m_intro = LoadImage( display, IDR_INTRO);
display->Blit(0, 0, m_intro);
IDR_INTRO is a 320x240 PNG image.
Any idea what's going on here?

I don't remember exactly where, but look for hardcoded values like "240", "239", "320", "319" in PocketFrog's source code... Should be in the framework.
These values shouldn't be hardcoded like that. Instead it should call PocketHAL to figure out the actual width/height.
PocketFrog was written with 240x320 displays in mind... I am not surprised it breaks here. Should be an easy fix... Somewhere there is code to center the blit on the display. This is the code that needs to change.
Sorry I can't be more specific... I don't have access to the source for the next 3 weeks.
I hate to say it, but I still haven't been able to get PocketFrog to work on the Motorola Q. I spent a couple hours trying to modify
game.cpp within framework without much luck. Here's the code I've been tweaking:
- Code:
#if defined(FROG_PC)
// Make sure the window is of the proper size
// Changed 06-10-2003 by Frank W. Zammetti
int width, height;
width = 240;
height = 320;
if (m_config.orientation == ORIENTATION_ROTATE90CW || m_config.orientation == ORIENTATION_ROTATE90CCW)
swap( width, height );
ResizeClient( width, height );
#endif
I tried to get the actual width/height from the PocketHAL
DisplayParameters struct (and assign to int width and height), but this didn't change the display. I have very little understanding of PocketHAL internals, so perhaps I'm doing this wrong?
I'm fearing that I'm one of the few people with a Motorola Q which will make this even more difficult to get help from others on this forum.
I'd gladly make another PocketHAL donation to have this issue fixed.
Thanks...
I think FROG_PC is only supposed to be defined on a PC build, right?
In defs.h is
#if !defined(_WIN32_WCE)
#define FROG_PC
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...

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
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.
As a quick test, I tried the following to see if it would make a difference in
game.cpp
- Code:
// Rect r( 0, 0, ::GetSystemMetrics( SM_CXSCREEN ), ::GetSystemMetrics( SM_CYSCREEN ) );
Rect r( 0, 0, 320, 240 );
I also added the "HI RES AWARE" flag to my resources, but the display is still messed up. It looks like the display is always 176x220. If I have the values hardcoded as 320x240, where is it getting the wrong screen dimensions?
The only way it can be running in 176x220 (and it seems it is), is if GAPI is used.
PocketHAL will use GAPI if it doesn't detect the hi-res screen. I am puzzled as to why it works for the PocketHAL samples and not PocketFrog.
That may be what's happening. For a quick check, I copied the PocketHAL lib file (bannered version from earlier in this forum posting) into my project space. I rebuilt and ran the exe on the Motorola Q. I don't see the PocketHAL banner on the screen.
Either the banner is not displayed because it's getting culled by the 176x220 display area, or I'm not picking up PocketHAL in my build. I have the PocketHAL lib directory in my project path. What else is required to use PocketHAL?
I feel stupid asking this since I've been using PocketHAL for months now (successfully). Perhaps something got changed in my project.
Is there any way to verify that I'm using PocketHAL other than the banner?
Use the debugger? Put a breakpoint on calls to PocketHAL and make sure you hit them?
Success!!! After hours of debugging, I found that I had an old copy of the PocketHAL_ARM.lib file in my library path. So, although I was copying the new version of PocketHAL into my project space, the build was grabbing the old one. Wouldn't you know it would be something simple.
So, if I were to summarize my changes to get PocketFrog to work with the Motorola Q, it would be the following:
- Remove
m_config.orientation = ORIENTATION_ROTATE90CCW from constructor
- Add
"HI_RES_AWARE" flag resource to project
- Link in new PocketHAL_0_7_7e library files
The only remaining issue I'm having with the Motorola Q is with Hekkus. The game music doesn't start consistently as it does on other PPC devices. For example, occasionally, I'll start the game and Hekkus won't start the game music. While running, if I connect (or disconnect) the Motorola Q (to/from) the USB port, the music will start playing. Other times, I can start the game and the music plays fine. I've never seen this behavior before on other devices.
Oh, before I forget, here's a picture showing PocketFrog/HAL running on Motorola Q in native 320x240 landscape:

Glad to hear you found the problem!