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

68
WINVQ/INCLUDE/VOCFILE.H Normal file
View File

@@ -0,0 +1,68 @@
/*
** 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 VOCFILE_H
#define VOCFILE_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
*
*----------------------------------------------------------------------------
*
* FILE
* vocfile.h
*
* DESCRIPTION
* VOC audio file definitions.
*
* PROGRAMMER
* Denzil E. Long, Jr.
*
****************************************************************************/
/* VOC file header.
*
* type - File type description
* offset - Offset of data block from the start of VOC file.
* ver - File format version number
* id - File identification code.
*/
typedef struct _VOCHeader {
char type[0x14];
unsigned short offset;
unsigned short ver;
unsigned short id;
} VOCHeader;
/* VOC sub-block block types */
#define VBT_TERMINATE 0 /* Last block of file (no size field) */
#define VBT_VOICEDATA 1 /* New set of voice data */
#define VBT_VOICECONT 2 /* Continuation of voice data */
#define VBT_SILENCE 3 /* Silence period */
#define VBT_MARKER 4 /* Syncronization marker */
#define VBT_ASCII 5 /* NULL terminated string */
#define VBT_REPEAT 6 /* Mark beginning of repeat loop */
#define VBT_ENDREPEAT 7 /* Mark end of repeat loop */
#define VBT_EXTENDED 8
#define IS_VOC(a,b) (((~a)+0x1234)==b)
#define BLOCK_LEN(a) ((a&0x00FFFFFFL))
#endif /* VOCFILE_H */

106
WINVQ/INCLUDE/VQ.H Normal file
View File

@@ -0,0 +1,106 @@
/*
** 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 VQ_H
#define VQ_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
*
*----------------------------------------------------------------------------
*
* NAME
* vq.h
*
* DESCRIPTION
* VQ file definition
*
* PROGRAMMER
* Denzil E. Long, Jr.
*
* DATE
* September 28, 1995
*
* NOTES
* VQ file organization:
*
* Header: This structure contains all the data pertaining to the VQ.
* (See structure definition for details)
*
* Size: 40 bytes
*
* Palette: Color palette used by this VQ. Stored as 24 bit RGB entries.
*
* Size: (PaletteRange * 3) bytes
*
* Codebook: Sequence of vector blocks used to represent the VQ image.
* Also called the dictionary. The sequence is sorted by
* usage, so the first entry is the most commonly used block.
*
* Size: ((BlockWidth * BlockHeight) * CodebookSize) bytes
*
* Pointers: Vector pointer map used to indicate the construction of
* the vector blocks. Also called codewords.
*
* Size: (((ImageWidth / BlockWidth)
* * (ImageHeight / BlockHeight)) * 2)
*
* Pointer format:
*
* Single color - Value less than or equal to 'Num1Color'
* Multi Color - Value greater than 'Num1Color'
*
****************************************************************************/
/* VQHeader - VQ header structure.
*
* ImageSize - Compressed image size
* ImageWidth - Image x-dimension
* ImageHeight - Image y-dimension
* BlockWidth - Block x-dimension
* BlockHeight - Block y-dimension
* BlockType - Block type
* PaletteRange - Number of palette colors
* Num1Color - Number of 1-color blocks & 1-color colors
* CodebookSize - Number of actual codebook entries
* CodingFlag - Flag for 2-color blocks
* FrameDiffMethod - Frame differencing method
* ForcedPalette - Force a palette on image
* F555Palette - Flag for output 15-bit palette
* VQVersion - VQ Version #
* pad[5] - Pad out to 40 bytes total
*/
typedef struct _VQHeader {
unsigned long ImageSize;
unsigned short ImageWidth;
unsigned short ImageHeight;
unsigned short BlockWidth;
unsigned short BlockHeight;
unsigned short BlockType;
unsigned short PaletteRange;
unsigned short Num1Color;
unsigned short CodebookSize;
unsigned short CodingFlag;
unsigned short FrameDiffMethod;
unsigned short ForcedPalette;
unsigned short F555Palette;
unsigned short VQVersion;
unsigned short pad[5];
} VQHeader;
#endif /* VQ_H */

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 */

118
WINVQ/INCLUDE/VQFILE.H Normal file
View File

@@ -0,0 +1,118 @@
/*
** 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 VQFILE_H
#define VQFILE_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
*
*----------------------------------------------------------------------------
*
* FILE
* VQFile.h
*
* DESCRIPTION
* VQ file format definitions.
*
* PROGRAMMER
* Denzil E. Long, Jr.
*
* DATE
* September 27, 1995
*
****************************************************************************/
#include <vqm32\iff.h>
/* Disable Watcom structure alignment. */
#ifdef __WATCOMC__
#pragma pack(1);
#endif
/*---------------------------------------------------------------------------
* STRUCTURE DEFINITIONS AND RELATED INFORMATION
*-------------------------------------------------------------------------*/
/* VQHeader: VQ header.
*
* Version - VQ file version
* Flags - Various flags (see below)
* ImageWidth - Width of constructed image in pixels.
* ImageHeight - Height of contructed image in pixels.
* BlockType - Type of codebook block. (EX: rectangle)
* BlockWidth - Width of a codebook block in pixels.
* BlockHeight - Height of a codebook block in pixels.
* BlockDepth - Depth of a codebook block in bits.
* CBEntries - Number of entries in the codebook.
* VPtrType - Vector pointer type. (IE: Banked)
* PalStart - Starting entry position of palette.
* PalLength - Number of palette entries the palette.
* PalDepth - Depth of palette entries in bits.
* ColorModel - Color model of this VQ
*/
typedef struct _VQHeader {
short Version;
short Flags;
short ImageWidth;
short ImageHeight;
short BlockType;
short BlockWidth;
short BlockHeight;
short BlockDepth;
short CBEntries;
short VPtrType;
short PalStart;
short PalLengh;
short PalDepth;
short ColorModel;
} VQHeader;
/* VQ file flags */
#define VQHB_CBCOMP 0 /* Codebook compressed */
#define VQHB_CTCOMP 1 /* Color table compressed */
#define VQHB_VPCOMP 2 /* Vector pointers compressed */
#define VQHF_CBCOMP (1<<VQHB_CBCOMP)
#define VQHF_CTCOMP (1<<VQHB_CTCOMP)
#define VQHF_VPCOMP (1<<VQHB_VPCOMP)
/* Block types */
#define VQBT_RECT 0 /* Rectangle Width X Height */
/* Color models */
#define VQCM_PALETTED 0 /* Palette (8 bit indices) */
#define VQCM_RGBTRUE 1 /* RBG truecolor (24 bit) */
#define VQCM_YBRTRUE 2 /* YCbCr truecolor */
/*---------------------------------------------------------------------------
* VQ FILE CHUNK ID DEFINITIONS
*-------------------------------------------------------------------------*/
#define ID_VQHR MAKE_ID('V','Q','H','R') /* VQ Header */
#define ID_VQCB MAKE_ID('V','Q','C','B') /* VQ Codebook */
#define ID_VQCT MAKE_ID('V','Q','C','T') /* VQ Color Table (palette) */
#define ID_VQVP MAKE_ID('V','Q','V','P') /* VQ Vector pointers */
#ifdef __WATCOMC__
#pragma pack();
#endif
#endif /* VQFILE_H */

58
WINVQ/INCLUDE/VQM32/ALL.H Normal file
View File

