Initial commit of Command & Conquer Red Alert source code.

This commit is contained in:
LFeenanEA
2025-02-27 16:15:05 +00:00
parent b685cea758
commit 5e733d5dcc
2082 changed files with 797727 additions and 0 deletions

151
WWFLAT32/PLAYCD/GETCD.CPP Normal file
View File

@@ -0,0 +1,151 @@
/*
** Command & Conquer Red Alert(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 A S S O C I A T E S **
***************************************************************************
* *
* Project Name : WWLIB *
* *
* File Name : GETCD.CPP *
* *
* Programmer : STEVE WETHERILL BASED ON JOE BOSTIC CODE *
* *
* Start Date : 5/13/94 *
* *
* Last Update : June 4, 1994 [SW] *
* *
*-------------------------------------------------------------------------*
*-------------------------------------------------------------------------*
* Functions: *
* GetCDClass::GetCDClass -- default constructor *
* GetCDClass::~GetCDClass -- destructor *
* GetCDClass::GetCDDrive -- returns the logical CD drive *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <dos.h>
#include "wwstd.h"
#include "playcd.h"
#include "wwmem.h"
/***************************************************************************
* GetCDClass -- default constructor *
* *
* *
* *
* INPUT: *
* none *
* OUTPUT: *
* none *
* WARNINGS: *
* *
* HISTORY: *
* 05/26/1994 SW : Created. *
*=========================================================================*/
GetCDClass::GetCDClass(VOID)
{
memset ( this , 0 , sizeof ( GetCDClass ) ) ;
if (DPMI_real_alloc(2, &cdDrive_addrp, &largestp))
exit(1);
CDCount = 0;
CDIndex = 0;
/*
** Set all CD drive placeholders to empty
*/
memset (CDDrives, NO_CD_DRIVE, MAX_CD_DRIVES);
/*
** Dos will only currently support one cd drive so just
** set the first entry to it.
*/
GetCDDrives();
}
/***************************************************************************
* GetCDClass -- destructor *
* *
* *
* *
* INPUT: *
* none *
* OUTPUT: *
* none *
* WARNINGS: *
* *
* HISTORY: *
* 05/26/1994 SW: Created. *
*=========================================================================*/
GetCDClass::~GetCDClass(VOID)
{
if(cdDrive_addrp.seg)
DPMI_real_free(cdDrive_addrp); // free up those conventional buffers
}
/***************************************************************************
* GetCDDrive -- returns the logical CD drive *
* *
* *
* *
* INPUT: *
* none *
* OUTPUT: *
* WORD logical_drive *
* WARNINGS: *
* *
* HISTORY: *
* 05/26/1994 SW : Created. *
*=========================================================================*/
void GetCDClass::GetCDDrives(VOID)
{
for (int lp = 0; lp < 26; lp++ ) {
/*
** This call determines if the current specifed drive is a
** CD ROM drive.
** Input:
** AX = 150Bh
** CX = CD rom drive letter to check (A = 0, B = 1)
** Output:
** AX = non zero if drive is a CD ROM, zero if it is not.
** BX = Signature word (ADADh if CD rom extension are installed)
*/
sregs . es = cdDrive_addrp . seg ;
regs . x . ebx = 0;
regs . x . eax = 0x150B;
regs . x . ecx = lp;
DPMI_real_intr ( 0x2F , & regs , & sregs ) ;
if (regs.x.ebx == 0xADAD && regs.x.eax != 0) {
CDDrives[CDCount++] = lp;
}
}
}
/* ==================================================================== */

View File

