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

1220
VQ/VQA32/AUDIO.BAK1 Normal file

File diff suppressed because it is too large Load Diff

1246
VQ/VQA32/AUDIO.BAK2 Normal file

File diff suppressed because it is too large Load Diff

1308
VQ/VQA32/AUDIO.CPP Normal file

File diff suppressed because it is too large Load Diff

9
VQ/VQA32/BCC32.CFG Normal file
View File

@@ -0,0 +1,9 @@
-c
-3
-d
-H=c:\projects\vqa32\obj\headers.sym
-wpro
-weas
-wpre
-IC:\PROJECTS\INCLUDE;C:\DEV\BC4\INCLUDE;C:\DEV\TNT\INCLUDE
-DPHARLAP_TNT=1

400
VQ/VQA32/CAPTION.CPP Normal file
View File

@@ -0,0 +1,400 @@
/*
** 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
* VQA player library (32 bit protected mode)
*
* FILE
* caption.c
*
* DESCRIPTION
* Text caption process/display manager.
*
* PROGRAMMER
* Denzil E. Long, Jr.
*
* DATE
* July 26, 1995
*
****************************************************************************/
#include <mem.h>
#include <malloc.h>
#include <vqm32\font.h>
#include <vqm32\text.h>
#include <vqm32\graphics.h>
#include <vqm32\captoken.h>
#include "caption.h"
/*---------------------------------------------------------------------------
* PRIVATE DECLARATIONS
*-------------------------------------------------------------------------*/
#define NUM_NODES 3
/* Function prototypes. */
static CaptionNode *AddCaptionNode(CaptionList *list, CaptionText *captext);
static void RemCaptionNode(CaptionList *list, CaptionNode *node);
/****************************************************************************
*
* NAME
* OpenCaptions - Initialize the caption system.
*
* SYNOPSIS
* OpenCaptions(Captions, Font)
*
* CaptionInfo *OpenCaptions(void *, void *);
*
* FUNCTION
* Allocate and initialize resources used by the caption system.
*
* INPUTS
* Captions - Captions to process.
* Font - Font to use to display captions.
*
* RESULT
* CaptionInfo - Caption information structure.
*
* SEE ALSO
* CloseCaption
*
****************************************************************************/
CaptionInfo *OpenCaptions(void *captions, void *font)
{
CaptionInfo *cap = NULL;
CaptionNode *node;
FontInfo *fi;
long i;
/* Allocate memory for the captioning system. */
cap = (CaptionInfo *)malloc(sizeof(CaptionInfo) + (sizeof(CaptionNode)
* NUM_NODES));
if (cap != NULL) {
memset(cap,0,(sizeof(CaptionInfo) + (sizeof(CaptionNode) * NUM_NODES)));
cap->Buffer = captions;
cap->Next = (CaptionText *)captions;
/* Initialize font */
fi = (FontInfo *)((char *)font + ((Font *)font)->InfoBlk);
cap->Font = font;
cap->FontHeight = fi->MaxHeight;
cap->FontWidth = fi->MaxWidth;
/* Initialize list header. */
cap->List.Head = (CaptionNode *)&cap->List.Tail;
cap->List.Tail = NULL;
cap->List.TailPred = (CaptionNode *)&cap->List.Head;
/* Link nodes. */
node = (CaptionNode *)((char *)cap + sizeof(CaptionInfo));
for (i = 0; i < NUM_NODES; i++) {
node->Succ = cap->List.Head;
cap->List.Head = node;
node->Pred = (CaptionNode *)&cap->List.Head;
node->Succ->Pred = node;
/* Next node. */
node = (CaptionNode *)((char *)node + sizeof(CaptionNode));
}
}
return (cap);
}
/****************************************************************************
*
* NAME
* CloseCaptions - Shutdown the caption system.
*
* SYNOPSIS
* CloseCaptions(CaptionInfo)
*
* void CloseCaptions(CaptionInfo *);
*
* FUNCTION
* Free the resources allocated by the caption system.
*
* INPUTS
* CaptionInfo - Caption information structure.
*
* RESULT
* NONE
*
* SEE ALSO
* OpenCaptions
*
****************************************************************************/
void CloseCaptions(CaptionInfo *cap)
{
free(cap);
}
/****************************************************************************
*
* NAME
* DoCaption - Process and display caption text.
*
* SYNOPSIS
* DoCaption(Captions, Frame)
*
* void DoCaption(CaptionInfo *, unsigned long);
*
* FUNCTION
* Process the caption events.
*
* INPUTS
* Captions - Pointer to CaptionInfo structure.
* Frame - Current frame number being processed.
*
* RESULT
* NONE
*
****************************************************************************/
void DoCaptions(CaptionInfo *cap, unsigned long frame)
{
CaptionText *captext;
CaptionNode *node;
void const *oldfont;
long width;
long i;
/* Initialize variables. */
oldfont = Set_Font((char *)cap->Font);
/*-------------------------------------------------------------------------
* Process the captions that are on the active queue.
*-----------------------------------------------------------------------*/
node = cap->List.Head;
while ((node->Succ != NULL) && (node->Flags & CNF_USED)) {
captext = node->Captext;
/* Clear the any previous captions that have expired. */
if (captext->OffFrame <= frame) {
Fill_Rect(captext->Xpos, captext->Ypos,
(captext->Xpos + node->BoundW - 1),
(captext->Ypos + node->BoundH - 1), 0);
/* Remove the caption from the active list. */
node = node->Pred;
RemCaptionNode(&cap->List, node->Succ);
} else {
if (captext->CPF != 0) {
/* If a NULL terminator is not found then display the next set of
* characters, otherwise remove the node.
*/
if (*node->Char != 0) {
Set_Font_Palette_Range(&captext->BgPen, 0, 1);
for (i = 0; i < captext->CPF; i++) {
/* Check for terminator. */
if (*node->Char == 0) {
captext->CPF = 0;
break;
}
/* Check for newline. */
else if (*node->Char == 0x0D) {
node->Char++;
node->CurX = captext->Xpos;
node->CurY += cap->FontHeight;
node->BoundH += cap->FontHeight;
}
Draw_Char(*node->Char, node->CurX, node->CurY);
node->CurX += Char_Pixel_Width(*node->Char);
node->Char++;
}
}
} else if (captext->Flags & CTF_FLASH) {
if (frame & 4) {
Fill_Rect(captext->Xpos, captext->Ypos,
(captext->Xpos + node->BoundW - 1),
(captext->Ypos + node->BoundH - 1), 0);
} else {
Text_Print(captext->Text, captext->Xpos, captext->Ypos,
captext->FgPen, captext->BgPen);
}
}
}
/* Next node. */
node = node->Succ;
}
/*-------------------------------------------------------------------------
* Process any captions that are waiting to be activated.
*-----------------------------------------------------------------------*/
captext = cap->Next;
while (captext->OnFrame <= frame) {
width = String_Pixel_Width(captext->Text);
switch (captext->Flags & CTF_JUSTIFY) {
case CTF_RIGHT:
captext->Xpos = (319 - width);
break;
case CTF_LEFT:
captext->Xpos = 0;
break;
case CTF_CENTER:
captext->Xpos = (160 - (width / 2));
break;
default:
break;
}
/* Display the text and record its bounding box. */
if (captext->CPF == 0) {
i = Text_Print(captext->Text, captext->Xpos, captext->Ypos,
captext->FgPen, captext->BgPen);
node = AddCaptionNode(&cap->List, captext);
node->BoundW = width;
node->BoundH = (cap->FontHeight * i);
} else {
node = AddCaptionNode(&cap->List, captext);
node->BoundW = width;
node->BoundH = cap->FontHeight;
}
/* Next */
cap->Next = (CaptionText *)(((char *)captext) + captext->Size);
captext = cap->Next;
}
Set_Font(oldfont);
}
/****************************************************************************
*
* NAME
* AddCaptionNode - Add a caption to the processing list.
*
* SYNOPSIS
* Node = AddCaptionNode(List, Caption)
*
* CaptionNode *AddCaptionNode(CaptionList *, CaptionText *);
*
* FUNCTION
* Add a caption the caption processing list.
*
* INPUTS
* List - Caption processing list.
* Caption - Caption to add to the list.
*
* RESULT
* Node - Pointer to node, otherwise NULL if error.
*
****************************************************************************/
static CaptionNode *AddCaptionNode(CaptionList *list, CaptionText *captext)
{
CaptionNode *node = NULL;
/* If this list is not full. */
node = list->TailPred;
if (!(node->Flags & CNF_USED)) {
/* Remove the node from the tail. */
node->Pred->Succ = node->Succ;
list->TailPred = node->Pred;
node->Flags |= CNF_USED;
node->Captext = captext;
node->Char = captext->Text;
node->CurX = captext->Xpos;
node->CurY = captext->Ypos;
/* Add the node to the head. */
node->Succ = list->Head;
list->Head = node;
node->Pred = (CaptionNode *)&list->Head;
node->Succ->Pred = node;
}
return (node);
}
/****************************************************************************
*
* NAME
* RemCaptionNode - Remove a caption from the processing list.
*
* SYNOPSIS
* RemCaptionNode(List, Node)
*
* void RemCaptionNode(CaptionList *, CaptionNode *);
*
* FUNCTION
* Remove the caption from the processing list. Mark the node as unused
* and put it at the tail of the list.
*
* INPUTS
* List - Caption processing list.
* Node - Caption node to remove.
*
* RESULT
* NONE
*
****************************************************************************/
static void RemCaptionNode(CaptionList *list, CaptionNode *node)
{
/* If the nodes successor is null then we are at the tail. */
if (node->Succ != NULL) {
/* Mark the node as unused. */
node->Flags = 0;
/* Relink the node to the tail. */
node->Succ->Pred = node->Pred;
node->Pred->Succ = node->Succ;
node->Succ = (CaptionNode *)&list->Tail;
node->Pred = list->TailPred;
list->TailPred->Succ = node;
list->TailPred = node;
}
}

121
VQ/VQA32/CAPTION.H Normal file
View File

@@ -0,0 +1,121 @@
/*
** Command & Conquer Red Alert(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef VQACAPTION_H
#define VQACAPTION_H
/****************************************************************************
*
* C O N F I D E N T I A L -- W E S T W O O D S T U D I O S
*
*----------------------------------------------------------------------------
*
* PROJECT
* VQA player library (32 bit protected mode)
*
* FILE
* caption.h
*
* DESCRIPTION
* Text caption definitions.
*
* PROGRAMMER
* Denzil E. Long, Jr.
*
* DATE
* July 26, 1995
*
****************************************************************************/
/*---------------------------------------------------------------------------
* STRUCTURES AND RELATED DEFINITIONS
*-------------------------------------------------------------------------*/
/* CaptionNode: Node describing a caption to process.
*
* Succ - Pointer to the next node in the list (successor).
* Pred - Pointer to the previous node in the list (predecessor).
* Flags - Status flags.
* CapText - Pointer to the CaptionText being processed.
* Char - Pointer to current character in the string.
* CurX - Current X position.
* CurY - Current Y position.
* BoundW - Bounding width of text.
* BoundH - Bounding height of text.
*/
typedef struct _CaptionNode {
struct _CaptionNode *Succ;
struct _CaptionNode *Pred;
unsigned short Flags;
CaptionText *Captext;
char *Char;
unsigned short CurX;
unsigned short CurY;
unsigned short BoundW;
unsigned short BoundH;
} CaptionNode;
/* CaptionNode flag definitions. */
#define CNB_USED 0 /* This node is being used. */
#define CNF_USED (1<<CNB_USED)
/* CaptionList: Double linked list of outstanding captions to process.
*
* Head - Pointer to the first node in the list.
* Tail - Always NULL
* TailPred - Pointer to the last node in the list.
*/
typedef struct _CaptionList {
CaptionNode *Head;
CaptionNode *Tail;
CaptionNode *TailPred;
} CaptionList;
/* CaptionInfo:
*
* Next - Pointer to the next caption to be processed.
* List - List of pending captions to process.
* Font - Font to use for this caption.
* BoundX - X position of bounding box.
* BoundY - Y position of bounding box.
* BoundW - Width of bounding box.
* BoundH - Height of bounding box.
* Buffer - Caption chunk buffer.
*/
typedef struct _CaptionInfo {
CaptionText *Next;
CaptionList List;
void *Font;
char FontHeight;
char FontWidth;
void *Buffer;
} CaptionInfo;
/*---------------------------------------------------------------------------
* FUNCTION PROTOTYPES
*-------------------------------------------------------------------------*/
CaptionInfo *OpenCaptions(void *captions, void *font);
void CloseCaptions(CaptionInfo *cap);
void DoCaptions(CaptionInfo *cap, unsigned long frame);
#endif /* VQACAPTION_H */

503
VQ/VQA32/CONFIG.CPP Normal file
View File

