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

565
VQ/INCLUDE/HMI32/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

128
VQ/INCLUDE/HMI32/SOSDATA.H Normal file
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


218
VQ/INCLUDE/HMI32/SOSFNCT.H Normal file
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

129
VQ/INCLUDE/HMI32/SOSRES.H Normal file
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


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

74
VQ/INCLUDE/VQ.H Normal file
View File

@@ -0,0 +1,74 @@
/*
** 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.
*
****************************************************************************/
/* 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 */

197
VQ/INCLUDE/VQA32/VQAFILE.H Normal file
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,282 @@
/*
** 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
* February 23, 1995
*
****************************************************************************/
/*---------------------------------------------------------------------------
* CONDITIONAL COMPILATION FLAGS
*-------------------------------------------------------------------------*/
#ifdef __WATCOMC__
#define VQAVOC_ON 0 /* Enable VOC file override */
#define VQAMONO_ON 1 /* Mono display output enable/disable */
#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 1 /* 2x2 block decode enable/disable */
#define VQABLOCK_2X3 1 /* 2x2 block decode enable/disable */
#define VQABLOCK_4X2 1 /* 4x2 block decode enable/disable */
#define VQABLOCK_4X4 1 /* 4x4 block decode enable/disable */
#else
#define VQAVOC_ON 1 /* Enable VOC file override */
#define VQAMONO_ON 1 /* Mono display output enable/disable */
#define VQAAUDIO_ON 0 /* 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 1 /* 2x2 block decode enable/disable */
#define VQABLOCK_2X3 1 /* 2x2 block decode enable/disable */
#define VQABLOCK_4X2 1 /* 4x2 block decode enable/disable */
#define VQABLOCK_4X4 1 /* 4x4 block decode enable/disable */
#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_STOP 2 /* 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 */
/* Error/condition values */
#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. */
/* Memory limits */
#define VQA_NUM_MAXRATES 5 /* Number of max rates in the Config struct */
#define VQA_TIMETICKS 60 /* Clock ticks per second */
/*---------------------------------------------------------------------------
* STRUCTURES AND RELATED DEFINITIONS
*-------------------------------------------------------------------------*/
/* VQAConfig: Player configuration structure
*
* DrawerCallback - User routine for Drawer to call each frame (NULL = none)
* 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)
* 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 22050 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)
* MaxRate - Fixed rate playback table.
*/
typedef struct _VQAConfig {
void (*DrawerCallback)(unsigned char *screen, long framenum);
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;
char *VocFile;
unsigned char *AudioBuf;
long AudioBufSize;
long AudioRate;
long Volume;
long HMIBufSize;
long DigiHandle;
long DigiCard;
long DigiPort;
long DigiIRQ;
long DigiDMA;
} 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 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)
/* 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_FINF 3 /* Frame info chunk enable */
#define VQAOPTB_SLOWPAL 4 /* Slow palette enable */
#define VQAOPTB_HMIINIT 5 /* HMI already initialized by client. */
#define VQAOPTF_AUDIO (1<<VQAOPTB_AUDIO)
#define VQAOPTF_STEP (1<<VQAOPTB_STEP)
#define VQAOPTF_MONO (1<<VQAOPTB_MONO)
#define VQAOPTF_FINF (1<<VQAOPTB_FINF)
#define VQAOPTF_SLOWPAL (1<<VQAOPTB_SLOWPAL)
#define VQAOPTF_HMIINIT (1<<VQAOPTB_HMIINIT)
/* 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.
*/
typedef struct _VQAInfo {
long NumFrames;
long ImageWidth;
long ImageHeight;
} 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.
*
* VQAStream - Something meaningful to the stream manager. (See DOCS)
*/
typedef struct _VQAHandle {
unsigned long VQAStream;
} VQAHandle;
/* Possible stream command values */
#define VQACMD_INIT 1 /* Prepare the stream for a session */
#define VQACMD_CLEANUP 2 /* Terminate stream session */
#define VQACMD_OPEN 3 /* Open stream */
#define VQACMD_CLOSE 4 /* Close stream */
#define VQACMD_READ 5 /* Read bytes from stream */
#define VQACMD_WRITE 6 /* Write bytes to stream */
#define VQACMD_SEEK 7 /* Seek on stream */
/*---------------------------------------------------------------------------
* FUNCTION PROTOTYPES
*-------------------------------------------------------------------------*/
void VQA_INIConfig(VQAConfig *config);
void VQA_DefaultConfig(VQAConfig *config);
VQAHandle *VQA_Alloc(void);
void VQA_Free(VQAHandle *vqa);
void VQA_InitAsDOS(VQAHandle *vqa);
void VQA_Init(VQAHandle *vqa, unsigned long(*streamhandler)(VQAHandle *vqa,
long action, void *buffer, long nbytes));
long VQA_Open(VQAHandle *vqa, char const *filename, VQAConfig *config);
void VQA_Close(VQAHandle *vqa);
long VQA_Play(VQAHandle *vqa, long mode);
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 */

321
VQ/INCLUDE/VQA32/VQAPLAY.H Normal file
View File

@@ -0,0 +1,321 @@
/*
** 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
*-------------------------------------------------------------------------*/
#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 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 VQAAUDIO_ON 0 /* 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
/*---------------------------------------------------------------------------
* 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)
* 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;
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_InitAsDOS(VQAHandle *vqa);
void VQA_Init(VQAHandle *vqa, long(*iohandler)(VQAHandle *vqa, long action,
void *buffer, long nbytes));
/* 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);
/* 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 */

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

105
VQ/INCLUDE/VQM32/MIXFILE.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 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 */

66
VQ/INCLUDE/VQM32/MONO.H Normal file
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 */

57
VQ/INCLUDE/VQM32/PORTIO.H Normal file
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 sosCODECInitStream(_SOS_COMPRESS_INFO *);
unsigned long cdecl sosCODECCompressData(_SOS_COMPRESS_INFO *,unsigned long);
unsigned long cdecl sosCODECDecompressData(_SOS_COMPRESS_INFO *,unsigned long);
#ifdef __cplusplus
}
#endif
#endif

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

56
VQ/INCLUDE/VQM32/TEXT.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 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 */

182
VQ/INCLUDE/VQM32/VESAVID.H Normal file
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 */

203
VQ/INCLUDE/VQM32/VESAVID.I Normal file
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
VQ/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
VQ/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 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 */

80
VQ/INCLUDE/VQM32/VIDEO.I Normal file
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
VQ/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 */

143
VQ/INCLUDE/WWLIB32/AUDIO.H Normal file
View File

@@ -0,0 +1,143 @@
/*
** Command & Conquer Red Alert(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/***************************************************************************
** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S **
***************************************************************************
* *
* Project Name : Westwood 32 bit Library *
* *
* File Name : AUDIO.H *
* *
* Programmer : Phil W. Gorrow *
* *
* Start Date : March 10, 1995 *
* *
* Last Update : March 10, 1995 [PWG] *
* *
*-------------------------------------------------------------------------*
* Functions: *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
#include "wwstd.h"
/*=========================================================================*/
/* AUD file header type */
/*=========================================================================*/
#define AUD_FLAG_STEREO 1
#define AUD_FLAG_16BIT 2
// PWG 3-14-95: This structure used to have bit fields defined for Stereo
// and Bits. These were removed because watcom packs them into a 32 bit
// flag entry even though they could have fit in a 8 bit entry.
#pragma pack(1);
typedef struct {
short int Rate; // Playback rate (hertz).
long Size; // Size of data (bytes).
unsigned char Flags; // Holds flags for info
// 1: Is the sample stereo?
// 2: Is the sample 16 bits?
unsigned char Compression; // What kind of compression for this sample?
} AUDHeaderType;
/*=========================================================================*/
/* There can be a different sound driver for sound effects, digitized */
/* samples, and musical scores. Each one must be of these specified */
/* types. */
/*=========================================================================*/
typedef enum {
SAMPLE_NONE, // No digitized sounds will be played.
SAMPLE_SB, // Sound Blaster digitized driver.
SAMPLE_SBPRO, // Sound Blaster Pro digitized driver.
SAMPLE_PAS, // Pro-Audio Spectrum digitized driver.
SAMPLE_ADLIBG, // Adlib-Gold digitized driver.
SAMPLE_TANDY, // Tandy 'compatible' driver.
SAMPLE_PCSPKR, // PC speaker digitized driver (The Audio Solution driver).
SAMPLE_ADLIB, // Adlib digitized driver (The Audio Solution driver).
SAMPLE_TEMP=0x1000,
SAMPLE_LAST
} Sample_Type;
typedef enum {
SCORE_NONE, // No scores will be played.
SCORE_ALFX, // Westwood's ALFX adlib compatable driver.
SCORE_WWPCSPKR, // Westwood's PC-speaker driver (obsolete).
SCORE_WWTANDY, // Westwood's PC-speaker driver with Tandy mod (obsolete).
SCORE_PCSPKR, // PC speaker XMIDI driver.
SCORE_TANDY, // Tandy XMIDI driver.
SCORE_MT32, // MT-32 / LAPC-1 Roland XMIDI driver.
SCORE_CANVAS, // Sound Canvas SC-55.
SCORE_ADLIB, // Adlib XMIDI driver.
SCORE_ADLIBG, // Adlib Gold XMIDI driver.
SCORE_PASFM, // Pro Audio Spectrum XMIDI driver.
SCORE_SBFM, // Sound Blaster XMIDI driver.
SCORE_SBP1FM, // Sound Blaster Pro (YM3812) XMIDI driver.
SCORE_SBP2FM, // Sound Blaster Pro (OPL3) XMIDI driver (Can't use with SFX_ALFX).
SCORE_TEMP=0x1000,
SCORE_LAST
} Score_Type;
typedef enum {
SFX_NONE, // No sound effects will be played.
SFX_ALFX, // Westwood's ALFX adlib compatable driver.
SFX_WWPCSPKR, // Westwood's PC-speaker driver.
SFX_WWTANDY, // Westwood's PC-speaker driver with Tandy mod.
SFX_PCSPKR, // PC speaker XMIDI driver.
SFX_TANDY, // Tandy XMIDI driver.
SFX_MT32, // MT-32 / LAPC-1 Roland XMIDI driver.
SFX_CANVAS, // Sound Canvas SC-55.
SFX_ADLIB, // Adlib XMIDI driver.
SFX_ADLIBG, // Adlib Gold XMIDI driver.
SFX_PASFM, // Pro Audio Spectrum XMIDI driver.
SFX_SBFM, // Sound Blaster XMIDI driver.
SFX_SBP1FM, // Sound Blaster Pro (YM3812) XMIDI driver.
SFX_SBP2FM, // Sound Blaster Pro (OPL3) XMIDI driver.
SFX_TEMP=0x1000,
SFX_LAST
} SFX_Type;
/*=========================================================================*/
/* The following prototypes are for the file: SOUNDIO.CPP */
/*=========================================================================*/
int File_Stream_Sample(char const *filename);
int File_Stream_Sample_Vol(char const *filename, int volume);
void cdecl _saveregs Sound_Callback(void);
void cdecl far __saveregs __loadds maintenance_callback(void);
void *Load_Sample(char const *filename);
long Load_Sample_Into_Buffer(char const *filename, void *buffer, long size);
long Sample_Read(int fh, void *buffer, long size);
void Free_Sample(void const *sample);
BOOL Sound_Init(int sfx, int score, int sample, int reverse_channels = FALSE);
BOOL Audio_Init(int sample, int address, int inter, int dma, int reverse_channels = FALSE);
void Sound_End(void);
void Stop_Sample(int handle);
BOOL Sample_Status(int handle);
BOOL Is_Sample_Playing(void const * sample);
void Stop_Sample_Playing(void const * sample);
int Play_Sample(void const *sample, int priority=0xFF, int volume=0xFF, signed short panloc = 0x0);
int Set_Sound_Vol(int volume);
int Set_Score_Vol(int volume);
void Fade_Sample(int handle, int ticks);
extern unsigned int DigiHandle;
extern int Misc;
extern SFX_Type SoundType;
extern Sample_Type SampleType;

129
VQ/INCLUDE/WWLIB32/BUFFER.H Normal file
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/>.
*/
/***************************************************************************
** C O N F I D E N T I A L --- W E S T W O O D A S S O C I A T E S **
***************************************************************************
* *
* Project Name : Westwood 32 Bit Library *
* *
* File Name : GBUFFER.H *
* *
* Programmer : Phil W. Gorrow *
* *
* Start Date : May 26, 1994 *
* *
* Last Update : July 5, 1994 [PWG] *
* *
*-------------------------------------------------------------------------*
* Functions: *
* BC::Get_Size -- Returns the buffer size of the BufferClass instance *
* BC::Get_Buffer -- Returns pointer to buffer inherent to BufferClass *
* BC::BufferClass -- inline constructor for BufferClass with size only *
* BC::To_Page -- Copys a buffer class to a page with definable x, y, w, h*
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
#ifndef BUFFER_H
#define BUFFER_H
/*=========================================================================*/
/* If we have not already loaded the standard library header, than we can */
/* load it. */
/*=========================================================================*/
#ifndef WWSTD_H
#include "wwstd.h"
#endif
class GraphicViewPortClass;
class VideoViewPortClass;
/*=========================================================================*/
/* BufferClass - A base class which holds buffer information including a */
/* pointer and the size of the buffer. */
/*=========================================================================*/
class BufferClass {
public:
/*===================================================================*/
/* Define the base constructor and destructors for the class */
/*===================================================================*/
BufferClass(void *ptr, long size);
BufferClass(long size);
BufferClass();
~BufferClass();
/*===================================================================*/
/* Define functions which work with the buffer class. */
/*===================================================================*/
long To_Page(GraphicViewPortClass &view);
long To_Page(int w, int h, GraphicViewPortClass &view);
long To_Page(int x, int y, int w, int h, GraphicViewPortClass &view);
long To_Page(VideoViewPortClass &view);
long To_Page(int w, int h, VideoViewPortClass &view);
long To_Page(int x, int y, int w, int h, VideoViewPortClass &view);
/*===================================================================*/
/* define functions to get at the protected data members */
/*===================================================================*/
void *Get_Buffer(void);
long Get_Size(void);
private:
/*===================================================================*/
/* Define the operators we do not want to happen which are the copy */
/* and equal constructors. These are bad because the Allocated flag */
/* could be copied and the associated buffer freed. If this were to */
/* gappen it could cause weird general protection fault. */
/*===================================================================*/
BufferClass(BufferClass const &);
BufferClass &operator=(BufferClass const &);
protected:
void *Buffer;
long Size;
BOOL Allocated;
};
/***************************************************************************
* BC::GET_SIZE -- Returns the buffer size of the BufferClass instance *
* *
* INPUT: none *
* *
* OUTPUT: long the size of the buffer *
* *
* HISTORY: *
* 06/01/1994 PWG : Created. *
*=========================================================================*/
inline long BufferClass::Get_Size(void)
{
return(Size);
}
/***************************************************************************
* BC::GET_BUFFER -- Returns pointer to buffer inherent to BufferClass *
* *
* INPUT: none *
* *
* OUTPUT: void * to the inherent buffer. *
* *
* HISTORY: *
* 06/01/1994 PWG : Created. *
*=========================================================================*/
inline void *BufferClass::Get_Buffer(void)
{
return(Buffer);
}
#endif

View File

@@ -0,0 +1,93 @@
/*
** Command & Conquer Red Alert(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/***************************************************************************
** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S **
***************************************************************************
* *
* Project Name : WWLIB32 library *
* *
* File Name : DESCMGMT.H *
* *
* Programmer : Scott K. Bowen *
* *
* Start Date : August 3, 1994 *
* *
* Last Update : August 3, 1994 [SKB] *
* *
*-------------------------------------------------------------------------*
* Functions: *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
#ifndef DESCMGMT_H
#define DESCMGMT_H
#ifndef WWSTD_H
#include "wwstd.h"
#endif
//=====================================================================
// C type include files
#ifdef __cplusplus
extern "C" {
#endif
#include <dos.h>
#include <bios.h>
#ifdef __cplusplus
}
#endif
// ====================================================================
// types
// These where taken from dos.h
//==========================================
// external functions
// ===================================================
extern ULONG Map_Segment_To_Address(ULONG address, ULONG length);
extern "C" {
// Assemble functions
extern UWORD FixSelector(UWORD sel);
extern UWORD GetDs(void);
extern UWORD GetCs(void);
extern VOID GetDefaultSelectors(VOID);
extern UWORD Get_Standard_Selector(void);
// Assembly data variables
extern UWORD CodeSelector;
extern UWORD DataSelector;
extern UWORD ScreenSelector;
extern UWORD GraphicsSelector;
extern UWORD PspSelector;
extern UWORD EnvSelector;
extern UWORD DosMemSelector;
extern UWORD Fp1167Selector;
extern UWORD FpWeitekSelector;
extern UWORD FpCyrixSelector;
}
#endif // DESCMGMT_H


View File

@@ -0,0 +1,24 @@
/*
** 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/>.
*/
int Dip_Text(char const *source, char *dest);
int UnDip_Text(char const *source, char *dest);
char *Extract_String(void const *data, int string);
void Fixup_Text(char const *source, char *dest);
extern char Common[];
extern char Dipthong[16][8];

256
VQ/INCLUDE/WWLIB32/FILE.H Normal file
View File

@@ -0,0 +1,256 @@
/*
** Command & Conquer Red Alert(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/***************************************************************************
** C O N F I D E N T I A L --- W E S T W O O D A S S O C I A T E S **
***************************************************************************
* *
* Project Name : Library - Filio header stuff. *
* *
* File Name : FILE.H *
* *
* Programmer : Scott K. Bowen *
* *
* Start Date : September 13, 1993 *
* *
* Last Update : April 11, 1994 *
* *
*-------------------------------------------------------------------------*
* Functions: *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
#ifndef FILE_H
#define FILE_H
#ifndef FILETEMP_H
// This should be removed once the library is all intacked.
#include "filetemp.h"
#endif
/*=========================================================================*/
/* File IO system defines and enumerations */
/*=========================================================================*/
#define XMAXPATH 80
/*
** These are the Open_File, Read_File, and Seek_File constants.
*/
#define READ 1 // Read access.
#define WRITE 2 // Write access.
#ifndef SEEK_SET
#define SEEK_SET 0 // Seek from start of file.
#define SEEK_CUR 1 // Seek relative from current location.
#define SEEK_END 2 // Seek from end of file.
#endif
typedef enum {
FILEB_PROCESSED=8,// Was the packed file header of this file processed?
FILEB_PRELOAD, // Scan for and make file resident at WWDOS_Init time?
FILEB_RESIDENT, // Make resident at Open_File time?
FILEB_FLUSH, // Un-resident at Close_File time?
FILEB_PACKED, // Is this file packed?
FILEB_KEEP, // Don't ever flush this resident file?
FILEB_PRIORITY, // Flush this file last?
FILEB_LAST
} FileFlags_Type;
#define FILEF_NONE 0
#define FILEF_PROCESSED (1<<FILEB_PROCESSED)
#define FILEF_PRELOAD (1<<FILEB_PRELOAD)
#define FILEF_RESIDENT (1<<FILEB_RESIDENT)
#define FILEF_FLUSH (1<<FILEB_FLUSH)
#define FILEF_PACKED (1<<FILEB_PACKED)
#define FILEF_KEEP (1<<FILEB_KEEP)
#define FILEF_PRIORITY (1<<FILEB_PRIORITY)
/*
** These errors are returned by WWDOS_Init(). All errors encountered are
** or'd together so there may be more then one error returned. Not all
** errors are fatal, such as the cache errors.
*/
typedef enum {
FI_SUCCESS = 0x00,
FI_CACHE_TOO_BIG = 0x01,
FI_CACHE_ALREADY_INIT = 0x02,
FI_FILEDATA_FILE_NOT_FOUND = 0x04,
FI_FILEDATA_TOO_BIG = 0x08,
FI_SEARCH_PATH_NOT_FOUND = 0x10,
FI_STARTUP_PATH_NOT_FOUND = 0x20,
FI_NO_CACHE_FOR_PRELOAD = 0x40,
FI_FILETABLE_NOT_INIT = 0x80,
} FileInitErrorType;
/*
** These are the errors that are detected by the File I/O system and
** passed to the io error routine.
*/
//lint -strong(AJX,FileErrorType)
typedef enum {
CANT_CREATE_FILE,
BAD_OPEN_MODE,
COULD_NOT_OPEN,
TOO_MANY_FILES,
CLOSING_NON_HANDLE,
READING_NON_HANDLE,
WRITING_NON_HANDLE,
SEEKING_NON_HANDLE,
SEEKING_BAD_OFFSET,
WRITING_RESIDENT,
UNKNOWN_INDEX,
DID_NOT_CLOSE,
FATAL_ERROR,
FILE_NOT_LISTED,
FILE_LENGTH_MISMATCH,
INTERNAL_ERROR,
MAKE_RESIDENT_ZERO_SIZE,
RESIDENT_SORT_FAILURE,
NUMBER_OF_ERRORS /* MAKE SURE THIS IS THE LAST ENTRY */
} FileErrorType;
// This is here tempararaly until library is put together.
//extern WORD cdecl (*cdecl IO_Error)(FileErrorType error, BYTE const *filename);
extern short (*Open_Error)(FileErrorType, BYTE const *);
/*=========================================================================*/
/* File IO system structures */
/*=========================================================================*/
//lint -strong(AJX,FileDataType)
typedef struct {
char *Name; // File name (include sub-directory but not volume).
long Size; // File size (0=indeterminate).
void *Ptr; // Resident file pointer.
long Start; // Starting offset in DOS handle file.
unsigned char Disk; // Disk number location.
unsigned char OpenCount; // Count of open locks on resident file.
unsigned short Flag; // File control flags.
} FileDataType;
/*=========================================================================*/
/* FIle IO system globals. */
/*=========================================================================*/
// These are cpp errors in funtions declarations JULIO JEREZ
// extern FileDataType cdecl FileData[];
// extern BYTE cdecl ExecPath[XMAXPATH + 1];
// extern BYTE cdecl DataPath[XMAXPATH + 1];
// extern BYTE cdecl StartPath[XMAXPATH + 1];
// extern BOOL cdecl UseCD;
// The correct syntax is NO TYPE MODIFIER APPLY TO DATA DECLARATIONS
extern FileDataType FileData[];
extern char ExecPath[XMAXPATH + 1];
extern char DataPath[XMAXPATH + 1];
extern char StartPath[XMAXPATH + 1];
extern BOOL UseCD;
/*=========================================================================*/
/* The following prototypes are for the file: FILEINIT.CPP */
/*=========================================================================*/
void cdecl WWDOS_Shutdown(void);
FileInitErrorType cdecl WWDOS_Init(unsigned long cachesize, char *filedata, char *cdpath);
/*=========================================================================*/
/* The following prototypes are for the file: FILE.CPP */
/*=========================================================================*/
short cdecl Open_File(char const *file_name, short mode);
void cdecl Close_File(short handle);
LONG cdecl Read_File(short handle, void *buf, unsigned long bytes);
LONG cdecl Write_File(short handle, void const *buf, unsigned long bytes);
unsigned long cdecl Seek_File(short handle, LONG offset, short starting);
short cdecl File_Exists(char const *file_name);
unsigned long cdecl File_Size(short handle);
BOOL cdecl Is_Handle_Valid(short handle, FileErrorType error, char const *name);
short cdecl Open_File_With_Recovery( char const *file_name, unsigned short mode );
/*=========================================================================*/
/* The following prototypes are for the file: FILECACH.CPP */
/*=========================================================================*/
void Unfragment_File_Cache(void);
BOOL cdecl Make_File_Resident(char const *filename);
short cdecl Flush_Unused_File_Cache(short flush_keeps);
BOOL cdecl Free_Resident_File(char const *file);
/*=========================================================================*/
/* The following prototypes are for the file: FILECHNG.CPP */
/*=========================================================================*/
short cdecl Create_File(char const *file_name);
short cdecl Delete_File(char const *file_name);
BOOL cdecl Change_File_Size(short handle, unsigned long new_size);
/*=========================================================================*/
/* The following prototypes are for the file: FILEINFO.CPP */
/*=========================================================================*/
short cdecl Get_DOS_Handle(short fh);
short cdecl Free_Handles(void);
short cdecl Find_Disk_Number(char const *file_name);
short cdecl Set_File_Flags(char const *filename, short flags);
short cdecl Clear_File_Flags(char const *filename, short flags);
short cdecl Get_File_Flags(char const *filename);
BOOL cdecl Multi_Drive_Search(BOOL on);
/*=========================================================================*/
/* The following prototypes are for the file: FINDFILE.CPP */
/*=========================================================================*/
short cdecl Find_File(char const *file_name);
short cdecl Find_File_Index(char const *filename);
/*=========================================================================*/
/* The following prototypes are for the file: FFIRST.ASM */
/*=========================================================================*/
#include <dos.h>
#ifdef __cplusplus
extern "C" {
#endif
extern short Find_First(unsigned char *fname, unsigned short mode, struct find_t *ffblk);
extern short Find_Next(struct find_t *ffblk);
#ifdef __cplusplus
}
#endif
#endif // FILE_H


