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

View File

@@ -0,0 +1,124 @@
/*
** 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/>.
*/
#ifndef VQACAPTION_H
#define VQACAPTION_H
/****************************************************************************
*
* 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
* VQA player library (32 bit protected mode)
*
* FILE
* caption.h
*
* DESCRIPTION
* Text caption definitions.
*
* PROGRAMMER
* Denzil E. Long, Jr.
*
* DATE
* July 26, 1995
*
****************************************************************************/
#define VQACAPTIONS_ON 0
/*---------------------------------------------------------------------------
* STRUCTURES AND RELATED DEFINITIONS
*-------------------------------------------------------------------------*/
/* CaptionNode: Node describing a caption to process.
*
* Succ - Pointer to the next node in the list (successor).
* Pred - Pointer to the previous node in the list (predecessor).
* Flags - Status flags.
* CapText - Pointer to the CaptionText being processed.
* Char - Pointer to current character in the string.
* CurX - Current X position.
* CurY - Current Y position.
* BoundW - Bounding width of text.
* BoundH - Bounding height of text.
*/
typedef struct _CaptionNode {
struct _CaptionNode *Succ;
struct _CaptionNode *Pred;
unsigned short Flags;
CaptionText *Captext;
char *Char;
unsigned short CurX;
unsigned short CurY;
unsigned short BoundW;
unsigned short BoundH;
} CaptionNode;
/* CaptionNode flag definitions. */
#define CNB_USED 0 /* This node is being used. */
#define CNF_USED (1<<CNB_USED)
/* CaptionList: Double linked list of outstanding captions to process.
*
* Head - Pointer to the first node in the list.
* Tail - Always NULL
* TailPred - Pointer to the last node in the list.
*/
typedef struct _CaptionList {
CaptionNode *Head;
CaptionNode *Tail;
CaptionNode *TailPred;
} CaptionList;
/* CaptionInfo:
*
* Next - Pointer to the next caption to be processed.
* List - List of pending captions to process.
* Font - Font to use for this caption.
* BoundX - X position of bounding box.
* BoundY - Y position of bounding box.
* BoundW - Width of bounding box.
* BoundH - Height of bounding box.
* Buffer - Caption chunk buffer.
*/
typedef struct _CaptionInfo {
CaptionText *Next;
CaptionList List;
void *Font;
char FontHeight;
char FontWidth;
void *Buffer;
} CaptionInfo;
/*---------------------------------------------------------------------------
* FUNCTION PROTOTYPES
*-------------------------------------------------------------------------*/
CaptionInfo *OpenCaptions(void *captions, void *font);
void CloseCaptions(CaptionInfo *cap);
void DoCaptions(CaptionInfo *cap, unsigned long frame);
#endif /* VQACAPTION_H */


565
WINVQ/INCLUDE/VQA32/SOS.H Normal file
View File

@@ -0,0 +1,565 @@
/*
** 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/>.
*/
/****************************************************************************
File : sos.h
Programmer(s) : Don Fowler, Nick Skrepetos
Date :
Purpose : Include Files For Zortech C++ Compiler
Last Updated :
****************************************************************************
Copyright(c) 1993,1994 Human Machine Interfaces
All Rights Reserved
****************************************************************************/
#ifndef _SOS_DEFINED
#define _SOS_DEFINED
#include "sosdefs.h"
#pragma pack(4)
// error definition for sound operating system
#define _SOS_ERR -1
// number of drivers allowed to be open at one time
#define _SOS_MAX_DRIVERS 5
// structure definition for the capabilities
typedef struct _tagCAPABILITIES
{
BYTE szDeviceName[ 32 ]; // device name
WORD wDeviceVersion; // device version
WORD wBitsPerSample; // bits per sound sample
WORD wChannels; // stereo/mono sound card
WORD wMinRate; // minimum rate
WORD wMaxRate; // maximum rate
WORD wMixerOnBoard; // board contains mixer
WORD wMixerFlags; // mixer capabilities
WORD wFlags; // miscellaneous flags
short far * lpPortList; // list of usable ports
short far * lpDMAList; // list of usable dma channels
short far * lpIRQList; // list of usable irq channels
short far * lpRateList; // list of usable rates, -1 if any in min to max
WORD fBackground; // foreground or background driver
WORD wDeviceID; // ID for the device
WORD wTimerID; // ID for the timer
} _SOS_CAPABILITIES;
// far pointer to the device capabilities structure
typedef _SOS_CAPABILITIES far * LPSOSDEVICECAPS;
// flag types for driver
#define _FLAGS_SIGNED 0x8000
// devices that can be loaded
#define _SOUND_BLASTER_8_MONO 0xe000
#define _SOUND_BLASTER_8_ST 0xe001
#define _SBPRO_8_ST _SOUND_BLASTER_8_ST
#define _SBPRO_8_MONO 0xe00f
#define _SOUND_MASTER_II_8_MONO 0xe002
#define _MV_PAS_8_MONO 0xe003
#define _MV_PAS_16_MONO 0xe004
#define _MV_PAS_8_ST 0xe005
#define _MV_PAS_16_ST 0xe006
#define _ADLIB_GOLD_8_ST 0xe007
#define _ADLIB_GOLD_16_ST 0xe008
#define _ADLIB_GOLD_8_MONO 0xe009
#define _ADLIB_GOLD_16_MONO 0xe00a
#define _MICROSOFT_8_MONO 0xe00b
#define _MICROSOFT_8_ST 0xe00c
#define _MICROSOFT_16_MONO 0xe00d
#define _MICROSOFT_16_ST 0xe00e
#define _SOUND_SOURCE_8_MONO_PC 0xe010
#define _SOUND_SOURCE_8_MONO_TANDY 0xe011
#define _GENERAL_PORT_8_MONO 0xe012
#define _GENERAL_PORT_8_MONO_R 0xe013
#define _SIERRA_8_MONO 0xe014
#define _SB16_8_MONO 0xe015
#define _SB16_8_ST 0xe016
#define _SB16_16_MONO 0xe017
#define _SB16_16_ST 0xe018
#define _ESS_AUDIODRIVE_8_MONO 0xe019
#define _ESS_AUDIODRIVE_8_ST 0xe01a
#define _ESS_AUDIODRIVE_16_MONO 0xe01b
#define _ESS_AUDIODRIVE_16_ST 0xe01c
#define _SOUNDSCAPE_8_MONO 0xe01d
#define _SOUNDSCAPE_8_ST 0xe01e
#define _SOUNDSCAPE_16_MONO 0xe01f
#define _SOUNDSCAPE_16_ST 0xe020
#define _RAP10_8_MONO 0xe021
#define _RAP10_16_MONO 0xe022
#define _GUS_8_MONO 0xe023
#define _GUS_8_ST 0xe024
#define _GUS_16_MONO 0xe025
#define _GUS_16_ST 0xe026
#define _GUS_MAX_8_MONO 0xe027
#define _GUS_MAX_8_ST 0xe028
#define _GUS_MAX_16_MONO 0xe029
#define _GUS_MAX_16_ST 0xe02a
#define _WAVEJAMMER_8_MONO 0xe02b
#define _WAVEJAMMER_8_ST 0xe02c
#define _WAVEJAMMER_16_MONO 0xe02d
#define _WAVEJAMMER_16_ST 0xe02e
#define _TEMPOCS_8_MONO 0xe02f
#define _TEMPOCS_8_ST 0xe030
#define _TEMPOCS_16_MONO 0xe031
#define _TEMPOCS_16_ST 0xe032
#define _WAVEJAMMERCD_8_MONO 0xe033
#define _WAVEJAMMERCD_8_ST 0xe034
#define _WAVEJAMMERCD_16_MONO 0xe035
#define _WAVEJAMMERCD_16_ST 0xe036
#define _SOUND_BLASTER_8_MONO_R 0xe050
#define _MICROSOFT_8_MONO_R 0xe051
#define _SOUND_MASTER_II_8_MONO_R 0xe052
#define _ADLIB_GOLD_8_MONO_R 0xe053
#define _MV_PAS_8_MONO_R 0xe054
#define _RAP10_8_MONO_R 0xe058
#define _RAP10_16_MONO_R 0xe059
#define _SB16_8_MONO_R 0xe05a
#define _SB16_8_ST_R 0xe05b
#define _SB16_16_MONO_R 0xe05c
#define _SB16_16_ST_R 0xe05d
#define _MV_PAS_16_MONO_R 0xe060
#define _SOUNDSCAPE_8_MONO_R 0xe061
#define _SOUNDSCAPE_8_ST_R 0xe062
#define _SOUNDSCAPE_16_MONO_R 0xe063
#define _SOUNDSCAPE_16_ST_R 0xe064
#define _ESS_AUDIODRIVE_8_MONO_R 0xe065
#define _ESS_AUDIODRIVE_8_ST_R 0xe066
#define _ESS_AUDIODRIVE_16_MONO_R 0xe067
#define _ESS_AUDIODRIVE_16_ST_R 0xe068
#define _SPEECH_THING_8_MONO 0xe090
#define _YAMAHA_8_MONO 0xe106
#define _INT_SPEAKER_8_MONO 0xe107
// call indexes for the loadable drivers
enum
{
_DRV_INIT,
_DRV_UNINIT,
_DRV_SETRATE,
_DRV_SETACTION,
_DRV_START,
_DRV_STOP,
_DRV_PAUSE,
_DRV_RESUME,
_DRV_CAPABILITIES,
_DRV_PLAY_FOREGROUND,
_DRV_GET_FILL_INFO,
_DRV_GET_CALL_FUNCTIONS,
_DRV_SET_CALL_FUNCTIONS
};
// fill info
typedef struct _tagFillInfo
{
LPSTR lpFillHandler; // pointer to fill handler
LPWORD lpDMAFillCount; // pointer to dma count
LPSTR lpSampleList; // pointer to sample list
LPWORD lpDMAMasterVolume; // pointer to dma count
} _SOS_FILL_INFO;
// caps info structure
typedef struct _tagCapsInfo
{
LPSTR lpPortList; // pointer to port list
LPSTR lpDMAList; // pointer to DMA list
LPSTR lpIRQList; // pointer to IRQ list
LPSTR lpRateList; // pointer to rate list
} _SOS_CAPS_INFO;
// maximum number of available voice
#define _MAX_VOICES 32
// structure definition
typedef struct _tagSAMPLE
{
LPSTR samplePtr; // pointer to data buffer
LPSTR sampleData; // pointer to active data
LPSTR sampleLoopPtr; // pointer for loop back
WORD sampleLength; // length of sample
WORD sampleIndex; // index into sample
WORD sampleLoopLength; // length of loop
WORD sampleBytesLeft; // bytes left to play in sample
WORD sampleLoopPoint; // byte count for loop point
WORD sampleLoopEndLength; // length of remaining chunk
short sampleFlags; // control sample
short sampleVolume; // volume control
short sampleID; // sample ID
short sampleChannel; // channel to play sample on
short sampleLoopCount; // loop count
short sampleLastFill; // last fill position
VOID ( far cdecl * sampleCallback )( WORD, WORD, WORD ); // callback function for sample
WORD samplePitchAdd;
short samplePitchFraction;
short samplePort; // port to use for non-dma digitized
WORD sampleTotalBytes;
WORD sampleByteLength;
short samplePanLocation;
short samplePanSpeed;
short samplePanDirection;
short samplePanStart;
short samplePanEnd;
short sampleDelayBytes;
short sampleDelayRepeat;
WORD sampleADPCMPredicted;
short sampleADPCMIndex;
short sampleRootNoteMIDI;
WORD sampleTemp1;
} _SOS_SAMPLE;
// enumeration for left or right channel
enum
{
_LEFT_CHANNEL,
_RIGHT_CHANNEL,
_CENTER_CHANNEL,
_INTERLEAVED
};
// enumeration for foreground and background
enum
{
_FOREGROUND,
_BACKGROUND
};
// defines for the sample flags
#define _ACTIVE 0x8000
#define _LOOPING 0x4000
#define _FIRST_TIME 0x2000
#define _PENDING_RELEASE 0x1000
#define _CONTINUE_BLOCK 0x0800
#define _PITCH_SHIFT 0x0400
#define _PANNING 0x0200
#define _VOLUME 0x0100
#define _TRANSLATE16TO8 0x0080
#define _STAGE_LOOP 0x0040
#define _TRANSLATE8TO16 0x0020
#define _STEREOTOMONO 0x0010
// defines for the wParam flags
#define _SINGLE_SAMPLE 0x01
#define _SOS_DCAPS_AUTO_REINIT 0x01
#define _SOS_DCAPS_MPU_401 0x02
#define _SOS_DCAPS_OPL2 0x04
#define _SOS_DCAPS_OPL3 0x08
#define _SOS_DCAPS_OPL4 0x10
#define _SOS_DCAPS_WAVETABLE 0x20
#define _SOS_DCAPS_DL_SAMPLES 0x40
#define _SOS_DCAPS_FIFO_DEVICE 0x80
#define _SOS_DCAPS_ENV_NEEDED 0x100
#define _SOS_DCAPS_PSEUDO_DMA1 0x200
#define _SOS_DCAPS_SIGNED_DATA 0x8000
// file header structure
typedef struct
{
// name ID
BYTE szName[ 32 ];
// number of drivers in the file
WORD wDrivers;
// offset of first driver
WORD lOffset;
// size of the file
WORD lFileSize;
} _FILEHEADER;
// driver header structure
typedef struct
{
// name ID
BYTE szName[ 32 ];
// offset of next driver
WORD lNextDriver;
// size of current driver
WORD wSize;
// id for the current device
WORD wDeviceID;
// id for the type of DOS extender
WORD wExtenderType;
} _DRIVERHEADER;
// device hardware information
typedef struct
{
// port to be used
WORD wPort;
// irq to use
WORD wIRQ;
// dma channel to se
WORD wDMA;
// extra parameter
WORD wParam;
} _SOS_HARDWARE;
// structure definition for start sample
typedef struct
{
// pointer to sample
LPSTR lpSamplePtr;
// size of the sample
WORD dwSampleSize;
// number of times to loop the sample -1 is infinite
WORD wLoopCount;
// channel to play sample on
WORD wChannel;
// volume to play sample at
WORD wVolume;
// id for the sample
WORD wSampleID;
// far pointer to the callback function
VOID ( far cdecl *lpCallback )( WORD, WORD, WORD );
// port to use if driver is a non-dma background driver
WORD wSamplePort;
// flags field
WORD wSampleFlags;
// total length of sample including loops, etc..
WORD dwSampleByteLength;
// loop point for the sample
WORD dwSampleLoopPoint;
WORD dwSampleLoopLength;
// pitch shifting components
WORD dwSamplePitchAdd;
WORD wSamplePitchFraction;
// pan components
WORD wSamplePanLocation;
WORD wSamplePanSpeed;
WORD wSamplePanDirection;
WORD wSamplePanStart;
WORD wSamplePanEnd;
// delay parts
WORD wSampleDelayBytes;
WORD wSampleDelayRepeat;
// compression components
WORD dwSampleADPCMPredicted;
WORD wSampleADPCMIndex;
// root note for pitch shifting
WORD wSampleRootNoteMIDI;
// filler for future upgrades
WORD dwSampleTemp1;
WORD dwSampleTemp2;
WORD dwSampleTemp3;
} _SOS_START_SAMPLE;
// structure for initializing a driver
typedef struct
{
WORD wBufferSize;
LPSTR lpBuffer;
BOOL wAllocateBuffer;
WORD wSampleRate;
WORD wParam;
LONG dwParam;
VOID ( far *lpFillHandler )( VOID );
LPSTR lpDriverMemory;
LPSTR lpDriverMemoryCS;
LPSTR lpTimerMemory;
LPSTR lpTimerMemoryCS;
WORD wTimerID;
WORD wPhysical;
} _SOS_INIT_DRIVER;
// define for the timer types to use
#define _SOS_NORMAL_TIMER 0x00
// enumeration for the timer types
enum
{
_TIMER_8_MONO = 0x1000,
_TIMER_8_ST,
_TIMER_16_MONO,
_TIMER_16_ST,
_TIMER_8_MONO_ULAW,
_TIMER_8_ST_ULAW,
_TIMER_16_MONO_ULAW,
_TIMER_16_ST_ULAW,
_TIMER_8_MONO_REC,
_TIMER_8_MONO_ULAW_REC,
_TIMER_UNDEFINED_1,
_TIMER_UNDEFINED_2,
_TIMER_UNDEFINED_3,
_TIMER_UNDEFINED_4,
_TIMER_UNDEFINED_5,
_TIMER_UNDEFINED_6,
_TIMER_UNDEFINED_7,
_TIMER_UNDEFINED_8,
_TIMER_UNDEFINED_9,
_TIMER_UNDEFINED_A,
_TIMER_UNDEFINED_B,
_TIMER_UNDEFINED_C,
_TIMER_UNDEFINED_D,
_TIMER_UNDEFINED_E,
_TIMER_UNDEFINED_F,
_TIMER_UNDEFINED_10,
_TIMER_UNDEFINED_11,
_TIMER_UNDEFINED_12,
_TIMER_UNDEFINED_13,
_TIMER_UNDEFINED_14,
_TIMER_UNDEFINED_15,
_TIMER_UNDEFINED_16,
_TIMER_8_SOUND_SOURCE,
_TIMER_8_SOUND_SOURCE_TANDY,
_TIMER_8_GENERAL_PORT,
_TIMER_8_GENERAL_PORT_REC
};
// define for no slots available
#define _ERR_NO_SLOTS ( WORD )-1
// error codes for the system
enum
{
_ERR_NO_ERROR,
_ERR_DRIVER_NOT_LOADED,
_ERR_INVALID_POINTER,
_ERR_DETECT_INITIALIZED,
_ERR_FAIL_ON_FILE_OPEN,
_ERR_MEMORY_FAIL,
_ERR_INVALID_DRIVER_ID,
_ERR_NO_DRIVER_FOUND,
_ERR_DETECTION_FAILURE,
_ERR_DRIVER_LOADED,
_ERR_INVALID_HANDLE,
_ERR_NO_HANDLES,
_ERR_PAUSED,
_ERR_NOT_PAUSED,
_ERR_INVALID_DATA,
_ERR_DRV_FILE_FAIL,
_ERR_INVALID_PORT,
_ERR_INVALID_IRQ,
_ERR_INVALID_DMA,
_ERR_INVALID_DMA_IRQ
};
// maximum number of timer events that can be registered
#define _TIMER_MAX_EVENTS 0x10
// flags for the debugging system
#define _SOS_DEBUG_NORMAL 0x0000
#define _SOS_DEBUG_NO_TIMER 0x0001
#define _SOS_TIMER_DPMI 0x0002
// define for types of DOS extenders
#define _SOS_RATIONAL 0x8000
#define _SOS_FLASHTECK 0x4000
// defines for the types of timers for different
// dos extenders
#define _SOS_TIMER_NEAR 0x8000
#define _SOS_TIMER_FAR 0x4000
// values for callback information
enum
{
_SAMPLE_PROCESSED,
_SAMPLE_LOOPING,
_SAMPLE_DONE
};
// define for special 18.2 callback rate to dos
#define _TIMER_DOS_RATE 0xff00
#pragma pack()
#pragma aux int_3 = "int 3"
#pragma pack( 1 )
typedef struct
{
unsigned region_size;
unsigned offset;
unsigned segment;
unsigned short number_available;
unsigned short number_used;
unsigned page0;
} EVDS_STRUCT;
typedef struct
{
unsigned region_size;
unsigned offset;
unsigned short segment;
unsigned short ID;
unsigned physical;
} VDS_STRUCT;
#pragma pack()
#include "sosdata.h"
#include "sosfnct.h"
#endif