@@ -0,0 +1,503 @@
/*
** 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
* VQA player library. (32-Bit protected mode)
*
* FILE
* config.c
*
* DESCRIPTION
* Player configuration routines.
*
* PROGRAMMER
* Bill Randolph
* Denzil E. Long, Jr.
*
* DATE
* April 10, 1995
*
*----------------------------------------------------------------------------
*
* PUBLIC
* VQA_INIConfig - Initialize VQAConfig structure with INI settings.
* VQA_DefaultConfig - Initialize VQAConfig structure with defaults.
*
****************************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "vqaplayp.h"
#include <vqm32\all.h>
/*---------------------------------------------------------------------------
* PRIVATE DECLARATIONS
*-------------------------------------------------------------------------*/
/* Default configuration structure. */
static VQAConfig _defaultconfig = {
/* DrawerCallback: This is a function that is called for every frame
* in the movie.
*/
NULL,
/* EventHandler: This is a function that is called for every event that
* the client requested to be notified about.
*/
NULL,
/* NotifyFlags: Flags representing the events the client wishes to be
* notified about during playback.
*/
NULL,
/* Vmode: Video mode to use. */
MCGA,
/* VBIBit: Vertical blank bit polarity. */
-1,
/* ImageBuf: Pointer to image buffer to draw into. */
NULL,
/* ImageWidth, ImageHeight: Width and height dimensions of image buffer.
* A width and height value of -1 tells the player to consider the image
* buffer as having the same dimensions as the frames in the movie.
*/
320, 200, /* Image width and height */
/* X1, Y1: These are the coordinates to put the movies frame in the image
* buffer. Values of -1 tell the drawer to center the frames in the buffer.
*/
-1, -1,
/* FrameRate: The rate to load the frames at. A value of -1 tells the
* player to use the framerate of the movie.
*/
-1,
/* DrawRate: The rate to draw the frames at. A value of -1 tells the
* player to use the framerate of the movie. A value of 0 tells the player
* to use a fixed rate based on the frame size.
*/
-1,
/* TimerMethod: Timer method to use for playback. */
-1,
/* DrawFlags: Various drawing related flags. */
0,
/* OptionFlags: Various player options. */
VQAOPTF_AUDIO,
/* NumFrameBufs: The number of frame buffers to allocate/use. */
6,
/* NumCBBufs: The number of codebook buffers to allocate/use. */
3,
/* VocFile: Filename of audio track override. A value of 0 tells the
* player not to override the movies audio track.
*/
NULL,
/* AudioBuf: Audio buffer to use. A value of 0 tells the player that
* it has to allocate a buffer itself.
*/
NULL,
/* AudioBufSize: Size of audio buffer to use/allocate. A value of -1
* tells the player to compute the buffer size from the audio
* information in the movie.
*/
-1,
/* AudioRate: Audio playback rate in samples per second. A value of -1
* tells the player to use the audio rate of the movie.
*/
-1,
/* Volume: Volume level to playback audio track. */
0x00FF,
/* HMIBufSize: Size of HMIs internal buffer. */
2048L,
/* DigiHandle: Handle to an initialized HMI sound driver. A value of -1
* tells the player it must initialize the HMI sound driver itself.
*/
-1,
/* DigiCard: HMI ID of audio card to use. A value of 0 tells the player
* not to use any card. A value of -1 tells the player to autodetect the
* card in the system.
*/
-1,
/* DigiPort: Port address of the sound card. A value of -1 tells the player
* to autodetect this address.
*/
-1,
/* DigiIRQ: Interrupt number of sound card. A value of -1 tells the player
* to autodetect the interrupt used by the card.
*/
-1,
/* DigiDMA: DMA channel of the sound card. A value of -1 tells the player
* to autodetect the channel used by the card.
*/
-1,
/* Language: Prefered language. */
0,
/* CaptionFont: Caption text font. */
NULL,
/* EVAFont: EVA text font. */
NULL,
};
/* Supported video modes. */
#if(VQAVIDEO_ON)
enum VMTAGS {
VMTAG_NONE = 0,
#if(VQAMCGA_ON)
VMTAG_MCGA,
VMTAG_MCGA_BUF,
#endif
#if(VQAXMODE_ON)
VMTAG_XMODE320X200,
VMTAG_XMODE320X200_BUF,
VMTAG_XMODE320X200_VRAM,
VMTAG_XMODE320X240,
VMTAG_XMODE320X240_BUF,
VMTAG_XMODE320X240_VRAM,
#endif
#if(VQAVESA_ON)
VMTAG_VESA640X480_BUF,
VMTAG_VESA640X480_X2,
VMTAG_VESA320X200,
VMTAG_VESA320X200_BUF,
#endif
};
typedef struct _VideoModeTag {
char const *token;
long id;
} VideoModeTag;
VideoModeTag VideoModeTags[] = {
{"NONE",VMTAG_NONE},
#if(VQAMCGA_ON)
{"MCGA", VMTAG_MCGA},
{"MCGA_BUF",VMTAG_MCGA_BUF},
#endif /* VQAMCGA_ON */
#if(VQAXMODE_ON)
{"XMODE_320X200", VMTAG_XMODE320X200},
{"XMODE_320X200_BUF", VMTAG_XMODE320X200_BUF},
{"XMODE_320X200_VRAM",VMTAG_XMODE320X200_VRAM},
{"XMODE_320X240", VMTAG_XMODE320X240},
{"XMODE_320X240_BUF", VMTAG_XMODE320X240_BUF},
{"XMODE_320X240_VRAM",VMTAG_XMODE320X240_VRAM},
#endif /* VQAXMODE_ON */
#if(VQAVESA_ON)
{"VESA_640X480_BUF",VMTAG_VESA640X480_BUF},
{"VESA_640X480_X2", VMTAG_VESA640X480_X2},
{"VESA_320X200", VMTAG_VESA320X200},
{"VESA_320X200_BUF",VMTAG_VESA320X200_BUF},
#endif /* VQAVESA_ON */
{NULL, NULL}
};
#endif /* VQAVIDEO_ON */
/****************************************************************************
*
* NAME
* VQA_INIConfig - Initialize VQAConfig structure with INI settings.
*
* SYNOPSIS
* VQA_INIConfig(Config)
*
* void VQA_INIConfig(VQAConfig *);
*
* FUNCTION
* Initializes the configuration structure from the player INI file.
*
* INPUTS
* Config - Pointer to VQAConfig structure.
*
* RESULT
* NONE
*
****************************************************************************/
void VQA_INIConfig(VQAConfig *config)
{
char *ininame;
char buf[80];
long i;
/* Set all Config entries to 0. */
memset(config, 0, sizeof(VQAConfig));
/* Retrieve player INI filename from an enviroment variable if
* it is provided.
*/
if ((ininame = getenv("VQACFG")) == NULL) {
ininame = "PLAYER.INI";
}
/*-------------------------------------------------------------------------
* VIDEO MODE AND DRAW FLAGS
*-----------------------------------------------------------------------*/
#if(VQAVIDEO_ON)
/* Get video mode from INI */
GetINIString("Player", "PlayerMode", "MCGA", buf, 80, ininame);
/* Search supported modes for a match. */
i = 0;
while (VideoModeTags[i].token != NULL) {
if (stricmp(buf, VideoModeTags[i].token) == 0) {
break;
}
i++;
}
/* Setup for requested mode */
switch (VideoModeTags[i].id) {
/* MCGA direct */
#if(VQAMONO_ON)
case VMTAG_MCGA:
config->Vmode = MCGA;
break;
/* MCGA buffered */
case VMTAG_MCGA_BUF:
config->Vmode = MCGA;
config->DrawFlags |= VQACFGF_BUFFER;
break;
#endif /* VQAMCGA_ON */
/* XMODE direct (320x200) */
#if(VQAXMODE_ON)
case VMTAG_XMODE320X200:
config->Vmode = XMODE_320X200;
break;
/* XMODE buffered (320x200) */
case VMTAG_XMODE320X200_BUF:
config->Vmode = XMODE_320X200;
config->DrawFlags |= VQACFGF_BUFFER;
break;
/* XMODE VRAM codebook (320x200) */
case VMTAG_XMODE320X200_VRAM:
config->Vmode = XMODE_320X200;
config->DrawFlags |= VQACFGF_VRAMCB;
break;
/* XMODE direct (320x240) */
case VMTAG_XMODE320X240:
config->Vmode = XMODE_320X240;
break;
/* XMODE buffered (320x240) */
case VMTAG_XMODE320X240_BUF:
config->Vmode = XMODE_320X240;
config->DrawFlags |= VQACFGF_BUFFER;
break;
/* XMODE VRAM codebook (320x240) */
case VMTAG_XMODE320X240_VRAM:
config->Vmode = XMODE_320X240;
config->DrawFlags |= VQACFGF_VRAMCB;
break;
#endif /* VQAXMODE_ON */
/* VESA buffered (640x480_256) */
#if(VQAVESA_ON)
case VMTAG_VESA640X480_BUF:
config->Vmode = VESA_640X480_256;
config->DrawFlags |= VQACFGF_BUFFER;
break;
/* VESA buffered scaled (640x480_256) */
case VMTAG_VESA640X480_X2:
config->Vmode = VESA_640X480_256;
config->DrawFlags |= (VQACFGF_BUFFER|VQACFGF_SCALEX2);
break;
/* VESA direct (320x200_32k) */
case VMTAG_VESA320X200:
config->Vmode = VESA_320X200_32K_1;
break;
/* VESA buffered (320x200_32k) */
case VMTAG_VESA320X200_BUF:
config->Vmode = VESA_320X200_32K_1;
config->DrawFlags |= VQACFGF_BUFFER;
break;
#endif /* VQAVESA_ON */
/* Default to MCGA direct */
VMTAG_NONE:
default:
config->Vmode = MCGA;
break;
}
#endif /* VQAVIDEO_ON */
/* Get framerate and drawrate. */
GetINIString("Player", "FrameRate", "-1", buf, 80, ininame);
config->FrameRate = atoi(buf);
GetINIString("Player", "DrawRate", "Variable", buf, 80, ininame);
if (!stricmp(buf, "Variable")) {
config->DrawRate = -1;
} else {
config->DrawRate = 0;
}
/*-------------------------------------------------------------------------
* AUDIO SETTINGS
*-----------------------------------------------------------------------*/
GetINIString("Player", "AudioRate", "-1", buf, 80, ininame);
config->AudioRate = atoi(buf);
/* OptionFlags */
GetINIString("Player", "SoundEnabled", "True", buf, 80, ininame);
if (!stricmp(buf, "True") || !stricmp(buf, "1")) {
config->OptionFlags |= VQAOPTF_AUDIO;
} else {
config->OptionFlags &= (~VQAOPTF_AUDIO);
}
/* Default audio settings. */
config->AudioBufSize = 32768U;
config->HMIBufSize = 2048;
config->DigiHandle = -1;
config->Volume = 0x00FF;
config->DigiCard = 0xFFFF;
config->DigiPort = -1;
config->DigiIRQ = -1;
config->DigiDMA = -1;
/* Configure sound hardware */
GetINIString("Player", "Port", "-1", buf, 80, ininame);
if (!stricmp(buf, "-1")) {
config->DigiPort = -1;
} else {
sscanf(buf, "%x", &config->DigiPort);
}
GetINIString("Player", "IRQ", "-1", buf, 80, ininame);
config->DigiIRQ = atoi(buf);
GetINIString("Player", "DMA", "-1", buf, 80, ininame);
config->DigiDMA = atoi(buf);
/*-------------------------------------------------------------------------
* GENERAL OPTIONS
*-----------------------------------------------------------------------*/
/* Enable/Disable single stepping */
GetINIString("Player", "SingleStep", "False", buf, 80, ininame);
if (!stricmp(buf, "True") || !stricmp(buf, "1")) {
config->OptionFlags |= VQAOPTF_STEP;
config->DrawFlags |= VQACFGF_NOSKIP;
} else {
config->OptionFlags &= (~VQAOPTF_STEP);
}
/* Enable/Disable Slowpalette */
GetINIString("Player", "SlowPalette", "False", buf, 80, ininame);
if (!stricmp(buf, "True") || !stricmp(buf, "1")) {
config->OptionFlags |= VQAOPTF_SLOWPAL;
} else {
config->OptionFlags &= (~VQAOPTF_SLOWPAL);
}
/* Enable/Disable monochrome display */
GetINIString("Player", "MonoOutput", "False", buf, 80, ininame);
if (!stricmp(buf, "True") || !stricmp(buf, "1")) {
config->OptionFlags |= VQAOPTF_MONO;
} else {
config->OptionFlags &= (~VQAOPTF_MONO);
}
/* Frame and codebook buffers */
config->NumFrameBufs = 6;
config->NumCBBufs = 3;
}
/****************************************************************************
*
* NAME
* VQA_DefaultConfig - Initialize VQAConfig structure with defaults.
*
* SYNOPSIS
* VQA_DefaultConfig(Config);
*
* void VQA_DefaultConfig(VQAConfig *);
*
* FUNCTION
* Initialize configuration with default settings.
*
* INPUTS
* Config - Pointer to VQA configuration structure.
*
* RESULT
* NONE
*
****************************************************************************/
void VQA_DefaultConfig(VQAConfig *config)
{
memcpy(config, &_defaultconfig, sizeof(VQAConfig));
}

2225
VQ/VQA32/DRAWER.BAK Normal file

File diff suppressed because it is too large Load Diff

2247
VQ/VQA32/DRAWER.CPP Normal file

File diff suppressed because it is too large Load Diff

188
VQ/VQA32/DSTREAM.CPP Normal file
View File

@@ -0,0 +1,188 @@
/*
** 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
* VQAPlay32 library.
*
* FILE
* dstream.c
*
* DESCRIPTION
* DOS IO handler.
*
* PROGRAMMER
* Denzil E. Long, Jr.
*
* DATE
* April 10, 1995
*
*----------------------------------------------------------------------------
*
* PUBLIC
* VQA_InitAsDOS - Initialize IO with the standard DOS handler.
*
* PRIVATE
* VQADOSHandler - Standard DOS IO handler.
*
****************************************************************************/
#include <fcntl.h>
#include <io.h>
#include "vqaplayp.h"
/*---------------------------------------------------------------------------
* PRIVATE DECLARATIONS
*-------------------------------------------------------------------------*/
static long VQADOSHandler(VQAHandle *vqa, long action, void *buffer,
long nbytes);
/****************************************************************************
*
* NAME
* VQA_InitAsDOS - Initialize IO with the standard DOS handler.
*
* SYNOPSIS
* VQA_InitAsDOS(VQA)
*
* VQA_InitAsDOS(VQAHandle *);
*
* FUNCTION
* Initialize the IO of the specified handle as a standard DOS access.
*
* INPUTS
* VQA - Pointer to VQAHandle to initialize as DOS.
*
* RESULT
* NONE
*
****************************************************************************/
void VQA_InitAsDOS(VQAHandle *vqa)
{
((VQAHandleP *)vqa)->IOHandler = VQADOSHandler;
}
/****************************************************************************
*
* NAME
* VQADOSHandler - Standard DOS IO handler.
*
* SYNOPSIS
* Error = VQADOSHandler(VQA, Action, Buffer, NBytes)
*
* unsigned long VQADOSHandler(VQAHandle *, long, long, long);
*
* FUNCTION
* Perform the requested action on the standard DOS file system.
*
* INPUTS
* VQA - VQAHandle to operate on.
* Action - Action to perform.
* Buffer - Buffer to Read/Write to/from.
* NBytes - Number of bytes to operate on.
*
* RESULT
* Error - 0 if successful, otherwise error.
*
****************************************************************************/
static long VQADOSHandler(VQAHandle *vqa, long action, void *buffer,
long nbytes)
{
long fh;
long error;
fh = vqa->VQAio;
/* Perform the action specified by the IO command */
switch (action) {
/* VQACMD_READ means read NBytes and place it in the memory
* pointed to by Buffer.
*
* Any error code returned will be remapped by VQA library into
* VQAERR_READ.
*/
case VQACMD_READ:
error = (read(fh, buffer, nbytes) != nbytes);
break;
/* VQACMD_WRITE is analogous to VQACMD_READ.
*
* Writing is not allowed to the VQA file, VQA library will remap the
* error into VQAERR_WRITE.
*/
case VQACMD_WRITE:
error = 1;
break;
/* VQACMD_SEEK asks that you perform a seek relative to the current
* position. NBytes is a signed number, indicating seek direction
* (positive for forward, negative for backward). Buffer has no meaning
* here.
*
* Any error code returned will be remapped by VQA library into
* VQAERR_SEEK.
*/
case VQACMD_SEEK:
error = (lseek(fh, nbytes, (long)buffer) == -1);
break;
/* VQACMD_OPEN asks that you open the file for access. */
case VQACMD_OPEN:
error = open((char *)buffer, (O_RDONLY|O_BINARY));
if (error != -1) {
vqa->VQAio = error;
error = 0;
}
break;
case VQACMD_CLOSE:
close(fh);
error = 0;
break;
/* VQACMD_INIT means to prepare your IO for reading. This is used for
* certain IOs that can't be read immediately upon opening, and need
* further preparation. This operation is allowed to fail; the error code
* will be returned directly to the client.
*/
case VQACMD_INIT:
/* IFFCMD_CLEANUP means to terminate the transaction with the associated
* IO. This is used for IOs that can't simply be closed. This operation
* is not allowed to fail; any error returned will be ignored.
*/
case VQACMD_CLEANUP:
error = 0;
break;
}
return (error);
}

2353
VQ/VQA32/LOADER.BAK Normal file

File diff suppressed because it is too large Load Diff

2832
VQ/VQA32/LOADER.CPP Normal file

File diff suppressed because it is too large Load Diff

163
VQ/VQA32/MAKEFILE Normal file
View File

@@ -0,0 +1,163 @@
#
# 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
# VQAPlay 32-bit library.
#
# FILE
# makefile (Watcom C/C++ 10.0a)
#
# DESCRIPTION
# Makefile for generating the 32-bit VQAPlay library.
#
# PROGRAMMER
# Denzil E. Long, Jr.
#
# DATE
# February 10, 1995
#
# ENVIROMENT
# PRJ - Projects path.
# PRJVCS - Version control archive path.
# WATCOM - Watcom C installation path.
#
#****************************************************************************
#----------------------------------------------------------------------------
# VERIFY ENVIROMENT
#----------------------------------------------------------------------------
!ifndef %PRJ || %PRJVCS || %WATCOM
!error Environment not configured.
!endif
.OPTIMIZE
.ERASE
#----------------------------------------------------------------------------
# PROJECTS DEPENDENT MACROS
#----------------------------------------------------------------------------
PRJNAME = vqa32wp
PRJDIR = $(%PRJ)\VQA32
OBJECTS = &
config.obj &
task.obj &
loader.obj &
drawer.obj &
audio.obj &
monodisp.obj &
dstream.obj &
unvqbuff.obj &
unvqvesa.obj &
vertag.obj &
caption.obj &
# unvqxmde.obj
#----------------------------------------------------------------------------
# PATH MACROS
#----------------------------------------------------------------------------
!ifdef %LIB
LIBPATH = $(%PRJ)\LIB;$(%LIB)
!else
LIBPATH = $(%PRJ)\LIB;$(%WATCOM)\LIB386
!endif
!ifdef %INCLUDE
INCLUDEPATH = $(%PRJ)\INCLUDE;$(%INCLUDE)
!else
INCLUDEPATH = $(%PRJ)\INCLUDE;$(%WATCOM)\H
!endif
path_c = .\
path_cpp = .\
path_h = .\
path_asm = .\
path_i = .\
path_obj = .\O
path_lib = $(%PRJ)\LIB
path_exe = .\
#----------------------------------------------------------------------------
# IMPLICIT RULE EXTENSIONS AND PATHS
#----------------------------------------------------------------------------
.EXTENSIONS :
.EXTENSIONS : .exe .lib .obj .c .cpp .asm .h .i
.c : $(path_c)
.cpp : $(path_cpp)
.h : $(path_h)
.asm : $(path_asm)
.i : $(path_i)
.obj : $(path_obj)
.lib : $(path_lib)
.exe : $(path_exe)
#----------------------------------------------------------------------------
# Tools/commands & configurations
#----------------------------------------------------------------------------
CC_CMD = wcc386
CCP_CMD = wpp386
ASM_CMD = tasm32
LINK_CMD = wlink
LIB_CMD = wlib
CC_OPTS = -i$(INCLUDEPATH) -j -zp1 -5s -mf -oaeilrt -s -zq
ASM_OPTS = /t /m /w+ /jJUMPS /ml /p /z /i$(%PRJ)\INCLUDE\VQM32 /dPHARLAP_TNT=0
LIB_OPTS = /b /c /q
LINK_CFG = $(PRJNAME).lnk
#----------------------------------------------------------------------------
# DEFAULT TARGET
#----------------------------------------------------------------------------
all : $(PRJNAME).lib .SYMBOLIC
$(PRJNAME).lib : $(OBJECTS) .SYMBOLIC
#----------------------------------------------------------------------------
# IMPLICIT RULES
#----------------------------------------------------------------------------
.c.obj :
$(CC_CMD) $(CC_OPTS) -fo=$(PATH_OBJ)\$^. $<
$(LIB_CMD) $(LIB_OPTS) $(path_lib)\$(PRJNAME).lib -+$(path_obj)\$]&
.cpp.obj :
$(CCP_CMD) $(CC_OPTS) -fo=$(PATH_OBJ)\$^. $<
$(LIB_CMD) $(LIB_OPTS) $(path_lib)\$(PRJNAME).lib -+$(path_obj)\$]&
.asm.obj:
$(ASM_CMD) $(ASM_OPTS) $<,$(path_obj)\$^.
$(LIB_CMD) $(LIB_OPTS) $(path_lib)\$(PRJNAME).lib -+$(path_obj)\$]&
update: .SYMBOLIC
@echo Updating VQAPlay32 header files!
@copy vqaplay.h ..\include\vqa32 >NUL
@copy vqafile.h ..\include\vqa32 >NUL

