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

160
WIN32LIB/INCLUDE/AUDIO.H Normal file
View File

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

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

View File

@@ -0,0 +1,39 @@
/*
** Command & Conquer Red Alert(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/***************************************************************************
** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S **
***************************************************************************
* *
* Project Name : WWLIB32 Example *
* *
* File Name : DEFINES.H *
* *
* Programmer : Scott K. Bowen *
* *
* Start Date : August 3, 1994 *
* *
* Last Update : August 3, 1994 [SKB] *
* *
*-------------------------------------------------------------------------*
* Functions: *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
#define USER_TIMER_FREQ 60

View File

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


1448
WIN32LIB/INCLUDE/DIFFTB.INC Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,24 @@
/*
** Command & Conquer Red Alert(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
int Dip_Text(char const *source, char *dest);
int UnDip_Text(char const *source, char *dest);
char *Extract_String(void const *data, int string);
void Fixup_Text(char const *source, char *dest);
extern char Common[];
extern char Dipthong[16][8];

View File

@@ -0,0 +1,67 @@
/*
** 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 DRAWBUFF_H
#define DRAWBUFF_H
#ifndef WWSTD_H
#include "wwstd.h"
#endif
class GraphicViewPortClass;
class GraphicBufferClass;
/*=========================================================================*/
/* Define functions which have not under-gone name mangling */
/*=========================================================================*/
extern "C" {
/*======================================================================*/
/* Externs for all of the common functions between the video buffer */
/* class and the graphic buffer class. */
/*======================================================================*/
long __cdecl Buffer_Size_Of_Region(void *thisptr, int w, int h);
void __cdecl Buffer_Put_Pixel(void * thisptr, int x, int y, unsigned char color);
int __cdecl Buffer_Get_Pixel(void * thisptr, int x, int y);
void __cdecl Buffer_Clear(void *thisptr, unsigned char color);
long __cdecl Buffer_To_Buffer(void *thisptr, int x, int y, int w, int h, void *buff, long size);
long __cdecl Buffer_To_Page(int x, int y, int w, int h, void *Buffer, void *view);
BOOL __cdecl Linear_Blit_To_Linear( void *thisptr, void * dest, int x_pixel, int y_pixel, int dx_pixel,
int dy_pixel, int pixel_width, int pixel_height, BOOL trans);
BOOL __cdecl Linear_Scale_To_Linear( void *, void *, int, int, int, int, int, int, int, int, BOOL, char *);
LONG __cdecl Buffer_Print(void *thisptr, const char *str, int x, int y, int fcolor, int bcolor);
/*======================================================================*/
/* Externs for all of the graphic buffer class only functions */
/*======================================================================*/
VOID __cdecl Buffer_Draw_Line(void *thisptr, int sx, int sy, int dx, int dy, unsigned char color);
VOID __cdecl Buffer_Fill_Rect(void *thisptr, int sx, int sy, int dx, int dy, unsigned char color);
VOID __cdecl Buffer_Remap(void * thisptr, int sx, int sy, int width, int height, void *remap);
VOID __cdecl Buffer_Fill_Quad(void * thisptr, VOID *span_buff, int x0, int y0, int x1, int y1,
int x2, int y2, int x3, int y3, int color);
void __cdecl Buffer_Draw_Stamp(void const *thisptr, void const *icondata, int icon, int x_pixel, int y_pixel, void const *remap);
void __cdecl Buffer_Draw_Stamp_Clip(void const *thisptr, void const *icondata, int icon, int x_pixel, int y_pixel, void const *remap, int ,int,int,int);
void * __cdecl Get_Font_Palette_Ptr ( void );
}
extern GraphicViewPortClass *LogicPage;
extern BOOL AllowHardwareBlitFills;
#endif

View File

@@ -0,0 +1,93 @@
;
; Command & Conquer Red Alert(tm)
; Copyright 2025 Electronic Arts Inc.
;
; This program is free software: you can redistribute it and/or modify
; it under the terms of the GNU General Public License as published by
; the Free Software Foundation, either version 3 of the License, or
; (at your option) any later version.
;
; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details.
;
; You should have received a copy of the GNU General Public License
; along with this program. If not, see <http://www.gnu.org/licenses/>.
;
;***************************************************************************
;** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S **
;***************************************************************************
;* *
;* Project Name : Westwood 32 bit Library *
;* *
;* File Name : DRAWBUFF.INC *
;* *
;* Programmer : Phil W. Gorrow *
;* *
;* Start Date : January 16, 1995 *
;* *
;* Last Update : January 16, 1995 [PWG] *
;* *
;*-------------------------------------------------------------------------*
;* Functions: *
;* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *
; Externs from REGIONSZ.ASM module of the DRAWBUFF library
GLOBAL C Buffer_Size_Of_Region :NEAR
; Externs from GETPIX.ASM module of the DRAWBUFF library
GLOBAL C Buffer_Get_Pixel :NEAR
; Externs from PUTPIX.ASM module of the DRAWBUFF library
GLOBAL C Buffer_Put_Pixel :NEAR
; Externs from CLEAR.ASM module of the DRAWBUFF library
GLOBAL C Buffer_Clear :NEAR
; Externs from BITBLIT.ASM module of the DRAWBUFF library
GLOBAL C Linear_Blit_To_Linear :NEAR
; Externs from TOBUFF.ASM module of the DRAWBUFF library
GLOBAL C Buffer_To_Buffer :NEAR
; Externs from TOPAGE.ASM module of the DRAWBUFF library
GLOBAL C Buffer_To_Page :NEAR
; Externs from SCALE.ASM module of the DRAWBUFF library
GLOBAL C Linear_Scale_To_Linear :NEAR
; Externs from TXTPRNT.ASM module of the DRAWBUFF library
GLOBAL C Buffer_Print :NEAR
;*-------------------------------------------------------------------------*
;* Define Buffer only assembly GLOBALS *
;*-------------------------------------------------------------------------*
; Externs from DRAWLINE.ASM module of the DRAWBUFF library
GLOBAL C Buffer_Draw_Line:NEAR
; Externs from FILLQUAD.ASM module of the DRAWBUFF library
GLOBAL C Buffer_Fill_Quad :NEAR
; Externs from FILLRECT.ASM module of the DRAWBUFF library
GLOBAL C Buffer_Fill_Rect :NEAR
; Externs from REMAP.ASM module of the DRAWBUFF library
GLOBAL C Buffer_Remap :NEAR
; Externs from STAMP.ASM module of the DRAWBUFF library
GLOBAL C Buffer_Draw_Stamp :NEAR
GLOBAL C get_clip : NEAR
struc RECTANGLE
x0 dd ?
y0 dd ?
x1 dd ?
y1 dd ?
ends RECTANGLE

View File

@@ -0,0 +1,40 @@
/*
** Command & Conquer Red Alert(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/***************************************************************************
** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S **
***************************************************************************
* *
* Project Name : WWLIB32 Example *
* *
* File Name : EXTERNS.H *
* *
* Programmer : Scott K. Bowen *
* *
* Start Date : August 3, 1994 *
* *
* Last Update : August 3, 1994 [SKB] *
* *
*-------------------------------------------------------------------------*
* Functions: *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
extern char NoTimer;
extern char NoKeyBoard;

260
WIN32LIB/INCLUDE/FILE.H Normal file
View File

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

View File

@@ -0,0 +1,77 @@
/*
** Command & Conquer Red Alert(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/***************************************************************************
;** C O N F I D E N T I A L --- W E S T W O O D A S S O C I A T E S **
;***************************************************************************
;* *
;* Project Name : iff *
;* *
;* File Name : FILEPCX.H *
;* *
;* Programmer : Julio R. Jerez *
;* *
;* Start Date : May 2, 1995 *
;* *
;* Last Update : May 2, 1995 [JRJ] *
;* *
;*-------------------------------------------------------------------------*
;* Functions: *
;* GraphicBufferClass* Read_PCX_File (char* name, BYTE* palette,void *buff, long size);
;* GraphicBufferClass* Read_PCX_File (char* name, BYTE* palette, BufferClass& Buff);
;* int Write_PCX_File (char* name, GraphicViewPortClass& pic, BYTE* palette );*
;*= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =*/
#include <gbuffer.h>
#include <string.h>
#include <buffer.h>
#include <file.h>
#ifndef PCX_H
#define PCX_H
typedef struct {
char red ;
char green ;
char blue ;
} RGB ;
typedef struct {
char id ;
char version ;
char encoding ;
char pixelsize ;
short x ;
short y ;
short width ;
short height ;
short xres ;
short yres ;
RGB ega_palette [ 16 ] ;
char nothing ;
char color_planes ;
short byte_per_line ;
short palette_type ;
char filler [ 58 ] ;
} PCX_HEADER ;
GraphicBufferClass* Read_PCX_File (char* name, char* palette= NULL,void *buff=NULL, long size=0);
GraphicBufferClass* Read_PCX_File (char* name, BufferClass& Buff,char* palette= NULL) ;
int Write_PCX_File (char* name, GraphicViewPortClass& pic, unsigned char* palette );
#endif

View File

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

118
WIN32LIB/INCLUDE/FONT.H Normal file
View File

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

View File

