Hi,
Yesterday I was trying to play frozen-bubble, but the game refused to
start. After a few tries I’ve understood that it was because of the
blank CDR in my cd burner! (in fact, frozen-bubble uses the sdl-perl
"SDL::App->new(…)", which uses “SDL_Init(SDL_INIT_EVERYTHING)”)
I’ve done a test with a very simple program:
#include <stdlib.h>
#include <SDL/SDL.h>
int main(int argc, char** argv)
{
SDL_Init(SDL_INIT_CDROM) ;
atexit(SDL_Quit) ;
SDL_Quit() ;
return(EXIT_SUCCESS) ;
}
Here is a partial strace of the execution:
<>
stat64("/dev/cdrom", {st_mode=S_IFBLK|0600, st_rdev=makedev(11, 0),
…}) = 0
open("/dev/cdrom", O_RDONLY|O_NONBLOCK|O_EXCL) = 3
ioctl(3, 0x530b
Here, the init process hangs, until I press the open button of the cdr
drive. It then continue:
ioctl(3, 0x530b, 0xbffff12c) = 0
close(3) = 0
<>
stat64("/dev/cdrw", {st_mode=S_IFBLK|0600, st_rdev=makedev(11,
0), …}) = 0
open("/dev/cdrw", O_RDONLY|O_NONBLOCK|O_EXCL) = 4
ioctl(4, 0x530b
Here it hangs again (/dev/cdrw and /dev/cdrom are the same device). I
again have to press the open button, and the the program can continue
and exit.
ioctl(4, 0x530b, 0xbffff07c) = -1 ENOMEDIUM (No medium found)
close(4) = 0
read(3, “”, 4096) = 0
close(3) = 0
<>
The workaround for this bug is quite simple: “don’t put a blank cdr in
the drive if you want to play to an sdl game.” But it can take a quite
long time to understand that the first time, so it would be nice if
somebody could fix that in libsdl.
Oh, and something else that may help:
I’m using Gentoo Linux, kernel 2.4.20-ck4, on a K7 PC.
Thanks for your all your work for the gamers community,–
Thomas.