@@ -0,0 +1,150 @@
/*
** Command & Conquer Red Alert(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 A S S O C I A T E S **
***************************************************************************
* *
* Project Name : WWLIB *
* *
* File Name : GETCD.CPP *
* *
* Programmer : STEVE WETHERILL BASED ON JOE BOSTIC CODE *
* *
* Start Date : 5/13/94 *
* *
* Last Update : June 4, 1994 [SW] *
* *
*-------------------------------------------------------------------------*
*-------------------------------------------------------------------------*
* Functions: *
* GetCDClass::GetCDClass -- default constructor *
* GetCDClass::~GetCDClass -- destructor *
* GetCDClass::GetCDDrive -- returns the logical CD drive *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <dos.h>
#include "wwstd.h"
#include "playcd.h"
#include "wwmem.h"
/***************************************************************************
* GetCDClass -- default constructor *
* *
* *
* *
* INPUT: *
* none *
* OUTPUT: *
* none *
* WARNINGS: *
* *
* HISTORY: *
* 05/26/1994 SW : Created. *
*=========================================================================*/
GetCDClass::GetCDClass(VOID)
{
memset ( this , 0 , sizeof ( GetCDClass ) ) ;
if (DPMI_real_alloc(2, &cdDrive_addrp, &largestp))
exit(1);
CDCount = 0;
CDIndex = 0;
/*
** Set all CD drive placeholders to empty
*/
memset (CDDrives, NO_CD_DRIVE, MAX_CD_DRIVES);
/*
** Dos will only currently support one cd drive so just
** set the first entry to it.
*/
GetCDDrives();
}
/***************************************************************************
* GetCDClass -- destructor *
* *
* *
* *
* INPUT: *
* none *
* OUTPUT: *
* none *
* WARNINGS: *
* *
* HISTORY: *
* 05/26/1994 SW: Created. *
*=========================================================================*/
GetCDClass::~GetCDClass(VOID)
{
if(cdDrive_addrp.seg)
DPMI_real_free(cdDrive_addrp); // free up those conventional buffers
}
/***************************************************************************
* GetCDDrive -- returns the logical CD drive *
* *
* *
* *
* INPUT: *
* none *
* OUTPUT: *
* WORD logical_drive *
* WARNINGS: *
* *
* HISTORY: *
* 05/26/1994 SW : Created. *
*=========================================================================*/
void GetCDClass::GetCDDrives(VOID)
{
for (int lp = 0; lp < 26; lp++ ) {
/*
** This call determines if the current specifed drive is a
** CD ROM drive.
** Input:
** AX = 150Bh
** CX = CD rom drive letter to check (A = 0, B = 1)
** Output:
** AX = non zero if drive is a CD ROM, zero if it is not.
** BX = Signature word (ADADh if CD rom extension are installed)
*/
sregs . es = cdDrive_addrp . seg ;
regs . x . ebx = 0;
regs . x . eax = 0x150B;
DPMI_real_intr ( 0x2F , & regs , & sregs ) ;
if (regs.x.ebx == 0xADAD && regs.x.eax != 0) {
CDDrives[CDCount++] = lp;
}
}
}
/* ==================================================================== */

184
WWFLAT32/PLAYCD/MAKEFILE Normal file
View File

@@ -0,0 +1,184 @@
#
# Command & Conquer Red Alert(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 : Westwood Library .LIB makefile *
#* *
#* File Name : MAKEFILE *
#* *
#* Programmer : Julio R. Jerez *
#* *
#* Start Date : Jan 27, 1995 *
#* *
#* *
#*-------------------------------------------------------------------------*
#* *
#* Required environment variables: *
#* WWFLAT = your root WWFLAT path *
#* WWVCS = root directory for wwlib version control archive *
#* WATCOM = your Watcom installation path *
#* *
#* Required changes to makefile: *
#* PROJ_NAME = name of the library you're building *
#* OBJECTS = list of objects in your library *
#* *
#* Optional changes to makefile: *
#* PROJ_DIR = full pathname of your working directory *
#* .path.xxx = full pathname where various file types live *
#* *
#***************************************************************************
#---------------------------------------------------------------------------
# Verify user's environment
#---------------------------------------------------------------------------
!ifndef %WWFLAT
!error WWFLAT Environment var not configured.
!endif
!ifndef %WWVCS
!error WWVCS Environment var not configured.
!endif
!ifndef %WATCOM
!error WATCOM Environment var not configured.
!endif
#===========================================================================
# User-defined section: the user should tailor this section for each project
#===========================================================================
PROJ_NAME = playcd
PROJ_DIR = $(%WWFLAT)\$(PROJ_NAME)
LIB_DIR = $(%WWFLAT)\lib
!include $(%WWFLAT)\project.cfg
#---------------------------------------------------------------------------
# Project-dependent variables
#---------------------------------------------------------------------------
OBJECTS = &
getcd.obj &
playcd.obj
# redbook.obj
# playcd.obj
#---------------------------------------------------------------------------
# Path macros: one path for each file type.
# These paths are used to tell make where to find/put each file type.
#---------------------------------------------------------------------------
.asm: $(PROJ_DIR)
.c: $(PROJ_DIR)
.cpp: $(PROJ_DIR)
.h: $(PROJ_DIR)
.obj: $(PROJ_DIR)
.lib: $(%WWFLAT)\lib
.exe: $(PROJ_DIR)
#===========================================================================
# Pre-defined section: there should be little need to modify this section.
#===========================================================================
#---------------------------------------------------------------------------
# Tools/commands
#---------------------------------------------------------------------------
C_CMD = wcc386
CPP_CMD = wpp386
LIB_CMD = wlib
LINK_CMD = wlink
ASM_CMD = tasm32
#---------------------------------------------------------------------------
# Include & library paths
# If LIB & INCLUDE are already defined, they are used in addition to the
# WWLIB32 lib & include; otherwise, they're constructed from
# BCDIR & TNTDIR
#---------------------------------------------------------------------------
LIBPATH = $(%WWFLAT)\LIB;$(%WATCOM)\LIB
INCLUDEPATH = $(%WWFLAT)\INCLUDE;$(%WATCOM)\H
#---------------------------------------------------------------------------
# Implicit rules
# Compiler:
# ($< = full dependent with path)
# Assembler:
# output obj's are constructed from .obj: & the $& macro
# ($< = full dependent with path)
# tasm's cfg file is not invoked as a response file.
#---------------------------------------------------------------------------
.c.obj: $(%WWFLAT)\project.cfg .AUTODEPEND
$(C_CMD) $(CC_CFG) $<
.cpp.obj: $(%WWFLAT)\project.cfg .AUTODEPEND
$(CPP_CMD) $(CC_CFG) $<
.asm.obj: $(%WWFLAT)\project.cfg
$(ASM_CMD) $(ASM_CFG) $<
#---------------------------------------------------------------------------
# Default target: configuration files & library (in that order)
#---------------------------------------------------------------------------
all: $(LIB_DIR)\$(PROJ_NAME).lib .SYMBOLIC
#---------------------------------------------------------------------------
# Build the library
# The original library is deleted by the librarian
# Lib objects & -+ commands are constructed by substituting within the
# $^@ macro (which expands to all target dependents, separated with
# spaces)
# Tlib's cfg file is not invoked as a response file.
# All headers & source files are copied into WWFLAT\SRCDEBUG, for debugging
#---------------------------------------------------------------------------
$(LIB_DIR)\$(PROJ_NAME).lib: $(OBJECTS) objects.lbc
copy *.h $(%WWFLAT)\include
copy *.inc $(%WWFLAT)\include
copy *.cpp $(%WWFLAT)\srcdebug
copy *.asm $(%WWFLAT)\srcdebug
$(LIB_CMD) $(LIB_CFG) $^@ @objects.lbc
#---------------------------------------------------------------------------
# Objects now have a link file which is NOT generated everytime. Instead
# it just has its own dependacy rule.
#---------------------------------------------------------------------------
objects.lbc : $(OBJECTS)
%create $^@
for %index in ($(OBJECTS)) do %append $^@ +%index
#---------------------------------------------------------------------------
# Create the test directory and make it.
#---------------------------------------------------------------------------
test:
mkdir test
cd test
copy $(%WWVCS)\$(PROJ_NAME)\test\vcs.cfg
update
wmake
cd ..
#**************************** End of makefile ******************************