View File

@@ -0,0 +1,128 @@
/*
** 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/>.
*/
/****************************************************************************
File : sosdata.h
Programmer(s) : Don Fowler, Nick Skrepetos
Date :
Purpose : Include Files For Zortech C++ Compiler
Last Updated :
****************************************************************************
Copyright(c) 1993,1994 Human Machine Interfaces
All Rights Reserved
****************************************************************************/
#ifndef _SOS_DATA
#define _SOS_DATA
#include <stddef.h>
#pragma pack(4)
extern WORD _sosDIGIData_Start;
extern WORD _sosDIGIData_End;
extern WORD _wSOSDriverLinear[];
extern WORD _wSOSTimerLinear[];
extern LPSTR _lpSOSDriver[];
extern LPSTR _lpSOSTimer[];
extern LPSTR _lpSOSDriverCS[];
extern LPSTR _lpSOSTimerCS[];
extern BOOL _wSOSDriverLoaded[];
extern BOOL _wSOSTimerLoaded[];
extern BOOL _wSOSDriverInitialized[];
extern WORD _wSOSOutputRate[];
extern WORD _wSOSDMABuffersize[];
extern LONG _dwSOSDMABufferPhysical[];
extern LPSTR _lpSOSDMABuffer[];
extern BOOL _wTimerUsed;
extern VOID ( far *_lpSOSFillHandler[] )( VOID );
extern WORD _wSOSTimerType[];
extern WORD _wSOSDriverType[];
extern _SOS_SAMPLE far * _lpSOSSampleList[][ _MAX_VOICES ];
extern LPWORD _lpSOSDMAIrqCount[];
extern LPWORD _lpSOSDMAFillCount[];
extern WORD _wSOSTmrNextCount;
extern VOID ( interrupt far *_lpSOSOldTimer )( VOID );
extern WORD _wSOSDriverID[];
extern _SOS_CAPABILITIES _sSOSDriverCaps[];
extern WORD _wSOSDMAPortList[];
extern BYTE _bSOSDMAChannel[];
extern _SOS_INIT_DRIVER _sSOSDIGIInitDriver[];
extern BYTE _pSOSDriverPath[];
extern BYTE _pSOSTempDriverPath[];
extern BOOL _wTIMERUsed;
extern WORD _wTIMERValue;
extern VOID ( far * _lpTIMEREvents[] )( VOID );
extern WORD _wTIMEREventRate[];
extern WORD _dwTIMEREventFraction[];
extern WORD _dwTIMEREventFractionCurrent[];
extern BYTE _bSOSMIDITimerSongHandler[];
extern BYTE _bSOSMIDISongHandle;
extern WORD _wSOSTimerMemHandle[];
extern WORD _wSOSDriverMemHandle[];
extern WORD _wSOSRealSeg[];
extern _FILEHEADER _sDETFileHeader;
extern _DRIVERHEADER _sDETDriverHeader;
extern _FILEHEADER sLOADFileHeader;
extern _DRIVERHEADER sLOADDriverHeader;
extern BOOL _wDETInitialized;
extern WORD _wDETLinear;
extern LPSTR _lpDETDriverBuffer;
extern LPSTR _lpDETDriverBufferCS;
extern WORD _hDETFile;
extern DWORD _dwDETDriverIndex;
extern WORD _wDETDriverIndexCur;
extern WORD _wDETMemHandle;
extern LPSOSDEVICECAPS _lpDETDeviceCaps;
extern _SOS_CAPABILITIES _sDETCaps;
extern PSTR _pSOSErrorStrings[];
extern BOOL _wSOSBufferAllocated[];
extern BOOL _wSOSSystemInitialized;
extern VDS_STRUCT _sSOSVDSInfo;
extern _SOS_FILL_INFO _sSOSFillInfo;
extern WORD _wSOSTimerEventIndex;
extern WORD _wSOSTimerEntered;
extern WORD _wSOSDriverSize[];
extern WORD _wSOSTimerSize[];
#ifdef __cplusplus
extern "C" {
#endif
extern WORD _sosDIGIData1_Start;
extern WORD _sosDIGIData1_End;
extern WORD _sosDIGIData2_Start;
extern WORD _sosDIGIData2_End;
extern BYTE _bTIMERInstalled;
extern BYTE _bTIMERDPMI;
extern WORD wDetectPort;
extern WORD wDetectIRQ;
extern WORD wDetectDMA;
extern WORD wDetectParam;
#ifdef __cplusplus
}
#endif
#pragma pack()
#endif


View File

@@ -0,0 +1,83 @@
/*
** 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/>.
*/
/****************************************************************************
File : sosdefs.h
Programmer(s) : Don Fowler, Nick Skrepetos
Date :
Purpose : Include Files For Zortech C++ Compiler
Last Updated :
****************************************************************************
Copyright(c) 1993,1994 Human Machine Interfaces
All Rights Reserved
****************************************************************************/
#ifndef _SOSDEFS_DEFINED
#define _SOSDEFS_DEFINED
#undef _TRUE
#undef _FALSE
#undef _NULL
enum
{
_FALSE,
_TRUE
};
#define _NULL 0
#ifndef VOID
#define VOID void
#endif
typedef int BOOL;
typedef unsigned int UINT;
typedef unsigned char BYTE;
typedef unsigned WORD;
#ifndef LONG
typedef signed long LONG;
#endif
typedef unsigned long DWORD;
typedef BYTE * PBYTE;
typedef char near * PSTR;
typedef WORD * PWORD;
typedef LONG * PLONG;
typedef VOID * PVOID;
typedef BYTE far * LPBYTE;
typedef BYTE far * LPSTR;
typedef WORD far * LPWORD;
typedef LONG far * LPLONG;
typedef VOID far * LPVOID;
typedef BYTE huge * HPBYTE;
typedef BYTE huge * HPSTR;
typedef WORD huge * HPWORD;
typedef LONG huge * HPLONG;
typedef VOID huge * HPVOID;
typedef unsigned HANDLE;
#endif


