Mercurial > sdl-ios-xcode
annotate src/cdrom/os2/SDL_syscdrom.c @ 1554:0ca607a5d173
Fixed bug #84
Date: Sun, 23 Oct 2005 16:39:03 +0200
From: "A. Schmid" <sahib@phreaker.net>
Subject: [SDL] no software surfaces with svgalib driver?
Hi,
I noticed that the SDL (1.2.9) svgalib driver only makes use of linear
addressable (framebuffer) video modes. On older systems (like one of
mine), linear addressable modes are often not available.
Especially for cards with VESA VBE < 2.0 the svgalib vesa driver is
unusable, since VESA only supports framebuffering for VBE 2.0 and later.
The changes necessary to add support for software surfaces seem to be
relatively small. I only had to hack src/video/svga/SDL_svgavideo.c (see
attached patch). The code worked fine for me, but it is no more than a
proof of concept and should be reviewed (probably has a memory leak when
switching modes). It also uses the vgagl library (included in the
svgalib package) and needs to be linked against it.
-Alex
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sun, 19 Mar 2006 12:04:40 +0000 |
parents | e3242177fe4a |
children | 92947e3a18db |
rev | line source |
---|---|
1190 | 1 /* |
2 SDL - Simple DirectMedia Layer | |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1190
diff
changeset
|
3 Copyright (C) 1997-2006 Sam Lantinga |
1190 | 4 |
5 This library is free software; you can redistribute it and/or | |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1190
diff
changeset
|
6 modify it under the terms of the GNU Lesser General Public |
1190 | 7 License as published by the Free Software Foundation; either |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1190
diff
changeset
|
8 version 2.1 of the License, or (at your option) any later version. |
1190 | 9 |
10 This library is distributed in the hope that it will be useful, | |
11 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1190
diff
changeset
|
13 Lesser General Public License for more details. |
1190 | 14 |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1190
diff
changeset
|
15 You should have received a copy of the GNU Lesser General Public |
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1190
diff
changeset
|
16 License along with this library; if not, write to the Free Software |
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1190
diff
changeset
|
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
1190 | 18 |
19 Sam Lantinga | |
20 slouken@libsdl.org | |
21 */ | |
1402
d910939febfa
Use consistent identifiers for the various platforms we support.
Sam Lantinga <slouken@libsdl.org>
parents:
1379
diff
changeset
|
22 #include "SDL_config.h" |
1190 | 23 |
24 /* Functions for system-level CD-ROM audio control */ | |
25 | |
26 #define INCL_MCIOS2 | |
27 #include <os2.h> | |
28 #include <os2me.h> | |
29 | |
30 #include "SDL_cdrom.h" | |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
31 #include "../SDL_syscdrom.h" |
1190 | 32 |
33 /* Size of MCI result buffer (in bytes) */ | |
34 #define MCI_CMDRETBUFSIZE 128 | |
35 | |
36 /* The maximum number of CD-ROM drives we'll detect */ | |
37 #define MAX_DRIVES 16 | |
38 | |
39 /* A list of available CD-ROM drives */ | |
40 static char *SDL_cdlist[MAX_DRIVES]; | |
41 //static dev_t SDL_cdmode[MAX_DRIVES]; | |
42 | |
43 /* The system-dependent CD control functions */ | |
44 static const char *SDL_SYS_CDName(int drive); | |
45 static int SDL_SYS_CDOpen(int drive); | |
46 static int SDL_SYS_CDGetTOC(SDL_CD *cdrom); | |
47 static CDstatus SDL_SYS_CDStatus(SDL_CD *cdrom, int *position); | |
48 static int SDL_SYS_CDPlay(SDL_CD *cdrom, int start, int length); | |
49 static int SDL_SYS_CDPause(SDL_CD *cdrom); | |
50 static int SDL_SYS_CDResume(SDL_CD *cdrom); | |
51 static int SDL_SYS_CDStop(SDL_CD *cdrom); | |
52 static int SDL_SYS_CDEject(SDL_CD *cdrom); | |
53 static void SDL_SYS_CDClose(SDL_CD *cdrom); | |
54 | |
55 /* MCI Timing Functions */ | |
56 #define MCI_MMTIMEPERSECOND 3000 | |
57 #define FRAMESFROMMM(mmtime) (((mmtime)*CD_FPS)/MCI_MMTIMEPERSECOND) | |
58 | |
59 | |
60 /* Ready for MCI CDAudio Devices */ | |
61 int SDL_SYS_CDInit(void) | |
62 { | |
63 int i; /* generig counter */ | |
64 MCI_SYSINFO_PARMS msp; /* Structure to MCI SysInfo parameters */ | |
65 CHAR SysInfoRet[MCI_CMDRETBUFSIZE]; /* Buffer for MCI Command result */ | |
66 | |
67 /* Fill in our driver capabilities */ | |
68 SDL_CDcaps.Name = SDL_SYS_CDName; | |
69 SDL_CDcaps.Open = SDL_SYS_CDOpen; | |
70 SDL_CDcaps.GetTOC = SDL_SYS_CDGetTOC; | |
71 SDL_CDcaps.Status = SDL_SYS_CDStatus; | |
72 SDL_CDcaps.Play = SDL_SYS_CDPlay; | |
73 SDL_CDcaps.Pause = SDL_SYS_CDPause; | |
74 SDL_CDcaps.Resume = SDL_SYS_CDResume; | |
75 SDL_CDcaps.Stop = SDL_SYS_CDStop; | |
76 SDL_CDcaps.Eject = SDL_SYS_CDEject; | |
77 SDL_CDcaps.Close = SDL_SYS_CDClose; | |
78 | |
79 /* Get the number of CD ROMs in the System */ | |
80 /* Clean SysInfo structure */ | |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
81 SDL_memset(&msp, 0x00, sizeof(MCI_SYSINFO_PARMS)); |
1190 | 82 /* Prepare structure to Ask Numer of Audio CDs */ |
83 msp.usDeviceType = MCI_DEVTYPE_CD_AUDIO; /* CD Audio Type */ | |
84 msp.pszReturn = (PSZ)&SysInfoRet; /* Return Structure */ | |
85 msp.ulRetSize = MCI_CMDRETBUFSIZE; /* Size of ret struct */ | |
86 if (LOUSHORT(mciSendCommand(0,MCI_SYSINFO, MCI_SYSINFO_QUANTITY | MCI_WAIT, (PVOID)&msp, 0)) != MCIERR_SUCCESS) return(CD_ERROR); | |
87 SDL_numcds = atoi(SysInfoRet); | |
88 if (SDL_numcds > MAX_DRIVES) SDL_numcds = MAX_DRIVES; /* Limit maximum CD number */ | |
89 | |
90 /* Get and Add their system name to the SDL_cdlist */ | |
91 msp.pszReturn = (PSZ)&SysInfoRet; /* Return Structure */ | |
92 msp.ulRetSize = MCI_CMDRETBUFSIZE; /* Size of ret struct */ | |
93 msp.usDeviceType = MCI_DEVTYPE_CD_AUDIO; /* CD Audio Type */ | |
94 for (i=0; i<SDL_numcds; i++) | |
95 { | |
96 msp.ulNumber = i+1; | |
97 mciSendCommand(0,MCI_SYSINFO, MCI_SYSINFO_NAME | MCI_WAIT,&msp, 0); | |
1379
c0a74f199ecf
Use only safe string functions
Sam Lantinga <slouken@libsdl.org>
parents:
1361
diff
changeset
|
98 SDL_cdlist[i] = SDL_strdup(SysInfoRet); |
1190 | 99 if ( SDL_cdlist[i] == NULL ) |
100 { | |
101 SDL_OutOfMemory(); | |
102 return(-1); | |
103 } | |
104 } | |
105 return(0); | |
106 } | |
107 | |
108 /* Return CDAudio System Dependent Device Name - Ready for MCI*/ | |
109 static const char *SDL_SYS_CDName(int drive) | |
110 { | |
111 return(SDL_cdlist[drive]); | |
112 } | |
113 | |
114 /* Open CDAudio Device - Ready for MCI */ | |
115 static int SDL_SYS_CDOpen(int drive) | |
116 { | |
117 MCI_OPEN_PARMS mop; | |
118 MCI_SET_PARMS msp; | |
119 MCI_GENERIC_PARMS mgp; | |
120 | |
121 /* Open the device */ | |
122 mop.hwndCallback = (HWND)NULL; // None | |
123 mop.usDeviceID = (USHORT)NULL; // Will be returned. | |
124 mop.pszDeviceType = (PSZ)SDL_cdlist[drive]; // CDAudio Device | |
125 if (LOUSHORT(mciSendCommand(0,MCI_OPEN,MCI_WAIT,&mop, 0)) != MCIERR_SUCCESS) return(CD_ERROR); | |
126 /* Set time format */ | |
127 msp.hwndCallback = (HWND)NULL; // None | |
128 msp.ulTimeFormat = MCI_FORMAT_MSF; // Minute : Second : Frame structure | |
129 msp.ulSpeedFormat = (ULONG)NULL; // No change | |
130 msp.ulAudio = (ULONG)NULL; // No Channel | |
131 msp.ulLevel = (ULONG)NULL; // No Volume | |
132 msp.ulOver = (ULONG)NULL; // No Delay | |
133 msp.ulItem = (ULONG)NULL; // No item | |
134 msp.ulValue = (ULONG)NULL; // No value for item flag | |
135 if (LOUSHORT(mciSendCommand(mop.usDeviceID,MCI_SET,MCI_WAIT | MCI_SET_TIME_FORMAT,&msp, 0)) == MCIERR_SUCCESS) return (mop.usDeviceID); | |
136 /* Error setting time format? - Close opened device */ | |
137 mgp.hwndCallback = (HWND)NULL; // None | |
138 mciSendCommand(mop.usDeviceID,MCI_CLOSE,MCI_WAIT,&mgp, 0); | |
139 return(CD_ERROR); | |
140 } | |
141 | |
142 /* Get CD Table Of Contents - Ready for MCI */ | |
143 static int SDL_SYS_CDGetTOC(SDL_CD *cdrom) | |
144 { | |
145 MCI_TOC_PARMS mtp; | |
146 MCI_STATUS_PARMS msp; | |
147 MCI_TOC_REC * mtr; | |
148 INT i; | |
149 | |
150 /* Correction because MCI cannot read TOC while CD is playing (it'll stop!) */ | |
151 if (cdrom->status == CD_PLAYING || cdrom->status == CD_PAUSED) return 0; | |
152 | |
153 /* Get Number of Tracks */ | |
154 msp.hwndCallback = (HWND)NULL; /* None */ | |
155 msp.ulReturn = (ULONG)NULL; /* We want this information */ | |
156 msp.ulItem = MCI_STATUS_NUMBER_OF_TRACKS; | |
157 msp.ulValue = (ULONG)NULL; /* No additional information */ | |
158 if (LOUSHORT(mciSendCommand(cdrom->id,MCI_STATUS,MCI_WAIT | MCI_STATUS_ITEM,&msp, 0)) != MCIERR_SUCCESS) return(CD_ERROR); | |
159 cdrom->numtracks = msp.ulReturn; | |
160 if ( cdrom->numtracks > SDL_MAX_TRACKS ) | |
161 { | |
162 cdrom->numtracks = SDL_MAX_TRACKS; | |
163 } | |
164 /* Alocate space for TOC data */ | |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
165 mtr = (MCI_TOC_REC *)SDL_malloc(cdrom->numtracks*sizeof(MCI_TOC_REC)); |
1190 | 166 if ( mtr == NULL ) |
167 { | |
168 SDL_OutOfMemory(); | |
169 return(-1); | |
170 } | |
171 /* Get TOC from CD */ | |
172 mtp.pBuf = mtr; | |
173 mtp.ulBufSize = cdrom->numtracks*sizeof(MCI_TOC_REC); | |
174 if (LOUSHORT(mciSendCommand(cdrom->id,MCI_GETTOC,MCI_WAIT,&mtp, 0)) != MCIERR_SUCCESS) | |
175 { | |
176 SDL_OutOfMemory(); | |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
177 SDL_free(mtr); |
1190 | 178 return(CD_ERROR); |
179 } | |
180 /* Fill SDL Tracks Structure */ | |
181 for (i=0; i<cdrom->numtracks; i++) | |
182 { | |
183 /* Set Track ID */ | |
184 cdrom->track[i].id = (mtr+i)->TrackNum; | |
185 /* Set Track Type */ | |
186 msp.hwndCallback = (HWND)NULL; /* None */ | |
187 msp.ulReturn = (ULONG)NULL; /* We want this information */ | |
188 msp.ulItem = MCI_CD_STATUS_TRACK_TYPE; | |
189 msp.ulValue = (ULONG)((mtr+i)->TrackNum); /* Track Number? */ | |
190 if (LOUSHORT(mciSendCommand(cdrom->id,MCI_STATUS,MCI_WAIT | MCI_TRACK | MCI_STATUS_ITEM,&msp, 0)) != MCIERR_SUCCESS) | |
191 { | |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
192 SDL_free(mtr); |
1190 | 193 return (CD_ERROR); |
194 } | |
195 if (msp.ulReturn==MCI_CD_TRACK_AUDIO) cdrom->track[i].type = SDL_AUDIO_TRACK; | |
196 else cdrom->track[i].type = SDL_DATA_TRACK; | |
197 /* Set Track Length - values from MCI are in MMTIMEs - 3000 MMTIME = 1 second */ | |
198 cdrom->track[i].length = FRAMESFROMMM((mtr+i)->ulEndAddr - (mtr+i)->ulStartAddr); | |
199 /* Set Track Offset */ | |
200 cdrom->track[i].offset = FRAMESFROMMM((mtr+i)->ulStartAddr); | |
201 } | |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
202 SDL_free(mtr); |
1190 | 203 return(0); |
204 } | |
205 | |
206 | |
207 /* Get CD-ROM status - Ready for MCI */ | |
208 static CDstatus SDL_SYS_CDStatus(SDL_CD *cdrom, int *position) | |
209 { | |
210 CDstatus status; | |
211 MCI_STATUS_PARMS msp; | |
212 | |
213 /* Get Status from MCI */ | |
214 msp.hwndCallback = (HWND)NULL; /* None */ | |
215 msp.ulReturn = (ULONG)NULL; /* We want this information */ | |
216 msp.ulItem = MCI_STATUS_MODE; | |
217 msp.ulValue = (ULONG)NULL; /* No additional information */ | |
218 if (LOUSHORT(mciSendCommand(cdrom->id,MCI_STATUS,MCI_WAIT | MCI_STATUS_ITEM,&msp, 0)) != MCIERR_SUCCESS) status = CD_ERROR; | |
219 else | |
220 { | |
221 switch(msp.ulReturn) | |
222 { | |
223 case MCI_MODE_NOT_READY: | |
224 status = CD_TRAYEMPTY; | |
225 break; | |
226 case MCI_MODE_PAUSE: | |
227 status = CD_PAUSED; | |
228 break; | |
229 case MCI_MODE_PLAY: | |
230 status = CD_PLAYING; | |
231 break; | |
232 case MCI_MODE_STOP: | |
233 status = CD_STOPPED; | |
234 break; | |
235 /* These cases should not occour */ | |
236 case MCI_MODE_RECORD: | |
237 case MCI_MODE_SEEK: | |
238 default: | |
239 status = CD_ERROR; | |
240 break; | |
241 } | |
242 } | |
243 | |
244 /* Determine position */ | |
245 if (position != NULL) /* The SDL $&$&%# CDROM call sends NULL pointer here! */ | |
246 { | |
247 if ((status == CD_PLAYING) || (status == CD_PAUSED)) | |
248 { | |
249 /* Get Position */ | |
250 msp.hwndCallback = (HWND)NULL; /* None */ | |
251 msp.ulReturn = (ULONG)NULL; /* We want this information */ | |
252 msp.ulItem = MCI_STATUS_POSITION; | |
253 msp.ulValue = (ULONG)NULL; /* No additiona info */ | |
254 if (LOUSHORT(mciSendCommand(cdrom->id,MCI_STATUS,MCI_WAIT | MCI_STATUS_ITEM,&msp, 0)) != MCIERR_SUCCESS) return (CD_ERROR); | |
255 /* Convert from MSF (format selected in the Open process) to Frames (format that will be returned) */ | |
256 *position = MSF_TO_FRAMES(MSF_MINUTE(msp.ulReturn),MSF_SECOND(msp.ulReturn),MSF_FRAME(msp.ulReturn)); | |
257 } | |
258 else *position = 0; | |
259 } | |
260 return(status); | |
261 } | |
262 | |
263 /* Start play - Ready for MCI */ | |
264 static int SDL_SYS_CDPlay(SDL_CD *cdrom, int start, int length) | |
265 { | |
266 MCI_GENERIC_PARMS mgp; | |
267 MCI_STATUS_PARMS msp; | |
268 MCI_PLAY_PARMS mpp; | |
269 ULONG min,sec,frm; | |
270 | |
271 /* Start MSF */ | |
272 FRAMES_TO_MSF(start, &min, &sec, &frm); | |
273 MSF_MINUTE(mpp.ulFrom) = min; | |
274 MSF_SECOND(mpp.ulFrom) = sec; | |
275 MSF_FRAME(mpp.ulFrom) = frm; | |
276 /* End MSF */ | |
277 FRAMES_TO_MSF(start+length, &min, &sec, &frm); | |
278 MSF_MINUTE(mpp.ulTo) = min; | |
279 MSF_SECOND(mpp.ulTo) = sec; | |
280 MSF_FRAME(mpp.ulTo) = frm; | |
281 #ifdef DEBUG_CDROM | |
282 fprintf(stderr, "Trying to play from %d:%d:%d to %d:%d:%d\n", | |
283 playtime.cdmsf_min0, playtime.cdmsf_sec0, playtime.cdmsf_frame0, | |
284 playtime.cdmsf_min1, playtime.cdmsf_sec1, playtime.cdmsf_frame1); | |
285 #endif | |
286 /* Verifies if it is paused first... and if it is, unpause before stopping it. */ | |
287 msp.hwndCallback = (HWND)NULL; /* None */ | |
288 msp.ulReturn = (ULONG)NULL; /* We want this information */ | |
289 msp.ulItem = MCI_STATUS_MODE; | |
290 msp.ulValue = (ULONG)NULL; /* No additional information */ | |
291 if (LOUSHORT(mciSendCommand(cdrom->id,MCI_STATUS,MCI_WAIT | MCI_STATUS_ITEM,&msp, 0)) == MCIERR_SUCCESS) | |
292 { | |
293 if (msp.ulReturn == MCI_MODE_PAUSE) | |
294 { | |
295 mgp.hwndCallback = (HWND)NULL; // None | |
1442
e3242177fe4a
Updated OS/2 build, yay!
Sam Lantinga <slouken@libsdl.org>
parents:
1402
diff
changeset
|
296 mciSendCommand(cdrom->id,MCI_RESUME,0,&mgp, 0); |
1190 | 297 } |
298 } | |
299 /* Now play it. */ | |
300 mpp.hwndCallback = (HWND)NULL; // We do not want the info. temp | |
301 if (LOUSHORT(mciSendCommand(cdrom->id,MCI_PLAY,MCI_FROM | MCI_TO,&mpp, 0)) == MCIERR_SUCCESS) return 0; | |
302 return (CD_ERROR); | |
303 } | |
304 | |
305 /* Pause play - Ready for MCI */ | |
306 static int SDL_SYS_CDPause(SDL_CD *cdrom) | |
307 { | |
308 MCI_GENERIC_PARMS mgp; | |
309 | |
310 mgp.hwndCallback = (HWND)NULL; // None | |
311 if (LOUSHORT(mciSendCommand(cdrom->id,MCI_PAUSE,MCI_WAIT,&mgp, 0)) == MCIERR_SUCCESS) return 0; | |
312 return(CD_ERROR); | |
313 } | |
314 | |
315 /* Resume play - Ready for MCI */ | |
316 static int SDL_SYS_CDResume(SDL_CD *cdrom) | |
317 { | |
318 MCI_GENERIC_PARMS mgp; | |
319 | |
320 mgp.hwndCallback = (HWND)NULL; // None | |
321 if (LOUSHORT(mciSendCommand(cdrom->id,MCI_RESUME,MCI_WAIT,&mgp, 0)) == MCIERR_SUCCESS) return 0; | |
322 return(CD_ERROR); | |
323 } | |
324 | |
325 /* Stop play - Ready for MCI */ | |
326 static int SDL_SYS_CDStop(SDL_CD *cdrom) | |
327 { | |
328 MCI_GENERIC_PARMS mgp; | |
329 MCI_STATUS_PARMS msp; | |
330 | |
331 /* Verifies if it is paused first... and if it is, unpause before stopping it. */ | |
332 msp.hwndCallback = (HWND)NULL; /* None */ | |
333 msp.ulReturn = (ULONG)NULL; /* We want this information */ | |
334 msp.ulItem = MCI_STATUS_MODE; | |
335 msp.ulValue = (ULONG)NULL; /* No additional information */ | |
336 if (LOUSHORT(mciSendCommand(cdrom->id,MCI_STATUS,MCI_WAIT | MCI_STATUS_ITEM,&msp, 0)) == MCIERR_SUCCESS) | |
337 { | |
338 if (msp.ulReturn == MCI_MODE_PAUSE) | |
339 { | |
340 mgp.hwndCallback = (HWND)NULL; // None | |
1442
e3242177fe4a
Updated OS/2 build, yay!
Sam Lantinga <slouken@libsdl.org>
parents:
1402
diff
changeset
|
341 mciSendCommand(cdrom->id,MCI_RESUME,0,&mgp, 0); |
1190 | 342 } |
343 } | |
344 /* Now stops the media */ | |
345 mgp.hwndCallback = (HWND)NULL; // None | |
346 if (LOUSHORT(mciSendCommand(cdrom->id,MCI_STOP,MCI_WAIT,&mgp, 0)) == MCIERR_SUCCESS) return 0; | |
347 return(CD_ERROR); | |
348 } | |
349 | |
350 /* Eject the CD-ROM - Ready for MCI */ | |
351 static int SDL_SYS_CDEject(SDL_CD *cdrom) | |
352 { | |
353 MCI_SET_PARMS msp; | |
354 | |
355 msp.hwndCallback = (HWND)NULL; // None | |
356 msp.ulTimeFormat = (ULONG)NULL; // No change | |
357 msp.ulSpeedFormat = (ULONG)NULL; // No change | |
358 msp.ulAudio = (ULONG)NULL; // No Channel | |
359 msp.ulLevel = (ULONG)NULL; // No Volume | |
360 msp.ulOver = (ULONG)NULL; // No Delay | |
361 msp.ulItem = (ULONG)NULL; // No item | |
362 msp.ulValue = (ULONG)NULL; // No value for item flag | |
363 if (LOUSHORT(mciSendCommand(cdrom->id,MCI_SET,MCI_WAIT | MCI_SET_DOOR_OPEN,&msp, 0)) == MCIERR_SUCCESS) return 0; | |
364 return(CD_ERROR); | |
365 } | |
366 | |
367 /* Close the CD-ROM handle - Ready for MCI */ | |
368 static void SDL_SYS_CDClose(SDL_CD *cdrom) | |
369 { | |
370 MCI_GENERIC_PARMS mgp; | |
371 | |
372 mgp.hwndCallback = (HWND)NULL; // None | |
373 mciSendCommand(cdrom->id,MCI_CLOSE,MCI_WAIT,&mgp, 0); | |
374 } | |
375 | |
376 /* Finalize CDROM Subsystem - Ready for MCI */ | |
377 void SDL_SYS_CDQuit(void) | |
378 { | |
379 int i; | |
380 | |
381 if ( SDL_numcds > 0 ) | |
382 { | |
383 for ( i=0; i<SDL_numcds; ++i ) | |
384 { | |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
385 SDL_free(SDL_cdlist[i]); |
1190 | 386 } |
387 SDL_numcds = 0; | |
388 } | |
389 } | |
390 |