comparison src/cdrom/win32/SDL_syscdrom.c @ 904:34af7946130a

Date: Fri, 16 Jul 2004 17:25:45 +0200 From: "A. Umbach" Subject: Patch for bug in SDL cdrom resume handling Black| pointed out a bug on #sdl today, that when you pause CD playback, and then Resume it, it'll play until the end of the disk, and not until the track you specified. Attached is a patch that fixes the issue, by saving the desired end position in the SDL_CD struct, and seting it again upon resume - Andreas
author Sam Lantinga <slouken@libsdl.org>
date Sun, 18 Jul 2004 19:01:27 +0000
parents b8d311d90021
children c9b51268668f
comparison
equal deleted inserted replaced
903:6e6248801043 904:34af7946130a
46 static char *SDL_cdlist[MAX_DRIVES]; 46 static char *SDL_cdlist[MAX_DRIVES];
47 static MCIDEVICEID SDL_mciID[MAX_DRIVES]; 47 static MCIDEVICEID SDL_mciID[MAX_DRIVES];
48 #ifdef BROKEN_MCI_PAUSE 48 #ifdef BROKEN_MCI_PAUSE
49 static int SDL_paused[MAX_DRIVES]; 49 static int SDL_paused[MAX_DRIVES];
50 #endif 50 #endif
51 static int SDL_CD_end_position;
51 52
52 /* The system-dependent CD control functions */ 53 /* The system-dependent CD control functions */
53 static const char *SDL_SYS_CDName(int drive); 54 static const char *SDL_SYS_CDName(int drive);
54 static int SDL_SYS_CDOpen(int drive); 55 static int SDL_SYS_CDOpen(int drive);
55 static int SDL_SYS_CDGetTOC(SDL_CD *cdrom); 56 static int SDL_SYS_CDGetTOC(SDL_CD *cdrom);
312 mci_play.dwCallback = 0; 313 mci_play.dwCallback = 0;
313 FRAMES_TO_MSF(start, &m, &s, &f); 314 FRAMES_TO_MSF(start, &m, &s, &f);
314 mci_play.dwFrom = MCI_MAKE_MSF(m, s, f); 315 mci_play.dwFrom = MCI_MAKE_MSF(m, s, f);
315 FRAMES_TO_MSF(start+length, &m, &s, &f); 316 FRAMES_TO_MSF(start+length, &m, &s, &f);
316 mci_play.dwTo = MCI_MAKE_MSF(m, s, f); 317 mci_play.dwTo = MCI_MAKE_MSF(m, s, f);
318 SDL_CD_end_position = mci_play.dwTo;
317 return(SDL_SYS_CDioctl(cdrom->id, MCI_PLAY, flags, &mci_play)); 319 return(SDL_SYS_CDioctl(cdrom->id, MCI_PLAY, flags, &mci_play));
318 } 320 }
319 321
320 /* Pause play */ 322 /* Pause play */
321 static int SDL_SYS_CDPause(SDL_CD *cdrom) 323 static int SDL_SYS_CDPause(SDL_CD *cdrom)
333 MCI_STATUS_PARMS mci_status; 335 MCI_STATUS_PARMS mci_status;
334 int okay; 336 int okay;
335 int flags; 337 int flags;
336 338
337 okay = 0; 339 okay = 0;
338 /* Play from the current play position to end of CD */ 340 /* Play from the current play position to the end position set earlier */
339 flags = MCI_STATUS_ITEM | MCI_WAIT; 341 flags = MCI_STATUS_ITEM | MCI_WAIT;
340 mci_status.dwItem = MCI_STATUS_POSITION; 342 mci_status.dwItem = MCI_STATUS_POSITION;
341 if ( SDL_SYS_CDioctl(cdrom->id, MCI_STATUS, flags, &mci_status) == 0 ) { 343 if ( SDL_SYS_CDioctl(cdrom->id, MCI_STATUS, flags, &mci_status) == 0 ) {
342 MCI_PLAY_PARMS mci_play; 344 MCI_PLAY_PARMS mci_play;
343 345
344 flags = MCI_FROM | MCI_NOTIFY; 346 flags = MCI_FROM | MCI_TO | MCI_NOTIFY;
345 mci_play.dwCallback = 0; 347 mci_play.dwCallback = 0;
346 mci_play.dwFrom = mci_status.dwReturn; 348 mci_play.dwFrom = mci_status.dwReturn;
349 mci_play.dwTo = SDL_CD_end_position;
347 if (SDL_SYS_CDioctl(cdrom->id,MCI_PLAY,flags,&mci_play) == 0) { 350 if (SDL_SYS_CDioctl(cdrom->id,MCI_PLAY,flags,&mci_play) == 0) {
348 okay = 1; 351 okay = 1;
349 SDL_paused[cdrom->id] = 0; 352 SDL_paused[cdrom->id] = 0;
350 } 353 }
351 } 354 }