Mercurial > sdl-ios-xcode
annotate src/cdrom/os2/SDL_syscdrom.c @ 1662:782fd950bd46 SDL-1.3
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
WARNING: None of the video drivers have been updated for the new API yet! The API is still under design and very fluid.
The code is now run through a consistent indent format:
indent -i4 -nut -nsc -br -ce
The headers are being converted to automatically generate doxygen documentation.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sun, 28 May 2006 13:04:16 +0000 |
parents | 92947e3a18db |
children | 4da1ee79c9af |
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 |
1635
92947e3a18db
Make sure code is only compiled if the appropriate subsystem is enabled
Sam Lantinga <slouken@libsdl.org>
parents:
1442
diff
changeset
|
24 #ifdef SDL_CDROM_OS2 |
92947e3a18db
Make sure code is only compiled if the appropriate subsystem is enabled
Sam Lantinga <slouken@libsdl.org>
parents:
1442
diff
changeset
|
25 |
1190 | 26 /* Functions for system-level CD-ROM audio control */ |
27 | |
28 #define INCL_MCIOS2 | |
29 #include <os2.h> | |
30 #include <os2me.h> | |
31 | |
32 #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
|
33 #include "../SDL_syscdrom.h" |
1190 | 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 */ | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
39 #define MAX_DRIVES 16 |
1190 | 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 */ | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
46 static const char *SDL_SYS_CDName (int drive); |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
47 static int SDL_SYS_CDOpen (int drive); |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
48 static int SDL_SYS_CDGetTOC (SDL_CD * cdrom); |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
49 static CDstatus SDL_SYS_CDStatus (SDL_CD * cdrom, int *position); |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
50 static int SDL_SYS_CDPlay (SDL_CD * cdrom, int start, int length); |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
51 static int SDL_SYS_CDPause (SDL_CD * cdrom); |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
52 static int SDL_SYS_CDResume (SDL_CD * cdrom); |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
53 static int SDL_SYS_CDStop (SDL_CD * cdrom); |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
54 static int SDL_SYS_CDEject (SDL_CD * cdrom); |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
55 static void SDL_SYS_CDClose (SDL_CD * cdrom); |
1190 | 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 */ | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
63 int |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
64 SDL_SYS_CDInit (void) |
1190 | 65 { |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
66 int i; /* generig counter */ |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
67 MCI_SYSINFO_PARMS msp; /* Structure to MCI SysInfo parameters */ |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
68 CHAR SysInfoRet[MCI_CMDRETBUFSIZE]; /* Buffer for MCI Command result */ |
1190 | 69 |
70 /* Fill in our driver capabilities */ | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
71 SDL_CDcaps.Name = SDL_SYS_CDName; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
72 SDL_CDcaps.Open = SDL_SYS_CDOpen; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
73 SDL_CDcaps.GetTOC = SDL_SYS_CDGetTOC; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
74 SDL_CDcaps.Status = SDL_SYS_CDStatus; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
75 SDL_CDcaps.Play = SDL_SYS_CDPlay; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
76 SDL_CDcaps.Pause = SDL_SYS_CDPause; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
77 SDL_CDcaps.Resume = SDL_SYS_CDResume; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
78 SDL_CDcaps.Stop = SDL_SYS_CDStop; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
79 SDL_CDcaps.Eject = SDL_SYS_CDEject; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
80 SDL_CDcaps.Close = SDL_SYS_CDClose; |
1190 | 81 |
82 /* Get the number of CD ROMs in the System */ | |
83 /* Clean SysInfo structure */ | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
84 SDL_memset (&msp, 0x00, sizeof (MCI_SYSINFO_PARMS)); |
1190 | 85 /* Prepare structure to Ask Numer of Audio CDs */ |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
86 msp.usDeviceType = MCI_DEVTYPE_CD_AUDIO; /* CD Audio Type */ |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
87 msp.pszReturn = (PSZ) & SysInfoRet; /* Return Structure */ |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
88 msp.ulRetSize = MCI_CMDRETBUFSIZE; /* Size of ret struct */ |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
89 if (LOUSHORT |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
90 (mciSendCommand |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
91 (0, MCI_SYSINFO, MCI_SYSINFO_QUANTITY | MCI_WAIT, (PVOID) & msp, |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
92 0)) != MCIERR_SUCCESS) |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
93 return (CD_ERROR); |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
94 SDL_numcds = atoi (SysInfoRet); |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
95 if (SDL_numcds > MAX_DRIVES) |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
96 SDL_numcds = MAX_DRIVES; /* Limit maximum CD number */ |
1190 | 97 |
98 /* Get and Add their system name to the SDL_cdlist */ | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
99 msp.pszReturn = (PSZ) & SysInfoRet; /* Return Structure */ |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
100 msp.ulRetSize = MCI_CMDRETBUFSIZE; /* Size of ret struct */ |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
101 msp.usDeviceType = MCI_DEVTYPE_CD_AUDIO; /* CD Audio Type */ |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
102 for (i = 0; i < SDL_numcds; i++) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
103 msp.ulNumber = i + 1; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
104 mciSendCommand (0, MCI_SYSINFO, MCI_SYSINFO_NAME | MCI_WAIT, &msp, 0); |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
105 SDL_cdlist[i] = SDL_strdup (SysInfoRet); |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
106 if (SDL_cdlist[i] == NULL) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
107 SDL_OutOfMemory (); |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
108 return (-1); |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
109 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
110 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
111 return (0); |
1190 | 112 } |
113 | |
114 /* Return CDAudio System Dependent Device Name - Ready for MCI*/ | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
115 static const char * |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
116 SDL_SYS_CDName (int drive) |
1190 | 117 { |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
118 return (SDL_cdlist[drive]); |
1190 | 119 } |
120 | |
121 /* Open CDAudio Device - Ready for MCI */ | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
122 static int |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
123 SDL_SYS_CDOpen (int drive) |
1190 | 124 { |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
125 MCI_OPEN_PARMS mop; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
126 MCI_SET_PARMS msp; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
127 MCI_GENERIC_PARMS mgp; |
1190 | 128 |
129 /* Open the device */ | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
130 mop.hwndCallback = (HWND) NULL; // None |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
131 mop.usDeviceID = (USHORT) NULL; // Will be returned. |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
132 mop.pszDeviceType = (PSZ) SDL_cdlist[drive]; // CDAudio Device |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
133 if (LOUSHORT (mciSendCommand (0, MCI_OPEN, MCI_WAIT, &mop, 0)) != |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
134 MCIERR_SUCCESS) |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
135 return (CD_ERROR); |
1190 | 136 /* Set time format */ |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
137 msp.hwndCallback = (HWND) NULL; // None |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
138 msp.ulTimeFormat = MCI_FORMAT_MSF; // Minute : Second : Frame structure |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
139 msp.ulSpeedFormat = (ULONG) NULL; // No change |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
140 msp.ulAudio = (ULONG) NULL; // No Channel |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
141 msp.ulLevel = (ULONG) NULL; // No Volume |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
142 msp.ulOver = (ULONG) NULL; // No Delay |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
143 msp.ulItem = (ULONG) NULL; // No item |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
144 msp.ulValue = (ULONG) NULL; // No value for item flag |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
145 if (LOUSHORT |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
146 (mciSendCommand |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
147 (mop.usDeviceID, MCI_SET, MCI_WAIT | MCI_SET_TIME_FORMAT, &msp, |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
148 0)) == MCIERR_SUCCESS) |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
149 return (mop.usDeviceID); |
1190 | 150 /* Error setting time format? - Close opened device */ |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
151 mgp.hwndCallback = (HWND) NULL; // None |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
152 mciSendCommand (mop.usDeviceID, MCI_CLOSE, MCI_WAIT, &mgp, 0); |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
153 return (CD_ERROR); |
1190 | 154 } |
155 | |
156 /* Get CD Table Of Contents - Ready for MCI */ | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
157 static int |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
158 SDL_SYS_CDGetTOC (SDL_CD * cdrom) |
1190 | 159 { |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
160 MCI_TOC_PARMS mtp; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
161 MCI_STATUS_PARMS msp; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
162 MCI_TOC_REC *mtr; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
163 INT i; |
1190 | 164 |
165 /* Correction because MCI cannot read TOC while CD is playing (it'll stop!) */ | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
166 if (cdrom->status == CD_PLAYING || cdrom->status == CD_PAUSED) |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
167 return 0; |
1190 | 168 |
169 /* Get Number of Tracks */ | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
170 msp.hwndCallback = (HWND) NULL; /* None */ |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
171 msp.ulReturn = (ULONG) NULL; /* We want this information */ |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
172 msp.ulItem = MCI_STATUS_NUMBER_OF_TRACKS; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
173 msp.ulValue = (ULONG) NULL; /* No additional information */ |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
174 if (LOUSHORT |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
175 (mciSendCommand |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
176 (cdrom->id, MCI_STATUS, MCI_WAIT | MCI_STATUS_ITEM, &msp, |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
177 0)) != MCIERR_SUCCESS) |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
178 return (CD_ERROR); |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
179 cdrom->numtracks = msp.ulReturn; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
180 if (cdrom->numtracks > SDL_MAX_TRACKS) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
181 cdrom->numtracks = SDL_MAX_TRACKS; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
182 } |
1190 | 183 /* Alocate space for TOC data */ |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
184 mtr = |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
185 (MCI_TOC_REC *) SDL_malloc (cdrom->numtracks * sizeof (MCI_TOC_REC)); |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
186 if (mtr == NULL) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
187 SDL_OutOfMemory (); |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
188 return (-1); |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
189 } |
1190 | 190 /* Get TOC from CD */ |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
191 mtp.pBuf = mtr; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
192 mtp.ulBufSize = cdrom->numtracks * sizeof (MCI_TOC_REC); |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
193 if (LOUSHORT (mciSendCommand (cdrom->id, MCI_GETTOC, MCI_WAIT, &mtp, 0)) |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
194 != MCIERR_SUCCESS) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
195 SDL_OutOfMemory (); |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
196 SDL_free (mtr); |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
197 return (CD_ERROR); |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
198 } |
1190 | 199 /* Fill SDL Tracks Structure */ |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
200 for (i = 0; i < cdrom->numtracks; i++) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
201 /* Set Track ID */ |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
202 cdrom->track[i].id = (mtr + i)->TrackNum; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
203 /* Set Track Type */ |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
204 msp.hwndCallback = (HWND) NULL; /* None */ |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
205 msp.ulReturn = (ULONG) NULL; /* We want this information */ |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
206 msp.ulItem = MCI_CD_STATUS_TRACK_TYPE; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
207 msp.ulValue = (ULONG) ((mtr + i)->TrackNum); /* Track Number? */ |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
208 if (LOUSHORT |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
209 (mciSendCommand |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
210 (cdrom->id, MCI_STATUS, MCI_WAIT | MCI_TRACK | MCI_STATUS_ITEM, |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
211 &msp, 0)) != MCIERR_SUCCESS) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
212 SDL_free (mtr); |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
213 return (CD_ERROR); |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
214 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
215 if (msp.ulReturn == MCI_CD_TRACK_AUDIO) |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
216 cdrom->track[i].type = SDL_AUDIO_TRACK; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
217 else |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
218 cdrom->track[i].type = SDL_DATA_TRACK; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
219 /* Set Track Length - values from MCI are in MMTIMEs - 3000 MMTIME = 1 second */ |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
220 cdrom->track[i].length = |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
221 FRAMESFROMMM ((mtr + i)->ulEndAddr - (mtr + i)->ulStartAddr); |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
222 /* Set Track Offset */ |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
223 cdrom->track[i].offset = FRAMESFROMMM ((mtr + i)->ulStartAddr); |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
224 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
225 SDL_free (mtr); |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
226 return (0); |
1190 | 227 } |
228 | |
229 | |
230 /* Get CD-ROM status - Ready for MCI */ | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
231 static CDstatus |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
232 SDL_SYS_CDStatus (SDL_CD * cdrom, int *position) |
1190 | 233 { |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
234 CDstatus status; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
235 MCI_STATUS_PARMS msp; |
1190 | 236 |
237 /* Get Status from MCI */ | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
238 msp.hwndCallback = (HWND) NULL; /* None */ |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
239 msp.ulReturn = (ULONG) NULL; /* We want this information */ |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
240 msp.ulItem = MCI_STATUS_MODE; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
241 msp.ulValue = (ULONG) NULL; /* No additional information */ |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
242 if (LOUSHORT |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
243 (mciSendCommand |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
244 (cdrom->id, MCI_STATUS, MCI_WAIT | MCI_STATUS_ITEM, &msp, |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
245 0)) != MCIERR_SUCCESS) |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
246 status = CD_ERROR; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
247 else { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
248 switch (msp.ulReturn) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
249 case MCI_MODE_NOT_READY: |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
250 status = CD_TRAYEMPTY; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
251 break; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
252 case MCI_MODE_PAUSE: |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
253 status = CD_PAUSED; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
254 break; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
255 case MCI_MODE_PLAY: |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
256 status = CD_PLAYING; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
257 break; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
258 case MCI_MODE_STOP: |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
259 status = CD_STOPPED; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
260 break; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
261 /* These cases should not occour */ |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
262 case MCI_MODE_RECORD: |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
263 case MCI_MODE_SEEK: |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
264 default: |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
265 status = CD_ERROR; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
266 break; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
267 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
268 } |
1190 | 269 |
270 /* Determine position */ | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
271 if (position != NULL) { /* The SDL $&$&%# CDROM call sends NULL pointer here! */ |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
272 if ((status == CD_PLAYING) || (status == CD_PAUSED)) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
273 /* Get Position */ |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
274 msp.hwndCallback = (HWND) NULL; /* None */ |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
275 msp.ulReturn = (ULONG) NULL; /* We want this information */ |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
276 msp.ulItem = MCI_STATUS_POSITION; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
277 msp.ulValue = (ULONG) NULL; /* No additiona info */ |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
278 if (LOUSHORT |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
279 (mciSendCommand |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
280 (cdrom->id, MCI_STATUS, MCI_WAIT | MCI_STATUS_ITEM, &msp, |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
281 0)) != MCIERR_SUCCESS) |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
282 return (CD_ERROR); |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
283 /* Convert from MSF (format selected in the Open process) to Frames (format that will be returned) */ |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
284 *position = |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
285 MSF_TO_FRAMES (MSF_MINUTE (msp.ulReturn), |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
286 MSF_SECOND (msp.ulReturn), |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
287 MSF_FRAME (msp.ulReturn)); |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
288 } else |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
289 *position = 0; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
290 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
291 return (status); |
1190 | 292 } |
293 | |
294 /* Start play - Ready for MCI */ | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
295 static int |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
296 SDL_SYS_CDPlay (SDL_CD * cdrom, int start, int length) |
1190 | 297 { |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
298 MCI_GENERIC_PARMS mgp; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
299 MCI_STATUS_PARMS msp; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
300 MCI_PLAY_PARMS mpp; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
301 ULONG min, sec, frm; |
1190 | 302 |
303 /* Start MSF */ | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
304 FRAMES_TO_MSF (start, &min, &sec, &frm); |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
305 MSF_MINUTE (mpp.ulFrom) = min; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
306 MSF_SECOND (mpp.ulFrom) = sec; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
307 MSF_FRAME (mpp.ulFrom) = frm; |
1190 | 308 /* End MSF */ |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
309 FRAMES_TO_MSF (start + length, &min, &sec, &frm); |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
310 MSF_MINUTE (mpp.ulTo) = min; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
311 MSF_SECOND (mpp.ulTo) = sec; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
312 MSF_FRAME (mpp.ulTo) = frm; |
1190 | 313 #ifdef DEBUG_CDROM |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
314 fprintf (stderr, "Trying to play from %d:%d:%d to %d:%d:%d\n", |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
315 playtime.cdmsf_min0, playtime.cdmsf_sec0, playtime.cdmsf_frame0, |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
316 playtime.cdmsf_min1, playtime.cdmsf_sec1, playtime.cdmsf_frame1); |
1190 | 317 #endif |
318 /* Verifies if it is paused first... and if it is, unpause before stopping it. */ | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
319 msp.hwndCallback = (HWND) NULL; /* None */ |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
320 msp.ulReturn = (ULONG) NULL; /* We want this information */ |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
321 msp.ulItem = MCI_STATUS_MODE; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
322 msp.ulValue = (ULONG) NULL; /* No additional information */ |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
323 if (LOUSHORT |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
324 (mciSendCommand |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
325 (cdrom->id, MCI_STATUS, MCI_WAIT | MCI_STATUS_ITEM, &msp, |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
326 0)) == MCIERR_SUCCESS) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
327 if (msp.ulReturn == MCI_MODE_PAUSE) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
328 mgp.hwndCallback = (HWND) NULL; // None |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
329 mciSendCommand (cdrom->id, MCI_RESUME, 0, &mgp, 0); |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
330 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
331 } |
1190 | 332 /* Now play it. */ |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
333 mpp.hwndCallback = (HWND) NULL; // We do not want the info. temp |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
334 if (LOUSHORT |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
335 (mciSendCommand (cdrom->id, MCI_PLAY, MCI_FROM | MCI_TO, &mpp, 0)) == |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
336 MCIERR_SUCCESS) |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
337 return 0; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
338 return (CD_ERROR); |
1190 | 339 } |
340 | |
341 /* Pause play - Ready for MCI */ | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
342 static int |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
343 SDL_SYS_CDPause (SDL_CD * cdrom) |
1190 | 344 { |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
345 MCI_GENERIC_PARMS mgp; |
1190 | 346 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
347 mgp.hwndCallback = (HWND) NULL; // None |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
348 if (LOUSHORT (mciSendCommand (cdrom->id, MCI_PAUSE, MCI_WAIT, &mgp, 0)) == |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
349 MCIERR_SUCCESS) |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
350 return 0; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
351 return (CD_ERROR); |
1190 | 352 } |
353 | |
354 /* Resume play - Ready for MCI */ | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
355 static int |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
356 SDL_SYS_CDResume (SDL_CD * cdrom) |
1190 | 357 { |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
358 MCI_GENERIC_PARMS mgp; |
1190 | 359 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
360 mgp.hwndCallback = (HWND) NULL; // None |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
361 if (LOUSHORT (mciSendCommand (cdrom->id, MCI_RESUME, MCI_WAIT, &mgp, 0)) |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
362 == MCIERR_SUCCESS) |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
363 return 0; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
364 return (CD_ERROR); |
1190 | 365 } |
366 | |
367 /* Stop play - Ready for MCI */ | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
368 static int |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
369 SDL_SYS_CDStop (SDL_CD * cdrom) |
1190 | 370 { |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
371 MCI_GENERIC_PARMS mgp; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
372 MCI_STATUS_PARMS msp; |
1190 | 373 |
374 /* Verifies if it is paused first... and if it is, unpause before stopping it. */ | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
375 msp.hwndCallback = (HWND) NULL; /* None */ |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
376 msp.ulReturn = (ULONG) NULL; /* We want this information */ |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
377 msp.ulItem = MCI_STATUS_MODE; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
378 msp.ulValue = (ULONG) NULL; /* No additional information */ |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
379 if (LOUSHORT |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
380 (mciSendCommand |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
381 (cdrom->id, MCI_STATUS, MCI_WAIT | MCI_STATUS_ITEM, &msp, |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
382 0)) == MCIERR_SUCCESS) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
383 if (msp.ulReturn == MCI_MODE_PAUSE) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
384 mgp.hwndCallback = (HWND) NULL; // None |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
385 mciSendCommand (cdrom->id, MCI_RESUME, 0, &mgp, 0); |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
386 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
387 } |
1190 | 388 /* Now stops the media */ |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
389 mgp.hwndCallback = (HWND) NULL; // None |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
390 if (LOUSHORT (mciSendCommand (cdrom->id, MCI_STOP, MCI_WAIT, &mgp, 0)) == |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
391 MCIERR_SUCCESS) |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
392 return 0; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
393 return (CD_ERROR); |
1190 | 394 } |
395 | |
396 /* Eject the CD-ROM - Ready for MCI */ | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
397 static int |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
398 SDL_SYS_CDEject (SDL_CD * cdrom) |
1190 | 399 { |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
400 MCI_SET_PARMS msp; |
1190 | 401 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
402 msp.hwndCallback = (HWND) NULL; // None |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
403 msp.ulTimeFormat = (ULONG) NULL; // No change |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
404 msp.ulSpeedFormat = (ULONG) NULL; // No change |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
405 msp.ulAudio = (ULONG) NULL; // No Channel |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
406 msp.ulLevel = (ULONG) NULL; // No Volume |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
407 msp.ulOver = (ULONG) NULL; // No Delay |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
408 msp.ulItem = (ULONG) NULL; // No item |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
409 msp.ulValue = (ULONG) NULL; // No value for item flag |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
410 if (LOUSHORT |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
411 (mciSendCommand |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
412 (cdrom->id, MCI_SET, MCI_WAIT | MCI_SET_DOOR_OPEN, &msp, |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
413 0)) == MCIERR_SUCCESS) |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
414 return 0; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
415 return (CD_ERROR); |
1190 | 416 } |
417 | |
418 /* Close the CD-ROM handle - Ready for MCI */ | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
419 static void |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
420 SDL_SYS_CDClose (SDL_CD * cdrom) |
1190 | 421 { |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
422 MCI_GENERIC_PARMS mgp; |
1190 | 423 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
424 mgp.hwndCallback = (HWND) NULL; // None |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
425 mciSendCommand (cdrom->id, MCI_CLOSE, MCI_WAIT, &mgp, 0); |
1190 | 426 } |
427 | |
428 /* Finalize CDROM Subsystem - Ready for MCI */ | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
429 void |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
430 SDL_SYS_CDQuit (void) |
1190 | 431 { |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
432 int i; |
1190 | 433 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
434 if (SDL_numcds > 0) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
435 for (i = 0; i < SDL_numcds; ++i) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
436 SDL_free (SDL_cdlist[i]); |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
437 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
438 SDL_numcds = 0; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
439 } |
1190 | 440 } |
441 | |
1635
92947e3a18db
Make sure code is only compiled if the appropriate subsystem is enabled
Sam Lantinga <slouken@libsdl.org>
parents:
1442
diff
changeset
|
442 #endif /* SDL_CDROM_OS2 */ |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1635
diff
changeset
|
443 /* vi: set ts=4 sw=4 expandtab: */ |