@@ -0,0 +1,58 @@
/*
** 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 VQMALL_H
#define VQMALL_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
*
*----------------------------------------------------------------------------
*
* FILE
* all.h
*
* DESCRIPTION
* All VQMisc32 library definitions. (32-Bit protected mode)
*
* PROGRAMMER
* Denzil E. Long, Jr.
*
* DATE
* July 5, 1995
*
****************************************************************************/
#include <vqm32\iff.h>
#include <vqm32\mono.h>
#include <vqm32\portio.h>
#include <vqm32\profile.h>
#include <vqm32\targa.h>
#include <vqm32\compress.h>
#include <vqm32\video.h>
#include <vqm32\palette.h>
#include <vqm32\vesavid.h>
#include <vqm32\vesablit.h>
#include <vqm32\graphics.h>
#include <vqm32\mixfile.h>
#include <vqm32\crc.h>
#include <vqm32\huffman.h>
#include <vqm32\mem.h>
#endif /* VQMALL_H */

View File

@@ -0,0 +1,80 @@
/*
** 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 VQMCAPTOKEN_H
#define VQMCAPTOKEN_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
*
*----------------------------------------------------------------------------
*
* FILE
* captoken.h
*
* DESCRIPTION
* Text caption script definitions.
*
* PROGRAMMER
* Denzil E. Long, Jr.
*
* DATE
* July 26, 1995
*
****************************************************************************/
/* CaptionText: This structure describes a line of text to be displayed
* with the video/audio.
*
* Size - Size of caption in bytes.
* OnFrame - Frame number to display caption.
* OffFrame - Frame number to clear caption.
* Flags - Display modifiers.
* CPF - Characters to draw per frame.
* Xpos - X pixel position to display caption.
* Ypos - Y pixel position to display caption.
* BgPen - Background pen to use.
* FgPen - Foreground pen to use.
* Text - Text string to display. (WORD aligned)
*/
typedef struct _CaptionText {
unsigned short Size;
unsigned short OnFrame;
unsigned short OffFrame;
unsigned char Flags;
char CPF;
unsigned short Xpos;
unsigned short Ypos;
char BgPen;
char FgPen;
char Text[];
} CaptionText;
/* CaptionText flag definitions. */
#define CTF_JUSTIFY (3<<0) /* Justification field. */
#define CTF_ABS (0<<0) /* Use absolute X,Y positions. */
#define CTF_CENTER (1<<0) /* Justify on Center */
#define CTF_LEFT (2<<0) /* Justify on left */
#define CTF_RIGHT (3<<0) /* Justify on right */
#define CTF_FLASH (1<<4) /* Flash text. */
/* Function prototypes. */
long BuildCaptions(char *name, char *buffer);
#endif /* VQMCAPTOKEN_H */

View File

@@ -0,0 +1,59 @@
/*
** 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 VQMCOMP_H
#define VQMCOMP_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
*
*----------------------------------------------------------------------------
*
* FILE
* compress.h
*
* DESCRIPTION
* Compression definitions. (32-Bit protected mode)
*
* PROGRAMMER
* Denzil E. Long, Jr.
*
* DATE
* January 26, 1995
*
****************************************************************************/
/* Prototypes */
#ifdef __cplusplus
extern "C" {
#endif
unsigned long __cdecl LCW_Compress(char const *source, char *dest,
unsigned long length);
unsigned long __cdecl LCW_Uncompress(char const *source, char *dest,
unsigned long length);
long AudioZap(void *source, void *dest, long size);
long __cdecl AudioUnzap(void *source, void *dest, long);
#ifdef __cplusplus
}
#endif
#endif /* VQMCOMP_H */

51
WINVQ/INCLUDE/VQM32/CRC.H Normal file
View File

@@ -0,0 +1,51 @@
/*
** 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 VQMCRC_H
#define VQMCRC_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
*
*----------------------------------------------------------------------------
*
* FILE
* CRC.h
*
* DESCRIPTION
* CRC calculation definitions.
*
* PROGRAMMER
* Joe L. Bostic
*
* DATE
* January 26, 1995
*
****************************************************************************/
#ifdef __cplusplus
extern "C" {
#endif
long __cdecl Calculate_CRC(void const *buffer, long length);
#ifdef __cplusplus
}
#endif
#endif /* VQMCRC_H */

105
WINVQ/INCLUDE/VQM32/FONT.H Normal file
View File

@@ -0,0 +1,105 @@
/*
** 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 VQMFONT_H
#define VQMFONT_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
*
*---------------------------------------------------------------------------
*
* FILE
* font.h
*
* DESCRIPTION
* Font definitions.
*
* PROGRAMMER
* Denzil E. Long, Jr.
*
* DATE
* March 9, 1995
*
****************************************************************************/
/* Font: A Westwood style font.
*
* Size - Size of font.
* CompMethod - Compression method of font. (0 = none)
* NumBlks - Number of data blocks.
* InfoBlk - Offset to font information block.
* OffsetBlk - Offset to character offset block.
* WidthBlk - Offset to character width block.
* DataBlk - Offset to character data block.
* HeightBlk - Offset to character height block.
*/
typedef struct _Font {
unsigned short Size;
unsigned char CompMethod;
unsigned char NumBlks;
unsigned short InfoBlk;
unsigned short OffsetBlk;
unsigned short WidthBlk;
unsigned short DataBlk;
unsigned short HeightBlk;
} Font;
typedef struct _FontInfo {
long huh;
unsigned char MaxHeight;
unsigned char MaxWidth;
} FontInfo;
#ifdef __cplusplus
extern "C" {
#endif
extern void const *FontPtr;
extern int FontXSpacing;
extern int FontYSpacing;
#ifdef __cplusplus
}
#endif
extern char FontWidth;
extern char FontHeight;
extern char *FontWidthBlockPtr;
/* Function prototypes. */
void *cdecl Load_Font(char const *name);
void *cdecl Set_Font(void const *font);
unsigned short __cdecl String_Pixel_Width(char const *string);
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __WATCOMC__
long __cdecl __saveregs Char_Pixel_Width(char chr);
#else
long __cdecl Char_Pixel_Width(char chr);
#endif
#ifdef __cplusplus
}
#endif
#endif /* VQMFONT_H */

View File

@@ -0,0 +1,55 @@
/*
** 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 VQMGRAPHICS_H
#define VQMGRAPHICS_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
*
*----------------------------------------------------------------------------
*
* FILE
* graphics.h
*
* DESCRIPTION
* Graphic rendering and manipulation definitions.
*
* PROGRAMMER
* Denzil E. Long, Jr.
*
* DATE
* April 27, 1995
*
****************************************************************************/
/* Prototypes */
#ifdef __cplusplus
extern "C" {
#endif
void __cdecl Eor_Region(long sx, long sy, long dx, long dy, long color);
void __cdecl Fill_Rect(long x1, long y1, long x2, long y2, long color);
#ifdef __cplusplus
}
#endif
#endif /* VQMGRAPHICS_H */

View File

