diff 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
line wrap: on
line diff
--- a/src/cdrom/win32/SDL_syscdrom.c	Sun Jul 18 18:33:28 2004 +0000
+++ b/src/cdrom/win32/SDL_syscdrom.c	Sun Jul 18 19:01:27 2004 +0000
@@ -48,6 +48,7 @@
 #ifdef BROKEN_MCI_PAUSE
 static int SDL_paused[MAX_DRIVES];
 #endif
+static int SDL_CD_end_position;
 
 /* The system-dependent CD control functions */
 static const char *SDL_SYS_CDName(int drive);
@@ -314,6 +315,7 @@
 	mci_play.dwFrom = MCI_MAKE_MSF(m, s, f);
 	FRAMES_TO_MSF(start+length, &m, &s, &f);
 	mci_play.dwTo = MCI_MAKE_MSF(m, s, f);
+	SDL_CD_end_position = mci_play.dwTo;
 	return(SDL_SYS_CDioctl(cdrom->id, MCI_PLAY, flags, &mci_play));
 }
 
@@ -335,15 +337,16 @@
 	int flags;
 
 	okay = 0;
-	/* Play from the current play position to end of CD */
+	/* Play from the current play position to the end position set earlier */
 	flags = MCI_STATUS_ITEM | MCI_WAIT;
 	mci_status.dwItem = MCI_STATUS_POSITION;
 	if ( SDL_SYS_CDioctl(cdrom->id, MCI_STATUS, flags, &mci_status) == 0 ) {
 		MCI_PLAY_PARMS mci_play;
 
-		flags = MCI_FROM | MCI_NOTIFY;
+		flags = MCI_FROM | MCI_TO | MCI_NOTIFY;
 		mci_play.dwCallback = 0;
 		mci_play.dwFrom = mci_status.dwReturn;
+		mci_play.dwTo = SDL_CD_end_position;
 		if (SDL_SYS_CDioctl(cdrom->id,MCI_PLAY,flags,&mci_play) == 0) {
 			okay = 1;
 			SDL_paused[cdrom->id] = 0;