Mercurial > sdl-ios-xcode
annotate src/cdrom/os2/SDL_syscdrom.c @ 1348:40d0975c1769
Date: Mon, 6 Feb 2006 11:41:04 -0500
From: "mystml@adinet.com.uy"
Subject: [SDL] ALT-F4 using DirectX
My game isn't getting SDL_QUIT when I press ALT-F4 using the DirectX
driver; it does get SDL_QUIT when I press the red X in the window.
I tracked this down to DX5_HandleMessage() in SDL_dx5events.c;
WM_SYSKEYDOWN is being trapped and ignored which causes Windows not to post
a WM_CLOSE, hence no SDL_QUIT is being generated.
The relevant code is this :
/* The keyboard is handled via DirectInput */
case WM_SYSKEYUP:
case WM_SYSKEYDOWN:
case WM_KEYUP:
case WM_KEYDOWN: {
/* Ignore windows keyboard messages */;
}
return(0);
If I comment the WM_SYSKEYDOWN case, it falls through DefWindowProc() and
ALT-F4 starts working again.
I'm not sure about the best way to fix this. One option is handling ALT-F4
as a particular case somehow, but doesn't sound good. Another option would
be to handle WM_SYSKEYDOWN separately and breaking instead of returning 0,
so processing falls through and goes to DefWindowProc which does The Right
Thing (TM). This seems to be the minimal change that makes ALT-F4 work and
normal keyboard input continues to work.
Does this sound reasonable? Am I overlooking anything? Do I submit a patch?
--Gabriel
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Wed, 08 Feb 2006 17:19:43 +0000 |
parents | 604d73db6802 |
children | c71e05b4dc2e |
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 */ | |
22 | |
23 /* Functions for system-level CD-ROM audio control */ | |
24 | |
25 #define INCL_MCIOS2 | |
26 #include <os2.h> | |
27 #include <os2me.h> | |
28 | |
1338
604d73db6802
Removed uses of stdlib.h and string.h
Sam Lantinga <slouken@libsdl.org>
parents:
1336
diff
changeset
|
29 #include "SDL_stdlib.h" |
604d73db6802
Removed uses of stdlib.h and string.h
Sam Lantinga <slouken@libsdl.org>
parents:
1336
diff
changeset
|
30 #include "SDL_string.h" |
1190 | 31 #include "SDL_error.h" |
32 #include "SDL_cdrom.h" | |
33 #include "SDL_syscdrom.h" | |
34 | |
35 /* Size of MCI result buffer (in bytes) */ | |
36 #define MCI_CMDRETBUFSIZE 128 | |
37 | |
38 /* The maximum number of CD-ROM drives we'll detect */ | |
39 #define MAX_DRIVES 16 | |
40 | |
41 /* A list of available CD-ROM drives */ | |
42 static char *SDL_cdlist[MAX_DRIVES]; | |
43 //static dev_t SDL_cdmode[MAX_DRIVES]; | |
44 | |
45 /* The system-dependent CD control functions */ | |
46 static const char *SDL_SYS_CDName(int drive); | |
47 static int SDL_SYS_CDOpen(int drive); | |
48 static int SDL_SYS_CDGetTOC(SDL_CD *cdrom); | |
49 static CDstatus SDL_SYS_CDStatus(SDL_CD *cdrom, int *position); | |
50 static int SDL_SYS_CDPlay(SDL_CD *cdrom, int start, int length); | |
51 static int SDL_SYS_CDPause(SDL_CD *cdrom); | |
52 static int SDL_SYS_CDResume(SDL_CD *cdrom); | |
53 static int SDL_SYS_CDStop(SDL_CD *cdrom); | |
54 static int SDL_SYS_CDEject(SDL_CD *cdrom); | |
55 static void SDL_SYS_CDClose(SDL_CD *cdrom); | |
56 | |
57 /* MCI Timing Functions */ | |
58 #define MCI_MMTIMEPERSECOND 3000 | |
59 #define FRAMESFROMMM(mmtime) (((mmtime)*CD_FPS)/MCI_MMTIMEPERSECOND) | |
60 | |
61 | |
62 /* Ready for MCI CDAudio Devices */ | |
63 int SDL_SYS_CDInit(void) | |
64 { | |
65 int i; /* generig counter */ | |
66 MCI_SYSINFO_PARMS msp; /* Structure to MCI SysInfo parameters */ | |
67 CHAR SysInfoRet[MCI_CMDRETBUFSIZE]; /* Buffer for MCI Command result */ | |
68 | |
69 /* Fill in our driver capabilities */ | |
70 SDL_CDcaps.Name = SDL_SYS_CDName; | |
71 SDL_CDcaps.Open = SDL_SYS_CDOpen; | |
72 SDL_CDcaps.GetTOC = SDL_SYS_CDGetTOC; | |
73 SDL_CDcaps.Status = SDL_SYS_CDStatus; | |
74 SDL_CDcaps.Play = SDL_SYS_CDPlay; | |
75 SDL_CDcaps.Pause = SDL_SYS_CDPause; | |
76 SDL_CDcaps.Resume = SDL_SYS_CDResume; | |
77 SDL_CDcaps.Stop = SDL_SYS_CDStop; | |
78 SDL_CDcaps.Eject = SDL_SYS_CDEject; | |
79 SDL_CDcaps.Close = SDL_SYS_CDClose; | |
80 | |
81 /* Get the number of CD ROMs in the System */ | |
82 /* Clean SysInfo structure */ | |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
83 SDL_memset(&msp, 0x00, sizeof(MCI_SYSINFO_PARMS)); |
1190 | 84 /* Prepare structure to Ask Numer of Audio CDs */ |
85 msp.usDeviceType = MCI_DEVTYPE_CD_AUDIO; /* CD Audio Type */ | |
86 msp.pszReturn = (PSZ)&SysInfoRet; /* Return Structure */ | |
87 msp.ulRetSize = MCI_CMDRETBUFSIZE; /* Size of ret struct */ | |
88 if (LOUSHORT(mciSendCommand(0,MCI_SYSINFO, MCI_SYSINFO_QUANTITY | MCI_WAIT, (PVOID)&msp, 0)) != MCIERR_SUCCESS) return(CD_ERROR); | |
89 SDL_numcds = atoi(SysInfoRet); | |
90 if (SDL_numcds > MAX_DRIVES) SDL_numcds = MAX_DRIVES; /* Limit maximum CD number */ | |
91 | |
92 /* Get and Add their system name to the SDL_cdlist */ | |
93 msp.pszReturn = (PSZ)&SysInfoRet; /* Return Structure */ | |
94 msp.ulRetSize = MCI_CMDRETBUFSIZE; /* Size of ret struct */ | |
95 msp.usDeviceType = MCI_DEVTYPE_CD_AUDIO; /* CD Audio Type */ | |
96 for (i=0; i<SDL_numcds; i++) | |
97 { | |
98 msp.ulNumber = i+1; | |
99 mciSendCommand(0,MCI_SYSINFO, MCI_SYSINFO_NAME | MCI_WAIT,&msp, 0); | |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
100 SDL_cdlist[i] = (char *)SDL_malloc(SDL_strlen(SysInfoRet)+1); |
1190 | 101 if ( SDL_cdlist[i] == NULL ) |
102 { | |
103 SDL_OutOfMemory(); | |
104 return(-1); | |
105 } | |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
106 SDL_strcpy(SDL_cdlist[i], SysInfoRet); |
1190 | 107 } |
108 return(0); | |
109 } | |
110 | |
111 /* Return CDAudio System Dependent Device Name - Ready for MCI*/ | |
112 static const char *SDL_SYS_CDName(int drive) | |
113 { | |
114 return(SDL_cdlist[drive]); | |
115 } | |
116 | |
117 /* Open CDAudio Device - Ready for MCI */ | |
118 static int SDL_SYS_CDOpen(int drive) | |
119 { | |
120 MCI_OPEN_PARMS mop; | |
121 MCI_SET_PARMS msp; | |
122 MCI_GENERIC_PARMS mgp; | |
123 | |
124 /* Open the device */ | |
125 mop.hwndCallback = (HWND)NULL; // None | |
126 mop.usDeviceID = (USHORT)NULL; // Will be returned. | |
127 mop.pszDeviceType = (PSZ)SDL_cdlist[drive]; // CDAudio Device | |
128 if (LOUSHORT(mciSendCommand(0,MCI_OPEN,MCI_WAIT,&mop, 0)) != MCIERR_SUCCESS) return(CD_ERROR); | |
129 /* Set time format */ | |
130 msp.hwndCallback = (HWND)NULL; // None | |
131 msp.ulTimeFormat = MCI_FORMAT_MSF; // Minute : Second : Frame structure | |
132 msp.ulSpeedFormat = (ULONG)NULL; // No change | |
133 msp.ulAudio = (ULONG)NULL; // No Channel | |
134 msp.ulLevel = (ULONG)NULL; // No Volume | |
135 msp.ulOver = (ULONG)NULL; // No Delay | |
136 msp.ulItem = (ULONG)NULL; // No item | |
137 msp.ulValue = (ULONG)NULL; // No value for item flag | |
138 if (LOUSHORT(mciSendCommand(mop.usDeviceID,MCI_SET,MCI_WAIT | MCI_SET_TIME_FORMAT,&msp, 0)) == MCIERR_SUCCESS) return (mop.usDeviceID); | |
139 /* Error setting time format? - Close opened device */ | |
140 mgp.hwndCallback = (HWND)NULL; // None | |
141 mciSendCommand(mop.usDeviceID,MCI_CLOSE,MCI_WAIT,&mgp, 0); | |
142 return(CD_ERROR); | |
143 } | |
144 | |
145 /* Get CD Table Of Contents - Ready for MCI */ | |
146 static int SDL_SYS_CDGetTOC(SDL_CD *cdrom) | |
147 { | |
148 MCI_TOC_PARMS mtp; | |
149 MCI_STATUS_PARMS msp; | |
150 MCI_TOC_REC * mtr; | |
151 INT i; | |
152 | |
153 /* Correction because MCI cannot read TOC while CD is playing (it'll stop!) */ | |
154 if (cdrom->status == CD_PLAYING || cdrom->status == CD_PAUSED) return 0; | |
155 | |
156 /* Get Number of Tracks */ | |
157 msp.hwndCallback = (HWND)NULL; /* None */ | |
158 msp.ulReturn = (ULONG)NULL; /* We want this information */ | |
159 msp.ulItem = MCI_STATUS_NUMBER_OF_TRACKS; | |
160 msp.ulValue = (ULONG)NULL; /* No additional information */ | |
161 if (LOUSHORT(mciSendCommand(cdrom->id,MCI_STATUS,MCI_WAIT | MCI_STATUS_ITEM,&msp, 0)) != MCIERR_SUCCESS) return(CD_ERROR); | |
162 cdrom->numtracks = msp.ulReturn; | |
163 if ( cdrom->numtracks > SDL_MAX_TRACKS ) | |
164 { | |
165 cdrom->numtracks = SDL_MAX_TRACKS; | |
166 } | |
167 /* Alocate space for TOC data */ | |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
168 mtr = (MCI_TOC_REC *)SDL_malloc(cdrom->numtracks*sizeof(MCI_TOC_REC)); |
1190 | 169 if ( mtr == NULL ) |
170 { | |
171 SDL_OutOfMemory(); | |
172 return(-1); | |
173 } | |
174 /* Get TOC from CD */ | |
175 mtp.pBuf = mtr; | |
176 mtp.ulBufSize = cdrom->numtracks*sizeof(MCI_TOC_REC); | |
177 if (LOUSHORT(mciSendCommand(cdrom->id,MCI_GETTOC,MCI_WAIT,&mtp, 0)) != MCIERR_SUCCESS) | |
178 { | |
179 SDL_OutOfMemory(); | |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
180 SDL_free(mtr); |
1190 | 181 return(CD_ERROR); |
182 } | |
183 /* Fill SDL Tracks Structure */ | |
184 for (i=0; i<cdrom->numtracks; i++) | |
185 { | |
186 /* Set Track ID */ | |
187 cdrom->track[i].id = (mtr+i)->TrackNum; | |
188 /* Set Track Type */ | |
189 msp.hwndCallback = (HWND)NULL; /* None */ | |
190 msp.ulReturn = (ULONG)NULL; /* We want this information */ | |
191 msp.ulItem = MCI_CD_STATUS_TRACK_TYPE; | |
192 msp.ulValue = (ULONG)((mtr+i)->TrackNum); /* Track Number? */ | |
193 if (LOUSHORT(mciSendCommand(cdrom->id,MCI_STATUS,MCI_WAIT | MCI_TRACK | MCI_STATUS_ITEM,&msp, 0)) != MCIERR_SUCCESS) | |
194 { | |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
195 SDL_free(mtr); |
1190 | 196 return (CD_ERROR); |
197 } | |
198 if (msp.ulReturn==MCI_CD_TRACK_AUDIO) cdrom->track[i].type = SDL_AUDIO_TRACK; | |
199 else cdrom->track[i].type = SDL_DATA_TRACK; | |
200 /* Set Track Length - values from MCI are in MMTIMEs - 3000 MMTIME = 1 second */ | |
201 cdrom->track[i].length = FRAMESFROMMM((mtr+i)->ulEndAddr - (mtr+i)->ulStartAddr); | |
202 /* Set Track Offset */ | |
203 cdrom->track[i].offset = FRAMESFROMMM((mtr+i)->ulStartAddr); | |
204 } | |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
205 SDL_free(mtr); |
1190 | 206 return(0); |
207 } | |
208 | |
209 | |
210 /* Get CD-ROM status - Ready for MCI */ | |
211 static CDstatus SDL_SYS_CDStatus(SDL_CD *cdrom, int *position) | |
212 { | |
213 CDstatus status; | |
214 MCI_STATUS_PARMS msp; | |
215 | |
216 /* Get Status from MCI */ | |
217 msp.hwndCallback = (HWND)NULL; /* None */ | |
218 msp.ulReturn = (ULONG)NULL; /* We want this information */ | |
219 msp.ulItem = MCI_STATUS_MODE; | |
220 msp.ulValue = (ULONG)NULL; /* No additional information */ | |
221 if (LOUSHORT(mciSendCommand(cdrom->id,MCI_STATUS,MCI_WAIT | MCI_STATUS_ITEM,&msp, 0)) != MCIERR_SUCCESS) status = CD_ERROR; | |
222 else | |
223 { | |
224 switch(msp.ulReturn) | |
225 { | |
226 case MCI_MODE_NOT_READY: | |
227 status = CD_TRAYEMPTY; | |
228 break; | |
229 case MCI_MODE_PAUSE: | |
230 status = CD_PAUSED; | |
231 break; | |
232 case MCI_MODE_PLAY: | |
233 status = CD_PLAYING; | |
234 break; | |
235 case MCI_MODE_STOP: | |
236 status = CD_STOPPED; | |
237 break; | |
238 /* These cases should not occour */ | |
239 case MCI_MODE_RECORD: | |
240 case MCI_MODE_SEEK: | |
241 default: | |
242 status = CD_ERROR; | |
243 break; | |
244 } | |
245 } | |
246 | |
247 /* Determine position */ | |
248 if (position != NULL) /* The SDL $&$&%# CDROM call sends NULL pointer here! */ | |
249 { | |
250 if ((status == CD_PLAYING) || (status == CD_PAUSED)) | |
251 { | |
252 /* Get Position */ | |
253 msp.hwndCallback = (HWND)NULL; /* None */ | |
254 msp.ulReturn = (ULONG)NULL; /* We want this information */ | |
255 msp.ulItem = MCI_STATUS_POSITION; | |
256 msp.ulValue = (ULONG)NULL; /* No additiona info */ | |
257 if (LOUSHORT(mciSendCommand(cdrom->id,MCI_STATUS,MCI_WAIT | MCI_STATUS_ITEM,&msp, 0)) != MCIERR_SUCCESS) return (CD_ERROR); | |
258 /* Convert from MSF (format selected in the Open process) to Frames (format that will be returned) */ | |
259 *position = MSF_TO_FRAMES(MSF_MINUTE(msp.ulReturn),MSF_SECOND(msp.ulReturn),MSF_FRAME(msp.ulReturn)); | |
260 } | |
261 else *position = 0; | |
262 } | |
263 return(status); | |
264 } | |
265 | |
266 /* Start play - Ready for MCI */ | |
267 static int SDL_SYS_CDPlay(SDL_CD *cdrom, int start, int length) | |
268 { | |
269 MCI_GENERIC_PARMS mgp; | |
270 MCI_STATUS_PARMS msp; | |
271 MCI_PLAY_PARMS mpp; | |
272 ULONG min,sec,frm; | |
273 | |
274 /* Start MSF */ | |
275 FRAMES_TO_MSF(start, &min, &sec, &frm); | |
276 MSF_MINUTE(mpp.ulFrom) = min; | |
277 MSF_SECOND(mpp.ulFrom) = sec; | |
278 MSF_FRAME(mpp.ulFrom) = frm; | |
279 /* End MSF */ | |
280 FRAMES_TO_MSF(start+length, &min, &sec, &frm); | |
281 MSF_MINUTE(mpp.ulTo) = min; | |
282 MSF_SECOND(mpp.ulTo) = sec; | |
283 MSF_FRAME(mpp.ulTo) = frm; | |
284 #ifdef DEBUG_CDROM | |
285 fprintf(stderr, "Trying to play from %d:%d:%d to %d:%d:%d\n", | |
286 playtime.cdmsf_min0, playtime.cdmsf_sec0, playtime.cdmsf_frame0, | |
287 playtime.cdmsf_min1, playtime.cdmsf_sec1, playtime.cdmsf_frame1); | |
288 #endif | |
289 /* Verifies if it is paused first... and if it is, unpause before stopping it. */ | |
290 msp.hwndCallback = (HWND)NULL; /* None */ | |
291 msp.ulReturn = (ULONG)NULL; /* We want this information */ | |
292 msp.ulItem = MCI_STATUS_MODE; | |
293 msp.ulValue = (ULONG)NULL; /* No additional information */ | |
294 if (LOUSHORT(mciSendCommand(cdrom->id,MCI_STATUS,MCI_WAIT | MCI_STATUS_ITEM,&msp, 0)) == MCIERR_SUCCESS) | |
295 { | |
296 if (msp.ulReturn == MCI_MODE_PAUSE) | |
297 { | |
298 mgp.hwndCallback = (HWND)NULL; // None | |
299 mciSendCommand(cdrom->id,MCI_RESUME,NULL,&mgp, 0); | |
300 } | |
301 } | |
302 /* Now play it. */ | |
303 mpp.hwndCallback = (HWND)NULL; // We do not want the info. temp | |
304 if (LOUSHORT(mciSendCommand(cdrom->id,MCI_PLAY,MCI_FROM | MCI_TO,&mpp, 0)) == MCIERR_SUCCESS) return 0; | |
305 return (CD_ERROR); | |
306 } | |
307 | |
308 /* Pause play - Ready for MCI */ | |
309 static int SDL_SYS_CDPause(SDL_CD *cdrom) | |
310 { | |
311 MCI_GENERIC_PARMS mgp; | |
312 | |
313 mgp.hwndCallback = (HWND)NULL; // None | |
314 if (LOUSHORT(mciSendCommand(cdrom->id,MCI_PAUSE,MCI_WAIT,&mgp, 0)) == MCIERR_SUCCESS) return 0; | |
315 return(CD_ERROR); | |
316 } | |
317 | |
318 /* Resume play - Ready for MCI */ | |
319 static int SDL_SYS_CDResume(SDL_CD *cdrom) | |
320 { | |
321 MCI_GENERIC_PARMS mgp; | |
322 | |
323 mgp.hwndCallback = (HWND)NULL; // None | |
324 if (LOUSHORT(mciSendCommand(cdrom->id,MCI_RESUME,MCI_WAIT,&mgp, 0)) == MCIERR_SUCCESS) return 0; | |
325 return(CD_ERROR); | |
326 } | |
327 | |
328 /* Stop play - Ready for MCI */ | |
329 static int SDL_SYS_CDStop(SDL_CD *cdrom) | |
330 { | |
331 MCI_GENERIC_PARMS mgp; | |
332 MCI_STATUS_PARMS msp; | |
333 | |
334 /* Verifies if it is paused first... and if it is, unpause before stopping it. */ | |
335 msp.hwndCallback = (HWND)NULL; /* None */ | |
336 msp.ulReturn = (ULONG)NULL; /* We want this information */ | |
337 msp.ulItem = MCI_STATUS_MODE; | |
338 msp.ulValue = (ULONG)NULL; /* No additional information */ | |
339 if (LOUSHORT(mciSendCommand(cdrom->id,MCI_STATUS,MCI_WAIT | MCI_STATUS_ITEM,&msp, 0)) == MCIERR_SUCCESS) | |
340 { | |
341 if (msp.ulReturn == MCI_MODE_PAUSE) | |
342 { | |
343 mgp.hwndCallback = (HWND)NULL; // None | |
344 mciSendCommand(cdrom->id,MCI_RESUME,NULL,&mgp, 0); | |
345 } | |
346 } | |
347 /* Now stops the media */ | |
348 mgp.hwndCallback = (HWND)NULL; // None | |
349 if (LOUSHORT(mciSendCommand(cdrom->id,MCI_STOP,MCI_WAIT,&mgp, 0)) == MCIERR_SUCCESS) return 0; | |
350 return(CD_ERROR); | |
351 } | |
352 | |
353 /* Eject the CD-ROM - Ready for MCI */ | |
354 static int SDL_SYS_CDEject(SDL_CD *cdrom) | |
355 { | |
356 MCI_SET_PARMS msp; | |
357 | |
358 msp.hwndCallback = (HWND)NULL; // None | |
359 msp.ulTimeFormat = (ULONG)NULL; // No change | |
360 msp.ulSpeedFormat = (ULONG)NULL; // No change | |
361 msp.ulAudio = (ULONG)NULL; // No Channel | |
362 msp.ulLevel = (ULONG)NULL; // No Volume | |
363 msp.ulOver = (ULONG)NULL; // No Delay | |
364 msp.ulItem = (ULONG)NULL; // No item | |
365 msp.ulValue = (ULONG)NULL; // No value for item flag | |
366 if (LOUSHORT(mciSendCommand(cdrom->id,MCI_SET,MCI_WAIT | MCI_SET_DOOR_OPEN,&msp, 0)) == MCIERR_SUCCESS) return 0; | |
367 return(CD_ERROR); | |
368 } | |
369 | |
370 /* Close the CD-ROM handle - Ready for MCI */ | |
371 static void SDL_SYS_CDClose(SDL_CD *cdrom) | |
372 { | |
373 MCI_GENERIC_PARMS mgp; | |
374 | |
375 mgp.hwndCallback = (HWND)NULL; // None | |
376 mciSendCommand(cdrom->id,MCI_CLOSE,MCI_WAIT,&mgp, 0); | |
377 } | |
378 | |
379 /* Finalize CDROM Subsystem - Ready for MCI */ | |
380 void SDL_SYS_CDQuit(void) | |
381 { | |
382 int i; | |
383 | |
384 if ( SDL_numcds > 0 ) | |
385 { | |
386 for ( i=0; i<SDL_numcds; ++i ) | |
387 { | |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
388 SDL_free(SDL_cdlist[i]); |
1190 | 389 } |
390 SDL_numcds = 0; | |
391 } | |
392 } | |
393 |