@@ -0,0 +1,99 @@
/*
** 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 HUFFMAN_H
#define HUFFMAN_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
*
*----------------------------------------------------------------------------
*
* FILE
* huffman.h
*
* DESCRIPTION
* Huffman order 0 compress/decompress definitions.
*
* PROGRAMMER
* Denzil E. Long, Jr.
*
* DATE
* May 19, 1995
*
****************************************************************************/
/* TreeNode: Huffman decoding tree node.
*
* count - Weight of the node in the tree.
* child0 - Child node 0
* child1 - Child node 1
*/
typedef struct _TreeNode {
unsigned long count;
unsigned short child0;
unsigned short child1;
} TreeNode;
/* HuffCode: This structure is used for storing the code for each symbol
* during encoding. A table of codes for each symbol is built
* from the Huffman tree.
*
* code - Code used to represent a symbol.
* bits - Length of code in bits.
*/
typedef struct _HuffCode {
unsigned short code;
short bits;
} HuffCode;
#define HUFF_EOS 256 /* End of stream symbol */
/* Prototypes */
#ifdef __cplusplus
extern "C" {
#endif
long __cdecl HuffCompress(unsigned char *data, unsigned char *buffer,
long length, char *work);
long __cdecl HuffDecompress(unsigned char *data, unsigned char *buffer,
long length, char *work);
void __cdecl HuffCount(unsigned char *data, TreeNode *nodes, long length,
long zero);
void __cdecl HuffScaleCounts(TreeNode *nodes);
long __cdecl RLEHuffCounts(TreeNode *nodes, unsigned char *buffer);
long __cdecl BuildHuffTree(TreeNode *nodes);
void __cdecl ConvertToCodes(TreeNode *nodes, HuffCode *codes,
unsigned short code, short bits, short node);
long __cdecl HuffEncode(unsigned char *data, unsigned char *buffer,
HuffCode *codes, long length);
#ifdef __cplusplus
}
#endif
#endif /* HUFFMAN_H */

141
WINVQ/INCLUDE/VQM32/IFF.H Normal file
View File

@@ -0,0 +1,141 @@
/*
** 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 VQMIFF_H
#define VQMIFF_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
*
*----------------------------------------------------------------------------
*
* FILE
* iff.h
*
* DESCRIPTION
* IFF (Interchange File Format) manager definitions.
* (32-Bit protected mode)
*
* PROGRAMMER
* Denzil E. Long, Jr.
*
* DATE
* January 26, 1995
*
****************************************************************************/
/* FormHeader - Structure associated with IFF forms.
*
* id - IFF form id (IE: "FORM")
* size - Length of IFF in bytes
* type - Form type (IE: "ILBM")
*/
typedef struct _FormHeader {
long id;
long size;
long type;
} FormHeader;
/* Context - Structure associated with chunks.
*
* id - Chunk identifier.
* size - Size of chunk in bytes.
* scan - Bytes read/written.
*/
typedef struct _Context {
long id;
long size;
long scan;
} Context;
/* IFFHandle - Structure associated with an active IFF read\write session.
*
* fh - DOS filehandle
* flags - Internal flags used by IFF routines.
* form - IFF form information.
* scan - Bytes read/written
* cn - Context of current chunk.
*/
typedef struct _IFFHandle {
long fh;
long flags;
FormHeader form;
long scan;
Context cn;
} IFFHandle;
/* bit masks for "flags" field. */
#define IFFB_READ 0
#define IFFB_WRITE 1
#define IFFF_READ (1<<IFFB_READ)
#define IFFF_WRITE (1<<IFFB_WRITE)
/* IFF return codes. Most functions return either zero for success or
* one of these codes. The exceptions are the read/write functions which,
* return positive values for number of bytes read or written, or a negative
* error code.
*
* IFFERR_EOF - End of file.
* IFFERR_READ - Read error.
* IFFERR_WRITE - Write error.
* IFFERR_NOMEM - Unable to allocate memory.
*/
#define IFFERR_EOF -1
#define IFFERR_READ -2
#define IFFERR_WRITE -3
#define IFFERR_NOMEM -4
/* Macros to make things easier. */
#define REVERSE_LONG(id) (unsigned long)((((unsigned long)(id)>>24) \
&0x000000FFL)|(((unsigned long)(id)>>8) \
&0x0000FF00L)|(((unsigned long)(id)<<8) \
&0x00FF0000L)|(((unsigned long)(id)<<24)&0xFF000000L))
#define REVERSE_WORD(id) ((unsigned short)((((unsigned short)(id)<<8) \
&0x00FF00)|(((unsigned short)(id)>>8)&0x0FF)))
#define PADSIZE(size) (((size)+1)&(~1))
#ifndef MAKE_ID
#define MAKE_ID(a,b,c,d) ((long)((long)(d)<<24)|((long)(c)<<16)| \
((long)(b)<<8)|(long)(a))
#endif
/* Universal IFF identifiers */
#define ID_FORM MAKE_ID('F','O','R','M')
#define ID_LIST MAKE_ID('L','I','S','T')
#define ID_PROP MAKE_ID('P','R','O','P')
#define ID_NULL MAKE_ID(' ',' ',' ',' ')
/* Prototypes */
IFFHandle *OpenIFF(char *, long);
void CloseIFF(IFFHandle *);
long ReadForm(IFFHandle *, FormHeader *);
long WriteForm(IFFHandle *, FormHeader *);
long ReadChunkHeader(IFFHandle *);
long WriteChunkHeader(IFFHandle *, long, long);
long WriteChunk(IFFHandle *, long, char *, long);
long WriteChunkBytes(IFFHandle *, char *, long);
long ReadChunkBytes(IFFHandle *, char *, long);
long SkipChunkBytes(IFFHandle *, long);
long FindChunk(IFFHandle *, long);
char *IDtoStr(long, char *);
long CurrentFilePos(IFFHandle *);
#endif /* VQMIFF_H */

56
WINVQ/INCLUDE/VQM32/MEM.H Normal file
View File

@@ -0,0 +1,56 @@
/*
** 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 VQAMEM_H
#define VQAMEM_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
*
*---------------------------------------------------------------------------
*
* FILE
* mem.h
*
* DESCRIPTION
* Memory management definitions.
*
* PROGRAMMER
* Phil Gorrow
* Denzil E. Long, Jr.
*
* DATE
* July 5, 1995
*
****************************************************************************/
/* Definitions */
#define DPMI_INT 0x0031
#define DPMI_LOCK 0x0600
#define DPMI_UNLOCK 0x0601
/* Prototypes */
#ifdef __WATCOMC__
void DPMI_Lock(void const *ptr, long const size);
void DPMI_Unlock(void const *ptr, long const size);
#else
#define DPMI_Lock(a,b)
#define DPMI_Unlock(a,b)
#endif
#endif /* VQAMEM_H */

View File

@@ -0,0 +1,105 @@
/*
** 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 VQMMIXFILE_H
#define VQMMIXFILE_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
*
*----------------------------------------------------------------------------
*
* FILE
* mixfile.h
*
* DESCRIPTION
* A mix file is basically a group of files concatinated together
* proceeded by a header describing where in the file each individual
* entry is located. These definitions are provided to simplify the access
* to these file entries.
*
* PROGRAMMER
* Denzil E. Long, Jr.
*
* DATE
* January 26, 1995
*
****************************************************************************/
/* Disable structure alignment.*/
#ifdef __WATCOMC__
#pragma pack(1);
#endif
/*---------------------------------------------------------------------------
* STRUCTURE DEFINITIONS
*-------------------------------------------------------------------------*/
/* MIXHeader: Mix file data header.
*
* Count - Number of entries contained in this mix file.
* Size - Size of Mix file.
*/
typedef struct _MIXHeader {
short Count;
long Size;
} MIXHeader;
/* MIXSubBlock: Mix file entry descriptor.
*
* CRC - Unique entry identifier.
* Offset - Offset from beginning of data segment to entry.
* Size - Size of entry.
*/
typedef struct _MIXSubBlock {
long CRC;
long Offset;
long Size;
} MIXSubBlock;
/* MIXHandle: Mix file handle.
*
* Name - Pointer to the name of the mix file this handle is for.
* Size - Size of entire mix file.
* FH - DOS file handle of opened entry.
* Count - Number of files contained in this mix.
* Entries - Array of 'Count' MIXSubBlock structure entries.
*/
typedef struct _MIXHandle {
char *Name;
long Size;
long FH;
long Count;
MIXSubBlock Entries[];
} MIXHandle;
/*---------------------------------------------------------------------------
* PROTOTYPES
*-------------------------------------------------------------------------*/
MIXHandle *OpenMix(char *name);
void CloseMix(MIXHandle *mix);
long OpenMixEntry(MIXHandle *mix, char *name);
/* Restore original alignment */
#ifdef __WATCOMC__
#pragma pack();
#endif
#endif /* VQMMIXFILE_H */