167
VQ/VQA32/MAKEFILE.BAK 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
# VQAPlay 32-bit library.
#
# FILE
# makefile (Watcom C/C++ 10.0a)
#
# DESCRIPTION
# Makefile for generating the 32-bit VQAPlay library.
#
# PROGRAMMER
# Denzil E. Long, Jr.
#
# DATE
# February 10, 1995
#
# ENVIROMENT
# PRJ - Projects path.
# PRJVCS - Version control archive path.
# WATCOM - Watcom C installation path.
#
#****************************************************************************
#----------------------------------------------------------------------------
# VERIFY ENVIROMENT
#----------------------------------------------------------------------------
!ifndef %PRJ
PRJ=..
!endif
!ifndef %WATCOM
!error Environment not configured.
!endif
.OPTIMIZE
.ERASE
#----------------------------------------------------------------------------
# PROJECTS DEPENDENT MACROS
#----------------------------------------------------------------------------
PRJNAME = vqa32wp
PRJDIR = $(PRJ)\VQA32
OBJECTS = &
config.obj &
task.obj &
loader.obj &
drawer.obj &
audio.obj &
monodisp.obj &
dstream.obj &
unvqbuff.obj &
unvqvesa.obj &
vertag.obj &
caption.obj &
# unvqxmde.obj
#----------------------------------------------------------------------------
# PATH MACROS
#----------------------------------------------------------------------------
!ifdef %LIB
LIBPATH = $(PRJ)\LIB;$(%LIB)
!else
LIBPATH = $(PRJ)\LIB;$(%WATCOM)\LIB386
!endif
!ifdef %INCLUDE
INCLUDEPATH = $(PRJ)\INCLUDE;$(%INCLUDE)
!else
INCLUDEPATH = $(PRJ)\INCLUDE;$(%WATCOM)\H
!endif
path_c = .\
path_cpp = .\
path_h = .\
path_asm = .\
path_i = .\
path_obj = .\O
path_lib = $(PRJ)\LIB
path_exe = .\
#----------------------------------------------------------------------------
# IMPLICIT RULE EXTENSIONS AND PATHS
#----------------------------------------------------------------------------
.EXTENSIONS :
.EXTENSIONS : .exe .lib .obj .c .cpp .asm .h .i
.c : $(path_c)
.cpp : $(path_cpp)
.h : $(path_h)
.asm : $(path_asm)
.i : $(path_i)
.obj : $(path_obj)
.lib : $(path_lib)
.exe : $(path_exe)
#----------------------------------------------------------------------------
# Tools/commands & configurations
#----------------------------------------------------------------------------
CC_CMD = wcc386
CCP_CMD = wpp386
ASM_CMD = tasm32
LINK_CMD = wlink
LIB_CMD = wlib
CC_OPTS = -i$(INCLUDEPATH) -j -zp1 -5s -mf -oaeilrt -s -zq
ASM_OPTS = /t /m /w+ /jJUMPS /ml /p /z /i$(PRJ)\INCLUDE\VQM32 /dPHARLAP_TNT=0
LIB_OPTS = /b /c /q
LINK_CFG = $(PRJNAME).lnk
#----------------------------------------------------------------------------
# DEFAULT TARGET
#----------------------------------------------------------------------------
all : $(PRJNAME).lib .SYMBOLIC
$(PRJNAME).lib : $(OBJECTS) .SYMBOLIC
#----------------------------------------------------------------------------
# IMPLICIT RULES
#----------------------------------------------------------------------------
.c.obj :
$(CC_CMD) $(CC_OPTS) -fo=$(PATH_OBJ)\$^. $<
$(LIB_CMD) $(LIB_OPTS) $(path_lib)\$(PRJNAME).lib -+$(path_obj)\$]&
.cpp.obj :
$(CCP_CMD) $(CC_OPTS) -fo=$(PATH_OBJ)\$^. $<
$(LIB_CMD) $(LIB_OPTS) $(path_lib)\$(PRJNAME).lib -+$(path_obj)\$]&
.asm.obj:
$(ASM_CMD) $(ASM_OPTS) $<,$(path_obj)\$^.
$(LIB_CMD) $(LIB_OPTS) $(path_lib)\$(PRJNAME).lib -+$(path_obj)\$]&
update: .SYMBOLIC
@echo Updating VQAPlay32 header files!
@copy vqaplay.h ..\include\vqa32 >NUL
@copy vqafile.h ..\include\vqa32 >NUL

216
VQ/VQA32/MAKEFILE.BOR Normal file
View File

@@ -0,0 +1,216 @@
#
# 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
# VQAPlay32 library.
#
# FILE
# makefile (Borland/TNT)
#
# DESCRIPTION
# Makefile for generating the 32-bit VQAPlay library.
#
# PROGRAMMER
# Denzil E. Long, Jr.
#
# DATE
# Feburary 7, 1995
#
# ENVIROMENT
# PRJ - Projects path.
# PRJVCS - Version control archive path.
# BCDIR - Borland C installation path.
# TNTDIR - Pharlap/TNT installation path.
#
#****************************************************************************
.AUTODEPEND
#----------------------------------------------------------------------------
# VERIFY ENVIROMENT
#----------------------------------------------------------------------------
!if !$d(PRJ) || !$d(PRJVCS) || !$d(BCDIR) || !$d(TNTDIR)
!error Environment not configured.
!endif
#----------------------------------------------------------------------------
# PROJECTS DEPENDENT MACROS
#----------------------------------------------------------------------------
PRJNAME = vqa32bp
PRJDIR = $(PRJ)\VQA32
OBJECTS = \
config.obj \
task.obj \
loader.obj \
drawer.obj \
audio.obj \
monodisp.obj \
dstream.obj \
unvqbuff.obj \
unvqvesa.obj \
vertag.obj \
caption.obj \
# unvqxmde.obj \
PRJLIBS = \
vqm32bp.lib \
#----------------------------------------------------------------------------
# PATH MACROS
#----------------------------------------------------------------------------
!if $d(LIB)
LIBPATH = $(PRJ)\LIB;$(LIB)
!else
LIBPATH = $(PRJ)\LIB;$(TNTDIR)\LIB;$(BCDIR)\LIB
!endif
!if $d(INCLUDE)
INCLUDEPATH = $(PRJ)\INCLUDE;$(INCLUDE)
!else
INCLUDEPATH = $(PRJ)\INCLUDE;$(TNTDIR)\INCLUDE;$(BCDIR)\INCLUDE
!endif
.path.asm = $(PRJDIR)
.path.c = $(PRJDIR)
.path.cpp = $(PRJDIR)
.path.h = $(PRJDIR)
.path.exe = $(PRJDIR)
.path.obj = $(PRJDIR)\OBJ
.path.sym = $(PRJDIR)\OBJ
.path.lib = $(PRJ)\LIB
#----------------------------------------------------------------------------
# TOOLS, COMMAND AND CONFIGURATIONS
#----------------------------------------------------------------------------
CC_CMD = bcc32
ASM_CMD = tasm32
LINK_CMD = tlink32
LIB_CMD = tlib
CC_CFG = bcc32.cfg
ASM_CFG = tasm32.cfg
LINK_CFG = tlink32.cfg
LIB_CFG = tlib.cfg
CFG_FILES = $(CC_CFG) $(ASM_CFG) $(LINK_CFG) $(LIB_CFG)
#----------------------------------------------------------------------------
# DEFAULT TARGET
#----------------------------------------------------------------------------
all: $(PRJNAME).lib
#----------------------------------------------------------------------------
# IMPLICIT RULES
#----------------------------------------------------------------------------
.c.obj:
$(CC_CMD) -P- -n$(.path.obj) {$< }
.cpp.obj:
$(CC_CMD) -P -n$(.path.obj) {$< }
.asm.obj:
$(ASM_CMD) @$(ASM_CFG) $<,$(.path.obj)\$&
#----------------------------------------------------------------------------
# BUILD LIBRARY
#----------------------------------------------------------------------------
$(PRJNAME).lib: $(OBJECTS)
- @del $(.path.lib)\$(PRJNAME).lib >&NUL
$(LIB_CMD) $(.path.lib)\$(PRJNAME).lib @$(LIB_CFG) @&&|
-+$(**: = -+)
|
- @copy vqaplay.h $(PRJ)\INCLUDE\VQA32 >&NUL
- @copy vqafile.h $(PRJ)\INCLUDE\VQA32 >&NUL
#----------------------------------------------------------------------------
# ALL OBJECTS DEPEND ON THE CONFIGURATION FILES
#----------------------------------------------------------------------------
$(OBJECTS): $(CFG_FILES)
#----------------------------------------------------------------------------
# COMPILER CONFIGURATION
#----------------------------------------------------------------------------
$(CC_CFG): makefile
copy &&|
-c
-3
-d
-H=$(.path.sym)\headers.sym
-wpro
-weas
-wpre
-I$(INCLUDEPATH)
-DPHARLAP_TNT=1
#-v
| $(CC_CFG)
#----------------------------------------------------------------------------
# ASSEMBLER CONFIGURATION
#----------------------------------------------------------------------------
$(ASM_CFG): makefile
copy &&|
/t
/m
/w+
/jJUMPS
/ml
/p
/z
/i$(PRJ)\INCLUDE\VQM32
/zi
/dPHARLAP_TNT=1
| $(ASM_CFG)
#----------------------------------------------------------------------------
# LINKER CONFIGURATION
#----------------------------------------------------------------------------
$(LINK_CFG): makefile
copy &&|
/c
/m
/Gm
-L$(LIBPATH)
-v
| $(LINK_CFG)
#----------------------------------------------------------------------------
# LIBRARIAN CONFIGURATION
#----------------------------------------------------------------------------
$(LIB_CFG): makefile
copy &&|
/C /E
| $(LIB_CFG)

163
VQ/VQA32/MAKEFILE.WAT Normal file
View File

@@ -0,0 +1,163 @@
#
# 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
# VQAPlay 32-bit library.
#
# FILE
# makefile (Watcom C/C++ 10.0a)
#
# DESCRIPTION
# Makefile for generating the 32-bit VQAPlay library.
#
# PROGRAMMER
# Denzil E. Long, Jr.
#
# DATE
# February 10, 1995
#
# ENVIROMENT
# PRJ - Projects path.
# PRJVCS - Version control archive path.
# WATCOM - Watcom C installation path.
#
#****************************************************************************
#----------------------------------------------------------------------------
# VERIFY ENVIROMENT
#----------------------------------------------------------------------------
!ifndef %PRJ || %PRJVCS || %WATCOM
!error Environment not configured.
!endif
.OPTIMIZE
.ERASE
#----------------------------------------------------------------------------
# PROJECTS DEPENDENT MACROS
#----------------------------------------------------------------------------
PRJNAME = vqa32wp
PRJDIR = $(%PRJ)\VQA32
OBJECTS = &
config.obj &
task.obj &
loader.obj &
drawer.obj &
audio.obj &
monodisp.obj &
dstream.obj &
unvqbuff.obj &
unvqvesa.obj &
vertag.obj &
caption.obj &
# unvqxmde.obj
#----------------------------------------------------------------------------
# PATH MACROS
#----------------------------------------------------------------------------
!ifdef %LIB
LIBPATH = $(%PRJ)\LIB;$(%LIB)
!else
LIBPATH = $(%PRJ)\LIB;$(%WATCOM)\LIB386
!endif
!ifdef %INCLUDE
INCLUDEPATH = $(%PRJ)\INCLUDE;$(%INCLUDE)
!else
INCLUDEPATH = $(%PRJ)\INCLUDE;$(%WATCOM)\H
!endif
path_c = .\
path_cpp = .\
path_h = .\
path_asm = .\
path_i = .\
path_obj = .\O
path_lib = $(%PRJ)\LIB
path_exe = .\
#----------------------------------------------------------------------------
# IMPLICIT RULE EXTENSIONS AND PATHS
#----------------------------------------------------------------------------
.EXTENSIONS :
.EXTENSIONS : .exe .lib .obj .c .cpp .asm .h .i
.c : $(path_c)
.cpp : $(path_cpp)
.h : $(path_h)
.asm : $(path_asm)
.i : $(path_i)
.obj : $(path_obj)
.lib : $(path_lib)
.exe : $(path_exe)
#----------------------------------------------------------------------------
# Tools/commands & configurations
#----------------------------------------------------------------------------
CC_CMD = wcc386
CCP_CMD = wpp386
ASM_CMD = tasm32
LINK_CMD = wlink
LIB_CMD = wlib
CC_OPTS = -i$(INCLUDEPATH) -j -zp1 -5s -mf -oaeilrt -s -zq
ASM_OPTS = /t /m /w+ /jJUMPS /ml /p /z /i$(%PRJ)\INCLUDE\VQM32 /dPHARLAP_TNT=0
LIB_OPTS = /b /c /q
LINK_CFG = $(PRJNAME).lnk
#----------------------------------------------------------------------------
# DEFAULT TARGET
#----------------------------------------------------------------------------
all : $(PRJNAME).lib .SYMBOLIC
$(PRJNAME).lib : $(OBJECTS) .SYMBOLIC
#----------------------------------------------------------------------------
# IMPLICIT RULES
#----------------------------------------------------------------------------
.c.obj :
$(CC_CMD) $(CC_OPTS) -fo=$(PATH_OBJ)\$^. $<
$(LIB_CMD) $(LIB_OPTS) $(path_lib)\$(PRJNAME).lib -+$(path_obj)\$]&
.cpp.obj :
$(CCP_CMD) $(CC_OPTS) -fo=$(PATH_OBJ)\$^. $<
$(LIB_CMD) $(LIB_OPTS) $(path_lib)\$(PRJNAME).lib -+$(path_obj)\$]&
.asm.obj:
$(ASM_CMD) $(ASM_OPTS) $<,$(path_obj)\$^.
$(LIB_CMD) $(LIB_OPTS) $(path_lib)\$(PRJNAME).lib -+$(path_obj)\$]&
update: .SYMBOLIC
@echo Updating VQAPlay32 header files!
@copy vqaplay.h ..\include\vqa32 >NUL
@copy vqafile.h ..\include\vqa32 >NUL

508
VQ/VQA32/MONODISP.BAK Normal file
View File