View File

@@ -0,0 +1,60 @@
/*
** Command & Conquer Red Alert(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/***************************************************************************
** C O N F I D E N T I A L --- W E S T W O O D A S S O C I A T E S **
***************************************************************************
* *
* Project Name : Temp header for file routines. *
* *
* File Name : FILETEMP.H *
* *
* Programmer : Scott K. Bowen *
* *
* Start Date : April 20, 1994 *
* *
* Last Update : April 20, 1994 [SKB] *
* *
*-------------------------------------------------------------------------*
* Functions: *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
#ifndef FILETEMP_H
#define FILETEMP_H
/////////////////////////////////////////////////////////////////////
// THIS DOES NOT BELONG HERE. IT WAS PUT HERE JUST TO GET THE THING
// TO COMPILE. ONCE THE BUFFER AND PAGE SYSTEMS ARE PUT IN, THESE
// WILL NEED TO BE TAKEN OUT AND MODS MADE TO ANY FUNCTION USING BuffType.
// SKB 4/20/94.
/*=========================================================================*/
/* Defines and such that must go into wwstd.h */
/*=========================================================================*/
// Look at FileErrorType below for the IO_Error function.
//extern WORD cdecl (*cdecl IO_Error)(FileErrorType error, BYTE const *filename);
VOID cdecl Prog_End(VOID);
extern WORD Hard_Error_Occured;
//////////////////////// END OF DON'T BELONG //////////////////////////////////
#endif //FILETEMP_H

122
VQ/INCLUDE/WWLIB32/FONT.H Normal file
View File

@@ -0,0 +1,122 @@
/*
** Command & Conquer Red Alert(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/***************************************************************************
** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S **
***************************************************************************
* *
* Project Name : Font and text print 32 bit library *
* *
* File Name : FONT.H *
* *
* Programmer : Scott K. Bowen *
* *
* Start Date : June 27, 1994 *
* *
* Last Update : June 29, 1994 [SKB] *
* *
*-------------------------------------------------------------------------*
* Functions: *
* VVPC::Text_Print -- Text print into a virtual viewport. *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
#ifndef FONT_H
#define FONT_H
#ifndef GBUFFER_H
#include <gbuffer.h>
#endif
#ifndef VBUFFER_H
#include <vbuffer.h>
#endif
//////////////////////////////////////// Defines //////////////////////////////////////////
// defines for font header, offsets to block offsets
#define FONTINFOBLOCK 4
#define FONTOFFSETBLOCK 6
#define FONTWIDTHBLOCK 8
#define FONTDATABLOCK 10
#define FONTHEIGHTBLOCK 12
// defines for font info block
#define FONTINFOMAXHEIGHT 4
#define FONTINFOMAXWIDTH 5
//////////////////////////////////////// Prototypes //////////////////////////////////////////
/*=========================================================================*/
/* The following prototypes are for the file: SET_FONT.CPP */
/*=========================================================================*/
VOID *cdecl Set_Font(VOID const *fontptr);
/*=========================================================================*/
/* The following prototypes are for the file: FONT.CPP */
/*=========================================================================*/
WORD cdecl Char_Pixel_Width(BYTE chr);
UWORD cdecl String_Pixel_Width(BYTE const *string);
VOID cdecl Get_Next_Text_Print_XY(GraphicViewPortClass& vp, ULONG offset, INT *x, INT *y);
VOID cdecl Get_Next_Text_Print_XY(VideoViewPortClass& vp, ULONG offset, INT *x, INT *y);
/*=========================================================================*/
/* The following prototypes are for the file: LOADFONT.CPP */
/*=========================================================================*/
VOID *cdecl Load_Font(BYTE const *name);
/*=========================================================================*/
/* The following prototypes are for the file: TEXTPRNT.ASM */
/*=========================================================================*/
#ifdef __cplusplus
extern "C" {
#endif
VOID Set_Font_Palette_Range(VOID *palette, INT start_idx, INT end_idx);
#ifdef __cplusplus
}
#endif
/*=========================================================================*/
//////////////////////////////////////// External varables ///////////////////////////////////////
extern "C" int FontXSpacing;
extern "C" int FontYSpacing;
extern BYTE FontWidth ;
extern BYTE FontHeight;
extern BYTE *FontWidthBlockPtr;
extern "C" VOID const *FontPtr;
#endif // FONT_H

View File