289
WWFLAT32/PLAYCD/PLAYCD.ASM Normal file
View File

@@ -0,0 +1,289 @@
;
; Command & Conquer Red Alert(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/>.
;
IDEAL
P386
MODEL USE32 FLAT
LOCALS ??
DPMI_INTR equ 031h
GLOBAL DPMI_real_alloc : near
GLOBAL DPMI_real_free : near
GLOBAL DPMI_real_intr : near
GLOBAL DPMI_real_call : near
STRUC SEGSEL
segmen dw ?
select dw ?
ENDS
STRUC REGS
_eax dd ?
_ebx dd ?
_ecx dd ?
_edx dd ?
_esi dd ?
_edi dd ?
_cflag dd ?
ENDS
STRUC SREGS
_es dw ?
_cs dw ?
_ss dw ?
_ds dw ?
_fs dw ?
_gs dw ?
ENDS
STRUC DPMI_REGS
_edi dd ?
_esi dd ?
_ebp dd ?
dd ?
_ebx dd ?
_edx dd ?
_ecx dd ?
_eax dd ?
Flags dw ?
_es dw ?
_ds dw ?
_fs dw ?
_gs dw ?
_ip dw ?
_cs dw ?
_sp dw ?
_ss dw ?
dd ?
dd ?
size_ref db ?
ENDS
CODESEG
; int DPMI_real_alloc ( UINT , SEGREG * , USHORT * ) ;
PROC DPMI_real_alloc C near
USES ebx , edx
ARG paragra : DWORD
ARG blk_segptr : DWORD
ARG largest_blkptr : DWORD
mov eax, 0100h
mov ebx, [paragra]
int DPMI_INTR
jnc ??dpmi_succed
mov ebx, [largest_blkptr]
mov [ word ptr ebx ] , bx
movzx eax , al
ret
??dpmi_succed:
mov ebx, [blk_segptr]
mov [(type SEGSEL ptr ebx). segmen ] , ax
mov [(type SEGSEL ptr ebx). select ] , dx
xor eax , eax
ret
ENDP DPMI_real_alloc
;**************************************************************************
; int DPMI_real_free ( UINT ) ;
PROC DPMI_real_free C near
USES eax , edx
ARG blk_selec : DWORD
mov eax, 0101h
mov edx, [blk_selec]
shr edx , 16
int DPMI_INTR
ret
ENDP DPMI_real_free
PROC DPMI_real_intr C near
USES eax , ebx , ecx , edx , edi , esi
ARG vector : dword
ARG regs_ptr: dword
ARG sreg_ptr: dword
LOCAL regblk : DPMI_REGS
lea edi , [ regblk ]
xor eax , eax
lea ecx , [ regblk . size_ref ]
sub ecx , edi
shr ecx , 2
rep stosd
mov ebx , [ regs_ptr ]
mov eax , [ (type REGS ptr ebx) . _eax ]
mov [ regblk . _eax ] , eax
mov eax , [ (type REGS ptr ebx) . _ebx ]
mov [ regblk . _ebx ] , eax
mov eax , [ (type REGS ptr ebx) . _ecx ]
mov [ regblk . _ecx ] , eax
mov eax , [ (type REGS ptr ebx) . _edx ]
mov [ regblk . _edx ] , eax
mov eax , [ (type REGS ptr ebx) . _esi ]
mov [ regblk . _esi ] , eax
mov eax , [ (type REGS ptr ebx) . _edi ]
mov [ regblk . _edi ] , eax
mov ebx , [ sreg_ptr ]
mov ax , [ (type SREGS ptr ebx) . _es ]
mov [ regblk . _es ] , ax
mov ax , [ (type SREGS ptr ebx) . _ds ]
mov [ regblk . _ds ] , ax
mov eax , 0300h
mov ebx , [ vector ]
xor bh , bh
xor ecx , ecx
lea edi , [ regblk ]
int DPMI_INTR
mov ebx , [ regs_ptr ]
mov eax , [ regblk . _eax ]
mov [ (type REGS ptr ebx) . _eax ] , eax
mov eax , [ regblk . _ebx ]
mov [ (type REGS ptr ebx) . _ebx ] , eax
mov eax , [ regblk . _ecx ]
mov [ (type REGS ptr ebx) . _ecx ] , eax
mov eax , [ regblk . _edx ]
mov [ (type REGS ptr ebx) . _edx ] , eax
mov eax , [ regblk . _esi ]
mov [ (type REGS ptr ebx) . _esi ] , eax
mov eax , [ regblk . _edi ]
mov [ (type REGS ptr ebx) . _edi ] , eax
mov ebx , [ sreg_ptr ]
mov ax , [ regblk . _es ]
mov [ (type SREGS ptr ebx) . _es ] , ax
mov ax , [ regblk . _ds ]
mov [ (type SREGS ptr ebx) . _ds ] , ax
ret
ENDP DPMI_real_intr
PROC DPMI_real_call C near
USES eax , ebx , ecx , edx , edi , esi
ARG vector : dword
ARG regs_ptr: dword
ARG sreg_ptr: dword
LOCAL regblk : DPMI_REGS
lea edi , [ regblk ]
xor al , al
lea ecx , [ regblk . size_ref ]
sub ecx , edi
rep movsb
mov ebx , [ regs_ptr ]
mov eax , [ (type REGS ptr ebx) . _eax ]
mov [ regblk . _eax ] , eax
mov eax , [ (type REGS ptr ebx) . _ebx ]
mov [ regblk . _ebx ] , eax
mov eax , [ (type REGS ptr ebx) . _ecx ]
mov [ regblk . _ecx ] , eax
mov eax , [ (type REGS ptr ebx) . _edx ]
mov [ regblk . _edx ] , eax
mov eax , [ (type REGS ptr ebx) . _esi ]
mov [ regblk . _esi ] , eax
mov eax , [ (type REGS ptr ebx) . _edi ]
mov [ regblk . _edi ] , eax
mov ebx , [ sreg_ptr ]
mov ax , [ (type SREGS ptr ebx) . _es ]
mov [ regblk . _es ] , ax
mov ax , [ (type SREGS ptr ebx) . _ds ]
mov [ regblk . _ds ] , ax
; mov eax , 0300h
; mov ebx , [ vector ]
; xor bh , bh
; xor ecx , ecx
; lea edi , [ regblk ]
; int DPMI_INTR
mov ebx , [ regs_ptr ]
mov eax , [ regblk . _eax ]
mov [ (type REGS ptr ebx) . _eax ] , eax
mov eax , [ regblk . _ebx ]
mov [ (type REGS ptr ebx) . _ebx ] , eax
mov eax , [ regblk . _ecx ]
mov [ (type REGS ptr ebx) . _ecx ] , eax
mov eax , [ regblk . _edx ]
mov [ (type REGS ptr ebx) . _edx ] , eax
mov eax , [ regblk . _esi ]
mov [ (type REGS ptr ebx) . _esi ] , eax
mov eax , [ regblk . _edi ]
mov [ (type REGS ptr ebx) . _edi ] , eax
mov ebx , [ sreg_ptr ]
mov ax , [ regblk . _es ]
mov [ (type SREGS ptr ebx) . _es ] , ax
mov ax , [ regblk . _ds ]
mov [ (type SREGS ptr ebx) . _ds ] , ax
ret
ENDP DPMI_real_call
END


304
WWFLAT32/PLAYCD/PLAYCD.H Normal file
View File

@@ -0,0 +1,304 @@
/*
** Command & Conquer Red Alert(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 A S S O C I A T E S **
***************************************************************************
* *
* Project Name : WWLIB *
* *
* File Name : PLAYCD.H *
* *
* Programmer : STEVE WETHERILL *
* *
* Start Date : 5/13/94 *
* *
* Last Update : June 4, 1994 [SW] *
* *
*-------------------------------------------------------------------------*/
#ifndef PLAYCD_H
#define PLAYCD_H
/* ==================================================================== */
/* Defines */
/* ==================================================================== */
#define CHLEFT 0
#define CHRIGHT 1
#define CHBOTH 2
#define AUDIO_START_MIN 1
#define AUDIO_START_SEC 44
typedef struct {
unsigned short seg ;
unsigned short sel ;
} SEGSEL ;
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
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;
};
// Audio Track Status Control Block
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;
};
// Audio Track Volume control block
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;
};
// Audio Track Play request block
struct PlayType {
UBYTE Length;
UBYTE SubCd;
UBYTE Command;
UWORD Status;
UBYTE Rsvd[8];
UBYTE AddrMd;
ULONG Start;
ULONG CntSect;
};
// Audio Track Stop request block
struct StopType {
UBYTE Length;
UBYTE SubCd;
UBYTE Command;
UWORD Status;
UBYTE Rsvd[8];
};
/***************************************************************************
* 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 {
protected:
union REGS regs;
struct SREGS sregs;
SEGSEL cdDrive_addrp;
UWORD largestp;
int CDDrives[MAX_CD_DRIVES]; //Array containing CD drive letters
int CDCount; //Number of available CD drives
int CDIndex;
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);};
private:
VOID GetCDDrives(VOID);
};
/***********************************************************************************************
* 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);
}
}
/***************************************************************************
* 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());
}
/***************************************************************************
* RedBookClass -- adds red book functionality *
* *
* this class inherits from GetCDClass and adds red book play functionality*
* *
* *
* HISTORY: *
* 06/04/1994 SW : Created. *
*=========================================================================*/
class RedBookClass : public GetCDClass {
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;
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);
};
/***************************** End of Playcd.h ****************************/
#endif // PLAYCD_H