@@ -0,0 +1,508 @@
/*
** 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
* VQA player library. (32-Bit protected mode)
*
* FILE
* monodisp.c
*
* DESCRIPTION
* Monochrome display (debug)
*
* PROGRAMMER
* Bill Randolph
* Denzil E. Long, Jr.
*
* DATE
* Feburary 23, 1995
*
*---------------------------------------------------------------------------
*
* PUBLIC
* VQA_InitMono - Initialize the player's mono screen.
* VQA_UpdateMono - Update the player's mono output.
*
****************************************************************************/
#include <stdio.h>
#include <string.h>
#include "vq.h"
#include "vqaplayp.h"
#include <vqm32\all.h>
#if(VQAMONO_ON)
/* Main window */
#define MAIN_WX1 0
#define MAIN_WX2 79
#define MAIN_WY1 0
#define MAIN_WY2 9
#define MAIN_TITLE "VQA Player"
/* Loader data window */
#define LOADER_WX1 0
#define LOADER_WX2 39
#define LOADER_WY1 10
#define LOADER_WY2 20
#define LOADER_TITLE " Frame Loader "
/* Drawer data window */
#define DRAWER_WX1 40
#define DRAWER_WX2 79
#define DRAWER_WY1 10
#define DRAWER_WY2 20
#define DRAWER_TITLE " Frame Drawer "
/* Audio data window */
#define AUDIO_WX1 0
#define AUDIO_WX2 39
#define AUDIO_WY1 21
#define AUDIO_WY2 24
#define AUDIO_TITLE " Audio Callback "
/* Flipper data window */
#define FLIPPER_WX1 40
#define FLIPPER_WX2 79
#define FLIPPER_WY1 21
#define FLIPPER_WY2 24
#define FLIPPER_TITLE " Frame Flipper "
extern char *HMIDevName;
/****************************************************************************
*
* NAME
* VQA_InitMono - Initialize the player's mono screen.
*
* SYNOPSIS
* VQA_InitMono(VQAData)
*
* void VQA_InitMono(VQAData *);
*
* FUNCTION
*
* INPUTS
* VQAData - Pointer to VQAData structure.
*
* RESULT
* NONE
*
****************************************************************************/
#pragma argsused
void VQA_InitMono(VQAHandleP *vqap)
{
VQAData *vqabuf;
VQAConfig *config;
char txt[80];
/* Dereference commonly used data members of quick access. */
vqabuf = vqap->VQABuf;
config = &vqap->Config;
/* Enable and clear the mono screen */
Mono_Enable();
Mono_Clear_Screen();
/* Init main window */
Mono_Draw_Rect(MAIN_WX1, MAIN_WY1, (MAIN_WX2 - MAIN_WX1 + 1),
(MAIN_WY2 - MAIN_WY1 + 1), 2, 1);
Mono_Set_Cursor((MAIN_WX2 + MAIN_WX1 - strlen(MAIN_TITLE)) / 2, MAIN_WY1);
Mono_Print(MAIN_TITLE);
/* Video mode */
Mono_Set_Cursor(MAIN_WX1 + 18, MAIN_WY1 + 1);
Mono_Print("Video Mode: ");
switch (config->Vmode) {
#if(VQAMONO_ON)
case MCGA:
if (config->DrawFlags & VQACFGF_BUFFER) {
Mono_Print("MCGA Buffered");
} else {
Mono_Print("MCGA Direct to screen");
}
break;
#endif
#if(VQAXMODE_ON)
case XMODE_320X200:
if (config->DrawFlags & VQACFGF_BUFFER) {
Mono_Print("XMODE 320x200 Buffered");
} else {
if (config->DrawFlags & VQACFGF_VRAMCB) {
Mono_Print("XMODE 320x200 VRAM Copy");
} else {
Mono_Print("XMODE 320x200 Linear->Banked");
}
}
break;
case XMODE_320X240:
if (config->DrawFlags & VQACFGF_BUFFER) {
Mono_Print("XMODE 320x240 Buffered");
} else {
if (config->DrawFlags & VQACFGF_VRAMCB) {
Mono_Print("XMODE 320x240 VRAM Copy");
} else {
Mono_Print("XMODE 320x240 Linear->Banked");
}
}
break;
#endif
#if(VQAVESA_ON)
case VESA_640X480_256:
Mono_Print("VESA 640x480");
break;
case VESA_320X200_32K_1:
if (config->DrawFlags & VQACFGF_BUFFER) {
Mono_Print("VESA 320x200 Buffered");
} else {
Mono_Print("VESA 320x200 Direct to screen");
}
break;
#endif
default:
Mono_Print("UNKNOWN");
break;
}
/* Sound status */
Mono_Set_Cursor(MAIN_WX1 + 18, MAIN_WY1 + 2);
Mono_Print(" Sound: ");
if (config->OptionFlags & VQAOPTF_AUDIO) {
sprintf(txt,"%u Hz", config->AudioRate);
Mono_Print(txt);
} else {
Mono_Print("OFF");
}
Mono_Set_Cursor(MAIN_WX1 + 18, MAIN_WY1 + 3);
Mono_Print(" Driver Name: ");
Mono_Print(HMIDevName);
/* Frame rates */
Mono_Set_Cursor(MAIN_WX1 + 18, MAIN_WY1 + 4);
sprintf(txt," Load Frame Rate: %d", config->FrameRate);
Mono_Print(txt);
Mono_Set_Cursor(MAIN_WX1 + 18, MAIN_WY1 + 5);
sprintf(txt," Draw Frame Rate: %d", config->DrawRate);
Mono_Print(txt);
/* Slow palette */
Mono_Set_Cursor(MAIN_WX1 + 18, MAIN_WY1 + 6);
Mono_Print(" Slow palette: ");
if (config->OptionFlags & VQAOPTF_SLOWPAL) {
Mono_Print("ON");
} else {
Mono_Print("OFF");
}
/* Memory Usage */
Mono_Set_Cursor(MAIN_WX1 + 18, MAIN_WY1 + 7);
sprintf(txt," Memory Used: %ld", vqabuf->MemUsed);
Mono_Print(txt);
/* Timer Method */
Mono_Set_Cursor(MAIN_WX1 + 18, MAIN_WY1 + 8);
if (VQA_TimerMethod() == VQA_TMETHOD_DOS) {
Mono_Print(" DOS Timer:");
} else if (VQA_TimerMethod() == VQA_TMETHOD_INT) {
Mono_Print(" Interrupt Timer:");
} else if (VQA_TimerMethod() == VQA_TMETHOD_AUDIO) {
Mono_Print(" Audio DMA Timer:");
} else {
Mono_Print(" Defualt:");
}
/* Init loader data window */
Mono_Draw_Rect(LOADER_WX1, LOADER_WY1, (LOADER_WX2 - LOADER_WX1 + 1),
(LOADER_WY2 - LOADER_WY1 + 1), 2, 1);
Mono_Set_Cursor((LOADER_WX2 + LOADER_WX1 - strlen(LOADER_TITLE)) / 2,
LOADER_WY1);
Mono_Print(LOADER_TITLE);
Mono_Set_Cursor(LOADER_WX1 + 2, LOADER_WY1 + 1);
Mono_Print(" Current Frame #:");
Mono_Set_Cursor(LOADER_WX1 + 2, LOADER_WY1 + 2);
Mono_Print("# Waits on Drawer:");
Mono_Set_Cursor(LOADER_WX1 + 2, LOADER_WY1 + 3);
Mono_Print(" # Waits on Audio:");
Mono_Set_Cursor(LOADER_WX1 + 2, LOADER_WY1 + 4);
Mono_Print(" Frame Size:");
Mono_Set_Cursor(LOADER_WX1 + 2, LOADER_WY1 + 5);
Mono_Print(" Max Frame Size:");
Mono_Set_Cursor(LOADER_WX1 + 2, LOADER_WY2 - 2);
Mono_Print("Audio:");
/* Init drawer data window */
Mono_Draw_Rect(DRAWER_WX1, DRAWER_WY1, (DRAWER_WX2 - DRAWER_WX1 + 1),
(DRAWER_WY2 - DRAWER_WY1 + 1), 2, 1);
Mono_Set_Cursor((DRAWER_WX2 + DRAWER_WX1 - strlen(DRAWER_TITLE)) / 2,
DRAWER_WY1);
Mono_Print(DRAWER_TITLE);
Mono_Set_Cursor(DRAWER_WX1 + 2, DRAWER_WY1 + 1);
Mono_Print(" Current Frame #:");
Mono_Set_Cursor(DRAWER_WX1 + 2, DRAWER_WY1 + 2);
Mono_Print(" Desired Frame #:");
Mono_Set_Cursor(DRAWER_WX1 + 2, DRAWER_WY1 + 3);
Mono_Print("# Waits on Flipper:");
Mono_Set_Cursor(DRAWER_WX1 + 2, DRAWER_WY1 + 4);
Mono_Print(" # Waits on Loader:");
Mono_Set_Cursor(DRAWER_WX1 + 2, DRAWER_WY1 + 5);
Mono_Print(" # Frames Skipped:");
Mono_Set_Cursor(DRAWER_WX1 + 2, DRAWER_WY1 + 6);
Mono_Print(" VQ Block Size:");
Mono_Set_Cursor(DRAWER_WX1 + 2, DRAWER_WY2 - 2);
Mono_Print("Frames: Cbooks:");
/* Init audio data window */
Mono_Draw_Rect(AUDIO_WX1, AUDIO_WY1, (AUDIO_WX2 - AUDIO_WX1 + 1),
(AUDIO_WY2 - AUDIO_WY1 + 1), 2, 1);
Mono_Set_Cursor((AUDIO_WX2 + AUDIO_WX1 - strlen(AUDIO_TITLE)) / 2,
AUDIO_WY1);
Mono_Print(AUDIO_TITLE);
Mono_Set_Cursor(AUDIO_WX1 + 2, AUDIO_WY1 + 1);
Mono_Print("# Repeated Buffers:");
/* Init flipper data window */
Mono_Draw_Rect(FLIPPER_WX1, FLIPPER_WY1, (FLIPPER_WX2 - FLIPPER_WX1 + 1),
(FLIPPER_WY2 - FLIPPER_WY1 + 1), 2, 1);
Mono_Set_Cursor((FLIPPER_WX2 + FLIPPER_WX1 - strlen(FLIPPER_TITLE)) / 2,
FLIPPER_WY1);
Mono_Print(FLIPPER_TITLE);
Mono_Set_Cursor(FLIPPER_WX1 + 2, FLIPPER_WY1 + 1);
Mono_Print("Current Frame #:");
}
/****************************************************************************
*
* NAME
* VQA_UpdateMono - Update the player's mono output.
*
* SYNOPSIS
* VQA_UpdateMono(VQAData)
*
* void VQA_UpdateMono(VQAData *);
*
* FUNCTION
*
* INPUTS
* VQAData - Pointer to VQAData structure.
*
* RESULT
* NONE
*
****************************************************************************/
#pragma argsused
void VQA_UpdateMono(VQAHandleP *vqap)
{
VQAData *vqabuf;
VQAConfig *config;
VQAFrameNode *frame;
VQACBNode *cbook;
long frameindex = -1;
long loadcb = -1;
long drawcb = -1;
long i;
char txt[80];
unsigned long curtime;
/* Dereference commonly used data members for quick access. */
vqabuf = vqap->VQABuf;
config = &vqap->Config;
/* Timer value */
curtime = VQA_GetTime();
Mono_Set_Cursor(MAIN_WX1 + 40, MAIN_WY1 + 8);
sprintf(txt,"%02ld:%02ld.%02ld",curtime / (VQA_TIMETICKS * VQA_TIMETICKS),
curtime / VQA_TIMETICKS,((curtime * 100L) / VQA_TIMETICKS)
-((curtime / VQA_TIMETICKS) * 100L));
Mono_Print(txt);
/* Loader data */
Mono_Set_Cursor(LOADER_WX1 + 22, LOADER_WY1 + 1);
sprintf(txt,"%4d",vqabuf->Loader.LastFrameNum);
Mono_Print(txt);
Mono_Set_Cursor(LOADER_WX1 + 22, LOADER_WY1 + 2);
sprintf(txt,"%4ld",vqabuf->Loader.WaitsOnDrawer);
Mono_Print(txt);
Mono_Set_Cursor(LOADER_WX1 + 22, LOADER_WY1 + 3);
sprintf(txt,"%4ld",vqabuf->Loader.WaitsOnAudio);
Mono_Print(txt);
Mono_Set_Cursor(LOADER_WX1 + 22, LOADER_WY1 + 4);
sprintf(txt,"%5u",vqabuf->Loader.FrameSize);
Mono_Print(txt);
Mono_Set_Cursor(LOADER_WX1 + 22, LOADER_WY1 + 5);
sprintf(txt,"%5u",vqabuf->Loader.MaxFrameSize);
Mono_Print(txt);
/* Draw a picture of the audio buffers */
for (i = 0; i < vqabuf->Audio.NumAudBlocks; i++) {
if (vqabuf->Audio.IsLoaded[i] == 0) {
txt[i] = '_';
} else {
txt[i] = 'X';
}
}
txt[i] = 0;
Mono_Set_Cursor(LOADER_WX1 + 9,LOADER_WY2 - 2);
Mono_Print(txt);
Mono_Set_Cursor(LOADER_WX1 + 9,LOADER_WY2-1);
Mono_Print(" ");
Mono_Set_Cursor(LOADER_WX1 + 9 + vqabuf->Audio.PlayPosition
/ config->HMIBufSize,LOADER_WY2 - 1);
Mono_Print("P");
Mono_Set_Cursor(LOADER_WX1 + 9 + vqabuf->Loader.AudBufPos
/ config->HMIBufSize,LOADER_WY2 - 1);
Mono_Print("L");
/* Drawer data */
Mono_Set_Cursor(DRAWER_WX1 + 22,DRAWER_WY1 + 1);
sprintf(txt,"%4d", vqabuf->Drawer.LastFrameNum);
Mono_Print(txt);
Mono_Set_Cursor(DRAWER_WX1 + 22,DRAWER_WY1 + 2);
sprintf(txt,"%4d", vqabuf->Drawer.DesiredFrame);
Mono_Print(txt);
Mono_Set_Cursor(DRAWER_WX1 + 22,DRAWER_WY1 + 3);
sprintf(txt,"%4ld", vqabuf->Drawer.WaitsOnFlipper);
Mono_Print(txt);
Mono_Set_Cursor(DRAWER_WX1 + 22,DRAWER_WY1 + 4);
sprintf(txt,"%4ld", vqabuf->Drawer.WaitsOnLoader);
Mono_Print(txt);
Mono_Set_Cursor(DRAWER_WX1 + 22,DRAWER_WY1 + 5);
sprintf(txt,"%4d", vqabuf->Drawer.NumSkipped);
Mono_Print(txt);
Mono_Set_Cursor(DRAWER_WX1 + 22,DRAWER_WY1 + 6);
sprintf(txt," %dx%d", vqap->Header.BlockWidth, vqap->Header.BlockHeight);
Mono_Print(txt);
/* Draw a picture of the frame buffers */
frame = vqabuf->FrameData;
for (i = 0; i < config->NumFrameBufs; i++) {
if (frame->Flags & VQAFRMF_LOADED) {
txt[i] = 'X';
} else {
txt[i] = '_';
}
if (vqabuf->Flipper.CurFrame == frame) {
frameindex = i;
}
frame = frame->Next;
}
txt[i] = 0;
Mono_Set_Cursor(DRAWER_WX1 + 10,DRAWER_WY2 - 2);
Mono_Print(txt);
Mono_Set_Cursor(DRAWER_WX1 + 10,DRAWER_WY2 - 1);
Mono_Print(" ");
Mono_Set_Cursor(DRAWER_WX1 + 10 + frameindex,DRAWER_WY2 - 1);
Mono_Print("^");
/* Draw a picture of the codebook buffers */
cbook = vqabuf->CBData;
for (i = 0; i < config->NumCBBufs; i++) {
if (vqabuf->Loader.CurCB == cbook) {
loadcb = i;
}
if (vqabuf->Flipper.CurFrame->Codebook == cbook) {
drawcb = i;
}
cbook = cbook->Next;
}
Mono_Set_Cursor(DRAWER_WX1 + 34,DRAWER_WY2 - 2);
Mono_Print("___");
Mono_Set_Cursor(DRAWER_WX1 + 34,DRAWER_WY2 - 1);
Mono_Print(" ");
Mono_Set_Cursor(DRAWER_WX1 + 34 + loadcb,DRAWER_WY2 - 1);
Mono_Print("L");
Mono_Set_Cursor(DRAWER_WX1 + 34 + drawcb,DRAWER_WY2 - 1);
Mono_Print("D");
/* Audio data */
Mono_Set_Cursor(AUDIO_WX1 + 22, AUDIO_WY1 + 1);
sprintf(txt,"%4ld", vqabuf->Audio.NumSkipped);
Mono_Print(txt);
/* Flipper data */
Mono_Set_Cursor(FLIPPER_WX1 + 22,FLIPPER_WY1 + 1);
sprintf(txt,"%4d", vqabuf->Flipper.LastFrameNum);
Mono_Print(txt);
Mono_Set_Cursor(0,0);
}
#endif /* VQAMONO_ON */

512
VQ/VQA32/MONODISP.CPP Normal file
View File

