Annoying WinCE powerdown thing

WinCE devices are of course little handhelds in general, and thus have
severe power constraints. This also means they have the annoying habit
of shutting down when you don’t touch the screen for more than 3
minutes.

Normally isn’t a problem, since it retains everything in memory, but
when you have an audio device open and playing in SDL, the thing fubars
upon power-on. I’ve sidestepped this problem by giving fake keystrokes
to prevent poweroff, but I’m wondering if there’s a way to co-operate
with the system, rather than subvert it.

WinCE generates two messages related to this, according to the docs;
WM_HIBERNATE and WM_ACTIVATE. I’ll try experimenting with those, first
to see if I get those at all, then to see if the audio device needs to
be closed entirely or just paused to avoid crash, etc… if/when this
code reaches the working stage, should it go under the WinCE audio code
or be left up to the programmer?

code reaches the working stage, should it go under the WinCE audio code
or be left up to the programmer?

What you’re describing would be an SDL bug, and we should handle it at the
SDL level.

Actually, it’s arguably a PocketPC bug, but we don’t have access to
Microsoft’s source repository. :slight_smile:

–ryan.

Hmm. It’s more difficult than I thought… WinCE doesn’t HAVE any
notification messages for powerdown/powerup. It DOES give powerdown/powerup
notification to device drivers, though, and I’ve got extremely simple skeleton
code for a ‘driver’ DLL that does nothing but push WM_USEREVENT’s upon
powerdown and powerup.

PowerUp messages seem to work perfectly fine through the normal WinCE and SDL
que… PowerDown ones are another matter, though. WinCE powers down
IMMEDIATELY after giving the device drivers notification, without running the
message que once more… so upon powerup, one gets a PowerDown message
followed by a PowerUp. Not very helpful if you wanted to shut down your audio
callback BEFORE it powered down and crashed. :stuck_out_tongue:

Only other method I know of that’d be fast enough, would be a direct
callback; Upon powerdown, the “device driver” we’ve rigged to notify us
directly calls a function we’ve specified through a pointer. I imagine
thread/thread function calls are hassle enough without one DLL directly
calling another DLL! Then, something totally insane occured to me.

Make the SDL DLL itself a device driver. Doesn’t look that hard, actually.

Could still be used as a perfectly normal DLL; only difference would be it’d
have an array of codestubs for the WinCE device driver read/write functions,
and PowerUp/PowerDown functions that get called by the system. These PowerUp
and PowerDown device-driver functions could call function pointers in it’s
home sdl.dll, vectoring back to your code exactly when you need it. SDL would
need to bootstrap itself into memory upon SDL_Init.

It’d mean another code tree to add to SDL, to support powerup/powerdown
crossplatform; WinCE isn’t the only platform capable of suspending, though…

“Ryan C. Gordon” wrote:> > code reaches the working stage, should it go under the WinCE audio code

or be left up to the programmer?

What you’re describing would be an SDL bug, and we should handle it at the
SDL level.

Actually, it’s arguably a PocketPC bug, but we don’t have access to
Microsoft’s source repository. :slight_smile:

–ryan.


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

Make the SDL DLL itself a device driver. Doesn’t look that hard, actually.

Here’s another thing I wish someone else was thinking about…

I’m working on a project that would really like to use the
application buttons. Unfortunately, I either have to figure
out how to do use the native WinCE calls to register my app
for the buttons (and how to let go of them), or to try using
the SDL wrapped around GAPI posted here several weeks ago.

Is there someone here that knows more about WinCE that
could embed some of the GAPI functionality (buttons, suspend,
resume) into SDL for WinCE, without requiring the use of
the GAPI dll?

I’m looking for something that would generate SDL events
from any of the keypresses (or the joypad).

I think I could figure it all out, but I have no idea if
my solution would be acceptable?

Andy–


Sign-up for your own FREE Personalized E-mail at Mail.com
http://www.mail.com/?sr=signup

Single & ready to mingle? lavalife.com: Where singles click. Free to Search!
http://www.lavalife.com/wp.epl?a=2716