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.
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
Actually, it’s arguably a PocketPC bug, but we don’t have access to
Microsoft’s source repository.
SDL mailing list
SDL at libsdl.org