View File

@@ -0,0 +1,66 @@
/*
** 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 VQMMONO_H
#define VQMMONO_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
*
*----------------------------------------------------------------------------
*
* FILE
* mono.h
*
* DESCRIPTION
* Mono screen definitions. (32-Bit protected mode)
*
* PROGRAMMER
* Denzil E. Long, Jr.
*
* DATE
* Feburary 8, 1995
*
****************************************************************************/
/* Prototypes */
#ifdef __cplusplus
extern "C" {
#endif
void __cdecl Mono_Enable(void);
void __cdecl Mono_Disable(void);
void __cdecl Mono_Set_Cursor(long x, long y);
void __cdecl Mono_Clear_Screen(void);
void __cdecl Mono_Scroll(long lines);
void __cdecl Mono_Put_Char(long character, long attrib);
void __cdecl Mono_Draw_Rect(long x, long y, long w, long h, long attrib,
long thick);
void __cdecl Mono_Text_Print(void const *text, long x, long y, long attrib);
void __cdecl Mono_Print(void const *text);
short __cdecl Mono_View_Page(long page);
short __cdecl Mono_X(void);
short __cdecl Mono_Y(void);
#ifdef __cplusplus
}
#endif
#endif /* VQMMONO_H */

View File

@@ -0,0 +1,59 @@
/*
** 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 VQMPALETTE_H
#define VQMPALETTE_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
*
*----------------------------------------------------------------------------
*
* FILE
* Palette.h (32-Bit protected mode)
*
* DESCRIPTION
* Palette definitions.
*
* PROGRAMMER
* Denzil E. Long, Jr.
*
* DATE
* Febuary 3, 1995
*
****************************************************************************/
/* Prototypes */
#ifdef __cplusplus
extern "C" {
#endif
void __cdecl SetPalette(unsigned char *palette,long numbytes,unsigned long slowpal);
void __cdecl ReadPalette(void *palette);
void __cdecl SetDAC(long color, long red, long green, long blue);
void __cdecl TranslatePalette(void *pal24, void *pal15, long numbytes);
#ifdef __cplusplus
}
#endif
void SortPalette(unsigned char *pal, long numcolors);
#endif /* VQMPALETTE_H */

View File

@@ -0,0 +1,57 @@
/*
** 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 VQMPORTIO_H
#define VQMPORTIO_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
*
*----------------------------------------------------------------------------
*
* FILE
* Portio.h (32-Bit protected mode)
*
* DESCRIPTION
* Hardware port I/O
*
* PROGRAMMER
* Denzil E. Long, Jr.
*
* DATE
* Febuary 3, 1995
*
****************************************************************************/
#ifdef __BORLANDC__
#ifdef __cplusplus
extern "C" {
#endif
short __cdecl inp(unsigned short portid);
void __cdecl outp(unsigned short portid, short value);
#ifdef __cplusplus
}
#endif
#endif /* __BORLANDC__ */
#endif /* VQMPORTIO_H */

View File

@@ -0,0 +1,52 @@
/*
** 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 VQMPROFILE_H
#define VQMPROFILE_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
*
*----------------------------------------------------------------------------
*
* FILE
* Profile.h (32-Bit protected mode)
*
* DESCRIPTION
* INI file profiling definitions.
*
* PROGRAMMER
* Denzil E. Long, Jr.
*
* DATE
* January 26, 1995
*
****************************************************************************/
/* Prototypes */
long GetINIInt(char const *section, char const *entry,
long deflt, char *fname);
long GetINIString(char const *section, char const *entry,
char const *def, char *retbuffer, long retlen, char *fname);
long Get_Frame_Pathname(char *inifile,long anim_frame,char *ext,
char *outbuf);
#endif /* VQMPROFILE_H */

View File

@@ -0,0 +1,82 @@
/*
** 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 VQMREALMODE_H
#define VQMREALMODE_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
*
*----------------------------------------------------------------------------
*
* FILE
* realmode.h
*
* DESCRIPTION
* Real-mode interfacing definitions and equates. Many of the definitions
* and descriptions in this file were taken from other sources and
* compiled here for use in MISC32 library.
*
* PROGRAMMER
* Denzil E. Long, Jr.
*
* DATE
* Febuary 6, 1995
*
****************************************************************************/
/* REALPTR: Real-mode pointer (segment:offset16).
*
* The REALPTR data type is used in protected mode to hold real-mode
* pointers. The type is an unsigned long value, were the upper 16 bits
* are the segment number and the lower 16 bit are an offset. This type
* and the associated macros are identical to that of the PHARLAP "pltypes.h"
* definitions for easy of conversion to WATCOM/4GW.
*/
typedef unsigned long REALPTR;
#define RP_OFF(rp) ((unsigned short)(((unsigned long)(rp)) & 0xFFFF))
#define RP_SEG(rp) ((unsigned short)(((unsigned long)(rp)) >> 16))
#define RP_SET(rp, off, seg) (rp = ((unsigned long)(seg) << 16) + (off))
#define RP_INCR(rp, incr) (rp += ((unsigned long)(incr)) & 0xFFFF)
#define MK_PTR(off, seg) (void *)((((unsigned long)seg&0xFFFF)<<4)+off)
/* RMInfo: Real-mode interrupt call structure.
*
* Information that needs to be passed down to the real-mode interrupt is
* transfered using this structure. The address to this protected-mode
* structure (allocated by user) is passed into DPMI function 0x300. DOS/4GW
* will then use this information to set up the real-mode registers, switch
* to real-mode and then execute the interrupt in real-mode.
*/
typedef struct _RMInfo {
long edi;
long esi;
long ebp;
long reservedbysystem;
long ebx;
long edx;
long ecx;
long eax;
short flags;
short es,ds,fs,gs,ip,cs,sp,ss;
} RMInfo;
#endif /* VQMREALMODE_H */

View File

