PocketMatrix forums

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

Some technical Qs

Hello everyone,

I'm new to PocketPC development having been developing Gameboy Advance stuff for the past year, and PC apps before then. I have a few questions!

- In your experience is it possible to get 60fps on a 206mhz machine using Bitmap copying? If not, I'll use GAPI.

- To play sounds with a latency of 0.1sec or less, which APIs are available?

- If the GAPI library is just a file called gx.dll which can be loaded onto any Pocket PC, presumably it has no special permissions? So can any program short-circuit the process, and directly program the screen like gx.dll does?

- Currently on my Jornada 565 running PocketPC 2002 (I think), when I close my program or any program, it doesn't actually exit, but stays in the list in the corner till I select "Close all windows". This is quite annoying for development since I can't replace the file! How can I make my application exit when it is closed?
Why does this happen/is this a new Pocket PC 2002 eccentricity?

- Can you play MIDI files on a Pocket PC, just out of curiousity?

- Which is most reliable/available of these timing methods for accuracy less than about 1/100 second?
timeGetTime()
GetTickCount()
SetTimer()/WM_TIMER
QueryPerformanceCounter

- I have MSDN already installed for Visual C++, however when I press F1 from Embedded Visual C++, it says "The MSDN Collection does not exist, please reinstall MSDN". Has anyone else had this problem and been able to fix it?

Thanks in advance everyone!
Dave.
refractor · 08 May 2002, 22:36 UTC — Some technical Qs
Dave wrote:
Hello everyone,


Hi there.

Dave wrote:
I'm new to PocketPC development having been developing Gameboy Advance stuff for the past year, and PC apps before then. I have a few questions!

- In your experience is it possible to get 60fps on a 206mhz machine using Bitmap copying? If not, I'll use GAPI.


Depends what exactly you mean by "bitmap copying". For example, RocketElite claims >100fps, and that's a bitmap-based game.

If you mean page-flipping... then yes, it's possible. Actually, either way it should be possible.

Oh, and the LCD on the iPAQs run at 70Hz :)

Dave wrote:
- If the GAPI library is just a file called gx.dll which can be loaded onto any Pocket PC, presumably it has no special permissions? So can any program short-circuit the process, and directly program the screen like gx.dll does?


Yes. The WinCE screen buffer is preallocated and in a fixed location on most PocketPC machines. You can just write to any memory you like, pretty much... and if you ask the OS nicely, you can read and write anywhere in addressable space.

Audio latency+Closing+MIDI+Timers+MSDN Problem:

Pass. Sorry. :) I suggest you search this forum for the timer + audio questions - IIRC we've at least discussed both of those fairly recently.

Cheers, hth,

Refractor.
I can't think of a single reason why you should target a game to run at 60fps. Those extra cycles would be put to much better use doing something else, like added effects.
By bitmap copying I was refering to the Windows function calls for bitmap copying. e.g. The CreateDIBSection stuff. I heard there was an equivalent on the PocketPC.

So you can buffer your graphics on a HBITMAP, and blit it to the screen. But would that method reach 60-70fps?

And how do you do page-flipping? (Did you mean page-flipping as in flipping the hardware screen address, or just double-buffering)

And what's the memory map of PocketPC? :)
Or does it vary from device to device.. ;)
In your experience is it possible to get 60fps on a 206mhz machine using Bitmap copying? If not, I'll use GAPI.

I assume you're comparing using Device Contexts and blitting to a window as opposed to GAPI. To my knowledge you can't get 30 fps blitting fullscreen bitmaps with the Windows API.

To play sounds with a latency of 0.1sec or less, which APIs are available?

FMod and MikMod are the main two sound APIs. FMod is more robust, but carries a hefty fee for true commercial apps (the shareware licensing is reasonable, but this becomes a grey area).

If the GAPI library is just a file called gx.dll which can be loaded onto any Pocket PC, presumably it has no special permissions? So can any program short-circuit the process, and directly program the screen like gx.dll does?

Yes, you can. There are many diverse devices out there, and this makes the task of supporting all of them much more difficult. However, in some cases, such as the iPaq 38xx devices, developers have reverted to directly accessing the display address because the GAPI implementation is very poor (and converts / rotates the display for each blit).

Currently on my Jornada 565 running PocketPC 2002 (I think), when I close my program or any program, it doesn't actually exit, but stays in the list in the corner till I select "Close all windows". This is quite annoying for development since I can't replace the file! How can I make my application exit when it is closed?
Why does this happen/is this a new Pocket PC 2002 eccentricity?