@@ -0,0 +1,512 @@
/*
** 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
* VQA player library. (32-Bit protected mode)
*
* FILE
* monodisp.c
*
* DESCRIPTION
* Monochrome display (debug)
*
* PROGRAMMER
* Bill Randolph
* Denzil E. Long, Jr.
*
* DATE
* April 6, 1995
*
*----------------------------------------------------------------------------
*
* PUBLIC
* VQA_InitMono - Initialize the player's mono screen.
* VQA_UpdateMono - Update the player's mono output.
*
****************************************************************************/
#include <stdio.h>
#include <string.h>
#include "vq.h"
#include "vqaplayp.h"
#include <vqm32\all.h>
#if(VQAMONO_ON)
/* Main window */
#define MAIN_WX1 0
#define MAIN_WX2 79
#define MAIN_WY1 0
#define MAIN_WY2 9
#define MAIN_TITLE "VQA Player"
/* Loader data window */
#define LOADER_WX1 0
#define LOADER_WX2 39
#define LOADER_WY1 10
#define LOADER_WY2 20
#define LOADER_TITLE " Frame Loader "
/* Drawer data window */
#define DRAWER_WX1 40
#define DRAWER_WX2 79
#define DRAWER_WY1 10
#define DRAWER_WY2 20
#define DRAWER_TITLE " Frame Drawer "
/* Audio data window */
#define AUDIO_WX1 0
#define AUDIO_WX2 39
#define AUDIO_WY1 21
#define AUDIO_WY2 24
#define AUDIO_TITLE " Audio Callback "
/* Flipper data window */
#define FLIPPER_WX1 40
#define FLIPPER_WX2 79
#define FLIPPER_WY1 21
#define FLIPPER_WY2 24
#define FLIPPER_TITLE " Frame Flipper "
extern char *HMIDevName;
/****************************************************************************
*
* NAME
* VQA_InitMono - Initialize the player's mono screen.
*
* SYNOPSIS
* VQA_InitMono(VQA)
*
* void VQA_InitMono(VQAHandleP *);
*
* FUNCTION
*
* INPUTS
* VQA - Pointer to private VQA handle.
*
* RESULT
* NONE
*
****************************************************************************/
#pragma argsused
void VQA_InitMono(VQAHandleP *vqap)
{
VQAData *vqabuf;
VQAConfig *config;
char txt[80];
/* Dereference commonly used data members of quick access. */
vqabuf = vqap->VQABuf;
config = &vqap->Config;
/* Enable and clear the mono screen */
Mono_Enable();
Mono_Clear_Screen();
/* Init main window */
Mono_Draw_Rect(MAIN_WX1, MAIN_WY1, (MAIN_WX2 - MAIN_WX1 + 1),
(MAIN_WY2 - MAIN_WY1 + 1), 2, 1);
Mono_Set_Cursor((MAIN_WX2 + MAIN_WX1 - strlen(MAIN_TITLE)) / 2, MAIN_WY1);
Mono_Print(MAIN_TITLE);
/* Video mode */
Mono_Set_Cursor(MAIN_WX1 + 18, MAIN_WY1 + 1);
Mono_Print("Video Mode: ");
switch (config->Vmode) {
#if(VQAMONO_ON)
case MCGA:
if (config->DrawFlags & VQACFGF_BUFFER) {
Mono_Print("MCGA Buffered");
} else {
Mono_Print("MCGA Direct to screen");
}
break;
#endif
#if(VQAXMODE_ON)
case XMODE_320X200:
if (config->DrawFlags & VQACFGF_BUFFER) {
Mono_Print("XMODE 320x200 Buffered");
} else {
if (config->DrawFlags & VQACFGF_VRAMCB) {
Mono_Print("XMODE 320x200 VRAM Copy");
} else {
Mono_Print("XMODE 320x200 Linear->Banked");
}
}
break;
case XMODE_320X240:
if (config->DrawFlags & VQACFGF_BUFFER) {
Mono_Print("XMODE 320x240 Buffered");
} else {
if (config->DrawFlags & VQACFGF_VRAMCB) {
Mono_Print("XMODE 320x240 VRAM Copy");
} else {
Mono_Print("XMODE 320x240 Linear->Banked");
}
}
break;
#endif
#if(VQAVESA_ON)
case VESA_640X480_256:
Mono_Print("VESA 640x480");
break;
case VESA_320X200_32K_1:
if (config->DrawFlags & VQACFGF_BUFFER) {
Mono_Print("VESA 320x200 Buffered");
} else {
Mono_Print("VESA 320x200 Direct to screen");
}
break;
#endif
default:
Mono_Print("UNKNOWN");
break;
}
/* Sound status */
Mono_Set_Cursor(MAIN_WX1 + 18, MAIN_WY1 + 2);
Mono_Print(" Sound: ");
if (config->OptionFlags & VQAOPTF_AUDIO) {
sprintf(txt,"%u Hz", config->AudioRate);
Mono_Print(txt);
} else {
Mono_Print("OFF");
}
Mono_Set_Cursor(MAIN_WX1 + 18, MAIN_WY1 + 3);
Mono_Print(" Driver Name: ");
Mono_Print(HMIDevName);
/* Frame rates */
Mono_Set_Cursor(MAIN_WX1 + 18, MAIN_WY1 + 4);
sprintf(txt," Load Frame Rate: %d", config->FrameRate);
Mono_Print(txt);
Mono_Set_Cursor(MAIN_WX1 + 18, MAIN_WY1 + 5);
sprintf(txt," Draw Frame Rate: %d", config->DrawRate);
Mono_Print(txt);
/* Slow palette */
Mono_Set_Cursor(MAIN_WX1 + 18, MAIN_WY1 + 6);
Mono_Print(" Slow palette: ");
if (config->OptionFlags & VQAOPTF_SLOWPAL) {
Mono_Print("ON");
} else {
Mono_Print("OFF");
}
/* Memory Usage */
Mono_Set_Cursor(MAIN_WX1 + 18, MAIN_WY1 + 7);
sprintf(txt," Memory Used: %ld", vqabuf->MemUsed);
Mono_Print(txt);
/* Timer Method */
Mono_Set_Cursor(MAIN_WX1 + 18, MAIN_WY1 + 8);
if (VQA_TimerMethod() == VQA_TMETHOD_DOS) {
Mono_Print(" DOS Timer:");
} else if (VQA_TimerMethod() == VQA_TMETHOD_INT) {
Mono_Print(" Interrupt Timer:");
} else if (VQA_TimerMethod() == VQA_TMETHOD_AUDIO) {
Mono_Print(" Audio DMA Timer:");
} else {
Mono_Print(" Defualt:");
}
/* Init loader data window */
Mono_Draw_Rect(LOADER_WX1, LOADER_WY1, (LOADER_WX2 - LOADER_WX1 + 1),
(LOADER_WY2 - LOADER_WY1 + 1), 2, 1);
Mono_Set_Cursor((LOADER_WX2 + LOADER_WX1 - strlen(LOADER_TITLE)) / 2,
LOADER_WY1);
Mono_Print(LOADER_TITLE);
Mono_Set_Cursor(LOADER_WX1 + 2, LOADER_WY1 + 1);
Mono_Print(" Current Frame #:");
Mono_Set_Cursor(LOADER_WX1 + 2, LOADER_WY1 + 2);
Mono_Print("# Waits on Drawer:");
Mono_Set_Cursor(LOADER_WX1 + 2, LOADER_WY1 + 3);
Mono_Print(" # Waits on Audio:");
Mono_Set_Cursor(LOADER_WX1 + 2, LOADER_WY1 + 4);
Mono_Print(" Frame Size:");
Mono_Set_Cursor(LOADER_WX1 + 2, LOADER_WY1 + 5);
Mono_Print(" Max Frame Size:");
Mono_Set_Cursor(LOADER_WX1 + 2, LOADER_WY2 - 2);
Mono_Print("Audio:");
/* Init drawer data window */
Mono_Draw_Rect(DRAWER_WX1, DRAWER_WY1, (DRAWER_WX2 - DRAWER_WX1 + 1),
(DRAWER_WY2 - DRAWER_WY1 + 1), 2, 1);
Mono_Set_Cursor((DRAWER_WX2 + DRAWER_WX1 - strlen(DRAWER_TITLE)) / 2,
DRAWER_WY1);
Mono_Print(DRAWER_TITLE);
Mono_Set_Cursor(DRAWER_WX1 + 2, DRAWER_WY1 + 1);
Mono_Print(" Current Frame #:");
Mono_Set_Cursor(DRAWER_WX1 + 2, DRAWER_WY1 + 2);
Mono_Print(" Desired Frame #:");
Mono_Set_Cursor(DRAWER_WX1 + 2, DRAWER_WY1 + 3);
Mono_Print("# Waits on Flipper:");
Mono_Set_Cursor(DRAWER_WX1 + 2, DRAWER_WY1 + 4);
Mono_Print(" # Waits on Loader:");
Mono_Set_Cursor(DRAWER_WX1 + 2, DRAWER_WY1 + 5);
Mono_Print(" # Frames Skipped:");
Mono_Set_Cursor(DRAWER_WX1 + 2, DRAWER_WY1 + 6);
Mono_Print(" VQ Block Size:");
Mono_Set_Cursor(DRAWER_WX1 + 2, DRAWER_WY2 - 2);
Mono_Print("Frames: Cbooks:");
/* Init audio data window */
Mono_Draw_Rect(AUDIO_WX1, AUDIO_WY1, (AUDIO_WX2 - AUDIO_WX1 + 1),
(AUDIO_WY2 - AUDIO_WY1 + 1), 2, 1);
Mono_Set_Cursor((AUDIO_WX2 + AUDIO_WX1 - strlen(AUDIO_TITLE)) / 2,
AUDIO_WY1);
Mono_Print(AUDIO_TITLE);
Mono_Set_Cursor(AUDIO_WX1 + 2, AUDIO_WY1 + 1);
Mono_Print("# Repeated Buffers:");
/* Init flipper data window */
Mono_Draw_Rect(FLIPPER_WX1, FLIPPER_WY1, (FLIPPER_WX2 - FLIPPER_WX1 + 1),
(FLIPPER_WY2 - FLIPPER_WY1 + 1), 2, 1);
Mono_Set_Cursor((FLIPPER_WX2 + FLIPPER_WX1 - strlen(FLIPPER_TITLE)) / 2,
FLIPPER_WY1);
Mono_Print(FLIPPER_TITLE);
Mono_Set_Cursor(FLIPPER_WX1 + 2, FLIPPER_WY1 + 1);
Mono_Print("Current Frame #:");
}
/****************************************************************************
*
* NAME
* VQA_UpdateMono - Update the player's mono output.
*
* SYNOPSIS
* VQA_UpdateMono(VQA)
*
* void VQA_UpdateMono(VQAHandleP *);
*
* FUNCTION
*
* INPUTS
* VQA - Pointer to private VQA handle.
*
* RESULT
* NONE
*
****************************************************************************/
#pragma argsused
void VQA_UpdateMono(VQAHandleP *vqap)
{
VQAData *vqabuf;
VQAConfig *config;
VQAFrameNode *frame;
VQACBNode *cbook;
long frameindex = -1;
long loadcb = -1;
long drawcb = -1;
long i;
unsigned long curtime;
char txt[80];
/* Dereference commonly used data members for quick access. */
vqabuf = vqap->VQABuf;
config = &vqap->Config;
/* Timer value */
curtime = VQA_GetTime(vqap);
Mono_Set_Cursor(MAIN_WX1 + 40, MAIN_WY1 + 8);
sprintf(txt,"%02ld:%02ld.%02ld",curtime / (VQA_TIMETICKS * VQA_TIMETICKS),
curtime / VQA_TIMETICKS,((curtime * 100L) / VQA_TIMETICKS)
-((curtime / VQA_TIMETICKS) * 100L));
Mono_Print(txt);
/* Loader data */
Mono_Set_Cursor(LOADER_WX1 + 22, LOADER_WY1 + 1);
sprintf(txt,"%4d",vqabuf->Loader.LastFrameNum);
Mono_Print(txt);
Mono_Set_Cursor(LOADER_WX1 + 22, LOADER_WY1 + 2);
sprintf(txt,"%4ld",vqabuf->Loader.WaitsOnDrawer);
Mono_Print(txt);
Mono_Set_Cursor(LOADER_WX1 + 22, LOADER_WY1 + 3);
sprintf(txt,"%4ld",vqabuf->Loader.WaitsOnAudio);
Mono_Print(txt);
Mono_Set_Cursor(LOADER_WX1 + 22, LOADER_WY1 + 4);
sprintf(txt,"%5u",vqabuf->Loader.FrameSize);
Mono_Print(txt);
Mono_Set_Cursor(LOADER_WX1 + 22, LOADER_WY1 + 5);
sprintf(txt,"%5u",vqabuf->Loader.MaxFrameSize);
Mono_Print(txt);
#if(VQAAUDIO_ON)
/* Draw a picture of the audio buffers */
for (i = 0; i < vqabuf->Audio.NumAudBlocks; i++) {
if (vqabuf->Audio.IsLoaded[i] == 0) {
txt[i] = '_';
} else {
txt[i] = 'X';
}
}
txt[i] = 0;
Mono_Set_Cursor(LOADER_WX1 + 9,LOADER_WY2 - 2);
Mono_Print(txt);
Mono_Set_Cursor(LOADER_WX1 + 9,LOADER_WY2-1);
Mono_Print(" ");
Mono_Set_Cursor(LOADER_WX1 + 9 + vqabuf->Audio.PlayPosition
/ config->HMIBufSize,LOADER_WY2 - 1);
Mono_Print("P");
Mono_Set_Cursor(LOADER_WX1 + 9 + vqabuf->Audio.AudBufPos
/ config->HMIBufSize,LOADER_WY2 - 1);
Mono_Print("L");
#endif /* VQAAUDIO_ON */
/* Drawer data */
Mono_Set_Cursor(DRAWER_WX1 + 22,DRAWER_WY1 + 1);
sprintf(txt,"%4d", vqabuf->Drawer.LastFrameNum);
Mono_Print(txt);
Mono_Set_Cursor(DRAWER_WX1 + 22,DRAWER_WY1 + 2);
sprintf(txt,"%4d", vqabuf->Drawer.DesiredFrame);
Mono_Print(txt);
Mono_Set_Cursor(DRAWER_WX1 + 22,DRAWER_WY1 + 3);
sprintf(txt,"%4ld", vqabuf->Drawer.WaitsOnFlipper);
Mono_Print(txt);
Mono_Set_Cursor(DRAWER_WX1 + 22,DRAWER_WY1 + 4);
sprintf(txt,"%4ld", vqabuf->Drawer.WaitsOnLoader);
Mono_Print(txt);
Mono_Set_Cursor(DRAWER_WX1 + 22,DRAWER_WY1 + 5);
sprintf(txt,"%4d", vqabuf->Drawer.NumSkipped);
Mono_Print(txt);
Mono_Set_Cursor(DRAWER_WX1 + 22,DRAWER_WY1 + 6);
sprintf(txt," %dx%d", vqap->Header.BlockWidth, vqap->Header.BlockHeight);
Mono_Print(txt);
/* Draw a picture of the frame buffers */
frame = vqabuf->FrameData;
for (i = 0; i < config->NumFrameBufs; i++) {
if (frame->Flags & VQAFRMF_LOADED) {
txt[i] = 'X';
} else {
txt[i] = '_';
}
if (vqabuf->Flipper.CurFrame == frame) {
frameindex = i;
}
frame = frame->Next;
}
txt[i] = 0;
Mono_Set_Cursor(DRAWER_WX1 + 10,DRAWER_WY2 - 2);
Mono_Print(txt);
Mono_Set_Cursor(DRAWER_WX1 + 10,DRAWER_WY2 - 1);
Mono_Print(" ");
Mono_Set_Cursor(DRAWER_WX1 + 10 + frameindex,DRAWER_WY2 - 1);
Mono_Print("^");
/* Draw a picture of the codebook buffers */
cbook = vqabuf->CBData;
for (i = 0; i < config->NumCBBufs; i++) {
if (vqabuf->Loader.CurCB == cbook) {
loadcb = i;
}
if (vqabuf->Flipper.CurFrame->Codebook == cbook) {
drawcb = i;
}
cbook = cbook->Next;
}
Mono_Set_Cursor(DRAWER_WX1 + 34,DRAWER_WY2 - 2);
Mono_Print("___");
Mono_Set_Cursor(DRAWER_WX1 + 34,DRAWER_WY2 - 1);
Mono_Print(" ");
Mono_Set_Cursor(DRAWER_WX1 + 34 + loadcb,DRAWER_WY2 - 1);
Mono_Print("L");
Mono_Set_Cursor(DRAWER_WX1 + 34 + drawcb,DRAWER_WY2 - 1);
Mono_Print("D");
/* Audio data */
#if(VQAAUDIO_ON)
Mono_Set_Cursor(AUDIO_WX1 + 22, AUDIO_WY1 + 1);
sprintf(txt,"%4ld", vqabuf->Audio.NumSkipped);
Mono_Print(txt);
#endif
/* Flipper data */
Mono_Set_Cursor(FLIPPER_WX1 + 22,FLIPPER_WY1 + 1);
sprintf(txt,"%4d", vqabuf->Flipper.LastFrameNum);
Mono_Print(txt);
Mono_Set_Cursor(0,0);
}
#endif /* VQAMONO_ON */

565
VQ/VQA32/SOS.H Normal file
View File

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

128
VQ/VQA32/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


83
VQ/VQA32/SOSDEFS.H Normal file
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/VQA32/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/VQA32/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


558
VQ/VQA32/TASK.CPP Normal file
View File