@@ -0,0 +1,90 @@
/*
** 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 : soscomp.h
* Date Created : 6/1/94
* Description :
*
* Programmer(s) : Nick Skrepetos
* Last Modification : 10/1/94 - 11:37:9 AM
* Additional Notes : Modified by Denzil E. Long, Jr.
*
*****************************************************************************
* Copyright (c) 1994, HMI, Inc. All Rights Reserved *
****************************************************************************/
#ifndef _SOS_COMPRESS
#define _SOS_COMPRESS
/* compression types */
enum {
_ADPCM_TYPE_1,
};
/* define compression structure */
typedef struct _tagCOMPRESS_INFO {
char *lpSource;
char *lpDest;
unsigned long dwCompSize;
unsigned long dwUnCompSize;
short wBitSize;
short wChannels;
unsigned long dwSampleIndex;
long dwPredicted;
long dwDifference;
short wCodeBuf;
short wCode;
short wStep;
short wIndex;
unsigned long dwSampleIndex2; //added BP for channel 2
long dwPredicted2; //added BP for channel 2
long dwDifference2; //added BP for channel 2
short wCodeBuf2; //added BP for channel 2
short wCode2; //added BP for channel 2
short wStep2; //added BP for channel 2
short wIndex2; //added BP for channel 2
} _SOS_COMPRESS_INFO;
/* compressed file type header */
typedef struct _tagCOMPRESS_HEADER {
unsigned long dwType; // type of compression
unsigned long dwCompressedSize; // compressed file size
unsigned long dwUnCompressedSize; // uncompressed file size
unsigned long dwSourceBitSize; // original bit size
char szName[16]; // file type, for error checking
} _SOS_COMPRESS_HEADER;
/* Prototypes */
#ifdef __cplusplus
extern "C" {
#endif
void __cdecl VQA_sosCODECInitStream(_SOS_COMPRESS_INFO *);
unsigned long __cdecl VQA_sosCODECCompressData(_SOS_COMPRESS_INFO *,unsigned long);
unsigned long __cdecl VQA_sosCODECDecompressData(_SOS_COMPRESS_INFO *,unsigned long);
#ifdef __cplusplus
}
#endif
#endif

130
WINVQ/INCLUDE/VQM32/TARGA.H Normal file
View File

@@ -0,0 +1,130 @@
/*
** 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 VQMTARGA_H
#define VQMTARGA_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
*
*----------------------------------------------------------------------------
*
* FILE
* Targa.h (32-Bit protected mode)
*
* DESCRIPTION
* Targa Image File definitions.
*
* PROGRAMMER
* Denzil E. Long, Jr.
*
* DATE
* January 26, 1995
*
****************************************************************************/
/*---------------------------------------------------------------------------
* Targa Header definitions
*-------------------------------------------------------------------------*/
/* TGAHeader - Targa Image File header.
*
* IDLength - Size of Image ID field
* ColorMapType - Color map type.
* ImageType - Image type code.
* CMapStart - Color map origin.
* CMapLength - Color map length.
* CMapDepth - Depth of color map entries.
* XOffset - X origin of image.
* YOffset - Y origin of image.
* Width - Width of image.
* Height - Height of image.
* PixelDepth - Image pixel size
* ImageDescriptor - Image descriptor byte.
*/
typedef struct _TGAHeader {
char IDLength;
char ColorMapType;
char ImageType;
short CMapStart;
short CMapLength;
char CMapDepth;
short XOffset;
short YOffset;
short Width;
short Height;
char PixelDepth;
char ImageDescriptor;
} TGAHeader;
/* ImageType definiton */
#define TGA_NOIMAGE 0 /* No image data included in file */
#define TGA_CMAPPED 1 /* Color-mapped image data */
#define TGA_TRUECOLOR 2 /* Truecolor image data */
#define TGA_MONO 3 /* Monochrome image data */
#define TGA_CMAPPED_ENCODED 9 /* Color-mapped image data (Encoded) */
#define TGA_TRUECOLOR_ENCODED 10 /* Truecolor image data (Encoded) */
#define TGA_MONO_ENCODED 11 /* Monochrome image data (Encoded) */
/* ImageDescriptor definition */
#define TGAF_ATTRIB_BITS (0x0F<<0) /* Number of attribute bits per pixel */
#define TGAF_XORIGIN (1<<4)
#define TGAF_YORIGIN (1<<5)
/*---------------------------------------------------------------------------
* Targa Handle definitions
*-------------------------------------------------------------------------*/
/* TGAHandle - Targa Image File handle.
*
* fh - File handle returned by open().
* mode - Access mode.
* header - TGAHeader structure.
*/
typedef struct _TGAHandle {
short fh;
unsigned short mode;
TGAHeader header;
} TGAHandle;
/* Access modes. */
#define TGA_READMODE 0
#define TGA_WRITEMODE 1
#define TGA_RDWRMODE 2
/* Error codes */
#define TGAERR_OPEN -1
#define TGAERR_READ -2
#define TGAERR_WRITE -3
#define TGAERR_SYNTAX -4
#define TGAERR_NOMEM -5
#define TGAERR_NOTSUPPORTED -6
/*---------------------------------------------------------------------------
* Function prototypes
*-------------------------------------------------------------------------*/
TGAHandle *OpenTarga(char *, unsigned short);
void CloseTarga(TGAHandle *);
long LoadTarga(char *, char *, char *);
long SaveTarga(char *, TGAHeader *, char *, char *);
void XFlipTarga(TGAHeader *, char *);
void YFlipTarga(TGAHeader *, char *);
#endif /* VQMTARGA_H */

View File

@@ -0,0 +1,56 @@
/*
** 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 VQMTEXT_H
#define VQMTEXT_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
*
*----------------------------------------------------------------------------
*
* FILE
* text.h
*
* DESCRIPTION
* Text printing definitions. (32-Bit protected mode)
*
* PROGRAMMER
* Denzil E. Long, Jr.
*
* DATE
* March 13, 1995
*
****************************************************************************/
/* Prototypes */
#ifdef __cplusplus
extern "C" {
#endif
long __cdecl Text_Print(char *string, long x, long y, long fcol, long bcol);
void __cdecl Draw_Char(long character, long x, long y);
void __cdecl Set_Font_Palette_Range(void *palette, long start, long end);
#ifdef __cplusplus
}
#endif
#endif /* VQMTEXT_H */

View File

@@ -0,0 +1,71 @@
/*
** 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 VQMVESABLIT_H
#define VQMVESABLIT_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
*
*----------------------------------------------------------------------------
*
* FILE
* VESABlit.h (32-Bit protected mode)
*
* DESCRIPTION
* VESA bitblit routines.
*
* PROGRAMMER
* Denzil E. Long, Jr.
*
* DATE
* Febuary 3, 1995
*
****************************************************************************/
#include <vqm32\video.h>
/*---------------------------------------------------------------------------
* FUNCTION PROTOTYPES
*-------------------------------------------------------------------------*/
void VESA_Blit_640x480(DisplayInfo *disp,unsigned char *buf,long x1,
long y1,long width,long height);
#ifdef __cplusplus
extern "C" {
#endif
void __cdecl Blit_VESA640x480(DisplayInfo *disp,unsigned char *buf,long x1,
long y1,long width,long height);
void __cdecl Buf_320x200_To_VESA_320x200(unsigned char *buffer, long grain);
void __cdecl Buf_320x200_To_VESA_640x400(unsigned char *buffer, long grain);
void __cdecl Buf_320x200_To_VESA_32K(unsigned char *buffer,
unsigned char *palette, long grain);
void __cdecl Copy_Row(char *, char *, long);
void __cdecl Copy_Word_Row(char *source, char *dest, char *palette,
long numbytes);
#ifdef __cplusplus
}
#endif
#endif /* VQMVESABLIT_H */

View File