@@ -0,0 +1,47 @@
/*
** Command & Conquer Red Alert(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*=========================================================================*/
/* The following prototypes are for the file: SOUNDIO.CPP */
/*=========================================================================*/
short Decompress_Frame(void * source, void * dest, short size);
int __cdecl Stream_Sample_Vol(void *buffer, long size, BOOL (*callback);
int __cdecl Stream_Sample(void *buffer, long size, BOOL (*callback);
int __cdecl File_Stream_Sample(char const *filename);
int __cdecl File_Stream_Sample_Vol(char const *filename, int volume);
void __cdecl _saveregs _loadds Sound_Callback(void);
void __cdecl far _saveregs _loadds maintenance_callback(void);
void __cdecl Load_Sample(char const *filename);
long __cdecl Load_Sample_Into_Buffer(char const *filename, void *buffer, long size);
long __cdecl Sample_Read(int fh, void *buffer, long size);
void __cdecl Free_Sample(void const *sample);
BOOL __cdecl Sound_Init(int sfx, int score, int sample);
void far VQA_TimerCallback(void);
BOOL Audio_Init(int sample, int address, int inter, int dma);
void __cdecl Sound_End(void);
void __cdecl Stop_Sample(int handle);
BOOL __cdecl Sample_Status(int handle);
BOOL __cdecl Is_Sample_Playing(void const * sample);
void __cdecl Stop_Sample_Playing(void const * sample);
int __cdecl Play_Sample(void const *sample);
int __cdecl Play_Sample_Vol(void const *sample, int priority, int volume);
int __cdecl Set_Sound_Vol(int volume);
int __cdecl Set_Score_Vol(int volume);
void __cdecl Fade_Sample(int handle, int ticks);

1366
WIN32LIB/INCLUDE/GBUFFER.H Normal file

File diff suppressed because it is too large Load Diff

View File

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

153
WIN32LIB/INCLUDE/ICONCACH.H Normal file
View File

@@ -0,0 +1,153 @@
/*
** Command & Conquer Red Alert(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/***********************************************************************************************
*** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
***********************************************************************************************
* *
* Project Name : Drawbuff - Westwood win95 library *
* *
* File Name : Iconcach.H *
* *
* Programmer : Steve Tall *
* *
* Start Date : November 8th, 1995 *
* *
* Last Update : November 16th, 1995 [ST] *
* *
*---------------------------------------------------------------------------------------------*
* Overview: This file cantains definition of the IconCacheClass and associated non member *
* function prototypes. *
* *
* Functions: *
* IconCacheClass::Get_Is_Cached -- member to allow access to private IsCached flag *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
#ifndef ICONCACH_H
#define ICONCACH_H
#include <tile.h>
#define ICON_WIDTH 24 // Icons must be this width to be cached
#define ICON_HEIGHT 24 // Icons must be this height to be cached
#define MAX_CACHED_ICONS 500 // Maximum number of icons that can be cached
#define MAX_ICON_SETS 100 // Maximum number of icon sets that can be registered
#define MAX_LOOKUP_ENTRIES 3000 // Size of icon index table
/*
** IconCacheClass for tracking individual icons cached into video memory
**
** Use Register_Icon_Set to identify a set of icons as cachable. Once registered, the icons
** will be cached automatically when drawn.
** Use Invalidate_Cached_Icons at the end of icon drawing to release the video memory used by the
** caching system.
** Restore_Cached_Icons may be used to reload the icons into video memory after a focus loss.
**
*/
class IconCacheClass {
public:
IconCacheClass (void); // class constructor
~IconCacheClass (void); // class destructor
void Restore(void); // restore the surface
BOOL Cache_It (void * icon_ptr); // Cache the icon to video memory
void Uncache_It (void); // Restore the video memory and flag the icon as uncached
void Draw_It (LPDIRECTDRAWSURFACE dest_surface , int x_pixel, int y_pixel, int window_left , int window_top , int window_width , int window_height);
inline BOOL Get_Is_Cached(void); // Return the IsCached member
int TimesDrawn; // counter of times cached icon has been drawn
int TimesFailed; // counter of times cached icon has failed to draw
private:
LPDIRECTDRAWSURFACE CacheSurface; // Ptr to direct draw surface where icon resides
BOOL IsCached; // Flag to say whether an icon is cached
BOOL SurfaceLost; // Flag to indicate that our icons surface has been lost
int DrawFrequency; // Number of times icon has been drawn
void *IconSource; // Ptr to original icon data in system memory
};
/*
** Structure to keep track of registered icon sets
**
*/
typedef struct tIconSetType{
IControl_Type *IconSetPtr; // Ptr to icon set data
int IconListOffset; // Offset into icon index table for this icon set
}IconSetType;
extern IconCacheClass CachedIcons[MAX_CACHED_ICONS];
extern void Invalidate_Cached_Icons (void);
extern void Restore_Cached_Icons (void);
extern void Register_Icon_Set (void *icon_data , BOOL pre_cache);
//
// Prototypes for assembly language procedures in STMPCACH.ASM
//
extern "C" void Clear_Icon_Pointers (void);
extern "C" void Cache_Copy_Icon (void const *icon_ptr ,void * , int);
extern "C" int Is_Icon_Cached (void const *icon_data , int icon);
extern "C" int Get_Icon_Index (void *icon_ptr);
extern "C" int Get_Free_Index (void);
extern "C" BOOL Cache_New_Icon (int icon_index, void *icon_ptr);
extern "C" int Get_Free_Cache_Slot(void);
extern int CachedIconsDrawn;
extern int UnCachedIconsDrawn;
/***********************************************************************************************
* ICC::Get_Is_Cached -- member to allow access to the private IsCached flag *
* *
* *
* *
* INPUT: Nothing *
* *
* OUTPUT: IsCached *
* *
* WARNINGS: None *
* *
* HISTORY: *
* 11/13/95 9:42AM ST : Created *
*=============================================================================================*/
inline BOOL IconCacheClass::Get_Is_Cached (void)
{
return (IsCached);
}
#endif //ICONCACH_H

167
WIN32LIB/INCLUDE/IFF.H Normal file
View File

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

1448
WIN32LIB/INCLUDE/INDEXTB.INC Normal file

File diff suppressed because it is too large Load Diff

678
WIN32LIB/INCLUDE/KEYBOARD.H Normal file
View File

@@ -0,0 +1,678 @@
/*
** 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/>.
*/
/***********************************************************************************************
* *
* Project Name : Westwood Keyboard Library *
* *
* File Name : KEYBOARD.H *
* *
* Programmer : Philip W. Gorrow *
* *
* Start Date : 10/16/95 *
* *
* Last Update : October 16, 1995 [PWG] *
* *
*---------------------------------------------------------------------------------------------*
* Functions: *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
#ifndef KEYBOARD_H
#define KEYBOARD_H
#include <WWSTD.H>
typedef enum {
WWKEY_SHIFT_BIT = 0x100,
WWKEY_CTRL_BIT = 0x200,
WWKEY_ALT_BIT = 0x400,
WWKEY_RLS_BIT = 0x800,
WWKEY_VK_BIT = 0x1000,
WWKEY_DBL_BIT = 0x2000,
WWKEY_BTN_BIT = 0x8000,
} WWKey_Type;
class WWKeyboardClass
{
public:
/*===================================================================*/
/* Define the base constructor and destructors for the class */
/*===================================================================*/
WWKeyboardClass();
/*===================================================================*/
/* Define the functions which work with the Keyboard Class */
/*===================================================================*/
BOOL Check(void); // checks keybuff for meta key
int Get(void); // gets a meta key from the keybuffer
BOOL Put(int key); // dumps a key into the keybuffer
BOOL Put_Key_Message( UINT vk_key, BOOL release = FALSE, // handles keyboard related message
BOOL dbl = FALSE); // and mouse clicks and dbl clicks
int Check_Num(void); // checks keybuff for a keynum key
int Get_VK(void); // gets keynum key from key buff
int Check_ACII(void); // checks keybuff for an ascii key
int Get_ASCII(void); // gets an ascii key from keybuff
int Check_Bits(void); // checks keybuff for key w/ bits
int Get_Bits(void); // get key from keybuff w/ bits
int To_ASCII(int num); // converts keynum to ascii value
int Option_On(int option); // turns specified option on
int Option_Off(int option); // turns specified option off
void Clear(void); // clears all keys from keybuffer
int Down(int key); // tests to see if a key is down
void AI(void); // messaging logic for key manager
/*===================================================================*/
/* Define the main hook for the message processing loop. */
/*===================================================================*/
void Message_Handler(HWND hwnd, UINT message, UINT wParam, LONG lParam);
/*===================================================================*/
/* Define public routines which can be used on keys in general. */
/*===================================================================*/
VOID Split(int &key, int &shift, int &ctrl, int &alt, int &rls, int &dbl);
BOOL Is_Mouse_Key(int key);
/*===================================================================*/
/* Define the public access variables which are used with the */
/* Keyboard Class. */
/*===================================================================*/
int MouseQX;
int MouseQY;
unsigned char VKRemap[256]; // gives vk for any ascii char
private:
/*===================================================================*/
/* Define the private access functions which are used by keyboard */
/*===================================================================*/
int Buff_Get(void);
/*===================================================================*/
/* Define the private access variables which are used with the */
/* Keyboard Class. */
/*===================================================================*/
unsigned char AsciiRemap[2048]; // remap for shft/ctrl/alt key combos
unsigned short Buffer[256]; // buffer which holds actual keypresses
unsigned char ToggleKeys[256]; // determines toggles which affect key
long Head; // the head position in keyboard buffer
long Tail; // the tail position in keyboard buffer
int MState;
int Conditional;
HANDLE CurrentCursor;
};
#define VK_NONE 0x00
#define VK_LBUTTON 0x01
#define VK_RBUTTON 0x02
#define VK_CANCEL 0x03
#define VK_MBUTTON 0x04
#define VK_NONE_05 0x05
#define VK_NONE_06 0x06
#define VK_NONE_07 0x07
#define VK_BACK 0x08
#define VK_TAB 0x09
#define VK_NONE_0A 0x0A
#define VK_NONE_0B 0x0B
#define VK_CLEAR 0x0C
#define VK_RETURN 0x0D
#define VK_NONE_0E 0x0E
#define VK_NONE_0F 0x0F
#define VK_SHIFT 0x10
#define VK_CONTROL 0x11
#define VK_MENU 0x12
#define VK_PAUSE 0x13
#define VK_CAPITAL 0x14
#define VK_NONE_15 0x15
#define VK_NONE_16 0x16
#define VK_NONE_17 0x17
#define VK_NONE_18 0x18
#define VK_NONE_19 0x19
#define VK_NONE_1A 0x1A
#define VK_ESCAPE 0x1B
#define VK_NONE_1C 0x1C
#define VK_NONE_1D 0x1D
#define VK_NONE_1E 0x1E
#define VK_NONE_1F 0x1F
#define VK_SPACE 0x20
#define VK_PRIOR 0x21
#define VK_NEXT 0x22
#define VK_END 0x23
#define VK_HOME 0x24
#define VK_LEFT 0x25
#define VK_UP 0x26
#define VK_RIGHT 0x27
#define VK_DOWN 0x28
#define VK_SELECT 0x29
#define VK_PRINT 0x2A
#define VK_EXECUTE 0x2B
#define VK_SNAPSHOT 0x2C
#define VK_INSERT 0x2D
#define VK_DELETE 0x2E
#define VK_HELP 0x2F
#define VK_0 0x30
#define VK_1 0x31
#define VK_2 0x32
#define VK_3 0x33
#define VK_4 0x34
#define VK_5 0x35
#define VK_6 0x36
#define VK_7 0x37
#define VK_8 0x38
#define VK_9 0x39
#define VK_NONE_3B 0x3B
#define VK_NONE_3C 0x3C
#define VK_NONE_3D 0x3D
#define VK_NONE_3E 0x3E
#define VK_NONE_3F 0x3F
#define VK_NONE_40 0x40
#define VK_A 0x41
#define VK_B 0x42
#define VK_C 0x43
#define VK_D 0x44
#define VK_E 0x45
#define VK_F 0x46
#define VK_G 0x47
#define VK_H 0x48
#define VK_I 0x49
#define VK_J 0x4A
#define VK_K 0x4B
#define VK_L 0x4C
#define VK_M 0x4D
#define VK_N 0x4E
#define VK_O 0x4F
#define VK_P 0x50
#define VK_Q 0x51
#define VK_R 0x52
#define VK_S 0x53
#define VK_T 0x54
#define VK_U 0x55
#define VK_V 0x56
#define VK_W 0x57
#define VK_X 0x58
#define VK_Y 0x59
#define VK_Z 0x5A
#define VK_NONE_5B 0x5B
#define VK_NONE_5C 0x5C
#define VK_NONE_5D 0x5D
#define VK_NONE_5E 0x5E
#define VK_NONE_5F 0x5F
#define VK_NUMPAD0 0x60
#define VK_NUMPAD1 0x61
#define VK_NUMPAD2 0x62
#define VK_NUMPAD3 0x63
#define VK_NUMPAD4 0x64
#define VK_NUMPAD5 0x65
#define VK_NUMPAD6 0x66
#define VK_NUMPAD7 0x67
#define VK_NUMPAD8 0x68
#define VK_NUMPAD9 0x69
#define VK_MULTIPLY 0x6A
#define VK_ADD 0x6B
#define VK_SEPARATOR 0x6C
#define VK_SUBTRACT 0x6D
#define VK_DECIMAL 0x6E
#define VK_DIVIDE 0x6F
#define VK_F1 0x70
#define VK_F2 0x71
#define VK_F3 0x72
#define VK_F4 0x73
#define VK_F5 0x74
#define VK_F6 0x75
#define VK_F7 0x76
#define VK_F8 0x77
#define VK_F9 0x78
#define VK_F10 0x79
#define VK_F11 0x7A
#define VK_F12 0x7B
#define VK_F13 0x7C
#define VK_F14 0x7D
#define VK_F15 0x7E
#define VK_F16 0x7F
#define VK_F17 0x80
#define VK_F18 0x81
#define VK_F19 0x82
#define VK_F20 0x83
#define VK_F21 0x84
#define VK_F22 0x85
#define VK_F23 0x86
#define VK_F24 0x87
#define VK_NONE_88 0x88
#define VK_NONE_89 0x89
#define VK_NONE_8A 0x8A
#define VK_NONE_8B 0x8B
#define VK_NONE_8C 0x8C
#define VK_NONE_8D 0x8D
#define VK_NONE_8E 0x8E
#define VK_NONE_8F 0x8F
#define VK_NUMLOCK 0x90
#define VK_SCROLL 0x91
#define VK_NONE_92 0x92
#define VK_NONE_93 0x93
#define VK_NONE_94 0x94
#define VK_NONE_95 0x95
#define VK_NONE_96 0x96
#define VK_NONE_97 0x97
#define VK_NONE_98 0x98
#define VK_NONE_99 0x99
#define VK_NONE_9A 0x9A
#define VK_NONE_9B 0x9B
#define VK_NONE_9C 0x9C
#define VK_NONE_9D 0x9D
#define VK_NONE_9E 0x9E
#define VK_NONE_9F 0x9F
#define VK_NONE_A0 0xA0
#define VK_NONE_A1 0xA1
#define VK_NONE_A2 0xA2
#define VK_NONE_A3 0xA3
#define VK_NONE_A4 0xA4
#define VK_NONE_A5 0xA5
#define VK_NONE_A6 0xA6
#define VK_NONE_A7 0xA7
#define VK_NONE_A8 0xA8
#define VK_NONE_A9 0xA9
#define VK_NONE_AA 0xAA
#define VK_NONE_AB 0xAB
#define VK_NONE_AC 0xAC
#define VK_NONE_AD 0xAD
#define VK_NONE_AE 0xAE
#define VK_NONE_AF 0xAF
#define VK_NONE_B0 0xB0
#define VK_NONE_B1 0xB1
#define VK_NONE_B2 0xB2
#define VK_NONE_B3 0xB3
#define VK_NONE_B4 0xB4
#define VK_NONE_B5 0xB5
#define VK_NONE_B6 0xB6
#define VK_NONE_B7 0xB7
#define VK_NONE_B8 0xB8
#define VK_NONE_B9 0xB9
#define VK_NONE_BA 0xBA
#define VK_NONE_BB 0xBB
#define VK_NONE_BC 0xBC
#define VK_NONE_BD 0xBD
#define VK_NONE_BE 0xBE
#define VK_NONE_BF 0xBF
#define VK_NONE_C0 0xC0
#define VK_NONE_C1 0xC1
#define VK_NONE_C2 0xC2
#define VK_NONE_C3 0xC3
#define VK_NONE_C4 0xC4
#define VK_NONE_C5 0xC5
#define VK_NONE_C6 0xC6
#define VK_NONE_C7 0xC7
#define VK_NONE_C8 0xC8
#define VK_NONE_C9 0xC9
#define VK_NONE_CA 0xCA
#define VK_NONE_CB 0xCB
#define VK_NONE_CC 0xCC
#define VK_NONE_CD 0xCD
#define VK_NONE_CE 0xCE
#define VK_NONE_CF 0xCF
#define VK_NONE_D0 0xD0
#define VK_NONE_D1 0xD1
#define VK_NONE_D2 0xD2
#define VK_NONE_D3 0xD3
#define VK_NONE_D4 0xD4
#define VK_NONE_D5 0xD5
#define VK_NONE_D6 0xD6
#define VK_NONE_D7 0xD7
#define VK_NONE_D8 0xD8
#define VK_NONE_D9 0xD9
#define VK_NONE_DA 0xDA
#define VK_NONE_DB 0xDB
#define VK_NONE_DC 0xDC
#define VK_NONE_DD 0xDD
#define VK_NONE_DE 0xDE
#define VK_NONE_DF 0xDF
#define VK_NONE_E0 0xE0
#define VK_NONE_E1 0xE1
#define VK_NONE_E2 0xE2
#define VK_NONE_E3 0xE3
#define VK_NONE_E4 0xE4
#define VK_NONE_E5 0xE5
#define VK_NONE_E6 0xE6
#define VK_NONE_E7 0xE7
#define VK_NONE_E8 0xE8
#define VK_NONE_E9 0xE9
#define VK_NONE_EA 0xEA
#define VK_NONE_EB 0xEB
#define VK_NONE_EC 0xEC
#define VK_NONE_ED 0xED
#define VK_NONE_EE 0xEE
#define VK_NONE_EF 0xEF
#define VK_NONE_F0 0xF0
#define VK_NONE_F1 0xF1
#define VK_NONE_F2 0xF2
#define VK_NONE_F3 0xF3
#define VK_NONE_F4 0xF4
#define VK_NONE_F5 0xF5
#define VK_NONE_F6 0xF6
#define VK_NONE_F7 0xF7
#define VK_NONE_F8 0xF8
#define VK_NONE_F9 0xF9
#define VK_NONE_FA 0xFA
#define VK_NONE_FB 0xFB
#define VK_NONE_FC 0xFC
#define VK_NONE_FD 0xFD
#define VK_NONE_FE 0xFE
#define VK_NONE_FF 0xFF
#define VK_UPLEFT VK_HOME
#define VK_UPRIGHT VK_PRIOR
#define VK_DOWNLEFT VK_END
#define VK_DOWNRIGHT VK_NEXT
#define VK_ALT VK_MENU
enum {
//
// Define all the KA types as variations of the VK types. This is
// so the KA functions will work properly under windows 95.
//
KA_NONE = 0,
KA_MORE = 1,
KA_SETBKGDCOL = 2,
KA_SETFORECOL = 6,
KA_FORMFEED = 12,
KA_SPCTAB = 20,
KA_SETX = 25,
KA_SETY = 26,
KA_SPACE = 32, /* */
KA_EXCLAMATION, /* ! */
KA_DQUOTE, /* " */
KA_POUND, /* # */
KA_DOLLAR, /* $ */
KA_PERCENT, /* % */
KA_AMPER, /* & */
KA_SQUOTE, /* ' */
KA_LPAREN, /* ( */
KA_RPAREN, /* ) */
KA_ASTERISK, /* * */
KA_PLUS, /* + */
KA_COMMA, /* , */
KA_MINUS, /* - */
KA_PERIOD, /* . */
KA_SLASH, /* / */
KA_0, KA_1, KA_2, KA_3, KA_4, KA_5, KA_6, KA_7, KA_8, KA_9,
KA_COLON, /* : */
KA_SEMICOLON, /* ; */
KA_LESS_THAN, /* < */
KA_EQUAL, /* = */
KA_GREATER_THAN, /* > */
KA_QUESTION, /* ? */
KA_AT, /* @ */
KA_A, /* A */
KA_B, /* B */
KA_C, /* C */
KA_D, /* D */
KA_E, /* E */
KA_F, /* F */
KA_G, /* G */
KA_H, /* H */
KA_I, /* I */
KA_J, /* J */
KA_K, /* K */
KA_L, /* L */
KA_M, /* M */
KA_N, /* N */
KA_O, /* O */
KA_P, /* P */
KA_Q, /* Q */
KA_R, /* R */
KA_S, /* S */
KA_T, /* T */
KA_U, /* U */
KA_V, /* V */
KA_W, /* W */
KA_X, /* X */
KA_Y, /* Y */
KA_Z, /* Z */
KA_LBRACKET, /* [ */
KA_BACKSLASH, /* \ */
KA_RBRACKET, /* ] */
KA_CARROT, /* ^ */
KA_UNDERLINE, /* _ */
KA_GRAVE, /* ` */
KA_a, /* a */
KA_b, /* b */
KA_c, /* c */
KA_d, /* d */
KA_e, /* e */
KA_f, /* f */
KA_g, /* g */
KA_h, /* h */
KA_i, /* i */
KA_j, /* j */
KA_k, /* k */
KA_l, /* l */
KA_m, /* m */
KA_n, /* n */
KA_o, /* o */
KA_p, /* p */
KA_q, /* q */
KA_r, /* r */
KA_s, /* s */
KA_t, /* t */
KA_u, /* u */
KA_v, /* v */
KA_w, /* w */
KA_x, /* x */
KA_y, /* y */
KA_z, /* z */
KA_LBRACE, /* { */
KA_BAR, /* | */
KA_RBRACE, /* ] */
KA_TILDA, /* ~ */
KA_ESC = VK_ESCAPE | WWKEY_VK_BIT,
KA_EXTEND = VK_ESCAPE | WWKEY_VK_BIT,
KA_RETURN = VK_RETURN | WWKEY_VK_BIT,
KA_BACKSPACE = VK_BACK | WWKEY_VK_BIT,
KA_TAB = VK_TAB | WWKEY_VK_BIT,
KA_DELETE = VK_DELETE | WWKEY_VK_BIT, /* <DELETE> */
KA_INSERT = VK_INSERT | WWKEY_VK_BIT, /* <INSERT> */
KA_PGDN = VK_NEXT | WWKEY_VK_BIT, /* <PAGE DOWN> */
KA_DOWNRIGHT = VK_NEXT | WWKEY_VK_BIT,
KA_DOWN = VK_DOWN | WWKEY_VK_BIT, /* <DOWN ARROW> */
KA_END = VK_END | WWKEY_VK_BIT, /* <END> */
KA_DOWNLEFT = VK_END | WWKEY_VK_BIT,
KA_RIGHT = VK_RIGHT | WWKEY_VK_BIT, /* <RIGHT ARROW> */
KA_KEYPAD5 = VK_SELECT | WWKEY_VK_BIT, /* NUMERIC KEY PAD <5> */
KA_LEFT = VK_LEFT | WWKEY_VK_BIT, /* <LEFT ARROW> */
KA_PGUP = VK_PRIOR | WWKEY_VK_BIT, /* <PAGE UP> */
KA_UPRIGHT = VK_PRIOR | WWKEY_VK_BIT,
KA_UP = VK_UP | WWKEY_VK_BIT, /* <UP ARROW> */
KA_HOME = VK_HOME | WWKEY_VK_BIT, /* <HOME> */
KA_UPLEFT = VK_HOME | WWKEY_VK_BIT,
KA_F12 = VK_F12 | WWKEY_VK_BIT,
KA_F11 = VK_F11 | WWKEY_VK_BIT,
KA_F10 = VK_F10 | WWKEY_VK_BIT,
KA_F9 = VK_F9 | WWKEY_VK_BIT,
KA_F8 = VK_F8 | WWKEY_VK_BIT,
KA_F7 = VK_F7 | WWKEY_VK_BIT,
KA_F6 = VK_F6 | WWKEY_VK_BIT,
KA_F5 = VK_F5 | WWKEY_VK_BIT,
KA_F4 = VK_F4 | WWKEY_VK_BIT,
KA_F3 = VK_F3 | WWKEY_VK_BIT,
KA_F2 = VK_F2 | WWKEY_VK_BIT,
KA_F1 = VK_F1 | WWKEY_VK_BIT,
KA_LMOUSE = VK_LBUTTON | WWKEY_VK_BIT,
KA_RMOUSE = VK_RBUTTON | WWKEY_VK_BIT,
KA_SHIFT_BIT = WWKEY_SHIFT_BIT,
KA_CTRL_BIT = WWKEY_CTRL_BIT,
KA_ALT_BIT = WWKEY_ALT_BIT,
KA_RLSE_BIT = WWKEY_RLS_BIT,
//
// Define all the KN types as variations of the KA types. This is
// so the KN functions will work properly under windows 95.
//
KN_NONE = 0,
KN_GRAVE = KA_GRAVE,
KN_1 = KA_1,
KN_2 = KA_2,
KN_3 = KA_3,
KN_4 = KA_4,
KN_5 = KA_5,
KN_6 = KA_6,
KN_7 = KA_7,
KN_8 = KA_8,
KN_9 = KA_9,
KN_0 = KA_0,
KN_MINUS = KA_MINUS, /* - */
KN_EQUAL = KA_EQUAL, /* = */
KN_BACKSPACE = KA_BACKSPACE,
KN_TAB = KA_TAB, /* <TAB> */
KN_Q = KA_q,
KN_W = KA_w,
KN_E = KA_e,
KN_R = KA_r,
KN_T = KA_t,
KN_Y = KA_y,
KN_U = KA_u,
KN_I = KA_i,
KN_O = KA_o,
KN_P = KA_p,
KN_LBRACKET = KA_LBRACKET, /* [ */
KN_RBRACKET = KA_RBRACKET, /* ] */
KN_BACKSLASH = KA_BACKSLASH, /* \ */
KN_A = KA_a,
KN_S = KA_s,
KN_D = KA_d,
KN_F = KA_f,
KN_G = KA_g,
KN_H = KA_h,
KN_J = KA_j,
KN_K = KA_k,
KN_L = KA_l,
KN_SEMICOLON = KA_SEMICOLON, /* ; */
KN_SQUOTE = KA_SQUOTE, /* ' */
KN_BACKSLASH2 = KA_BACKSLASH,
KN_RETURN = KA_RETURN,
KN_Z = KA_z,
KN_X = KA_x,
KN_C = KA_c,
KN_V = KA_v,
KN_B = KA_b,
KN_N = KA_n,
KN_M = KA_m,
KN_COMMA = KA_COMMA, /* , */
KN_PERIOD = KA_PERIOD, /* . */
KN_SLASH = KA_SLASH, /* / */
KN_SPACE = KA_SPACE,
KN_LMOUSE = KA_LMOUSE,
KN_RMOUSE = KA_RMOUSE,
KN_HOME = KA_HOME, /* num key pad 7 */
KN_UPLEFT = KA_UPLEFT,
KN_LEFT = KA_LEFT, /* num key pad 4 */
KN_END = KA_END, /* num key pad 1 */
KN_DOWNLEFT = KA_DOWNLEFT,
KN_KEYPAD_SLASH = KA_SLASH, /* num key pad / */
KN_UP = KA_UP, /* num key pad 8 */
KN_CENTER = KA_KEYPAD5, /* num key pad 5 */
KN_DOWN = KA_DOWN, /* num key pad 2 */
KN_INSERT = KA_INSERT, /* num key pad 0 */
KN_KEYPAD_ASTERISK= KA_ASTERISK, /* num key pad * */
KN_PGUP = KA_PGUP, /* num key pad 9 */
KN_UPRIGHT = KA_UPRIGHT,
KN_RIGHT = KA_RIGHT, /* num key pad 6 */
KN_PGDN = KA_PGDN, /* num key pad 3 */
KN_DOWNRIGHT = KA_DOWNRIGHT,
KN_DELETE = KA_DELETE, /* num key pad . */
KN_KEYPAD_MINUS = KA_MINUS, /* num key pad - */
KN_KEYPAD_PLUS = KA_PLUS, /* num key pad + */
KN_KEYPAD_RETURN = KA_RETURN, /* num key pad <ENTER> */
KN_ESC = KA_ESC,
KN_F1 = KA_F1,
KN_F2 = KA_F2,
KN_F3 = KA_F3,
KN_F4 = KA_F4,
KN_F5 = KA_F5,
KN_F6 = KA_F6,
KN_F7 = KA_F7,
KN_F8 = KA_F8,
KN_F9 = KA_F9,
KN_F10 = KA_F10,
KN_F11 = KA_F11,
KN_F12 = KA_F12,
KN_PRNTSCRN = VK_PRINT | WWKEY_VK_BIT,
KN_CAPSLOCK = VK_CAPITAL | WWKEY_VK_BIT,
KN_SCROLLLOCK = VK_SCROLL | WWKEY_VK_BIT, /* <SCROLL LOCK> */
KN_PAUSE = VK_PAUSE | WWKEY_VK_BIT, /* <PAUSE> */
KN_LSHIFT = VK_SHIFT | WWKEY_VK_BIT,
KN_RSHIFT = VK_SHIFT | WWKEY_VK_BIT,
KN_LCTRL = VK_CONTROL | WWKEY_VK_BIT,
KN_RCTRL = VK_CONTROL | WWKEY_VK_BIT,
KN_LALT = VK_MENU | WWKEY_VK_BIT,
KN_RALT = VK_MENU | WWKEY_VK_BIT,
KN_E_INSERT = VK_INSERT | WWKEY_VK_BIT,
KN_E_DELETE = VK_DELETE | WWKEY_VK_BIT,
KN_E_LEFT = VK_LEFT | WWKEY_VK_BIT, /* extended <LEFT ARROW> */
KN_E_HOME = VK_HOME | WWKEY_VK_BIT, /* extended <HOME> */
KN_E_END = VK_END | WWKEY_VK_BIT, /* extended <END> */
KN_E_UP = VK_UP | WWKEY_VK_BIT, /* extended <UP ARROW> */
KN_E_DOWN = VK_DOWN | WWKEY_VK_BIT, /* extended <DOWN ARROW> */
KN_E_PGUP = VK_PRIOR | WWKEY_VK_BIT, /* extended <PAGE UP> */
KN_E_PGDN = VK_NEXT | WWKEY_VK_BIT, /* extended <PAGE DOWN> */
KN_E_RIGHT = VK_RIGHT | WWKEY_VK_BIT, /* extended <RIGHT ARROW> */
KN_NUMLOCK = VK_NUMLOCK | WWKEY_VK_BIT, /* <NUM LOCK> */
KN_SHIFT_BIT = WWKEY_SHIFT_BIT,
KN_CTRL_BIT = WWKEY_CTRL_BIT | WWKEY_VK_BIT,
KN_ALT_BIT = WWKEY_ALT_BIT | WWKEY_VK_BIT,
KN_RLSE_BIT = WWKEY_RLS_BIT,
KN_BUTTON = WWKEY_BTN_BIT,
};
extern WWKeyboardClass *_Kbd;
/*
** The following routines provide some compatability with the old westwood
** library.
*/
int Check_Key(void);
int Check_Key_Num(void);
int Get_Key_Num(void);
int Get_Key(void);
int KN_To_KA(int key);
void Clear_KeyBuffer(void);
int Key_Down(int key);
int KN_To_VK(int key);
#endif

View File

@@ -0,0 +1,129 @@
;
; Command & Conquer Red Alert(tm)
; Copyright 2025 Electronic Arts Inc.
;
; This program is free software: you can redistribute it and/or modify
; it under the terms of the GNU General Public License as published by
; the Free Software Foundation, either version 3 of the License, or
; (at your option) any later version.
;
; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details.
;
; You should have received a copy of the GNU General Public License
; along with this program. If not, see <http://www.gnu.org/licenses/>.
;
;***************************************************************************
;** C O N F I D E N T I A L --- W E S T W O O D A S S O C I A T E S **
;***************************************************************************
;* *
;* Project Name : Westwood 32 bit Library *
;* *
;* File Name : KEYBOARD.INC *
;* *
;* Programmer : Phil W. Gorrow *
;* *
;* Start Date : July 12, 1994 *
;* *
;* Last Update : July 12, 1994 [PWG] *
;* *
;*-------------------------------------------------------------------------*
;* Contains all the defines used by the keyboard interrupt for assembly *
;* includes. *
;* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *
TRUE EQU 1 ; numerical true
FALSE EQU 0 ; numerical false
DEBUG EQU 1
MAX_X_PIXEL EQU 319
MAX_Y_PIXEL EQU 199
KN_RESERVED1 EQU 14
KN_RESERVED2 EQU 45
KN_RESERVED3 EQU 56
; these two are reserved for AMIGA open and close.
KN_LCOMM EQU 59
KN_RCOMM EQU 63
KN_LMOUSE EQU 65
KN_RMOUSE EQU 66
KN_JBUTTON1 EQU 67
KN_JBUTTON2 EQU 68
KN_J_UP EQU 69
KN_J_RIGHT EQU 70
KN_J_DOWN EQU 71
KN_J_LEFT EQU 72
KN_LEFT EQU 92
KN_UPLEFT EQU 91
KN_UP EQU 96
KN_UPRIGHT EQU 101
KN_RIGHT EQU 102
KN_DOWNRIGHT EQU 103
KN_DOWN EQU 98
KN_DOWNLEFT EQU 93
KN_CENTER EQU 97
KN_INSERT EQU 99
KN_DELETE EQU 104
KN_RETURN EQU 43
KN_SPACE EQU 61
KN_KEYPAD_RETURN EQU 108
; these two are reserved for AMIGA K left and right paren
KN_KLPAREN EQU 87
KN_KRPAREN EQU 88
KN_NUMLOCK EQU 90
KN_SCROLLOCK EQU 125 ; key ignored by the logging system
KN_MOUSE_MOVE EQU 45 ; Indicate a mouse move (for playback of logged data)
; ----------------------------------------------------------------
; flags used in Keyflags to customize keystroke interrupt.
REPEATON EQU 0001H ; 1:all makes into buffer, 0:only 1st make
TRACKEXT EQU 0002H ; 1:Home != keypad Home, 0:Home=keypad Home
FILTERONLY EQU 0004H ; 1:Normal BIOS operation with filter
CTRLSON EQU 0008H ; 1:pass scroll lock sequence into BIOS
CTRLALTTURBO EQU 0010H ; 1:Allow turbo up and down in application
CTRLCON EQU 0020H ; 1:pass stop code to BIOS
SCROLLLOCKON EQU 0040H ; 1:pass scroll lock key into BIOS
PAUSEON EQU 0080H ; 1:pass the pause key and seq to BIOS
BREAKON EQU 0100H ; 1:pass the ctrl break seq to BIOS
NONUMLOCK EQU 0200H ; 1:do NOT remap keypad to numbers
TASKSWITCHABLE EQU 0400H ; 1:allows task switching keys thru ALT-TAB,
; ALT-ESC,CTRL-ESC
PASSBREAKS EQU 0800H ; 1:Pass all break codes to keyboard buffer.
KEYMOUSE EQU 1000H ; 1:Numeric keypad moves mouse
SIMLBUTTON EQU 2000H ; 1:have space and enter keys simulate Left
DEBUGINT EQU 4000H ; mouse button when KEYMOUSE is set
SHIFTPRESS EQU 001H ; bit 0 for shift key pressed
CTRLPRESS EQU 002H ; bit 1 for ctrl key pressed
ALTPRESS EQU 004H ; bit 2 for alt key pressed
KEYRELEASE EQU 008H ; bit 3 for key released
NOTKEYRELEASE EQU 0F7H ; not of key released
CAPSLOCK EQU 00001H ; bit 0 for caps locked
NUMLOCK EQU 00002H ; bit 1 for num locked
CLEARISR EQU 020H ; value to clear In Service Register
DOS EQU 021H
INTCHIP0 EQU 020H ; 8259 interrupt chip controller 0
KEYCTRL EQU 061H ; control bits for KB sense data
KEYDATA EQU 060H ; keyboard scan code port

View File

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

View File

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



109
WIN32LIB/INCLUDE/MEMFLAG.H Normal file
View File

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

272
WIN32LIB/INCLUDE/MISC.H Normal file
View File

@@ -0,0 +1,272 @@
/*
** Command & Conquer Red Alert(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/***************************************************************************
** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S **
***************************************************************************
* *
* Project Name : 32 bit library *
* *
* File Name : MISC.H *
* *
* Programmer : Scott K. Bowen *
* *
* Start Date : August 3, 1994 *
* *
* Last Update : August 3, 1994 [SKB] *
* *
*-------------------------------------------------------------------------*
* Functions: *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
#ifndef MISC_H
#define MISC_H
#define WIN32_LEAN_AND_MEAN // eliminates unecessary definitions in windows.h
#ifndef _WIN32 // Denzil 6/2/98 Watcom 11.0 complains without this check
#define _WIN32
#endif // _WIN32
#include <windows.h>
#include <windowsx.h>
#include <ddraw.h>
extern LPDIRECTDRAWSURFACE PaletteSurface;
/*========================= C++ Routines ==================================*/
/*=========================================================================*/
/* The following prototypes are for the file: DDRAW.CPP */
/*=========================================================================*/
void Process_DD_Result(HRESULT result, int display_ok_msg);
BOOL Set_Video_Mode(HWND hwnd, int w, int h, int bits_per_pixel);
void Reset_Video_Mode(void);
unsigned Get_Free_Video_Memory(void);
void Wait_Blit(void);
unsigned Get_Video_Hardware_Capabilities(void);
extern "C" void Wait_Vert_Blank(void);
extern "C" void Set_DD_Palette (void *palette);
/*
** Pointer to function to call if we detect a focus loss
*/
extern void (*Misc_Focus_Loss_Function)(void);
/*
** Pointer to function to call if we detect a surface restore
*/
extern void (*Misc_Focus_Restore_Function)(void);
/*
* Flags returned by Get_Video_Hardware_Capabilities
*/
/* Hardware blits supported? */
#define VIDEO_BLITTER 1
/* Hardware blits asyncronous? */
#define VIDEO_BLITTER_ASYNC 2
/* Can palette changes be synced to vertical refresh? */
#define VIDEO_SYNC_PALETTE 4
/* Is the video cards memory bank switched? */
#define VIDEO_BANK_SWITCHED 8
/* Can the blitter do filled rectangles? */
#define VIDEO_COLOR_FILL 16
/* Is there no hardware assistance avaailable at all? */
#define VIDEO_NO_HARDWARE_ASSIST 32
/*
* Definition of surface monitor class
*
* This class keeps track of all the graphic buffers we generate in video memory so they
* can be restored after a focus switch.
*/
#define MAX_SURFACES 20
class SurfaceMonitorClass {
public:
SurfaceMonitorClass();
void Add_DD_Surface (LPDIRECTDRAWSURFACE);
void Remove_DD_Surface (LPDIRECTDRAWSURFACE);
BOOL Got_Surface_Already (LPDIRECTDRAWSURFACE);
void Restore_Surfaces (void);
void Set_Surface_Focus ( BOOL in_focus );
void Release(void);
BOOL SurfacesRestored;
private:
LPDIRECTDRAWSURFACE Surface[MAX_SURFACES];
BOOL InFocus;
};
extern SurfaceMonitorClass AllSurfaces; //List of all direct draw surfaces
/*=========================================================================*/
/* The following variables are declared in: DDRAW.CPP */
/*=========================================================================*/
extern LPDIRECTDRAW DirectDrawObject;
extern LPDIRECTDRAW2 DirectDraw2Interface;
extern HWND MainWindow;
extern BOOL SystemToVideoBlits;
extern BOOL VideoToSystemBlits;
extern BOOL SystemToSystemBlits;
extern BOOL OverlappedVideoBlits; // Can video driver blit overlapped regions?
/*=========================================================================*/
/* The following prototypes are for the file: EXIT.CPP */
/* Prog_End Must be supplied by the user program in startup.cpp */
/*=========================================================================*/
VOID __cdecl Prog_End(VOID);
VOID __cdecl Exit(INT errorval, const BYTE *message, ...);
/*=========================================================================*/
/* The following prototypes are for the file: DELAY.CPP */
/*=========================================================================*/
void Delay(int duration);
void Vsync(void);
/*=========================================================================*/
/* The following prototypes are for the file: FINDARGV.CPP */
/*=========================================================================*/
BYTE __cdecl Find_Argv(BYTE const *str);
/*=========================================================================*/
/* The following prototypes are for the file: LIB.CPP */
/*=========================================================================*/
char *Find_Argv(char const *str);
void Mono_Mem_Dump(void const *databuf, int bytes, int y);
void Convert_RGB_To_HSV(unsigned int r, unsigned int g, unsigned int b, unsigned int *h, unsigned int *s, unsigned int *v);
void Convert_HSV_To_RGB(unsigned int h, unsigned int s, unsigned int v, unsigned int *r, unsigned int *g, unsigned int *b);
/*=========================================================================*/
/* The following prototypes are for the file: VERSION.CPP */
/*=========================================================================*/
BYTE __cdecl Version(VOID);
/*=========================================================================*/
/* The following prototypes are for the file: IRANDOM.CPP */
/*=========================================================================*/
int IRandom(int minval, int maxval);
/*========================= Assembly Routines ==============================*/
#ifdef __cplusplus
extern "C" {
#endif
/*=========================================================================*/
/* The following prototypes are for the file: RANDOM.ASM */
/*=========================================================================*/
unsigned char __cdecl Random(void);
int __cdecl Get_Random_Mask(int maxval);
/*=========================================================================*/
/* The following prototype is for the file: SHAKESCR.ASM */
/*=========================================================================*/
void __cdecl Shake_Screen(int shakes);
/*=========================================================================*/
/* The following prototypes are for the file: REVERSE.ASM */
/*=========================================================================*/
long __cdecl Reverse_Long(long number);
short __cdecl Reverse_Short(short number);
long __cdecl Swap_Long(long number);
#if (0)
/*=========================================================================*/
/* The following prototype is for the file: FACING8.ASM */
/*=========================================================================*/
int __cdecl Desired_Facing8(int x1, int y1, int x2, int y2);
/*=========================================================================*/
/* The following prototype is for the file: FACING16.ASM */
/*=========================================================================*/
int __cdecl Desired_Facing16(int x1, int y1, int x2, int y2);
/*=========================================================================*/
/* The following prototype is for the file: FACINGFF.ASM */
/*=========================================================================*/
int __cdecl Desired_Facing256(int x1, int y1, int x2, int y2);
/*=========================================================================*/
/* The following prototype is for the file: FADING.ASM */
/*=========================================================================*/
#endif
void * __cdecl Build_Fading_Table(void const *palette, void const *dest, long int color, long int frac);
/*=========================================================================*/
/* The following prototype is for the file: CRC.ASM */
/*=========================================================================*/
long __cdecl Calculate_CRC(void *buffer, long length);
/*=========================================================================*/
/* The following prototypes are for the file: DETPROC.ASM */
/*=========================================================================*/
extern WORD __cdecl Processor(void);
extern WORD __cdecl Operating_System(void);
extern unsigned long random ( unsigned long mod ) ;
//extern void randomize ( void ) ;
extern int __cdecl Clip_Rect ( int * x , int * y , int * dw , int * dh ,
int width , int height ) ;
extern int __cdecl Confine_Rect ( int * x , int * y , int dw , int dh ,
int width , int height ) ;
/*=========================================================================*/
/* The following prototypes are for the file: OPSYS.ASM */
/*=========================================================================*/
extern WORD OperationgSystem;
#ifdef __cplusplus
}
#endif
/*=========================================================================*/
#endif // MISC_H

View File

@@ -0,0 +1,72 @@
/*
** 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 WIN32
#define WIN32
#ifndef _WIN32 // Denzil 6/2/98 Watcom 11.0 complains without this check
#define _WIN32
#endif // _WIN32
#endif //WIN32
#include <windows.h>
class ModemRegistryEntryClass {
public:
ModemRegistryEntryClass (int modem_number);
~ModemRegistryEntryClass (void);
char *Get_Modem_Name (void) { return (ModemName); }
char *Get_Modem_Device_Name (void) { return (ModemDeviceName); }
char *Get_Modem_Error_Correction_Enable (void) { return (ErrorCorrectionEnable); }
char *Get_Modem_Error_Correction_Disable (void) { return (ErrorCorrectionDisable); }
char *Get_Modem_Compression_Enable (void) { return (CompressionEnable); }
char *Get_Modem_Compression_Disable (void) { return (CompressionDisable); }
char *Get_Modem_Hardware_Flow_Control (void) { return (HardwareFlowControl); }
char *Get_Modem_No_Flow_Control (void) { return (HardwareFlowControl); }
private:
char *ModemName;
char *ModemDeviceName;
char *ErrorCorrectionEnable;
char *ErrorCorrectionDisable;
char *CompressionEnable;
char *CompressionDisable;
char *HardwareFlowControl;
char *NoFlowControl;
};

185
WIN32LIB/INCLUDE/MONO.H Normal file
View File

@@ -0,0 +1,185 @@
/*
** 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/>.
*/
/* $Header: F:\projects\c&c\vcs\code\monoc.h_v 2.16 06 Sep 1995 16:29:02 JOE_BOSTIC $ */
/***********************************************************************************************
*** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
***********************************************************************************************
* *
* Project Name : Command & Conquer *
* *
* File Name : MONO.H *
* *
* Programmer : Joe L. Bostic *
* *
* Start Date : July 2, 1994 *
* *
* Last Update : July 2, 1994 [JLB] *
* *
*---------------------------------------------------------------------------------------------*
* Functions: *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
#ifndef MONOC_H
#define MONOC_H
class MonoClass {
/*
** This is a private structure that is used to control which characters
** are used when a box is drawn. Line drawing on the monochrome screen is
** really made up of characters. This specifies which characters to use.
*/
typedef struct {
char UpperLeft;
char TopEdge;
char UpperRight;
char RightEdge;
char BottomRight;
char BottomEdge;
char BottomLeft;
char LeftEdge;
} BoxDataType;
/*
** Each cell is constructed of the actual character that is displayed and the
** attribute to use. This character pair is located at every position on the
** display (80 x 25). Since this cell pair can be represented by a "short"
** integer, certain speed optimizations are taken in the monochrome drawing
** code.
*/
typedef struct {
char Character; // Character to display.
char Attribute; // Attribute.
} CellType;
/*
** These private constants are used in the various monochrome operations.
*/
enum MonoClassPortEnums {
CONTROL_PORT=0x03B4, // CRTC control register.
DATA_PORT=0x03B5, // CRTC data register.
COLUMNS=80, // Number of columns.
LINES=25, // Number of lines.
SIZE_OF_PAGE=LINES*COLUMNS*sizeof(CellType), // Entire page size.
DEFAULT_ATTRIBUTE=0x02 // Normal white on black color attribute.
};
public:
enum MonoClassPageEnums {
MAX_MONO_PAGES=16, // Maximum RAM pages on mono card.
SEGMENT=0xB000 // Monochrome screen segment.
};
/*
** These are the various box styles that may be used.
*/
typedef enum BoxStyleType {
SINGLE, // Single thickness.
DOUBLE_HORZ, // Double thick on the horizontal axis.
DOUBLE_VERT, // Double thick on the vertical axis.
DOUBLE, // Double thickness.
COUNT
} BoxStyleType;
MonoClass(void);
~MonoClass(void);
static void Enable(void) {Enabled = 1;};
static void Disable(void) {Enabled = 0;};
static int Is_Enabled(void) {return Enabled;};
static MonoClass * Get_Current(void) {return PageUsage[0];};
void Draw_Box(int x, int y, int w, int h, char attrib=DEFAULT_ATTRIBUTE, BoxStyleType thick=SINGLE);
void Set_Default_Attribute(char attrib) {Attrib = attrib;};
void Clear(void);
void Set_Cursor(int x, int y);
void Print(char const *text);
void Print(int text);
void Printf(char const *text, ...);
void Printf(int text, ...);
void Text_Print(char const *text, int x, int y, char attrib=DEFAULT_ATTRIBUTE);
void Text_Print(int text, int x, int y, char attrib=DEFAULT_ATTRIBUTE);
void View(void);
int Get_X(void) const {return X;};
int Get_Y(void) const {return Y;};
/*
** Handles deep copies for the mono class objects. This performs what is essentially
** a screen copy.
*/
MonoClass & operator = (MonoClass const & );
/*
** This merely makes a duplicate of the mono object into a newly created mono
** object.
*/
MonoClass (MonoClass const &);
private:
char X; // Cursor X position.
char Y; // Cursor Y position.
char Attrib; // Normal attribute to use if none specified.
char Page; // The current page to write to.
/*
** Helper functions to help with display operations.
*/
int Offset(int x=0, int y=0) const {return (SIZE_OF_PAGE*Page) + sizeof(CellType)*(x + (y*COLUMNS));};
void Scroll(int lines);
void Store_Cell(CellType &cell, int x, int y) {
*(CellType *)((long)MonoSegment + Offset(x, y)) = cell;
};
/*
** This is the segment/selector of the monochrome screen.
*/
static void * MonoSegment;
/*
** This the the arrays of characters used for drawing boxes.
*/
static BoxDataType const CharData[4];
/*
** This array contains pointers to the monochrome objects that are assigned
** to each of the monochrome pages. As the monochrome pages are made visible,
** they can be shuffled around between the actual locations. The first entry
** in this table is the one that is visible.
*/
static MonoClass * PageUsage[MAX_MONO_PAGES];
/*
** If this is true, then monochrome output is allowed. It defaults to false
** so that monochrome output must be explicitly enabled.
*/
static int Enabled;
};
void Mono_Set_Cursor(int x, int y);
int Mono_Printf(char const *string, ...);
void Mono_Clear_Screen(void);
void Mono_Text_Print(void const *text, int x, int y, int attrib);
void Mono_Draw_Rect(int x, int y, int w, int h, int attrib, int thick);
void Mono_Print(void const *text);
int Mono_X(void);
int Mono_Y(void);
#endif