@@ -0,0 +1,47 @@
/*
** 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/>.
*/
/*=========================================================================*/
/* The following prototypes are for the file: SOUNDIO.CPP */
/*=========================================================================*/
short Decompress_Frame(void * source, void * dest, short size);
int cdecl Stream_Sample_Vol(void *buffer, long size, BOOL (*callback);
int cdecl Stream_Sample(void *buffer, long size, BOOL (*callback);
int cdecl File_Stream_Sample(char const *filename);
int cdecl File_Stream_Sample_Vol(char const *filename, int volume);
void cdecl _saveregs _loadds Sound_Callback(void);
void cdecl far _saveregs _loadds maintenance_callback(void);
void *cdecl Load_Sample(char const *filename);
long cdecl Load_Sample_Into_Buffer(char const *filename, void *buffer, long size);
long cdecl Sample_Read(int fh, void *buffer, long size);
void cdecl Free_Sample(void const *sample);
BOOL cdecl Sound_Init(int sfx, int score, int sample);
void far VQA_TimerCallback(void);
BOOL Audio_Init(int sample, int address, int inter, int dma);
void cdecl Sound_End(void);
void cdecl Stop_Sample(int handle);
BOOL cdecl Sample_Status(int handle);
BOOL cdecl Is_Sample_Playing(void const * sample);
void cdecl Stop_Sample_Playing(void const * sample);
int cdecl Play_Sample(void const *sample);
int cdecl Play_Sample_Vol(void const *sample, int priority, int volume);
int cdecl Set_Sound_Vol(int volume);
int cdecl Set_Score_Vol(int volume);
void cdecl Fade_Sample(int handle, int ticks);

View File

@@ -0,0 +1,866 @@
/*
** Command & Conquer Red Alert(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/***************************************************************************
** C O N F I D E N T I A L --- W E S T W O O D A S S O C I A T E S **
***************************************************************************
* *
* Project Name : Westwood 32 Bit Library *
* *
* File Name : GBUFFER.H *
* *
* Programmer : Phil W. Gorrow *
* *
* Start Date : May 26, 1994 *
* *
* Last Update : January 17, 1995 [PWG] *
* *
***************************************************************************
* *
* This module contains the definition for the graphic buffer class. The *
* primary functionality of the graphic buffer class is handled by inline *
* functions that make a call through function pointers to the correct *
* routine. This has two benefits: *
* *
* *
* 1) C++ name mangling is not a big deal since the function pointers *
* point to functions in standard C format. *
* 2) The function pointers can be changed when we set a different *
* graphic mode. This allows us to have both supervga and mcga *
* routines present in memory at once. *
* *
* In the basic library, these functions point to stub routines which just *
* return. This makes a product that just uses a graphic buffer take the *
* minimum amount of code space. For programs that require MCGA or VESA *
* support, all that is necessary to do is link either the MCGA or VESA *
* specific libraries in, previous to WWLIB32. The linker will then *
* overide the the necessary stub functions automatically. *
* *
* In addition, there are helpful inline function calls for parameter *
* ellimination. This header file gives the defintion for all *
* GraphicViewPort and GraphicBuffer classes. *
* *
* Terminology: *
* *
* Buffer Class - A class which consists of a pointer to an allocated *
* buffer and the size of the buffer that was allocated. *
* *
* Graphic ViewPort - The Graphic ViewPort defines a window into a *
* Graphic Buffer. This means that although a Graphic Buffer *
* represents linear memory, this may not be true with a Graphic *
* Viewport. All low level functions that act directly on a graphic *
* viewport are included within this class. This includes but is not *
* limited to most of the functions which can act on a Video Viewport *
* Video Buffer. *
* *
* Graphic Buffer - A Graphic Buffer is an instance of an allocated buffer *
* used to represent a rectangular region of graphics memory. *
* The HidBuff and BackBuff are excellent examples of a Graphic Buffer. *
* *
* Below is a tree which shows the relationship of the VideoBuffer and *
* Buffer classes to the GraphicBuffer class: *
* *
* BUFFER.H GBUFFER.H BUFFER.H VBUFFER.H *
* ---------- ---------- ---------- ---------- *
* | Buffer | | Graphic | | Buffer | | Video | *
* | Class | | ViewPort | | Class | | ViewPort | *
* ---------- ---------- ---------- ---------- *
* \ / \ / *
* \ / \ / *
* ---------- ---------- *
* | Graphic | | Video | *
* | Buffer | | Buffer | *
* ---------- ---------- *
* GBUFFER.H VBUFFER.H *
*-------------------------------------------------------------------------*
* Functions: *
* GBC::GraphicBufferClass -- inline constructor for GraphicBufferClass *
* GVPC::Remap -- Short form to remap an entire graphic view port *
* GVPC::Get_XPos -- Returns x offset for a graphic viewport class *
* GVPC::Get_Ypos -- Return y offset in a GraphicViewPortClass *
* VVPC::Get_XPos -- Get the x pos of the VP on the Video *
* VVPC::Get_YPos -- Get the y pos of the VP on the video *
* GBC::Get_Graphic_Buffer -- Get the graphic buffer of the VP. *
* GVPC::Draw_Line -- Stub function to draw line in Graphic Viewport Class*
* GVPC::Fill_Rect -- Stub function to fill rectangle in a GVPC *
* GVPC::Remap -- Stub function to remap a GVPC *
* GVPC::Print -- stub func to print a text string *
* GVPC::Print -- Stub function to print an integer *
* GVPC::Print -- Stub function to print a short to a graphic viewport *
* GVPC::Print -- stub function to print a long on a graphic view port *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
#ifndef GBUFFER_H
#define GBUFFER_H
/*=========================================================================*/
/* If we have not already loaded the standard library header, than we can */
/* load it. */
/*=========================================================================*/
#ifndef WWSTD_H
#include "wwstd.h"
#endif
#ifndef MCGAPRIM_H
#include "mcgaprim.h"
#endif
#ifndef BUFFER_H
#include "buffer.h"
#endif
#include <stdlib.h>
/*=========================================================================*/
/* Define the screen width and height to make portability to other modules */
/* easier. */
/*=========================================================================*/
#define DEFAULT_SCREEN_WIDTH 320
#define DEFAULT_SCREEN_HEIGHT 200
/*=========================================================================*/
/* Let the compiler know that a GraphicBufferClass exists so that it can */
/* keep a pointer to it in a VideoViewPortClass. */
/*=========================================================================*/
class GraphicViewPortClass;
class GraphicBufferClass;
class VideoViewPortClass;
class VideoBufferClass;
GraphicBufferClass *Set_Logic_Page(GraphicBufferClass *ptr);
GraphicBufferClass *Set_Logic_Page(GraphicBufferClass &ptr);
/*=========================================================================*/
/* GraphicViewPortClass - Holds viewport information on a viewport which */
/* has been attached to a GraphicBuffer. A viewport is effectively a */
/* rectangular subset of the full buffer which is used for clipping and */
/* the like. */
/* */
/* char *Buffer - is the offset to view port buffer */
/* int Width - is the width of view port */
/* int Height - is the height of view port */
/* int XAdd - is add value to go from the end of a line */
/* to the beginning of the next line */
/* int XPos; - x offset into its associated VideoBuffer */
/* int YPos; - y offset into its associated VideoBuffer */
/*=========================================================================*/
class GraphicViewPortClass {
public:
/*===================================================================*/
/* Define the base constructor and destructors for the class */
/*===================================================================*/
GraphicViewPortClass(GraphicBufferClass* graphic_buff, int x, int y, int w, int h);
GraphicViewPortClass();
~GraphicViewPortClass();
/*===================================================================*/
/* define functions to get at the private data members */
/*===================================================================*/
long Get_Offset(void);
int Get_Height(void);
int Get_Width(void);
int Get_XAdd(void);
int Get_XPos(void);
int Get_YPos(void);
GraphicBufferClass *Get_Graphic_Buffer(void);
/*===================================================================*/
/* Define a function which allows us to change a video viewport on */
/* the fly. */
/*===================================================================*/
BOOL Change(int x, int y, int w, int h);
/*===================================================================*/
/* Define the set of common graphic functions that are supported by */
/* both Graphic ViewPorts and VideoViewPorts. */
/*===================================================================*/
long Size_Of_Region(int w, int h);
void Put_Pixel(int x, int y, unsigned char color);
int Get_Pixel(int x, int y);
void Clear(unsigned char color = 0);
long To_Buffer(int x, int y, int w, int h, void *buff, long size);
long To_Buffer(int x, int y, int w, int h, BufferClass *buff);
long To_Buffer(BufferClass *buff);
BOOL Blit( GraphicViewPortClass& dest, int x_pixel, int y_pixel, int dx_pixel,
int dy_pixel, int pixel_width, int pixel_height, BOOL trans = FALSE);
BOOL Blit( GraphicViewPortClass& dest, int dx, int dy, BOOL trans = FALSE);
BOOL Blit( GraphicViewPortClass& dest, BOOL trans = FALSE);
BOOL Blit( VideoViewPortClass& dest, int x_pixel, int y_pixel, int dx_pixel,
int dy_pixel, int pixel_width, int pixel_height, BOOL trans = FALSE);
BOOL Blit( VideoViewPortClass& dest, int dx, int dy, BOOL trans = FALSE);
BOOL Blit( VideoViewPortClass& dest, BOOL trans = FALSE);
BOOL Scale( GraphicViewPortClass &dest, int src_x, int src_y, int dst_x,
int dst_y, int src_w, int src_h, int dst_w, int dst_h, BOOL trans = FALSE, char *remap = NULL);
BOOL Scale( GraphicViewPortClass &dest, int src_x, int src_y, int dst_x,
int dst_y, int src_w, int src_h, int dst_w, int dst_h, char *remap);
BOOL Scale( GraphicViewPortClass &dest, BOOL trans = FALSE, char *remap = NULL);
BOOL Scale( GraphicViewPortClass &dest, char *remap);
BOOL Scale( VideoViewPortClass &dest, int src_x, int src_y, int dst_x,
int dst_y, int src_w, int src_h, int dst_w, int dst_h, BOOL trans = FALSE, char *remap = NULL);
BOOL Scale( VideoViewPortClass &dest, int src_x, int src_y, int dst_x,
int dst_y, int src_w, int src_h, int dst_w, int dst_h, char *remap);
BOOL Scale( VideoViewPortClass &dest, BOOL trans = FALSE, char *remap = NULL);
BOOL Scale( VideoViewPortClass &dest, char *remap);
unsigned long Print(char const *string, int x_pixel, int y_pixel, int fcolor, int bcolor);
unsigned long Print(short num, int x_pixel, int y_pixel, int fcol, int bcol);
unsigned long Print(int num, int x_pixel, int y_pixel, int fcol, int bcol);
unsigned long Print(long num, int x_pixel, int y_pixel, int fcol, int bcol);
/*===================================================================*/
/* Define the list of graphic functions which work only with a */
/* graphic buffer. */
/*===================================================================*/
VOID Draw_Line(int sx, int sy, int dx, int dy, unsigned char color);
VOID Draw_Rect(int sx, int sy, int dx, int dy, unsigned char color);
VOID Fill_Rect(int sx, int sy, int dx, int dy, unsigned char color);
VOID Fill_Quad(VOID *span_buff, int x0, int y0, int x1, int y1,
int x2, int y2, int x3, int y3, int color);
VOID Remap(int sx, int sy, int width, int height, VOID *remap);
VOID Remap(VOID *remap);
void Draw_Stamp(void const *icondata, int icon, int x_pixel, int y_pixel, void const *remap);
VOID Grey_Out_Region(int x, int y, int width, int height, int color);
protected:
/*===================================================================*/
/* Define functions to attach the viewport to a graphicbuffer */
/*===================================================================*/
VOID Attach(GraphicBufferClass *graphic_buff, int x, int y, int w, int h);
void Attach(GraphicBufferClass *video_buff, int w, int h);
/*===================================================================*/
/* Define the data used by a GraphicViewPortClass */
/*===================================================================*/
long Offset; // offset to graphic page
int Width; // width of graphic page
int Height; // height of graphic page
int XAdd; // xadd for graphic page (0)
int XPos; // x offset in relation to graphicbuff
int YPos; // y offset in relation to graphicbuff
GraphicBufferClass *GraphicBuff; // related graphic buff
};
/*=========================================================================*/
/* GraphicBufferClass - A GraphicBuffer refers to an actual instance of an */
/* allocated buffer. The GraphicBuffer may be drawn to directly */
/* becuase it inherits a ViewPort which represents its physcial size. */
/* */
/* BYTE *Buffer - is the offset to graphic buffer */
/* int Width - is the width of graphic buffer */
/* int Height - is the height of graphic buffer */
/* int XAdd - is the xadd of graphic buffer */
/* int XPos; - will be 0 because it is graphicbuff */
/* int YPos; - will be 0 because it is graphicbuff */
/*=========================================================================*/
class GraphicBufferClass : public GraphicViewPortClass, public BufferClass {
public:
GraphicBufferClass( long size = 64500, int w = DEFAULT_SCREEN_WIDTH, int h = DEFAULT_SCREEN_HEIGHT,
VOID *buffer = 0);
GraphicBufferClass(int w, int h, void *buffer = 0);
~GraphicBufferClass();
};
/***************************************************************************
* GVPC::GET_OFFSET -- Get offset for virtual view port class instance *
* *
* INPUT: none *
* *
* OUTPUT: long the offset for the virtual viewport instance *
* *
* HISTORY: *
* 06/07/1994 PWG : Created. *
*=========================================================================*/
inline long GraphicViewPortClass::Get_Offset(void)
{
return(Offset);
}
/***************************************************************************
* GVPC::GET_HEIGHT -- Gets the height of a virtual viewport instance *
* *
* INPUT: none *
* *
* OUTPUT: WORD the height of the virtual viewport instance *
* *
* HISTORY: *
* 06/07/1994 PWG : Created. *
*=========================================================================*/
inline int GraphicViewPortClass::Get_Height(void)
{
return(Height);
}
/***************************************************************************
* GVPC::GET_WIDTH -- Get the width of a virtual viewport instance *
* *
* INPUT: none *
* *
* OUTPUT: WORD the width of the virtual viewport instance *
* *
* HISTORY: *
* 06/07/1994 PWG : Created. *
*=========================================================================*/
inline int GraphicViewPortClass::Get_Width(void)
{
return(Width);
}
/***************************************************************************
* GVPC::GET_XADD -- Get the X add offset for virtual viewport instance *
* *
* INPUT: none *
* *
* OUTPUT: WORD the xadd for a virtual viewport instance *
* *
* HISTORY: *
* 06/07/1994 PWG : Created. *
*=========================================================================*/
inline int GraphicViewPortClass::Get_XAdd(void)
{
return(XAdd);
}
/***************************************************************************
* GVPC::GET_XPOS -- Get the x pos of the VP on the Video *
* *
* INPUT: none *
* *
* OUTPUT: WORD the x offset to VideoBufferClass *
* *
* HISTORY: *
;* 08/22/1994 SKB : Created. *
*=========================================================================*/
inline int GraphicViewPortClass::Get_XPos(void)
{
return(XPos);
}
/***************************************************************************
* GVPC::GET_YPOS -- Get the y pos of the VP on the video *
* *
* INPUT: none *
* *
* OUTPUT: WORD the x offset to VideoBufferClass *
* *
* WARNINGS: *
* *
* HISTORY: *
;* 08/22/1994 SKB : Created. *
*=========================================================================*/
inline int GraphicViewPortClass::Get_YPos(void)
{
return(YPos);
}
/***************************************************************************
* GVPC::GET_GRAPHIC_BUFFER -- Get the graphic buffer of the VP. *
* *
* INPUT: *
* *
* OUTPUT: *
* *
* HISTORY: *
* 08/22/1994 SKB : Created. *
*=========================================================================*/
inline GraphicBufferClass *GraphicViewPortClass::Get_Graphic_Buffer(void)
{
return (GraphicBuff);
}
/***************************************************************************
* GVPC::SIZE_OF_REGION -- stub to call curr graphic mode Size_Of_Region *
* *
* INPUT: *
* *
* OUTPUT: *
* *
* WARNINGS: *
* *
* HISTORY: *
* 03/01/1995 BWG : Created. *
*=========================================================================*/
inline long GraphicViewPortClass::Size_Of_Region(int w, int h)
{
return MCGA_Size_Of_Region(this, w, h);
}
/***************************************************************************
* GVPC::PUT_PIXEL -- stub to call curr graphic mode Put_Pixel *
* *
* INPUT: *
* *
* OUTPUT: *
* *
* WARNINGS: *
* *
* HISTORY: *
* 01/06/1995 PWG : Created. *
*=========================================================================*/
inline void GraphicViewPortClass::Put_Pixel(int x, int y, unsigned char color)
{
MCGA_Put_Pixel(this, x, y, color);
}
/***************************************************************************
* GVPC::GET_PIXEL -- stub to call curr graphic mode Get_Pixel *
* *
* INPUT: *
* *
* OUTPUT: *
* *
* WARNINGS: *
* *
* HISTORY: *
* 01/06/1995 PWG : Created. *
*=========================================================================*/
inline int GraphicViewPortClass::Get_Pixel(int x, int y)
{
return(MCGA_Get_Pixel(this, x, y));
}
/***************************************************************************
* GVPC::CLEAR -- stub to call curr graphic mode Clear *
* *
* INPUT: *
* *
* OUTPUT: *
* *
* WARNINGS: *
* *
* HISTORY: *
* 01/06/1995 PWG : Created. *
*=========================================================================*/
inline void GraphicViewPortClass::Clear(unsigned char color)
{
MCGA_Clear(this, color);
}
/***************************************************************************
* GVPC::TO_BUFFER -- stub 1 to call curr graphic mode To_Buffer *
* *
* INPUT: *
* *
* OUTPUT: *
* *
* WARNINGS: *
* *
* HISTORY: *
* 01/06/1995 PWG : Created. *
*=========================================================================*/
inline long GraphicViewPortClass::To_Buffer(int x, int y, int w, int h, void *buff, long size)
{
return(MCGA_To_Buffer(this, x, y, w, h, buff, size));
}
/***************************************************************************
* GVPC::TO_BUFFER -- stub 2 to call curr graphic mode To_Buffer *
* *
* INPUT: *
* *
* OUTPUT: *
* *
* WARNINGS: *
* *
* HISTORY: *
* 01/06/1995 PWG : Created. *
*=========================================================================*/
inline long GraphicViewPortClass::To_Buffer(int x, int y, int w, int h, BufferClass *buff)
{
return(MCGA_To_Buffer(this, x, y, w, h, buff->Get_Buffer(), buff->Get_Size()));
}
/***************************************************************************
* GVPC::TO_BUFFER -- stub 3 to call curr graphic mode To_Buffer *
* *
* INPUT: *
* *
* OUTPUT: *
* *
* WARNINGS: *
* *
* HISTORY: *
* 01/06/1995 PWG : Created. *
*=========================================================================*/
inline long GraphicViewPortClass::To_Buffer(BufferClass *buff)
{
return(MCGA_To_Buffer(this, 0, 0, Width, Height, buff->Get_Buffer(), buff->Get_Size()));
}
/***************************************************************************
* GVPC::BLIT -- stub 1 to call curr graphic mode Blit to GVPC *
* *
* INPUT: *
* *
* OUTPUT: *
* *
* WARNINGS: *
* *
* HISTORY: *
* 01/06/1995 PWG : Created. *
*=========================================================================*/
inline BOOL GraphicViewPortClass::Blit( GraphicViewPortClass& dest, int x_pixel, int y_pixel, int dx_pixel,
int dy_pixel, int pixel_width, int pixel_height, BOOL trans)
{
return(Linear_Blit_To_Linear(this, &dest, x_pixel, y_pixel, dx_pixel, dy_pixel, pixel_width, pixel_height, trans));
}
/***************************************************************************
* GVPC::BLIT -- Stub 2 to call curr graphic mode Blit to GVPC *
* *
* INPUT: *
* *
* OUTPUT: *
* *
* WARNINGS: *
* *
* HISTORY: *
* 01/06/1995 PWG : Created. *
*=========================================================================*/
inline BOOL GraphicViewPortClass::Blit( GraphicViewPortClass& dest, int dx, int dy, BOOL trans)
{
return(Linear_Blit_To_Linear(this, &dest, 0, 0, dx, dy, Width, Height, trans));
}
/***************************************************************************
* GVPC::BLIT -- stub 3 to call curr graphic mode Blit to GVPC *
* *
* INPUT: *
* *
* OUTPUT: *
* *
* WARNINGS: *
* *
* HISTORY: *
* 01/06/1995 PWG : Created. *
*=========================================================================*/
inline BOOL GraphicViewPortClass::Blit( GraphicViewPortClass& dest, BOOL trans)
{
return(Linear_Blit_To_Linear(this, &dest, 0, 0, 0, 0, Width, Height, trans));
}
/***************************************************************************
* GVPC::SCALE -- stub 1 to call curr graphic mode Scale to GVPC *
* *
* INPUT: *
* *
* OUTPUT: *
* *
* WARNINGS: *
* *
* HISTORY: *
* 01/06/1995 PWG : Created. *
*=========================================================================*/
inline BOOL GraphicViewPortClass::Scale( GraphicViewPortClass &dest, int src_x, int src_y, int dst_x,
int dst_y, int src_w, int src_h, int dst_w, int dst_h, BOOL trans, char *remap)
{
return(Linear_Scale_To_Linear(this, &dest, src_x, src_y, dst_x, dst_y, src_w, src_h, dst_w, dst_h, trans, remap));
}
/***************************************************************************
* GVPC::SCALE -- stub 2 to call curr graphic mode Scale to GVPC *
* *
* INPUT: *
* *
* OUTPUT: *
* *
* WARNINGS: *
* *
* HISTORY: *
* 01/06/1995 PWG : Created. *
*=========================================================================*/
inline BOOL GraphicViewPortClass::Scale( GraphicViewPortClass &dest, int src_x, int src_y, int dst_x,
int dst_y, int src_w, int src_h, int dst_w, int dst_h, char *remap)
{
return(Linear_Scale_To_Linear(this, &dest, src_x, src_y, dst_x, dst_y, src_w, src_h, dst_w, dst_h, FALSE, remap));
}
/***************************************************************************
* GVPC::SCALE -- stub 3 to call curr graphic mode Scale to GVPC *
* *
* INPUT: *
* *
* OUTPUT: *
* *
* WARNINGS: *
* *
* HISTORY: *
* 01/06/1995 PWG : Created. *
*=========================================================================*/
inline BOOL GraphicViewPortClass::Scale( GraphicViewPortClass &dest, BOOL trans, char *remap)
{
return(Linear_Scale_To_Linear(this, &dest, 0, 0, 0, 0, Width, Height, dest.Get_Width(), dest.Get_Height(), trans, remap));
}
/***************************************************************************
* GVPC::SCALE -- stub 4 to call curr graphic mode Scale to GVPC *
* *
* INPUT: *
* *
* OUTPUT: *
* *
* WARNINGS: *
* *
* HISTORY: *
* 01/06/1995 PWG : Created. *
*=========================================================================*/
inline BOOL GraphicViewPortClass::Scale( GraphicViewPortClass &dest, char *remap)
{
return(Linear_Scale_To_Linear(this, &dest, 0, 0, 0, 0, Width, Height, dest.Get_Width(), dest.Get_Height(), FALSE, remap));
}
/***************************************************************************
* GVPC::PRINT -- stub func to print a text string *
* *
* INPUT: *
* *
* OUTPUT: *
* *
* WARNINGS: *
* *
* HISTORY: *
* 01/17/1995 PWG : Created. *
*=========================================================================*/
inline unsigned long GraphicViewPortClass::Print(char const *str, int x, int y, int fcol, int bcol)
{
return(MCGA_Print(this, str, x, y, fcol, bcol));
}
/***************************************************************************
* GVPC::PRINT -- Stub function to print an integer *
* *
* INPUT: *
* *
* OUTPUT: *
* *
* WARNINGS: *
* *
* HISTORY: *
*=========================================================================*/
inline unsigned long GraphicViewPortClass::Print(int num, int x, int y, int fcol, int bcol)
{
char str[17];
return(MCGA_Print(this, itoa(num, str, 10), x, y, fcol, bcol));
}
/***************************************************************************
* GVPC::PRINT -- Stub function to print a short to a graphic viewport *
* *
* INPUT: *
* *
* OUTPUT: *
* *
* WARNINGS: *
* *
* HISTORY: *
*=========================================================================*/
inline unsigned long GraphicViewPortClass::Print(short num, int x, int y, int fcol, int bcol)
{
char str[17];
return(MCGA_Print(this, itoa(num, str, 10), x, y, fcol, bcol));
}
/***************************************************************************
* GVPC::PRINT -- stub function to print a long on a graphic view port *
* *
* INPUT: *
* *
* OUTPUT: *
* *
* WARNINGS: *
* *
* HISTORY: *
*=========================================================================*/
inline unsigned long GraphicViewPortClass::Print(long num, int x, int y, int fcol, int bcol)
{
char str[33];
return(MCGA_Print(this, ltoa(num, str,10), x, y, fcol, bcol));
}
/***************************************************************************
* GVPC::DRAW_STAMP -- stub function to draw a tile on a graphic view port *
* *
* INPUT: *
* *
* OUTPUT: *
* *
* WARNINGS: *
* *
* HISTORY: *
*=========================================================================*/
inline void GraphicViewPortClass::Draw_Stamp(void const *icondata, int icon, int x_pixel, int y_pixel, void const *remap)
{
MCGA_Draw_Stamp(this, icondata, icon, x_pixel, y_pixel, remap);
}
/***************************************************************************
* GVPC::DRAW_LINE -- Stub function to draw line in Graphic Viewport Class *
* *
* INPUT: *
* *
* OUTPUT: *
* *
* WARNINGS: *
* *
* HISTORY: *
* 01/16/1995 PWG : Created. *
*=========================================================================*/
inline VOID GraphicViewPortClass::Draw_Line(int sx, int sy, int dx, int dy, unsigned char color)
{
MCGA_Draw_Line(this, sx, sy, dx, dy, color);
}
/***************************************************************************
* GVPC::FILL_RECT -- Stub function to fill rectangle in a GVPC *
* *
* INPUT: *
* *
* OUTPUT: *
* *
* WARNINGS: *
* *
* HISTORY: *
* 01/16/1995 PWG : Created. *
*=========================================================================*/
inline VOID GraphicViewPortClass::Fill_Rect(int sx, int sy, int dx, int dy, unsigned char color)
{
MCGA_Fill_Rect(this, sx, sy, dx, dy, color);
}
/***************************************************************************
* GVPC::REMAP -- Stub function to remap a GVPC *
* *
* INPUT: *
* *
* OUTPUT: *
* *
* WARNINGS: *
* *
* HISTORY: *
* 01/16/1995 PWG : Created. *
*=========================================================================*/
inline VOID GraphicViewPortClass::Remap(int sx, int sy, int width, int height, VOID *remap)
{
MCGA_Remap(this, sx, sy, width, height, remap);
}
inline VOID GraphicViewPortClass::Fill_Quad(VOID *span_buff, int x0, int y0, int x1, int y1,
int x2, int y2, int x3, int y3, int color)
{
MCGA_Fill_Quad(this, span_buff, x0, y0, x1, y1, x2, y2, x3, y3, color);
}
/***************************************************************************
* GVPC::REMAP -- Short form to remap an entire graphic view port *
* *
* INPUT: BYTE * to the remap table to use *
* *
* OUTPUT: none *
* *
* HISTORY: *
* 07/01/1994 PWG : Created. *
*=========================================================================*/
inline VOID GraphicViewPortClass::Remap(VOID *remap)
{
MCGA_Remap(this, 0, 0, Width, Height, remap);
}
/*=========================================================================*/
/* The following BufferClass functions are defined here because they act */
/* on graphic viewports. */
/*=========================================================================*/
/***************************************************************************
* BUFFER_TO_PAGE -- Generic 'c' callable form of Buffer_To_Page *
* *
* INPUT: *
* *
* OUTPUT: *
* *
* WARNINGS: *
* *
* HISTORY: *
* 01/12/1995 PWG : Created. *
*=========================================================================*/
inline long Buffer_To_Page(int x, int y, int w, int h, void *Buffer, GraphicViewPortClass &view)
{
return(MCGA_Buffer_To_Page(x, y, w, h, Buffer, &view));
}
/***************************************************************************
* BC::TO_PAGE -- Copys a buffer class to a page with definable w, h *
* *
* INPUT: int width - the width of copy region *
* int height - the height of copy region *
* GVPC& dest - virtual viewport to copy to *
* *
* OUTPUT: none *
* *
* WARNINGS: x and y position are the upper left corner of the dest *
* viewport *
* *
* HISTORY: *
* 07/01/1994 PWG : Created. *
*=========================================================================*/
inline long BufferClass::To_Page(int w, int h, GraphicViewPortClass &view)
{
return(MCGA_Buffer_To_Page(0, 0, w, h, Buffer, &view));
}
/***************************************************************************
* BC::TO_PAGE -- Copys a buffer class to a page with definable w, h *
* *
* INPUT: GVPC& dest - virtual viewport to copy to *
* *
* OUTPUT: none *
* *
* WARNINGS: x and y position are the upper left corner of the dest *
* viewport. width and height are assumed to be the *
* viewport's width and height. *
* *
* HISTORY: *
* 07/01/1994 PWG : Created. *
*=========================================================================*/
inline long BufferClass::To_Page(GraphicViewPortClass &view)
{
return(MCGA_Buffer_To_Page(0, 0, view.Get_Width(), view.Get_Height(), Buffer, &view));
}
/***************************************************************************
* BC::TO_PAGE -- Copys a buffer class to a page with definable x, y, w, h *
* *
* INPUT: int x - x pixel on viewport to copy from *
* int y - y pixel on viewport to copy from *
* int width - the width of copy region *
* int height - the height of copy region *
* GVPC& dest - virtual viewport to copy to *
* *
* OUTPUT: none *
* *
* HISTORY: *
* 07/01/1994 PWG : Created. *
*=========================================================================*/
inline long BufferClass::To_Page(int x, int y, int w, int h, GraphicViewPortClass &view)
{
return(MCGA_Buffer_To_Page(x, y, w, h, Buffer, &view));
}
#endif

View File

@@ -0,0 +1,60 @@
;
; Command & Conquer Red Alert(tm)
; Copyright 2025 Electronic Arts Inc.
;
; This program is free software: you can redistribute it and/or modify
; it under the terms of the GNU General Public License as published by
; the Free Software Foundation, either version 3 of the License, or
; (at your option) any later version.
;
; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details.
;
; You should have received a copy of the GNU General Public License
; along with this program. If not, see <http://www.gnu.org/licenses/>.
;
;***************************************************************************
;** C O N F I D E N T I A L --- W E S T W O O D A S S O C I A T E S **
;***************************************************************************
;* *
;* Project Name : Westwood 32 Bit Library *
;* *
;* File Name : GBUFFER.INC *
;* *
;* Programmer : Phil W. Gorrow *
;* *
;* Start Date : May 26, 1994 *
;* *
;* Last Update : May 26, 1994 [PWG] *
;* *
;* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *
;******************************************************************************
; Much testing was done to determine that only when there are 14 or more bytes
; being copied does it speed the time it takes to do copies in this algorithm.
; For this reason and because 1 and 2 byte copies crash, is the special case
; used. SKB 4/21/94. Tested on 486 66mhz. Copied by PWG 6/7/04.
OPTIMAL_BYTE_COPY equ 14
STRUC GraphicViewPort
GVPOffset DD ? ; offset to virtual viewport
GVPWidth DD ? ; width of virtual viewport
GVPHeight DD ? ; height of virtual viewport
GVPXAdd DD ? ; x mod to get to next line
GVPXPos DD ? ; x pos relative to Graphic Buff
GVPYPos DD ? ; y pos relative to Graphic Buff
GVPBuffPtr DD ? ; ptr to associated Graphic Buff
ENDS
STRUC VideoViewPort
VIVPOffset DD ? ; offset to virtual viewport
VIVPWidth DD ? ; width of virtual viewport
VIVPHeight DD ? ; height of virtual viewport
VIVPXAdd DD ? ; x mod to get to next line
VIVPXPos DD ? ; x pos relative to Graphic Buff
VIVPYPos DD ? ; y pos relative to Graphic Buff
VIVPBuffPtr DD ? ; ptr to associated Graphic Buff
ENDS

168
VQ/INCLUDE/WWLIB32/IFF.H Normal file
View File

@@ -0,0 +1,168 @@
/*
** Command & Conquer Red Alert(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/***************************************************************************
** C O N F I D E N T I A L --- W E S T W O O D A S S O C I A T E S **
***************************************************************************
* *
* Project Name : Part of the FILEIO Library *
* *
* File Name : IFF.H *
* *
* Programmer : Scott K. Bowen *
* *
* Start Date : April 20, 1994 *
* *
* Last Update : April 20, 1994 [SKB] *
* *
*-------------------------------------------------------------------------*
* Functions: *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
#ifndef IFF_H
#define IFF_H
#ifndef MISC_H
#include <misc.h> // This is needed fro Reverse_WORD and _LONG
#endif
#ifndef MEMFLAG_H
#include <memflag.h> // This is needed for MemoryFlagType.
#endif
#ifndef GBUFFER_H
#include <gbuffer.h>
#endif
#define LZW_SUPPORTED FALSE
/*=========================================================================*/
/* Iff and Load Picture system defines and enumerations */
/*=========================================================================*/
#define MAKE_ID(a,b,c,d) ((LONG) ((LONG) d << 24) | ((LONG) c << 16) | ((LONG) b << 8) | (LONG)(a))
#define IFFize_WORD(a) Reverse_WORD(a)
#define IFFize_LONG(a) Reverse_LONG(a)
//lint -strong(AJX,PicturePlaneType)
typedef enum {
BM_AMIGA, // Bit plane format (8K per bitplane).
BM_MCGA, // Byte per pixel format (64K).
BM_DEFAULT=BM_MCGA // Default picture format.
} PicturePlaneType;
/*
** This is the compression type code. This value is used in the compressed
** file header to indicate the method of compression used. Note that the
** LZW method may not be supported.
*/
//lint -strong(AJX,CompressionType)
typedef enum {
NOCOMPRESS, // No compression (raw data).
LZW12, // LZW 12 bit codes.
LZW14, // LZW 14 bit codes.
HORIZONTAL, // Run length encoding (RLE).
LCW // Westwood proprietary compression.
} CompressionType;
/*
** Compressed blocks of data must start with this header structure.
** Note that disk based compressed files have an additional two
** leading bytes that indicate the size of the entire file.
*/
//lint -strong(AJX,CompHeaderType)
typedef struct {
BYTE Method; // Compression method (CompressionType).
BYTE pad; // Reserved pad byte (always 0).
LONG Size; // Size of the uncompressed data.
WORD Skip; // Number of bytes to skip before data.
} CompHeaderType;
/*=========================================================================*/
/* The following prototypes are for the file: IFF.CPP */
/*=========================================================================*/
WORD cdecl Open_Iff_File(BYTE const *filename);
VOID cdecl Close_Iff_File(WORD fh);
ULONG cdecl Get_Iff_Chunk_Size(WORD fh, LONG id);
ULONG cdecl Read_Iff_Chunk(WORD fh, LONG id, VOID *buffer, ULONG maxsize);
VOID cdecl Write_Iff_Chunk(WORD file, LONG id, VOID *buffer, LONG length);
/*=========================================================================*/
/* The following prototypes are for the file: LOADPICT.CPP */
/*=========================================================================*/
WORD cdecl Load_Picture(BYTE const *filename, BufferClass& scratchbuf, BufferClass& destbuf, UBYTE *palette=NULL, PicturePlaneType format=BM_DEFAULT);
/*=========================================================================*/
/* The following prototypes are for the file: LOAD.CPP */
/*=========================================================================*/
ULONG cdecl Load_Data(BYTE const *name, VOID *ptr, ULONG size);
ULONG cdecl Write_Data(BYTE const *name, VOID *ptr, ULONG size);
VOID * cdecl Load_Alloc_Data(BYTE const *name, MemoryFlagType flags);
ULONG cdecl Load_Uncompress(BYTE const *file, BufferClass& uncomp_buff, BufferClass& dest_buff, VOID *reserved_data=NULL);
ULONG cdecl Uncompress_Data(VOID const *src, VOID *dst);
VOID cdecl Set_Uncomp_Buffer(WORD buffer_segment, UWORD size_of_buffer);
/*=========================================================================*/
/* The following prototypes are for the file: WRITELBM.CPP */
/*=========================================================================*/
PUBLIC BOOL Write_LBM_File(WORD lbmhandle, BufferClass& buff, WORD bitplanes, UBYTE *palette);
/*========================= Assembly Functions ============================*/
#ifdef __cplusplus
extern "C" {
#endif
/*=========================================================================*/
/* The following prototypes are for the file: PACK2PLN.ASM */
/*=========================================================================*/
extern VOID Pack_2_Plane(VOID *buffer, VOID * pageptr, WORD planebit);
/*=========================================================================*/
/* The following prototypes are for the file: LCWCOMP.ASM */
/*=========================================================================*/
extern ULONG LCW_Compress(VOID *source, VOID *dest, ULONG length);
/*=========================================================================*/
/* The following prototypes are for the file: LCWUNCMP.ASM */
/*=========================================================================*/
extern ULONG LCW_Uncompress(VOID *source, VOID *dest, ULONG length);
#ifdef __cplusplus
}
#endif
/*=========================================================================*/
#endif //IFF_H


View File

@@ -0,0 +1,445 @@
/*
** Command & Conquer Red Alert(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/***************************************************************************
** C O N F I D E N T I A L --- W E S T W O O D A S S O C I A T E S **
***************************************************************************
* *
* Project Name : Westwood 32 bit Library *
* *
* File Name : KEYBOARD.H *
* *
* Programmer : Phil W. Gorrow *
* *
* Start Date : July 13, 1994 *
* *
* Last Update : July 13, 1994 [PWG] *
* *
*-------------------------------------------------------------------------*
* Functions: *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
#ifndef KEYBOARD_H
#define KEYBOARD_H
/*=========================================================================*/
/* If we have not already loaded the standard library header, than we can */
/* load it. */
/*=========================================================================*/
#ifndef WWSTD_H
#include "wwstd.h"
#endif
extern "C" {
void Install_Keyboard_Interrupt(void *addr, long size);
void *Get_RM_Keyboard_Address(void);
long Get_RM_Keyboard_Size(void);
void Remove_Keyboard_Interrupt(void);
int Check_Key_Num(void);
int Check_Key_Bits(void);
int Check_Key(void);
short Get_Key_Num(void);
short Get_Key_Bits(void);
int Get_Key(void);
int KN_To_KA(int keynum);
int Keyboard_Attributes_On(int key_flags);
int Keyboard_Attributes_Off(int key_flags);
void Clear_KeyBuffer(void);
int Key_Down(int key);
int Key_Satisfied(int key);
void Stuff_Key_WORD(int code);
void Stuff_Key_Num(int key);
void Install_Mouse(int max_width, int max_height, int scr_width, int scr_height);
void Reset_Mouse (void) ;
void Remove_Mouse(void);
int Get_Mouse_State(void);
int Get_Mouse_X(void);
int Get_Mouse_Y(void);
int Get_Mouse_Disabled(void);
void *Set_Mouse_Cursor(int xhotspot, int yhotspot, void *cursor);
void Hide_Mouse(void);
void Show_Mouse(void);
void Conditional_Hide_Mouse(int sx_pixel, int sy_pixel, int dx_pixel, int dy_pixel);
void Conditional_Show_Mouse(void);
void __interrupt far Keyboard_Interrupt(void);
extern int MouseQX;
extern int MouseQY;
}
enum {
REPEATON = 0x0001, /* 1:all makes into buffer, 0:only 1st make */
TRACKEXT = 0x0002, /* 1:Home != keypad Home, 0:Home=keypad Home */
FILTERONLY = 0x0004, /* 1:Normal BIOS operation with filter */
CTRLALTTURBO = 0x0010, /* 1:Allow turbo up and down in application */
NONUMLOCK = 0x0200, /* 1:do NOT remap keypad to numbers */
TASKSWITCHABLE = 0x400, /* 1:allows task switching keys thru ALT-TAB, */
/* ALT-ESC,CTRL-ESC */
PASSBREAKS = 0x0800, // Pass all breaks to the keyboard buffer.
/* The following flags, if turned on, should only be used for
debugging purposes (remember to take out the calls when BETA */
CTRLSON = 0x0008, /* 1:pass scroll lock sequence into BIOS */
CTRLCON = 0x0020, /* 1:pass stop code to BIOS */
SCROLLLOCKON = 0x0040, /* 1:pass scroll lock key into BIOS */
PAUSEON = 0x0080, /* 1:pass the pause key and seq to BIOS */
/* make sure FILTERONLY is set */
BREAKON = 0x0100, /* 1:pass the ctrl break seq to BIOS */
KEYMOUSE = 0x1000, /* 1:keypad translates into mouse moves */
SIMLBUTTON = 0x2000 /* 1:have space and enter keys simulate Left */
/* mouse button when KEYMOUSE is set */
};
/*
** These are the codes for the various key codes that are returned from the
** keyboard input routines Get_Key() and Input_ASCII().
*/
typedef enum {
KA_CTRL_AT = 0,
KA_CTRL_A,
KA_MORE = KA_CTRL_A,
KA_CTRL_B,
KA_SETBKGDCOL = KA_CTRL_B,
KA_CTRL_C,
KA_CTRL_D,
KA_CTRL_E,
KA_CTRL_F,
KA_SETFORECOL = KA_CTRL_F,
KA_CTRL_G,
KA_CTRL_H,
KA_BACKSPACE = KA_CTRL_H,
KA_CTRL_I,
KA_TAB = KA_CTRL_I,
KA_CTRL_J,
KA_CTRL_K,
KA_CTRL_L,
KA_FORMFEED = KA_CTRL_L,
KA_CTRL_M,
KA_RETURN = KA_CTRL_M,
KA_CTRL_N,
KA_CTRL_O,
KA_CTRL_P,
KA_CTRL_Q,
KA_CTRL_R,
KA_CTRL_S,
KA_SPCTAB = KA_CTRL_S,
KA_CTRL_T,
KA_CTRL_U,
KA_CTRL_V,
KA_CTRL_W,
KA_CTRL_X,
KA_SETX = KA_CTRL_X,
KA_CTRL_Y,
KA_SETY = KA_CTRL_Y,
KA_CTRL_Z,
KA_CTRL_LBRACKET,
KA_ESC = KA_CTRL_LBRACKET,
KA_EXTEND = KA_ESC,
KA_CTRL_BACKSLASH,
KA_CTRL_RBRACKET,
KA_LITERAL = KA_CTRL_RBRACKET,
KA_CTRL_CARROT,
KA_CTRL_UNDERLINE,
KA_SPACE, /* */
KA_EXCLAMATION, /* ! */
KA_DQUOTE, /* " */
KA_POUND, /* # */
KA_DOLLAR, /* $ */
KA_PERCENT, /* % */
KA_AMPER, /* & */
KA_SQUOTE, /* ' */
KA_LPAREN, /* ( */
KA_RPAREN, /* ) */
KA_ASTERISK, /* * */
KA_PLUS, /* + */
KA_COMMA, /* , */
KA_MINUS, /* - */
KA_PERIOD, /* . */
KA_SLASH, /* / */
KA_0, KA_1, KA_2, KA_3, KA_4, KA_5, KA_6, KA_7, KA_8, KA_9,
KA_COLON, /* : */
KA_SEMICOLON, /* ; */
KA_LESS_THAN, /* < */
KA_EQUAL, /* = */
KA_GREATER_THAN, /* > */
KA_QUESTION, /* ? */
KA_AT, /* @ */
KA_A, /* A */
KA_B, /* B */
KA_C, /* C */
KA_D, /* D */
KA_E, /* E */
KA_F, /* F */
KA_G, /* G */
KA_H, /* H */
KA_I, /* I */
KA_J, /* J */
KA_K, /* K */
KA_L, /* L */
KA_M, /* M */
KA_N, /* N */
KA_O, /* O */
KA_P, /* P */
KA_Q, /* Q */
KA_R, /* R */
KA_S, /* S */
KA_T, /* T */
KA_U, /* U */
KA_V, /* V */
KA_W, /* W */
KA_X, /* X */
KA_Y, /* Y */
KA_Z, /* Z */
KA_LBRACKET, /* [ */
KA_BACKSLASH, /* \ */
KA_RBRACKET, /* ] */
KA_CARROT, /* ^ */
KA_UNDERLINE, /* _ */
KA_GRAVE, /* ` */
KA_a, /* a */
KA_b, /* b */
KA_c, /* c */
KA_d, /* d */
KA_e, /* e */
KA_f, /* f */
KA_g, /* g */
KA_h, /* h */
KA_i, /* i */
KA_j, /* j */
KA_k, /* k */
KA_l, /* l */
KA_m, /* m */
KA_n, /* n */
KA_o, /* o */
KA_p, /* p */
KA_q, /* q */
KA_r, /* r */
KA_s, /* s */
KA_t, /* t */
KA_u, /* u */
KA_v, /* v */
KA_w, /* w */
KA_x, /* x */
KA_y, /* y */
KA_z, /* z */
KA_LBRACE, /* { */
KA_BAR, /* | */
KA_RBRACE, /* ] */
KA_TILDA, /* ~ */
KA_DEL, /* not used */
KA_ALT_F10 = 143,
KA_ALT_F9, KA_ALT_F8, KA_ALT_F7, KA_ALT_F6, KA_ALT_F5,
KA_ALT_F4, KA_ALT_F3, KA_ALT_F2, KA_ALT_F1,
KA_CTRL_F10, KA_CTRL_F9, KA_CTRL_F8, KA_CTRL_F7, KA_CTRL_F6,
KA_CTRL_F5, KA_CTRL_F4, KA_CTRL_F3, KA_CTRL_F2, KA_CTRL_F1,
KA_SHIFT_F10, KA_SHIFT_F9, KA_SHIFT_F8, KA_SHIFT_F7, KA_SHIFT_F6,
KA_SHIFT_F5, KA_SHIFT_F4, KA_SHIFT_F3, KA_SHIFT_F2, KA_SHIFT_F1,
KA_DELETE, /* <DELETE> */
KA_INSERT, /* <INSERT> */
KA_PGDN, /* <PAGE DOWN> */
KA_DOWNRIGHT = KA_PGDN,
KA_DOWN, /* <DOWN ARROW> */
KA_END, /* <END> */
KA_DOWNLEFT = KA_END,
KA_RESERVED1,
KA_RIGHT, /* <RIGHT ARROW> */
KA_KEYPAD5, /* NUMERIC KEY PAD <5> */
KA_LEFT, /* <LEFT ARROW> */
KA_RESERVED2,
KA_PGUP, /* <PAGE UP> */
KA_UPRIGHT = KA_PGUP,
KA_UP, /* <UP ARROW> */
KA_HOME, /* <HOME> */
KA_UPLEFT = KA_HOME,
KA_RESERVED3,
KA_RESERVED4,
KA_F10, KA_F9, KA_F8, KA_F7, KA_F6, KA_F5, KA_F4, KA_F3, KA_F2, KA_F1,
KA_LMOUSE,
KA_RMOUSE,
KA_JBUTTON1,
KA_JBUTTON2,
KA_J_UP,
KA_J_RIGHT,
KA_J_DOWN,
KA_J_LEFT,
KA_SHIFT_BIT = 0x0100,
KA_CTRL_BIT = 0x0200,
KA_ALT_BIT = 0x0400,
KA_RLSE_BIT = 0x0800,
KA_LCOMM_BIT = 0x1000, /* Amiga Left Comm key */
KA_RCOMM_BIT = 0x2000 /* Amiga Right Comm key */
} KeyASCIIType;
/*
** These are the keyboard codes that are returned from the input routines
** Get_Key_Num and Input_Num.
*/
typedef enum {
KN_NONE = 0,
KN_GRAVE = 1, /* ` */
KN_1, KN_2, KN_3, KN_4, KN_5, KN_6, KN_7, KN_8, KN_9, KN_0,
KN_MINUS, /* - */
KN_EQUAL, /* = */
KN_RESERVED1,
KN_BACKSPACE, /* <BACKSPACE> */
KN_TAB, /* <TAB> */
KN_Q, KN_W, KN_E, KN_R, KN_T, KN_Y, KN_U, KN_I, KN_O, KN_P,
KN_LBRACKET, /* [ */
KN_RBRACKET, /* ] */
KN_BACKSLASH, /* \ */
KN_CAPSLOCK, /* <CAPS LOCK> */
KN_A, KN_S, KN_D, KN_F, KN_G, KN_H, KN_J, KN_K, KN_L,
KN_SEMICOLON, /* ; */
KN_SQUOTE, /* ' */
KN_BACKSLASH2,
KN_RETURN, /* <RETURN> or <ENTER> */
KN_LSHIFT, /* <LEFT SHIFT> */
KN_MOUSE_MOVE, // Indicate a mouse move (for playback of
KN_Z, KN_X, KN_C, KN_V, KN_B, KN_N, KN_M,
KN_COMMA, /* , */
KN_PERIOD, /* . */
KN_SLASH, /* / */
KN_RESERVED3,
KN_RSHIFT, /* <RIGHT SHIFT> */
KN_LCTRL, /* <LEFT CTRL> */
KN_LCOMM, /* for AMIGA */
KN_LALT, /* <LEFT ALT> */
KN_SPACE, /* <SPACE BAR> */
KN_RALT, /* <RIGHT ALT> */
KN_RCOMM, /* for AMIGA */
KN_RCTRL, /* <RIGHT CTRL> */
/* the following are forced into key buffer */
KN_LMOUSE,
KN_RMOUSE,
KN_JBUTTON1,
KN_JBUTTON2,
KN_J_UP,
KN_J_RIGHT,
KN_J_DOWN,
KN_J_LEFT,
KN_SPECIAL9,
KN_SPECIAL10,
KN_E_INSERT, /* extended <INSERT> */
KN_E_DELETE, /* extended <DELETE> */
KN_RESERVED4,
KN_RESERVED5,
KN_E_LEFT, /* extended <LEFT ARROW> */
KN_E_HOME, /* extended <HOME> */
KN_E_END, /* extended <END> */
KN_RESERVED6,
KN_E_UP, /* extended <UP ARROW> */
KN_E_DOWN, /* extended <DOWN ARROW> */
KN_E_PGUP, /* extended <PAGE UP> */
KN_E_PGDN, /* extended <PAGE DOWN> */
KN_K_LPAREN, /* for AMIGA */
KN_K_RPAREN, /* for AMIGA */
KN_E_RIGHT, /* extended <RIGHT ARROW> */
KN_NUMLOCK, /* <NUM LOCK> */
KN_HOME, /* num key pad 7 */
KN_UPLEFT = KN_HOME,
KN_LEFT, /* num key pad 4 */
KN_END, /* num key pad 1 */
KN_DOWNLEFT = KN_END,
KN_RESERVED7,
KN_KEYPAD_SLASH, /* num key pad / */
KN_UP, /* num key pad 8 */
KN_CENTER, /* num key pad 5 */
KN_DOWN, /* num key pad 2 */
KN_INSERT, /* num key pad 0 */
KN_KEYPAD_ASTERISK, /* num key pad * */
KN_PGUP, /* num key pad 9 */
KN_UPRIGHT = KN_PGUP,
KN_RIGHT, /* num key pad 6 */
KN_PGDN, /* num key pad 3 */
KN_DOWNRIGHT = KN_PGDN,
KN_DELETE, /* num key pad . */
KN_KEYPAD_MINUS, /* num key pad - */
KN_KEYPAD_PLUS, /* num key pad + */
KN_RESERVED8,
KN_KEYPAD_RETURN, /* num key pad <ENTER> */
KN_RESERVED9,
KN_ESC,
KN_HELP, /* for AMIGA */
KN_F1, KN_F2, KN_F3, KN_F4, KN_F5, KN_F6, KN_F7, KN_F8, KN_F9, KN_F10,
KN_F11,
KN_F12,
KN_PRNTSCRN, /* <PRINT SCRN> */
KN_SCROLLLOCK, /* <SCROLL LOCK> */
KN_PAUSE, /* <PAUSE> */
KN_SHIFT_BIT = 0x0100,
KN_CTRL_BIT = 0x0200,
KN_ALT_BIT = 0x0400,
KN_RLSE_BIT = 0x0800,
KN_LCOMM_BIT = 0x1000, /* Amiga Left Comm key */
KN_RCOMM_BIT = 0x2000, /* Amiga Right Comm key */
KN_BUTTON = 0x8000 /* Amiga Right Comm key */
} KeyNumType;
#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/>.
;
;***************************************************************************
;** C O N F I D E N T I A L --- W E S T W O O D A S S O C I A T E S **
;***************************************************************************
;* *
;* Project Name : Westwood 32 bit Library *
;* *
;* File Name : KEYBOARD.INC *
;* *
;* Programmer : Phil W. Gorrow *
;* *
;* Start Date : July 12, 1994 *
;* *
;* Last Update : July 12, 1994 [PWG] *
;* *
;*-------------------------------------------------------------------------*
;* Contains all the defines used by the keyboard interrupt for assembly *
;* includes. *
;* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *
TRUE EQU 1 ; numerical true
FALSE EQU 0 ; numerical false
DEBUG EQU 1
MAX_X_PIXEL EQU 319
MAX_Y_PIXEL EQU 199
KN_RESERVED1 EQU 14
KN_RESERVED2 EQU 45
KN_RESERVED3 EQU 56
; these two are reserved for AMIGA open and close.
KN_LCOMM EQU 59
KN_RCOMM EQU 63
KN_LMOUSE EQU 65
KN_RMOUSE EQU 66
KN_JBUTTON1 EQU 67
KN_JBUTTON2 EQU 68
KN_J_UP EQU 69
KN_J_RIGHT EQU 70
KN_J_DOWN EQU 71
KN_J_LEFT EQU 72
KN_LEFT EQU 92
KN_UPLEFT EQU 91
KN_UP EQU 96
KN_UPRIGHT EQU 101
KN_RIGHT EQU 102
KN_DOWNRIGHT EQU 103
KN_DOWN EQU 98
KN_DOWNLEFT EQU 93
KN_CENTER EQU 97
KN_INSERT EQU 99
KN_DELETE EQU 104
KN_RETURN EQU 43
KN_SPACE EQU 61
KN_KEYPAD_RETURN EQU 108
; these two are reserved for AMIGA K left and right paren
KN_KLPAREN EQU 87
KN_KRPAREN EQU 88
KN_NUMLOCK EQU 90
KN_SCROLLOCK EQU 125 ; key ignored by the logging system
KN_MOUSE_MOVE EQU 45 ; Indicate a mouse move (for playback of logged data)
; ----------------------------------------------------------------
; flags used in Keyflags to customize keystroke interrupt.
REPEATON EQU 0001H ; 1:all makes into buffer, 0:only 1st make
TRACKEXT EQU 0002H ; 1:Home != keypad Home, 0:Home=keypad Home
FILTERONLY EQU 0004H ; 1:Normal BIOS operation with filter
CTRLSON EQU 0008H ; 1:pass scroll lock sequence into BIOS
CTRLALTTURBO EQU 0010H ; 1:Allow turbo up and down in application
CTRLCON EQU 0020H ; 1:pass stop code to BIOS
SCROLLLOCKON EQU 0040H ; 1:pass scroll lock key into BIOS
PAUSEON EQU 0080H ; 1:pass the pause key and seq to BIOS
BREAKON EQU 0100H ; 1:pass the ctrl break seq to BIOS
NONUMLOCK EQU 0200H ; 1:do NOT remap keypad to numbers
TASKSWITCHABLE EQU 0400H ; 1:allows task switching keys thru ALT-TAB,
; ALT-ESC,CTRL-ESC
PASSBREAKS EQU 0800H ; 1:Pass all break codes to keyboard buffer.
KEYMOUSE EQU 1000H ; 1:Numeric keypad moves mouse
SIMLBUTTON EQU 2000H ; 1:have space and enter keys simulate Left
; mouse button when KEYMOUSE is set
SHIFTPRESS EQU 001H ; bit 0 for shift key pressed
CTRLPRESS EQU 002H ; bit 1 for ctrl key pressed
ALTPRESS EQU 004H ; bit 2 for alt key pressed
KEYRELEASE EQU 008H ; bit 3 for key released
NOTKEYRELEASE EQU 0F7H ; not of key released
CAPSLOCK EQU 00001H ; bit 0 for caps locked
NUMLOCK EQU 00002H ; bit 1 for num locked
CLEARISR EQU 020H ; value to clear In Service Register
DOS EQU 021H
INTCHIP0 EQU 020H ; 8259 interrupt chip controller 0
KEYCTRL EQU 061H ; control bits for KB sense data
KEYDATA EQU 060H ; keyboard scan code port

View File

@@ -0,0 +1,161 @@
;
; Command & Conquer Red Alert(tm)
; Copyright 2025 Electronic Arts Inc.
;
; This program is free software: you can redistribute it and/or modify
; it under the terms of the GNU General Public License as published by
; the Free Software Foundation, either version 3 of the License, or
; (at your option) any later version.
;
; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details.
;
; You should have received a copy of the GNU General Public License
; along with this program. If not, see <http://www.gnu.org/licenses/>.
;
;***************************************************************************
;** C O N F I D E N T I A L --- W E S T W O O D A S S O C I A T E S **
;***************************************************************************
;* *
;* Project Name : Westwood 32 bit Library *
;* *
;* File Name : KEYSTRUC.INC *
;* *
;* Programmer : Phil W. Gorrow *
;* *
;* Start Date : July 13, 1994 *
;* *
;* Last Update : July 13, 1994 [PWG] *
;* *
;*-------------------------------------------------------------------------*
;* Functions: *
;* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
STRUC KeyboardType
SoundOn DW ? ; toggled by alt S
MusicOn DW ? ; toggled by alt M
KeyFlags DD ? ; all but repeat for now
Break DW ?
KeyMouseMove DB 6 DUP(?)
ScreenEdge DW 18 DUP (?)
Bits DB 8 DUP (?)
CondPassKey DW 17 DUP (?)
CondPassCond DW 17 DUP (?)
EscRoutine DD ?
ExtCodes DB 16 DUP (?)
ExtNums DB 16 DUP (?)
ExtRemap DB 16 DUP (?)
ExtRemapEnd DB ?
ExtKeyboard DB ?
KeyBuffer DW 128 DUP(?) ; set to empty
KeyBufferHead DD ? ; set to first entry
KeyBufferTail DD ? ; set to head for empty buffer
KeyLock DW ? ; num and caps lock bits
KeyNums DB 89 DUP (?)
KeysCapsLock DB 16 DUP (?)
KeysNumLock DB 16 DUP (?)
KeysUpDown DB 16 DUP (?)
KeyStream DB 16 DUP (?)
PassCount DW ?
KeyStreamIndex DW ?
LastKeyE0 DB ?
LastKeyE1 DB ?
PassAlways DB 10 DUP (?)
PassAlwaysEnd DB ? ; invalid code to END PassAlways
CtrlFlags DB ?
Buffer DW ?
Time DW ?
XYAdjust DB 26 DUP (?)
EdgeConv DW 16 DUP (?)
MouseUpdate DW ?
MouseX DD ?
LocalMouseX DW ?
MouseY DD ?
LocalMouseY DW ?
IsExtKey DB ?
ExtIndex DW ?
KeyOldRMI DD ? ; The origianl RM interrupt seg:off.
KeyOldPMIOffset DD ? ; The origianl PM interrupt offset
KeyOldPMISelector DD ? ; The original PM interrupt segment.
KeyCodeOffset DW ? ; Offset of the code in the RM stuff.
CallKeyRMIntOffset DW ? ; Offset of function to call DOS timer interrupt.
CallKeyRMIntAddr DD ? ; PM address of CallRealIntOffset for speed.
PMIssuedKeyInt DD ? ; did Protected mode pass this through?
BrkOldRMI DD ? ; The origianl RM interrupt seg:off.
BrkOldPMIOffset DD ? ; The origianl PM interrupt offset
BrkOldPMISelector DD ? ; The original PM interrupt segment.
BrkCodeOffset DW ? ; Offset of the code in the RM stuff.
CallBrkRMIntOffset DW ? ; Offset of function to call DOS timer interrupt.
CallBrkRMIntAddr DD ? ; PM address of CallRealIntOffset for speed.
PMIssuedBrkInt DD ? ; did Protected mode pass this through?
KeyIntDisabled DD ?
DbgOldPMIOffset DD ? ; The origianl PM interrupt offset
DbgOldPMISelector DD ? ; The original PM interrupt segment.
;---------------------------------------------------------------------------
; Begin definition of Mouse Specific Variables for real mode
;---------------------------------------------------------------------------
Button DB ? ; current value of the mouse button
MDisabled DB ? ; Is the mouse driver disabled
MInput DB ? ; Defaults to mouse input allowed.
Adjust DW ? ; flag to adjust coordinates if necessary
MouseStepX DW ? ; step values if the mouse moves at
MouseStepY DW ? ; more than one pixel at a time
MouseOffsetX DW ? ; Fractional step values used if a mouse
MouseOffsetY DW ? ; moves at less than one pixel at a time
MState DD ? ; Tracks if mouse is hidden (TRUE) or not (FALSE)
MouseXOld DW ? ; Holds last MouseX and MouseY to determine if
MouseYOld DW ? ; mouse needs to be redrawn
MCState DW ? ; Tracks if mouse conditional hidden (TRUE) or not
MouseCXLeft DD ? ; Conditional hide mouse left x position
MouseCYUpper DD ? ; Conditional hide mouse top y position
MouseCXRight DD ? ; Conditional hide mouse right x position
MouseCYLower DD ? ; Conditional hide mouse lower y position
MouseCursor DD ? ; Pointer to the mouse cursor to draw
MouseCursorSize DW ? ; Size of mouse cursor draw area
MouseBuffer DD ? ; Pointer to buffer mouse is saved in
MouseXHot DD ? ; Offset to mouse's x hot spot
MouseYHot DD ? ; Offset to mouse's y hot spot
MouseBuffX DD ? ; X position background was saved at
MouseBuffY DD ? ; Y position background was saved at
MouseBuffW DD ? ; Width of the region saved for mouse
MouseBuffH DD ? ; Height of the region saved for mouse
MouseWidth DD ? ; Mouse cursor theoretical width
MouseHeight DD ? ; Mouse cursor theoretical height
MouseCodeOffset DW ? ; Offset to the real mode code offset
MouseRight DD ? ; Right hand side of the screen
MouseBottom DD ? ; Bottom of the screen
ShadowPtr dw ?
DrawMousePtr dw ?
VGAMouseDraw dw ?
VGAMouseShadow dw ?
VESAMouseDraw dw ?
VESAMouseShadow dw ?
VesaPtr dd ?
VesaBankTable DD 8 dup (?)
Adjust_XPos dd ?
Adjust_YPos dd ?
ENDS
; InitFlags that are set to have a fully functional interrupt.
IF_ALLOC_RM equ 1 ; Allocation of RM was successful.
IF_SET_VECTORS equ 2 ; Vectors have been set.
IF_LOCKED_PM_CODE equ 4 ; Locked PM code for DPMI.
IF_LOCKED_PM_DATA equ 8 ; Locked PM code for DPMI.
IF_RATE_CHANGE equ 10 ; Timer rate was changed.
IF_FUNCTIONAL equ 20 ; Timer is in and functional.

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 MCGAPRIM_H
#define MCGAPRIM_H
#ifndef WWSTD_H
#include "wwstd.h"
#endif
class GraphicViewPortClass;
class GraphicBufferClass;
class VideoBufferClass;
/*=========================================================================*/
/* Define functions which have not under-gone name mangling */
/*=========================================================================*/
#ifdef __cplusplus
extern "C" {
#endif
/*======================================================================*/
/* Externs for all of the common functions between the video buffer */
/* class and the graphic buffer class. */
/*======================================================================*/
extern long MCGA_Size_Of_Region(void *thisptr, int w, int h);
extern void MCGA_Put_Pixel(void * thisptr, int x, int y, unsigned char color);
extern int MCGA_Get_Pixel(void * thisptr, int x, int y);
extern void MCGA_Clear(void *thisptr, unsigned char color);
extern long MCGA_To_Buffer(void *thisptr, int x, int y, int w, int h, void *buff, long size);
extern long MCGA_Buffer_To_Page(int x, int y, int w, int h, void *Buffer, void *view);
extern BOOL Linear_Blit_To_Linear( void *thisptr, void * dest, int x_pixel, int y_pixel, int dx_pixel,
int dy_pixel, int pixel_width, int pixel_height, BOOL trans);
extern BOOL Linear_Scale_To_Linear( void *, void *, int, int, int, int, int, int, int, int, BOOL, char *);
extern void Vesa_Put_Pixel(void * thisptr, int x, int y, unsigned char color);
extern int Vesa_Get_Pixel(void * thisptr, int x, int y);
extern void Vesa_Clear(void *thisptr, unsigned char color);
extern long Vesa_To_Buffer(void *thisptr, int x, int y, int w, int h, void *buff, long size);
extern long Vesa_Buffer_To_Page(int x, int y, int w, int h, void *Buffer, void *view);
extern BOOL Linear_Blit_To_Vesa( void *thisptr, void * dest, int x_pixel, int y_pixel, int dx_pixel,
int dy_pixel, int pixel_width, int pixel_height, BOOL trans);
extern BOOL Vesa_Blit_To_Linear( void *thisptr, void * dest, int x_pixel, int y_pixel, int dx_pixel,
int dy_pixel, int pixel_width, int pixel_height, BOOL trans);
extern BOOL Vesa_Blit_To_Vesa( void *thisptr, void * dest, int x_pixel, int y_pixel, int dx_pixel,
int dy_pixel, int pixel_width, int pixel_height, BOOL trans);
extern BOOL Linear_Scale_To_Vesa( void *, void *, int, int, int, int, int, int, int, int, BOOL, char *);
extern BOOL Vesa_Scale_To_Linear( void *, void *, int, int, int, int, int, int, int, int, BOOL, char *);
extern BOOL Vesa_Scale_To_Vesa( void *, void *, int, int, int, int, int, int, int, int, BOOL, char *);
extern LONG MCGA_Print( void *thisptr, const char *str, int x, int y, int fcolor, int bcolor);
extern LONG Vesa_Print( void *thisptr, const char *str, int x, int y, int fcolor, int bcolor);
/*======================================================================*/
/* Externs for all of the graphic buffer class only functions */
/*======================================================================*/
extern VOID MCGA_Draw_Line(void *thisptr, int sx, int sy, int dx, int dy, unsigned char color);
extern VOID MCGA_Fill_Rect(void *thisptr, int sx, int sy, int dx, int dy, unsigned char color);
extern VOID MCGA_Remap(void * thisptr, int sx, int sy, int width, int height, void *remap);
extern VOID MCGA_Fill_Quad(void * thisptr, VOID *span_buff, int x0, int y0, int x1, int y1,
int x2, int y2, int x3, int y3, int color);
extern void MCGA_Draw_Stamp(void const *thisptr, void const *icondata, int icon, int x_pixel, int y_pixel, void const *remap);
extern void Shadow_Blit(long int xpix, long int ypix, long int width, long int height, GraphicViewPortClass &src, VideoBufferClass &dst, void *shadowbuff);
// extern int Get_Standard_Selector(VOID);
// extern VOID Set_Selector(UWORD sel);
#ifdef __cplusplus
}
#endif
extern BOOL (*VVPC_Blit_to_GVPC_Func)(void *, void *, int, int, int, int, int, int, BOOL);
extern BOOL (*VVPC_Blit_to_VVPC_Func)(void *, void *, int, int, int, int, int, int, BOOL);
extern void (*VVPC_Clear_Func)(void *, unsigned char);
extern long (*VVPC_To_Buffer_Func)(void *,int x, int y, int w, int h, void *buff, long size);
extern void (*VVPC_Put_Pixel_Func)(void *,int x, int y, unsigned char color);
extern int (*VVPC_Get_Pixel_Func)(void *, int x, int y);
extern long (*VVPC_Buffer_To_Page)(int x, int y, int w, int h, void *buffer, void *view);
extern BOOL (*GVPC_Blit_to_VVPC_Func)(void *, void *, int, int, int, int, int, int, BOOL);
extern BOOL (*VVPC_Blit_to_GVPC_Func)(void *, void *, int, int, int, int, int, int, BOOL);
extern BOOL (*VVPC_Blit_to_VVPC_Func)(void *, void *, int, int, int, int, int, int, BOOL);
extern BOOL (*VVPC_Scale_To_GVPC)( void *, void *, int, int, int, int, int, int, int, int, BOOL, char *);
extern BOOL (*VVPC_Scale_To_VVPC)( void *, void *, int, int, int, int, int, int, int, int, BOOL, char *);
extern BOOL (*GVPC_Scale_To_VVPC)( void *, void *, int, int, int, int, int, int, int, int, BOOL, char *);
extern LONG (*VVPC_Print_Func)(void *, const char *, int, int, int, int);
extern GraphicBufferClass *LogicPage;
#endif

View File

@@ -0,0 +1,122 @@
;
; Command & Conquer Red Alert(tm)
; Copyright 2025 Electronic Arts Inc.
;
; This program is free software: you can redistribute it and/or modify
; it under the terms of the GNU General Public License as published by
; the Free Software Foundation, either version 3 of the License, or
; (at your option) any later version.
;
; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details.
;
; You should have received a copy of the GNU General Public License
; along with this program. If not, see <http://www.gnu.org/licenses/>.
;
;***************************************************************************
;** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S **
;***************************************************************************
;* *
;* Project Name : Westwood 32 bit Library *
;* *
;* File Name : MCGAPRIM.INC *
;* *
;* Programmer : Phil W. Gorrow *
;* *
;* Start Date : January 16, 1995 *
;* *
;* Last Update : January 16, 1995 [PWG] *
;* *
;*-------------------------------------------------------------------------*
;* Functions: *
;* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *
; Externs from REGIONSZ.ASM module of the MCGAPRIM library
GLOBAL MCGA_Size_Of_Region :NEAR
; Externs from GETPIX.ASM module of the MCGAPRIM library
GLOBAL MCGA_Get_Pixel :NEAR
; Externs from VGETPIX.ASM module of the SVGA/MCGAPRIM library
GLOBAL Vesa_Get_Pixel :NEAR
; Externs from PUTPIX.ASM module of the MCGAPRIM library
GLOBAL MCGA_Put_Pixel :NEAR
; Externs from VPUTTPIX.ASM module of the SVGA/MCGAPRIM library
GLOBAL Vesa_Put_Pixel :NEAR
; Externs from CLEAR.ASM module of the MCGAPRIM library
GLOBAL MCGA_Clear :NEAR
; Externs from VCLEAR.ASM module of the MCGA/SVGAPRIM library
GLOBAL Vesa_Clear :NEAR
; Externs from BITBLIT.ASM module of the MCGAPRIM library
GLOBAL Linear_Blit_To_Linear :NEAR
; Externs from VBITBLIT.ASM module of the MCGA/SVGAPRIM library
GLOBAL Linear_Blit_To_Vesa :NEAR
GLOBAL Vesa_Blit_To_Linear :NEAR
GLOBAL Vesa_Blit_To_Vesa :NEAR
; Externs from TOBUFF.ASM module of the MCGAPRIM library
GLOBAL MCGA_To_Buffer :NEAR
; Externs from VTOBUFF.ASM module of the SVGA/MCGAPRIM library
GLOBAL Vesa_To_Buffer :NEAR
; Externs from TOPAGE.ASM module of the MCGAPRIM library
GLOBAL MCGA_Buffer_To_Page :NEAR
; Externs from VTOPAGE.ASM module of the SVGA/MCGAPRIM library
GLOBAL Vesa_Buffer_To_Page :NEAR
; Externs from SCALE.ASM module of the MCGAPRIM library
GLOBAL Linear_Scale_To_Linear :NEAR
; Externs from VSCALE.ASM module of the SVGA/MCGAPRIM library
GLOBAL Linear_Scale_To_Vesa :NEAR
GLOBAL Vesa_Scale_To_Linear :NEAR
GLOBAL Vesa_Scale_To_Vesa :NEAR
; Externs from TXTPRNT.ASM module of the MCGAPRIM library
GLOBAL MCGA_Print :NEAR
; Externs from VTXTPRNT.ASM module of the SVGA/MCGAPRIM library
GLOBAL Vesa_Print :NEAR
;*-------------------------------------------------------------------------*
;* Define MCGA only assembly GLOBALS *
;*-------------------------------------------------------------------------*
; Externs from DRAWLINE.ASM module of the MCGAPRIM library
GLOBAL MCGA_Draw_Line :NEAR
; Externs from FILLQUAD.ASM module of the MCGAPRIM library
GLOBAL MCGA_Fill_Quad :NEAR
; Externs from FILLRECT.ASM module of the MCGAPRIM library
GLOBAL MCGA_Fill_Rect :NEAR
; Externs from REMAP.ASM module of the MCGAPRIM library
GLOBAL MCGA_Remap :NEAR
; Externs from STAMP.ASM module of the MCGAPRIM library
GLOBAL MCGA_Draw_Stamp :NEAR
GLOBAL get_clip : NEAR
struc RECTANGLE
x0 dd ?
y0 dd ?
x1 dd ?
y1 dd ?
ends RECTANGLE



View File

@@ -0,0 +1,102 @@
/*
** Command & Conquer Red Alert(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/***************************************************************************
** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S **
***************************************************************************
* *
* Project Name : Memory System *
* *
* File Name : MEMFLAG.H *
* *
* Programmer : Jeff Wilson *
* *
* Start Date : April 4, 1994 *
* *
* Last Update : September 8, 1994 [IML] *
* *
*-------------------------------------------------------------------------*
* Functions: *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
#ifndef MEMFLAG_H
#define MEMFLAG_H
// Memory Flags
/*
** Memory allocation flags. These are the flags that are passed into Alloc
** in order to control the type of memory allocated.
*/
typedef enum {
MEM_NORMAL = 0x0000, // Default memory (normal).
MEM_NEW = 0x0001, // Called by the operator new and was overloaded.
MEM_CLEAR = 0x0002, // Clear memory before returning.
MEM_REAL = 0x0004, // Clear memory before returning.
MEM_TEMP = 0x0008, // Clear memory before returning.
} MemoryFlagType;
/*=========================================================================*/
/* The following prototypes are for the file: ALLOC.CPP */
/*=========================================================================*/
void *Alloc(unsigned long bytes_to_alloc, MemoryFlagType flags);
void Free(void *pointer);
void *Resize_Alloc(void *original_ptr, unsigned long new_size_in_bytes);
long Ram_Free(MemoryFlagType flag);
long Heap_Size(MemoryFlagType flag);
long Total_Ram_Free(MemoryFlagType flag);
inline void * operator new(size_t size, MemoryFlagType flag)
{
return(Alloc(size, flag));
}
inline void * operator new[] (size_t size, MemoryFlagType flag)
{
return(Alloc(size, flag));
}
/*=========================================================================*/
/* The following prototypes are for the file: MEM_COPY.ASM */
/*=========================================================================*/
#ifdef __cplusplus
extern "C" {
#endif
extern void Mem_Copy(void *source, void *dest, unsigned long bytes_to_copy);
#ifdef __cplusplus
}
#endif
inline void *Add_Long_To_Pointer(void const *ptr, long size)
{
return ((void *) ( (char const *) ptr + size));
}
extern void (*Memory_Error)(void);
extern unsigned long MinRam; // Record of least memory at worst case.
extern unsigned long MaxRam; // Record of total allocated at worst case.
#endif

171
VQ/INCLUDE/WWLIB32/MISC.H Normal file
View File

@@ -0,0 +1,171 @@
/*
** Command & Conquer Red Alert(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/***************************************************************************
** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S **
***************************************************************************
* *
* Project Name : 32 bit library *
* *
* File Name : MISC.H *
* *
* Programmer : Scott K. Bowen *
* *
* Start Date : August 3, 1994 *
* *
* Last Update : August 3, 1994 [SKB] *
* *
*-------------------------------------------------------------------------*
* Functions: *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
#ifndef MISC_H
#define MISC_H
/*========================= C++ Routines ==================================*/
/*=========================================================================*/
/* The following prototypes are for the file: EXIT.CPP */
/* Prog_End Must be supplied by the user program in startup.cpp */
/*=========================================================================*/
VOID cdecl Prog_End(VOID);
VOID cdecl Exit(INT errorval, const BYTE *message, ...);
/*=========================================================================*/
/* The following prototypes are for the file: DELAY.CPP */
/*=========================================================================*/
void Delay(int duration);
void Vsync(void);
/*=========================================================================*/
/* The following prototypes are for the file: FINDARGV.CPP */
/*=========================================================================*/
BYTE *cdecl Find_Argv(BYTE const *str);
/*=========================================================================*/
/* The following prototypes are for the file: LIB.CPP */
/*=========================================================================*/
char *Find_Argv(char const *str);
void Mono_Mem_Dump(void const *databuf, int bytes, int y);
void Convert_RGB_To_HSV(unsigned int r, unsigned int g, unsigned int b, unsigned int *h, unsigned int *s, unsigned int *v);
void Convert_HSV_To_RGB(unsigned int h, unsigned int s, unsigned int v, unsigned int *r, unsigned int *g, unsigned int *b);
/*=========================================================================*/
/* The following prototypes are for the file: VERSION.CPP */
/*=========================================================================*/
BYTE *cdecl Version(VOID);
/*=========================================================================*/
/* The following prototypes are for the file: IRANDOM.CPP */
/*=========================================================================*/
int IRandom(int minval, int maxval);
/*========================= Assembly Routines ==============================*/
#ifdef __cplusplus
extern "C" {
#endif
/*=========================================================================*/
/* The following prototypes are for the file: RANDOM.ASM */
/*=========================================================================*/
UBYTE Random(VOID);
int Get_Random_Mask(int maxval);
/*=========================================================================*/
/* The following prototype is for the file: SHAKESCR.ASM */
/*=========================================================================*/
void Shake_Screen(int shakes);
/*=========================================================================*/
/* The following prototypes are for the file: REVERSE.ASM */
/*=========================================================================*/
LONG Reverse_LONG(LONG number);
WORD Reverse_WORD(WORD number);
LONG Swap_LONG(LONG number);
/*=========================================================================*/
/* The following prototype is for the file: FACING8.ASM */
/*=========================================================================*/
int Desired_Facing8(int x1, int y1, int x2, int y2);
/*=========================================================================*/
/* The following prototype is for the file: FACING16.ASM */
/*=========================================================================*/
int Desired_Facing16(int x1, int y1, int x2, int y2);
/*=========================================================================*/
/* The following prototype is for the file: FACINGFF.ASM */
/*=========================================================================*/
int Desired_Facing256(int x1, int y1, int x2, int y2);
/*=========================================================================*/
/* The following prototype is for the file: FADING.ASM */
/*=========================================================================*/
void *Build_Fading_Table(void const *palette, void const *dest, long int color, long int frac);
/*=========================================================================*/
/* The following prototype is for the file: CRC.ASM */
/*=========================================================================*/
long Calculate_CRC(void *buffer, long length);
/*=========================================================================*/
/* The following prototypes are for the file: DETPROC.ASM */
/*=========================================================================*/
extern WORD Processor(VOID);
extern WORD Operating_System(VOID);
extern ULONG random ( ULONG mod ) ;
extern void randomize ( void ) ;
extern int Clip_Rect ( int * x , int * y , int * dw , int * dh ,
int width , int height ) ;
extern int Confine_Rect ( int * x , int * y , int dw , int dh ,
int width , int height ) ;
/*=========================================================================*/
/* The following prototypes are for the file: OPSYS.ASM */
/*=========================================================================*/
extern WORD OperationgSystem;
#ifdef __cplusplus
}
#endif
/*=========================================================================*/
#endif // MISC_H



77
VQ/INCLUDE/WWLIB32/MONO.H Normal file
View File

@@ -0,0 +1,77 @@
/*
** Command & Conquer Red Alert(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/***************************************************************************
** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S **
***************************************************************************
* *
* Project Name : Mono Sub-system *
* *
* File Name : MONO.H *
* *
* Programmer : Joe Bostic *
* 32Bit Programmer : Jeff Wilson *
* *
* Start Date : March 28, 1994 *
* *
* Last Update : March 28, 1994 [] *
* *
*-------------------------------------------------------------------------*
* Functions: *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
#ifndef MONO_H
#define MONO_H
// C++ Routines
//==================================================================
// Mono Screen routines
//==================================================================
int Initialize_Mono_Screen ( void );
// C Routines
//==================================================================
#ifdef __cplusplus
extern "C" {
#endif
// Mono Screen routines
//===================================================================
extern unsigned MonoScreen;
extern unsigned MonoEnabled;
extern void Mono_Set_Cursor(int x, int y);
extern void Mono_Clear_Screen(void);
extern void Mono_Scroll(int lines);
extern void Mono_Put_Char(char character, int attrib=2);
extern void Mono_Draw_Rect(int x, int y, int w, int h, int attrib=2, int thick=0);
extern void Mono_Text_Print(void const *text, int x, int y, int attrib=2);
extern void Mono_Print(void const *text);
extern void Mono_View_Page(int page);
extern int Mono_Printf(char const *string, ...);
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,85 @@
/*
** Command & Conquer Red Alert(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/***************************************************************************
;** C O N F I D E N T I A L --- W E S T W O O D A S S O C I A T E S **
;***************************************************************************
;* *
;* Project Name : Palette 32bit Library. *
;* *
;* File Name : PALETTE.H *
;* *
;* Programmer : Scott K. Bowen *
;* *
;* Start Date : April 25, 1994 *
;* *
;* Last Update : April 27, 1994 [BRR] *
;* *
;* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
#ifndef PALETTE_H
#define PALETTE_H
/*
********************************* Constants *********************************
*/
#define RGB_BYTES 3
#define PALETTE_SIZE 256
#define PALETTE_BYTES 768
/*
******************************** Prototypes *********************************
*/
/*
-------------------------------- Palette.cpp --------------------------------
*/
VOID cdecl Set_Palette(VOID *palette);
VOID cdecl Set_Palette_Color(VOID *palette, WORD color, VOID *data);
VOID Fade_Palette_To(VOID *palette1, UWORD delay, VOID (*callback)() );
/*
-------------------------------- loadpal.cpp --------------------------------
*/
VOID cdecl Load_Palette(BYTE *palette_file_name, VOID *palette_pointer);
/*
------------------------------- morphpal.cpp --------------------------------
*/
VOID cdecl Morph_Palette (VOID *src_palette, VOID *dst_palette, UWORD delay,
VOID *callback);
/*
---------------------------------- pal.asm ----------------------------------
*/
#ifdef __cplusplus
extern "C" {
#endif
extern VOID Set_Palette_Range(VOID *palette);
extern BOOL Bump_Color(VOID *palette, WORD changable, WORD target);
#ifdef __cplusplus
}
#endif
extern "C" extern UBYTE CurrentPalette[]; /* in pal.asm */
#endif // PALETTE_H
/***************************** End of palette.h ****************************/


249
VQ/INCLUDE/WWLIB32/PLAYCD.H Normal file
View File

@@ -0,0 +1,249 @@
/*
** Command & Conquer Red Alert(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/***************************************************************************
** C O N F I D E N T I A L --- W E S T W O O D A S S O C I A T E S **
***************************************************************************
* *
* Project Name : WWLIB *
* *
* File Name : PLAYCD.H *
* *
* Programmer : STEVE WETHERILL *
* *
* Start Date : 5/13/94 *
* *
* Last Update : June 4, 1994 [SW] *
* *
*-------------------------------------------------------------------------*/
#ifndef PLAYCD_H
#define PLAYCD_H
/* ==================================================================== */
/* Defines */
/* ==================================================================== */
#define CHLEFT 0
#define CHRIGHT 1
#define CHBOTH 2
#define AUDIO_START_MIN 1
#define AUDIO_START_SEC 44
typedef struct {
unsigned short seg ;
unsigned short sel ;
} SEGSEL ;
extern "C" int DPMI_real_alloc ( UINT , SEGSEL * , USHORT * ) ;
extern "C" int DPMI_real_free ( SEGSEL ) ;
extern "C" void DPMI_real_intr ( int , union REGS * , struct SREGS * );
extern "C" void DPMI_real_call ( void * funct , union REGS * , struct SREGS * );
/* ==================================================================== */
/* Data structures */
/* ==================================================================== */
// Audio Track Info request block
struct TinfoType {
UBYTE Length;
UBYTE SubCd;
UBYTE Command;
UWORD Status;
UBYTE Rsvd[8];
UBYTE MDescr;
UWORD TrnsAdOff;
UWORD TrnsAdSeg;
UWORD CntTrns;
UWORD StSect;
UWORD VolIDOff;
UWORD VolIDSeg;
UBYTE TrInfo;
UBYTE Track;
ULONG Start;
UBYTE TrCtrl;
};
// Audio Track Status Control Block
struct StatType {
UBYTE Length;
UBYTE SubCd;
UBYTE Command;
UWORD Status;
UBYTE Rsvd[8];
UBYTE MDescr;
UWORD TrnsAdOff;
UWORD TrnsAdSeg;
UWORD CntTrns;
UWORD StSect;
UWORD VolIDOff;
UWORD VolIDSeg;
UBYTE StatInfo;
UWORD Stat;
ULONG Start;
ULONG End;
};
// Audio Track Volume control block
struct VolmType {
UBYTE Length;
UBYTE SubCd;
UBYTE Command;
UWORD Status;
UBYTE Rsvd[8];
UBYTE MDescr;
UWORD TrnsAdOff;
UWORD TrnsAdSeg;
UWORD CntTrns;
UWORD StSect;
UWORD VolIDOff;
UWORD VolIDSeg;
UBYTE TrInfo;
UBYTE In0;
UBYTE Vol0;
UBYTE In1;
UBYTE Vol1;
UBYTE In2;
UBYTE Vol2;
UBYTE In3;
UBYTE Vol3;
};
// Audio Track Play request block
struct PlayType {
UBYTE Length;
UBYTE SubCd;
UBYTE Command;
UWORD Status;
UBYTE Rsvd[8];
UBYTE AddrMd;
ULONG Start;
ULONG CntSect;
};
// Audio Track Stop request block
struct StopType {
UBYTE Length;
UBYTE SubCd;
UBYTE Command;
UWORD Status;
UBYTE Rsvd[8];
};
/***************************************************************************
* GetCDClass -- object which will return logical CD drive *
* *
* HISTORY: *
* 06/04/1994 SW : Created. *
*=========================================================================*/
class GetCDClass {
protected:
union REGS regs;
struct SREGS sregs;
SEGSEL cdDrive_addrp;
UWORD largestp;
UBYTE cdDrive[26]; // CD Drive letters from MSCDEX
public:
GetCDClass(VOID); // This is the default constructor
~GetCDClass(VOID); // This is the destructor
WORD GetCDDrive(VOID);
};
/***************************************************************************
* RedBookClass -- adds red book functionality *
* *
* this class inherits from GetCDClass and adds red book play functionality*
* *
* *
* HISTORY: *
* 06/04/1994 SW : Created. *
*=========================================================================*/
class RedBookClass : public GetCDClass {
private:
SEGSEL Tinfo_addrp;
SEGSEL Stat_addrp;
SEGSEL Stop_addrp;
SEGSEL Volm_addrp;
SEGSEL Play_addrp;
StopType Stop;
PlayType Play;
VolmType Volm;
StatType Stat;
TinfoType Tinfo;
public:
RedBookClass(VOID); // This is the default constructor
~RedBookClass(VOID); // This is the destructor
ULONG RedToHS(ULONG i);
ULONG MSFtoRed(UBYTE m, UBYTE s, UBYTE f);
VOID FullCDVolume(UBYTE chan);
VOID PlayTrack(UWORD track);
VOID Play_CD_MSL(UWORD min_sec, UWORD len);
VOID PlayMSF(UBYTE startM, UBYTE startS, UBYTE startF,
UBYTE endM, UBYTE endS, UBYTE endF, UBYTE chan);
UWORD CheckCDMusic(VOID);
VOID StopCDMusic(VOID);
};
/***************************** End of Playcd.h ****************************/
#endif // PLAYCD_H


167
VQ/INCLUDE/WWLIB32/SHAPE.H Normal file
View File

@@ -0,0 +1,167 @@
/*
** Command & Conquer Red Alert(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/***************************************************************************
** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S **
***************************************************************************
* *
* Project Name : WWLIB32 *
* *
* File Name : SHAPE.H *
* *
* Programmer : Bill Randolph *
* *
* Start Date : May 25, 1994 *
* *
* Last Update : September 14, 1994 [IML] *
* *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
#ifndef SHAPE_H
#define SHAPE_H
#ifndef GBUFFER_H
#include "gbuffer.h"
#endif
/*
*********************************** Types ***********************************
*/
/*
--------------------------- Shape creation flags ----------------------------
*/
typedef enum {
MAKESHAPE_NORMAL = 0x0000, // 256-color compressed shape
MAKESHAPE_COMPACT = 0x0001, // 16-color shape (with built-in color table)
MAKESHAPE_NOCOMP = 0x0002, // Uncompressed shape
MAKESHAPE_VARIABLE = 0x0004 // <16-color shape
} MakeShapeFlags_Type;
/*---------------------------------------------------------------------------
Shape drawing flags:
- The low byte is for coordinate transformations.
- The high byte is for drawing effects.
---------------------------------------------------------------------------*/
typedef enum {
SHAPE_NORMAL = 0x0000, // Standard shape
SHAPE_HORZ_REV = 0x0001, // Flipped horizontally
SHAPE_VERT_REV = 0x0002, // Flipped vertically
SHAPE_SCALING = 0x0004, // Scaled (WORD scale_x, WORD scale_y)
SHAPE_VIEWPORT_REL = 0x0010, // Coords are window-relative
SHAPE_WIN_REL = 0x0010, // Coordinates are window relative instead of absolute.
SHAPE_CENTER = 0x0020, // Coords are based on shape's center pt
SHAPE_FADING = 0x0100, // Fading effect (VOID * fading_table,
// WORD fading_num)
SHAPE_PREDATOR = 0x0200, // Transparent warping effect
SHAPE_COMPACT = 0x0400, // Never use this bit
SHAPE_PRIORITY = 0x0800, // Use priority system when drawing
SHAPE_GHOST = 0x1000, // Shape is drawn ghosted
SHAPE_SHADOW = 0x2000,
SHAPE_PARTIAL = 0x4000,
SHAPE_COLOR = 0x8000 // Remap the shape's colors
// (VOID * color_table)
} ShapeFlags_Type;
/*
------------------------------- Shape header --------------------------------
*/
typedef struct {
UWORD ShapeType; // 0 = normal, 1 = 16 colors,
// 2 = uncompressed, 4 = <16 colors
UBYTE Height; // Height of the shape in scan lines
UWORD Width; // Width of the shape in bytes
UBYTE OriginalHeight; // Original height of shape in scan lines
UWORD ShapeSize; // Size of the shape, including header
UWORD DataLength; // Size of the uncompressed shape (just data)
UBYTE Colortable[16]; // Optional color table for compact shape
} Shape_Type;
/*
------------------------------- Shape block ---------------------------------
*/
typedef struct {
UWORD NumShapes; // number of shapes in the block
LONG Offsets[]; // array of offsets to shape data
// (offsets within the shape block, with
// 0 being the first offset value, not the
// start of the shape block)
} ShapeBlock_Type;
/*
******************************** Prototypes *********************************
*/
/*
-------------------------------- prioinit.c ---------------------------------
*/
extern "C" {
extern VOID *MaskPage;
extern VOID *BackGroundPage;
extern LONG _ShapeBufferSize;
extern BYTE *_ShapeBuffer;
}
VOID cdecl Init_Priority_System (GraphicBufferClass *mask,
GraphicBufferClass *back);
/*
-------------------------------- drawshp.asm --------------------------------
*/
extern "C" {
WORD Draw_Shape(GraphicViewPortClass *gvp, VOID const *shape, LONG x, LONG y, LONG flags, ...);
}
/*
---------------------------------- shape.c ----------------------------------
*/
short cdecl Get_Shape_Data(VOID const *shape, WORD data);
int cdecl Extract_Shape_Count(VOID const *buffer);
void * cdecl Extract_Shape(VOID const *buffer, int shape);
int cdecl Restore_Shape_Height(VOID *shape);
int cdecl Set_Shape_Height(VOID const *shape, WORD newheight);
extern "C" {
int Get_Shape_Width(VOID const *shape);
int Get_Shape_Height(VOID const *shape);
int Get_Shape_Original_Height(VOID const *shape);
int Get_Shape_Uncomp_Size(VOID const *shape);
}
/*
------------------------------- setshape.asm --------------------------------
*/
extern "C" {
VOID Set_Shape_Buffer(void const *buffer, int size);
}
/*
------------------------------- shapeinf.asm --------------------------------
*/
WORD cdecl Get_Shape_Flags(VOID const *shape);
int cdecl Get_Shape_Size(VOID const *shape);
int cdecl Get_Shape_Scaled_Width(VOID const *shape, WORD scale);
int cdecl Get_Shape_Scaled_Height(VOID const *shape, WORD scale);
#endif // SHAPE_H
/****************************** End of shape.h *****************************/



View File

@@ -0,0 +1,214 @@
;
; Command & Conquer Red Alert(tm)
; Copyright 2025 Electronic Arts Inc.
;
; This program is free software: you can redistribute it and/or modify
; it under the terms of the GNU General Public License as published by
; the Free Software Foundation, either version 3 of the License, or
; (at your option) any later version.
;
; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details.
;
; You should have received a copy of the GNU General Public License
; along with this program. If not, see <http://www.gnu.org/licenses/>.
;
;***************************************************************************
;** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S **
;***************************************************************************
;* *
;* Project Name : WWLIB32 *
;* *
;* File Name : SHAPE.INC *
;* *
;* Programmer : Scott Bowen *
;* *
;* Start Date : May 25, 1994 *
;* *
;* Last Update : September 14, 1994 [IML] *
;* *
;* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *
;****************************** Equates ************************************
;
;............................ Shape Types ..................................
;
TRUE equ 1 ; Boolean 'true' value
FALSE equ 0 ; Boolean 'false' value
MAKESHAPE_NORMAL EQU 0 ; 256-color compressed shape
MAKESHAPE_COMPACT EQU 1 ; 16-color shape (built-in color table)
MAKESHAPE_NOCOMP EQU 2 ; non-wwcomped shape
MAKESHAPE_VARIABLE EQU 4 ; <16-color shape with variable #
; of colors (ColorTable[0] = # of colors)
; old names:
;COLOR_SHAPE EQU 1 ; flag which determines a color shape
;NORM_SHAPE EQU 2 ; flag that indicates non wwcomped shp
;NORM_SHAPE_16 EQU 4 ; flag that tells us if we have a variable sized table
; variable sized table
;
;...........................................................................
; Drawing flags:
; The low byte is for coordinate transformations.
; The high byte is for drawing effects.
;...........................................................................
;
SHAPE_NORMAL EQU 0000h ; no options; just a copy
SHAPE_HORZ_REV EQU 0001h ; reverse horizontally
SHAPE_VERT_REV EQU 0002h ; reverse vertically
SHAPE_SCALING EQU 0004h ; scale
SHAPE_VIEWPORT_REL EQU 0010h ; viewport-relative coordinates
SHAPE_CENTER EQU 0020h ; use centered coordinates
SHAPE_FADING EQU 0100h ; fading effect shape
SHAPE_PREDATOR EQU 0200h ; predator effect shape
SHAPE_COMPACT EQU 0400h ; shape is in 16 colors
SHAPE_PRIORITY EQU 0800h ; priority draw shape
SHAPE_GHOST EQU 1000h ; ghosting effect
SHAPE_SHADOW EQU 2000h ; shadow effect
SHAPE_PARTIAL EQU 4000h ; partial predator effect
SHAPE_COLOR EQU 8000h ; use alternative color table effect
SHAPE_EFFECTS EQU 03F00h ; shape effect flags
;
;.......................... Shadow Effect ..................................
;
SHADOW_COL EQU 00FFh ; magic number for shadows
;......................... Priority System .................................
;
CLEAR_UNUSED_BITS EQU 0007h ; and with 0000-0111 to clear
; non-walkable high bit and
; scaling id bits
NON_WALKABLE_BIT EQU 0080h ; and with 1000-0000 to clear all
; but non-walkable bit
;
;......................... Predator Effect .................................
;
PRED_MASK EQU 0007h ; mask used for predator pixel puts
;---------------------------------------------------------------------------
; This table is a list of the local stack variables in the function
; Draw_Shape. Many other functions in other modules access these variables
; on the stack. Since the BP is not changed when these other functions are
; called by Draw_Shape (possibly indirectly), they can also access these
; stack varibles. When adding or removing from the table, one must be very
; careful to change the offsets.
;---------------------------------------------------------------------------
;.......................... proc addresses .................................
LSkipRout EQU DWORD PTR ebp - 04h ;DWORD pointer to the skip routine
RSkipRout EQU DWORD PTR ebp - 08h ;DWORD pointer to the skip routine
DrawRout EQU DWORD PTR ebp - 0Ch ;DWORD pointer to the draw routine
;........................ optional arguments ...............................
ColorTable EQU DWORD PTR ebp - 10h ;DWORD ptr to the shapes color table
FadingTable EQU DWORD PTR ebp - 14h ;DWORD ptr to the fading table
FadingNum EQU DWORD PTR ebp - 18h ;DWORD number of times to fade
IsTranslucent EQU DWORD PTR ebp - 1Ch ;DWORD ptr to is_translucent table
Translucent EQU DWORD PTR ebp - 20h ;DWORD ptr to actual translucent tbl
PriLevel EQU BYTE PTR ebp - 24h ;BYTE priority level of the object
ScaleX EQU DWORD PTR ebp - 28h ;DWORD the x increment to scale by
ScaleY EQU DWORD PTR ebp - 2Ch ;DWORD the y increment to scale by
ShadowingTable EQU DWORD PTR ebp - 30h ;DWORD ptr to the shadowing table
;........................ Shape header values ..............................
ShapeType EQU DWORD PTR ebp - 34h ;DWORD shape type
ShapeWidth EQU DWORD PTR ebp - 38h ;DWORD shape's unscaled width
ShapeHeight EQU DWORD PTR ebp - 3Ch ;DWORD shape's unscaled height
UncompDataLen EQU DWORD PTR ebp - 40h ;DWORD uncompressed data length
ShapeData EQU DWORD PTR ebp - 44h ;DWORD pointer to shape data
;...................... Scaled shape dimensions ............................
ScaledWidth EQU DWORD PTR ebp - 48h ;DWORD shape's scaled width
ScaledHeight EQU DWORD PTR ebp - 4Ch ;DWORD shape's scaled height
;...................... Pixel clipping variables ...........................
LeftClipPixels EQU DWORD PTR ebp - 50h ;DWORD # left-clipped pixels
RightClipPixels EQU DWORD PTR ebp - 54h ;DWORD # right-clipped pixels
TopClipPixels EQU DWORD PTR ebp - 58h ;DWORD # top-clipped pixels
BotClipPixels EQU DWORD PTR ebp - 5Ch ;DWORD # bottom-clipped pixels
PixelWidth EQU DWORD PTR ebp - 60h ;DWORD drawable area in pixels
PixelHeight EQU DWORD PTR ebp - 64h ;DWORD drawable area in pixels
;......................... Drawing variables ...............................
NumColors EQU DWORD PTR ebp - 68h ;DWORD # colors for 16-color shapes
StartDraw EQU DWORD PTR ebp - 6Ch ;DWORD offset of drawing start pos
NextLine EQU DWORD PTR ebp - 70h ;DWORD offset of next drawing line
LeftClipBytes EQU DWORD PTR ebp - 74h ;DWORD # left-clipped bytes
XTotal EQU DWORD PTR ebp - 78h ;DWORD accumulated x-pixels
XTotalInit EQU DWORD PTR ebp - 7Ch ;DWORD initial roundoff for XTotal
YTotal EQU DWORD PTR ebp - 80h ;DWORD accumulated y-pixels
HeightCount EQU DWORD PTR ebp - 84h ;DWORD ht counter for drawing lines
LineStart EQU DWORD PTR ebp - 88h ;DWORD address of start of line
WidthCount EQU DWORD PTR ebp - 8Ch ;DWORD counts down # bytes skipped
StashReg EQU DWORD PTR ebp - 90h ;DWORD temp variable for draw routines
MaskAdjust EQU DWORD PTR ebp - 94h ;DWORD priority buffer offset
BackAdjust EQU DWORD PTR ebp - 98h ;DWORD background buffer offset
StashECX EQU DWORD PTR ebp - 9Ch ;DWORD temp variable for ECX register
StashEDX EQU DWORD PTR ebp -0A0h ;DWORD temp variable for EDX register
Local_Size EQU 00A4h ; Amt of data on stack: 4+last offset
;****************************** Declarations *******************************
;---------------------------------------------------------------------------
; Global variables used by the shape routines, defined in drawshp.asm
;---------------------------------------------------------------------------
GLOBAL _ShapeBuffer:DWORD
GLOBAL _ShapeBufferSize:DWORD
GLOBAL _MaskPage:DWORD
GLOBAL _BackGroundPage:DWORD
GLOBAL PredCount:DWORD
GLOBAL PredTable:BYTE
GLOBAL PredValue:DWORD
GLOBAL PartialPred:DWORD
GLOBAL PartialCount:DWORD
GLOBAL Flags:DWORD
;---------------------------------------------------------------------------
; External tables that are defined in ds_table.asm.
;---------------------------------------------------------------------------
GLOBAL LSkipTable:DWORD
GLOBAL RSkipTable:DWORD
GLOBAL DrawTable:DWORD
;------------------------------------------------------------------------------
; Public functions, declared in the order they appear in the function tables.
;--------------------------------------------------------------------------------
GLOBAL C Not_Supported:NEAR
; LSkipTable:
GLOBAL Left_Skip:NEAR ; ds_ls
GLOBAL Left_Reverse_Skip:NEAR ; ds_lrs
GLOBAL Left_Skip:NEAR ; ds_ls
GLOBAL Left_Reverse_Skip:NEAR ; ds_lrs
GLOBAL Left_Scale_Skip:NEAR ; ds_lss
GLOBAL Left_Scale_Reverse_Skip:NEAR ; ds_lsrs
GLOBAL Left_Scale_Skip:NEAR ; ds_lss
GLOBAL Left_Scale_Reverse_Skip:NEAR ; ds_lsrs
; RSkipTable:
GLOBAL Right_Skip:NEAR ; ds_rs
GLOBAL Right_Reverse_Skip:NEAR ; ds_rrs
GLOBAL Right_Skip:NEAR ; ds_rs
GLOBAL Right_Reverse_Skip:NEAR ; ds_rrs
GLOBAL Right_Scale_Skip:NEAR ; ds_rss
GLOBAL Right_Scale_Reverse_Skip:NEAR ; ds_rsrs
GLOBAL Right_Scale_Skip:NEAR ; ds_rss
GLOBAL Right_Scale_Reverse_Skip:NEAR ; ds_rsrs
; DrawTable:
GLOBAL Draw_Normal:NEAR ; ds_dn
GLOBAL Draw_Reverse:NEAR ; ds_dr
GLOBAL Draw_Normal:NEAR ; ds_dn
GLOBAL Draw_Reverse:NEAR ; ds_dr
GLOBAL Draw_Scale:NEAR ; ds_ds
GLOBAL Draw_Scale_Reverse:NEAR ; ds_dsr
GLOBAL Draw_Scale:NEAR ; ds_ds
GLOBAL Draw_Scale_Reverse:NEAR ; ds_dsr
;************************* End of shape.inc ********************************


565
VQ/INCLUDE/WWLIB32/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,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 : 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;
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
short wBitSize;
short wChannels; //added BP for # of channels
} _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 */
extern "C" {
void sosCODECInitStream(_SOS_COMPRESS_INFO *);
unsigned long sosCODECCompressData(_SOS_COMPRESS_INFO *, unsigned long);
unsigned long sosCODECDecompressData(_SOS_COMPRESS_INFO *, unsigned long);
}
#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

129
VQ/INCLUDE/WWLIB32/SOSRES.H Normal file
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


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/>.
*/
/***************************************************************************
** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S **
***************************************************************************
* *
* Project Name : Westwood Library *
* *
* File Name : SOUND.H *
* *
* Programmer : Joe L. Bostic *
* *
* Start Date : September 1, 1993 *
* *
* Last Update : September 1, 1993 [JLB] *
* *
*-------------------------------------------------------------------------*
* Functions: *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
#ifndef SOUND_H
#define SOUND_H
#define HMI_DRIVER TRUE
#include "sos.h"
#include "soscomp.h"
/*
** Maximum number of sound effects that may run at once.
*/
#define MAX_SFX 4
/*
** Size of temp HMI low memory staging buffer.
*/
#define SFX_MINI_STAGE_BUFFER_SIZE (1024*4)
extern WORD _SoundVolume;
extern WORD _ScoreVolume;
#endif

View File

@@ -0,0 +1,35 @@
;
; 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/>.
;
; This is the control structure at the start of a loaded icon set. It must match
; the structure in ICONSET.C! This structure MUST be a multiple of 16 bytes long.
STRUC IControl_Type
Width DW ? ; Width in pixels (per icon).
Height DW ? ; Height in pixels (per icon).
Count DW ? ; Number of icons in this set.
Allocated DW ? ; Was this iconset allocated?
Size DD ? ; Size of entire iconset memory block.
Icons DD ? ; Offset from buffer start to icon data.
Palettes DD ? ; Offset from buffer start to palette data.
Remaps DD ? ; Offset from buffer start to remap index data.
TransFlag DD ? ; Offset for transparency flag data.
Map DD ? ; Icon map offset.
ENDS
ICON256 EQU 1


View File

@@ -0,0 +1,77 @@
;
; Command & Conquer Red Alert(tm)
; Copyright 2025 Electronic Arts Inc.
;
; This program is free software: you can redistribute it and/or modify
; it under the terms of the GNU General Public License as published by
; the Free Software Foundation, either version 3 of the License, or
; (at your option) any later version.
;
; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details.
;
; You should have received a copy of the GNU General Public License
; along with this program. If not, see <http://www.gnu.org/licenses/>.
;
;***************************************************************************
;** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S **
;***************************************************************************
;* *
;* Project Name : Westwood 32 bit Library *
;* *
;* File Name : SVGAPRIM.INC *
;* *
;* Programmer : Phil W. Gorrow *
;* *
;* Start Date : December 8, 1994 *
;* *
;* Last Update : December 8, 1994 [PWG] *
;* *
;*-------------------------------------------------------------------------*
; Externs from VIDEO.CPP module of the VIDEO library
GLOBAL BankTable :DWORD
GLOBAL VesaFunc :DWORD
GLOBAL XRes :DWORD
GLOBAL YRes :DWORD
GLOBAL CurrentMode :DWORD
global cpu_video_page :dword
global cpu_page_limit :dword
; Externs from VESA.ASM module of the SVGAPRIM library
GLOBAL Vesa_Asm_Set_Win :NEAR
GLOBAL Vesa_Asm_Next_Win :NEAR
; Externs from VGETPIX.ASM module of the SVGA/MCGAPRIM library
GLOBAL Vesa_Get_Pixel :NEAR
; Externs from VPUTTPIX.ASM module of the SVGA/MCGAPRIM library
GLOBAL Vesa_Put_Pixel :NEAR
; Externs from VCLEAR.ASM module of the MCGA/SVGAPRIM library
GLOBAL Vesa_Clear :NEAR
; Externs from VBITBLIT.ASM module of the MCGA/SVGAPRIM library
GLOBAL Linear_Blit_To_Vesa :NEAR
GLOBAL Vesa_Blit_To_Linear :NEAR
GLOBAL Vesa_Blit_To_Vesa :NEAR
; Externs from VTOBUFF.ASM module of the SVGA/MCGAPRIM library
GLOBAL Vesa_To_Buffer :NEAR
; Externs from VTOPAGE.ASM module of the SVGA/MCGAPRIM library
GLOBAL Vesa_Buffer_To_Page :NEAR
; Externs from VSCALE.ASM module of the SVGA/MCGAPRIM library
GLOBAL Linear_Scale_To_Vesa :NEAR
GLOBAL Vesa_Scale_To_Linear :NEAR
GLOBAL Vesa_Scale_To_Vesa :NEAR
; Externs from VSCALE.ASM module of the SVGA/MCGAPRIM library
GLOBAL Vesa_Print :NEAR

57
VQ/INCLUDE/WWLIB32/TILE.H Normal file
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/>.
*/
/***************************************************************************
** C O N F I D E N T I A L --- W E S T W O O D A S S O C I A T E S **
***************************************************************************
* *
* Project Name : Part of the TILE Library *
* *
* File Name : TILE.H *
* *
* Programmer : Barry W. Green *
* *
* Start Date : February 2, 1995 *
* *
* Last Update : February 2, 1995 [BWG] *
* *
*-------------------------------------------------------------------------*
* Functions: *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
#ifndef TILE_H
#define TILE_H
/*=========================================================================*/
/* The following prototypes are for the file: ICONSET.CPP */
/*=========================================================================*/
void * Load_Icon_Set(char const *filename, void *iconsetptr, long buffsize);
void Free_Icon_Set(void const *iconset);
long Get_Icon_Set_Size(void const *iconset);
int Get_Icon_Set_Width(void const *iconset);
int Get_Icon_Set_Height(void const *iconset);
void * Get_Icon_Set_Icondata(void const *iconset);
void * Get_Icon_Set_Trans(void const *iconset);
void * Get_Icon_Set_Remapdata(void const *iconset);
void * Get_Icon_Set_Palettedata(void const *iconset);
int Get_Icon_Set_Count(void const *iconset);
void * Get_Icon_Set_Map(void const *iconset);
#endif //TILE_H


151
VQ/INCLUDE/WWLIB32/TIMER.H Normal file
View File

@@ -0,0 +1,151 @@
/*
** Command & Conquer Red Alert(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/***************************************************************************
** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S **
***************************************************************************
* *
* Project Name : Timer Class Functions *
* *
* File Name : TIMER.H *
* *
* Programmer : Scott K. Bowen *
* *
* Start Date : July 6, 1994 *
* *
* Last Update : July 12, 1994 [SKB] *
* *
*-------------------------------------------------------------------------*
* Functions: *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
#ifndef TIMER_H
#define TIMER_H
/*=========================================================================*/
/* The following prototypes are for the file: TIMERA.ASM */
/*=========================================================================*/
//////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////// Externs /////////////////////////////////////////////
extern BOOL TimerSystemOn;
/*=========================================================================*/
typedef enum BaseTimerEnum {
BT_SYSTEM, // System timer (60 / second).
BT_USER // User controllable timer (? / second).
} BaseTimerEnum;
class TimerClass {
public:
// Constructor. Timers set before low level init has been done will not
// be able to be 'Started' or 'on' until timer system is in place.
TimerClass(BaseTimerEnum timer=BT_SYSTEM, BOOL start=FALSE);
// No destructor.
~TimerClass(void){}
//
long Set(long value, BOOL start=TRUE); // Set initial timer value.
long Stop(void); // Pause timer.
long Start(void); // Resume timer.
long Reset(BOOL start=TRUE); // Reset timer to zero.
long Time(void); // Fetch current timer value.
protected:
long Started; // Time last started (0 == not paused).
long Accumulated; // Total accumulated ticks.
private:
long (*Get_Ticks)(void); // System timer fetch.
};
inline long TimerClass::Reset(BOOL start)
{
return(Set(0, start));
}
class CountDownTimerClass : private TimerClass {
public:
// Constructor. Timers set before low level init has been done will not
// be able to be 'Started' or 'on' until timer system is in place.
CountDownTimerClass(BaseTimerEnum timer, long set, int on=FALSE);
CountDownTimerClass(BaseTimerEnum timer=BT_SYSTEM, int on=FALSE);
// No destructor.
~CountDownTimerClass(void){}
// Public functions
long Set(long set, BOOL start=TRUE); // Set count down value.
long Reset(BOOL start=TRUE); // Reset timer to zero.
long Stop(void); // Pause timer.
long Start(void); // Resume timer.
long Time(void); // Fetch current count down value.
protected:
long DelayTime; // Ticks remaining before countdown timer expires.
};
inline long CountDownTimerClass::Stop(void)
{
TimerClass::Stop();
return(Time());
}
inline long CountDownTimerClass::Start(void)
{
TimerClass::Start();
return(Time());
}
inline long CountDownTimerClass::Reset(BOOL start)
{
return (TimerClass::Reset(start));
}
//////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////// externs //////////////////////////////////////////
extern TimerClass TickCount;
extern CountDownTimerClass CountDown;
//////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////// Prototypes //////////////////////////////////////////
extern "C" {
long Get_System_Tick_Count(void);
long Get_User_Tick_Count(void);
void far Timer_Interrupt_Func(void);
// long Get_Num_Interrupts(unsigned int realmode);
}
/*=========================================================================*/
/* The following prototypes are for the file: TIMER.CPP */
/*=========================================================================*/
BOOL Init_Timer_System(unsigned int freq, int partial = FALSE);
BOOL Remove_Timer_System(VOID);
#endif // TIMER_H


1034
VQ/INCLUDE/WWLIB32/VBUFFER.H Normal file

File diff suppressed because it is too large Load Diff

210
VQ/INCLUDE/WWLIB32/VIDEO.H Normal file
View File

@@ -0,0 +1,210 @@
/*
** Command & Conquer Red Alert(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/***************************************************************************
** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S **
***************************************************************************
* *
* Project Name : 32 bit library *
* *
* File Name : VIDEO.H *
* *
* Programmer : Scott K. Bowen *
* *
* Start Date : August 3, 1994 *
* *
* Last Update : August 3, 1994 [SKB] *
* *
*-------------------------------------------------------------------------*
* Functions: *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
#ifndef VIDEO_H
#define VIDEO_H
#ifndef WWSTD_H
#include "wwstd.h"
#endif
/*=========================================================================*/
/* The machine can be in one of the following graphic modes. The global */
/* GraphicMode is set to one of these values. */
/*=========================================================================*/
#define CGA_MODE 4 // DOS 320x200 4 color mode
#define TGA_MODE 9 // TANDY 320x200 16 color mode
#define EGA_MODE 13 // DOS 320x200 16 color mode
#define MCGA_MODE 0x13 // DOS 320x200 256 color mode
#define VGA_MODE 0x13 // DOS 320x200 256 color mode
#define EEGA_MODE 14 // DOS 640x400 16 color mode
#define ETGA_MODE 9 // TANDY 640x400 16 color mode
#define HGA_MODE 7 // DOS 768x400 2 color mode
#define TXT_MODE 3 // DOS plain old color text mode
#define VESA_640X400_256 0x100 // VESA 640x400 256 color mode
#define VESA_640X480_256 0x101 // VESA 640x480 256 color mode
#define VESA_800X600_256 0x103 // VESA 800x600 256 color mode
#define VESA_1024X768_256 0x105 // VESA 1024x768 256 color mode
#define VESA_1280X400_256 0x107 // VESA 1280x400 256 color mode
#define VESA_TEXT_80X60 0x108 // VESA 80x60 text mode
#define VESA_TEXT_132X25 0x109 // VESA 132x25 text mode
#define VESA_TEXT_132X60 0x10C // VESA 132x60 text mode
#define RESET_MODE -1
#define UNINITIALIZED_MODE -1
#define VESA_MIN VESA_640X400_256
#define VESA_MAX VESA_TEXT_132X60
/*=========================================================================*/
/* Define the maximum number of bank entries */
/*=========================================================================*/
#define MAX_BANK_ENTRIES ((1280L*1024L)/65536L)
/*=========================================================================*
* VesaInfoType - General info 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 {
char Signature[4];
short Version;
REALPTR OEMString;
long Capabilities;
REALPTR AvailModes;
short TotalMemory;
char Reserved[236];
} VesaInfoType;
/*=========================================================================*
* VesaModeInfoType - Info 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 funcs valid in this mode *
* bit 3: 0 = monochrome, 1 = color *
* bit 4: 0 = text mode, 1 = graphics *
* WinA_Attributes - bit 0 = win exists, bit 1=readable, bit 2= writable *
* WinB_Attributes - bit 0 = win 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 {
short Attributes;
char WinA_Attributes;
char WinB_Attributes;
short WinGranularity;
short WinSize;
short WinA_Segment;
short WinB_Segment;
REALPTR WinFunc;
short BytesPerScanline;
short XRes;
short YRes;
char XCharSize;
char YCharSize;
char NumPlanes;
char BitsPerPixel;
char NumBanks;
char MemoryModel;
char BankSize;
char NumInputPages;
char Reserved;
char RedMaskSize;
char RedFieldPosition;
char GreenMaskSize;
char GreenFieldPosition;
char BlueMaskSize;
char BlueFieldPosition;
char RsvdMaskSize;
char RsvdFieldPosition;
char DirectColorModeInfo;
char pad[216];
} VesaModeInfoType;
extern "C" {
extern int GraphicMode;
extern long XRes;
extern long YRes;
extern long BankTable [];
extern REALPTR VesaFunc;
extern unsigned long RMVesaVector ;
extern unsigned long RMVesaRegs ;
}
/*=========================================================================*/
/* The following prototypes are for the file: VIDEO.CPP */
/*=========================================================================*/
int Get_Video_Mode(void);
int Set_Video_Mode(int mode);
void Vesa_Info(void);
void Vesa_Set_Window(long grain_num);
/*=========================================================================*/
/* The following prototypes are for the file: INITDLAY.CPP */
/*=========================================================================*/
extern VOID Init_Delay(VOID);
extern BOOL VertBlank;
/*=========================================================================*/
/* The following prototypes are for the file: VERTBLNK.ASM */
/*=========================================================================*/
extern "C" {
extern WORD Get_Vert_Blank(VOID);
extern VOID Wait_Vert_Blank(BOOL blank);
}
/*=========================================================================*/
#endif // VIDEO_H

View File

@@ -0,0 +1,96 @@
/*
** Command & Conquer Red Alert(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/***************************************************************************
** C O N F I D E N T I A L --- W E S T W O O D A S S O C I A T E S **
***************************************************************************
* *
* Project Name : Part of the WINDOWS Library *
* *
* File Name : WINDOWS.H *
* *
* Programmer : Barry W. Green *
* *
* Start Date : February 16, 1995 *
* *
* Last Update : February 16, 1995 [BWG] *
* *
*-------------------------------------------------------------------------*
* Functions: *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
#ifndef WINDOWS_H
#define WINDOWS_H
/*=========================================================================*/
/* The following prototypes are for the file: WINHIDE.CPP */
/*=========================================================================*/
void Window_Hide_Mouse(int window);
void Window_Show_Mouse(void);
/*=========================================================================*/
/* The following prototypes are for the file: WINDOWS.CPP */
/*=========================================================================*/
void Standard_More_Prompt(char const *prompt, int space, int fcolor, int bcolor);
void Set_More_Prompt(char const *prompt, int space, int fcolor, int bcolor);
void Set_More_On(void);
void Set_More_Off(void);
int Change_Window(int windnum);
int Change_New_Window(int windnum);
void New_Window(void);
void Window_Int_Print(int num);
void Window_Print(char const string[], ...);
/*
** The WindowList[][8] array contains the following elements. Use these
** defines when accessing the WindowList.
*/
typedef enum {
WINDOWX, // X byte position of left edge.
WINDOWY, // Y pixel position of top edge.
WINDOWWIDTH, // Width in bytes of the window.
WINDOWHEIGHT, // Height in pixels of the window.
WINDOWFCOL, // Default foreground color.
WINDOWBCOL, // Default background color.
WINDOWCURSORX, // Current cursor X position (in rows).
WINDOWCURSORY, // Current cursor Y position (in lines).
WINDOWPADDING=0x1000
} WindowIndexType;
extern int WindowList[][8];
extern int WindowColumns;
extern int WindowLines;
extern int WindowWidth;
extern unsigned int WinB;
extern unsigned int WinC;
extern unsigned int WinX;
extern unsigned int WinY;
extern unsigned int WinCx;
extern unsigned int WinCy;
extern unsigned int WinH;
extern unsigned int WinW;
extern unsigned int Window;
extern int MoreOn;
extern char *TXT_MoreText;
extern void (*Window_More_Ptr)(char const *, int, int, int);
#endif //WINDOWS_H


166
VQ/INCLUDE/WWLIB32/WSA.H Normal file
View File

@@ -0,0 +1,166 @@
/*
** Command & Conquer Red Alert(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/***************************************************************************
** C O N F I D E N T I A L --- W E S T W O O D A S S O C I A T E S **
***************************************************************************
* *
* Project Name : WSA 32bit LIbrary *
* *
* File Name : WSA.H *
* *
* Programmer : Scott K. Bowen *
* *
* Start Date : May 23, 1994 *
* *
* Last Update : May 25, 1994 [SKB] *
* *
*-------------------------------------------------------------------------*
* Functions: *
* Open_Animation -- file name and flags, system allocates buffer. *
* Open_Animation -- file name, flags, palette, system allocates buffer. *
* Open_Animation -- file_name, graphic buffer, flags. *
* Open_Animation -- file name, bufferclass, flags, palette. *
* Open_Animation -- filename, ptr, size, flags, no palette. *
* Animate_Frame -- Animate a frame to a page with magic colors. *
* Animate_Frame -- Animate a frame to a viewport with magic colors. *
* Animate_Frame -- Animate a frame to a page. *
* Animate_Frame -- Animate a frame to a viewport. *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
#ifndef WSA_H
#define WSA_H
#ifndef WWSTD_H
#include "wwstd.h"
#endif
#ifndef GBUFFER_H
#include "gbuffer.h"
#endif
#ifndef VBUFFER_H
#include "vbuffer.h"
#endif
//lint -strong(AJX,WSAType)
typedef enum {
WSA_NORMAL, // Normal WSA animation
WSA_GHOST = 0x1000, // Or'd with the above flags to get ghosting
WSA_PRIORITY2 = 0x2000, // Copy using a priority (or in the priority)
WSA_TRANS = 0x4000, // Copy frame, ignoring transparent colors
WSA_PRIORITY = 0x8000 // Copy using a priority (or in the priority)
} WSAType;
//lint -strong(AJX,WSAOpenType)
typedef enum {
WSA_OPEN_FROM_MEM = 0x0000, // Try to load entire anim into memory.
WSA_OPEN_INDIRECT = 0x0000, // First animate to internal buffer, then copy to page/viewport.
WSA_OPEN_FROM_DISK = 0x0001, // Force the animation to be disk based.
WSA_OPEN_DIRECT = 0x0002, // Animate directly to page or viewport.
// These next two have been added for the 32 bit library to give a better idea of what is
// happening. You may want to animate directly to the destination or indirectly to the
// destination by using the animations buffer. Indirecly is best if the dest is a seenpage
// and the animation is not linear or if the destination is modified between frames.
WSA_OPEN_TO_PAGE = WSA_OPEN_DIRECT ,
WSA_OPEN_TO_BUFFER= WSA_OPEN_INDIRECT ,
} WSAOpenType;
/*=========================================================================*/
/* The following prototypes are for the file: WSA.CPP */
/*=========================================================================*/
VOID * cdecl Open_Animation(BYTE const *file_name, BYTE *user_buffer, LONG user_buffer_size, WSAOpenType user_flags, UBYTE *palette=NULL);
VOID cdecl Close_Animation( VOID *handle );
BOOL cdecl Animate_Frame(VOID *handle, GraphicViewPortClass& view,
WORD frame_number, WORD x_pixel=0, WORD y_pixel=0,
WSAType flags_and_prio = WSA_NORMAL, VOID *magic_cols=NULL, VOID *magic=NULL);
WORD cdecl Get_Animation_Frame_Count(VOID *handle);
BOOL cdecl Animate_Frame(VOID *handle, VideoViewPortClass& view,
WORD frame_number, WORD x_pixel=0, WORD y_pixel=0,
WSAType flags_and_prio = WSA_NORMAL, VOID *magic_cols=NULL, VOID *magic=NULL);
WORD cdecl Get_Animation_Frame_Count(VOID *handle);
WORD cdecl Get_Animation_X(VOID const *handle);
WORD cdecl Get_Animation_Y(VOID const *handle);
WORD cdecl Get_Animation_Width(VOID const *handle);
WORD cdecl Get_Animation_Height(VOID const *handle);
WORD cdecl Get_Animation_Palette(VOID const *handle);
ULONG cdecl Get_Animation_Size(VOID const *handle);
/***************************************************************************
* OPEN_ANIMATION -- file name, flags, palette, system allocates buffer. *
* *
* *
* INPUT: BYTE *file_name - name of file to open. *
* WSAOpenType user_flags - flags on how to open. *
* UBYTE *palette - pointer to a palette buffer to fill. *
* *
* OUTPUT: VOID *pointer to animation data. Must be used for all *
* other WSA calls. *
* *
* WARNINGS: *
* *
* HISTORY: *
* 05/24/1994 SKB : Created. *
*=========================================================================*/
inline VOID *cdecl Open_Animation(BYTE *file_name, WSAOpenType user_flags, UBYTE *palette=NULL)
{
return (Open_Animation(file_name, NULL, 0L, user_flags, palette));
}
/***************************************************************************
* OPEN_ANIMATION -- file_name, bufferclass, flags. *
* *
* *
* INPUT: BYTE *file_name - name of file to open. *
* GraphicBufferClass - pointer to a buffer. *
* WSAOpenType user_flags - flags on how to open. *
* UBYTE *palette - pointer to a palette buffer to fill. *
* *
* OUTPUT: VOID *pointer to animation data. Must be used for all *
* other WSA calls. *
* *
* WARNINGS: *
* *
* HISTORY: *
* 05/24/1994 SKB : Created. *
*=========================================================================*/
inline VOID *cdecl Open_Animation(BYTE *file_name, BufferClass& buffer, WSAOpenType user_flags, UBYTE *palette=NULL)
{
return (Open_Animation(file_name, (BYTE *)buffer.Get_Buffer(), buffer.Get_Size(), user_flags, palette));
}
/*=========================================================================*/
/* The following prototypes are for the file: LP_ASM.ASM */
/*=========================================================================*/
extern "C" {
UWORD Apply_XOR_Delta(BYTE *source_ptr, BYTE *delta_ptr);
VOID Apply_XOR_Delta_To_Page_Or_Viewport(VOID *target, VOID *delta, WORD width, WORD nextrow, WORD copy);
}
#endif // WSA_H

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/>.
*/
/***************************************************************************
** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S **
***************************************************************************
* *
* Project Name : WWLIB32 User include file *
* *
* File Name : WWLIB32.H *
* *
* Programmer : Scott K. Bowen *
* *
* Start Date : August 3, 1994 *
* *
* Last Update : August 3, 1994 [SKB] *
* *
*-------------------------------------------------------------------------*
* Functions: *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
#ifndef WWLIB32_H
#define WWLIB32_H
#include <wwstd.h>
#include <audio.h>
#include <buffer.h>
#include <descmgmt.h>
#include <dipthong.h>
#include <file.h>
#include <font.h>
#include <gbuffer.h>
#include <iff.h>
#include <keyboard.h>
#include <mcgaprim.h>
#include <misc.h>
#include <mono.h>
#include <palette.h>
#include <playcd.h>
#include <shape.h>
#include <tile.h>
#include <timer.h>
#include <video.h>
#include <vbuffer.h>
#include <windows.h>
#include <wsa.h>
#include <wwmem.h>
#endif // WWLIB32_H


View File

@@ -0,0 +1,69 @@
/*
** Command & Conquer Red Alert(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/***************************************************************************
** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S **
***************************************************************************
* *
* Project Name : Memory System *
* *
* File Name : MEM.H *
* *
* Programmer : Jeff Wilson *
* *
* Start Date : April 4, 1994 *
* *
* Last Update : September 8, 1994 [IML] *
* *
*-------------------------------------------------------------------------*
* Functions: *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
#ifndef WWMEM_H
#define WWMEM_H
#include "wwstd.h"
#include "new.h"
#include "memflag.h"
// Defines
//==============
/*=========================================================================*/
/* The following prototypes are for the file: MEM.CPP */
/*=========================================================================*/
int Mem_Init(void *buffer, long size);
void *Mem_Alloc(void *poolptr, long lsize, unsigned long id);
int Mem_Free(void *poolptr, void *buffer);
void Mem_Reference(void *node);
void Mem_Lock_Block(void *node);
void Mem_In_Use(void *node);
void *Mem_Find(void *poolptr, unsigned long id);
unsigned long Mem_Get_ID(void *node);
void *Mem_Find_Oldest(void *poolptr);
void *Mem_Free_Oldest(void *poolptr);
long Mem_Pool_Size(void *poolptr);
long Mem_Avail(void *poolptr);
long Mem_Largest_Avail(void *poolptr);
void Mem_Cleanup(void *poolptr);
#endif


View File

@@ -0,0 +1,43 @@
;
; Command & Conquer Red Alert(tm)
; Copyright 2025 Electronic Arts Inc.
;
; This program is free software: you can redistribute it and/or modify
; it under the terms of the GNU General Public License as published by
; the Free Software Foundation, either version 3 of the License, or
; (at your option) any later version.
;
; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details.
;
; You should have received a copy of the GNU General Public License
; along with this program. If not, see <http://www.gnu.org/licenses/>.
;
;***************************************************************************
;** C O N F I D E N T I A L --- W E S T W O O D A S S O C I A T E S **
;***************************************************************************
;* *
;* Project Name : Memory System *
;* *
;* File Name : WWMEM.INC *
;* *
;* Programmer : Ian M. Leslie *
;* *
;* Start Date : August 11, 1994 *
;* *
;* Last Update : August 17, 1994 [IML] *
;* *
;*-------------------------------------------------------------------------*
;* Functions: *
;* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *
MEM_NORMAL EQU 0000h ; Default memory (normal).
MEM_NEW EQU 0001h ; Called by the operator new and was overloaded.
MEM_CLEAR EQU 0002h ;
GLOBAL @Alloc$qul14MemoryFlagType:PROC
GLOBAL @Free$qpv:PROC

308
VQ/INCLUDE/WWLIB32/WWSTD.H Normal file
View File

@@ -0,0 +1,308 @@
/*
** Command & Conquer Red Alert(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/***************************************************************************
** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S **
***************************************************************************
* *
* Project Name : wwstd.h *
* *
* File Name : WWLIB.H *
* *
* Programmer : Jeff Wilson *
* *
* Start Date : March 1, 1994 *
* *
* Last Update : March 1, 1994 [] *
* *
*-------------------------------------------------------------------------*
* Functions: *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
#ifndef WWSTD_H
#define WWSTD_H
// Note: SKB 4/11/94
// Before this library is done, this needs to be able to be set to TRUE.
// Once it is, the FALSE parts should be removed from the source code.
#define LIB_EXTERNS_RESOLVED FALSE
#include <stdio.h>
#include <stdlib.h>
#include <dos.h>
#include <bios.h>
//================================
// TRUE and FALSE are defined in pltypes.h
#ifndef IBM
#define IBM TRUE
#endif
#ifndef AMIGA
#define AMIGA FALSE
#endif
#ifndef SEGA
#define SEGA FALSE
#endif
/*
** Common constants used in normal code.
*/
#define ERROR -1
#ifdef NULL
#undef NULL
#endif
#ifndef NULL
#define NULL 0L
#endif
#ifdef VOID
#undef VOID
#endif
#define PRIVATE static
#define PUBLIC /* Routines & data don't have a specifier */
#ifdef __cplusplus
#define __CPPARGS ...
#else
#define __CPPARGS
#endif
// This macro will get the size (in elements) of the specified array.
#ifdef GET_SIZE
#undef GET_SIZE
#endif
#define GET_SIZE(a) ((sizeof(a) / sizeof(*a)))
// Returns the absolute value of the number.
#ifdef ABS
#undef ABS
#endif
template<class T> T ABS(T a)
{
return (a < 0) ? -a : a;
}
int ABS(int);
long ABS(long);
// Returns the minimum of the two numbers.
#ifdef MIN
#undef MIN
#endif
template<class T> T MIN(T a, T b)
{
return (b < a) ? b : a;
};
short MIN(short, short);
int MIN(int, int);
long MIN(long, long);
// Returns the maximum of the two numbers.
#ifdef MAX
#undef MAX
#endif
template<class T> T MAX(T a, T b)
{
return (b > a) ? b : a;
};
short MAX(short, short);
int MAX(int, int);
long MAX(long, long);
// Returns the low word of a long
#define LOW_WORD(a) ((unsigned short)((long)(a) & 0x0000FFFFL))
// Returns the high word of a long
#define HIGH_WORD(a) ((unsigned long)(a) >> 16)
// Merges to shorts to become a long
#define MAKE_LONG(a,b) (((long)(a) << 16) | (long)((b)&0x0000FFFFL))
/*
** Macro allows our routines to act like
** sprintf etc..
*/
#ifdef AssembleTo
#undef AssembleTo
#endif
#define AssembleTo(dest,fmt)\
{\
va_list argptr;\
if (fmt != (dest))\
{\
va_start (argptr, fmt);\
vsprintf ((dest), fmt, argptr);\
va_end (argptr);\
}\
}
// type definitions
//=======================================
typedef void VOID;
//==================================================
// Pharlape defines these for use so we use their
// typedefs!
// typedef unsigned char BOOL;
// typedef signed long LONG;
// typedef unsigned long ULONG;
//==================================================
#ifndef PRIVATE
#define PRIVATE static
#endif
// The purpose of the INT and UINT is for efficiency. It says that while a short int (16 bit)
// has enough precision, it is more efficient to pass in an int (32 bits). For efficiency, most
// WORD and UWORD should be an INT or UINT, especially on the stack and structures that will
// not be in large arrays. When size efficiency is more important then speed, use WORD UWORD.
#define VOID void
#pragma warn -eas
#define TRUE 1
#define FALSE 0
#define BOOL int // 32 bits for speed. use CHAR for size optimizations.
#ifndef HMI_DRIVER
#define INT int
#define UINT unsigned int
#define BYTE char
#define UBYTE unsigned char
#define UCHAR unsigned char
#define WORD signed short
#define UWORD unsigned short
#define USHORT unsigned short
#define LONG signed long
#define ULONG unsigned long
#define REALPTR unsigned long
#define FARPTR char far *
#endif
/*
** The type of processor running on this system as
** returned by Processor().
*/
#define PROC_80386 0
#define PROC_80486 1
#define PROC_PENTIUM 2
// Inline Routines
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
//
// These Template functions are generally used
// by classes when they havce over loaded > and <.
//
#ifdef __cplusplus
template<class T> T Min(T a, T b)
{
return (a<b ? a : b);
}
template<class T> inline T Max(T a, T b)
{
return (a>b ? a : b);
}
template<class T> T Abs(T a)
{
return ((a<0) ? -(a) : a);
}
template<class T> VOID minimize(T &a, T b)
{
if( b<a )
a=b;
}
template<class T> VOID maximize(T &a, T b)
{
if( b>a )
a=b;
}
#endif
/*
** Macros that control bit settings in a variable.
*/
#define Bit_Flags_On(a,b) a |= (b)
#define Bit_Flags_Off(a,b) a &= (~(b))
#define Bit_Flags_Value(a,b) (a & (b))
#define Bit_Flags_Flip(a,b) a ^= (b)
// Template replacements for the user defines above
#ifdef __cplusplus
template<class T> VOID BitFlagsOn(T &a, T b)
{
a |= (b);
}
template<class T> VOID BitFlagsOff(T &a, T b)
{
a &= (~(b));
}
template<class T> T BitFlagsValue(T a, T b)
{
return (a & (b));
}
template<class T> VOID BitFlagsFlip(T &a, T b)
{
a ^= (b);
}
#endif
typedef enum {
TBLACK,
PURPLE,
CYAN,
GREEN,
LTGREEN,
YELLOW,
PINK,
BROWN,
RED,
LTCYAN,
LTBLUE,
BLUE,
BLACK,
GREY,
LTGREY,
WHITE,
COLOR_PADDING=0x1000
} ColorType;
#endif

183
VQ/INCLUDE/WWLIB32/_FILE.H Normal file
View File

@@ -0,0 +1,183 @@
/*
** Command & Conquer Red Alert(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/***************************************************************************
;** C O N F I D E N T I A L --- W E S T W O O D A S S O C I A T E S **
;***************************************************************************
;* *
;* Project Name : Library - Filio header stuff. *
;* *
;* File Name : FILE.H *
;* *
;* Programmer : Scott K. Bowen *
;* *
;* Start Date : September 13, 1993 *
;* *
;* Last Update : April 11, 1994 *
;* *
;*-------------------------------------------------------------------------*
;* Functions: *
;* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
#ifndef FILE_H
#include "file.h"
#endif
#ifndef _FILE_H
#define _FILE_H
/*=========================================================================*/
/* Fileio defines */
/*=========================================================================*/
#define LIB_CDROM TRUE
#define MODE_OLDFILE (O_RDONLY | O_BINARY)
#define MODE_NEWFILE (O_WRONLY | O_BINARY | O_CREAT | O_TRUNC)
#define MODE_READWRITE (O_RDWR | O_BINARY)
#define FILEOPENERROR -1
#define FILEOPEN(f,m) ibm_open(f, m, (((UWORD) m) == MODE_OLDFILE) ? S_IREAD : (S_IREAD | S_IWRITE))
#define FILECLOSE(fd) ibm_close(fd)
#define FILEREAD(f,b,n) ibm_read(f,b,(WORD)(n))
#define FILEWRITE(f,b,n) ibm_write(f,b,(WORD)(n))
#define FILESEEK(f,b,n) ibm_lseek(f, b, n)
#define FILEDELETE(f) ibm_unlink(f)
#define CHANGEDIR(p) ibm_chdir(p)
#define FILENAMESIZE 13
#define IO_CHUNK_SIZE 0xfff0UL
/*
** Maximum number of file handles
*/
#define TABLE_MAX 20
/*=========================================================================*/
/* The file handle table */
/*=========================================================================*/
typedef struct {
BOOL Empty; // Is this handle empty?
WORD Handle; // DOS file handle (0 = resident).
LONG Pos; // Current file position.
LONG Start; // Offset of file from pointer.
WORD Index; // FileData[] index.
WORD Mode; // Access mode (WW).
BYTE *Name; // File name pointer.
} FileHandleType;
/*=========================================================================*/
/* The following prototypes are for the file: FILEIO.CPP */
/*=========================================================================*/
WORD ibm_getdisk(VOID);
WORD ibm_setdisk(WORD drive);
WORD ibm_close(WORD handle);
WORD ibm_unlink(BYTE const *name);
LONG ibm_lseek(WORD handle, LONG offset, WORD where);
UWORD ibm_read(WORD handle, VOID *ptr, UWORD bytes);
UWORD ibm_write(WORD handle, VOID *ptr, UWORD bytes);
WORD ibm_open(BYTE const *name, UWORD mode, WORD attrib);
WORD ibm_chdir(BYTE const *path);
/*=========================================================================*/
/* The following prototypes are for the file: FILELIB.CPP */
/*=========================================================================*/
WORD cdecl Do_Open_Error(FileErrorType errormsgnum, BYTE const *file_name);
VOID cdecl Do_IO_Error(FileErrorType errormsgnum, BYTE const *filename);
LONG cdecl Read_File_With_Recovery( WORD handle, VOID *buf, UWORD bytes );
WORD cdecl Open_File_With_Recovery( BYTE const *file_name, UWORD mode );
BOOL cdecl Cache_File(WORD index, WORD file_handle);
/*=========================================================================*/
/* The following prototypes are for the file: DEVICES.ASM */
/*=========================================================================*/
#ifdef __cplusplus
extern "C" {
#endif
extern VOID Get_Devices(VOID);
extern WORD Is_Device_Real(WORD device);
#ifdef __cplusplus
}
#endif
/*=========================================================================*/
/* The following prototypes are for the file: DEVTABLE.ASM */
/*=========================================================================*/
#ifdef __cplusplus
extern "C" {
#endif
extern VOID Init_Device_Table(BYTE *table);
extern WORD Max_Device(VOID);
#ifdef __cplusplus
}
#endif
/*=========================================================================*/
/* The following prototypes are for the file: HARDERR.ASM */
/*=========================================================================*/
#ifdef __cplusplus
extern "C" {
#endif
extern VOID Install_Hard_Error_Handler(VOID);
extern VOID Remove_Hard_Error_Handler(VOID);
#ifdef __cplusplus
}
#endif
/*=========================================================================*/
/* Globale variables in the fileio system. */
/*=========================================================================*/
extern BYTE CallingDOSInt;
extern "C" extern BYTE MaxDevice,DefaultDrive;
extern BYTE MultiDriveSearch;
extern FileDataType *FileDataPtr;
extern FileHandleType FileHandleTable[TABLE_MAX];
extern UWORD NumFiles; // Number of files, except PAK, in file table.
extern UWORD NumPAKFiles; // Number of PAK files in filetable.
extern VOID *FileCacheHeap; // Pointer to the cache in memory.
extern WORD DiskNumber;
extern WORD MaxDirNum;
/*=========================================================================*/
#endif // _FILE_H

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