@@ -0,0 +1,182 @@
/*
** 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 VQMVESAVID_H
#define VQMVESAVID_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
*
*----------------------------------------------------------------------------
*
* FILE
* VESAVid.h (32-Bit protected mode)
*
* DESCRIPTION
* VESA video manager definitions.
*
* PROGRAMMER
* Denzil E. Long, Jr.
*
* DATE
* Febuary 3, 1995
*
****************************************************************************/
#ifndef __WATCOMC__
#include <pharlap.h>
#else
#include "realmode.h"
#endif
/*---------------------------------------------------------------------------
* VESA Video Modes
*-------------------------------------------------------------------------*/
#define VESA_640X400_256 0x100
#define VESA_640X480_256 0x101
#define VESA_800X600_16 0x102
#define VESA_800X600_256 0x103
#define VESA_1024X768_16 0x104
#define VESA_1024X768_256 0x105
#define VESA_1280X400_16 0x106
#define VESA_1280X400_256 0x107
#define VESA_TEXT_80X60 0x108
#define VESA_TEXT_132X25 0x109
#define VESA_TEXT_132X60 0x10C
#define VESA_320X200_32K_1 0x10D
#define VESA_320X200_32K_2 0x10E
#define VESA_640X480_32K 0x110
#define VESA_640X480_65K 0x111
#define VESA_640X480_16M 0x112
#define VESA_800X600_32K 0x113
#define VESA_800X600_65K 0x114
#define VESA_1024X768_32K 0x116
#define VESA_1024X768_65K 0x117
#define VESA_MIN VESA_640X400_256
#define VESA_MAX VESA_1024X768_65K
/*---------------------------------------------------------------------------
* Structure definitions
*-------------------------------------------------------------------------*/
/* VESAInfo - General information about this VESA implementation.
* (Filled in by VESA BIOS Function 0)
*
* Signature - Will always be 'VESA'
* Version - Version #
* OEMString - OEM ID string
* Capabilities - Not defined by VESA yet
* AvailModes - List of available modes; terminated with -1 (0xffff)
* TotalMemory - ???
* Reserved - Pads structure to 256 bytes total
*/
typedef struct _VESAInfo {
char Signature[4];
unsigned short Version;
REALPTR OEMString;
unsigned long Capabilities;
REALPTR AvailModes;
unsigned short TotalMemory;
unsigned char Reserved[236];
} VESAInfo;
/* VESAModeInfo - Information about this VESA mode.
* (Filled in by VESA BIOS Function 1)
*
* Attributes - bit 0: 1 = mode is supported
* bit 1: 1 = optional info available
* bit 2: 1 = std BIOS output functions valid in this mode
* bit 3: 0 = monochrome, 1 = color
* bit 4: 0 = text mode, 1 = graphics
* WinA_Attributes - bit 0 = window exists, bit 1=readable, bit 2= writable
* WinB_Attributes - bit 0 = window exists, bit 1=readable, bit 2= writable
* WinGranularity - smallest address boundary window can be placed upon;
* size is in KB (ie 64, 32, 4)
* WinSize - size of windows in KB (ie 64, 32)
* WinA_Segment - location of Window A in CPU space (usually 0xa000)
* WinB_Segment - location of Window B in CPU space (usually 0xb000)
* WinFunc - address of window-setting function (This is provided
* as an alternative to Int 10 for speed.)
* BytesPerScanline - # bytes per scan line
*
* Optional info (available if bit 1 of Attributes is set):
*
* XRes - X-resolution
* YRes - Y-resolution
* XCharSize - Horizontal size of char cell
* YCharSize - Vertical size of char cell
* NumPlanes - # of memory planes (???)
* BitsPerPixel - # bites per pixel
* NumBanks - # of banks (ie planes)
* MemoryModel - 00h = Text mode
* 01h = CGA mode
* 02h = Hercules
* 03h = 4 plane planar mode
* 04h = packed pixel mode (1 byte/pixel)
* 05h = non-chain 4, 256-color mode
* 06-0Fh =
* 10-FFh = OEM-specific
* BankSize - Bank size in KB
*/
typedef struct _VESAModeInfo {
unsigned short Attributes;
unsigned char WinA_Attributes;
unsigned char WinB_Attributes;
unsigned short WinGranularity;
unsigned short WinSize;
unsigned short WinA_Segment;
unsigned short WinB_Segment;
REALPTR WinFunc;
unsigned short BytesPerScanline;
unsigned short XRes;
unsigned short YRes;
unsigned char XCharSize;
unsigned char YCharSize;
unsigned char NumPlanes;
unsigned char BitsPerPixel;
unsigned char NumBanks;
unsigned char MemoryModel;
unsigned char BankSize;
unsigned char NumInputPages;
unsigned char Reserved;
unsigned char RedMaskSize;
unsigned char RedFieldPosition;
unsigned char GreenMaskSize;
unsigned char GreenFieldPosition;
unsigned char BlueMaskSize;
unsigned char BlueFieldPosition;
unsigned char RsvdMaskSize;
unsigned char RsvdFieldPosition;
unsigned char DirectColorModeInfo;
unsigned char pad[216];
} VESAModeInfo;
/*---------------------------------------------------------------------------
* Function prototypes
*-------------------------------------------------------------------------*/
long InitVESA(void);
void UninitVESA(void);
VESAModeInfo *SetVESAMode(long mode);
VESAModeInfo *ReadVESAModeInfo(long mode);
void SetVESAWindow(long grain_num);
#endif /* VQMVESAVID_H */

View File