View File

@@ -0,0 +1,305 @@
/*
** Command & Conquer Red Alert(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 A S S O C I A T E S **
***************************************************************************
* *
* Project Name : WWLIB *
* *
* File Name : PLAYCD.H *
* *
* Programmer : STEVE WETHERILL *
* *
* Start Date : 5/13/94 *
* *
* Last Update : June 4, 1994 [SW] *
* *
*-------------------------------------------------------------------------*/
#ifndef PLAYCD_H
#define PLAYCD_H
/* ==================================================================== */
/* Defines */
/* ==================================================================== */
#define CHLEFT 0
#define CHRIGHT 1
#define CHBOTH 2
#define AUDIO_START_MIN 1
#define AUDIO_START_SEC 44
typedef struct {
unsigned short seg ;
unsigned short sel ;
} SEGSEL ;
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
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;
};
// Audio Track Status Control Block
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;
};
// Audio Track Volume control block
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;
};
// Audio Track Play request block
struct PlayType {
UBYTE Length;
UBYTE SubCd;
UBYTE Command;
UWORD Status;
UBYTE Rsvd[8];
UBYTE AddrMd;
ULONG Start;
ULONG CntSect;
};
// Audio Track Stop request block
struct StopType {
UBYTE Length;
UBYTE SubCd;
UBYTE Command;
UWORD Status;
UBYTE Rsvd[8];
};
/***************************************************************************
* 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 {
protected:
union REGS regs;
struct SREGS sregs;
SEGSEL cdDrive_addrp;
UWORD largestp;
int CDDrives[MAX_CD_DRIVES]; //Array containing CD drive letters
int CDCount; //Number of available CD drives
int CDIndex;
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);};
private:
VOID GetCDDrive(VOID);
};
/***********************************************************************************************
* 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);
}
}
/***************************************************************************
* 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());
}
/***************************************************************************
* RedBookClass -- adds red book functionality *
* *
* this class inherits from GetCDClass and adds red book play functionality*
* *
* *
* HISTORY: *
* 06/04/1994 SW : Created. *
*=========================================================================*/
class RedBookClass : public GetCDClass {
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;
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);
};
/***************************** End of Playcd.h ****************************/
#endif // PLAYCD_H