126
WIN32LIB/INCLUDE/MOUSE.H Normal file
View File

@@ -0,0 +1,126 @@
/*
** 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/>.
*/
/***********************************************************************************************
* *
* Project Name : Westwood 32 Bit Library *
* *
* File Name : MOUSE.H *
* *
* Programmer : Philip W. Gorrow *
* *
* Start Date : 12/12/95 *
* *
* Last Update : December 12, 1995 [PWG] *
* *
*---------------------------------------------------------------------------------------------*
* Functions: *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
#ifndef WW_MOUSE_H
#define WW_MOUSE_H
#include <gbuffer.h>
class WWMouseClass {
public:
WWMouseClass(GraphicViewPortClass *scr, int mouse_max_width, int mouse_max_height);
~WWMouseClass();
void *Set_Cursor(int xhotspot, int yhotspot, void *cursor);
void Process_Mouse(void);
void Hide_Mouse(void);
void Show_Mouse(void);
void Conditional_Hide_Mouse(int x1, int y1, int x2, int y2);
void Conditional_Show_Mouse(void);
int Get_Mouse_State(void);
int Get_Mouse_X(void);
int Get_Mouse_Y(void);
void Get_Mouse_XY(int &x, int &y);
//
// The following two routines can be used to render the mouse onto a graphicbuffer
// other than the hidpage.
//
void Draw_Mouse(GraphicViewPortClass *scr);
void Erase_Mouse(GraphicViewPortClass *scr, int forced = FALSE);
void Block_Mouse(GraphicBufferClass *buffer);
void Unblock_Mouse(GraphicBufferClass *buffer);
void Set_Cursor_Clip(void);
void Clear_Cursor_Clip(void);
private:
enum {
CONDHIDE = 1,
CONDHIDDEN = 2,
};
void Low_Hide_Mouse(void);
void Low_Show_Mouse(int x, int y);
char *MouseCursor; // pointer to the mouse cursor in memory
int MouseXHot; // X hot spot of the current mouse cursor
int MouseYHot; // Y hot spot of the current mouse cursor
int CursorWidth; // width of the mouse cursor in pixels
int CursorHeight; // height of the mouse cursor in pixels
char *MouseBuffer; // pointer to background buffer in memory
int MouseBuffX; // pixel x mouse buffer was preserved at
int MouseBuffY; // pixel y mouse buffer was preserved at
int MaxWidth; // maximum width of mouse background buffer
int MaxHeight; // maximum height of mouse background buffer
int MouseCXLeft; // left x pos if conditional hide mouse in effect
int MouseCYUpper; // upper y pos if conditional hide mouse in effect
int MouseCXRight; // right x pos if conditional hide mouse in effect
int MouseCYLower; // lower y pos if conditional hide mouse in effect
char MCFlags; // conditional hide mouse flags
char MCCount; // nesting count for conditional hide mouse
GraphicViewPortClass *Screen; // pointer to the surface mouse was init'd with
char * PrevCursor; // pointer to previous cursor shape
int MouseUpdate;
int State;
char *EraseBuffer; // Buffer which holds background to restore to hidden page
int EraseBuffX; // X position of the hidden page background
int EraseBuffY; // Y position of the hidden page background
int EraseBuffHotX; // X position of the hidden page background
int EraseBuffHotY; // Y position of the hidden page background
int EraseFlags; // Records whether mutex has been released
CRITICAL_SECTION MouseCriticalSection; // Control for mouse re-enterancy
unsigned TimerHandle;
};
extern "C" {
void __cdecl Mouse_Shadow_Buffer(void *thisptr, GraphicViewPortClass *srcdst, void *buffer, int x, int y, int hotx, int hoty, int store);
void __cdecl Draw_Mouse(void *thisptr, GraphicViewPortClass *srcdst, int x, int y);
void * __cdecl ASM_Set_Mouse_Cursor(void * thisptr, int hotspotx, int hotspoty, VOID *cursor);
};
void Hide_Mouse(void);
void Show_Mouse(void);
void Conditional_Hide_Mouse(int x1, int y1, int x2, int y2);
void Conditional_Show_Mouse(void);
int Get_Mouse_State(void);
void *Set_Mouse_Cursor(int hotx, int hoty, void *cursor);
int Get_Mouse_X(void);
int Get_Mouse_Y(void);
#endif

View File

@@ -0,0 +1,67 @@
;
; 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/>.
;
;***********************************************************************************************
;* *
;* Project Name : Westwood 32 bit Library *
;* *
;* File Name : MOUSE.INC *
;* *
;* Programmer : Philip W. Gorrow *
;* *
;* Start Date : 12/12/95 *
;* *
;* Last Update : December 12, 1995 [PWG] *
;* *
;*---------------------------------------------------------------------------------------------*
;* Functions: *
;* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *
STRUC MouseType
MouseCursor DD ? ; pointer to the mouse cursor in memory
MouseXHot DD ? ; X hot spot of the current mouse cursor
MouseYHot DD ? ; Y hot spot of the current mouse cursor
CursorWidth DD ? ; Width of mouse cursor in pixels
CursorHeight DD ? ; Height of the mouse cursor in pixels
MouseBuffer DD ? ; pointer to background buffer in memory
MouseBuffX DD ? ; pixel x mouse buffer was preserved at
MouseBuffY DD ? ; pixel y mouse buffer was preserved at
MaxWidth DD ? ; Maximum possible width of the background buffer
MaxHeight DD ? ; Maximum possible height of the background buffer
MouseCXLeft DD ? ; left hand x position if conditional hide mouse in effect
MouseCYUpper DD ? ; upper y position if conditional hide mouse in effect
MouseCXRight DD ? ; right hand x position if conditional hide mouse in effect
MouseCYLower DD ? ; lower y position if conditional hide mouse in effect
MCFlags DB ? ; conditional hide mouse flags
MCCount DB ? ; nesting count for conditional hide mouse
Screen DD ? ; pointer to the surface mouse was init'd with
PrevCursor DD ? ; pointer to the prev cursor shape
MouseUpdate DD ? ; is the mouse being currently updated
State DD ?
EraseBuffer DD ?
EraseBuffX DD ?
EraseBuffY DD ?
EraseBuffHotX DD ?
EraseBuffHotY DD ?
EraseFlags DD ?
ENDS

View File

@@ -0,0 +1,59 @@
;
; Command & Conquer Red Alert(tm)
; Copyright 2025 Electronic Arts Inc.
;
; This program is free software: you can redistribute it and/or modify
; it under the terms of the GNU General Public License as published by
; the Free Software Foundation, either version 3 of the License, or
; (at your option) any later version.
;
; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details.
;
; You should have received a copy of the GNU General Public License
; along with this program. If not, see <http://www.gnu.org/licenses/>.
;
;****************************************************************************
;* bNybbleTablexxxx - ADPCM Lookup table for nybbles
;****************************************************************************
align 4
bNybbleTableLow DB 00h*2,01h*2,02h*2,03h*2,04h*2,05h*2,06h*2,07h*2,08h*2,09h*2,0Ah*2,0Bh*2,0Ch*2,0Dh*2,0Eh*2,0Fh*2
DB 00h*2,01h*2,02h*2,03h*2,04h*2,05h*2,06h*2,07h*2,08h*2,09h*2,0Ah*2,0Bh*2,0Ch*2,0Dh*2,0Eh*2,0Fh*2
DB 00h*2,01h*2,02h*2,03h*2,04h*2,05h*2,06h*2,07h*2,08h*2,09h*2,0Ah*2,0Bh*2,0Ch*2,0Dh*2,0Eh*2,0Fh*2
DB 00h*2,01h*2,02h*2,03h*2,04h*2,05h*2,06h*2,07h*2,08h*2,09h*2,0Ah*2,0Bh*2,0Ch*2,0Dh*2,0Eh*2,0Fh*2
DB 00h*2,01h*2,02h*2,03h*2,04h*2,05h*2,06h*2,07h*2,08h*2,09h*2,0Ah*2,0Bh*2,0Ch*2,0Dh*2,0Eh*2,0Fh*2
DB 00h*2,01h*2,02h*2,03h*2,04h*2,05h*2,06h*2,07h*2,08h*2,09h*2,0Ah*2,0Bh*2,0Ch*2,0Dh*2,0Eh*2,0Fh*2
DB 00h*2,01h*2,02h*2,03h*2,04h*2,05h*2,06h*2,07h*2,08h*2,09h*2,0Ah*2,0Bh*2,0Ch*2,0Dh*2,0Eh*2,0Fh*2
DB 00h*2,01h*2,02h*2,03h*2,04h*2,05h*2,06h*2,07h*2,08h*2,09h*2,0Ah*2,0Bh*2,0Ch*2,0Dh*2,0Eh*2,0Fh*2
DB 00h*2,01h*2,02h*2,03h*2,04h*2,05h*2,06h*2,07h*2,08h*2,09h*2,0Ah*2,0Bh*2,0Ch*2,0Dh*2,0Eh*2,0Fh*2
DB 00h*2,01h*2,02h*2,03h*2,04h*2,05h*2,06h*2,07h*2,08h*2,09h*2,0Ah*2,0Bh*2,0Ch*2,0Dh*2,0Eh*2,0Fh*2
DB 00h*2,01h*2,02h*2,03h*2,04h*2,05h*2,06h*2,07h*2,08h*2,09h*2,0Ah*2,0Bh*2,0Ch*2,0Dh*2,0Eh*2,0Fh*2
DB 00h*2,01h*2,02h*2,03h*2,04h*2,05h*2,06h*2,07h*2,08h*2,09h*2,0Ah*2,0Bh*2,0Ch*2,0Dh*2,0Eh*2,0Fh*2
DB 00h*2,01h*2,02h*2,03h*2,04h*2,05h*2,06h*2,07h*2,08h*2,09h*2,0Ah*2,0Bh*2,0Ch*2,0Dh*2,0Eh*2,0Fh*2
DB 00h*2,01h*2,02h*2,03h*2,04h*2,05h*2,06h*2,07h*2,08h*2,09h*2,0Ah*2,0Bh*2,0Ch*2,0Dh*2,0Eh*2,0Fh*2
DB 00h*2,01h*2,02h*2,03h*2,04h*2,05h*2,06h*2,07h*2,08h*2,09h*2,0Ah*2,0Bh*2,0Ch*2,0Dh*2,0Eh*2,0Fh*2
DB 00h*2,01h*2,02h*2,03h*2,04h*2,05h*2,06h*2,07h*2,08h*2,09h*2,0Ah*2,0Bh*2,0Ch*2,0Dh*2,0Eh*2,0Fh*2
align 4
bNybbleTableHigh DB 00h*2,00h*2,00h*2,00h*2,00h*2,00h*2,00h*2,00h*2,00h*2,00h*2,00h*2,00h*2,00h*2,00h*2,00h*2,00h*2
DB 01h*2,01h*2,01h*2,01h*2,01h*2,01h*2,01h*2,01h*2,01h*2,01h*2,01h*2,01h*2,01h*2,01h*2,01h*2,01h*2
DB 02h*2,02h*2,02h*2,02h*2,02h*2,02h*2,02h*2,02h*2,02h*2,02h*2,02h*2,02h*2,02h*2,02h*2,02h*2,02h*2
DB 03h*2,03h*2,03h*2,03h*2,03h*2,03h*2,03h*2,03h*2,03h*2,03h*2,03h*2,03h*2,03h*2,03h*2,03h*2,03h*2
DB 04h*2,04h*2,04h*2,04h*2,04h*2,04h*2,04h*2,04h*2,04h*2,04h*2,04h*2,04h*2,04h*2,04h*2,04h*2,04h*2
DB 05h*2,05h*2,05h*2,05h*2,05h*2,05h*2,05h*2,05h*2,05h*2,05h*2,05h*2,05h*2,05h*2,05h*2,05h*2,05h*2
DB 06h*2,06h*2,06h*2,06h*2,06h*2,06h*2,06h*2,06h*2,06h*2,06h*2,06h*2,06h*2,06h*2,06h*2,06h*2,06h*2
DB 07h*2,07h*2,07h*2,07h*2,07h*2,07h*2,07h*2,07h*2,07h*2,07h*2,07h*2,07h*2,07h*2,07h*2,07h*2,07h*2
DB 08h*2,08h*2,08h*2,08h*2,08h*2,08h*2,08h*2,08h*2,08h*2,08h*2,08h*2,08h*2,08h*2,08h*2,08h*2,08h*2
DB 09h*2,09h*2,09h*2,09h*2,09h*2,09h*2,09h*2,09h*2,09h*2,09h*2,09h*2,09h*2,09h*2,09h*2,09h*2,09h*2
DB 0Ah*2,0Ah*2,0Ah*2,0Ah*2,0Ah*2,0Ah*2,0Ah*2,0Ah*2,0Ah*2,0Ah*2,0Ah*2,0Ah*2,0Ah*2,0Ah*2,0Ah*2,0Ah*2
DB 0Bh*2,0Bh*2,0Bh*2,0Bh*2,0Bh*2,0Bh*2,0Bh*2,0Bh*2,0Bh*2,0Bh*2,0Bh*2,0Bh*2,0Bh*2,0Bh*2,0Bh*2,0Bh*2
DB 0Ch*2,0Ch*2,0Ch*2,0Ch*2,0Ch*2,0Ch*2,0Ch*2,0Ch*2,0Ch*2,0Ch*2,0Ch*2,0Ch*2,0Ch*2,0Ch*2,0Ch*2,0Ch*2
DB 0Dh*2,0Dh*2,0Dh*2,0Dh*2,0Dh*2,0Dh*2,0Dh*2,0Dh*2,0Dh*2,0Dh*2,0Dh*2,0Dh*2,0Dh*2,0Dh*2,0Dh*2,0Dh*2
DB 0Eh*2,0Eh*2,0Eh*2,0Eh*2,0Eh*2,0Eh*2,0Eh*2,0Eh*2,0Eh*2,0Eh*2,0Eh*2,0Eh*2,0Eh*2,0Eh*2,0Eh*2,0Eh*2
DB 0Fh*2,0Fh*2,0Fh*2,0Fh*2,0Fh*2,0Fh*2,0Fh*2,0Fh*2,0Fh*2,0Fh*2,0Fh*2,0Fh*2,0Fh*2,0Fh*2,0Fh*2,0Fh*2

View File

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

309
WIN32LIB/INCLUDE/PLAYCD.H Normal file
View File

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


105
WIN32LIB/INCLUDE/PROFILE.H Normal file
View File

@@ -0,0 +1,105 @@
/*
** Command & Conquer Red Alert(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/***********************************************************************************************
*** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
***********************************************************************************************
* *
* Project Name : Library profiler *
* *
* File Name : PROFILE.H *
* *
* Programmer : Steve Tall *
* *
* Start Date : 11/17/95 *
* *
* Last Update : November 20th 1995 [ST] *
* *
*---------------------------------------------------------------------------------------------*
* Overview: *
* *
* New System *
* ~~~~~~~~~~~ *
* *
* The new profiler system creates a seperate thread and then starts a timer off there. The *
* timer in the second thread uses GetThreadContext to sample the IP address of each user *
* thread. This system has the advantage of being able to sample what is happening in all the *
* threads we own not just the main thread. Another advantage is that it doesnt require a *
* major recompilation. *
* The disadvantage is that we dont really know what is going on when the IP is outside the *
* scope of our threads - We could be in direct draw, direct sound or even something like the *
* VMM and there is no way to tell. *
* *
* *
* *
* Old System *
* ~~~~~~~~~~~ *
* *
* The profiler works by using the function prologue and epilogue hooks available in Watcom *
* to register the current functions address in a global variable and then sampling the *
* contents of the variable using a windows timer which runs at up to 1000 samples per second.*
* *
* Compile the code to be sampled with the -ep and -ee flags to enable the prologue (__PRO) *
* and epilogue (__EPI) calls to be generated. *
* At the beginning of the section to be profiled (just before main loop normally) call the *
* Start_Profiler function to start sampling. At the end of the section, call Stop_Profiler *
* which will stop the timer and write the profile data to disk in the PROFILE.BIN file. *
* *
* Use PROFILE.EXE to view the results of the session. *
* *
* The addition of prologue and epilogue code will slow down the product and the profiler *
* allocates a huge buffer for data so it should not be linked in unless it is going to be *
* used. *
* *
* The advantage of the prologue/epilogue approach is that all samples represent valid *
* addresses within our code so we get valid results we can use even when the IP is in system *
* code. *
* *
* *
*---------------------------------------------------------------------------------------------*
* *
* Functions: *
* *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
#define MAX_PROFILE_TIME 60*1 //1 minute(s) @ 14.4 Mb per hour
#define PROFILE_RATE 1000 //samples per sec (max 1000)
/*
* Defines for choosing between the old and new profiler system
*
*/
#define OLD_PROFILE_SYSTEM 1
#define NEW_PROFILE_SYSTEM 2
//#define PROFILE_SYSTEM OLD_PROFILE_SYSTEM
#define PROFILE_SYSTEM NEW_PROFILE_SYSTEM
extern "C"{
void __cdecl Profile_Init(void);
void __cdecl Profile_End(void);
void __cdecl Start_Profiler(void);
void __cdecl Stop_Profiler(void);
}