Pocket PC apps close just like any other Windows app. The problem is that the shell does not have a close button, thus it doesn't provide a GUI method of sending WM_CLOSE to the app. Most people revert to taskbar programs like WisBar and GigaBar to provide them with the ability to close apps. You can go into the Memory control panel and close running apps. Any app can also include an Exit option on its menu, as well as providing its own buttons, etc, to close the app.

Can you play MIDI files on a Pocket PC, just out of curiousity?

Check FMod. I think it might provide that capability. MIDI is not a commonly used format on Pocket PC at this time.

Which is most reliable/available of these timing methods for accuracy less than about 1/100 second?

GetTickCount returns a timer value with a resolution of 1 MS.

Regarding MSDN, I seem to remember that VC++ 6.0 has the ability to select which MSDN library to use. I don't know if eVC++ has the capability or not.

Dan East
And how do you do page-flipping? (Did you mean page-flipping as in flipping the hardware screen address, or just double-buffering)


I meant double-buffering really, but page-flipping is possible on some platforms. :wink:

Cheers,

Refractor
Instead of FMod and MikMod I was thinking more of the underlying APIs which these two use to create a sound loop. Would it be functions like waveOpenOut or functions like DirectSoundCreate()? Or direct access to the hardware?

With the lack of a WM_CLOSE button, would that mean the (X) button is more like a minimize button?

Would there be any nasty consequences of doing this?:
case WM_KILLFOCUS: GXSuspend(); PostQuitMessage(0); return 0;
This is what I am currently using to speed up development so I can overwrite the file.

Also regarding the iPaq 3800 with gx.dll returning a Ram buffer and then memcpying, it seems you just ignore and use 0xac0755a0 as the direct screen buffer.
But wouldn't this be a bug in gx.dll, and could be solved by updating gx.dll to return 0xac0755a0? Has it been fixed already (1.2?)
The low-level sound API supported by Windows CE is the waveOut* family.

Right, CE basically hides the app at that time. It should be via WM_ACTIVATE with wParam==WA_INACTIVE.

Well, there are various things that could cause your app to lose focus. The first thing that comes to mind is the low battery warning. Any other pop-up alerts, such as when an appointment occurs, or when an iPaq is inserted into a sleeve, will cause your app to exit, which would like not be the desired behaviour.

Regarding the 38xx devices, they do not use the same screen orientation as the original iPaqs (the 36xx iPaq's display is actually a landscape display rotated for portrait use). Almost all original Arm games were hardcoded for the iPaq's specs (it was the only Arm device for at least a year - when the @migo was released we found that they wisely duplicated the iPaq's hardware display interface exactly). So I assume that Compaq figured that if the new iPaqs did not have the same display orientation as the originals, that a substantial number of games would not work on it. So they have GAPI expose a buffer with identical properties to the original iPaqs, then rotate and blit the display each time GXEndDraw is called, which hurts performance greatly.

Dan East
Altough you can bypass GAPI and directly access the screen, you don't want to do that because some device use DMA for page flipping (ex: Casio E-125). What's more, future devices might also decide to do something similar. (Think about future device with hardware accelerated video memory).

I've conducted bandwidth tests with my E-125 and using GX.DLL gives a noticable speed increase over direct access, even when the game is "video memory bandwidth" limited.
I guess the best thing to do would be use GAPI, and possibly add the hack for iPaq 38xx users.

I did some tests on my Jornada 565 and found that using both GXBeginDraw and the address 0xa8012020 direct I was able to get
112+ frames per second in both cases (not doing much yet other than drawing a pattern writing every pixel).
So for machines other than iPaq 38xx I would guess that using GAPI truly is as fast as you can get. :)

By the way, to not write on the title bar, would you use GetClientRect to find out where not to draw?
(Hehe - cool, no overlapping windows = no need for DirectDrawClippers :))

Regarding the Windows CE MSDN docs, it appears I have a directory in D:\WinCE\Windows CE Tools\Htmlhelp\emtools
with loads of chm and chi files, just like the other MSDN folders.

The registry even has a link to D:\Windows CE Tools\Htmlhelp\emtools\embed.col
However embed.col does not exist and it's noticeably missing from the SDK install files too. I think this is my problem... can everyone have a quick look for a file called embed.col on their disk?
If you find it, please mail it to me at dave@finalburn.com
Thanks!
Not using the fullscreen mode will only work for direct-access to the video memory devices such as the iPAQ.

Devices that use an intermediary buffer (E-125) might not be able to provide "windowed" mode. (But see GXSetViewport()).