@@ -0,0 +1,203 @@
;
; 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
;*
;*----------------------------------------------------------------------------
;*
;* FILE
;* vesavid.i
;*
;* DESCRIPTION
;* VESA video manager definitions. (32-Bit protected mode)
;*
;* PROGRAMMER
;* Denzil E. Long, Jr.
;*
;* DATE
;* January 26, 1995
;*
;****************************************************************************
;----------------------------------------------------------------------------
; VESA video modes
;----------------------------------------------------------------------------
VESA_640X400_256 EQU 0x100
VESA_640X480_256 EQU 0x101
VESA_800X600_16 EQU 0x102
VESA_800X600_256 EQU 0x103
VESA_1024X768_16 EQU 0x104
VESA_1024X768_256 EQU 0x105
VESA_1280X400_16 EQU 0x106
VESA_1280X400_256 EQU 0x107
VESA_TEXT_80X60 EQU 0x108
VESA_TEXT_132X25 EQU 0x109
VESA_TEXT_132X60 EQU 0x10C
VESA_320X200_32K_1 EQU 0x10D
VESA_320X200_32K_2 EQU 0x10E
VESA_640X480_32K EQU 0x110
VESA_640X480_65K EQU 0x111
VESA_640X480_16M EQU 0x112
VESA_800X600_32K EQU 0x113
VESA_800X600_65K EQU 0x114
VESA_1024X768_32K EQU 0x116
VESA_1024X768_65K EQU 0x117
VESA_MIN EQU VESA_640X400_256
VESA_MAX EQU VESA_1024X768_65K
;----------------------------------------------------------------------------
; Structure definitions
;----------------------------------------------------------------------------
; VESAInfo - General information about this VESA implementation.
; (Filled in by VESA BIOS Function 0)
;
; Signature - Will always be 'VESA'
; Ver - Version #
; OEMString - OEM ID string
; Capabilities - Not defined by VESA yet
; AvailModes - List of available modes; terminated with -1 (0xffff)
; TotalMemory - ???
; Reserved - Pads structure to 256 bytes total
STRUC VESAInfo
Signature DD ?
Ver DW ?
OEMString DD ?
Capabilities DD ?
AvailModes DD ?
TotalMemory DW ?
Reserved DB 236 DUP (?)
ENDS VESAInfo
; VESAModeInfo - Information about this VESA mode.
; (Filled in by VESA BIOS Function 1)
;
; Attributes - bit 0: 1 = mode is supported
; bit 1: 1 = optional info available
; bit 2: 1 = std BIOS output functions valid in this mode
; bit 3: 0 = monochrome, 1 = color
; bit 4: 0 = text mode, 1 = graphics
; WinA_Attributes - bit 0 = window exists, bit 1=readable, bit 2= writable
; WinB_Attributes - bit 0 = window exists, bit 1=readable, bit 2= writable
; WinGranularity - smallest address boundary window can be placed upon;
; size is in KB (ie 64, 32, 4)
; WinSize - size of windows in KB (ie 64, 32)
; WinA_Segment - location of Window A in CPU space (usually 0xa000)
; WinB_Segment - location of Window B in CPU space (usually 0xb000)
; WinFunc - address of window-setting function (This is provided
; as an alternative to Int 10 for speed.)
; BytesPerScanline - # bytes per scan line
;
; Optional info (available if bit 1 of Attributes is set):
;
; XRes - X-resolution
; YRes - Y-resolution
; XCharSize - Horizontal size of char cell
; YCharSize - Vertical size of char cell
; NumPlanes - # of memory planes (???)
; BitsPerPixel - # bites per pixel
; NumBanks - # of banks (ie planes)
; MemoryModel - 00h = Text mode
; 01h = CGA mode
; 02h = Hercules
; 03h = 4 plane planar mode
; 04h = packed pixel mode (1 byte/pixel)
; 05h = non-chain 4, 256-color mode
; 06-0Fh =
; 10-FFh = OEM-specific
; BankSize - Bank size in KB
STRUC VESAModeInfo
Attributes DW ?
WinA_Attributes DB ?
WinB_Attributes DB ?
WinGranularity DW ?
WinSize DW ?
WinA_Segment DW ?
WinB_Segment DW ?
WinFunc DD ?
BytesPerScanline DW ?
XRes DW ?
YRes DW ?
XCharSize DB ?
YCharSize DB ?
NumPlanes DB ?
BitsPerPixel DB ?
NumBanks DB ?
MemoryModel DB ?
BankSize DB ?
NumInputPages DB ?
Reserved DB ?
RedMaskSize DB ?
RedFieldPosition DB ?
GreenMaskSize DB ?
GreenFieldPosition DB ?
BlueMaskSize DB ?
BlueFieldPosition DB ?
RsvdMaskSize DB ?
RsvdFieldPosition DB ?
DirectColorModeInfo DB ?
pad DB 216 DUP (?)
ENDS VESAModeInfo
;----------------------------------------------------------------------------
; Function definitions
;----------------------------------------------------------------------------
GLOBAL C InitVESA:PROC
GLOBAL C UninitVESA:PROC
GLOBAL C SetVESAMode:PROC
GLOBAL C ReadVESAModeInfo:PROC
GLOBAL C SetVESAWindow:PROC
;----------------------------------------------------------------------------
;
; NAME
; SET_WINDOW - Sets window A to the specified bank.
;
; SYNOPSIS
; SET_WINDOW GrainNum
;
; FUNCTION
; This routine uses the C Set_Window function rather than going through
; the BIOS, for two reasons: (1) Speed, and (2) On the Cirrus Logic 54xx
; VESA cards, BIOS calls make noise while playing digital audio.
;
; INPUTS
; GrainNum - Granularity number.
;
; RESULT
; NONE
;
;----------------------------------------------------------------------------
MACRO SET_WINDOW grain_num
push esi
push edi
push es
call SetVESAWindow C,grain_num
pop es
pop edi
pop esi
ENDM

217
WINVQ/INCLUDE/VQM32/VGA.I Normal file
View File

@@ -0,0 +1,217 @@
;
; 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
;*
;*---------------------------------------------------------------------------
;*
;* FILE
;* vga.i
;*
;* DESCRIPTION
;* VGA hardware definitions. (32-Bit protected mode)
;*
;* PROGRAMMER
;* Denzil E. Long, Jr.
;*
;* DATE
;* January 26, 1995
;*
;****************************************************************************
;----------------------------------------------------------------------------
; VGA Registers
;----------------------------------------------------------------------------
R_SEQUENCER EQU 03C4h ;Sequencer Controller Index reg
SEQ_RESET EQU 00h ;Reset
SEQ_MAP_MASK EQU 02h ;Index in Sequencer of Map Mask reg
SEQ_MEMORY_MODE EQU 04h ;Memory Mode
R_GRAPHICS_CONTROLLER EQU 03CEh ;Graphics Controller Index reg
GC_READ_MAP EQU 04h ;Index in GController of Read Map reg
GC_MODE EQU 05h ;Read/Write Modes
GC_MISC EQU 06h ;Read/Write Modes
GC_BITMASK EQU 08h ;Index in GController of BitMask reg
R_CRT_CONTROLLER EQU 03D4h ;CRT Controller Index reg
CRT_VERT_TOTAL EQU 06h ;Vertical total
CRT_OVERFLOW EQU 07h ;Overflow
CRT_MAX_SCANLINE EQU 09h ;Max scan line
CRT_STARTADDR_HIGH EQU 0Ch ;Bitmap start address high byte
CRT_STARTADDR_LOW EQU 0Dh ;Bitmap start address low byte
CRT_VERTRET_START EQU 010h ;Vertical retrace pulse start
CRT_VERTRET_END EQU 011h ;Vertical retrace pulse end
CRT_VERTDISP_END EQU 012h ;Vertical display end
CRT_UNDERLINE EQU 014h ;Underline location
CRT_START_VB EQU 015h ;Start vertical blank
CRT_END_VB EQU 016h ;End vertical blank
CRT_MODE_CONTROL EQU 017h ;Mode control
R_MISC_OUTPUT EQU 03C2h ;Miscellaneous Output reg
;----------------------------------------------------------------------------
; Palette Registers
;----------------------------------------------------------------------------
PEL_READ_ADDR EQU 03C7h
PEL_WRITE_ADDR EQU 03C8h
PEL_DATA EQU 03C9h
;----------------------------------------------------------------------------
; XMode planes, for the Map Mask register
;----------------------------------------------------------------------------
XPLANE_1 EQU 1
XPLANE_2 EQU 2
XPLANE_3 EQU 4
XPLANE_4 EQU 8
;----------------------------------------------------------------------------
;
; NAME
; SET_PLANE - Set an XMode plane.
;
; SYNOPSIS
; SET_PLANE plane
;
; INPUTS
; plane - Number of Xmode plane to set.
;
; USES
; eax, edx
;
;----------------------------------------------------------------------------
MACRO SET_PLANE plane
mov edx,R_SEQUENCER
mov eax,SEQ_MAP_MASK
out dx,al
inc edx
mov eax,plane
out dx,al
ENDM
;----------------------------------------------------------------------------
;
; NAME
; SET_BITMASK - Set the BitMask register.
;
; SYNOPSIS
; SET_BITMASK mask
;
; INPUTS
; mask - Bitmask to use.
;
; USES
; eax, edx
;
;----------------------------------------------------------------------------
MACRO SET_BITMASK mask
mov edx,R_GRAPHICS_CONTROLLER
mov eax,GC_BITMASK
out dx,al
inc edx
mov eax,mask
out dx,al
ENDM
;----------------------------------------------------------------------------
;
; NAME
; SET_WRITEMODE - Set the VGA writemode.
;
; SYNOPSIS
; SET_WRITEMODE mode
;
; INPUTS
; mode - Write mode.
;
; USES
; eax, edx
;
;----------------------------------------------------------------------------
MACRO SET_WRITEMODE mode
mov edx,R_GRAPHICS_CONTROLLER
mov eax,GC_MODE
out dx,al
inc edx
in al,dx ;Read the register
and al,0FCh ;Turn off 2 lower bits
or al,mode ;Set write mode
out dx,al
ENDM
;----------------------------------------------------------------------------
;
; NAME
; OUTPORT - Output data to a VGA register.
;
; SYNOPSIS
; OUTPORT port,register,data
;
; INPUTS
; port - Port address.
; register - Register to write to.
; data - Data to write.
;
; USES
; eax, edx
;
;----------------------------------------------------------------------------
MACRO OUTPORT port,register,data
mov edx,port
mov al,register
out dx,al
inc edx
mov al,data
out dx,al
ENDM
;----------------------------------------------------------------------------
;
; NAME
; INPORT - Input data from a VGA register.
;
; SYNOPSIS
; data = INPORT port,register
;
; INPUTS
; port - Port address.
; register - Register to read from.
;
; RESULT
; data - Value read from port in AL.
;
; USES
; eax, edx
;
;----------------------------------------------------------------------------
MACRO INPORT port,register
mov edx,port
mov al,register
out dx,al
inc edx
in al,dx
ENDM