View File

@@ -0,0 +1,44 @@
;
; 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/>.
;
;USE_PROFILER =1
macro prologue
Ifdef USE_PROFILER
global __PRO:near
call __PRO
endif ;USE_PROFILER
endm
macro epilogue
ifdef USE_PROFILER
global __EPI:near
push ebp
call __EPI
pop ebp
endif ;USE_PROFILER
endm

257
WIN32LIB/INCLUDE/RAWFILE.H Normal file
View File

@@ -0,0 +1,257 @@
/*
** 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/>.
*/
/* $Header: F:\projects\c&c\vcs\code\rawfile.h_v 2.15 06 Sep 1995 16:29:30 JOE_BOSTIC $ */
/***********************************************************************************************
*** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
***********************************************************************************************
* *
* Project Name : Westwood Library *
* *
* File Name : RAWFILE.H *
* *
* Programmer : Joe L. Bostic *
* *
* Start Date : August 8, 1994 *
* *
* Last Update : October 18, 1994 [JLB] *
* *
*---------------------------------------------------------------------------------------------*
* Functions: *
* RawFileClass::File_Name -- Returns with the filename associate with the file object. *
* RawFileClass::RawFileClass -- Default constructor for a file object. *
* RawFileClass::Is_Open -- Checks to see if the file is open or not. *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
#ifndef RAWFILE_H
#define RAWFILE_H
#ifndef WIN32
#define WIN32 1
#ifndef _WIN32 // Denzil 6/2/98 Watcom 11.0 complains without this check
#define _WIN32
#endif // _WIN32
#endif
#include <windows.h>
//#include <wwlib32.h>
#include <limits.h>
#include <errno.h>
#include <windows.h>
//#include <algo.h>
#include "wwfile.h"
#ifdef NEVER
/*
** This is a duplicate of the error numbers. The error handler for the RawFileClass handles
** these errors. If the error routine is overridden and additional errors are defined, then
** use numbers starting with 100. Note that these errors here are listed in numerical order.
** These errors are defined in the standard header file "ERRNO.H".
*/
EZERO, // Non-error.
EINVFNC, // Invalid function number.
ENOFILE, // File not found.
ENOENT=ENOFILE, // No such file or directory.
ENOPATH, // Path not found.
EMFILE, // Too many open files.
EACCES, // Permission denied.
EBADF, // Bad file number.
ECONTR, // Memory blocks destroyed.
ENOMEM, // Not enough core memory.
EINVMEM, // Invalid memory block address.
EINVENV, // Invalid environment.
EINVFMT, // Invalid format.
EINVACC, // Invalid access code.
EINVDAT, // Invalid data.
EFAULT, // Unknown error.
EINVDRV, // Invalid drive specified.
ENODEV=EINVDRV, // No such device.
ECURDIR, // Attempt to remove CurDir.
ENOTSAM, // Not same device.
ENMFILE, // No more files.
EINVAL, // Invalid argument.
E2BIG, // Argument list too long.
ENOEXEC, // exec format error.
EXDEV, // Cross-device link.
ENFILE, // Too many open files.
ECHILD, // No child process.
ENOTTY, // not used
ETXTBSY, // not used
EFBIG, // not used
ENOSPC, // No space left on device.
ESPIPE, // Illegal seek.
EROFS, // Read-only file system.
EMLINK, // not used
EPIPE, // Broken pipe.
EDOM, // Math argument.
ERANGE, // Result too large.
EEXIST, // File already exists.
EDEADLOCK, // Locking violation.
EPERM, // Operation not permitted.
ESRCH, // not used
EINTR, // Interrupted function call.
EIO, // Input/output error.
ENXIO, // No such device or address.
EAGAIN, // Resource temporarily unavailable.
ENOTBLK, // not used
EBUSY, // Resource busy.
ENOTDIR, // not used
EISDIR, // not used
EUCLEAN, // not used
#endif
/*
** This is the definition of the raw file class. It is derived from the abstract base FileClass
** and handles the interface to the low level DOS routines. This is the first class in the
** chain of derived file classes that actually performs a useful function. With this class,
** I/O is possible. More sophisticated features, such as packed files, CD-ROM support,
** file caching, and XMS/EMS memory support, are handled by derived classes.
**
** Of particular importance is the need to override the error routine if more sophisticated
** error handling is required. This is more than likely if greater functionality is derived
** from this base class.
*/
class RawFileClass : public FileClass
{
public:
/*
** This is a record of the access rights used to open the file. These rights are
** used if the file object is duplicated.
*/
int Rights;
RawFileClass(char const *filename);
RawFileClass(void);
RawFileClass (RawFileClass const & f);
RawFileClass & operator = (RawFileClass const & f);
virtual ~RawFileClass(void) {if (Allocated && Filename) free((char *)Filename);};
virtual char const * File_Name(void) const;
virtual char const * Set_Name(char const *filename);
virtual int Create(void);
virtual int Delete(void);
virtual int Is_Available(int forced=false);
virtual int Is_Open(void) const;
virtual int Open(char const *filename, int rights=READ);
virtual int Open(int rights=READ);
virtual long Read(void *buffer, long size);
virtual long Seek(long pos, int dir=SEEK_CUR);
virtual long Size(void);
virtual long Write(void const *buffer, long size);
virtual void Close(void);
virtual void Error(int error, int canretry = false, char const * filename=NULL);
virtual void Set_Buffer_Size(int size);
protected:
/*
** This function returns the largest size a low level DOS read or write may
** perform. Larger file transfers are performed in chunks of this size or less.
*/
long Transfer_Block_Size(void) {return (long)((unsigned)UINT_MAX)-16L;};
private:
/*
** This is the low level DOS handle. A -1 indicates an empty condition.
*/
int Handle;
/*
** This points to the filename as a NULL terminated string. It may point to either a
** constant or an allocated string as indicated by the "Allocated" flag.
*/
char const * const Filename;
/*
** Filenames that were assigned as part of the construction process
** are not allocated. It is assumed that the filename string is a
** constant in that case and thus making duplication unnecessary.
** This value will be non-zero if the filename has be allocated
** (using strdup()).
*/
unsigned Allocated:1;
};
/***********************************************************************************************
* RawFileClass::File_Name -- Returns with the filename associate with the file object. *
* *
* Use this routine to determine what filename is associated with this file object. If no *
* filename has yet been assigned, then this routing will return NULL. *
* *
* INPUT: none *
* *
* OUTPUT: Returns with a pointer to the file name associated with this file object or NULL *
* if one doesn't exist. *
* *
* WARNINGS: none *
* *
* HISTORY: *
;* 10/18/1994 JLB : Created. *
*=============================================================================================*/
inline char const * RawFileClass::File_Name(void) const
{
return Filename;
}
/***********************************************************************************************
* RawFileClass::RawFileClass -- Default constructor for a file object. *
* *
* This constructs a null file object. A null file object has no file handle or filename *
* associated with it. In order to use a file object created in this fashion it must be *
* assigned a name and then opened. *
* *
* INPUT: none *
* *
* OUTPUT: none *
* *
* WARNINGS: none *
* *
* HISTORY: *
;* 10/18/1994 JLB : Created. *
*=============================================================================================*/
inline RawFileClass::RawFileClass(void) : Filename(0)
{
Handle = -1;
Allocated = false;
}
/***********************************************************************************************
* RawFileClass::Is_Open -- Checks to see if the file is open or not. *
* *
* Use this routine to determine if the file is open. It returns true if it is. *
* *
* INPUT: none *
* *
* OUTPUT: bool; Is the file open? *
* *
* *
* WARNINGS: none *
* *
* HISTORY: *
;* 10/18/1994 JLB : Created. *
*=============================================================================================*/
inline int RawFileClass::Is_Open(void) const
{
return (Handle != -1);
}
#endif

