src/cdrom/win32/SDL_syscdrom.c
changeset 201 ddee60057806
parent 192 e31f8d815aaa
child 252 e8157fcb3114
equal deleted inserted replaced
200:ec77d3d32201 201:ddee60057806
   213 						cdrom->track[i].offset-
   213 						cdrom->track[i].offset-
   214 						cdrom->track[i-1].offset;
   214 						cdrom->track[i-1].offset;
   215 			}
   215 			}
   216 		}
   216 		}
   217 		if ( i == cdrom->numtracks ) {
   217 		if ( i == cdrom->numtracks ) {
   218 			flags &= ~MCI_TRACK;
   218 			mci_status.dwTrack = cdrom->track[i - 1].id;
   219 			mci_status.dwItem = MCI_STATUS_LENGTH;
   219 			mci_status.dwItem = MCI_STATUS_LENGTH;
   220 			if ( SDL_SYS_CDioctl(cdrom->id, MCI_STATUS, flags,
   220 			if ( SDL_SYS_CDioctl(cdrom->id, MCI_STATUS, flags,
   221 							&mci_status) == 0 ) {
   221 							&mci_status) == 0 ) {
   222 				cdrom->track[i].offset = MSF_TO_FRAMES(
   222 				cdrom->track[i - 1].length = MSF_TO_FRAMES(
   223 					MCI_MSF_MINUTE(mci_status.dwReturn),
   223 					MCI_MSF_MINUTE(mci_status.dwReturn),
   224 					MCI_MSF_SECOND(mci_status.dwReturn),
   224 					MCI_MSF_SECOND(mci_status.dwReturn),
   225 					MCI_MSF_FRAME(mci_status.dwReturn));
   225 					MCI_MSF_FRAME(mci_status.dwReturn)) + 1; /* +1 to fix */
       
   226 											/* MCI last track length bug */
       
   227 				/* compute lead-out offset */
       
   228 				cdrom->track[i].offset = cdrom->track[i - 1].offset +
       
   229 					cdrom->track[i - 1].length;
   226 				cdrom->track[i].length = 0;
   230 				cdrom->track[i].length = 0;
   227 				cdrom->track[i-1].length =
       
   228 						cdrom->track[i].offset-
       
   229 						cdrom->track[i-1].offset;
       
   230 				okay = 1;
   231 				okay = 1;
   231 			}
   232 			}
   232 		}
   233 		}
   233 	}
   234 	}
   234 	return(okay ? 0 : -1);
   235 	return(okay ? 0 : -1);