View File

@@ -0,0 +1,218 @@
/*
** 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/>.
*/
/****************************************************************************
File : sosfnct.h
Programmer(s) : Don Fowler, Nick Skrepetos
Date :
Purpose : Include Files For Zortech C++ Compiler
Last Updated :
****************************************************************************
Copyright(c) 1993,1994 Human Machine Interfaces
All Rights Reserved
****************************************************************************/
#ifndef _SOS_FUNCTIONS
#define _SOS_FUNCTIONS
#pragma pack(4)
WORD sosDIGILockMemory ( VOID );
WORD sosDIGIUnLockMemory ( VOID );
WORD sosDIGIInitSystem ( LPSTR, WORD );
WORD sosDIGIUnInitSystem ( VOID );
WORD sosDIGIInitDriver ( WORD, _SOS_HARDWARE far *,
_SOS_INIT_DRIVER far *, WORD far * );
WORD sosDIGIUnInitDriver ( WORD, BOOL, BOOL );
WORD sosDIGILoadDriver ( WORD, WORD, LPSTR far *, LPSTR far *, PSTR, PSTR, WORD * );
WORD sosDIGIUnLoadDriver ( WORD );
WORD sosDIGIGetDeviceCaps ( WORD, LPSOSDEVICECAPS );
#ifdef PHARLAP
LPSTR sosDIGIAllocateBuffer ( WORD , WORD *, WORD * );
#else
LPSTR sosDIGIAllocateBuffer ( WORD , WORD *, WORD * );
#endif
WORD sosDIGIStopSample ( WORD, WORD );
WORD sosDIGISamplesPlaying ( WORD );
BOOL sosDIGISampleDone ( WORD, WORD );
BOOL sosDIGISampleFilling ( WORD, WORD );
WORD sosDIGIStartSample ( WORD, _SOS_START_SAMPLE far * );
WORD sosDIGIContinueSample ( WORD, WORD, _SOS_START_SAMPLE far * );
WORD sosDIGIDetectInit ( LPSTR );
WORD sosDIGIDetectUnInit ( VOID );
WORD sosDIGIDetectFindHardware ( WORD, _SOS_CAPABILITIES far *, WORD far * );
WORD sosDIGIDetectFindFirst ( _SOS_CAPABILITIES far *, WORD far * );
WORD sosDIGIDetectFindNext ( _SOS_CAPABILITIES far *, WORD far * );
WORD sosDIGIDetectGetSettings ( _SOS_HARDWARE far * );
WORD sosDIGIDetectGetCaps ( WORD, _SOS_CAPABILITIES far * );
WORD sosDIGIDetectVerifySettings( _SOS_HARDWARE far * );
PSTR sosGetErrorString ( WORD );
WORD sosDIGILoadTimer ( WORD , LPSTR far *, LPSTR far *, PSTR, PSTR, WORD * );
WORD sosDIGIUnLoadTimer ( WORD );
WORD sosTIMERRegisterEvent ( WORD wCallRate, VOID ( far * lpTimerEvent )( VOID ), WORD far *lpTimerHandle );
WORD sosTIMERInitSystem ( WORD, WORD );
WORD sosTIMERUnInitSystem ( WORD );
WORD sosTIMERSetRate ( WORD );
WORD sosTIMERRemoveEvent ( WORD );
WORD sosTIMERAlterEventRate ( WORD, WORD );
WORD sosTIMERGetEventRate ( WORD );
VOID far sosTIMEROldHandler ( VOID );
VOID far sosTIMERHandler ( VOID );
// functions in soscntl.c
WORD sosDIGISetSampleVolume ( WORD, WORD, WORD );
WORD sosDIGIGetSampleVolume ( WORD, WORD );
WORD sosDIGISetChannel ( WORD, WORD, WORD );
WORD sosDIGIGetChannel ( WORD, WORD );
WORD sosDIGIGetBytesProcessed ( WORD, WORD );
WORD sosDIGIGetLoopCount ( WORD, WORD );
WORD sosDIGISetPanLocation ( WORD, WORD, WORD );
WORD sosDIGIGetPanLocation ( WORD, WORD );
DWORD sosDIGISetPitch ( WORD, WORD, DWORD );
DWORD sosDIGIGetPitch ( WORD, WORD );
WORD sosDIGIGetDMAPosition ( WORD );
WORD sosDIGISetPanSpeed ( WORD, WORD, WORD );
WORD sosDIGIGetPanSpeed ( WORD, WORD );
WORD sosDIGIGetSampleID ( WORD, WORD );
WORD sosDIGIGetSampleHandle ( WORD, WORD );
WORD sosDIGISetMasterVolume ( WORD, WORD );
#ifdef PHARLAP
VOID sosFreeVDSPage ( unsigned short, unsigned short, DWORD );
WORD sosAllocVDSPage ( unsigned short *, unsigned short *, DWORD * );
#else
WORD sosAllocVDSPage ( LPSTR *, WORD *, WORD * );
VOID sosFreeVDSPage ( WORD, WORD, LONG );
#endif
#ifdef __cplusplus
extern "C" {
#endif
#ifdef PHARLAP
extern int cdecl sosRealFree ( int );
extern BOOL cdecl _sos_read( WORD, LPSTR, WORD, WORD * );
extern int cdecl sosRealAlloc( int, int *, int * );
extern void cdecl sosDRVFarMemCopy( LPSTR, LPSTR, WORD );
extern int cdecl sosGetCS( VOID );
extern int cdecl sosGetES( VOID );
#else
extern int cdecl sosRealAlloc ( int, int *, int * );
extern int cdecl sosRealFree ( int );
#endif
// sos driver functions
extern WORD cdecl sosDRVLockMemory ( DWORD, DWORD );
extern WORD cdecl sosDRVUnLockMemory ( DWORD, DWORD );
extern void cdecl sosDRVGetCapsInfo ( LPSTR, LPSTR, _SOS_CAPABILITIES far * );
extern void cdecl sosDetDRVGetCapsInfo ( LPSTR, LPSTR, _SOS_CAPABILITIES far * );
extern void cdecl sosDRVGetCapsPtr ( LPSTR, LPSTR, _SOS_CAPABILITIES far * );
extern void cdecl sosDRVInit ( LPSTR, LPSTR, int, int, int, int, int, int );
extern void cdecl sosDRVStart ( LPSTR, LPSTR, int, int );
extern void cdecl sosDRVSetRate ( LPSTR, LPSTR, int );
extern void cdecl sosDRVSetAction ( LPSTR, LPSTR );
extern void cdecl sosDRVStop ( LPSTR, LPSTR );
extern void cdecl sosDRVUnInit ( LPSTR, LPSTR );
extern void cdecl sosDRVGetFillInfo ( LPSTR, LPSTR, LPSTR, int, int, int, _SOS_FILL_INFO * );
extern void cdecl sosFillSampleStructs ( PSTR, LPSTR );
extern WORD cdecl sosDetDRVExist ( LPSTR, LPSTR );
extern WORD cdecl sosDetDRVGetSettings ( LPSTR, LPSTR );
extern WORD cdecl sosDetDRVVerifySettings( LPSTR, WORD, WORD, WORD, LPSTR );
extern WORD cdecl sosDIGIInitForWindows( WORD );
extern WORD cdecl sosDIGIUnInitForWindows( WORD );
extern LPSTR cdecl sosAllocateFarMem ( WORD, PSTR, WORD * );
extern LPSTR cdecl sosCreateAliasCS ( LPSTR );
extern VOID cdecl sosFreeSelector ( LPSTR, DWORD );
extern LPSTR cdecl sosMAKEDOSPtr ( PSTR );
extern VOID cdecl sosDetDRVSetEnvString ( DWORD, PSTR );
extern PSTR cdecl sosDetDRVGetEnvString ( DWORD );
extern VOID cdecl sosDetDRVEnvStringInit ( LPSTR, LPSTR );
extern VOID cdecl sosDRVSetupCallFunctions( LPSTR, LPSTR, LPSTR, LPSTR );
extern WORD cdecl sosDRVGetFreeMemory ( VOID );
extern WORD cdecl sosDRVAllocVDSStruct ( WORD, WORD *, WORD * );
extern WORD cdecl sosDRVFreeVDSStruct ( WORD, WORD );
extern WORD cdecl sosDRVIsWindowsActive ( VOID );
extern WORD cdecl sosDRVVDSGetBuffer ( WORD );
extern WORD cdecl sosDRVVDSFreeBuffer ( WORD );
extern WORD cdecl getDS( VOID );
extern WORD cdecl sosDRVMakeDMASelector ( WORD );
extern WORD cdecl sosDRVFreeDMASelector ( WORD );
extern void cdecl sosTIMERDRVInit( int wRate, void ( far * )( void ) );
extern void cdecl sosTIMERDRVUnInit( void );
extern void cdecl sosTIMERDRVHandler( void );
extern void cdecl sosTIMERDRVFHandler( void );
extern void cdecl sosTIMERDRVEnable( void );
extern void cdecl sosTIMERDRVDisable( void );
extern void cdecl sosTIMERDRVCallOld( void );
extern void cdecl sosTIMERDRVSetRate( WORD );
extern void cdecl sosDIGITimer_Start( void );
extern void cdecl sosDIGITimer_End( void );
extern void cdecl sosDIGIDrv_Start( void );
extern void cdecl sosDIGIDrv_End( void );
#ifdef __cplusplus
}
#endif
// external functions for handling system initialization and
// uninitialization
WORD sosEXDIGInitDriver ( WORD, WORD, WORD, LPSTR,
_SOS_HARDWARE far *, WORD * );
WORD sosEXDIGIUnInitDriver ( VOID );
WORD sosEXDETFindDriver ( WORD, LPSTR, _SOS_HARDWARE far *,
_SOS_CAPABILITIES far * );
// memory locking prototypes
VOID sosDIGICaps_Start( VOID );
VOID sosDIGICaps_End( VOID );
VOID sosDIGIErr_Start( VOID );
VOID sosDIGIErr_End( VOID );
VOID sosDIGITmr_Start( VOID );
VOID sosDIGITmr_End( VOID );
VOID sosDIGIStart_Start( VOID );
VOID sosDIGIStart_End( VOID );
VOID sosDIGIPlyng_Start( VOID );
VOID sosDIGIPlyng_End( VOID );
VOID sosDIGIRate_Start( VOID );
VOID sosDIGIRate_End( VOID );
VOID sosDIGIDone_Start( VOID );
VOID sosDIGIDone_End( VOID );
VOID sosDIGIDetec_Start( VOID );
VOID sosDIGIDetec_End( VOID );
VOID sosDIGIInit_Start( VOID );
VOID sosDIGIInit_End( VOID );
VOID sosDIGILoad_Start( VOID );
VOID sosDIGILoad_End( VOID );
VOID sosDIGICntl_Start( VOID );
VOID sosDIGICntl_End( VOID );
#pragma pack()
#endif

View File

@@ -0,0 +1,129 @@
/*
** 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/>.
*/
/****************************************************************************
File : sosres.h
Programmer(s) : Don Fowler, Nick Skrepetos
Date :
Purpose : Include Files For Zortech C++ Compiler
Last Updated :
****************************************************************************
Copyright(c) 1993,1994 Human Machine Interfaces
All Rights Reserved
****************************************************************************/
#define _SOS_RESOURCE
#ifndef _SOS_RESOURCE
#define _SOS_RESOURCE
// structure for resource file header
typedef struct
{
// file version
WORD wVersion;
// file size
LONG dwFileSize;
// number of resources in file
WORD wResCount;
// offset of resource data from top of file
LONG dwResOffset;
// offset of sync track from top of file
LONG dwSyncTrackOffset;
} _RES_FILE_HEADER;
// structure for resource block header
typedef struct
{
// resource id
WORD wID;
// resource type
WORD wResType;
// offset of next block
LONG dwNextBlock;
// size of the current resource information
LONG dwResSize;
// rate to play block at
WORD wBlockRate;
// id for the sync track to use
WORD wSyncTrackID;
} _RES_BLOCK_HEADER;
// structure for sync mark tag
typedef struct _tagSYNCMARK
{
// ID of the type of mark being used
WORD wID;
// location in data of sync mark
LONG dwSyncOffset;
// length of sync block
LONG dwSyncSize;
// start sample data
_SOS_START_SAMPLE sampleData;
} _RES_SYNCMARK;
typedef union
{
// structure for sync mark tag
_RES_SYNCMARK syncMark;
} _RES_TAG;
// union for filter information for prepareWave
typedef union
{
// filter type
WORD wFilterID;
// structure for volume
struct volume
{
WORD wVolume;
};
// structure for delay
struct delay
{
WORD wDelaySamples;
};
} _SOS_FILTER;
#endif