167
WIN32LIB/INCLUDE/SHAPE.H Normal file
View File

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



214
WIN32LIB/INCLUDE/SHAPE.INC Normal file
View File

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


565
WIN32LIB/INCLUDE/SOS.H Normal file
View File

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

View File

@@ -0,0 +1,83 @@
/*
** Command & Conquer Red Alert(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/****************************************************************************
*
* File : soscomp.h
* Date Created : 6/1/94
* Description :
*
* Programmer(s) : Nick Skrepetos
* Last Modification : 10/1/94 - 11:37:9 AM
* Additional Notes : Modified by Denzil E. Long, Jr.
*
*****************************************************************************
* Copyright (c) 1994, HMI, Inc. All Rights Reserved *
****************************************************************************/
#ifndef _SOS_COMPRESS
#define _SOS_COMPRESS
/* compression types */
enum {
_ADPCM_TYPE_1,
};
/* define compression structure */
typedef struct _tagCOMPRESS_INFO {
char *lpSource;
char *lpDest;
unsigned long dwCompSize;
unsigned long dwUnCompSize;
unsigned long dwSampleIndex;
long dwPredicted;
long dwDifference;
short wCodeBuf;
short wCode;
short wStep;
short wIndex;
unsigned long dwSampleIndex2; //added BP for channel 2
long dwPredicted2; //added BP for channel 2
long dwDifference2; //added BP for channel 2
short wCodeBuf2; //added BP for channel 2
short wCode2; //added BP for channel 2
short wStep2; //added BP for channel 2
short wIndex2; //added BP for channel 2
short wBitSize;
short wChannels; //added BP for # of channels
} _SOS_COMPRESS_INFO;
/* compressed file type header */
typedef struct _tagCOMPRESS_HEADER {
unsigned long dwType; // type of compression
unsigned long dwCompressedSize; // compressed file size
unsigned long dwUnCompressedSize; // uncompressed file size
unsigned long dwSourceBitSize; // original bit size
char szName[16]; // file type, for error checking
} _SOS_COMPRESS_HEADER;
/* Prototypes */
extern "C" {
void __cdecl sosCODECInitStream(_SOS_COMPRESS_INFO *);
unsigned long __cdecl sosCODECCompressData(_SOS_COMPRESS_INFO *, unsigned long);
unsigned long __cdecl sosCODECDecompressData(_SOS_COMPRESS_INFO *, unsigned long);
unsigned long __cdecl General_sosCODECDecompressData(_SOS_COMPRESS_INFO *, unsigned long);
}
#endif