@@ -0,0 +1,558 @@
/*
** 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
* VQA player library. (32-Bit protected mode)
*
* FILE
* task.c
*
* DESCRIPTION
* Loading and drawing delegation
*
* PROGRAMMER
* Bill Randolph
* Denzil E. Long, Jr.
*
* DATE
* July 25, 1995
*
*----------------------------------------------------------------------------
*
* PUBLIC
* VQA_Alloc - Allocate a VQAHandle to use.
* VQA_Free - Free a VQAHandle.
* VQA_Init - Initialize the VQAHandle IO.
* VQA_Play - Play the VQA movie.
* VQA_GetInfo - Get VQA movie information.
* VQA_GetStats - Get VQA movie statistics.
* VQA_Version - Get VQA library version number.
* VQA_IDString - Get the VQA player library's ID string.
*
* PRIVATE
* VQA_IO_Task - Loader task for multitasking.
* VQA_Rendering_Task - Drawer task for multitasking.
* User_Update - Page flip routine called by the task interrupt.
*
****************************************************************************/
#include <stdio.h>
#include <malloc.h>
#include <dos.h>
#include <mem.h>
#include <conio.h>
#include <sys\timeb.h>
#include <vqm32\all.h>
#include "vqaplayp.h"
/*---------------------------------------------------------------------------
* PRIVATE DECLARATIONS
*-------------------------------------------------------------------------*/
/* Externals */
#ifdef __cplusplus
extern "C" {
#endif
extern int cdecl Check_Key(void);
extern int cdecl Get_Key(void);
#ifdef __cplusplus
}
#endif
/****************************************************************************
*
* NAME
* VQA_Alloc - Allocate a VQAHandle to use.
*
* SYNOPSIS
* VQAHandle = VQA_Alloc()
*
* VQAHandle *VQA_Alloc(void);
*
* FUNCTION
* Obtain a VQAHandle. This handle is used by most VQA library functions,
* and contains the current position in the file. This is the only legal
* way to obtain a VQAHandle.
*
* INPUTS
* NONE
*
* RESULT
* VQA - Handle of a VQA.
*
****************************************************************************/
VQAHandle *VQA_Alloc(void)
{
VQAHandleP *vqa;
if ((vqa = (VQAHandleP *)malloc(sizeof(VQAHandleP))) != NULL) {
memset(vqa, 0, sizeof(VQAHandleP));
}
return ((VQAHandle *)vqa);
}
/****************************************************************************
*
* NAME
* VQA_Free - Free a VQAHandle.
*
* SYNOPSIS
* VQA_Free(VQA)
*
* void VQA_Free(VQAHandle *);
*
* FUNCTION
* Dispose of a VQAHandle. This is the only legal way to dispose of a
* VQAHandle.
*
* INPUTS
* VQA - Pointer to VQAHandle to dispose of.
*
* RESULT
* NONE
*
****************************************************************************/
void VQA_Free(VQAHandle *vqa)
{
if (vqa) free(vqa);
}
/****************************************************************************
*
* NAME
* VQA_Init - Initialize the VQAHandle IO handler.
*
* SYNOPSIS
* VQA_Init(VQA, IOHandler)
*
* void VQA_Init(VQAHandle *, IOHandler *);
*
* FUNCTION
* Initialize the specified VQAHandle IO with the client provided custom
* IO handler.
*
* INPUTS
* VQA - Pointer to VQAHandle to initialize.
* IOHandler - Pointer to custom file I/O handler function.
*
* RESULT
* NONE
*
****************************************************************************/
void VQA_Init(VQAHandle *vqa, long(*iohandler)(VQAHandle *vqa, long action,
void *buffer, long nbytes))
{
((VQAHandleP *)vqa)->IOHandler = iohandler;
}
/****************************************************************************
*
* NAME
* VQA_Play - Play the VQA movie.
*
* SYNOPSIS
* Error = VQA_Play(VQA, Mode)
*
* long VQA_Play(VQAHandle *, long);
*
* FUNCTION
* Playback the movie associated with the specified VQAHandle.
*
* INPUTS
* VQA - Pointer to handle of movie to play.
* Mode - Playback mode.
* VQAMODE_RUN - Run the movie until completion.
* VQAMODE_WALK - Walk the movie frame by frame.
* VQAMODE_PAUSE - Pause the movie.
* VQAMODE_STOP - Stop the movie (Shutdown).
*
* RESULT
* Error - 0 if successful, or error code.
*
****************************************************************************/
long VQA_Play(VQAHandle *vqa, long mode)
{
VQAData *vqabuf;
VQAConfig *config;
VQADrawer *drawer;
long rc;
long i;
long key;
/* Dereference commonly used data members for quick access. */
vqabuf = ((VQAHandleP *)vqa)->VQABuf;
drawer = &vqabuf->Drawer;
config = &((VQAHandleP *)vqa)->Config;
/* One time player priming. */
if (!(vqabuf->Flags & VQADATF_PRIMED)) {
/* Init the Drawer's configuration */
VQA_Configure_Drawer((VQAHandleP *)vqa);
/* If audio enabled & loaded, start playing */
#if(VQAAUDIO_ON)
if ((config->OptionFlags & VQAOPTF_AUDIO) && vqabuf->Audio.IsLoaded[0]) {
VQA_StartAudio((VQAHandleP *)vqa);
}
#endif
/* Initialize the timer */
i = ((vqabuf->Drawer.CurFrame->FrameNum * VQA_TIMETICKS)
/ config->DrawRate);
VQA_SetTimer((VQAHandleP *)vqa, i, config->TimerMethod);
vqabuf->StartTime = VQA_GetTime((VQAHandleP *)vqa);
/* Set up the Mono screen */
#if(VQAMONO_ON)
if (config->OptionFlags & VQAOPTF_MONO) {
VQA_InitMono((VQAHandleP *)vqa);
}
#endif
/* Priming is complete. */
vqabuf->Flags |= VQADATF_PRIMED;
}
/* Main Player Loop */
switch (mode) {
case VQAMODE_PAUSE:
if ((vqabuf->Flags & VQADATF_PAUSED) == 0) {
vqabuf->Flags |= VQADATF_PAUSED;
vqabuf->EndTime = VQA_GetTime((VQAHandleP *)vqa);
/* Stop the audio while the movie is paused. */
#if(VQAAUDIO_ON)
if (vqabuf->Audio.Flags & VQAAUDF_ISPLAYING) {
VQA_StopAudio((VQAHandleP *)vqa);
}
#endif
}
rc = VQAERR_PAUSED;
break;
case VQAMODE_RUN:
case VQAMODE_WALK:
default:
/* Start up the movie if is it currently paused. */
if (vqabuf->Flags & VQADATF_PAUSED) {
vqabuf->Flags &= ~VQADATF_PAUSED;
/* Start the audio if it was previously on. */
#if(VQAAUDIO_ON)
if (config->OptionFlags & VQAOPTF_AUDIO) {
VQA_StartAudio((VQAHandleP *)vqa);
}
#endif
VQA_SetTimer((VQAHandleP *)vqa, vqabuf->EndTime, config->TimerMethod);
}
/* Load, Draw, Load, Draw, Load, Draw ... */
while ((vqabuf->Flags & (VQADATF_DDONE|VQADATF_LDONE))
!= (VQADATF_DDONE|VQADATF_LDONE)) {
/* Load a frame */
if (!(vqabuf->Flags & VQADATF_LDONE)) {
if ((rc = VQA_LoadFrame(vqa)) == 0) {
vqabuf->LoadedFrames++;
}
else if ((rc != VQAERR_NOBUFFER) && (rc != VQAERR_SLEEPING)) {
vqabuf->Flags |= VQADATF_LDONE;
rc = 0;
}
}
/* Draw a frame */
if ((config->DrawFlags & VQACFGF_NODRAW) == 0) {
if ((rc = (*(vqabuf->Draw_Frame))(vqa)) == 0) {
vqabuf->DrawnFrames++;
if (User_Update(vqa)) {
vqabuf->Flags |= (VQADATF_DDONE|VQADATF_LDONE);
}
}
else if ((vqabuf->Flags & VQADATF_LDONE)
&& (rc == VQAERR_NOBUFFER)) {
vqabuf->Flags |= VQADATF_DDONE;
}
} else {
vqabuf->Flags |= VQADATF_DDONE;
drawer->CurFrame->Flags = 0L;
drawer->CurFrame = drawer->CurFrame->Next;
}
/* Update Mono output */
#if(VQAMONO_ON)
if (config->OptionFlags & VQAOPTF_MONO) {
VQA_UpdateMono((VQAHandleP *)vqa);
}
#endif
if (mode == VQAMODE_WALK) {
break;
}
#if(VQASTANDALONE)
else {
/* Do single-stepping check. */
if (config->OptionFlags & VQAOPTF_STEP) {
while ((key = Check_Key()) == 0);
Get_Key();
/* Escape key still quits. */
if (key == 27) {
break;
}
}
/* Check for ESC */
if ((key = Check_Key()) != 0) {
mode = VQAMODE_STOP;
break;
}
}
#endif
}
break;
}
/* If the movie is finished or we are requested to stop then shutdown. */
if (((vqabuf->Flags & (VQADATF_DDONE|VQADATF_LDONE))
== (VQADATF_DDONE|VQADATF_LDONE)) || (mode == VQAMODE_STOP)) {
/* Record the end time; must be done before stopping audio, since we're
* getting the elapsed time from the audio DMA position.
*/
vqabuf->EndTime = VQA_GetTime((VQAHandleP *)vqa);
/* Stop audio, if it's playing. */
#if(VQAAUDIO_ON)
if (vqabuf->Audio.Flags & VQAAUDF_ISPLAYING) {
VQA_StopAudio((VQAHandleP *)vqa);
}
#endif
/* Movie is finished. */
rc = VQAERR_EOF;
}
return (rc);
}
/****************************************************************************
*
* NAME
* VQA_GetInfo - Get VQA movie information.
*
* SYNOPSIS
* VQA_GetInfo(VQA, Info)
*
* void VQA_GetInfo(VQAHandle *, VQAInfo *);
*
* FUNCTION
* Retrieve information about the opened movie.
*
* INPUTS
* VQA - Pointer to VQAHandle of opened movie.
* Info - Pointer to VQAInfo structure to fill.
*
* RESULT
* NONE
*
****************************************************************************/
void VQA_GetInfo(VQAHandle *vqa, VQAInfo *info)
{
VQAHeader *header;
/* Dereference header structure. */
header = &((VQAHandleP *)vqa)->Header;
info->NumFrames = header->Frames;
info->ImageHeight = header->ImageHeight;
info->ImageWidth = header->ImageWidth;
info->ImageBuf = ((VQAHandleP *)vqa)->VQABuf->Drawer.ImageBuf;
}
/****************************************************************************
*
* NAME
* VQA_GetStats - Get VQA movie statistics.
*
* SYNOPSIS
* VQA_GetStats(VQA, Stats)
*
* void VQA_GetStats(VQAHandle *, VQAStatistics *);
*
* FUNCTION
* Retrieve the statistics for the VQA movie.
*
* INPUTS
* VQA - Handle of VQA movie to get statistics for.
* Stats - Pointer to VQAStatistics to fill.
*
* RESULT
* NONE
*
****************************************************************************/
void VQA_GetStats(VQAHandle *vqa, VQAStatistics *stats)
{
VQAData *vqabuf;
/* Dereference VQAData structure from VQAHandle */
vqabuf = ((VQAHandleP *)vqa)->VQABuf;
stats->MemUsed = vqabuf->MemUsed;
stats->StartTime = vqabuf->StartTime;
stats->EndTime = vqabuf->EndTime;
stats->FramesLoaded = vqabuf->LoadedFrames;
stats->FramesDrawn = vqabuf->DrawnFrames;
stats->FramesSkipped = vqabuf->Drawer.NumSkipped;
stats->MaxFrameSize = vqabuf->Loader.MaxFrameSize;
#if(VQAAUDIO_ON)
stats->SamplesPlayed = vqabuf->Audio.SamplesPlayed;
#else
stats->SamplesPlayed = 0;
#endif
}
/****************************************************************************
*
* NAME
* VQA_Version - Get VQA library version number.
*
* SYNOPSIS
* Version = VQA_Version()
*
* char *VQA_Version(void);
*
* FUNCTION
* Return the version of the VQA player library.
*
* INPUTS
* NONE
*
* RESULT
* Version - Pointer to version number string.
*
****************************************************************************/
char *VQA_Version(void)
{
return(VQA_VERSION);
}
/****************************************************************************
*
* NAME
* VQA_IDString - Get the VQA player library's ID string.
*
* SYNOPSIS
* IDString = VQA_IDString()
*
* char *VQA_IDString(void);
*
* FUNCTION
* Return the ID string of this VQA player library.
*
* INPUTS
* NONE
*
* RESULT
* IDString - Pointer to ID string.
*
****************************************************************************/
char *VQA_IDString(void)
{
return (VQA_IDSTRING);
}
/****************************************************************************
*
* NAME
* User_Update - Page flip routine called by the task interrupt.
*
* SYNOPSIS
* User_Update(VQA)
*
* long User_Update(VQAHandle *);
*
* FUNCTION
*
* INPUTS
* VQA - Handle of VQA movie.
*
* RESULT
* NONE
*
****************************************************************************/
long User_Update(VQAHandle *vqa)
{
VQAData *vqabuf;
long rc = 0;
/* Dereference data members for quicker access. */
vqabuf = ((VQAHandleP *)vqa)->VQABuf;
if (vqabuf->Flags & VQADATF_UPDATE) {
/* Invoke the page flip routine */
rc = (*(vqabuf->Page_Flip))(vqa);
/* Update data for mono output */
vqabuf->Flipper.LastFrameNum = vqabuf->Flipper.CurFrame->FrameNum;
/* Mark the frame as loadable */
vqabuf->Flipper.CurFrame->Flags = 0L;
vqabuf->Flags &= (~VQADATF_UPDATE);
}
return (rc);
}

10
VQ/VQA32/TASM32.CFG Normal file
View File

@@ -0,0 +1,10 @@
/t
/m
/w+
/jJUMPS
/ml
/p
/z
/iC:\PROJECTS\INCLUDE\VQM32
/zi
/dPHARLAP_TNT=1

1
VQ/VQA32/TLIB.CFG Normal file
View File

@@ -0,0 +1 @@
/C /E

5
VQ/VQA32/TLINK32.CFG Normal file
View File

@@ -0,0 +1,5 @@
/c
/m
/Gm
-LC:\PROJECTS\LIB;C:\DEV\BC4\LIB
-v

124
VQ/VQA32/UNVQ.H Normal file
View File

@@ -0,0 +1,124 @@
/*
** Command & Conquer Red Alert(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef VQAUNVQ_H
#define VQAUNVQ_H
/****************************************************************************
*
* C O N F I D E N T I A L -- W E S T W O O D S T U D I O S
*
*----------------------------------------------------------------------------
*
* PROJECT
* VQAPlay32 library. (32-Bit protected mode)
*
* FILE
* unvq.h
*
* DESCRIPTION
* VQ frame decompress definitions.
*
* PROGRAMMER
* Denzil E. Long, Jr.
*
* DATE
* Feburary 8, 1995
*
****************************************************************************/
#ifdef PHARLAP_TNT
#include <pltypes.h>
#endif
/*---------------------------------------------------------------------------
* FUNCTION PROTOTYPES
*-------------------------------------------------------------------------*/
#ifdef __cplusplus
extern "C" {
#endif
/* unvqbuff.asm */
#ifndef PHARLAP_TNT
void cdecl UnVQ_2x2(unsigned char *codebook, unsigned char *pointers,
unsigned char *buffer, unsigned long blocksperrow,
unsigned long numrows, unsigned long bufwidth);
void cdecl UnVQ_2x3(unsigned char *codebook, unsigned char *pointers,
unsigned char *buffer, unsigned long blocksperrow,
unsigned long numrows, unsigned long bufwidth);
void cdecl UnVQ_4x2(unsigned char *codebook, unsigned char *pointers,
unsigned char *buffer, unsigned long blocksperrow,
unsigned long numrows, unsigned long bufwidth);
void cdecl UnVQ_4x4(unsigned char *codebook, unsigned char *pointers,
unsigned char *buffer, unsigned long blocksperrow,
unsigned long numrows, unsigned long bufwidth);
void cdecl UnVQ_4x2_Woofer(unsigned char *codebook, unsigned char *pointers,
unsigned char *buffer, unsigned long blocksperrow,
unsigned long numrows, unsigned long bufwidth);
/* unvqvesa.asm */
void cdecl UnVQ_4x2_VESA320_32K(unsigned char *codebook,
unsigned char *pointers, unsigned char *palette,
unsigned long grains_per_win,unsigned long dummy1,unsigned long dummy2);
#else /* PHARLAP_TNT */
void cdecl UnVQ_2x2(unsigned char *codebook, unsigned char *pointers,
FARPTR buffer, unsigned long blocksperrow, unsigned long numrows,
unsigned long bufwidth);
void cdecl UnVQ_2x3(unsigned char *codebook, unsigned char *pointers,
FARPTR buffer, unsigned long blocksperrow, unsigned long numrows,
unsigned long bufwidth);
void cdecl UnVQ_4x2(unsigned char *codebook, unsigned char *pointers,
FARPTR buffer, unsigned long blocksperrow, unsigned long numrows,
unsigned long bufwidth);
void cdecl UnVQ_4x4(unsigned char *codebook, unsigned char *pointers,
FARPTR buffer, unsigned long blocksperrow, unsigned long numrows,
unsigned long bufwidth);
/* unvqvesa.asm */
void cdecl UnVQ_4x2_VESA320_32K(unsigned char *codebook,
unsigned char *pointers, FARPTR palette, unsigned long grains_per_win,
unsigned long dummy1, unsigned long dummy2);
#endif /* PHARLAP_TNT */
/* unvqxmde.asm */
void cdecl UnVQ_4x2_Xmode(unsigned char *codebook, unsigned char *pointers,
unsigned char *buffer, unsigned long blocksperrow,
unsigned long numrows, unsigned long dummy);
void cdecl UnVQ_4x2_XmodeCB(unsigned char *cbdummy, unsigned char *pointers,
unsigned char *buffer, unsigned long blocksperrow,
unsigned long numrows, unsigned long dummy);
void cdecl Upload_4x2CB(unsigned char *codebook, unsigned long numentries);
void cdecl XlatePointers(unsigned char *pointers, unsigned long numpointers);
#ifdef __cplusplus
}
#endif
#endif /* VQAUNVQ_H */

1152
VQ/VQA32/UNVQBUFF.ASM Normal file

File diff suppressed because it is too large Load Diff

380
VQ/VQA32/UNVQVESA.ASM Normal file
View File