124
WINVQ/INCLUDE/VQA32/UNVQ.H Normal file
View File

@@ -0,0 +1,124 @@
/*
** 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/>.
*/
#ifndef VQAUNVQ_H
#define VQAUNVQ_H
/****************************************************************************
*
* 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
* VQAPlay32 library. (32-Bit protected mode)
*
* FILE
* unvq.h
*
* DESCRIPTION
* VQ frame decompress definitions.
*
* PROGRAMMER
* Denzil E. Long, Jr.
*
* DATE
* Feburary 8, 1995
*
****************************************************************************/
#ifdef PHARLAP_TNT
#include <pltypes.h>
#endif
/*---------------------------------------------------------------------------
* FUNCTION PROTOTYPES
*-------------------------------------------------------------------------*/
#ifdef __cplusplus
extern "C" {
#endif
/* unvqbuff.asm */
#ifndef PHARLAP_TNT
void __cdecl UnVQ_2x2(unsigned char *codebook, unsigned char *pointers,
unsigned char *buffer, unsigned long blocksperrow,
unsigned long numrows, unsigned long bufwidth);
void __cdecl UnVQ_2x3(unsigned char *codebook, unsigned char *pointers,
unsigned char *buffer, unsigned long blocksperrow,
unsigned long numrows, unsigned long bufwidth);
void __cdecl UnVQ_4x2(unsigned char *codebook, unsigned char *pointers,
unsigned char *buffer, unsigned long blocksperrow,
unsigned long numrows, unsigned long bufwidth);
void __cdecl UnVQ_4x4(unsigned char *codebook, unsigned char *pointers,
unsigned char *buffer, unsigned long blocksperrow,
unsigned long numrows, unsigned long bufwidth);
void __cdecl UnVQ_4x2_Woofer(unsigned char *codebook, unsigned char *pointers,
unsigned char *buffer, unsigned long blocksperrow,
unsigned long numrows, unsigned long bufwidth);
/* unvqvesa.asm */
void __cdecl UnVQ_4x2_VESA320_32K(unsigned char *codebook,
unsigned char *pointers, unsigned char *palette,
unsigned long grains_per_win,unsigned long dummy1,unsigned long dummy2);
#else /* PHARLAP_TNT */
void __cdecl UnVQ_2x2(unsigned char *codebook, unsigned char *pointers,
FARPTR buffer, unsigned long blocksperrow, unsigned long numrows,
unsigned long bufwidth);
void __cdecl UnVQ_2x3(unsigned char *codebook, unsigned char *pointers,
FARPTR buffer, unsigned long blocksperrow, unsigned long numrows,
unsigned long bufwidth);
void __cdecl UnVQ_4x2(unsigned char *codebook, unsigned char *pointers,
FARPTR buffer, unsigned long blocksperrow, unsigned long numrows,
unsigned long bufwidth);
void __cdecl UnVQ_4x4(unsigned char *codebook, unsigned char *pointers,
FARPTR buffer, unsigned long blocksperrow, unsigned long numrows,
unsigned long bufwidth);
/* unvqvesa.asm */
void __cdecl UnVQ_4x2_VESA320_32K(unsigned char *codebook,
unsigned char *pointers, FARPTR palette, unsigned long grains_per_win,
unsigned long dummy1, unsigned long dummy2);
#endif /* PHARLAP_TNT */
/* unvqxmde.asm */
void __cdecl UnVQ_4x2_Xmode(unsigned char *codebook, unsigned char *pointers,
unsigned char *buffer, unsigned long blocksperrow,
unsigned long numrows, unsigned long dummy);
void __cdecl UnVQ_4x2_XmodeCB(unsigned char *cbdummy, unsigned char *pointers,
unsigned char *buffer, unsigned long blocksperrow,
unsigned long numrows, unsigned long dummy);
void __cdecl Upload_4x2CB(unsigned char *codebook, unsigned long numentries);
void __cdecl XlatePointers(unsigned char *pointers, unsigned long numpointers);
#ifdef __cplusplus
}
#endif
#endif /* VQAUNVQ_H */

View File

@@ -0,0 +1,197 @@
/*
** 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/>.
*/
#ifndef VQAFILE_H
#define VQAFILE_H
/****************************************************************************
*
* 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
* VQA player library. (32-Bit protected mode)
*
* FILE
* vqafile.h
*
* DESCRIPTION
* VQA file format definitions.
*
* PROGRAMMER
* Denzil E. Long, Jr.
*
* DATE
* April 10, 1995
*
****************************************************************************/
#include <vqm32\iff.h>
#ifdef __WATCOMC__
#pragma pack(1);
#endif
/*---------------------------------------------------------------------------
* STRUCTURE DEFINITIONS AND RELATED DEFINES.
*-------------------------------------------------------------------------*/
/* VQAHeader: VQA movie description header. (VQHD)
*
* Version - VQA version.
* Flags - Various flags. (See below)
* ImageWidth - Image width in pixels.
* ImageHeight - Image height in pixels.
* BlockWidth - Block width in pixels.
* BlockHeight - Block height in pixels.
* Frames - Total number of frames in the movie.
* FPS - Playback rate (Frame Per Second).
* Groupsize - Frame grouping size (frames per codebook).
* Num1Colors - Number of 1 color colors.
* CBentries - Number of codebook entries.
* Xpos - X position to draw frames. (-1 = Center)
* Ypos - Y position to draw frames. (-1 = Center)
* MaxFramesize - Size of largest frame.
* SampleRate - Sample rate of primary audio stream.
* Channels - Number of channels in primary audio stream.
* BitsPerSample - Sample bit size in primary audio stream.
* FutureUse - Reserved for future expansion.
*/
typedef struct _VQAHeader {
unsigned short Version;
unsigned short Flags;
unsigned short Frames;
unsigned short ImageWidth;
unsigned short ImageHeight;
unsigned char BlockWidth;
unsigned char BlockHeight;
unsigned char FPS;
unsigned char Groupsize;
unsigned short Num1Colors;
unsigned short CBentries;
unsigned short Xpos;
unsigned short Ypos;
unsigned short MaxFramesize;
unsigned short SampleRate;
unsigned char Channels;
unsigned char BitsPerSample;
unsigned short AltSampleRate;
unsigned char AltChannels;
unsigned char AltBitsPerSample;
unsigned short FutureUse[5];
} VQAHeader;
/* Version type. */
#define VQAHD_VER1 1
#define VQAHD_VER2 2
/* VQA header flag definitions */
#define VQAHDB_AUDIO 0 /* Audio track present. */
#define VQAHDB_ALTAUDIO 1 /* Alternate audio track present. */
#define VQAHDF_AUDIO (1<<VQAHDB_AUDIO)
#define VQAHDF_ALTAUDIO (1<<VQAHDB_ALTAUDIO)
/* Frame information (FINF) chunk definitions
*
* The FINF chunk contains a longword (4 bytes) entry for each
* frame in the movie. This entry is divided into two parts,
* flags (4 bits) and offset (28 bits).
*
* BITS NAME DESCRIPTION
* -----------------------------------------------------------
* 31-28 Flags 4 bitwise boolean flags.
* 27-0 Offset Offset in WORDS from the start of the file.
*/
#define VQAFINB_KEY 31
#define VQAFINB_PAL 30
#define VQAFINB_SYNC 29
#define VQAFINF_KEY (1L<<VQAFINB_KEY)
#define VQAFINF_PAL (1L<<VQAFINB_PAL)
#define VQAFINF_SYNC (1L<<VQAFINB_SYNC)
/* FINF related defines and macros. */
#define VQAFINF_OFFSET 0x0FFFFFFFL
#define VQAFINF_FLAGS 0xF0000000L
#define VQAFRAME_OFFSET(a) (((a & VQAFINF_OFFSET)<<1))
/* VQ vector pointer codes. */
#define VPC_ONE_SINGLE 0xF000 /* One single color block */
#define VPC_ONE_SEMITRANS 0xE000 /* One semitransparent block */
#define VPC_SHORT_DUMP 0xD000 /* Short dump of single color blocks */
#define VPC_LONG_DUMP 0xC000 /* Long dump of single color blocks */
#define VPC_SHORT_RUN 0xB000 /* Short run of single color blocks */
#define VPC_LONG_RUN 0xA000 /* Long run */
/* Long run codes. */
#define LRC_SEMITRANS 0xC000 /* Long run of semitransparent blocks. */
#define LRC_SINGLE 0x8000 /* Long run of single color blocks. */
/* Defines used for Run-Skip-Dump compression. */
#define MIN_SHORT_RUN_LENGTH 2
#define MAX_SHORT_RUN_LENGTH 15
#define MIN_LONG_RUN_LENGTH 2
#define MAX_LONG_RUN_LENGTH 4095
#define MIN_SHORT_DUMP_LENGTH 3
#define MAX_SHORT_DUMP_LENGTH 15
#define MIN_LONG_DUMP_LENGTH 2
#define MAX_LONG_DUMP_LENGTH 4095
#define WORD_HI_BIT 0x8000
/*---------------------------------------------------------------------------
* VQA FILE CHUNK ID DEFINITIONS.
*-------------------------------------------------------------------------*/
#define ID_WVQA MAKE_ID('W','V','Q','A') /* Westwood VQ Animation form. */
#define ID_VQHD MAKE_ID('V','Q','H','D') /* VQ header. */
#define ID_NAME MAKE_ID('N','A','M','E') /* Name string. */
#define ID_FINF MAKE_ID('F','I','N','F') /* Frame information. */
#define ID_VQFR MAKE_ID('V','Q','F','R') /* VQ frame container. */
#define ID_VQFK MAKE_ID('V','Q','F','K') /* VQ key frame container. */
#define ID_CBF0 MAKE_ID('C','B','F','0') /* Full codebook. */
#define ID_CBFZ MAKE_ID('C','B','F','Z') /* Full codebook (compressed). */
#define ID_CBP0 MAKE_ID('C','B','P','0') /* Partial codebook. */
#define ID_CBPZ MAKE_ID('C','B','P','Z') /* Partial codebook (compressed). */
#define ID_VPT0 MAKE_ID('V','P','T','0') /* Vector pointers. */
#define ID_VPTZ MAKE_ID('V','P','T','Z') /* Vector pointers (compressed). */
#define ID_VPTK MAKE_ID('V','P','T','K') /* Vector pointers (Delta Key). */
#define ID_VPTD MAKE_ID('V','P','T','D') /* Vector pointers (Delta). */
#define ID_VPTR MAKE_ID('V','P','T','R') /* Pointers RSD compressed. */
#define ID_VPRZ MAKE_ID('V','P','R','Z') /* Pointers RSD, lcw compressed. */
#define ID_CPL0 MAKE_ID('C','P','L','0') /* Color palette. */
#define ID_CPLZ MAKE_ID('C','P','L','Z') /* Color palette (compressed). */
#define ID_SND0 MAKE_ID('S','N','D','0') /* Sound */
#define ID_SND1 MAKE_ID('S','N','D','1') /* Sound (Zap compressed). */
#define ID_SND2 MAKE_ID('S','N','D','2') /* Sound (ADPCM compressed). */
#define ID_SNDZ MAKE_ID('S','N','D','Z') /* Sound (LCW compression). */
#define ID_SNA0 MAKE_ID('S','N','A','0') /* Sound */
#define ID_SNA1 MAKE_ID('S','N','A','1') /* Sound (Zap compressed). */
#define ID_SNA2 MAKE_ID('S','N','A','2') /* Sound (ADPCM compressed). */
#define ID_SNAZ MAKE_ID('S','N','A','Z') /* Sound (LCW compression). */
#define ID_CAP0 MAKE_ID('C','A','P','0') /* Caption text */
#define ID_EVA0 MAKE_ID('E','V','A','0') /* EVA text */
#ifdef __WATCOMC__
#pragma pack();
#endif
#endif /* VQAFILE_H */

View File