128
WIN32LIB/INCLUDE/SOSDATA.H Normal file
View File

@@ -0,0 +1,128 @@
/*
** Command & Conquer Red Alert(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/****************************************************************************
File : sosdata.h
Programmer(s) : Don Fowler, Nick Skrepetos
Date :
Purpose : Include Files For Zortech C++ Compiler
Last Updated :
****************************************************************************
Copyright(c) 1993,1994 Human Machine Interfaces
All Rights Reserved
****************************************************************************/
#ifndef _SOS_DATA
#define _SOS_DATA
#include <stddef.h>
#pragma pack(4)
extern WORD _sosDIGIData_Start;
extern WORD _sosDIGIData_End;
extern WORD _wSOSDriverLinear[];
extern WORD _wSOSTimerLinear[];
extern LPSTR _lpSOSDriver[];
extern LPSTR _lpSOSTimer[];
extern LPSTR _lpSOSDriverCS[];
extern LPSTR _lpSOSTimerCS[];
extern BOOL _wSOSDriverLoaded[];
extern BOOL _wSOSTimerLoaded[];
extern BOOL _wSOSDriverInitialized[];
extern WORD _wSOSOutputRate[];
extern WORD _wSOSDMABuffersize[];
extern LONG _dwSOSDMABufferPhysical[];
extern LPSTR _lpSOSDMABuffer[];
extern BOOL _wTimerUsed;
extern VOID ( far *_lpSOSFillHandler[] )( VOID );
extern WORD _wSOSTimerType[];
extern WORD _wSOSDriverType[];
extern _SOS_SAMPLE far * _lpSOSSampleList[][ _MAX_VOICES ];
extern LPWORD _lpSOSDMAIrqCount[];
extern LPWORD _lpSOSDMAFillCount[];
extern WORD _wSOSTmrNextCount;
extern VOID ( interrupt far *_lpSOSOldTimer )( VOID );
extern WORD _wSOSDriverID[];
extern _SOS_CAPABILITIES _sSOSDriverCaps[];
extern WORD _wSOSDMAPortList[];
extern BYTE _bSOSDMAChannel[];
extern _SOS_INIT_DRIVER _sSOSDIGIInitDriver[];
extern BYTE _pSOSDriverPath[];
extern BYTE _pSOSTempDriverPath[];
extern BOOL _wTIMERUsed;
extern WORD _wTIMERValue;
extern VOID ( far * _lpTIMEREvents[] )( VOID );
extern WORD _wTIMEREventRate[];
extern WORD _dwTIMEREventFraction[];
extern WORD _dwTIMEREventFractionCurrent[];
extern BYTE _bSOSMIDITimerSongHandler[];
extern BYTE _bSOSMIDISongHandle;
extern WORD _wSOSTimerMemHandle[];
extern WORD _wSOSDriverMemHandle[];
extern WORD _wSOSRealSeg[];
extern _FILEHEADER _sDETFileHeader;
extern _DRIVERHEADER _sDETDriverHeader;
extern _FILEHEADER sLOADFileHeader;
extern _DRIVERHEADER sLOADDriverHeader;
extern BOOL _wDETInitialized;
extern WORD _wDETLinear;
extern LPSTR _lpDETDriverBuffer;
extern LPSTR _lpDETDriverBufferCS;
extern WORD _hDETFile;
extern DWORD _dwDETDriverIndex;
extern WORD _wDETDriverIndexCur;
extern WORD _wDETMemHandle;
extern LPSOSDEVICECAPS _lpDETDeviceCaps;
extern _SOS_CAPABILITIES _sDETCaps;
extern PSTR _pSOSErrorStrings[];
extern BOOL _wSOSBufferAllocated[];
extern BOOL _wSOSSystemInitialized;
extern VDS_STRUCT _sSOSVDSInfo;
extern _SOS_FILL_INFO _sSOSFillInfo;
extern WORD _wSOSTimerEventIndex;
extern WORD _wSOSTimerEntered;
extern WORD _wSOSDriverSize[];
extern WORD _wSOSTimerSize[];
#ifdef __cplusplus
extern "C" {
#endif
extern WORD _sosDIGIData1_Start;
extern WORD _sosDIGIData1_End;
extern WORD _sosDIGIData2_Start;
extern WORD _sosDIGIData2_End;
extern BYTE _bTIMERInstalled;
extern BYTE _bTIMERDPMI;
extern WORD wDetectPort;
extern WORD wDetectIRQ;
extern WORD wDetectDMA;
extern WORD wDetectParam;
#ifdef __cplusplus
}
#endif
#pragma pack()
#endif

View File

@@ -0,0 +1,83 @@
/*
** Command & Conquer Red Alert(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/****************************************************************************
File : sosdefs.h
Programmer(s) : Don Fowler, Nick Skrepetos
Date :
Purpose : Include Files For Zortech C++ Compiler
Last Updated :
****************************************************************************
Copyright(c) 1993,1994 Human Machine Interfaces
All Rights Reserved
****************************************************************************/
#ifndef _SOSDEFS_DEFINED
#define _SOSDEFS_DEFINED
#undef _TRUE
#undef _FALSE
#undef _NULL
enum
{
_FALSE,
_TRUE
};
#define _NULL 0
#ifndef VOID
#define VOID void
#endif
typedef int BOOL;
typedef unsigned int UINT;
typedef unsigned char BYTE;
typedef unsigned WORD;
#ifndef LONG
typedef signed long LONG;
#endif
typedef unsigned long DWORD;
typedef BYTE * PBYTE;
typedef char near * PSTR;
typedef WORD * PWORD;
typedef LONG * PLONG;
typedef VOID * PVOID;
typedef BYTE far * LPBYTE;
typedef BYTE far * LPSTR;
typedef WORD far * LPWORD;
typedef LONG far * LPLONG;
typedef VOID far * LPVOID;
typedef BYTE huge * HPBYTE;
typedef BYTE huge * HPSTR;
typedef WORD huge * HPWORD;
typedef LONG huge * HPLONG;
typedef VOID huge * HPVOID;
typedef unsigned HANDLE;
#endif

219
WIN32LIB/INCLUDE/SOSFNCT.H Normal file
View File

@@ -0,0 +1,219 @@
/*
** 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
WIN32LIB/INCLUDE/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


55
WIN32LIB/INCLUDE/SOUND.H Normal file
View File

@@ -0,0 +1,55 @@
/*
** Command & Conquer Red Alert(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/***************************************************************************
** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S **
***************************************************************************
* *
* Project Name : Westwood Library *
* *
* File Name : SOUND.H *
* *
* Programmer : Joe L. Bostic *
* *
* Start Date : September 1, 1993 *
* *
* Last Update : September 1, 1993 [JLB] *
* *
*-------------------------------------------------------------------------*
* Functions: *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
#ifndef SOUND_H
#define SOUND_H
//#define HMI_DRIVER TRUE
//#include "sos.h"
#include "soscomp.h"
#include "dsound.h"
/*
** Maximum number of sound effects that may run at once.
*/
#define MAX_SFX 5
/*
** Size of temp HMI low memory staging buffer.
*/
#define SECONDARY_BUFFER_SIZE (1024*32)
#endif

292
WIN32LIB/INCLUDE/SOUNDINT.H Normal file
View File

@@ -0,0 +1,292 @@
/*
** Command & Conquer Red Alert(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/***************************************************************************
** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S **
***************************************************************************
* *
* Project Name : Westwood 32 bit Library *
* *
* File Name : SOUNDINT.H *
* *
* Programmer : Phil W. Gorrow *
* *
* Start Date : June 23, 1995 *
* *
* Last Update : June 23, 1995 [PWG] *
* *
* This file is the include file for the Westwood Sound Sytem defines and *
* routines that are handled in an interrupt.
* *
*-------------------------------------------------------------------------*
* Functions: *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
#include "sound.h"
/*
** Defines for true and false. These are included because we do not allow
** the sound int to include any of the westwood standard headers. If we
** did, there might be too much temptation to call another library function.
** this would be bad, because then that function would not be locked.
*/
#define FALSE 0
#define TRUE 1
/*
** Define the different type of sound compression avaliable to the westwood
** library.
*/
typedef enum {
SCOMP_NONE=0, // No compression -- raw data.
SCOMP_WESTWOOD=1, // Special sliding window delta compression.
SCOMP_SONARC=33, // Sonarc frame compression.
SCOMP_SOS=99 // SOS frame compression.
} SCompressType;
/*
** This is the safety overrun margin for the sonarc compressed
** data frames. This value should be equal the maximum 'order' times
** the maximum number of bytes per sample. It should be evenly divisible
** by 16 to aid paragraph alignment.
*/
#define SONARC_MARGIN 32
/*
** Define the sample control structure which helps us to handle feeding
** data to the sound interrupt.
*/
#pragma pack(1);
typedef struct {
/*
** This flags whether this sample structure is active or not.
*/
unsigned Active;
//unsigned Active:1;
/*
** This flags whether the sample is loading or has been started.
*/
//unsigned Loading:1;
unsigned Loading;
/*
** This semaphore ensures that simultaneous update of this structure won't
** occur. This is necessary since both interrupt and regular code can modify
** this structure.
*/
//unsigned DontTouch:1;
unsigned DontTouch;
/*
** If this sample is really to be considered a score rather than
** a sound effect, then special rules apply. These largely fall into
** the area of volume control.
*/
//unsigned IsScore:1;
unsigned IsScore;
/*
** This is the original sample pointer. It is used to control the sample based on
** pointer rather than handle. The handle method is necessary when more than one
** sample could be playing simultaneously. The pointer method is necessary when
** the dealing with a sample that may have stopped behind the programmer's back and
** this occurance is not otherwise determinable. It is also used in
** conjunction with original size to unlock a sample which has been DPMI
** locked.
*/
void const *Original;
long OriginalSize;
/*
** These are pointers to the double buffers.
*/
LPDIRECTSOUNDBUFFER PlayBuffer;
/*
** Variable to keep track of the playback rate of this buffer
*/
int PlaybackRate;
/*
** Variable to keep track of the sample type ( 8 or 16 bit ) of this buffer
*/
int BitSize;
/*
** Variable to keep track of the stereo ability of this buffer
*/
int Stereo;
/*
** The number of bytes in the buffer that has been filled but is not
** yet playing. This value is normally the size of the buffer,
** except for the case of the last bit of the sample.
*/
LONG DataLength;
/*
** This is the buffer index for the low buffer that
** has been filled with data but not yet being
** played.
*/
// short int Index;
/*
** Pointer into the play buffer for writing the next
** chunk of sample to
**
*/
VOID *DestPtr;
/*
** This flag indicates that there is more source data
** to copy to the play buffer
**
*/
BOOL MoreSource;
/*
** This flag indicates that the entire sample fitted inside the
** direct sound secondary buffer
**
*/
BOOL OneShot;
/*
** Pointer to the sound data that has not yet been copied
** to the playback buffers.
*/
VOID *Source;
/*
** This is the number of bytes remaining in the source data as
** pointed to by the "Source" element.
*/
LONG Remainder;
/*
** Object to use with Enter/LeaveCriticalSection
**
*/
CRITICAL_SECTION AudioCriticalSection;
/*
** Samples maintain a priority which is used to determine
** which sounds live or die when the maximum number of
** sounds are being played.
*/
int Priority;
/*
** This is the handle as returned by sosDIGIStartSample function.
*/
short int Handle;
/*
** This is the current volume of the sample as it is being played.
*/
int Volume;
int Reducer; // Amount to reduce volume per tick.
/*
** This is the compression that the sound data is using.
*/
SCompressType Compression;
short int TrailerLen; // Number of trailer bytes in buffer.
BYTE Trailer[SONARC_MARGIN]; // Maximum number of 'order' samples needed.
DWORD Pitch;
WORD Flags;
/*
** This flag indicates whether this sample needs servicing.
** Servicing entails filling one of the empty low buffers.
*/
short int Service;
/*
** This flag is TRUE when the sample has stopped playing,
** BUT there is more data available. The sample must be
** restarted upon filling the low buffer.
*/
BOOL Restart;
/*
** Streaming control handlers.
*/
BOOL (*Callback)(short int id, short int *odd, VOID **buffer, LONG *size);
VOID *QueueBuffer; // Pointer to continued sample data.
LONG QueueSize; // Size of queue buffer attached.
short int Odd; // Block number tracker (0..StreamBufferCount-1).
int FilePending; // Number of buffers already filled ahead.
long FilePendingSize; // Number of bytes in last filled buffer.
/*
** The file variables are used when streaming directly off of the
** hard drive.
*/
int FileHandle; // Streaming file handle (ERROR = not in use).
VOID *FileBuffer; // Temporary streaming buffer (allowed to be freed).
/*
** The following structure is used if the sample if compressed using
** the sos 16 bit compression Codec.
*/
_SOS_COMPRESS_INFO sosinfo;
} SampleTrackerType;
typedef struct LockedData {
unsigned int DigiHandle; // = -1;
BOOL ServiceSomething; // = FALSE;
long MagicNumber; // = 0xDEAF;
VOID *UncompBuffer; // = NULL;
long StreamBufferSize; // = (2*SECONDARY_BUFFER_SIZE)+128;
short StreamBufferCount; // = 32;
SampleTrackerType SampleTracker[MAX_SFX];
unsigned int SoundVolume;
unsigned int ScoreVolume;
BOOL _int;
} LockedDataType;
extern LockedDataType LockedData;
#pragma pack(4);
void Init_Locked_Data(void);
long Simple_Copy(void ** source, long * ssize, void ** alternate, long * altsize, void **dest, long size);
long Sample_Copy(SampleTrackerType *st, void ** source, long * ssize, void ** alternate, long * altsize, void * dest, long size, SCompressType scomp, void * trailer, short int *trailersize);
VOID far __cdecl maintenance_callback(VOID);
VOID __cdecl far DigiCallback(unsigned int driverhandle, unsigned int callsource, unsigned int sampleid);
void far HMI_TimerCallback(void);
void *Audio_Add_Long_To_Pointer(void const *ptr, long size);
void DPMI_Unlock(VOID const *ptr, long const size);
extern "C" {
void __cdecl Audio_Mem_Set(void const *ptr, unsigned char value, long size);
// void Mem_Copy(void *source, void *dest, unsigned long bytes_to_copy);
long __cdecl Decompress_Frame(void * source, void * dest, long size);
int __cdecl Decompress_Frame_Lock(void);
int __cdecl Decompress_Frame_Unlock(void);
int __cdecl sosCODEC_Lock(void);
int __cdecl sosCODEC_Unlock(void);
void __GETDS(void);
}

