PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

Detecting PPC Models

I've been told that GXGetDisplayProperties, when called on an iPAQ 38xx, returns the pitch values for the 36xx displays. If we're bypassing GAPI on the 38xx using memory address AC0755A0h instead of a call to GXBeginDraw() we need to have the real display settings.

I was thinking one way to detect what model the user is running would be with SystemParametersInfo.

Code:

BOOL SystemParametersInfo (
UINT uiAction,
UINT uiParam,
PVOID pvParam,
UINT fWinIni );


using the uiAction flag SPI_GETOEMINFO. Has anyone else experimented with ways of detecting the device at runtime outside of using GXGetDisplayProperties? Is SystemParametersInfo the only other option?

After we know what model the user is using then it's a simple matter of populating the GXDisplayProperties structure as appropriate or adjusting our Display object's attributes.

Thanks,
-Hosed
simonjacobs · 17 Jan 2002, 12:07 UTC
Yes, that is exactly how you should do it. Then, as you say, if you detect a 38xx you can fill in the correct values and not call GXBeginDraw or EndDraw.
This is from Scott Ramsby, who I think got it from Larry Bank:
Code:

TCHAR pdaname[100];
SystemParametersInfo(SPI_GETOEMINFO, 100, pdaname, SPIF_SENDCHANGE || SPIF_UPDATEINIFILE);
bIsiPaq38xx=!_tcscmp(pdaname,_T("Compaq iPAQ H3800"));


Dan East
Compaq really screwed themselves by doing this. Now even if they come up with a display for future 38xx devices that is oriented the same as the 36xx devices (or portrait for that matter), none of the games written now will work because everyone is querying on the device type and assuming the frame buffer address will always be 0xAC0755A0.

I think if I were writing a game I would at least use GAPI to find out if I weren't getting the actual display frame buffer address first. On the current 38xx devices I wouldn't be, so I'd then find out if I was on a 38xx, then try to use AC0755A0. If GAPI came back and said what I was getting WAS the true frame buffer address, then I'd just use that. This allows Compaq to "fix" things in future revs of the device. Heck, I'd probably throw in a reg key for all of this just for good measure, so the user could alter the behavior of my sniffing code if they so choose.
simonjacobs · 17 Jan 2002, 21:50 UTC
BIG problem with that idea:

The current 38xx reports that you ARE getting the true framebuffer in GAPI even though it is a complete lie!!!
You know, I had heard that Compaq did this, but then someone else here posted that they report what they've done properly via GXIsDisplayDRAMBuffer. Well that obviously changes things completely! They should be shot for doing something as stupid as this and deserve any future incompatibilities.
Digby · 20 Feb 2002, 07:46 UTC — -- UPDATE --
I finally got access to an iPaq 3870 and ran some tests. Actually, GXIsDisplayDRAMBuffer *DOES* return the correct info (TRUE) on the 3870. You must make sure that you call the API after first calling GXOpenDisplay. If you call it before opening the display, the API always returns FALSE. Maybe that's the problem you were running into Simon?

Here's a dump from my GAPI query program:

************************************************
COMPAQ IPAQ 3870
************************************************

GXDisplayProperties
cxWidth = 240
cyHeight = 320
cbxPitch = 640
cbyPitch = -2
cBPP = 16
ffFormat = 0x000000A8 (kfLandscape | kfDirect | kfDirect565)

GXIsDisplayDRAMBuffer returns 0x00000001 (TRUE)

GXBeginDraw returns 0xAC02227E

GXKeyList
vkUp = 0x0026
ptUp = (120, 330)
vkDown = 0x0028
ptDown = (120, 390)
vkLeft = 0x0025
ptLeft = (70, 360)
vkRight = 0x0027
ptRight = (170, 360)
vkA = 0x00C3
ptA = (190, 340)
vkB = 0x00C4
ptB = (210, 350)
vkC = 0x00C5
ptC = (-40, 0)
vkStart = 0x0086
ptStart = (120, 360)

BTW, does anyone know of a website were the above sort of info is posted for all Pocket PC devices? I've seen the sites that have graphics benchmarks, but not the GAPI parameters for each device.
refractor · 20 Feb 2002, 09:24 UTC — -- UPDATE --
Closest I found is this:

http://www14.brinkster.com/aemu/gapiproperties.asp

Cheers,

Refractor.
Digby - I have wanted this website to host that type of information for some time now, in addition to some other general specs about each device, like what type of expansion slots it has, etc.

Dan East
That would be an extremly useful resource. I have several devices and would be happy to contribute diagnostic results. A simple CE program which displays it's result would be an idiot proof solution.

Just need someone to write the prog and convince pocketmatrix to host ;), shouldn't be a problem to convince them as it would surely attract a lot of developers to the site!

Jim.
There's a GAPI properties exe at:

[url]http://www.icode.com.tw/myfiles/myfiles.asp?folder=\GAPI[/url]

It just slings up a messagebox containing the information.

Cheers,

Refractor.
I started a new thread about the GAPI properties:
http://forums.pocketmatrix.com/viewtopic.php?p=59986

Dan East
fzammetti · 24 Aug 2002, 15:21 UTC — Props different?
Hello all... I'm trying to get my graphics library working on the 38xx series (works on all other finally!) and I just noticed something while trying to dig up some answers in this forum...

The information I got from http://www.cewindows.net/bugs/pocketpc2002-developer.htm for the 38xx GAPI properties is:

Video memory address = 0xac0755a0
cxWidth = 240
cyHeight = 320
cBPP = 16
ffFormat = 168
cbyPitch = 2
cbxPitch = -640

But in Digby's post here, he is showing a different video memory address and different cbyPitch and cbxPitch (actually, the numbers are the same, but the signs are reversed).

Can anyone tell me which is correct, or if it might be different on various 38xx models? DAMN YOU COMPAQ!!
fzammetti wrote:38xx GAPI properties is:

Video memory address = 0xac0755a0
cxWidth = 240
cyHeight = 320
cBPP = 16
ffFormat = 168
cbyPitch = 2
cbxPitch = -640

These are not the properties that the Game API gives you. They are the properties of the actual vram you want to use. All 3800 models are the same.

I notice the 3900 has reverted to the old way. They probably should have left the buffer and optimized their blit routine--do you think? But then there are reasons you want your own buffer. That was the only real problem with the 3800, not the different orientations.
To check if it is an iPAQ 38xx:
Code:

bool IsIPAQ3800(void) {
#ifdef ARM
unsigned short wModel[255];
SystemParametersInfo(SPI_GETOEMINFO, 255, wModel, 0);
if(wcscmp(wModel, _T("Compaq iPAQ H3800")) == 0) return true;
else return false;
#else
return false;
#endif
}


You can skip the defines if you are only coding for the ARM platform. Guess it probably works without them anyways, but if you are doing Win32 builds at the same time it won't.

Here is the code for what to do if it is the iPAQ 38xx.

Code:

if(IsIPAQ3800()) {
pVideoBuffer = (unsigned short*)0xAC0755A0;
cBPP= 16;
cbxPitch= -640;
cbyPitch = 2;
ffFormat= 0xA8;
cxWidth = 240;
cyHeight = 320;
bDRAMBuffer = false;
}
It seems neither of these GAPI property apps are still at those urls, and I've never gotten my hands on Digby's app. Anybody have such an app to save me a little redundant coding?

Thanks.

Dan East