@@ -0,0 +1,355 @@
/*
** 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/>.
*/
#ifndef VQAPLAY_H
#define VQAPLAY_H
/****************************************************************************
*
* 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
* VQA player library. (32-Bit protected mode)
*
* FILE
* vqaplay.h
*
* DESCRIPTION
* VQAPlay library definitions.
*
* PROGRAMMER
* Bill Randolph
* Denzil E. Long, Jr.
*
* DATE
* April 10, 1995
*
****************************************************************************/
/*---------------------------------------------------------------------------
* CONDITIONAL COMPILATION FLAGS
*-------------------------------------------------------------------------*/
// MEG - 11.28.95 - added for debug
extern void Debug_Printf( char *format_string, ... );
#ifdef __WATCOMC__
#define VQASTANDALONE 0 /* Stand alone player */
#define VQAVOC_ON 0 /* Enable VOC file override */
#define VQAMONO_ON 0 /* Mono display output enable/disable */
#define VQADIRECT_SOUND 1 /* Use windows direct sound system */
#define VQAAUDIO_ON 1 /* Audio playback enable/disable */
#define VQAVIDEO_ON 0 /* Video manager enable/disable */
#define VQAMCGA_ON 1 /* MCGA enable/disable */
#define VQAXMODE_ON 0 /* Xmode enable/disable */
#define VQAVESA_ON 0 /* VESA enable/disable */
#define VQABLOCK_2X2 0 /* 2x2 block decode enable/disable */
#define VQABLOCK_2X3 0 /* 2x2 block decode enable/disable */
#define VQABLOCK_4X2 1 /* 4x2 block decode enable/disable */
#define VQABLOCK_4X4 0 /* 4x4 block decode enable/disable */
#define VQAWOOFER_ON 0
#else
#define VQASTANDALONE 0 /* Stand alone player */
#define VQAVOC_ON 0 /* Enable VOC file override */
#define VQAMONO_ON 1 /* Mono display output enable/disable */
#define VQADIRECT_SOUND 1 /* Use windows direct sound system */
#define VQAAUDIO_ON 1 /* Audio playback enable/disable */
#define VQAVIDEO_ON 0 /* Video manager enable/disable */
#define VQAMCGA_ON 1 /* MCGA enable/disable */
#define VQAXMODE_ON 0 /* Xmode enable/disable */
#define VQAVESA_ON 0 /* VESA enable/disable */
#define VQABLOCK_2X2 0 /* 2x2 block decode enable/disable */
#define VQABLOCK_2X3 0 /* 2x2 block decode enable/disable */
#define VQABLOCK_4X2 1 /* 4x2 block decode enable/disable */
#define VQABLOCK_4X4 0 /* 4x4 block decode enable/disable */
#define VQAWOOFER_ON 0
#endif
#if (VQAAUDIO_ON && VQADIRECT_SOUND)
#ifndef WIN32
#define WIN32 1
#ifndef _WIN32 // Denzil 6/2/98 Watcom 11.0 complains without this check
#define _WIN32
#endif // _WIN32
#endif
#undef WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <windowsx.h>
#include "dsound.h"
#endif
/*---------------------------------------------------------------------------
* GENERAL CONSTANT DEFINITIONS
*-------------------------------------------------------------------------*/
/* Playback modes. */
#define VQAMODE_RUN 0 /* Run the movie through the end. */
#define VQAMODE_WALK 1 /* Draw the next frame then return. */
#define VQAMODE_PAUSE 2 /* Suspend movie playback. */
#define VQAMODE_STOP 3 /* Stop the movie. */
/* Playback timer methods */
#define VQA_TMETHOD_DEFAULT -1 /* Use default timer method. */
#define VQA_TMETHOD_DOS 1 /* DOS timer method */
#define VQA_TMETHOD_INT 2 /* Interrupt timer method */
#define VQA_TMETHOD_AUDIO 3 /* Audio timer method */
#define VQA_TIMETICKS 60 /* Clock ticks per second */
/* Error/Status conditions */
#define VQAERR_NONE 0 /* No error */
#define VQAERR_EOF -1 /* Valid end of file */
#define VQAERR_OPEN -2 /* Unable to open */
#define VQAERR_READ -3 /* Read error */
#define VQAERR_WRITE -4 /* Write error */
#define VQAERR_SEEK -5 /* Seek error */
#define VQAERR_NOTVQA -6 /* Not a valid VQA file. */
#define VQAERR_NOMEM -7 /* Unable to allocate memory */
#define VQAERR_NOBUFFER -8 /* No buffer avail for load/draw */
#define VQAERR_NOT_TIME -9 /* Not time for frame yet */
#define VQAERR_SLEEPING -10 /* Function is in a sleep state */
#define VQAERR_VIDEO -11 /* Video related error. */
#define VQAERR_AUDIO -12 /* Audio related error. */
#define VQAERR_PAUSED -13 /* In paused state. */
/* Event flags. */
#define VQAEVENT_PALETTE (1<<0)
#define VQAEVENT_SYNC (1<<1)
/*---------------------------------------------------------------------------
* STRUCTURES AND RELATED DEFINITIONS
*-------------------------------------------------------------------------*/
/* VQAConfig: Player configuration structure
*
* DrawerCallback - User routine for Drawer to call each frame (NULL = none)
* EventHandler - User routine for notification to client of events.
* NotifyFlags - User specified events to be notified about.
* Vmode - Requested Video mode (May be promoted).
* VBIBit - Vertical blank bit polarity.
* ImageBuf - Pointer to caller's buffer for the Drawer to use as its
* ImageBuf; NULL = player will allocate its own, if
* VQACFGF_BUFFER is set in DrawFlags.
* ImageWidth - Width of Image buffer.
* ImageHeight - Height of Image buffer.
* X1 - Draw window X coordinate (-1 = Center).
* Y1 - Draw window Y coordinate (-1 = Center).
* FrameRate - Desired frames per second (-1 = use VQA header's value).
* DrawRate - Desired drawing frame rate; allows the Drawer to draw at
* a separate rate from the Loader.
* TimerMethod - Timer method to use during playback.
* DrawFlags - Bits control various special drawing options. (See below)
* OptionFlags - Bits control various special misc options. (See below)
* NumFrameBufs - Desired number of frame buffers. (Default = 6)
* NumCBBufs - Desired number of codebook buffers. (Default = 3)
* SoundObject - Ptr to callers Direct Sound Object (Default =NULL)
* PrimaryBufferPtr- Ptr to callers Primary Sound Buffer. (Default = NULL)
* VocFile - Name of VOC file to play instead of VQA audio track.
* AudioBuf - Pointer to audio buffer.
* AudioBufSize - Size of audio buffer. (Default = 32768)
* AudioRate - Audio data playback rate (-1 = use samplerate scaled
* to the frame rate)
* Volume - Audio playback volume. (0x7FFF = max)
* HMIBufSize - Desired HMI buffer size. (Default = 2000)
* DigiHandle - Handle to an initialized sound driver. (-1 = none)
* DigiCard - HMI ID of card to use. (0 = none, -1 = auto-detect)
* DigiPort - Audio port address. (-1 = auto-detect)
* DigiIRQ - Audio IRQ. (-1 = auto-detect)
* DigiDMA - Audio DMA channel. (-1 = auto-detect)
* Language - Language identifier. (Not used)
* CapFont - Pointer to font to use for subtitle text captions.
* EVAFont - Pointer to font to use for E.V.A text cations. (For C&C)
*/
typedef struct _VQAConfig {
long (*DrawerCallback)(unsigned char *screen, long framenum);
long (*EventHandler)(unsigned long event,void *buffer,long nbytes);
unsigned long NotifyFlags;
long Vmode;
long VBIBit;
unsigned char *ImageBuf;
long ImageWidth;
long ImageHeight;
long X1,Y1;
long FrameRate;
long DrawRate;
long TimerMethod;
long DrawFlags;
long OptionFlags;
long NumFrameBufs;
long NumCBBufs;
#if (VQADIRECT_SOUND)
LPDIRECTSOUND SoundObject;
LPDIRECTSOUNDBUFFER PrimaryBufferPtr;
#endif //(VQADIRECT_SOUND)
char *VocFile;
unsigned char *AudioBuf;
long AudioBufSize;
long AudioRate;
long Volume;
long HMIBufSize;
long DigiHandle;
long DigiCard;
long DigiPort;
long DigiIRQ;
long DigiDMA;
long Language;
char *CapFont;
char *EVAFont; /* For C&C Only */
} VQAConfig;
/* Drawer Configuration flags (DrawFlags) */
#define VQACFGB_BUFFER 0 /* Buffer UnVQ enable */
#define VQACFGB_NODRAW 1 /* Drawing disable */
#define VQACFGB_NOSKIP 2 /* Disable frame skipping. */
#define VQACFGB_VRAMCB 3 /* XMode VRAM copy enable */
#define VQACFGB_ORIGIN 4 /* 0,0 origin position */
#define VQACFGB_SCALEX2 6 /* Scale X2 enable (VESA 320x200 to 640x400) */
#define VQACFGB_WOOFER 7
#define VQACFGF_BUFFER (1<<VQACFGB_BUFFER)
#define VQACFGF_NODRAW (1<<VQACFGB_NODRAW)
#define VQACFGF_NOSKIP (1<<VQACFGB_NOSKIP)
#define VQACFGF_VRAMCB (1<<VQACFGB_VRAMCB)
#define VQACFGF_ORIGIN (3<<VQACFGB_ORIGIN)
#define VQACFGF_TOPLEFT (0<<VQACFGB_ORIGIN)
#define VQACFGF_TOPRIGHT (1<<VQACFGB_ORIGIN)
#define VQACFGF_BOTRIGHT (2<<VQACFGB_ORIGIN)
#define VQACFGF_BOTLEFT (3<<VQACFGB_ORIGIN)
#define VQACFGF_SCALEX2 (1<<VQACFGB_SCALEX2)
#define VQACFGF_WOOFER (1<<VQACFGB_WOOFER)
/* Options Configuration (OptionFlags) */
#define VQAOPTB_AUDIO 0 /* Audio enable. */
#define VQAOPTB_STEP 1 /* Single step enable. */
#define VQAOPTB_MONO 2 /* Mono output enable. */
#define VQAOPTB_PALOFF 3 /* Palette set disable. */
#define VQAOPTB_SLOWPAL 4 /* Slow palette enable. */
#define VQAOPTB_HMIINIT 5 /* HMI already initialized by client. */
#define VQAOPTB_ALTAUDIO 6 /* Use alternate audio track. */
#define VQAOPTB_CAPTIONS 7 /* Show captions. */
#define VQAOPTB_EVA 8 /* Show EVA text (For C&C only) */
#define VQAOPTF_AUDIO (1<<VQAOPTB_AUDIO)
#define VQAOPTF_STEP (1<<VQAOPTB_STEP)
#define VQAOPTF_MONO (1<<VQAOPTB_MONO)
#define VQAOPTF_PALOFF (1<<VQAOPTB_PALOFF)
#define VQAOPTF_SLOWPAL (1<<VQAOPTB_SLOWPAL)
#define VQAOPTF_HMIINIT (1<<VQAOPTB_HMIINIT)
#define VQAOPTF_ALTAUDIO (1<<VQAOPTB_ALTAUDIO)
#define VQAOPTF_CAPTIONS (1<<VQAOPTB_CAPTIONS)
#define VQAOPTF_EVA (1<<VQAOPTB_EVA) /* For C&C only */
/* VQAInfo: Information about the VQA movie.
*
* NumFrames - The number of frames contained in the movie.
* ImageHeight - Height of image in pixels.
* ImageWidth - Width of image in pixels.
* ImageBuf - Pointer to the image buffer VQA draw into.
*/
typedef struct _VQAInfo {
long NumFrames;
long ImageWidth;
long ImageHeight;
unsigned char *ImageBuf;
} VQAInfo;
/* VQAStatistics: Statistics about the VQA movie played.
*
* StartTime - Time movie started.
* EndTime - Time movie stoped.
* FramesLoaded - Total number of frames loaded.
* FramesDrawn - Total number of frames drawn.
* FramesSkipped - Total number of frames skipped.
* MaxFrameSize - Size of largest frame.
* SamplesPlayed - Number of sample bytes played.
* MemUsed - Total bytes used. (Low memory)
*/
typedef struct _VQAStatistics {
long StartTime;
long EndTime;
long FramesLoaded;
long FramesDrawn;
long FramesSkipped;
long MaxFrameSize;
unsigned long SamplesPlayed;
unsigned long MemUsed;
} VQAStatistics;
/* VQAHandle: VQA file handle. (Must be obtained by calling VQA_Alloc()
* and freed through VQA_Free(). This is the only legal way
* to obtain and dispose of a VQAHandle.
*
* VQAio - Something meaningful to the IO manager. (See DOCS)
*/
typedef struct _VQAHandle {
unsigned long VQAio;
} VQAHandle;
/* Possible IO command values */
#define VQACMD_INIT 1 /* Prepare the IO for a session */
#define VQACMD_CLEANUP 2 /* Terminate IO session */
#define VQACMD_OPEN 3 /* Open file */
#define VQACMD_CLOSE 4 /* Close file */
#define VQACMD_READ 5 /* Read bytes */
#define VQACMD_WRITE 6 /* Write bytes */
#define VQACMD_SEEK 7 /* Seek */
/*---------------------------------------------------------------------------
* FUNCTION PROTOTYPES
*-------------------------------------------------------------------------*/
/* Configuration routines. */
void VQA_INIConfig(VQAConfig *config);
void VQA_DefaultConfig(VQAConfig *config);
/* Handle manipulation routines. */
VQAHandle *VQA_Alloc(void);
void VQA_Free(VQAHandle *vqa);
void VQA_Reset(VQAHandle *vqa);
void VQA_InitAsDOS(VQAHandle *vqa);
void VQA_Init(VQAHandle *vqa, long(*iohandler)(VQAHandle *vqa, long action,
void *buffer, long nbytes));
unsigned char *VQA_GetPalette(VQAHandle *vqa);
long VQA_GetPaletteSize(VQAHandle *vqa);
void VQA_Set_DrawBuffer(VQAHandle *vqa, unsigned char *buffer,
unsigned long width, unsigned long height,
long xpos, long ypos);
/* File routines. */
long VQA_Open(VQAHandle *vqa, char const *filename, VQAConfig *config);
void VQA_Close(VQAHandle *vqa);
long VQA_Play(VQAHandle *vqa, long mode);
long VQA_SeekFrame(VQAHandle *vqa, long frame, long fromwhere);
long VQA_SetStop(VQAHandle *vqa, long stop);
/* Information/statistics access routines. */
void VQA_GetInfo(VQAHandle *vqa, VQAInfo *info);
void VQA_GetStats(VQAHandle *vqa, VQAStatistics *stats);
char *VQA_Version(void);
char *VQA_IDString(void);
#endif /* VQAPLAY_H */