View File

@@ -0,0 +1,59 @@
;
; Command & Conquer Red Alert(tm)
; Copyright 2025 Electronic Arts Inc.
;
; This program is free software: you can redistribute it and/or modify
; it under the terms of the GNU General Public License as published by
; the Free Software Foundation, either version 3 of the License, or
; (at your option) any later version.
;
; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details.
;
; You should have received a copy of the GNU General Public License
; along with this program. If not, see <http://www.gnu.org/licenses/>.
;
; This is the control structure at the start of a loaded icon set. It must match
; the structure in ICONSET.C! This structure MUST be a multiple of 16 bytes long.
ifdef NO_WAY_THIS_WILL_BE_DEFINED_HAHAHAHA
STRUC IControl_Type
Width DW ? ; Width in pixels (per icon).
Height DW ? ; Height in pixels (per icon).
Count DW ? ; Number of icons in this set.
Allocated DW ? ; Was this iconset allocated?
Size DD ? ; Size of entire iconset memory block.
Icons DD ? ; Offset from buffer start to icon data.
Palettes DD ? ; Offset from buffer start to palette data.
Remaps DD ? ; Offset from buffer start to remap index data.
TransFlag DD ? ; Offset for transparency flag data.
Map DD ? ; Icon map offset.
ENDS
else
STRUC IControl_Type
Width DW ? ; Width in pixels (per icon).
Height DW ? ; Height in pixels (per icon).
Count DW ? ; Number of icons in this set.
Allocated DW ? ; Was this iconset allocated?
MapWidth DW ?
MapHeight DW ?
Size DD ? ; Size of entire iconset memory block.
Icons DD ? ; Offset from buffer start to icon data.
Palettes DD ? ; Offset from buffer start to palette data.
Remaps DD ? ; Offset from buffer start to remap index data.
TransFlag DD ? ; Offset for transparency flag data.
ColorMap DD ?
Map DD ? ; Icon map offset.
ENDS
endif
ICON256 EQU 1

View File

@@ -0,0 +1,37 @@
/*
** Command & Conquer Red Alert(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/***************************************************************************
** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S **
***************************************************************************
* *
* Project Name : WWLIB32 Examples *
* *
* File Name : STRUCTS.H *
* *
* Programmer : Scott K. Bowen *
* *
* Start Date : August 3, 1994 *
* *
* Last Update : August 3, 1994 [SKB] *
* *
*-------------------------------------------------------------------------*
* Functions: *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

View File

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

94
WIN32LIB/INCLUDE/TILE.H Normal file
View File

@@ -0,0 +1,94 @@
/*
** Command & Conquer Red Alert(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/***************************************************************************
** C O N F I D E N T I A L --- W E S T W O O D A S S O C I A T E S **
***************************************************************************
* *
* Project Name : Part of the TILE Library *
* *
* File Name : TILE.H *
* *
* Programmer : Barry W. Green *
* *
* Start Date : February 2, 1995 *
* *
* Last Update : February 2, 1995 [BWG] *
* *
*-------------------------------------------------------------------------*
* Functions: *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
#ifndef TILE_H
#define TILE_H
/*=========================================================================*/
/* The following prototypes are for the file: ICONSET.CPP */
/*=========================================================================*/
void * Load_Icon_Set(char const *filename, void *iconsetptr, long buffsize);
void Free_Icon_Set(void const *iconset);
long Get_Icon_Set_Size(void const *iconset);
int Get_Icon_Set_Width(void const *iconset);
int Get_Icon_Set_Height(void const *iconset);
void * Get_Icon_Set_Icondata(void const *iconset);
void * Get_Icon_Set_Trans(void const *iconset);
void * Get_Icon_Set_Remapdata(void const *iconset);
void * Get_Icon_Set_Palettedata(void const *iconset);
int Get_Icon_Set_Count(void const *iconset);
void * Get_Icon_Set_Map(void const *iconset);
#if (0)
/*
** This is the control structure at the start of a loaded icon set. It must match
** the structure in WWLIB.I! This structure MUST be a multiple of 16 bytes long.
*/
typedef struct {
short Width; // Width of icons (pixels).
short Height; // Height of icons (pixels).
short Count; // Number of (logical) icons in this set.
// BOOL Allocated; // Was this iconset allocated?
short Allocated; // Was this iconset allocated?
long Size; // Size of entire iconset memory block.
unsigned char *Icons; // Offset from buffer start to icon data.
long Palettes; // Offset from buffer start to palette data.
long Remaps; // Offset from buffer start to remap index data.
long TransFlag; // Offset for transparency flag table.
unsigned char *Map; // Icon map offset (if present).
} IControl_Type;
#endif //(0)
typedef struct {
short Width; // Width of icons (pixels).
short Height; // Height of icons (pixels).
short Count; // Number of (logical) icons in this set.
short Allocated; // Was this iconset allocated?
short MapWidth; // Width of map (in icons).
short MapHeight; // Height of map (in icons).
long Size; // Size of entire iconset memory block.
long Icons; // Offset from buffer start to icon data.
// unsigned char * Icons; // Offset from buffer start to icon data.
long Palettes; // Offset from buffer start to palette data.
long Remaps; // Offset from buffer start to remap index data.
long TransFlag; // Offset for transparency flag table.
long ColorMap; // Offset for color control value table.
long Map; // Icon map offset (if present).
// unsigned char * Map; // Icon map offset (if present).
} IControl_Type;
#endif //TILE_H

201
WIN32LIB/INCLUDE/TIMER.H Normal file
View File

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

219
WIN32LIB/INCLUDE/VIDEO.H Normal file
View File

@@ -0,0 +1,219 @@
/*
** Command & Conquer Red Alert(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/***************************************************************************
** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S **
***************************************************************************
* *
* Project Name : 32 bit library *
* *
* File Name : VIDEO.H *
* *
* Programmer : Scott K. Bowen *
* *
* Start Date : August 3, 1994 *
* *
* Last Update : August 3, 1994 [SKB] *
* *
*-------------------------------------------------------------------------*
* Functions: *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
#ifndef VIDEO_H
#define VIDEO_H
#ifndef WWSTD_H
#include "wwstd.h"
#endif
/*=========================================================================*/
/* The machine can be in one of the following graphic modes. The global */
/* GraphicMode is set to one of these values. */
/*=========================================================================*/
#define CGA_MODE 4 // DOS 320x200 4 color mode
#define TGA_MODE 9 // TANDY 320x200 16 color mode
#define EGA_MODE 13 // DOS 320x200 16 color mode
#define MCGA_MODE 0x13 // DOS 320x200 256 color mode
#define VGA_MODE 0x13 // DOS 320x200 256 color mode
#define EEGA_MODE 14 // DOS 640x400 16 color mode
#define ETGA_MODE 9 // TANDY 640x400 16 color mode
#define HGA_MODE 7 // DOS 768x400 2 color mode
#define TXT_MODE 3 // DOS plain old color text mode
#define VESA_640X400_256 0x100 // VESA 640x400 256 color mode
#define VESA_640X480_256 0x101 // VESA 640x480 256 color mode
#define VESA_800X600_256 0x103 // VESA 800x600 256 color mode
#define VESA_1024X768_256 0x105 // VESA 1024x768 256 color mode
#define VESA_1280X400_256 0x107 // VESA 1280x400 256 color mode
#define VESA_TEXT_80X60 0x108 // VESA 80x60 text mode
#define VESA_TEXT_132X25 0x109 // VESA 132x25 text mode
#define VESA_TEXT_132X60 0x10C // VESA 132x60 text mode
#define RESET_MODE -1
#define UNINITIALIZED_MODE -1
#define VESA_MIN VESA_640X400_256
#define VESA_MAX VESA_TEXT_132X60
/*=========================================================================*/
/* Define the maximum number of bank entries */
/*=========================================================================*/
#define MAX_BANK_ENTRIES ((1280L*1024L)/65536L)
/*=========================================================================*
* VesaInfoType - General info about this VESA implementation *
* (Filled in by VESA BIOS Function 0) *
* *
* Signature - Will always be 'VESA' *
* Version - Version # *
* OEMString - OEM ID string *
* Capabilities - Not defined by VESA yet *
* AvailModes - List of available modes; terminated with -1 (0xffff) *
* TotalMemory - ??? *
* Reserved - Pads structure to 256 bytes total *
*=========================================================================*/
#ifdef NOT_FOR_WIN95
typedef struct {
char Signature[4];
short Version;
REALPTR OEMString;
long Capabilities;
REALPTR AvailModes;
short TotalMemory;
char Reserved[236];
} VesaInfoType;
#endif //NOT_FOR_WIN95
/*=========================================================================*
* VesaModeInfoType - Info about this VESA mode *
* (Filled in by VESA BIOS Function 1) *
* *
* Attributes - bit 0: 1 = mode is supported *
* bit 1: 1 = optional info available *
* bit 2: 1 = std BIOS output funcs valid in this mode *
* bit 3: 0 = monochrome, 1 = color *
* bit 4: 0 = text mode, 1 = graphics *
* WinA_Attributes - bit 0 = win exists, bit 1=readable, bit 2= writable *
* WinB_Attributes - bit 0 = win exists, bit 1=readable, bit 2= writable *
* WinGranularity - smallest address boundary window can be placed upon; *
* size is in KB (ie 64, 32, 4) *
* WinSize - size of windows in KB (ie 64, 32) *
* WinA_Segment - location of Window A in CPU space (usually 0xa000) *
* WinB_Segment - location of Window B in CPU space (usually 0xb000) *
* WinFunc - address of window-setting function (This is provided *
* as an alternative to Int 10 for speed.) *
* BytesPerScanline - # bytes per scan line *
* *
* Optional info (available if bit 1 of Attributes is set): *
* *
* XRes - X-resolution *
* YRes - Y-resolution *
* XCharSize - Horizontal size of char cell *
* YCharSize - Vertical size of char cell *
* NumPlanes - # of memory planes (???) *
* BitsPerPixel - # bites per pixel *
* NumBanks - # of banks (ie planes) *
* MemoryModel - 00h = Text mode *
* 01h = CGA mode *
* 02h = Hercules *
* 03h = 4 plane planar mode *
* 04h = packed pixel mode (1 byte/pixel) *
* 05h = non-chain 4, 256-color mode *
* 06-0Fh = *
* 10-FFh = OEM-specific *
* BankSize - Bank size in KB *
*=========================================================================*/
#ifdef NOT_FOR_WIN95
typedef struct {
short Attributes;
char WinA_Attributes;
char WinB_Attributes;
short WinGranularity;
short WinSize;
short WinA_Segment;
short WinB_Segment;
REALPTR WinFunc;
short BytesPerScanline;
short XRes;
short YRes;
char XCharSize;
char YCharSize;
char NumPlanes;
char BitsPerPixel;
char NumBanks;
char MemoryModel;
char BankSize;
char NumInputPages;
char Reserved;
char RedMaskSize;
char RedFieldPosition;
char GreenMaskSize;
char GreenFieldPosition;
char BlueMaskSize;
char BlueFieldPosition;
char RsvdMaskSize;
char RsvdFieldPosition;
char DirectColorModeInfo;
char pad[216];
} VesaModeInfoType;
extern REALPTR VesaFunc;
#endif //NOT_FOR_WIN95
extern "C" {
extern int GraphicMode;
extern long XRes;
extern long YRes;
extern long BankTable [];
extern unsigned long RMVesaVector ;
extern unsigned long RMVesaRegs ;
}
/*=========================================================================*/
/* The following prototypes are for the file: VIDEO.CPP */
/*=========================================================================*/
extern "C" int Set_Video_Mode(int mode);
int Get_Video_Mode(void);
void Update_Video_Mode (void) ;
void Vesa_Info(void);
void Vesa_Set_Window(long grain_num);
int Get_Original_Video_Mode(void);
void Set_Original_Video_Mode(int mode);
/*=========================================================================*/
/* The following prototypes are for the file: INITDLAY.CPP */
/*=========================================================================*/
extern VOID Init_Delay(VOID);
extern BOOL VertBlank;
/*=========================================================================*/
/* The following prototypes are for the file: VERTBLNK.ASM */
/*=========================================================================*/
extern "C" {
extern WORD Get_Vert_Blank(VOID);
extern VOID Wait_Vert_Blank(BOOL blank);
}
/*=========================================================================*/
#endif // VIDEO_H

457
WIN32LIB/INCLUDE/WINCOMM.H Normal file
View File