518
WWFLAT32/PLAYCD/REDBOOK.CPP Normal file
View File

@@ -0,0 +1,518 @@
/*
** Command & Conquer Red Alert(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 A S S O C I A T E S **
***************************************************************************
* *
* Project Name : WWLIB *
* *
* File Name : REDBOOK.CPP *
* *
* Programmer : STEVE WETHERILL (FROM SCOTT BOWEN CODE) *
* *
* Start Date : 5/13/94 *
* *
* Last Update : June 4, 1994 [SW] *
* *
*-------------------------------------------------------------------------*
*-------------------------------------------------------------------------*
* Functions: *
* RedBookClass::~RedBookClass(VOID) *
* RedBookClass::RedToHS(ULONG i) *
* RedBookClass::MSFtoRed(UBYTE m, UBYTE s, UBYTE f) *
* RedBookClass::FullCDVolume(UBYTE chan) *
* RedBookClass::PlayTrack(UWORD track) *
* RedBookClass::Play_CD_MSL(UWORD min_sec, UWORD len) *
* RedBookClass::PlayMSF(UBYTE startM, UBYTE startS, UBYTE startF, *
* UBYTE endM, UBYTE endS, UBYTE endF, UBYTE chan) *
* RedBookClass::CheckCDMusic(VOID) *
* RedBookClass::StopCDMusic(VOID) *
*= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =*/
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <dos.h>
#include "wwstd.h"
#include "playcd.h"
#include "wwmem.h"
/***************************************************************************
* RedBookClass -- default constructor *
* *
* *
* *
* INPUT: *
* none *
* OUTPUT: *
* none *
* WARNINGS: *
* calls GetCDDrive() *
* HISTORY: *
* 05/25/1994 SW : Created. *
*=========================================================================*/
RedBookClass::RedBookClass(VOID)
: GetCDClass() // call the base constructor
{
SEGSEL tmpadr ;
tmpadr = cdDrive_addrp;
memset ( this , 0 , sizeof ( RedBookClass ) ) ;
cdDrive_addrp = tmpadr ;
Stop.Length = 13;
Stop.Command = 133;
Tinfo.Length = 26;
Tinfo.Command = 3;
Tinfo.CntTrns = 7;
Tinfo.TrInfo = 11;
Play.Length = 22;
Play.Command = 132;
Play.AddrMd = 1;
Volm.Length = 26;
Volm.Command = 12;
Volm.CntTrns = 9;
Volm.TrInfo = 3;
Volm.In1 = 1;
Volm.In2 = 2;
Volm.In3 = 3;
Stat.Length = 26;
Stat.Command = 3;
Stat.CntTrns = 11;
Stat.StatInfo = 15;
if (DPMI_real_alloc(sizeof(TinfoType)/16+1, &Tinfo_addrp, &largestp))
exit(1);
if (DPMI_real_alloc(sizeof(StatType)/16+1, &Stat_addrp, &largestp))
exit(1);
if (DPMI_real_alloc(sizeof(VolmType)/16+1, &Volm_addrp, &largestp))
exit(1);
if (DPMI_real_alloc(sizeof(PlayType)/16+1, &Play_addrp, &largestp))
exit(1);
if (DPMI_real_alloc(sizeof(StopType)/16+1, &Stop_addrp, &largestp))
exit(1);
GetCDDrive();
}
/***************************************************************************
* REDBOOKCLASS -- destructor *
* *
* *
* *
* INPUT: *
* none *
* OUTPUT: *
* none *
* WARNINGS: *
* *
* HISTORY: *
* 05/26/1994 SW : Created. *
*=========================================================================*/
RedBookClass::~RedBookClass(VOID)
{
if(Tinfo_addrp.seg)
DPMI_real_free(Tinfo_addrp); // free up those conventional buffers
if(Stat_addrp.seg)
DPMI_real_free(Stat_addrp);
if(Volm_addrp.seg)
DPMI_real_free(Volm_addrp);
if(Play_addrp.seg)
DPMI_real_free(Play_addrp);
if(Stop_addrp.seg)
DPMI_real_free(Stop_addrp);
}
/***************************************************************************
* REDTOHS -- RedBook to High-Sierra conversion *
* *
* *
* *
* INPUT: *
* ULONG *
* OUTPUT: *
* ULONG *
* WARNINGS: *
* *
* HISTORY: *
* 05/26/1994 SW : Created. *
*=========================================================================*/
ULONG RedBookClass::RedToHS(ULONG i)
{
return( ((i>>16) & 0xFF) * 60 * 75) + ( ((i>>8) & 0xFF) * 75) + (i & 0xFF);
}
/***************************************************************************
* MSFTORED -- Minute, Second, Frame to RedBook conversion *
* *
* *
* *
* INPUT: *
* UBYTE minute *
* UBYTE second *
* UBYTE frame *
* OUTPUT: *
* ULONG RedBook *
* WARNINGS: *
* *
* HISTORY: *
* 05/26/1994 SW : Created. *
*=========================================================================*/
ULONG RedBookClass::MSFtoRed(UBYTE m, UBYTE s, UBYTE f)
{
return( ((ULONG)m << 16) + ((ULONG)s << 8) + (ULONG)f );
}
/***************************************************************************
* FULLCDVOLUME -- set full volume *
* *
* *
* *
* INPUT: *
* UBYTE channel *
* *
* CHLEFT *
* CHRIGHT *
* CHBOTH *
* *
* OUTPUT: *
* none *
* WARNINGS: *
* *
* HISTORY: *
* 05/26/1994 SW : Created. *
*=========================================================================*/
VOID RedBookClass::FullCDVolume(UBYTE chan)
{
Volm.Vol0 = Volm.Vol1 = Volm.Vol2 = Volm.Vol3 = 255;
Volm.TrnsAdOff = offsetof (VolmType, TrInfo);
Volm.TrnsAdSeg = Volm_addrp.seg;
if(chan == CHLEFT)
{
// Volm.In0 = 0;
// Volm.In1 = 3;
// Volm.In2 = 3;
// Volm.In3 = 3;
Volm.Vol1 = 0;
}
else if(chan == CHRIGHT)
{
// Volm.In0 = 3;
// Volm.In1 = 1;
// Volm.In2 = 3;
// Volm.In3 = 3;
Volm.Vol0 = 0;
}
else /* both channels */
{
Volm.In0 = 0;
Volm.In1 = 1;
Volm.In2 = 2;
Volm.In3 = 3;
}
// WriteRealMem(REALPTR(Volm_addrp) << 16, &Volm, sizeof(VolmType));
Mem_Copy ( &Volm , (void *) ( Volm_addrp.seg << 4 ) , sizeof(VolmType));
regs.x.eax = 0x1510;
regs.x.ecx = cdDrive[0];
regs.x.ebx = 0x0000;
sregs.es = Volm_addrp.seg;
DPMI_real_intr(0x2F, &regs, & sregs);
// ReadRealMem(&Volm, REALPTR(Volm_addrp) << 16, sizeof(VolmType));
Mem_Copy ( (void *) ( Volm_addrp . seg << 4 ), &Volm ,sizeof(VolmType));
}
/***************************************************************************
* PLAYTRACK -- play a track *
* *
* *
* *
* INPUT: *
* UWORD track *
* OUTPUT: *
* none *
* WARNINGS: *
* *
* HISTORY: *
* 05/26/1994 SW : Created. *
*=========================================================================*/
VOID RedBookClass::PlayTrack(UWORD track)
{
StopCDMusic();
Tinfo.Track = track;
Tinfo.TrnsAdOff = offsetof (TinfoType, TrInfo);
Tinfo.TrnsAdSeg = Tinfo_addrp.seg;
// WriteRealMem(REALPTR(Tinfo_addrp) << 16, &Tinfo, sizeof(TinfoType));
Mem_Copy ( &Tinfo , (void *) ( Tinfo_addrp.seg << 4 ) , sizeof(TinfoType));
regs.x.eax = 0x1510;
regs.x.ecx = cdDrive[0];
regs.x.ebx = 0x0000;
sregs.es = Tinfo_addrp.seg;
DPMI_real_intr(0x2F, &regs, &sregs); // gets start time of track in Tinfo.Start
// ReadRealMem(&Tinfo, REALPTR(Tinfo_addrp) << 16, sizeof(TinfoType));
Mem_Copy ( (void *) ( Tinfo_addrp.seg << 4 ) , &Tinfo, sizeof(TinfoType));
Play.Start = Tinfo.Start;
Tinfo.Track++;
Tinfo.TrnsAdOff = offsetof (TinfoType, TrInfo);
Tinfo.TrnsAdSeg = Tinfo_addrp.seg;
// WriteRealMem(REALPTR(Tinfo_addrp) << 16, &Tinfo, sizeof(TinfoType));
Mem_Copy ( &Tinfo , (void *) ( Tinfo_addrp.seg << 4 ) , sizeof(TinfoType));
regs.x.eax = 0x1510;
regs.x.ecx = cdDrive[0];
regs.x.ebx = 0x0000;
sregs.es = Tinfo_addrp.seg;
DPMI_real_intr(0x2F, &regs , &sregs); // gets start time of following track in Tinfo.Start
// ReadRealMem(&Tinfo, REALPTR(Tinfo_addrp) << 16, sizeof(TinfoType));
Mem_Copy ( (void *) ( Tinfo_addrp.seg << 4 ) , &Tinfo, sizeof(TinfoType));
Play.CntSect = RedToHS(Tinfo.Start) - RedToHS(Play.Start) - 1;
// WriteRealMem(REALPTR(Play_addrp) << 16, &Play, sizeof(PlayType));
Mem_Copy ( &Play , (void *) ( Play_addrp.seg << 4 ) , sizeof(PlayType));
regs.x.eax = 0x1510;
regs.x.ecx = cdDrive[0];
regs.x.ebx = 0x0000;
sregs.es = Play_addrp.seg;
DPMI_real_intr(0x2F, &regs, &sregs);
// ReadRealMem(&Play, REALPTR(Play_addrp) << 16, sizeof(PlayType));
Mem_Copy ( (void *) ( Play_addrp.seg << 4 ) , &Play, sizeof(PlayType));
FullCDVolume(CHBOTH);
}
/***************************************************************************
* PLAY_CD_MSL -- play cd from start min_sec for len *
* *
* *
* *
* INPUT: *
* UWORD min_sec *
* UWORD Len *
* OUTPUT: *
* none *
* WARNINGS: *
* *
* HISTORY: *
* 05/26/1994 SW : Created. *
*=========================================================================*/
VOID RedBookClass::Play_CD_MSL(UWORD min_sec, UWORD len)
{
UWORD startM, startS, startF;
UWORD endM, endS, endF;
if (!len)
return;
endM = startM = (min_sec >> 8) + AUDIO_START_MIN;
endS = startS = (min_sec & 0xFF) + AUDIO_START_SEC;
startF = endF = 0;
while (len > 59) {
endM++;
len -= 60;
}
endS += len;
if (endS > 59) {
endM++;
endS -= 60;
}
PlayMSF((UBYTE) startM, (UBYTE)startS, (UBYTE)startF, (UBYTE)endM, (UBYTE)endS, (UBYTE)endF, 2 /* chan */);
}
/***************************************************************************
* PlayMSF -- Play Minute, Second, Frame to Minute, Second, Frame *
* *
* *
* *
* INPUT: *
* UBYTE startM *
* UBYTE startS *
* UBYTE startF *
* UBYTE endM *
* UBYTE endS *
* UBYTE endF *
* UBYTE chan *
* OUTPUT: *
* none *
* WARNINGS: *
* *
* HISTORY: *
* 05/27/1994 SW : Created. *
*=========================================================================*/
VOID RedBookClass::PlayMSF(UBYTE startM, UBYTE startS, UBYTE startF, UBYTE endM, UBYTE endS, UBYTE endF, UBYTE chan)
{
Play.Start = MSFtoRed(startM, startS, startF);
Play.CntSect = RedToHS(MSFtoRed(endM, endS, endF)) - RedToHS(Play.Start) - 1;
// WriteRealMem(REALPTR(Play_addrp) << 16, &Play, sizeof(PlayType));
Mem_Copy ( &Play , (void *) ( Play_addrp.seg << 4 ) , sizeof(PlayType));
regs.x.eax = 0x1510;
regs.x.ecx = cdDrive[0];
regs.x.ebx = offsetof (PlayType, Length);
sregs.es = Play_addrp.seg;
DPMI_real_intr(0x2F, &regs, &sregs);
// ReadRealMem(&Play, REALPTR(Play_addrp) << 16, sizeof(PlayType));
Mem_Copy ( (void *) ( Play_addrp.seg << 4 ) , &Play, sizeof(PlayType));
FullCDVolume(chan);
}
/***************************************************************************
* CheckCDMusic -- Check for CD playing *
* *
* *
* *
* INPUT: *
* UBYTE startM *
* UBYTE startS *
* UBYTE startF *
* UBYTE endM *
* UBYTE endS *
* UBYTE endF *
* UBYTE chan *
* OUTPUT: *
* UWORD TRUE if playing else FALSE *
* WARNINGS: *
* *
* HISTORY: *
* 05/27/1994 SW : Created. *
*=========================================================================*/
UWORD RedBookClass::CheckCDMusic(VOID)
{
Stat.TrnsAdOff = offsetof (StatType, StatInfo);
Stat.TrnsAdSeg = Stat_addrp.seg;
// WriteRealMem(REALPTR(Stat_addrp) << 16, &Stat, sizeof(StatType));
Mem_Copy ( &Stat , (void *) ( Stat_addrp.seg << 4 ) , sizeof(StatType));
regs.x.ecx = cdDrive[0];
regs.x.ebx = offsetof (StatType, Length);
regs.x.eax = 0x1510;
sregs.es = Stat_addrp.seg;
DPMI_real_intr(0x2F, &regs, &sregs);
// ReadRealMem(&Stat, REALPTR(Stat_addrp) << 16, sizeof(StatType));
Mem_Copy ( (void *) ( Stat_addrp.seg << 4 ) , &Stat, sizeof(StatType));
return (Stat.Status&0x200);
}
/***************************************************************************
* STOPCDMUSIC -- stop CD playing *
* *
* *
* *
* INPUT: *
* none *
* OUTPUT: *
* none *
* WARNINGS: *
* *
* HISTORY: *
* 05/27/1994 SW : Created. *
*=========================================================================*/
VOID RedBookClass::StopCDMusic(VOID)
{
// WriteRealMem(REALPTR(Stop_addrp) << 16, &Stop, sizeof(StopType));
Mem_Copy ( &Stop , (void *) ( Stop_addrp.seg << 4 ) , sizeof(StopType));
regs.x.eax = 0x1510;
regs.x.ecx = cdDrive[0];
regs.x.ebx = offsetof (StopType, Length);
sregs.es = Stop_addrp.seg;
DPMI_real_intr(0x2F, &regs, &sregs);
// ReadRealMem(&Stop, REALPTR(Stop_addrp) << 16, sizeof(StopType));
Mem_Copy ( (void *) ( Stop_addrp.seg << 4 ) , &Stop, sizeof(StopType));
}