View File

@@ -0,0 +1,353 @@
/*
** 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/>.
*/
#ifndef VQAPLAY_H
#define VQAPLAY_H
/****************************************************************************
*
* 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
* VQA player library. (32-Bit protected mode)
*
* FILE
* vqaplay.h
*
* DESCRIPTION
* VQAPlay library definitions.
*
* PROGRAMMER
* Bill Randolph
* Denzil E. Long, Jr.
*
* DATE
* April 10, 1995
*
****************************************************************************/
/*---------------------------------------------------------------------------
* CONDITIONAL COMPILATION FLAGS
*-------------------------------------------------------------------------*/
// MEG - 11.28.95 - added for debug
extern void Debug_Printf( char *format_string, ... );
#ifdef __WATCOMC__
#define VQASTANDALONE 0 /* Stand alone player */
#define VQAVOC_ON 0 /* Enable VOC file override */
#define VQAMONO_ON 0 /* Mono display output enable/disable */
#define VQADIRECT_SOUND 1 /* Use windows direct sound system */
#define VQAAUDIO_ON 1 /* Audio playback enable/disable */
#define VQAVIDEO_ON 0 /* Video manager enable/disable */
#define VQAMCGA_ON 1 /* MCGA enable/disable */
#define VQAXMODE_ON 0 /* Xmode enable/disable */
#define VQAVESA_ON 0 /* VESA enable/disable */
#define VQABLOCK_2X2 0 /* 2x2 block decode enable/disable */
#define VQABLOCK_2X3 0 /* 2x2 block decode enable/disable */
#define VQABLOCK_4X2 1 /* 4x2 block decode enable/disable */
#define VQABLOCK_4X4 0 /* 4x4 block decode enable/disable */
#define VQAWOOFER_ON 0
#else
#define VQASTANDALONE 0 /* Stand alone player */
#define VQAVOC_ON 0 /* Enable VOC file override */
#define VQAMONO_ON 1 /* Mono display output enable/disable */
#define VQADIRECT_SOUND 1 /* Use windows direct sound system */
#define VQAAUDIO_ON 1 /* Audio playback enable/disable */
#define VQAVIDEO_ON 0 /* Video manager enable/disable */
#define VQAMCGA_ON 1 /* MCGA enable/disable */
#define VQAXMODE_ON 0 /* Xmode enable/disable */
#define VQAVESA_ON 0 /* VESA enable/disable */
#define VQABLOCK_2X2 0 /* 2x2 block decode enable/disable */
#define VQABLOCK_2X3 0 /* 2x2 block decode enable/disable */
#define VQABLOCK_4X2 1 /* 4x2 block decode enable/disable */
#define VQABLOCK_4X4 0 /* 4x4 block decode enable/disable */
#define VQAWOOFER_ON 0
#endif
#if (VQAAUDIO_ON && VQADIRECT_SOUND)
#ifndef WIN32 1
#define WIN32
#define _WIN32
#endif
#undef WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <windowsx.h>
#include "dsound.h"
#endif
/*---------------------------------------------------------------------------
* GENERAL CONSTANT DEFINITIONS
*-------------------------------------------------------------------------*/
/* Playback modes. */
#define VQAMODE_RUN 0 /* Run the movie through the end. */
#define VQAMODE_WALK 1 /* Draw the next frame then return. */
#define VQAMODE_PAUSE 2 /* Suspend movie playback. */
#define VQAMODE_STOP 3 /* Stop the movie. */
/* Playback timer methods */
#define VQA_TMETHOD_DEFAULT -1 /* Use default timer method. */
#define VQA_TMETHOD_DOS 1 /* DOS timer method */
#define VQA_TMETHOD_INT 2 /* Interrupt timer method */
#define VQA_TMETHOD_AUDIO 3 /* Audio timer method */
#define VQA_TIMETICKS 60 /* Clock ticks per second */
/* Error/Status conditions */
#define VQAERR_NONE 0 /* No error */
#define VQAERR_EOF -1 /* Valid end of file */
#define VQAERR_OPEN -2 /* Unable to open */
#define VQAERR_READ -3 /* Read error */
#define VQAERR_WRITE -4 /* Write error */
#define VQAERR_SEEK -5 /* Seek error */
#define VQAERR_NOTVQA -6 /* Not a valid VQA file. */
#define VQAERR_NOMEM -7 /* Unable to allocate memory */
#define VQAERR_NOBUFFER -8 /* No buffer avail for load/draw */
#define VQAERR_NOT_TIME -9 /* Not time for frame yet */
#define VQAERR_SLEEPING -10 /* Function is in a sleep state */
#define VQAERR_VIDEO -11 /* Video related error. */
#define VQAERR_AUDIO -12 /* Audio related error. */
#define VQAERR_PAUSED -13 /* In paused state. */
/* Event flags. */
#define VQAEVENT_PALETTE (1<<0)
#define VQAEVENT_SYNC (1<<1)
/*---------------------------------------------------------------------------
* STRUCTURES AND RELATED DEFINITIONS
*-------------------------------------------------------------------------*/
/* VQAConfig: Player configuration structure
*
* DrawerCallback - User routine for Drawer to call each frame (NULL = none)
* EventHandler - User routine for notification to client of events.
* NotifyFlags - User specified events to be notified about.
* Vmode - Requested Video mode (May be promoted).
* VBIBit - Vertical blank bit polarity.
* ImageBuf - Pointer to caller's buffer for the Drawer to use as its
* ImageBuf; NULL = player will allocate its own, if
* VQACFGF_BUFFER is set in DrawFlags.
* ImageWidth - Width of Image buffer.
* ImageHeight - Height of Image buffer.
* X1 - Draw window X coordinate (-1 = Center).
* Y1 - Draw window Y coordinate (-1 = Center).
* FrameRate - Desired frames per second (-1 = use VQA header's value).
* DrawRate - Desired drawing frame rate; allows the Drawer to draw at
* a separate rate from the Loader.
* TimerMethod - Timer method to use during playback.
* DrawFlags - Bits control various special drawing options. (See below)
* OptionFlags - Bits control various special misc options. (See below)
* NumFrameBufs - Desired number of frame buffers. (Default = 6)
* NumCBBufs - Desired number of codebook buffers. (Default = 3)
* SoundObject - Ptr to callers Direct Sound Object (Default =NULL)
* PrimaryBufferPtr- Ptr to callers Primary Sound Buffer. (Default = NULL)
* VocFile - Name of VOC file to play instead of VQA audio track.
* AudioBuf - Pointer to audio buffer.
* AudioBufSize - Size of audio buffer. (Default = 32768)
* AudioRate - Audio data playback rate (-1 = use samplerate scaled
* to the frame rate)
* Volume - Audio playback volume. (0x7FFF = max)
* HMIBufSize - Desired HMI buffer size. (Default = 2000)
* DigiHandle - Handle to an initialized sound driver. (-1 = none)
* DigiCard - HMI ID of card to use. (0 = none, -1 = auto-detect)
* DigiPort - Audio port address. (-1 = auto-detect)
* DigiIRQ - Audio IRQ. (-1 = auto-detect)
* DigiDMA - Audio DMA channel. (-1 = auto-detect)
* Language - Language identifier. (Not used)
* CapFont - Pointer to font to use for subtitle text captions.
* EVAFont - Pointer to font to use for E.V.A text cations. (For C&C)
*/
typedef struct _VQAConfig {
long (*DrawerCallback)(unsigned char *screen, long framenum);
long (*EventHandler)(unsigned long event,void *buffer,long nbytes);
unsigned long NotifyFlags;
long Vmode;
long VBIBit;
unsigned char *ImageBuf;
long ImageWidth;
long ImageHeight;
long X1,Y1;
long FrameRate;
long DrawRate;
long TimerMethod;
long DrawFlags;
long OptionFlags;
long NumFrameBufs;
long NumCBBufs;
#if (VQADIRECT_SOUND)
LPDIRECTSOUND SoundObject;
LPDIRECTSOUNDBUFFER PrimaryBufferPtr;
#endif //(VQADIRECT_SOUND)
char *VocFile;
unsigned char *AudioBuf;
long AudioBufSize;
long AudioRate;
long Volume;
long HMIBufSize;
long DigiHandle;
long DigiCard;
long DigiPort;
long DigiIRQ;
long DigiDMA;
long Language;
char *CapFont;
char *EVAFont; /* For C&C Only */
} VQAConfig;
/* Drawer Configuration flags (DrawFlags) */
#define VQACFGB_BUFFER 0 /* Buffer UnVQ enable */
#define VQACFGB_NODRAW 1 /* Drawing disable */
#define VQACFGB_NOSKIP 2 /* Disable frame skipping. */
#define VQACFGB_VRAMCB 3 /* XMode VRAM copy enable */
#define VQACFGB_ORIGIN 4 /* 0,0 origin position */
#define VQACFGB_SCALEX2 6 /* Scale X2 enable (VESA 320x200 to 640x400) */
#define VQACFGB_WOOFER 7
#define VQACFGF_BUFFER (1<<VQACFGB_BUFFER)
#define VQACFGF_NODRAW (1<<VQACFGB_NODRAW)
#define VQACFGF_NOSKIP (1<<VQACFGB_NOSKIP)
#define VQACFGF_VRAMCB (1<<VQACFGB_VRAMCB)
#define VQACFGF_ORIGIN (3<<VQACFGB_ORIGIN)
#define VQACFGF_TOPLEFT (0<<VQACFGB_ORIGIN)
#define VQACFGF_TOPRIGHT (1<<VQACFGB_ORIGIN)
#define VQACFGF_BOTRIGHT (2<<VQACFGB_ORIGIN)
#define VQACFGF_BOTLEFT (3<<VQACFGB_ORIGIN)
#define VQACFGF_SCALEX2 (1<<VQACFGB_SCALEX2)
#define VQACFGF_WOOFER (1<<VQACFGB_WOOFER)
/* Options Configuration (OptionFlags) */
#define VQAOPTB_AUDIO 0 /* Audio enable. */
#define VQAOPTB_STEP 1 /* Single step enable. */
#define VQAOPTB_MONO 2 /* Mono output enable. */
#define VQAOPTB_PALOFF 3 /* Palette set disable. */
#define VQAOPTB_SLOWPAL 4 /* Slow palette enable. */
#define VQAOPTB_HMIINIT 5 /* HMI already initialized by client. */
#define VQAOPTB_ALTAUDIO 6 /* Use alternate audio track. */
#define VQAOPTB_CAPTIONS 7 /* Show captions. */
#define VQAOPTB_EVA 8 /* Show EVA text (For C&C only) */
#define VQAOPTF_AUDIO (1<<VQAOPTB_AUDIO)
#define VQAOPTF_STEP (1<<VQAOPTB_STEP)
#define VQAOPTF_MONO (1<<VQAOPTB_MONO)
#define VQAOPTF_PALOFF (1<<VQAOPTB_PALOFF)
#define VQAOPTF_SLOWPAL (1<<VQAOPTB_SLOWPAL)
#define VQAOPTF_HMIINIT (1<<VQAOPTB_HMIINIT)
#define VQAOPTF_ALTAUDIO (1<<VQAOPTB_ALTAUDIO)
#define VQAOPTF_CAPTIONS (1<<VQAOPTB_CAPTIONS)
#define VQAOPTF_EVA (1<<VQAOPTB_EVA) /* For C&C only */
/* VQAInfo: Information about the VQA movie.
*
* NumFrames - The number of frames contained in the movie.
* ImageHeight - Height of image in pixels.
* ImageWidth - Width of image in pixels.
* ImageBuf - Pointer to the image buffer VQA draw into.
*/
typedef struct _VQAInfo {
long NumFrames;
long ImageWidth;
long ImageHeight;
unsigned char *ImageBuf;
} VQAInfo;
/* VQAStatistics: Statistics about the VQA movie played.
*
* StartTime - Time movie started.
* EndTime - Time movie stoped.
* FramesLoaded - Total number of frames loaded.
* FramesDrawn - Total number of frames drawn.
* FramesSkipped - Total number of frames skipped.
* MaxFrameSize - Size of largest frame.
* SamplesPlayed - Number of sample bytes played.
* MemUsed - Total bytes used. (Low memory)
*/
typedef struct _VQAStatistics {
long StartTime;
long EndTime;
long FramesLoaded;
long FramesDrawn;
long FramesSkipped;
long MaxFrameSize;
unsigned long SamplesPlayed;
unsigned long MemUsed;
} VQAStatistics;
/* VQAHandle: VQA file handle. (Must be obtained by calling VQA_Alloc()
* and freed through VQA_Free(). This is the only legal way
* to obtain and dispose of a VQAHandle.
*
* VQAio - Something meaningful to the IO manager. (See DOCS)
*/
typedef struct _VQAHandle {
unsigned long VQAio;
} VQAHandle;
/* Possible IO command values */
#define VQACMD_INIT 1 /* Prepare the IO for a session */
#define VQACMD_CLEANUP 2 /* Terminate IO session */
#define VQACMD_OPEN 3 /* Open file */
#define VQACMD_CLOSE 4 /* Close file */
#define VQACMD_READ 5 /* Read bytes */
#define VQACMD_WRITE 6 /* Write bytes */
#define VQACMD_SEEK 7 /* Seek */
/*---------------------------------------------------------------------------
* FUNCTION PROTOTYPES
*-------------------------------------------------------------------------*/
/* Configuration routines. */
void VQA_INIConfig(VQAConfig *config);
void VQA_DefaultConfig(VQAConfig *config);
/* Handle manipulation routines. */
VQAHandle *VQA_Alloc(void);
void VQA_Free(VQAHandle *vqa);
void VQA_Reset(VQAHandle *vqa);
void VQA_InitAsDOS(VQAHandle *vqa);
void VQA_Init(VQAHandle *vqa, long(*iohandler)(VQAHandle *vqa, long action,
void *buffer, long nbytes));
unsigned char *VQA_GetPalette(VQAHandle *vqa);
long VQA_GetPaletteSize(VQAHandle *vqa);
void VQA_Set_DrawBuffer(VQAHandle *vqa, unsigned char *buffer,
unsigned long width, unsigned long height,
long xpos, long ypos);
/* File routines. */
long VQA_Open(VQAHandle *vqa, char const *filename, VQAConfig *config);
void VQA_Close(VQAHandle *vqa);
long VQA_Play(VQAHandle *vqa, long mode);
long VQA_SeekFrame(VQAHandle *vqa, long frame, long fromwhere);
long VQA_SetStop(VQAHandle *vqa, long stop);
/* Information/statistics access routines. */
void VQA_GetInfo(VQAHandle *vqa, VQAInfo *info);
void VQA_GetStats(VQAHandle *vqa, VQAStatistics *stats);
char *VQA_Version(void);
char *VQA_IDString(void);
#endif /* VQAPLAY_H */

