| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323 |
- /*
- ** Command & Conquer Generals(tm)
- ** Copyright 2025 Electronic Arts Inc.
- **
- ** This program is free software: you can redistribute it and/or modify
- ** it under the terms of the GNU General Public License as published by
- ** the Free Software Foundation, either version 3 of the License, or
- ** (at your option) any later version.
- **
- ** This program is distributed in the hope that it will be useful,
- ** but WITHOUT ANY WARRANTY; without even the implied warranty of
- ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- ** GNU General Public License for more details.
- **
- ** You should have received a copy of the GNU General Public License
- ** along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
- /************************************************************************************************
- *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ****
- ************************************************************************************************
- * *
- * Project Name : Command & Conquer *
- * *
- * $Archive:: /Renegade Setup/Autorun/GetCD.h $Author:: Denzil_l *
- * $Modtime:: 1/08/02 3:38p $Revision:: 20 *
- * *
- *----------------------------------------------------------------------------------------------*
- * Functions: *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
- #pragma once
- #ifndef GETCD_H
- #define GETCD_H
- extern char * _CD_Volume_Label[];
- extern int _Num_Volumes;
- #ifdef NOT_FOR_WIN95
- /* ==================================================================== */
- /* Defines */
- /* ==================================================================== */
- #define CHLEFT 0
- #define CHRIGHT 1
- #define CHBOTH 2
- #define AUDIO_START_MIN 1
- #define AUDIO_START_SEC 44
- struct SEGSEL {
- unsigned short seg ;
- unsigned short sel ;
- };
- extern "C" int DPMI_real_alloc ( UINT , SEGSEL * , USHORT * ) ;
- extern "C" int DPMI_real_free ( SEGSEL ) ;
- extern "C" void DPMI_real_intr ( int , union REGS * , struct SREGS * );
- extern "C" void DPMI_real_call ( void * funct , union REGS * , struct SREGS * );
- /* ==================================================================== */
- /* Data structures */
- /* ==================================================================== */
- //-----------------------------------------------------------------------------
- // Audio Track Info request block
- //-----------------------------------------------------------------------------
- #pragma pack(push, 1)
- struct TinfoType {
- UBYTE Length;
- UBYTE SubCd;
- UBYTE Command;
- UWORD Status;
- UBYTE Rsvd[8];
- UBYTE MDescr;
- UWORD TrnsAdOff;
- UWORD TrnsAdSeg;
- UWORD CntTrns;
- UWORD StSect;
- UWORD VolIDOff;
- UWORD VolIDSeg;
- UBYTE TrInfo;
- UBYTE Track;
- ULONG Start;
- UBYTE TrCtrl;
- };
- #pragma pack(pop)
- //-----------------------------------------------------------------------------
- // Audio Track Status Control Block
- //-----------------------------------------------------------------------------
- #pragma pack(push, 1)
- struct StatType {
- UBYTE Length;
- UBYTE SubCd;
- UBYTE Command;
- UWORD Status;
- UBYTE Rsvd[8];
- UBYTE MDescr;
- UWORD TrnsAdOff;
- UWORD TrnsAdSeg;
- UWORD CntTrns;
- UWORD StSect;
- UWORD VolIDOff;
- UWORD VolIDSeg;
- UBYTE StatInfo;
- UWORD Stat;
- ULONG Start;
- ULONG End;
- };
- #pragma pack(pop)
- //-----------------------------------------------------------------------------
- // Audio Track Volume control block
- //-----------------------------------------------------------------------------
- #pragma pack(push, 1)
- struct VolmType {
- UBYTE Length;
- UBYTE SubCd;
- UBYTE Command;
- UWORD Status;
- UBYTE Rsvd[8];
- UBYTE MDescr;
- UWORD TrnsAdOff;
- UWORD TrnsAdSeg;
- UWORD CntTrns;
- UWORD StSect;
- UWORD VolIDOff;
- UWORD VolIDSeg;
- UBYTE TrInfo;
- UBYTE In0;
- UBYTE Vol0;
- UBYTE In1;
- UBYTE Vol1;
- UBYTE In2;
- UBYTE Vol2;
- UBYTE In3;
- UBYTE Vol3;
- };
- #pragma pack(pop)
- //-----------------------------------------------------------------------------
- // Audio Track Play request block
- //-----------------------------------------------------------------------------
- #pragma pack(push, 1)
- struct PlayType {
- UBYTE Length;
- UBYTE SubCd;
- UBYTE Command;
- UWORD Status;
- UBYTE Rsvd[8];
- UBYTE AddrMd;
- ULONG Start;
- ULONG CntSect;
- };
- #pragma pack(pop)
- //-----------------------------------------------------------------------------
- // Audio Track Stop request block
- //-----------------------------------------------------------------------------
- #pragma pack(push, 1)
- struct StopType {
- UBYTE Length;
- UBYTE SubCd;
- UBYTE Command;
- UWORD Status;
- UBYTE Rsvd[8];
- };
- #pragma pack(pop)
- #endif //NOT_FOR_WIN95
- /****************************************************************************
- * GetCDClass -- object which will return logical CD drive *
- * *
- * HISTORY: *
- * 06/04/1994 SW : Created. *
- *==========================================================================*/
- #define MAX_CD_DRIVES 26
- #define NO_CD_DRIVE -1
- class GetCDClass
- {
- public:
- GetCDClass ( void ); // This is the default constructor
- ~GetCDClass ( void ); // This is the destructor
- inline int Get_First_CD_Drive ( void );
- inline int Get_Next_CD_Drive ( void );
- inline int Get_Number_Of_Drives ( void ) { return( CDCount ); };
- inline int Get_Index ( void ) { return( CDIndex ); };
- inline void Reset_Index ( void ) { CDIndex = 0; };
- int Get_CD_Drive_For_This_Volume ( char *volume_name );
- char * Get_Volume_For_This_CD_Drive ( char *path, char *volume_name );
- char * Get_Volume_Label ( int index );
- protected:
- int CDDrives[ MAX_CD_DRIVES ]; //Array containing CD drive letters
- int CDCount; //Number of available CD drives
- int CDIndex; //Index of current location
- };
- /****************************************************************************
- * GCDC::Get_First_CD_Drive -- return the number of the first CD drive *
- * *
- * INPUT: none *
- * *
- * OUTPUT: logical drive number *
- * *
- * WARNINGS: *
- * *
- * HISTORY: *
- * 05/26/1994 SW : Created. *
- * 12/4/95 ST : fixed for Win95 *
- *==========================================================================*/
- inline int GetCDClass::Get_First_CD_Drive(void)
- {
- CDIndex = 0;
- return (Get_Next_CD_Drive());
- }
- /************************************************************************************
- * GCDC::Get_Next_CD_Drive -- return the logical drive number of the next CD drive *
- * *
- * INPUT: Nothing *
- * *
- * OUTPUT: Logical drive number of a cd drive or -1 if none *
- * *
- * WARNINGS: None *
- * *
- * HISTORY: *
- * 5/21/96 3:50PM ST : Created *
- *==================================================================================*/
- inline int GetCDClass::Get_Next_CD_Drive(void)
- {
- if (CDCount){
- if (CDIndex >= CDCount) {
- CDIndex = 0;
- }
- return (CDDrives[CDIndex++]);
- } else {
- return (-1);
- }
- }
- /************************************************************************************
- * RedBookClass -- adds red book functionality *
- * *
- * this class inherits from GetCDClass and adds red book play functionality *
- * *
- * *
- * HISTORY: *
- * 06/04/1994 SW : Created. *
- *==================================================================================*/
- #ifdef NOT_FOR_WIN95
- class RedBookClass : public GetCDClass
- {
- public:
- RedBookClass(void); // This is the default constructor
- ~RedBookClass(void); // This is the destructor
- ULONG RedToHS(ULONG i);
- ULONG MSFtoRed(UBYTE m, UBYTE s, UBYTE f);
- void FullCDVolume(UBYTE chan);
- void PlayTrack(UWORD track);
- void Play_CD_MSL(UWORD min_sec, UWORD len);
- void PlayMSF(UBYTE startM, UBYTE startS, UBYTE startF,
- UBYTE endM, UBYTE endS, UBYTE endF, UBYTE chan);
- UWORD CheckCDMusic(void);
- void StopCDMusic(void);
- private:
- SEGSEL Tinfo_addrp;
- SEGSEL Stat_addrp;
- SEGSEL Stop_addrp;
- SEGSEL Volm_addrp;
- SEGSEL Play_addrp;
- StopType Stop;
- PlayType Play;
- VolmType Volm;
- StatType Stat;
- TinfoType Tinfo;
- };
- #endif //NOT_FOR_WIN95
- /***************************** End of Playcd.h ****************************/
- extern GetCDClass CDList;
- //-----------------------------------------------------------------------------
- // Functions
- //-----------------------------------------------------------------------------
- bool CD_Volume_Verification ( int cd_drive, char *volume_label, char *volume_to_find );
- #endif // PLAYCD_H
|