@@ -0,0 +1,457 @@
/*
** Command & Conquer Red Alert(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/***********************************************************************************************
*** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
***********************************************************************************************
* *
* Project Name : Command & Conquer/ WW Library *
* *
* File Name : WINCOMM.H *
* *
* Programmer : Steve Tall *
* *
* Start Date : 1/10/96 *
* *
* Last Update : January 10th 1996 [ST] *
* *
*---------------------------------------------------------------------------------------------*
* Overview: *
* *
* These classes was created to replace the greenleaf comms functions used in C&C DOS with *
* WIN32 API calls. *
* *
*---------------------------------------------------------------------------------------------*
* *
* Functions: *
* *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
#ifndef WIN32
#define WIN32
#define _WIN32
#endif //WIN32
#include <windows.h>
typedef enum WinCommDialMethodType {
WC_TOUCH_TONE = 0,
WC_PULSE
} WinCommDialMethodType;
#define COMMSUCCESS 0
#define ASTIMEOUT -10
#define COMMUSERABORT -16
/*
** The size of our serial buffer within the class.
**
** !!!!!! THIS MUST BE A POWER OF 2 !!!!!!
**
*/
#define SIZE_OF_WINDOWS_SERIAL_BUFFER 2048
/*
** WinModemClass.
**
** This class provides access to modems under Win95. The functions are designed to be more or less
** drop in replacements for the Grenleaf comms functions.
*/
class WinModemClass
{
public:
WinModemClass (void); //WinModemClass Contructor
virtual ~WinModemClass (void); //WinModemClass Destructor
/*
** Serial port open should be called to get a handle to the COM port
** This needs to be called first as other class members rely on the handle
**
** Replacement for Greenleaf function: PortOpenGreenleafFast
*/
//virtual HANDLE Serial_Port_Open (int port, int baud, int parity, int wordlen, int stopbits);
virtual HANDLE Serial_Port_Open (char *device_name, int baud, int parity, int wordlen, int stopbits, int flowcontrol);
/*
** This function releases the COM port handle and should be called after
** communications have finished
**
** Replacement for Greenleaf function: PortClose
*/
void Serial_Port_Close (void);
/*
** This member copies any bytes from the internal class serial buffer
** into your user buffer.
**
** Replacement for Greenleaf function: ReadBuffer
*/
int Read_From_Serial_Port (unsigned char *dest_ptr, int buffer_len);
/*
** Write chars to the serial port
**
** Replacement for Greenleaf function: WriteBuffer
*/
void Write_To_Serial_Port (unsigned char *buffer, int length);
/*
** Wait for the outgoing buffer to empty
*/
void Wait_For_Serial_Write (void);
/*
** Set the dial type to DIAL_TOUCH_TONE or DIAL_PULSE
**
** Replacement for Greenleaf function: HMSetDiallingMethod
*/
virtual void Set_Modem_Dial_Type (WinCommDialMethodType method);
/*
** Get the status of the modem control lines
** Possible flags are: CTS_SET DSR_SET RI_SET & CD_SET
**
** Replacement for Greenleaf function: GetModemStatus
*/
virtual unsigned Get_Modem_Status (void);
/*
** Set the DTR line to the given state
**
** Replacement for Greenleaf function: SetDtr
*/
virtual void Set_Serial_DTR (BOOL state);
/*
** Get the result code from the modem after issuing an 'AT' command
**
** Replacement for Greenleaf function: HMInputLine
*/
virtual int Get_Modem_Result (int delay, char *buffer, int buffer_len);
/*
** Issue a dial command to the modem.
** Use Set_Modem_Dial_Type to select pulse or tone dial
**
** Replacement for Greenleaf function: HMDial
*/
virtual void Dial_Modem (char *dial_number);
/*
** Send a command to the modem. This is usually an 'AT' command.
** Function will optionally retry until 'OK' is received.
*/
virtual int Send_Command_To_Modem (char *command, char terminator, char *buffer, int buflen, int delay, int retries);
/*
** Sets a pointer to a function that will be called for each incoming serial char
**
** Replacement for Greenleaf function: HMSetUpEchoRoutine
*/
virtual void Set_Echo_Function (void(*func)(char c));
/*
** Sets a pointer to a function that will be called if ESC is pressed during a dial
**
** Replacement for Greenleaf function: HMSetUpAbortKey
*/
virtual void Set_Abort_Function (int (*func)(void));
/*
** Member to allow access to the serial port handle
*/
HANDLE Get_Port_Handle(void);
/*
** Status vars for debugging purposes
*/
int FramingErrors;
int IOErrors;
int BufferOverruns;
int InBufferOverflows;
int ParityErrors;
int OutBufferOverflows;
int InQueue;
int OutQueue;
/*
** Modem send result codes
*/
enum SendModemEnum {
MODEM_CMD_TIMEOUT = 0,
MODEM_CMD_OK,
MODEM_CMD_0,
MODEM_CMD_ERROR
};
/*
** Enums for modem status flags
*/
enum {
CTS_SET = 0x10,
DSR_SET = 0x20,
RI_SET = 0x40,
CD_SET = 0x80
};
protected:
/*
** Copy incoming data from the windows file buffer into the internal class buffer
*/
BOOL Read_Serial_Chars(void);
/*
** Pointer to the internal class circular buffer for incoming data
*/
unsigned char *SerialBuffer;
/*
** Overlap object for asyncronous reads from the serial port
*/
OVERLAPPED ReadOverlap;
/*
** Overlap object for asyncronous writes to the serial port
*/
OVERLAPPED WriteOverlap;
/*
** Flag that there is no outstanding incoming data in the windows buffer
*/
BOOL WaitingForSerialCharRead;
/*
** Flag that we are waiting for the last write to port operation to complete
*/
BOOL WaitingForSerialCharWrite;
/*
** Head and Tail pointers for our internal serial buffer
*/
int SerialBufferReadPtr;
int SerialBufferWritePtr;
/*
** Windows handle to the COM port device
*/
HANDLE PortHandle;
/*
** Dialing method - DIAL_TOUCH_TONE or DIAL_PULSE
*/
WinCommDialMethodType DialingMethod;
/*
** Pointer to function for echoing incoming data - can be NULL
*/
void (*EchoFunction)(char c);
/*
** Pointer to function for aborting when ESC pressed - can be NULL
*/
int (*AbortFunction)(void);
/*
** Serial buffer for asyncronous reads
*/
char TempSerialBuffer[SIZE_OF_WINDOWS_SERIAL_BUFFER];
};
/*
** WinNullModemClass.
**
** This class provides access to serial ports under Win95. The functions are designed to be more or less
** drop in replacements for the Grenleaf comms functions.
**
** This class just overloads the WinModemClass members that arent required for direct serial communications
** via a 'null modem' cable.
*/
class WinNullModemClass : public WinModemClass
{
public:
virtual inline void Set_Modem_Dial_Type (int){};
virtual inline unsigned Get_Modem_Status (void){return (0);};
virtual inline void Set_Serial_DTR (BOOL){};
virtual inline int Get_Modem_Result (int, char*, int){return(0);};
virtual inline void Dial_Modem (char*){};
virtual inline int Send_Command_To_Modem (char*, char, char*, int, int, int){return (0);};
virtual inline void Set_Echo_Function (void(*)(char)){};
virtual inline void Set_Abort_Function (int(*)(void)){};
};
extern WinModemClass *SerialPort;
//
//
// This bit swiped from the SDK because its not in the Watcom headers yet
//
//
/************************************************************************
* *
* mcx.h -- This module defines the 32-Bit Windows MCX APIs *
* *
* Copyright (c) 1990-1995, Microsoft Corp. All rights reserved. *
* *
************************************************************************/
#ifndef _MCX_H_
#define _MCX_H_
typedef struct _MODEMDEVCAPS {
DWORD dwActualSize;
DWORD dwRequiredSize;
DWORD dwDevSpecificOffset;
DWORD dwDevSpecificSize;
// product and version identification
DWORD dwModemProviderVersion;
DWORD dwModemManufacturerOffset;
DWORD dwModemManufacturerSize;
DWORD dwModemModelOffset;
DWORD dwModemModelSize;
DWORD dwModemVersionOffset;
DWORD dwModemVersionSize;
// local option capabilities
DWORD dwDialOptions; // bitmap of supported values
DWORD dwCallSetupFailTimer; // maximum in seconds
DWORD dwInactivityTimeout; // maximum in seconds
DWORD dwSpeakerVolume; // bitmap of supported values
DWORD dwSpeakerMode; // bitmap of supported values
DWORD dwModemOptions; // bitmap of supported values
DWORD dwMaxDTERate; // maximum value in bit/s
DWORD dwMaxDCERate; // maximum value in bit/s
// Variable portion for proprietary expansion
BYTE abVariablePortion [1];
} MODEMDEVCAPS, *PMODEMDEVCAPS, *LPMODEMDEVCAPS;
typedef struct _MODEMSETTINGS {
DWORD dwActualSize;
DWORD dwRequiredSize;
DWORD dwDevSpecificOffset;
DWORD dwDevSpecificSize;
// static local options (read/write)
DWORD dwCallSetupFailTimer; // seconds
DWORD dwInactivityTimeout; // seconds
DWORD dwSpeakerVolume; // level
DWORD dwSpeakerMode; // mode
DWORD dwPreferredModemOptions; // bitmap
// negotiated options (read only) for current or last call
DWORD dwNegotiatedModemOptions; // bitmap
DWORD dwNegotiatedDCERate; // bit/s
// Variable portion for proprietary expansion
BYTE abVariablePortion [1];
} MODEMSETTINGS, *PMODEMSETTINGS, *LPMODEMSETTINGS;
// Dial Options
#define DIALOPTION_BILLING 0x00000040 // Supports wait for bong "$"
#define DIALOPTION_QUIET 0x00000080 // Supports wait for quiet "@"
#define DIALOPTION_DIALTONE 0x00000100 // Supports wait for dial tone "W"
// SpeakerVolume for MODEMDEVCAPS
#define MDMVOLFLAG_LOW 0x00000001
#define MDMVOLFLAG_MEDIUM 0x00000002
#define MDMVOLFLAG_HIGH 0x00000004
// SpeakerVolume for MODEMSETTINGS
#define MDMVOL_LOW 0x00000000
#define MDMVOL_MEDIUM 0x00000001
#define MDMVOL_HIGH 0x00000002
// SpeakerMode for MODEMDEVCAPS
#define MDMSPKRFLAG_OFF 0x00000001
#define MDMSPKRFLAG_DIAL 0x00000002
#define MDMSPKRFLAG_ON 0x00000004
#define MDMSPKRFLAG_CALLSETUP 0x00000008
// SpeakerMode for MODEMSETTINGS
#define MDMSPKR_OFF 0x00000000
#define MDMSPKR_DIAL 0x00000001
#define MDMSPKR_ON 0x00000002
#define MDMSPKR_CALLSETUP 0x00000003
// Modem Options
#define MDM_COMPRESSION 0x00000001
#define MDM_ERROR_CONTROL 0x00000002
#define MDM_FORCED_EC 0x00000004
#define MDM_CELLULAR 0x00000008
#define MDM_FLOWCONTROL_HARD 0x00000010
#define MDM_FLOWCONTROL_SOFT 0x00000020
#define MDM_CCITT_OVERRIDE 0x00000040
#define MDM_SPEED_ADJUST 0x00000080
#define MDM_TONE_DIAL 0x00000100
#define MDM_BLIND_DIAL 0x00000200
#define MDM_V23_OVERRIDE 0x00000400
#endif /* _MCX_H_ */

163
WIN32LIB/INCLUDE/WSA.H 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 A S S O C I A T E S **
***************************************************************************
* *
* Project Name : WSA 32bit LIbrary *
* *
* File Name : WSA.H *
* *
* Programmer : Scott K. Bowen *
* *
* Start Date : May 23, 1994 *
* *
* Last Update : May 25, 1994 [SKB] *
* *
*-------------------------------------------------------------------------*
* Functions: *
* Open_Animation -- file name and flags, system allocates buffer. *
* Open_Animation -- file name, flags, palette, system allocates buffer. *
* Open_Animation -- file_name, graphic buffer, flags. *
* Open_Animation -- file name, bufferclass, flags, palette. *
* Open_Animation -- filename, ptr, size, flags, no palette. *
* Animate_Frame -- Animate a frame to a page with magic colors. *
* Animate_Frame -- Animate a frame to a viewport with magic colors. *
* Animate_Frame -- Animate a frame to a page. *
* Animate_Frame -- Animate a frame to a viewport. *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
#ifndef WSA_H
#define WSA_H
#ifndef WWSTD_H
#include "wwstd.h"
#endif
#ifndef GBUFFER_H
#include "gbuffer.h"
#endif
//lint -strong(AJX,WSAType)
typedef enum {
WSA_NORMAL, // Normal WSA animation
WSA_GHOST = 0x1000, // Or'd with the above flags to get ghosting
WSA_PRIORITY2 = 0x2000, // Copy using a priority (or in the priority)
WSA_TRANS = 0x4000, // Copy frame, ignoring transparent colors
WSA_PRIORITY = 0x8000 // Copy using a priority (or in the priority)
} WSAType;
//lint -strong(AJX,WSAOpenType)
typedef enum {
WSA_OPEN_FROM_MEM = 0x0000, // Try to load entire anim into memory.
WSA_OPEN_INDIRECT = 0x0000, // First animate to internal buffer, then copy to page/viewport.
WSA_OPEN_FROM_DISK = 0x0001, // Force the animation to be disk based.
WSA_OPEN_DIRECT = 0x0002, // Animate directly to page or viewport.
// These next two have been added for the 32 bit library to give a better idea of what is
// happening. You may want to animate directly to the destination or indirectly to the
// destination by using the animations buffer. Indirecly is best if the dest is a seenpage
// and the animation is not linear or if the destination is modified between frames.
WSA_OPEN_TO_PAGE = WSA_OPEN_DIRECT ,
WSA_OPEN_TO_BUFFER= WSA_OPEN_INDIRECT ,
} WSAOpenType;
/*=========================================================================*/
/* The following prototypes are for the file: WSA.CPP */
/*=========================================================================*/
void * __cdecl Open_Animation(char const *file_name, char *user_buffer, long user_buffer_size, WSAOpenType user_flags, unsigned char *palette=NULL);
void __cdecl Close_Animation( void *handle );
BOOL __cdecl Animate_Frame(void *handle, GraphicViewPortClass& view,
int frame_number, int x_pixel=0, int y_pixel=0,
WSAType flags_and_prio = WSA_NORMAL, void *magic_cols=NULL, void *magic=NULL);
int __cdecl Get_Animation_Frame_Count(void *handle);
BOOL __cdecl Animate_Frame(void *handle, VideoViewPortClass& view,
int frame_number, int x_pixel=0, int y_pixel=0,
WSAType flags_and_prio = WSA_NORMAL, void *magic_cols=NULL, void *magic=NULL);
int __cdecl Get_Animation_Frame_Count(void *handle);
int __cdecl Get_Animation_X(void const *handle);
int __cdecl Get_Animation_Y(void const *handle);
int __cdecl Get_Animation_Width(void const *handle);
int __cdecl Get_Animation_Height(void const *handle);
int __cdecl Get_Animation_Palette(void const *handle);
unsigned long __cdecl Get_Animation_Size(void const *handle);
/***************************************************************************
* OPEN_ANIMATION -- file name, flags, palette, system allocates buffer. *
* *
* *
* INPUT: char *file_name - name of file to open. *
* WSAOpenType user_flags - flags on how to open. *
* unsigned char *palette - pointer to a palette buffer to fill. *
* *
* OUTPUT: void *pointer to animation data. Must be used for all *
* other WSA calls. *
* *
* WARNINGS: *
* *
* HISTORY: *
* 05/24/1994 SKB : Created. *
*=========================================================================*/
inline void * __cdecl Open_Animation(char *file_name, WSAOpenType user_flags, unsigned char *palette=NULL)
{
return (Open_Animation(file_name, NULL, 0L, user_flags, palette));
}
/***************************************************************************
* OPEN_ANIMATION -- file_name, bufferclass, flags. *
* *
* *
* INPUT: char *file_name - name of file to open. *
* GraphicBufferClass - pointer to a buffer. *
* WSAOpenType user_flags - flags on how to open. *
* unsigned char *palette - pointer to a palette buffer to fill. *
* *
* OUTPUT: void *pointer to animation data. Must be used for all *
* other WSA calls. *
* *
* WARNINGS: *
* *
* HISTORY: *
* 05/24/1994 SKB : Created. *
*=========================================================================*/
inline void * __cdecl Open_Animation(char *file_name, BufferClass& buffer, WSAOpenType user_flags, unsigned char *palette=NULL)
{
return (Open_Animation(file_name, (char *)buffer.Get_Buffer(), buffer.Get_Size(), user_flags, palette));
}
/*=========================================================================*/
/* The following prototypes are for the file: LP_ASM.ASM */
/*=========================================================================*/
extern "C" {
unsigned int __cdecl Apply_XOR_Delta(char *source_ptr, char *delta_ptr);
void __cdecl Apply_XOR_Delta_To_Page_Or_Viewport(void *target, void *delta, int width, int nextrow, int copy);
}
#endif // WSA_H

71
WIN32LIB/INCLUDE/WWFILE.H Normal file
View File

@@ -0,0 +1,71 @@
/*
** Command & Conquer Red Alert(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/* $Header: F:\projects\c&c\vcs\code\wwfile.h_v 2.14 06 Sep 1995 16:30:00 JOE_BOSTIC $ */
/***********************************************************************************************
*** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
***********************************************************************************************
* *
* Project Name : Westwood Library *
* *
* File Name : WWFILE.H *
* *
* Programmer : Joe L. Bostic *
* *
* Start Date : August 8, 1994 *
* *
* Last Update : August 8, 1994 [JLB] *
* *
*---------------------------------------------------------------------------------------------*
* Functions: *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
#ifndef WWFILE_H
#define WWFILE_H
#include <stdio.h>
#ifndef READ
#define READ _READ
#endif
#ifndef WRITE
#define WRITE _WRITE
#endif
class FileClass
{
public:
virtual ~FileClass(void) {};
virtual char const * File_Name(void) const = 0;
virtual char const * Set_Name(char const *filename) = 0;
virtual int Create(void) = 0;
virtual int Delete(void) = 0;
virtual int Is_Available(int forced=false) = 0;
virtual int Is_Open(void) const = 0;
virtual int Open(char const *filename, int rights=READ) = 0;
virtual int Open(int rights=READ) = 0;
virtual long Read(void *buffer, long size) = 0;
virtual long Seek(long pos, int dir=SEEK_CUR) = 0;
virtual long Size(void) = 0;
virtual long Write(void const *buffer, long size) = 0;
virtual void Close(void) = 0;
operator char const * () {return File_Name();};
};
#endif

View File

@@ -0,0 +1,68 @@
/*
** Command & Conquer Red Alert(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/***************************************************************************
** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S **
***************************************************************************
* *
* Project Name : WWLIB32 User include file *
* *
* File Name : WWLIB32.H *
* *
* Programmer : Scott K. Bowen *
* *
* Start Date : August 3, 1994 *
* *
* Last Update : August 3, 1994 [SKB] *
* *
*-------------------------------------------------------------------------*
* Functions: *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
#ifndef WWLIB32_H
#define WWLIB32_H
#include <gbuffer.h>
#include <wwstd.h>
#include <drawbuff.h>
#include <buffer.h>
#include <font.h>
#include <iff.h>
#include <misc.h>
#include <mono.h>
#include <tile.h>
#include <wwmem.h>
#include <keyboard.h>
#include <mouse.h>
#include <file.h>
#include <rawfile.h>
#include <audio.h>
#include <dipthong.h>
#include <palette.h>
#include <playcd.h>
#include <shape.h>
#include <timer.h>
#include <ww_win.h>
#include <wsa.h>
#include <profile.h>
#endif // WWLIB32_H


70
WIN32LIB/INCLUDE/WWMEM.H Normal file
View File

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


View File

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

338
WIN32LIB/INCLUDE/WWSTD.H Normal file
View File

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

96
WIN32LIB/INCLUDE/WW_WIN.H Normal file
View File

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


183
WIN32LIB/INCLUDE/_FILE.H Normal file
View File

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