115
WINVQ/INCLUDE/VQM32/VIDEO.H Normal file
View File

@@ -0,0 +1,115 @@
/*
** 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 VQMVIDEO_H
#define VQMVIDEO_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
*
*----------------------------------------------------------------------------
*
* FILE
* Video.h (32-Bit protected mode)
*
* DESCRIPTION
* Video manager definitions.
*
* PROGRAMMER
* Denzil E. Long, Jr.
*
* DATE
* Febuary 3, 1995
*
****************************************************************************/
#include <vqm32\vesavid.h>
/*---------------------------------------------------------------------------
* VGA video modes
*-------------------------------------------------------------------------*/
#define TEXT_VIDEO 0x02
#define MCGA 0x13
#define XMODE_320X200 0x50
#define XMODE_320X240 0x51
#define XMODE_320X400 0x52
#define XMODE_320X480 0x53
#define XMODE_360X400 0x54
#define XMODE_360X480 0x55
#define XMODE_MIN 0x50
#define XMODE_MAX 0x55
/*---------------------------------------------------------------------------
* Structure definitions
*-------------------------------------------------------------------------*/
/* DisplayInfo - Information about the current display.
*
* Mode - Mode identification.
* XRes - X resolution of mode.
* YRes - Y resolution of mode.
* VBIbit - Polarity of vertical blank bit.
* Extended - Pointer to mode specific data structure.
*/
typedef struct _DisplayInfo {
long Mode;
long XRes;
long YRes;
long VBIbit;
void *Extended;
} DisplayInfo;
/*---------------------------------------------------------------------------
* Function prototypes
*-------------------------------------------------------------------------*/
DisplayInfo *SetVideoMode(long mode);
DisplayInfo *GetDisplayInfo(void);
long TestVBIBit(void);
long GetVBIBit(void);
void SetupXPaging(void);
void FlipXPage(void);
unsigned char *GetXHidPage(void);
unsigned char *GetXSeenPage(void);
void DisplayXPage(long page);
#ifdef __cplusplus
extern "C" {
#endif
void __cdecl WaitNoVB(short vbibit);
void __cdecl WaitVB(short vbibit);
void __cdecl ClearVRAM(void);
long __cdecl SetXMode(long mode);
void __cdecl ClearXMode(void);
void __cdecl ShowXPage(unsigned long StartOffset);
void __cdecl Xmode_BufferCopy_320x200(void *buff, void *screen);
void __cdecl Xmode_Blit(void *buffer, void *screen, long imgwidth, long imgheight);
void __cdecl MCGA_BufferCopy(unsigned char *buffer, unsigned char *dummy);
void __cdecl MCGA_Blit(unsigned char *buffer, unsigned char *screen,
long imgwidth, long imgheight);
#ifdef __cplusplus
}
#endif
#endif /* VQMVIDEO_H */

View File

@@ -0,0 +1,80 @@
;
; 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
;*
;*----------------------------------------------------------------------------
;*
;* FILE
;* video.i
;*
;* DESCRIPTION
;* Video manager definitions. (32-Bit protected mode)
;*
;* PROGRAMMER
;* Denzil E. Long, Jr.
;*
;* DATE
;* January 26, 1995
;*
;****************************************************************************
INCLUDE "vesavid.i"
;----------------------------------------------------------------------------
; Video Modes
;----------------------------------------------------------------------------
TEXT EQU 002h
MCGA EQU 013h
XMODE_320X200 EQU 050h
XMODE_320X240 EQU 051h
XMODE_320X400 EQU 052h
XMODE_320X480 EQU 053h
XMODE_360X400 EQU 054h
XMODE_360X480 EQU 055h
;----------------------------------------------------------------------------
; Structure definitions
;----------------------------------------------------------------------------
; DisplayInfo - Information about the current display.
;
; Mode - Mode identification
; XRes - X resolution
; YRes - Y resolution
; VBIbit - Polarity of vertical blank bit.
; Extended - Pointer to mode specified data structure.
STRUC DisplayInfo
Mode DD ?
XRes DD ?
YRes DD ?
VBIbit DD ?
Extended DD ?
ENDS DisplayInfo
;----------------------------------------------------------------------------
; Function definitions
;----------------------------------------------------------------------------
GLOBAL C GetDisplayInfo:NEAR
GLOBAL C GetVBIBit:NEAR

73
WINVQ/INCLUDE/WAVEFILE.H Normal file
View File

@@ -0,0 +1,73 @@
/*
** 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 WAVEFILE_H
#define WAVEFILE_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
*
*----------------------------------------------------------------------------
*
* FILE
* wavefile.c
*
* DESCRIPTION
* WAVE file format definitions.
*
* PROGRAMMER
* Denzil E. Long, Jr.
*
* DATE
* February 21, 1995
*
****************************************************************************/
/* WAVHeader: WAVE file header.
*
* RIFF - 4 byte identifier (always "RIFF").
* Size - Size in bytes of entire file.
* WAVE - 4 byte identifier (always "WAVE").
*/
typedef struct _WAVHeader {
long RIFF;
long Size;
long WAVE;
} WAVHeader;
/* WAVFormat: This structure describes the format of the audio data contained
* in the WAV file.
*
* FormatTag -
* Channels - Number of channels (1 = mono, 2 = stereo).
* SamplesPerSec - Sampling rate.
* AvgBytesPerSec - Bytes in 1 second of audio (Rate * SampleSize * Channels)
* BlockAlign - padding.
* BitsPerSample - Number of bits per sample (8, 16).
*/
typedef struct _WAVFormat {
short FormatTag;
short Channels;
long SamplesPerSec;
long AvgBytesPerSec;
short BlockAlign;
short BitsPerSample;
} WAVFormat;
#endif /* WAVEFILE_H */

54
WINVQ/INCLUDE/WWTYPES.H Normal file
View File

@@ -0,0 +1,54 @@
/*
** 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 WWTYPES_H
#define WWTYPES_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
*
*----------------------------------------------------------------------------
*
* FILENAME
* wwtypes.h
*
* DESCRIPTION
* Westwood standard types definitions.
*
* PROGRAMMER
* Denzil E. Long, Jr.
*
****************************************************************************/
#define TRUE 1
#define FALSE 0
#define VOID void
#define PRIVATE static
#define PUBLIC
#define BOOL short
#define BYTE char
#define UBYTE unsigned char
#define WORD signed short
#define UWORD unsigned short
#define LONG signed long
#define ULONG unsigned long
#endif /* WWTYPES_H */