@@ -0,0 +1,380 @@
;
; 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
;* VQAPlay32 library.
;*
;* FILE
;* unvqvesa.asm
;*
;* DESCRIPTION
;* VESA VQ decompress/draw routines. (32-Bit protected mode)
;*
;* PROGRAMMER
;* Denzil E. Long, Jr.
;*
;*---------------------------------------------------------------------------
;*
;* PUBLIC
;* UnVQ_4x2_VESA320_32K - Draw 4x2 VQ frame to VESA320 32k color.
;*
;****************************************************************************
IDEAL
P386
MODEL USE32 FLAT
LOCALS ??
INCLUDE "vga.i"
INCLUDE "vesavid.i"
INCLUDE "vqaplay.i"
CODESEG
SKIP_PTR EQU 8000h
IF VQAVESA_ON
IF VQABLOCK_4X2
;****************************************************************************
;*
;* NAME
;* UnVQ_4x2_VESA320_32K - Draw 4x2 VQ frame to VESA320 32k color.
;*
;* SYNOPSIS
;* UnVQ_4x2_VESA320_32K(Codebook, Pointers, Palette, GrainPerWin)
;*
;* void UnVQ_4x2_VESA320_32K(char *, char *, char *, long);
;*
;* FUNCTION
;*
;* INPUTS
;* Codebook - Pointer to codebook.
;* Pointers - Pointer to vector pointer data to unvq.
;* Palette - Pointer to 15-bit palette.
;* GrainPerWin - Granularity units for 64k window.
;*
;* RESULT
;* NONE
;*
;****************************************************************************
;---------------------------------------------------------------------------
; SET_2_PIXELS:
; - Loads 2 bytes from codebook, expands them into words in eax
; - Sets them on the screen
; cb_index: offset into codebook of start of 2 bytes to load
; di_index: offset from current di to draw 2 pixels
; BX: offset into codebook of this block
; Uses: EAX, DX, SI!
;---------------------------------------------------------------------------
MACRO SET_2_PIXELS cb_index,edi_index
xor edx,edx
mov dl,[BYTE PTR ebx+1+cb_index]
shl edx,1
add edx,[palette]
mov esi,edx
mov ax,[WORD PTR esi]
shl eax,16
xor edx,edx
mov dl,[BYTE PTR ebx+cb_index]
shl edx,1
add edx,[palette]
mov esi,edx
mov ax,[WORD PTR esi]
IF PHARLAP_TNT
mov [DWORD PTR es:edi+edi_index],eax
ELSE
mov [DWORD PTR edi+edi_index],eax
ENDIF
ENDM
;---------------------------------------------------------------------------
; DRAW_BLOCK_ROWS macro:
; Draws 'numrows' rows of 'blocksperrow' blocks each
;---------------------------------------------------------------------------
MACRO DRAW_BLOCK_ROWS numrows,blocksperrow
LOCAL ??Start_row
LOCAL ??Not_finished_a_line
LOCAL ??One_color
LOCAL ??Draw_One_Color
LOCAL ??Next_row
LOCAL ??Done
mov [rowcount],numrows ; initialize row counter
;---------------------------------------- Start a new row:
??Start_row:
mov ecx,blocksperrow ; # blocks to fill a line
;---------------------------------------- Start a new block:
??Not_finished_a_line:
;........................................ Get next pointer word:
xor ebx,ebx
mov bx,[WORD PTR esi] ; BX = pointer word
add esi,2
;........................................ Check for a 1-color block:
or bx,bx ; see if high bit is set
js ??One_color
;---------------------------------------- Multi-color block:
mov [esi_save],esi ; save current SI
add ebx,[cb_offset] ; get codebook offset
SET_2_PIXELS 0,0
SET_2_PIXELS 2,4
SET_2_PIXELS 4,640
SET_2_PIXELS 6,644
add edi,8 ; next block position
mov esi,[esi_save] ; get current SI
;........................................ Check block count
dec ecx ; decrement block count
jnz ??Not_finished_a_line
;---------------------------------------- Next block row:
add edi,640
;
;............ see if we're past the end of the ptr data ............
;
dec [rowcount]
jnz ??Start_row
jmp ??Done
;---------------------------------------- 1-color block:
??One_color:
;................... skip ptr value SKIP_PTR .......................
cmp bx,SKIP_PTR
jne ??Draw_One_Color
add edi,8
dec ecx
jnz ??Not_finished_a_line
jmp ??Next_row
??Draw_One_Color:
not bx ; get palette index
shl bx,1 ; convert to WORD offset
add ebx,[palette]
mov ax,[WORD PTR ebx] ; get 15-bit palette value
mov dx,ax ; copy it into dx
shl eax,16
mov ax,dx ; eax = 2 pixels, same color
mov edx,eax ; edx = 2 pixels, same color
IF PHARLAP_TNT
mov [DWORD PTR es:edi],eax ; set 2 pixels
mov [DWORD PTR es:edi+4],edx ; set 2 pixels
mov [DWORD PTR es:edi+640],eax ; set 2 pixels
mov [DWORD PTR es:edi+644],edx ; set 2 pixels
ELSE
mov [DWORD PTR edi],eax ; set 2 pixels
mov [DWORD PTR edi+4],edx ; set 2 pixels
mov [DWORD PTR edi+640],eax ; set 2 pixels
mov [DWORD PTR edi+644],edx ; set 2 pixels
ENDIF
add edi,8 ; next block position
;........................................ Check block count
dec ecx ; decrement block count
jnz ??Not_finished_a_line
;---------------------------------------- Next block row:
??Next_row:
add edi,640
;
;............ see if we're past the end of the ptr data ............
;
dec [rowcount]
jnz ??Start_row
??Done:
ENDM
;---------------------------------------------------------------------------
; DRAW_BLOCK_PART_ROW macro:
; Draws top or bottom half of blocks on a row
; 'numblocks' = # blocks to draw
; 'cb_add' = amt to add to codebook (0=top half, 4=bottom half)
;---------------------------------------------------------------------------
MACRO DRAW_BLOCK_PART_ROW numblocks,cb_add
LOCAL ??Not_finished_a_line
LOCAL ??One_color
LOCAL ??Draw_One_Color
LOCAL ??Done
mov ecx,numblocks
;---------------------------------------- Start a new block:
??Not_finished_a_line:
;........................................ Get next pointer word:
xor ebx,ebx
mov bx,[WORD PTR esi] ; BX = pointer word
add esi,2
;........................................ Check for a 1-color block:
or bx,bx ; see if high bit is set
js short ??One_color
;---------------------------------------- Multi-color block:
mov [esi_save],esi ; save current SI
add ebx,[cb_offset] ; get codebook offset
SET_2_PIXELS cb_add,0
SET_2_PIXELS cb_add+2,4
add edi,8 ; next block position
mov esi,[esi_save] ; get current SI
;........................................ Check block count
dec ecx ; decrement block count
jnz short ??Not_finished_a_line
jmp ??Done
;---------------------------------------- 1-color block:
??One_color:
;................... skip ptr value SKIP_PTR .......................
cmp bx,SKIP_PTR
jne ??Draw_One_Color
add edi,8
dec ecx
jnz short ??Not_finished_a_line
jmp ??Done
??Draw_One_Color:
not bx ; get palette index
shl bx,1 ; convert to WORD offset
add ebx,[palette]
mov ax,[WORD PTR ebx] ; get 15-bit palette value
mov dx,ax ; copy it into dx
shl eax,16
mov ax,dx ; eax = 2 pixels, same color
mov edx,eax ; edx = 2 pixels, same color
IF PHARLAP_TNT
mov [DWORD PTR es:edi],eax ; set 2 pixels
mov [DWORD PTR es:edi+4],edx ; set 2 pixels
ELSE
mov [DWORD PTR edi],eax ; set 2 pixels
mov [DWORD PTR edi+4],edx ; set 2 pixels
ENDIF
add edi,8 ; next block position
;........................................ Check block count
dec ecx ; decrement block count
jnz ??Not_finished_a_line
??Done:
ENDM
;===========================================================================
; The actual procedure:
;===========================================================================
GLOBAL C UnVQ_4x2_VESA320_32K:NEAR
PROC UnVQ_4x2_VESA320_32K C NEAR
ARG codebook:NEAR PTR
ARG pointers:NEAR PTR
IF PHARLAP_TNT
ARG pal:QWORD ;KLUDGE - bcc32 pads FARPTR
ELSE
ARG palette:NEAR PTR
ENDIF
ARG grains_per_win:DWORD
ARG dummy1:DWORD
ARG dummy2:DWORD
LOCAL rowcount:DWORD ; # rows drawn
LOCAL esi_save:DWORD
LOCAL cb_offset:DWORD
IF PHARLAP_TNT
LOCAL palette:NEAR PTR
ENDIF
;-------------------------------------------------------------------
; Save registers
;-------------------------------------------------------------------
pushad
;-------------------------------------------------------------------
; Set GS:[cb_offset] to codebook
;-------------------------------------------------------------------
mov eax,[codebook]
sub eax,4
mov [cb_offset],eax
mov esi,[pointers]
;-------------------------------------------------------------------
; Set ES:DI to screen
;-------------------------------------------------------------------
IF PHARLAP_TNT
push es
les edi,[FWORD pal]
mov [palette],edi
mov eax,01Ch
mov es,ax
mov edi,0
ELSE
mov edi,0A0000h
ENDIF
;-------------------------------------------------------------------
; Do Bank 0:
; - 102 full scanlines (51 rows of blocks)
; - 128 pixels of the top half of blocks (32 top-half blocks)
;-------------------------------------------------------------------
SET_WINDOW 0
DRAW_BLOCK_ROWS 51,80
DRAW_BLOCK_PART_ROW 32,0 ; do top half
;-------------------------------------------------------------------
; Do Bank 1:
; - 128 pixels of the bottom half of the previous 32 blocks
; - 192 pixels of full blocks (1 row of 48 blocks)
; - 96 full scanlines (48 rows of blocks)
;-------------------------------------------------------------------
SET_WINDOW [grains_per_win]
sub esi,64 ; subtract word size of last 32 blks
mov edi,384
DRAW_BLOCK_PART_ROW 32,4 ; do bottom half
mov edi,0
DRAW_BLOCK_ROWS 1,48 ; draw one row of 48 full blocks
DRAW_BLOCK_ROWS 48,80 ; draw 48 full block rows
??End_of_data:
IF PHARLAP_TNT
pop es
ENDIF
popad
ret
ENDP UnVQ_4x2_VESA320_32K
ENDIF ;VQABLOCK_4X2
ENDIF ;VQAVESA_ON
END

724
VQ/VQA32/UNVQXMDE.ASM Normal file
View File