View File

@@ -0,0 +1,540 @@
/*
** 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/>.
*/
#ifndef VQAPLAYP_H
#define VQAPLAYP_H
/****************************************************************************
*
* 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
* VQA player library. (32-Bit protected mode)
*
* FILE
* vqaplayp.h
*
* DESCRIPTION
* VQAPlay private library definitions.
*
* PROGRAMMER
* Denzil E. Long, Jr.
* Bill Randolph
*
* DATE
* August 21, 1995
*
****************************************************************************/
#include <vqm32\video.h>
#include <vqm32\soscomp.h>
#include <vqm32\captoken.h>
#include "vqafile.h"
#include "vqaplay.h"
#include "caption.h"
#if(VQAAUDIO_ON)
#if(VQADIRECT_SOUND)
extern HWND MainWindow;
#else
#include "sos.h"
#endif
#endif
/*---------------------------------------------------------------------------
* GENERAL CONSTANT DEFINITIONS
*-------------------------------------------------------------------------*/
/* Internal library version. */
#define VQA_VERSION "2.42"
#define VQA_DATE __DATE__" "__TIME__
#define VQA_IDSTRING "VQA32 "VQA_VERSION" ("VQA_DATE")"
#define VQA_REQUIRES "VQM32 2.12 or better."
/* Block dimensions macro and identifiers. */
#define BLOCK_DIM(a,b) (((a&0xFF)<<8)|(b&0xFF))
#define BLOCK_2X2 BLOCK_DIM(2,2)
#define BLOCK_2X3 BLOCK_DIM(2,3)
#define BLOCK_4X2 BLOCK_DIM(4,2)
#define BLOCK_4X4 BLOCK_DIM(4,4)
/* Memory limits */
#define VQA_MAX_CBBUFS 10 /* Maximum number of codebook buffers */
#define VQA_MAX_FRAMEBUFS 30 /* Maximum number of frame buffers */
/* Special Constants */
#define VQA_MASK_POINTER 0x8000 /* Pointer value to use for masking. */
/*---------------------------------------------------------------------------
* STRUCTURES AND RELATED DEFINITIONS
*-------------------------------------------------------------------------*/
/* ChunkHeader: IFF chunk identifier header.
*
* id - 4 Byte chunk id.
* size - Size of chunk.
*/
typedef struct _ChunkHeader {
unsigned long id;
unsigned long size;
} ChunkHeader;
/* ZAPHeader: ZAP audio compression header. NOTE: If the uncompressed size
* and the compressed size are equal then the audio frame is RAW
* (NOT COMPRESSED).
*
* UnCompSize - Uncompressed size in bytes.
* CompSize - Compressed size in bytes.
*/
typedef struct _ZAPHeader {
unsigned short UnCompSize;
unsigned short CompSize;
} ZAPHeader;
/* VQACBNode: A circular list of codebook buffers, used by the load task.
* If the data is compressed, it is loaded into the end of the
* buffer and the compression flags is set. Otherwise the data
* is loaded into the start of the buffer.
* (Make sure this structure's size is always DWORD aligned.)
*
* Buffer - Pointer to Codebook data.
* Next - Pointer to next VQACBNode in the codebook list.
* Flags - Used by the drawer to tell if certain operations have been
* performed on this codebook, such as downloading to VRAM,
* or pre-scaling it. This field is cleared by the Loader when a
* new codebook is loaded.
* CBOffset - Offset into the buffer of the compressed data.
*/
typedef struct _VQACBNode {
unsigned char *Buffer;
struct _VQACBNode *Next;
unsigned long Flags;
unsigned long CBOffset;
} VQACBNode;
/* VQACBNode flags */
#define VQACBB_DOWNLOADED 0 /* Download codebook to VRAM (XMODE VRAM) */
#define VQACBB_CBCOMP 1 /* Codebook is compressed */
#define VQACBF_DOWNLOADED (1<<VQACBB_DOWNLOADED)
#define VQACBF_CBCOMP (1<<VQACBB_CBCOMP)
/* VQAFrameNode: A circular list of frame buffers, filled in by the load
* task. If the data is compressed, it is loaded into the end
* of the buffer and the compress flag is set. Otherwise, it's
* loaded into the start of the buffer.
* (Make sure this structure's size is always DWORD aligned.)
*
* Pointers - Pointer to the vector pointer data.
* Codebook - Pointer to VQACBNode list entry for this frame.
* Palette - Pointer to an array of palette colors (R,G,B).
* Next - Pointer to the next entry in the Frame Buffer List.
* Flags - Inter-process communication flags for this frame (see below)
* set by Loader, cleared by Flipper.
* FrameNum - Number of this frame in the animation.
* PtrOffset - Offset into buffer of the compressed vector pointer data.
* PalOffset - Offset into buffer of the compressed palette data.
* PaletteSize - Size of the palette for this frame (in bytes).
*/
typedef struct _VQAFrameNode {
unsigned char *Pointers;
VQACBNode *Codebook;
unsigned char *Palette;
struct _VQAFrameNode *Next;
unsigned long Flags;
long FrameNum;
long PtrOffset;
long PalOffset;
long PaletteSize;
} VQAFrameNode;
/* FrameNode flags */
#define VQAFRMB_LOADED 0 /* Frame loaded */
#define VQAFRMB_KEY 1 /* Key Frame (must be drawn) */
#define VQAFRMB_PALETTE 2 /* Palette needs set */
#define VQAFRMB_PALCOMP 3 /* Palette is compressed */
#define VQAFRMB_PTRCOMP 4 /* Vector pointer data is compressed */
#define VQAFRMF_LOADED (1<<VQAFRMB_LOADED)
#define VQAFRMF_KEY (1<<VQAFRMB_KEY)
#define VQAFRMF_PALETTE (1<<VQAFRMB_PALETTE)
#define VQAFRMF_PALCOMP (1<<VQAFRMB_PALCOMP)
#define VQAFRMF_PTRCOMP (1<<VQAFRMB_PTRCOMP)
/* VQALoader: Data needed exclusively by the Loader.
* (Make sure this structure's size is always DWORD aligned.)
*
* CurCB - Pointer to the current codebook node to load data into.
* FullCB - Pointer to the last fully-loaded codebook node.
* CurFrame - Pointer to the current frame node to load data into.
* NumPartialCB - Number of partial codebooks accumulated.
* PartialCBSize - Size of partial codebook (LCW'd or not), in bytes
* CurFrameNum - The number of the frame being loaded by the Loader.
* LastCBFrame - Last frame in the animation that contains a partial CB
* LastFrameNum - Number of the last loaded frame
* WaitsOnDrawer - Number of wait states Loader hits waiting on the Drawer
* WaitsOnAudio - Number of wait states Loader hits waiting on HMI
* FrameSize - Size of the last frame in bytes.
* MaxFrameSize - Size of the largest frame in the animation.
* CurChunkHdr - Chunk header of the chunk currently being processed.
*/
typedef struct _VQALoader {
VQACBNode *CurCB;
VQACBNode *FullCB;
VQAFrameNode *CurFrame;
long NumPartialCB;
long PartialCBSize;
long CurFrameNum;
long LastCBFrame;
long LastFrameNum;
long WaitsOnDrawer;
long WaitsOnAudio;
long FrameSize;
long MaxFrameSize;
ChunkHeader CurChunkHdr;
} VQALoader;
/* VQADrawer: Data needed exclusively by the Drawer.
* (Make sure this structure's size is always DWORD aligned.)
*
* CurFrame - Pointer to the current frame to draw.
* Flags - Flags for the draw routines (IE: VQADRWF_SETPAL)
* Display - Pointer to DisplayInfo structure for active video mode.
* ImageBuf - Buffer to un-vq into, must be DWORD aligned.
* ImageWidth - Width of Image buffer (in pixels).
* ImageHeight - Height of Image buffer (in pixels).
* X1,Y1,X2,Y2 - Coordinates of image corners (in pixels).
* ScreenOffset - Offset into screen memory, for centering small images.
* CurPalSize - Size of the current palette in bytes.
* Palette_24 - Copy of the last-loaded palette
* Palette_15 - 15-bit version of Palette_24, for 32K-color modes
* BlocksPerRow - # of VQ blocks per row for this resolution/block width.
* NumRows - # of rows of VQ blocks for this resolution/block height.
* NumBlocks - Total number of blocks in the image.
* MaskStart - Pointer index of start of mask rectangle.
* MaskWidth - Width of mask rectangle, in blocks.
* MaskHeight - Height of mask rectangle, in blocks.
* LastTime - The time when that last frame was drawn.
* LastFrame - The number of the last frame selected.
* LastFrameNum - Number of the last frame drawn.
* DesiredFrame - The number of the frame that should be drawn.
* NumSkipped - Number of frames skipped.
* WaitsOnFlipper - Number of wait states Drawer hits waiting on the Flipper.
* WaitsOnLoader - Number of wait states Drawer hits waiting on the Loader.
*/
typedef struct _VQADrawer {
VQAFrameNode *CurFrame;
unsigned long Flags;
DisplayInfo *Display;
unsigned char *ImageBuf;
long ImageWidth;
long ImageHeight;
long X1,Y1,X2,Y2;
long ScreenOffset;
long CurPalSize;
unsigned char Palette_24[768];
unsigned char Palette_15[512];
long BlocksPerRow;
long NumRows;
long NumBlocks;
long MaskStart;
long MaskWidth;
long MaskHeight;
long LastTime;
long LastFrame;
long LastFrameNum;
long DesiredFrame;
long NumSkipped;
long WaitsOnFlipper;
long WaitsOnLoader;
} VQADrawer;
/* Drawer flags */
#define VQADRWB_SETPAL 0 /* Set palette */
#define VQADRWF_SETPAL (1<<VQADRWB_SETPAL)
/* VQAFlipper: Data needed exclusively by the page-flipper.
* (Make sure this structure's size is always DWORD aligned.)
*
* CurFrame - Pointer to current flipper frame.
* LastFrameNum - Number of last flipped frame
* pad - DWORD alignment padding.
*/
typedef struct _VQAFlipper {
VQAFrameNode *CurFrame;
long LastFrameNum;
} VQAFlipper;
#if(VQAAUDIO_ON)
#ifdef __WATCOMC__
#pragma pack(4);
#endif
/* VQAAudio: Data needed exclusively by audio playback.
* (Make sure this structure's size is always DWORD aligned.)
*
* Buffer - Pointer to the audio buffer.
* AudBufPos - Current audio buffer position, for copying data in buffer.
* IsLoaded - Inter-process communication flag:
* 0 = is loadable, 1 = is not. Loader sets it when it
* loads, audio callback clears it when it plays one.
* NumAudBlocks - Number of HMI blocks in the audio buffer.
* CurBlock - Current audio block
* NextBlock - Next audio block
* TempBuf - Pointer to temp buffer for loading/decompressing audio
* data.
* TempBufLen - Number of bytes loaded into temp buffer.
* TempBufSize - Size of temp buffer in bytes.
* Flags - Various audio flags. (See below)
* PlayPosition - HMI's current buffer position.
* SamplesPlayed - Total samples played.
* NumSkipped - Count of buffers missed.
* SampleRate - Recorded sampling rate of the track.
* Channels - Number of channels in the track.
* BitsPerSample - Bit resolution size of sample (8,16)
* BytesPerSec - Recorded data transfer for one second.
* ADPCM_Info - ADPCM decompression information structure.
* DigiHandle - HMI digital device handle.
* SampleHandle - HMI sample handle.
* DigiTimer - HMI digital fill handler timer handle.
* sSOSSampleData - HMI sample structure.
* DigiCaps - HMI sound card digital capabilities.
* DigiHardware - HMI sound card digital hardware settings.
* sSOSInitDriver - HMI driver initialization structure.
* TimerHandle - Handle to Windows multi-media timer
* SoundTimerHandle- Handle to extra Windows mm timer req. for direct sound
* SecondaryBufferPtr - Pointer to out direct sound secondary buffer
* DSBuffFormat - WAVEFORMATEX structure for direct sound
* BufferDesc - Description structure for setting up direct sound buffers
* SecondaryBufferSize - length in bytes of our secondary sound buffer
* EndLastAudioChunk - Offset into secondary buffer of the end of the last chunk of audio copied in
* ChunksMovedToAudioBuffer - Total number of HMIBufSize chunks moved into the secondary buffer
* LastChunkPosition - Offset position of last chunk copied to secondary buffer
* CreatedSoundObject - True if we had to create our own direct sound object
* CreatedSoundBuffer - True if we had to create out own direct sound primary buffer
*/
typedef struct _VQAAudio {
unsigned char *Buffer;
unsigned long AudBufPos;
short *IsLoaded;
unsigned long NumAudBlocks;
unsigned long CurBlock;
unsigned long NextBlock;
unsigned char *TempBuf;
unsigned long TempBufLen;
unsigned long TempBufSize;
unsigned long Flags;
unsigned long PlayPosition;
unsigned long SamplesPlayed;
unsigned long NumSkipped;
unsigned short SampleRate;
unsigned char Channels;
unsigned char BitsPerSample;
unsigned long BytesPerSec;
_SOS_COMPRESS_INFO ADPCM_Info;
#if (!VQADIRECT_SOUND)
WORD DigiHandle;
WORD SampleHandle;
WORD DigiTimer;
_SOS_START_SAMPLE sSOSSampleData;
_SOS_CAPABILITIES DigiCaps;
_SOS_HARDWARE DigiHardware;
_SOS_INIT_DRIVER sSOSInitDriver;
#else
unsigned TimerHandle;
unsigned SoundTimerHandle;
LPDIRECTSOUNDBUFFER SecondaryBufferPtr;
WAVEFORMATEX DsBuffFormat;
DSBUFFERDESC BufferDesc;
unsigned SecondaryBufferSize;
unsigned EndLastAudioChunk;
unsigned ChunksMovedToAudioBuffer;
unsigned LastChunkPosition;
BOOL CreatedSoundObject;
BOOL CreatedSoundBuffer;
#endif
} VQAAudio;
/* Audio flags. */
#define VQAAUDB_DIGIINIT 0 /* HMI digital driver initialized (2 bits) */
#define VQAAUDB_TIMERINIT 2 /* HMI timer system initialized (2 bits) */
#define VQAAUDB_HMITIMER 4 /* HMI timer callback initialized (2 bits) */
#define VQAAUDB_ISPLAYING 6 /* Audio playing flag. */
#define VQAAUDB_MEMLOCKED 30 /* Audio memory page locked. */
#define VQAAUDB_MODLOCKED 31 /* Audio module page locked. */
#define VQAAUDF_DIGIINIT (3<<VQAAUDB_DIGIINIT)
#define VQAAUDF_TIMERINIT (3<<VQAAUDB_TIMERINIT)
#define VQAAUDF_HMITIMER (3<<VQAAUDB_HMITIMER)
#define VQAAUDF_ISPLAYING (1<<VQAAUDB_ISPLAYING)
#define VQAAUDF_MEMLOCKED (1<<VQAAUDB_MEMLOCKED)
#define VQAAUDF_MODLOCKED (1<<VQAAUDB_MODLOCKED)
/* HMI device initialization conditions. (DIGIINIT, TIMERINIT, HMITIMER) */
#define HMI_UNINIT 0 /* Unitialize state. */
#define HMI_VQAINIT 1 /* VQA initialized */
#define HMI_APPINIT 2 /* Application initialized */
#ifdef __WATCOMC__
#pragma pack(1);
#endif
#endif /* VQAAUDIO_ON */
/* VQAData: This stucture contains all the data used for playing a VQA.
*
* Draw_Frame - Pointer to the draw-frame routine for this video mode.
* Page_Flip - Pointer to the page flip function for this video mode.
* UnVQ - Pointer to the UnVQ routine for this vid mode & blk size.
* FrameData - Frame buffer circular list head.
* CBData - Codebook circular list head.
* Audio - Audio buffer
* Loader - Loader's data
* Drawer - Drawer's data
* Flipper - Flipper's data
* Flags - Flags used by the player.
* Foff - Pointer to frame offset table.
* VBIBit - Vertical blank bit polarity.
* Max_CB_Size - Maximum size of an uncompressed codebook
* Max_Pal_Size - Maximum size of an uncompressed palette
* Max_Ptr_Size - Maximum size of uncompressed pointer data
* LoadedFrames - Number of frames loaded
* DrawnFrames - Number of frames drawn
* StartTime - Start time in VQA time ticks
* EndTime - Stop time in VQA time ticks
* MemUsed - Number of bytes allocated by VQA_AllocBuffers
*/
typedef struct _VQAData {
long (*Draw_Frame)(VQAHandle *vqa);
long (*Page_Flip)(VQAHandle *vqa);
#ifndef PHARLAP_TNT
void __cdecl (*UnVQ)(unsigned char *codebook, unsigned char *pointers,
unsigned char *buffer, unsigned long blocksperrow,
unsigned long numrows, unsigned long bufwidth);
#else
void __cdecl (*UnVQ)(unsigned char *codebook, unsigned char *pointers,
FARPTR buffer, unsigned long blocksperrow, unsigned long numrows,
unsigned long bufwidth);
#endif
VQAFrameNode *FrameData;
VQACBNode *CBData;
#if(VQAAUDIO_ON)
VQAAudio Audio;
#endif
VQALoader Loader;
VQADrawer Drawer;
VQAFlipper Flipper;
unsigned long Flags;
long *Foff;
long VBIBit;
long Max_CB_Size;
long Max_Pal_Size;
long Max_Ptr_Size;
long LoadedFrames;
long DrawnFrames;
long StartTime;
long EndTime;
long MemUsed;
} VQAData;
/* VQAData flags */
#define VQADATB_UPDATE 0 /* Update the display. */
#define VQADATB_DSLEEP 1 /* Drawer sleep state. */
#define VQADATB_LSLEEP 2 /* Loader sleep state. */
#define VQADATB_DDONE 3 /* Drawer done flag. (0 = done) */
#define VQADATB_LDONE 4 /* Loader done flag. (0 = done) */
#define VQADATB_PRIMED 5 /* Buffers are primed. */
#define VQADATB_PAUSED 6 /* The player is paused. */
#define VQADATF_UPDATE (1<<VQADATB_UPDATE)
#define VQADATF_DSLEEP (1<<VQADATB_DSLEEP)
#define VQADATF_LSLEEP (1<<VQADATB_LSLEEP)
#define VQADATF_DDONE (1<<VQADATB_DDONE)
#define VQADATF_LDONE (1<<VQADATB_LDONE)
#define VQADATF_PRIMED (1<<VQADATB_PRIMED)
#define VQADATF_PAUSED (1<<VQADATB_PAUSED)
/* VQAHandleP: Private VQA file handle. Must be obtained by calling
* VQA_Alloc() and freed through VQA_Free(). This is the only
* legal way to obtain and dispose of a VQAHandle.
*
* VQAio - Something meaningful to the IO manager. (See DOCS)
* IOHandler - IO handler callback.
* VQABuf - Pointer to internal data buffers.
* Config - Configuration structure.
* Header - VQA header structure.
* vocfh - Override audiotrack file handle.
*/
typedef struct _VQAHandleP {
unsigned long VQAio;
long (*IOHandler)(VQAHandle *vqa, long action, void *buffer,
long nbytes);
VQAData *VQABuf;
VQAConfig Config;
VQAHeader Header;
long vocfh;
CaptionInfo *Caption;
CaptionInfo *EVA;
} VQAHandleP;
/*---------------------------------------------------------------------------
* FUNCTION PROTOTYPES
*-------------------------------------------------------------------------*/
/* Loader/Drawer system. */
long VQA_LoadFrame(VQAHandle *vqa);
void VQA_Configure_Drawer(VQAHandleP *vqap);
long User_Update(VQAHandle *vqa);
/* Timer system. */
long VQA_StartTimerInt(VQAHandleP *vqap, long init);
void VQA_StopTimerInt(VQAHandleP *vqap);
void VQA_SetTimer(VQAHandleP *vqap, long time, long method);
unsigned long VQA_GetTime(VQAHandleP *vqap);
long VQA_TimerMethod(void);
/* Audio system. */
#if(VQAAUDIO_ON)
long VQA_OpenAudio(VQAHandleP *vqap , HWND window);
void VQA_CloseAudio(VQAHandleP *vqap);
long VQA_StartAudio(VQAHandleP *vqap);
void VQA_StopAudio(VQAHandleP *vqap);
long CopyAudio(VQAHandleP *vqap);
#endif
/* Debugging system. */
void VQA_InitMono(VQAHandleP *vqap);
void VQA_UpdateMono(VQAHandleP *vqap);
#endif /* VQAPLAYP_H */