CnC_Remastered_Collection

Command and Conquer: Red Alert
Log | Files | Refs | README | LICENSE

SOS.H (15482B)


      1 //
      2 // Copyright 2020 Electronic Arts Inc.
      3 //
      4 // TiberianDawn.DLL and RedAlert.dll and corresponding source code is free 
      5 // software: you can redistribute it and/or modify it under the terms of 
      6 // the GNU General Public License as published by the Free Software Foundation, 
      7 // either version 3 of the License, or (at your option) any later version.
      8 
      9 // TiberianDawn.DLL and RedAlert.dll and corresponding source code is distributed 
     10 // in the hope that it will be useful, but with permitted additional restrictions 
     11 // under Section 7 of the GPL. See the GNU General Public License in LICENSE.TXT 
     12 // distributed with this program. You should have received a copy of the 
     13 // GNU General Public License along with permitted additional restrictions 
     14 // with this program. If not, see https://github.com/electronicarts/CnC_Remastered_Collection
     15 
     16 /****************************************************************************
     17 
     18    File              : sos.h
     19 
     20    Programmer(s)     : Don Fowler, Nick Skrepetos
     21    Date              :
     22 
     23    Purpose           : Include Files For Zortech C++ Compiler
     24 
     25    Last Updated      :
     26 
     27 ****************************************************************************
     28                Copyright(c) 1993,1994 Human Machine Interfaces
     29                             All Rights Reserved
     30 ****************************************************************************/
     31 
     32 #ifndef  _SOS_DEFINED
     33 #define  _SOS_DEFINED
     34 #include "sosdefs.h"
     35 
     36 #pragma pack(4)
     37 
     38 // error definition for sound operating system
     39 #define  _SOS_ERR          -1
     40 
     41 // number of drivers allowed to be open at one time
     42 #define  _SOS_MAX_DRIVERS  5
     43 
     44 // structure definition for the capabilities
     45 typedef struct _tagCAPABILITIES
     46 {
     47    BYTE  szDeviceName[ 32 ];  // device name
     48    WORD  wDeviceVersion;      // device version
     49    WORD  wBitsPerSample;      // bits per sound sample
     50    WORD  wChannels;           // stereo/mono sound card
     51    WORD  wMinRate;            // minimum rate
     52    WORD  wMaxRate;            // maximum rate
     53    WORD  wMixerOnBoard;       // board contains mixer
     54    WORD  wMixerFlags;         // mixer capabilities
     55    WORD  wFlags;              // miscellaneous flags
     56    short far * lpPortList;         // list of usable ports
     57    short far * lpDMAList;          // list of usable dma channels
     58    short far * lpIRQList;          // list of usable irq channels
     59    short far * lpRateList;         // list of usable rates, -1 if any in min to max
     60    WORD  fBackground;         // foreground or background driver
     61    WORD  wDeviceID;           // ID for the device
     62    WORD  wTimerID;            // ID for the timer
     63 
     64 } _SOS_CAPABILITIES;
     65 
     66 // far pointer to the device capabilities structure
     67 typedef _SOS_CAPABILITIES far *  LPSOSDEVICECAPS;
     68 
     69 // flag types for driver
     70 #define  _FLAGS_SIGNED              0x8000
     71 
     72 // devices that can be loaded
     73 #define  _SOUND_BLASTER_8_MONO      0xe000
     74 #define  _SOUND_BLASTER_8_ST        0xe001
     75 #define  _SBPRO_8_ST                _SOUND_BLASTER_8_ST
     76 #define  _SBPRO_8_MONO              0xe00f
     77 #define  _SOUND_MASTER_II_8_MONO    0xe002
     78 #define  _MV_PAS_8_MONO             0xe003
     79 #define  _MV_PAS_16_MONO            0xe004
     80 #define  _MV_PAS_8_ST               0xe005
     81 #define  _MV_PAS_16_ST              0xe006
     82 #define  _ADLIB_GOLD_8_ST           0xe007
     83 #define  _ADLIB_GOLD_16_ST          0xe008
     84 #define  _ADLIB_GOLD_8_MONO         0xe009
     85 #define  _ADLIB_GOLD_16_MONO        0xe00a
     86 #define  _MICROSOFT_8_MONO          0xe00b
     87 #define  _MICROSOFT_8_ST            0xe00c
     88 #define  _MICROSOFT_16_MONO         0xe00d
     89 #define  _MICROSOFT_16_ST           0xe00e
     90 #define  _SOUND_SOURCE_8_MONO_PC    0xe010
     91 #define  _SOUND_SOURCE_8_MONO_TANDY 0xe011
     92 #define  _GENERAL_PORT_8_MONO       0xe012
     93 #define  _GENERAL_PORT_8_MONO_R     0xe013
     94 #define  _SIERRA_8_MONO             0xe014
     95 #define  _SB16_8_MONO               0xe015
     96 #define  _SB16_8_ST                 0xe016
     97 #define  _SB16_16_MONO              0xe017
     98 #define  _SB16_16_ST                0xe018
     99 #define  _ESS_AUDIODRIVE_8_MONO     0xe019
    100 #define  _ESS_AUDIODRIVE_8_ST       0xe01a
    101 #define  _ESS_AUDIODRIVE_16_MONO    0xe01b
    102 #define  _ESS_AUDIODRIVE_16_ST      0xe01c
    103 #define  _SOUNDSCAPE_8_MONO         0xe01d
    104 #define  _SOUNDSCAPE_8_ST           0xe01e
    105 #define  _SOUNDSCAPE_16_MONO        0xe01f
    106 #define  _SOUNDSCAPE_16_ST          0xe020
    107 #define  _RAP10_8_MONO              0xe021
    108 #define  _RAP10_16_MONO             0xe022
    109 #define  _GUS_8_MONO                0xe023
    110 #define  _GUS_8_ST                  0xe024
    111 #define  _GUS_16_MONO               0xe025
    112 #define  _GUS_16_ST                 0xe026
    113 #define  _GUS_MAX_8_MONO            0xe027
    114 #define  _GUS_MAX_8_ST              0xe028
    115 #define  _GUS_MAX_16_MONO           0xe029
    116 #define  _GUS_MAX_16_ST             0xe02a
    117 #define  _WAVEJAMMER_8_MONO         0xe02b
    118 #define  _WAVEJAMMER_8_ST           0xe02c
    119 #define  _WAVEJAMMER_16_MONO        0xe02d
    120 #define  _WAVEJAMMER_16_ST          0xe02e
    121 #define  _TEMPOCS_8_MONO            0xe02f
    122 #define  _TEMPOCS_8_ST              0xe030
    123 #define  _TEMPOCS_16_MONO           0xe031
    124 #define  _TEMPOCS_16_ST             0xe032
    125 #define  _WAVEJAMMERCD_8_MONO       0xe033
    126 #define  _WAVEJAMMERCD_8_ST         0xe034
    127 #define  _WAVEJAMMERCD_16_MONO      0xe035
    128 #define  _WAVEJAMMERCD_16_ST        0xe036
    129 #define  _SOUND_BLASTER_8_MONO_R    0xe050
    130 #define  _MICROSOFT_8_MONO_R        0xe051
    131 #define  _SOUND_MASTER_II_8_MONO_R  0xe052
    132 #define  _ADLIB_GOLD_8_MONO_R       0xe053
    133 #define  _MV_PAS_8_MONO_R           0xe054
    134 #define  _RAP10_8_MONO_R            0xe058
    135 #define  _RAP10_16_MONO_R           0xe059
    136 #define  _SB16_8_MONO_R             0xe05a
    137 #define  _SB16_8_ST_R               0xe05b
    138 #define  _SB16_16_MONO_R            0xe05c
    139 #define  _SB16_16_ST_R              0xe05d
    140 #define  _MV_PAS_16_MONO_R          0xe060
    141 #define  _SOUNDSCAPE_8_MONO_R       0xe061
    142 #define  _SOUNDSCAPE_8_ST_R         0xe062
    143 #define  _SOUNDSCAPE_16_MONO_R      0xe063
    144 #define  _SOUNDSCAPE_16_ST_R        0xe064
    145 #define  _ESS_AUDIODRIVE_8_MONO_R   0xe065
    146 #define  _ESS_AUDIODRIVE_8_ST_R     0xe066
    147 #define  _ESS_AUDIODRIVE_16_MONO_R  0xe067
    148 #define  _ESS_AUDIODRIVE_16_ST_R    0xe068
    149 #define  _SPEECH_THING_8_MONO       0xe090
    150 #define  _YAMAHA_8_MONO             0xe106
    151 #define  _INT_SPEAKER_8_MONO        0xe107
    152 
    153 // call indexes for the loadable drivers
    154 enum
    155 {
    156    _DRV_INIT,
    157    _DRV_UNINIT,
    158    _DRV_SETRATE,
    159    _DRV_SETACTION,
    160    _DRV_START,
    161    _DRV_STOP,
    162    _DRV_PAUSE,
    163    _DRV_RESUME,
    164    _DRV_CAPABILITIES,
    165    _DRV_PLAY_FOREGROUND,
    166    _DRV_GET_FILL_INFO,
    167    _DRV_GET_CALL_FUNCTIONS,
    168    _DRV_SET_CALL_FUNCTIONS
    169 };
    170 
    171 // fill info
    172 typedef  struct   _tagFillInfo
    173          {
    174 
    175             LPSTR lpFillHandler;                   // pointer to fill handler
    176             LPWORD lpDMAFillCount;                 // pointer to dma count
    177             LPSTR lpSampleList;                    // pointer to sample list
    178             LPWORD lpDMAMasterVolume;              // pointer to dma count
    179 
    180          } _SOS_FILL_INFO;
    181 
    182 // caps info structure
    183 typedef  struct   _tagCapsInfo
    184          {
    185 
    186             LPSTR    lpPortList;                   // pointer to port list
    187             LPSTR    lpDMAList;                    // pointer to DMA list
    188             LPSTR    lpIRQList;                    // pointer to IRQ list
    189             LPSTR    lpRateList;                   // pointer to rate list
    190 
    191          } _SOS_CAPS_INFO;
    192 
    193 // maximum number of available voice
    194 #define  _MAX_VOICES    32
    195 
    196 // structure definition
    197 typedef  struct   _tagSAMPLE
    198 {
    199    LPSTR    samplePtr;                 // pointer to data buffer
    200    LPSTR    sampleData;                // pointer to active data
    201    LPSTR    sampleLoopPtr;             // pointer for loop back
    202 
    203    WORD     sampleLength;              // length of sample
    204    WORD     sampleIndex;               // index into sample
    205    WORD     sampleLoopLength;          // length of loop
    206 
    207    WORD     sampleBytesLeft;           // bytes left to play in sample
    208 
    209    WORD     sampleLoopPoint;           // byte count for loop point
    210    WORD     sampleLoopEndLength;       // length of remaining chunk
    211 
    212    short    sampleFlags;               // control sample
    213    short    sampleVolume;              // volume control
    214    short    sampleID;                  // sample ID
    215 
    216    short    sampleChannel;             // channel to play sample on
    217    short    sampleLoopCount;           // loop count
    218    short    sampleLastFill;            // last fill position
    219    VOID ( far __cdecl * sampleCallback )( WORD, WORD, WORD ); // callback function for sample
    220 
    221    WORD     samplePitchAdd;
    222    short    samplePitchFraction;
    223 
    224    short    samplePort;                // port to use for non-dma digitized
    225 
    226    WORD     sampleTotalBytes;
    227    WORD     sampleByteLength;
    228 
    229    short    samplePanLocation;
    230    short    samplePanSpeed;
    231    short    samplePanDirection;
    232    short    samplePanStart;
    233    short    samplePanEnd;
    234 
    235    short    sampleDelayBytes;
    236    short    sampleDelayRepeat;
    237 
    238    WORD     sampleADPCMPredicted;
    239    short    sampleADPCMIndex;
    240 
    241    short    sampleRootNoteMIDI;
    242 
    243    WORD  sampleTemp1;
    244 
    245 } _SOS_SAMPLE;
    246 
    247 // enumeration for left or right channel
    248 enum
    249 {
    250    _LEFT_CHANNEL,
    251    _RIGHT_CHANNEL,
    252    _CENTER_CHANNEL,
    253    _INTERLEAVED
    254 };
    255 
    256 // enumeration for foreground and background
    257 enum
    258 {
    259    _FOREGROUND,
    260    _BACKGROUND
    261 };
    262 
    263 // defines for the sample flags
    264 #define  _ACTIVE           0x8000
    265 #define  _LOOPING          0x4000
    266 #define  _FIRST_TIME       0x2000
    267 #define  _PENDING_RELEASE  0x1000
    268 #define  _CONTINUE_BLOCK   0x0800
    269 #define  _PITCH_SHIFT      0x0400
    270 #define  _PANNING          0x0200
    271 #define  _VOLUME           0x0100
    272 #define  _TRANSLATE16TO8   0x0080
    273 #define  _STAGE_LOOP       0x0040
    274 #define  _TRANSLATE8TO16   0x0020
    275 #define  _STEREOTOMONO     0x0010
    276 
    277 // defines for the wParam flags
    278 #define  _SINGLE_SAMPLE 0x01
    279 
    280 #define  _SOS_DCAPS_AUTO_REINIT     0x01
    281 #define  _SOS_DCAPS_MPU_401         0x02
    282 #define  _SOS_DCAPS_OPL2            0x04
    283 #define  _SOS_DCAPS_OPL3            0x08
    284 #define  _SOS_DCAPS_OPL4            0x10
    285 #define  _SOS_DCAPS_WAVETABLE       0x20
    286 #define  _SOS_DCAPS_DL_SAMPLES      0x40
    287 #define  _SOS_DCAPS_FIFO_DEVICE     0x80
    288 #define  _SOS_DCAPS_ENV_NEEDED      0x100
    289 #define  _SOS_DCAPS_PSEUDO_DMA1     0x200
    290 #define  _SOS_DCAPS_SIGNED_DATA     0x8000
    291 
    292 // file header structure
    293 typedef struct
    294 {
    295    // name ID
    296    BYTE  szName[ 32 ];
    297 
    298    // number of drivers in the file
    299    WORD  wDrivers;
    300 
    301    // offset of first driver
    302    WORD  lOffset;
    303 
    304    // size of the file
    305    WORD  lFileSize;
    306 
    307 } _FILEHEADER;
    308 
    309 // driver header structure
    310 typedef struct
    311 {
    312    // name ID
    313    BYTE  szName[ 32 ];
    314 
    315    // offset of next driver
    316    WORD  lNextDriver;
    317 
    318    // size of current driver
    319    WORD  wSize;
    320 
    321    // id for the current device
    322    WORD  wDeviceID;
    323 
    324    // id for the type of DOS extender
    325    WORD  wExtenderType;
    326 
    327 } _DRIVERHEADER;
    328 
    329 // device hardware information
    330 typedef struct
    331 {
    332    // port to be used
    333    WORD  wPort;
    334 
    335    // irq to use
    336    WORD  wIRQ;
    337 
    338    // dma channel to se
    339    WORD  wDMA;
    340 
    341    // extra parameter
    342    WORD  wParam;
    343 
    344 } _SOS_HARDWARE;
    345 
    346 // structure definition for start sample
    347 typedef struct
    348 {
    349    // pointer to sample
    350    LPSTR lpSamplePtr;
    351 
    352    // size of the sample
    353    WORD  dwSampleSize;
    354 
    355    // number of times to loop the sample -1 is infinite
    356    WORD  wLoopCount;
    357 
    358    // channel to play sample on
    359    WORD  wChannel;
    360 
    361    // volume to play sample at
    362    WORD wVolume;
    363 
    364    // id for the sample
    365    WORD  wSampleID;
    366 
    367    // far pointer to the callback function
    368    VOID ( far __cdecl *lpCallback )( WORD, WORD, WORD );
    369 
    370    // port to use if driver is a non-dma background driver
    371    WORD  wSamplePort;
    372 
    373    // flags field
    374    WORD  wSampleFlags;
    375 
    376    // total length of sample including loops, etc..
    377    WORD     dwSampleByteLength;
    378 
    379    // loop point for the sample
    380    WORD  dwSampleLoopPoint;
    381    WORD  dwSampleLoopLength;
    382 
    383    // pitch shifting components
    384    WORD     dwSamplePitchAdd;
    385    WORD    wSamplePitchFraction;
    386 
    387    // pan components
    388    WORD    wSamplePanLocation;
    389    WORD    wSamplePanSpeed;
    390    WORD    wSamplePanDirection;
    391    WORD    wSamplePanStart;
    392    WORD    wSamplePanEnd;
    393 
    394    // delay parts
    395    WORD    wSampleDelayBytes;
    396    WORD    wSampleDelayRepeat;
    397 
    398    // compression components
    399    WORD     dwSampleADPCMPredicted;
    400    WORD    wSampleADPCMIndex;
    401 
    402    // root note for pitch shifting
    403    WORD    wSampleRootNoteMIDI;
    404 
    405    // filler for future upgrades
    406    WORD  dwSampleTemp1;
    407    WORD  dwSampleTemp2;
    408    WORD  dwSampleTemp3;
    409 
    410 } _SOS_START_SAMPLE;
    411 
    412 // structure for initializing a driver
    413 typedef struct
    414 {
    415    WORD  wBufferSize;
    416    LPSTR lpBuffer;
    417    BOOL  wAllocateBuffer;
    418    WORD  wSampleRate;
    419    WORD  wParam;
    420    LONG  dwParam;
    421    VOID ( far *lpFillHandler )( VOID );
    422    LPSTR lpDriverMemory;
    423    LPSTR lpDriverMemoryCS;
    424    LPSTR lpTimerMemory;
    425    LPSTR lpTimerMemoryCS;
    426    WORD  wTimerID;
    427    WORD  wPhysical;
    428 
    429 } _SOS_INIT_DRIVER;
    430 
    431 // define for the timer types to use
    432 #define  _SOS_NORMAL_TIMER          0x00
    433 
    434 // enumeration for the timer types
    435 enum
    436 {
    437    _TIMER_8_MONO   =     0x1000,
    438    _TIMER_8_ST,
    439    _TIMER_16_MONO,
    440    _TIMER_16_ST,
    441    _TIMER_8_MONO_ULAW,
    442    _TIMER_8_ST_ULAW,
    443    _TIMER_16_MONO_ULAW,
    444    _TIMER_16_ST_ULAW,
    445    _TIMER_8_MONO_REC,
    446    _TIMER_8_MONO_ULAW_REC,
    447    _TIMER_UNDEFINED_1,
    448    _TIMER_UNDEFINED_2,
    449    _TIMER_UNDEFINED_3,
    450    _TIMER_UNDEFINED_4,
    451    _TIMER_UNDEFINED_5,
    452    _TIMER_UNDEFINED_6,
    453    _TIMER_UNDEFINED_7,
    454    _TIMER_UNDEFINED_8,
    455    _TIMER_UNDEFINED_9,
    456    _TIMER_UNDEFINED_A,
    457    _TIMER_UNDEFINED_B,
    458    _TIMER_UNDEFINED_C,
    459    _TIMER_UNDEFINED_D,
    460    _TIMER_UNDEFINED_E,
    461    _TIMER_UNDEFINED_F,
    462    _TIMER_UNDEFINED_10,
    463    _TIMER_UNDEFINED_11,
    464    _TIMER_UNDEFINED_12,
    465    _TIMER_UNDEFINED_13,
    466    _TIMER_UNDEFINED_14,
    467    _TIMER_UNDEFINED_15,
    468    _TIMER_UNDEFINED_16,
    469    _TIMER_8_SOUND_SOURCE,
    470    _TIMER_8_SOUND_SOURCE_TANDY,
    471    _TIMER_8_GENERAL_PORT,
    472    _TIMER_8_GENERAL_PORT_REC
    473 };
    474 
    475 // define for no slots available
    476 #define  _ERR_NO_SLOTS ( WORD )-1
    477 
    478 // error codes for the system
    479 enum
    480 {
    481    _ERR_NO_ERROR,
    482    _ERR_DRIVER_NOT_LOADED,
    483    _ERR_INVALID_POINTER,
    484    _ERR_DETECT_INITIALIZED,
    485    _ERR_FAIL_ON_FILE_OPEN,
    486    _ERR_MEMORY_FAIL,
    487    _ERR_INVALID_DRIVER_ID,
    488    _ERR_NO_DRIVER_FOUND,
    489    _ERR_DETECTION_FAILURE,
    490    _ERR_DRIVER_LOADED,
    491    _ERR_INVALID_HANDLE,
    492    _ERR_NO_HANDLES,
    493    _ERR_PAUSED,
    494    _ERR_NOT_PAUSED,
    495    _ERR_INVALID_DATA,
    496    _ERR_DRV_FILE_FAIL,
    497    _ERR_INVALID_PORT,
    498    _ERR_INVALID_IRQ,
    499    _ERR_INVALID_DMA,
    500    _ERR_INVALID_DMA_IRQ
    501 };
    502 
    503 // maximum number of timer events that can be registered
    504 #define  _TIMER_MAX_EVENTS    0x10
    505 
    506 // flags for the debugging system
    507 #define  _SOS_DEBUG_NORMAL       0x0000
    508 #define  _SOS_DEBUG_NO_TIMER     0x0001
    509 #define  _SOS_TIMER_DPMI         0x0002
    510 
    511 // define for types of DOS extenders
    512 #define  _SOS_RATIONAL           0x8000
    513 #define  _SOS_FLASHTECK          0x4000
    514 
    515 // defines for the types of timers for different
    516 // dos extenders
    517 #define  _SOS_TIMER_NEAR         0x8000
    518 #define  _SOS_TIMER_FAR          0x4000
    519 
    520 // values for callback information
    521 enum
    522 {
    523    _SAMPLE_PROCESSED,
    524    _SAMPLE_LOOPING,
    525    _SAMPLE_DONE
    526 };
    527 
    528 // define for special 18.2 callback rate to dos
    529 #define  _TIMER_DOS_RATE   0xff00
    530 
    531 #pragma pack()
    532 
    533 #pragma aux int_3 = "int 3"
    534 
    535 #pragma pack( 1 )
    536 typedef struct
    537 {
    538 	unsigned       region_size;
    539 	unsigned       offset;
    540 	unsigned       segment;
    541 	unsigned short	number_available;
    542 	unsigned short number_used;
    543 	unsigned       page0;
    544 
    545 } EVDS_STRUCT;
    546 
    547 typedef struct
    548 {
    549 	unsigned       region_size;
    550 	unsigned       offset;
    551 	unsigned short segment;
    552 	unsigned short	ID;
    553 	unsigned       physical;
    554 
    555 } VDS_STRUCT;
    556 
    557 #pragma pack()
    558 
    559 #include "sosdata.h"
    560 #include "sosfnct.h"
    561 
    562 #endif