@@ -0,0 +1,724 @@
;
; 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
;* VQAPlay library.
;*
;* FILE
;* UnVQxmde.asm
;*
;* DESCRIPTION
;* XMode VQ decompress/draw routines.
;*
;* PROGRAMMER
;* Denzil E. Long, Jr.
;*
;* DATE
;* May 18, 1995
;*
;*---------------------------------------------------------------------------
;*
;* PUBLIC
;* UnVQ_4x2_Xmode - Draw 4x2 VQ frame directly to Xmode.
;* UnVQ_4x2_XmodeCB - Draw 4x2 VQ frame to Xmode from VRAM codebook.
;* Upload_4x2CB - Upload 4x2 codebook into XMode VRAM.
;* UnVQ_4x2_VESA320_32K - Draw 4x2 VQ frame to VESA320 32k color.
;* XlatePointers - Translate pointer to optimal XMode format.
;*
;****************************************************************************
IDEAL
P386
MODEL USE32 FLAT
LOCALS ??
INCLUDE "vga.i"
INCLUDE "vesavid.i"
INCLUDE "vqaplay.i"
CODESEG
IF VQAXMODE_ON
SKIP_PTR EQU 8000h
CBOOK_SEG EQU (0B0000h - 270h)
IF VQABLOCK_4X2
;****************************************************************************
;*
;* NAME
;* UnVQ_4x2_Xmode - Draw 4x2 VQ frame directly to Xmode.
;*
;* SYNOPSIS
;* UnVQ_4x2_Xmode(Codebook, Pointers, Buffer, BPR, Rows, Dummy)
;*
;* void UnVQ_4x2_Xmode(unsigned char *, unsigned char *, unsigned char *,
;* unsigned short, unsigned short, unsigned short);
;*
;* FUNCTION
;* This function draws an image to the Xmode display from the pointers
;* and codebook provided. This routine has been optimized for a 320x200
;* image.
;*
;* INPUTS
;* Codebook - Pointer to codebook used to draw image.
;* Pointers - Pointer to vector pointer data.
;* Buffer - Pointer to buffer to draw image into.
;* BPR - Number of blocks per row.
;* Rows - Number of rows.
;* Dummy - Not used (prototype placeholder)
;*
;* RESULT
;* NONE
;*
;****************************************************************************
GLOBAL C UnVQ_4x2_Xmode:NEAR
PROC UnVQ_4x2_Xmode C NEAR USES
ARG codebook:NEAR PTR
ARG pointers:NEAR PTR
IF PHARLAP_TNT
ARG buffer:QWORD ;KLUDGE - bcc32 pads FARPTR
ELSE
ARG buffer:NEAR PTR
ENDIF
ARG blocksperrow:DWORD
ARG numrows:DWORD
ARG bufwidth:DWORD
LOCAL data_end:DWORD
LOCAL cb_offset:DWORD
LOCAL edi_startval:DWORD
LOCAL rowoffset:DWORD
;----------------------------------------------------------------------------
; Initialize
;----------------------------------------------------------------------------
mov eax,[codebook] ;Adjust the codebook address so
sub eax,4 ; that the pointer offsets will
mov [cb_offset],eax ; point directly at the codeword.
mov eax,[bufwidth] ;Compute the offset to the next
shl eax,1 ; row of blocks.
mov [rowoffset],eax
mov esi,[pointers]
mov eax,[numrows] ;Compute the end address of the
mul [blocksperrow] ; pointer data.
shl eax,1
add eax,esi
mov [data_end],eax
IF PHARLAP_TNT
push es
les edi,[FWORD buffer] ;KLUDGE - bcc32 pads FARPTR
ELSE
mov edi,[buffer]
ENDIF
mov [edi_startval],edi
;----------------------------------------------------------------------------
; Drawing loop
;----------------------------------------------------------------------------
SET_PLANE XPLANE_1
??Start_row:
mov ecx,[blocksperrow] ;Number of blocks in a line
??Not_finished_a_line1:
sub ebx,ebx
mov bx,[WORD PTR esi] ;Get the codebook pointer value
add esi,2 ; then advance to the next one.
or bx,bx ;Is it a one color block?
js short ??One_color1
; Draw multi-color block
add ebx,[cb_offset] ;Codeword address
mov eax,[ebx] ;Read 1st row of codeword
mov edx,[ebx+4] ;Read 2nd row of codeword
; mov ebx,[bufwidth]
IF PHARLAP_TNT
mov [es:edi],eax ;Write 1st row to dest
mov [es:edi+ebx],edx ;Write 2nd row to dest
ELSE
mov [edi],al ;Write 1st row to dest
mov [edi+80],dl ;Write 2nd row to dest
ENDIF
; add edi,4 ;Next dest block position
inc edi ;Next dest block position
dec ecx ;More blocks for this row?
jnz short ??Not_finished_a_line
; Advance to the next destination row of blocks.
mov edi,[edi_startval]
add edi,[rowoffset]
mov [edi_startval],edi
cmp esi,[data_end] ;Have we reached the end of the
jnb short ??End_of_data ; pointers buffer?
jmp ??Start_row
; Draw 1-color block
??One_color1:
cmp bx,SKIP_PTR ;Is this a skip block?
jne ??Draw_One_Color
add edi,4 ;Move to next dest block position
dec ecx ;More blocks for this row?
jnz short ??Not_finished_a_line
jmp ??Next_row
??Draw_One_Color:
not bx ;NOT pointer value to get color
mov bh,bl ;Duplicate color through the
mov ax,bx ; entire dword register.
rol eax,16
mov ax,bx
; mov ebx,[bufwidth]
IF PHARLAP_TNT
mov [es:edi],eax ;Write 1st row to dest
mov [es:edi+ebx],eax ;Write 2nd row to dest
ELSE
mov [edi],al ;Write 1st row to dest
mov [edi+80],al ;Write 2nd row to dest
ENDIF
add edi,4 ;Next dest block positionw
dec ecx ;More blocks for this row?
jnz short ??Not_finished_a_line
; Advance to the next destination row of blocks.
??Next_row:
mov edi,[edi_startval]
add edi,[rowoffset]
mov [edi_startval],edi
cmp esi,[data_end] ;Have we reached the end of the
jnb short ??End_of_data ; pointers buffer?
jmp ??Start_row
??End_of_data:
IF PHARLAP_TNT
pop es
ENDIF
ret
ENDP UnVQ_4x2_Xmode
;****************************************************************************
;*
;* NAME
;* UnVQ_4x2_XmodeCB - Draw 4x2 VQ frame to Xmode from VRAM codebook.
;*
;* SYNOPSIS
;* UnVQ_4x2_XmodeCB(Dummy, Pointers, Buffer, BPR, Rows)
;*
;* void UnVQ_4x2_XmodeCB(unsigned char *, unsigned char *,
;* unsigned char *, unsigned short,
;* unsigned short);
;*
;* FUNCTION
;* This routine copies codebook entries from video RAM to video RAM.
;* The procedure for Write Mode 1 is:
;*
;* - Perform a CPU read at the address of the 4-byte codebook entry;
;* this will load each byte at that address from all 4 bitplanes
;* into the VGA's internal latches.
;*
;* - Perform a CPU write at the destination address, with the BitMask
;* register set to 0 (this tells the VGA hardware to only use the
;* data stored in the latches to write with), and the Map Mask
;* register set to 0Fh (all bitplanes enabled).
;*
;* Optimized for 320x200.
;* The codebook must have been downloaded to video RAM before this
;* routine is called. This routine assumes the multicolor block pointers
;* have been pre-divided by 4, and have a total of 512 added to them, so
;* the pointer is an exact offset into the codebook.
;*
;* INPUTS
;* Dummy - Not used (prototype placeholder)
;* Pointers - Pointer to vector pointer data.
;* Buffer - Pointer to Xmode buffer.
;* BPR - Number of blocks per row.
;* Rows - Number of rows.
;*
;* RESULT
;* NONE
;*
;****************************************************************************
GLOBAL C UnVQ_4x2_XmodeCB:NEAR
PROC UnVQ_4x2_XmodeCB C NEAR USES
ARG cbdummy:FAR PTR
ARG pointers:FAR PTR
ARG buffer:FAR PTR
ARG blocksperrow:WORD
ARG numrows:WORD
; ;-------------------------------------------------------------------
; ; Local variables:
; ;-------------------------------------------------------------------
; LOCAL di_startval:WORD ; init value for DI, for new row
;
; ;===================================================================
; ; Initialization
; ;===================================================================
; ;-------------------------------------------------------------------
; ; Save our registers
; ;-------------------------------------------------------------------
; push ds
; push es
; push fs
; pushad
;
; ;-------------------------------------------------------------------
; ; Save codebook's segment in DS
; ;-------------------------------------------------------------------
; mov ax,CBOOK_SEG
; mov ds,ax
;
; ;-------------------------------------------------------------------
; ; Load pointers into FS:BX
; ;-------------------------------------------------------------------
; les di,[pointers]
; mov ax,es
; mov fs,ax
; mov bx,di
;
; ;-------------------------------------------------------------------
; ; Load screen address into ES:DI
; ;-------------------------------------------------------------------
; les di, [buffer] ; point ES:DI to dest
; mov [di_startval],di ; store it
;
; ;-------------------------------------------------------------------
; ; Initialize VGA registers:
; ; - Enable all bitplanes for writing
; ; - Set the BitMask register to 0, so only the data from the
; ; VGA latches is written into the bitplanes
; ;-------------------------------------------------------------------
; SET_PLANE 0fh ; enable all planes for write
; SET_WRITEMODE 1
;
; ;===================================================================
; ; The drawing loop:
; ; DS:SI = codebook
; ; ES:DI = drawing buffer
; ; FS:BX = pointers
; ;===================================================================
; ;-------------------------------------------------------------------
; ; Start a new row of drawing
; ;-------------------------------------------------------------------
;??Start_row:
; mov cx,[blocksperrow] ; # blocks to fill a line
;
; ;-------------------------------------------------------------------
; ; Start a new block
; ;-------------------------------------------------------------------
;??Not_finished_a_line:
; ;
; ;..................... get next pointer word .......................
; ;
; mov si,[WORD PTR fs:bx] ; SI = ptr word (cbook offset)
; add bx,2 ; next ptr word
; ;
; ;................... skip ptr value SKIP_PTR .......................
; ;
; cmp si,SKIP_PTR
; jne ??Draw_Block
; inc di
; dec cx
; jnz short ??Not_finished_a_line
; jmp ??Next_row
;
; ;-------------------------------------------------------------------
; ; Draw a block via the VGA internal latches:
; ; DS:SI = codebook address
; ; ES:DI = buffer position to draw at
; ; - Load the VGA latches from the 1st 4 codebook bytes
; ; - write 4 pixels with one CPU write
; ; - If this is a one-color block, skip the next codebook read
; ; (Video RAM reads are very slow); otherwise, latch the next 4
; ; codebook bytes
; ; - write the next 4 pixels
; ;-------------------------------------------------------------------
; ;
; ;..................... draw 1st 4 pixels ...........................
; ;
;??Draw_Block:
; mov al,[ds:si] ; latch 1st 4 cbook bytes
; mov [es:di],al ; write 4 pixels
; ;
; ;.................. check for 1-color block ........................
; ;
; cmp si,512 ; if 1color blk, don't read
; jb ??One_Color
; ;
; ;..................... draw next 4 pixels ..........................
; ;
; mov al,[ds:si+1] ; latch next 4 cbook bytes
;??One_Color:
; mov [es:di+80],al ; write next 4 pixels
; inc di ; next block position
; ;
; ;...................... check block count ..........................
; ;
; dec cx ; decrement block count
; jnz short ??Not_finished_a_line
;
; ;-------------------------------------------------------------------
; ; Go to the next block row:
; ; - Add (80*2/16) to ES, and set DI to its start-row value
; ; (Incrementing the segment allows us to unpack up to 1MB of data)
; ;-------------------------------------------------------------------
; ;
; ;...................... add (320*2/16) to ES .......................
; ;
;??Next_row:
; mov ax,es
; add ax,10 ; add 80*2/16
; mov es,ax
; ;
; ;.................. set DI to its start-row value ..................
; ;
; mov di,[di_startval]
; ;
; ;............ see if we're past the end of the ptr data ............
; ;
; dec [numrows]
; jg ??Start_row
;
;??End_of_data:
; ;-------------------------------------------------------------------
; ; Restore VGA Write Mode to 0
; ;-------------------------------------------------------------------
; SET_WRITEMODE 0
;
; popad
; pop fs
; pop es
; pop ds
ret
ENDP UnVQ_4x2_XmodeCB
;****************************************************************************
;*
;* NAME
;* Upload_4x2CB - Upload 4x2 codebook into XMode VRAM.
;*
;* SYNOPSIS
;* Upload_4x2CB(Codebook, Entries)
;*
;* void Upload_4x2CB(unsigned char *, unsigned short);
;*
;* FUNCTION
;* This routine copies the given codebook into Xmode VRAM, so that it
;* can be used later for direct video-to-video copies. The address used
;* is the end of video memory minus 02700h (10K). This should be plenty
;* for a 3000-entry codebook; each 4x2 codebook entry will take up 8
;* 8 bytes, or 2 addresses in XMode (6000 addresses).
;*
;* The routine also creates a 1-color-block table in VRAM, so the 1-color
;* blocks can be generated the same way as the multicolor blocks.
;*
;* XMode 320x200 uses 320x200/4 addresses per page, for a total of 32000
;* addresses. XMode 320x240 uses 320x240/4 addresses per page, for a
;* total of 38400 addresses. This leaves 27136 addresses unused.
;*
;* INPUTS
;* Codebook - Pointer to codebook to copy.
;* Entries - Number of codebook entries to copy.
;*
;* RESULT
;* NONE
;*
;****************************************************************************
GLOBAL C Upload_4x2CB:NEAR
PROC Upload_4x2CB C NEAR USES
ARG codebook:NEAR PTR
ARG numentries:DWORD
; ;===================================================================
; ; Generate the 1-color block table by writing each color value from
; ; 0-255 into all 4 bitplanes, at 256 consecutive addresses:
; ;===================================================================
; SET_PLANE 0fh ; enable all bitplanes for writing
; ;...................................................................
; ; Set ES:DI to destination address, set up CX for the loop
; ;...................................................................
; mov ax,CBOOK_SEG
; mov es,ax
; mov di,0
; mov cx,256
; mov ax,0
;??1_Color_Loop:
; mov [es:di],al ; write 4 bytes
; inc di ; next 4-byte position
; mov [es:di],al ; write 4 bytes
; inc di ; next 4-byte position
; inc ax ; next color #
; dec cx ; decrement loop counter
; jnz ??1_Color_Loop
;
; ;===================================================================
; ; Copy the codebook into video RAM, one plane at a time:
; ;===================================================================
; ;-------------------------------------------------------------------
; ; Copy codebook byte 0 into Plane 1
; ;-------------------------------------------------------------------
; ;...................................................................
; ; Set DS:SI to codebook address, ES:DI to screen address
; ; (Codebook is stored at offset 1, so the pointers will point at
; ; exactly the right offset.)
; ;...................................................................
; lds si, [codebook] ; DS:SI = codebook
; mov ax,CBOOK_SEG
; mov es,ax
; mov di,512
;
; ;...................................................................
; ; Set up the loop
; ;...................................................................
; SET_PLANE XPLANE_1
; mov cx,[numentries] ; set loop counter
; shl cx,1 ; do 2 DWORDS per cbook entry
;
; ;...................................................................
; ; Loop through codebook entries
; ;...................................................................
;??CB_Loop_1:
; mov al,[ds:si]
; mov [es:di],al
; add si,4
; inc di
; dec cx
; jnz ??CB_Loop_1
;
; ;-------------------------------------------------------------------
; ; Copy codebook byte 1 Plane 2
; ;-------------------------------------------------------------------
; ;...................................................................
; ; Set DS:SI to codebook address, ES:DI to screen address
; ; (Codebook is stored at offset 1, so the pointers will point at
; ; exactly the right offset.)
; ;...................................................................
; lds si, [codebook] ; DS:SI = codebook
; mov ax,CBOOK_SEG
; mov es,ax
; mov di,512
; add si,1 ; use 2nd byte value
;
; ;...................................................................
; ; Set up the loop
; ;...................................................................
; SET_PLANE XPLANE_2
; mov cx,[numentries] ; set loop counter
; shl cx,1 ; do 2 DWORDS per cbook entry
;
; ;...................................................................
; ; Loop through codebook entries
; ;...................................................................
;??CB_Loop_2:
; mov al,[ds:si]
; mov [es:di],al
; add si,4
; inc di
; dec cx
; jnz ??CB_Loop_2
;
; ;-------------------------------------------------------------------
; ; Copy codebook byte 2 Plane 3
; ;-------------------------------------------------------------------
; ;...................................................................
; ; Set DS:SI to codebook address, ES:DI to screen address
; ; (Codebook is stored at offset 1, so the pointers will point at
; ; exactly the right offset.)
; ;...................................................................
; lds si, [codebook] ; DS:SI = codebook
; mov ax,CBOOK_SEG
; mov es,ax
; mov di,512
; add si,2 ; use 3rd byte value
;
; ;...................................................................
; ; Set up the loop
; ;...................................................................
; SET_PLANE XPLANE_3
; mov cx,[numentries] ; set loop counter
; shl cx,1 ; do 2 DWORDS per cbook entry
;
; ;...................................................................
; ; Loop through codebook entries
; ;...................................................................
;??CB_Loop_3:
; mov al,[ds:si]
; mov [es:di],al
; add si,4
; inc di
; dec cx
; jnz ??CB_Loop_3
;
; ;-------------------------------------------------------------------
; ; Copy codebook byte 3 Plane 4
; ;-------------------------------------------------------------------
; ;...................................................................
; ; Set DS:SI to codebook address, ES:DI to screen address
; ; (Codebook is stored at offset 1, so the pointers will point at
; ; exactly the right offset.)
; ;...................................................................
; lds si, [codebook] ; DS:SI = codebook
; mov ax,CBOOK_SEG
; mov es,ax
; mov di,512
; add si,3 ; use 4th byte value
;
; ;...................................................................
; ; Set up the loop
; ;...................................................................
; SET_PLANE XPLANE_4
; mov cx,[numentries] ; set loop counter
; shl cx,1 ; do 2 DWORDS per cbook entry
;
; ;...................................................................
; ; Loop through codebook entries
; ;...................................................................
;??CB_Loop_4:
; mov al,[ds:si]
; mov [es:di],al
; add si,4
; inc di
; dec cx
; jnz ??CB_Loop_4
;
ret
ENDP Upload_4x2CB
ENDIF ;VQABLOCK_4X2
;****************************************************************************
;*
;* NAME
;* XlatePointers - Translate pointer to optimal XMode format.
;*
;* SYNOPSIS
;* XlatePointers(Pointers, Entries)
;*
;* void XlatePointers(unsigned char *, unsigned short);
;*
;* FUNCTION
;*
;* INPUTS
;* Pointers - Pointer to vector pointers to translate.
;* Entries - Number of pointer entries.
;*
;* RESULT
;* NONE
;*
;****************************************************************************
GLOBAL C XlatePointers:NEAR
PROC XlatePointers C NEAR USES
ARG pointers:NEAR PTR
ARG numpointers:DWORD
; ;-------------------------------------------------------------------
; ; Load pointers into DS:SI
; ;-------------------------------------------------------------------
; lds si,[pointers]
;
; mov cx,[numpointers] ; init to # pointers on scrn
;
;??Process_pointer:
; ;
; ;..................... get next pointer word .......................
; ;
; mov ax,[WORD PTR ds:si] ; SI = ptr word (cbook offset)
; ;
; ;.................... check for a 1-color block ....................
; ;
; or ax,ax ; check to see if high bit set
; js short ??One_color
; ;
; ;....................... multi-color pointer .......................
; ;
; sub ax,4 ; subtract 4
; shr ax,2 ; divide by 4
; add ax,512 ; add 512
; mov [WORD PTR ds:si],ax ; save new value
; add si,2 ; next ptr word
; ;
; ;....................... see if we're done .........................
; ;
; dec cx
; jnz ??Process_pointer
; jmp ??Done
;
;??One_color:
; ;
; ;......................... 1-color pointer .........................
; ;
; not ax ; get actual color value
; shl ax,1 ; multiply by 2
; mov [WORD PTR ds:si],ax ; save new value
; add si,2 ; next ptr word
; ;
; ;....................... see if we're done .........................
; ;
; dec cx
; jnz ??Process_pointer
;
;??Done:
ret
ENDP XlatePointers
ENDIF ;VQAXMODE_ON
END

1221
VQ/VQA32/UNVQXMDE.ASM.BAK Normal file

File diff suppressed because it is too large Load Diff

52
VQ/VQA32/VERTAG.CPP Normal file
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/>.
*/
/****************************************************************************
*
* 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
* vertag.c
*
* DESCRIPTION
* Version Tag
*
* PROGRAMMER
* Denzil E. Long, Jr.
*
* DATE
* February 23, 1995
*
****************************************************************************/
#include "vqaplayp.h"
#ifdef __WATCOMC__
#define DEVNAME "Watcom/4GW"
#else
#define DEVNAME "Borland/TNT"
#endif
char VerTag[] = {"$VER$" VQA_IDSTRING" "DEVNAME" ("VQA_DATE")"};
char ReqTag[] = {"$REQ$" VQA_REQUIRES};

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

282
VQ/VQA32/VQAPLAY.BAK Normal file
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 0 /* 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 */
#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/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 */

76
VQ/VQA32/VQAPLAY.I Normal file
View File

@@ -0,0 +1,76 @@
;
; 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
;* VQAPlay 32 library.
;*
;* FILE
;* vqaplay.i
;*
;* DESCRIPTION
;* VQA player definitions.
;*
;* PROGRAMMER
;* Denzil E. Long, Jr.
;*
;* DATE
;* January 30, 1995
;*
;****************************************************************************
;*---------------------------------------------------------------------------
;* CONDITIONAL COMPILATION FLAGS
;*---------------------------------------------------------------------------
IF PHARLAP_TNT
VQASTANDALONE EQU 0 ;Stand alone player
VQAMONO_ON EQU 1 ;Mono display output enable/disable
VQAAUDIO_ON EQU 0 ;Audio playback enable/disable
VQAVIDEO_ON EQU 0 ;Video manager enable/disable
VQAMCGA_ON EQU 1 ;MCGA enable/disable
VQAXMODE_ON EQU 0 ;Xmode enable/disable
VQAVESA_ON EQU 0 ;VESA enable/disable
VQABLOCK_2X2 EQU 0 ;2x2 block decode enable/disable
VQABLOCK_2X3 EQU 0 ;2x3 block decode enable/disable
VQABLOCK_4X2 EQU 1 ;4x2 block decode enable/disable
VQABLOCK_4X4 EQU 0 ;4x4 block decode enable/disable
VQABLOCK_WOOFER EQU 0
ELSE
VQASTANDALONE EQU 0 ;Stand alone player
VQAMONO_ON EQU 0 ;Mono display output enable/disable
VQAAUDIO_ON EQU 1 ;Audio playback enable/disable
VQAVIDEO_ON EQU 0 ;Video manager enable/disable
VQAMCGA_ON EQU 1 ;MCGA enable/disable
VQAXMODE_ON EQU 0 ;Xmode enable/disable
VQAVESA_ON EQU 0 ;VESA enable/disable
VQABLOCK_2X2 EQU 0 ;2x2 block decode enable/disable
VQABLOCK_2X3 EQU 0 ;2x3 block decode enable/disable
VQABLOCK_4X2 EQU 1 ;4x2 block decode enable/disable
VQABLOCK_4X4 EQU 0 ;4x4 block decode enable/disable
VQABLOCK_WOOFER EQU 0
ENDIF

511
VQ/VQA32/VQAPLAYP.H Normal file
View File

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