ref: 9e687f0c3573c7bb93692cd06a5ddcac9e9341be
parent: 5621ef41a8d5ba36ea9e55aadb150fdc66afcc79
author: Tanguy Fautre <[email protected]>
date: Sun Feb 16 09:39:11 EST 2020
Remove more legacy no-op functions.
--- a/Game/CMakeLists.txt
+++ b/Game/CMakeLists.txt
@@ -6,7 +6,6 @@
set(src_files_audiolib_headers
src/audiolib/_multivc.h
- src/audiolib/dma.h
src/audiolib/dpmi.h
src/audiolib/dsl.h
src/audiolib/fx_man.h
@@ -22,6 +21,7 @@
)
set(src_files_audiolib
+ src/audiolib/dpmi.c
src/audiolib/dsl.c
src/audiolib/fx_man.c
src/audiolib/ll_man.c
@@ -28,7 +28,6 @@
src/audiolib/multivoc.c
src/audiolib/mv_mix.c
src/audiolib/mvreverb.c
- src/audiolib/nodpmi.c
src/audiolib/pitch.c
# TODO source contains loads of files that are not used (only DOS). Delete them?
)
--- a/Game/src/audiolib/_multivc.h
+++ b/Game/src/audiolib/_multivc.h
@@ -123,13 +123,8 @@
void ( *DemandFeed )( char **ptr, uint32_t *length );
-#if 0
- short *LeftVolume;
- short *RightVolume;
-#else
int LeftVolume;
int RightVolume;
-#endif
int GLast;
int GPos;
--- a/Game/src/audiolib/dma.c
+++ /dev/null
@@ -1,379 +1,0 @@
-/*
-Copyright (C) 1994-1995 Apogee Software, Ltd.
-
-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 2
-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, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-*/
-/**********************************************************************
- module: DMA.C
-
- author: James R. Dose
- date: February 4, 1994
-
- Low level routines to for programming the DMA controller for 8 bit
- and 16 bit transfers.
-
- (c) Copyright 1994 James R. Dose. All Rights Reserved.
-**********************************************************************/
-
-#include <dos.h>
-#include <conio.h>
-#include <stdlib.h>
-#include "dma.h"
-
-#define DMA_MaxChannel 7
-
-#define VALID ( 1 == 1 )
-#define INVALID ( !VALID )
-
-#define BYTE 0
-#define WORD 1
-
-typedef struct
- {
- int Valid;
- int Width;
- int Mask;
- int Mode;
- int Clear;
- int Page;
- int Address;
- int Length;
- } DMA_PORT;
-
-static const DMA_PORT DMA_PortInfo[ DMA_MaxChannel + 1 ] =
- {
- { VALID, BYTE, 0xA, 0xB, 0xC, 0x87, 0x0, 0x1 },
- { VALID, BYTE, 0xA, 0xB, 0xC, 0x83, 0x2, 0x3 },
- { INVALID, BYTE, 0xA, 0xB, 0xC, 0x81, 0x4, 0x5 },
- { VALID, BYTE, 0xA, 0xB, 0xC, 0x82, 0x6, 0x7 },
- { INVALID, WORD, 0xD4, 0xD6, 0xD8, 0x8F, 0xC0, 0xC2 },
- { VALID, WORD, 0xD4, 0xD6, 0xD8, 0x8B, 0xC4, 0xC6 },
- { VALID, WORD, 0xD4, 0xD6, 0xD8, 0x89, 0xC8, 0xCA },
- { VALID, WORD, 0xD4, 0xD6, 0xD8, 0x8A, 0xCC, 0xCE },
- };
-
-int DMA_ErrorCode = DMA_Ok;
-
-#define DMA_SetErrorCode( status ) \
- DMA_ErrorCode = ( status );
-
-
-/*---------------------------------------------------------------------
- Function: DMA_ErrorString
-
- Returns a pointer to the error message associated with an error
- number. A -1 returns a pointer the current error.
----------------------------------------------------------------------*/
-
-char *DMA_ErrorString
- (
- int ErrorNumber
- )
-
- {
- char *ErrorString;
-
- switch( ErrorNumber )
- {
- case DMA_Error :
- ErrorString = DMA_ErrorString( DMA_ErrorCode );
- break;
-
- case DMA_Ok :
- ErrorString = "DMA channel ok.";
- break;
-
- case DMA_ChannelOutOfRange :
- ErrorString = "DMA channel out of valid range.";
- break;
-
- case DMA_InvalidChannel :
- ErrorString = "Unsupported DMA channel.";
- break;
-
- default :
- ErrorString = "Unknown DMA error code.";
- break;
- }
-
- return( ErrorString );
- }
-
-
-/*---------------------------------------------------------------------
- Function: DMA_VerifyChannel
-
- Verifies whether a DMA channel is available to transfer data.
----------------------------------------------------------------------*/
-
-int DMA_VerifyChannel
- (
- int channel
- )
-
- {
- int status;
- int Error;
-
- status = DMA_Ok;
- Error = DMA_Ok;
-
- if ( ( channel < 0 ) || ( DMA_MaxChannel < channel ) )
- {
- Error = DMA_ChannelOutOfRange;
- status = DMA_Error;
- }
- else if ( DMA_PortInfo[ channel ].Valid == INVALID )
- {
- Error = DMA_InvalidChannel;
- status = DMA_Error;
- }
-
- DMA_SetErrorCode( Error );
- return( status );
- }
-
-
-/*---------------------------------------------------------------------
- Function: DMA_SetupTransfer
-
- Programs the specified DMA channel to transfer data.
----------------------------------------------------------------------*/
-
-int DMA_SetupTransfer
- (
- int channel,
- char *address,
- int length,
- int mode
- )
-
- {
- DMA_PORT *Port;
- int addr;
- int ChannelSelect;
- int Page;
- int HiByte;
- int LoByte;
- int TransferLength;
- int status;
-
- status = DMA_VerifyChannel( channel );
-
- if ( status == DMA_Ok )
- {
- Port = &DMA_PortInfo[ channel ];
- ChannelSelect = channel & 0x3;
-
- addr = ( int )address;
-
- if ( Port->Width == WORD )
- {
- Page = ( addr >> 16 ) & 255;
- HiByte = ( addr >> 9 ) & 255;
- LoByte = ( addr >> 1 ) & 255;
-
- // Convert the length in bytes to the length in words
- TransferLength = ( length + 1 ) >> 1;
-
- // The length is always one less the number of bytes or words
- // that we're going to send
- TransferLength--;
- }
- else
- {
- Page = ( addr >> 16 ) & 255;
- HiByte = ( addr >> 8 ) & 255;
- LoByte = addr & 255;
-
- // The length is always one less the number of bytes or words
- // that we're going to send
- TransferLength = length - 1;
- }
-
- // Mask off DMA channel
- outp( Port->Mask, 4 | ChannelSelect );
-
- // Clear flip-flop to lower byte with any data
- outp( Port->Clear, 0 );
-
- // Set DMA mode
- switch( mode )
- {
- case DMA_SingleShotRead :
- outp( Port->Mode, 0x48 | ChannelSelect );
- break;
-
- case DMA_SingleShotWrite :
- outp( Port->Mode, 0x44 | ChannelSelect );
- break;
-
- case DMA_AutoInitRead :
- outp( Port->Mode, 0x58 | ChannelSelect );
- break;
-
- case DMA_AutoInitWrite :
- outp( Port->Mode, 0x54 | ChannelSelect );
- break;
- }
-
- // Send address
- outp( Port->Address, LoByte );
- outp( Port->Address, HiByte );
-
- // Send page
- outp( Port->Page, Page );
-
- // Send length
- outp( Port->Length, TransferLength );
- outp( Port->Length, TransferLength >> 8 );
-
- // enable DMA channel
- outp( Port->Mask, ChannelSelect );
- }
-
- return( status );
- }
-
-
-/*---------------------------------------------------------------------
- Function: DMA_EndTransfer
-
- Ends use of the specified DMA channel.
----------------------------------------------------------------------*/
-
-int DMA_EndTransfer
- (
- int channel
- )
-
- {
- DMA_PORT *Port;
- int ChannelSelect;
- int status;
-
- status = DMA_VerifyChannel( channel );
- if ( status == DMA_Ok )
- {
- Port = &DMA_PortInfo[ channel ];
- ChannelSelect = channel & 0x3;
-
- // Mask off DMA channel
- outp( Port->Mask, 4 | ChannelSelect );
-
- // Clear flip-flop to lower byte with any data
- outp( Port->Clear, 0 );
- }
-
- return( status );
- }
-
-
-/*---------------------------------------------------------------------
- Function: DMA_GetCurrentPos
-
- Returns the position of the specified DMA transfer.
----------------------------------------------------------------------*/
-
-char *DMA_GetCurrentPos
- (
- int channel
- )
-
- {
- DMA_PORT *Port;
- unsigned long addr;
- int status;
-
- addr = NULL;
- status = DMA_VerifyChannel( channel );
-
- if ( status == DMA_Ok )
- {
- Port = &DMA_PortInfo[ channel ];
-
- if ( Port->Width == WORD )
- {
- // Get address
- addr = inp( Port->Address ) << 1;
- addr |= inp( Port->Address ) << 9;
-
- // Get page
- addr |= inp( Port->Page ) << 16;
- }
- else
- {
- // Get address
- addr = inp( Port->Address );
- addr |= inp( Port->Address ) << 8;
-
- // Get page
- addr |= inp( Port->Page ) << 16;
- }
- }
-
- return( ( char * )addr );
- }
-
-
-/*---------------------------------------------------------------------
- Function: DMA_GetTransferCount
-
- Returns how many bytes are left in the DMA's transfer.
----------------------------------------------------------------------*/
-
-int DMA_GetTransferCount
- (
- int channel
- )
-
- {
- DMA_PORT *Port;
- int count;
- int status;
-
- status = DMA_Ok;
-
- count = 0;
-
- if ( ( channel < 0 ) || ( DMA_MaxChannel < channel ) )
- {
- status = DMA_ChannelOutOfRange;
- }
- else if ( DMA_PortInfo[ channel ].Valid == INVALID )
- {
- status = DMA_InvalidChannel;
- }
-
- if ( status == DMA_Ok )
- {
- Port = &DMA_PortInfo[ channel ];
-
- outp( Port->Clear, 0 );
- count = inp( Port->Length );
- count += inp( Port->Length ) << 8;
-
- if ( Port->Width == WORD )
- {
- count <<= 1;
- }
- }
-
- DMA_SetErrorCode( status );
-
- return( count );
- }
--- a/Game/src/audiolib/dma.h
+++ /dev/null
@@ -1,83 +1,0 @@
-/*
-Copyright (C) 1994-1995 Apogee Software, Ltd.
-
-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 2
-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, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-*/
-/**********************************************************************
- file: DMA.H
-
- author: James R. Dose
- date: February 4, 1994
-
- Public header file for DMA.C
-
- (c) Copyright 1994 James R. Dose. All Rights Reserved.
-**********************************************************************/
-
-#ifndef __DMA_H
-#define __DMA_H
-
-enum DMA_ERRORS
- {
- DMA_Error = -1,
- DMA_Ok = 0,
- DMA_ChannelOutOfRange,
- DMA_InvalidChannel
- };
-
-enum DMA_Modes
- {
- DMA_SingleShotRead,
- DMA_SingleShotWrite,
- DMA_AutoInitRead,
- DMA_AutoInitWrite
- };
-
-char *DMA_ErrorString
- (
- int ErrorNumber
- );
-
-int DMA_VerifyChannel
- (
- int channel
- );
-
-int DMA_SetupTransfer
- (
- int channel,
- char *address,
- int length,
- int mode
- );
-
-int DMA_EndTransfer
- (
- int channel
- );
-
-char *DMA_GetCurrentPos
- (
- int channel
- );
-
-int DMA_GetTransferCount
- (
- int channel
- );
-
-#endif
--- a/Game/src/audiolib/dpmi.c
+++ b/Game/src/audiolib/dpmi.c
@@ -28,223 +28,20 @@
(c) Copyright 1994 James R. Dose. All Rights Reserved.
**********************************************************************/
-#include <dos.h>
-#include <string.h>
+#include <stdlib.h>
#include "dpmi.h"
-#define TRUE ( 1 == 1 )
-#define FALSE ( !TRUE )
+int DPMI_GetDOSMemory( void **ptr, void **descriptor, unsigned length )
+{
+ *ptr = malloc(length);
+ *descriptor = *ptr;
+
+ return (descriptor == 0) ? DPMI_Error : DPMI_Ok;
+}
-static union REGS Regs;
-static struct SREGS SegRegs;
-
-
-/*---------------------------------------------------------------------
- Function: DPMI_GetRealModeVector
-
- Returns the vector of a real mode interrupt.
----------------------------------------------------------------------*/
-
-unsigned long DPMI_GetRealModeVector
- (
- int num
- )
-
- {
- unsigned long vector;
-
- Regs.x.eax = 0x0200;
- Regs.h.bl = num;
- int386( 0x31, &Regs, &Regs );
-
- vector = Regs.w.cx & 0xffff;
- vector <<= 16;
- vector |= Regs.w.dx & 0xffff;
-
- return( vector );
- }
-
-
-/*---------------------------------------------------------------------
- Function: DPMI_SetRealModeVector
-
- Sets the vector of a real mode interrupt.
----------------------------------------------------------------------*/
-
-void DPMI_SetRealModeVector
- (
- int num,
- unsigned long vector
- )
-
- {
- Regs.x.eax = 0x0201;
- Regs.h.bl = num;
- Regs.w.dx = vector & 0xffff;
- Regs.w.cx = ( vector >> 16 ) & 0xffff;
-
- int386( 0x31, &Regs, &Regs );
- }
-
-
-/*---------------------------------------------------------------------
- Function: DPMI_CallRealModeFunction
-
- Performs a call to a real mode function.
----------------------------------------------------------------------*/
-
-int DPMI_CallRealModeFunction
- (
- dpmi_regs *callregs
- )
-
- {
- // Setup our registers to call DPMI
- Regs.w.ax = 0x0301;
- Regs.h.bl = 0;
- Regs.h.bh = 0;
- Regs.w.cx = 0;
-
- SegRegs.es = FP_SEG( callregs );
- Regs.x.edi = FP_OFF( callregs );
-
- // Call Real-mode procedure with Far Return Frame
- int386x( 0x31, &Regs, &Regs, &SegRegs );
-
- if ( Regs.x.cflag )
- {
- return( DPMI_Error );
- }
-
- return( DPMI_Ok );
- }
-
-
-/*---------------------------------------------------------------------
- Function: DPMI_LockMemory
-
- Locks a region of memory to keep the virtual memory manager from
- paging the region out.
----------------------------------------------------------------------*/
-
-int DPMI_LockMemory
- (
- void *address,
- unsigned length
- )
-
- {
- unsigned linear;
-
- // Thanks to DOS/4GW's zero-based flat memory model, converting
- // a pointer of any type to a linear address is trivial.
-
- linear = (unsigned) address;
-
- // DPMI Lock Linear Region
- Regs.w.ax = 0x600;
-
- // Linear address in BX:CX
- Regs.w.bx = (linear >> 16);
- Regs.w.cx = (linear & 0xFFFF);
-
- // Length in SI:DI
- Regs.w.si = (length >> 16);
- Regs.w.di = (length & 0xFFFF);
-
- int386 (0x31, &Regs, &Regs);
-
- // Return 0 if can't lock
- if ( Regs.w.cflag )
- {
- return( DPMI_Error );
- }
-
- return ( DPMI_Ok );
- }
-
-
-/*---------------------------------------------------------------------
- Function: DPMI_LockMemoryRegion
-
- Locks a region of memory to keep the virtual memory manager from
- paging the region out.
----------------------------------------------------------------------*/
-
-int DPMI_LockMemoryRegion
- (
- void *start,
- void *end
- )
-
- {
- int status;
-
- status = DPMI_LockMemory( start, ( char * )end - ( char * )start );
-
- return( status );
- }
-
-
-/*---------------------------------------------------------------------
- Function: DPMI_UnlockMemory
-
- Unlocks a region of memory that was previously locked.
----------------------------------------------------------------------*/
-
-int DPMI_UnlockMemory
- (
- void *address,
- unsigned length
- )
-
- {
- unsigned linear;
-
- // Thanks to DOS/4GW's zero-based flat memory model, converting
- // a pointer of any type to a linear address is trivial.
-
- linear = (unsigned) address;
-
- // DPMI Unlock Linear Region
- Regs.w.ax = 0x601;
-
- // Linear address in BX:CX
- Regs.w.bx = (linear >> 16);
- Regs.w.cx = (linear & 0xFFFF);
-
- // Length in SI:DI
- Regs.w.si = (length >> 16);
- Regs.w.di = (length & 0xFFFF);
-
- int386 (0x31, &Regs, &Regs);
-
- // Return 0 if can't unlock
- if ( Regs.w.cflag )
- {
- return( DPMI_Error );
- }
-
- return ( DPMI_Ok );
- }
-
-
-/*---------------------------------------------------------------------
- Function: DPMI_UnlockMemoryRegion
-
- Unlocks a region of memory that was previously locked.
----------------------------------------------------------------------*/
-
-int DPMI_UnlockMemoryRegion
- (
- void *start,
- void *end
- )
-
- {
- int status;
-
- status = DPMI_UnlockMemory( start, ( char * )end - ( char * )start );
-
- return( status );
- }
+int DPMI_FreeDOSMemory( void* descriptor )
+{
+ free(descriptor);
+
+ return (descriptor == 0) ? DPMI_Error : DPMI_Ok;
+}
--- a/Game/src/audiolib/dpmi.h
+++ b/Game/src/audiolib/dpmi.h
@@ -31,8 +31,6 @@
#ifndef __DPMI_H
#define __DPMI_H
-#include <inttypes.h>
-
enum DPMI_Errors
{
DPMI_Warning = -2,
@@ -39,27 +37,6 @@
DPMI_Error = -1,
DPMI_Ok = 0
};
-
-typedef struct
- {
- uint32_t EDI;
- uint32_t ESI;
- uint32_t EBP;
- uint32_t Reserved;
- uint32_t EBX;
- uint32_t EDX;
- uint32_t ECX;
- uint32_t EAX;
- uint32_t Flags;
- uint32_t ES;
- uint32_t DS;
- uint32_t FS;
- uint32_t GS;
- uint32_t IP;
- uint16_t CS;
- uint16_t SP;
- uint16_t SS;
- } dpmi_regs;
int DPMI_GetDOSMemory( void **ptr, void **descriptor, unsigned length );
int DPMI_FreeDOSMemory( void *descriptor );
--- a/Game/src/audiolib/fx_man.c
+++ b/Game/src/audiolib/fx_man.c
@@ -28,17 +28,11 @@
(c) Copyright 1994 James R. Dose. All Rights Reserved.
**********************************************************************/
-#include <stdio.h>
-#include <stdlib.h>
+#include "dsl.h"
+#include "fx_man.h"
#include "sndcards.h"
#include "multivoc.h"
-
-
-#include "dsl.h"
-#include "ll_man.h"
-#include "fx_man.h"
-
#define TRUE ( 1 == 1 )
#define FALSE ( !TRUE )
@@ -143,44 +137,6 @@
return( status );
- }
-
-
-/*---------------------------------------------------------------------
- Function: FX_GetBlasterSettings
-
- Returns the current BLASTER environment variable settings.
----------------------------------------------------------------------*/
-
-int FX_GetBlasterSettings
- (
- fx_blaster_config *blaster
- )
-
- {
-
- return( FX_Ok );
- }
-
-
-/*---------------------------------------------------------------------
- Function: FX_SetupSoundBlaster
-
- Handles manual setup of the Sound Blaster information.
----------------------------------------------------------------------*/
-
-int FX_SetupSoundBlaster
- (
- fx_blaster_config blaster,
- int *MaxVoices,
- int *MaxSampleBits,
- int *MaxChannels
- )
-
- {
-
-
- return( FX_Ok );
}
--- a/Game/src/audiolib/fx_man.h
+++ b/Game/src/audiolib/fx_man.h
@@ -31,7 +31,6 @@
#ifndef __FX_MAN_H
#define __FX_MAN_H
-#include "sndcards.h"
#include <inttypes.h>
typedef struct
@@ -44,17 +43,6 @@
#define MonoFx 1
#define StereoFx 2
-typedef struct
- {
- unsigned long Address;
- unsigned long Type;
- unsigned long Interrupt;
- unsigned long Dma8;
- unsigned long Dma16;
- unsigned long Midi;
- unsigned long Emu;
- } fx_blaster_config;
-
enum FX_ERRORS
{
FX_Warning = -2,
@@ -80,8 +68,6 @@
char *FX_ErrorString( int ErrorNumber );
int FX_SetupCard( int SoundCard, fx_device *device );
-int FX_GetBlasterSettings( fx_blaster_config *blaster );
-int FX_SetupSoundBlaster( fx_blaster_config blaster, int *MaxVoices, int *MaxSampleBits, int *MaxChannels );
int FX_Init( int SoundCard, int numvoices, int numchannels, int samplebits, unsigned mixrate );
int FX_Shutdown( void );
int FX_SetCallBack( void ( *function )( int32_t ) );
--- a/Game/src/audiolib/multivoc.c
+++ b/Game/src/audiolib/multivoc.c
@@ -32,12 +32,9 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <time.h>
-#include "util.h"
#include "dpmi.h"
#include "usrhooks.h"
-#include "dma.h"
#include "linklist.h"
#include "sndcards.h"
#include "dsl.h"
@@ -59,11 +56,7 @@
static int MV_ReverbLevel;
int MV_ReverbDelay;
-#if 0
-static VOLUME16 *MV_ReverbTable = NULL;
-#else
static int MV_ReverbTable = -1;
-#endif
//static signed short MV_VolumeTable[ MV_MaxVolume + 1 ][ 256 ];
//static signed short MV_VolumeTable[ 63 + 1 ][ 256 ];
@@ -92,7 +85,6 @@
static int MV_RequestedMixRate;
int MV_MixRate;
-static int MV_DMAChannel = -1;
static int MV_BuffShift;
static int MV_TotalMemory;
@@ -121,13 +113,8 @@
// char *MV_HarshClipTable;
char *MV_MixDestination;
-#if 0
-short *MV_LeftVolume;
-short *MV_RightVolume;
-#else
int MV_LeftVolume;
int MV_RightVolume;
-#endif
int MV_SampleSize = 1;
int MV_RightChannelOffset;
--- a/Game/src/audiolib/nodpmi.c
+++ /dev/null
@@ -1,47 +1,0 @@
-/*
-Copyright (C) 1994-1995 Apogee Software, Ltd.
-
-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 2
-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, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-*/
-/**********************************************************************
- module: DPMI.C
-
- author: James R. Dose
- date: April 8, 1994
-
- Functions for performing DPMI calls.
-
- (c) Copyright 1994 James R. Dose. All Rights Reserved.
-**********************************************************************/
-
-#include <stdlib.h>
-#include "dpmi.h"
-
-int DPMI_GetDOSMemory( void **ptr, void **descriptor, unsigned length )
-{
- *ptr = malloc(length);
- *descriptor = *ptr;
-
- return (descriptor == 0) ? DPMI_Error : DPMI_Ok;
-}
-
-int DPMI_FreeDOSMemory( void* descriptor )
-{
- free(descriptor);
-
- return (descriptor == 0) ? DPMI_Error : DPMI_Ok;
-}
--- a/Game/src/audiolib/usrhooks.h
+++ b/Game/src/audiolib/usrhooks.h
@@ -33,8 +33,6 @@
#ifndef __USRHOOKS_H
#define __USRHOOKS_H
-#include "../duke3d.h"
-
/*---------------------------------------------------------------------
Error definitions
---------------------------------------------------------------------*/
--- a/Game/src/config.c
+++ b/Game/src/config.c
@@ -27,7 +27,6 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
-#include <ctype.h>
#include <time.h>
#include "duke3d.h"
#include "scriplib.h"
@@ -51,7 +50,6 @@
int32 VoiceToggle;
int32 AmbienceToggle;
int32 OpponentSoundToggle; // xduke to toggle opponent's sounds on/off in DM (duke 1.3d scheme)
-fx_blaster_config BlasterConfig;
int32 NumVoices;
int32 NumChannels;
int32 NumBits;
@@ -693,13 +691,6 @@
FXDevice = SoundScape;
SCRIPT_GetNumber( scripthandle, "Sound Setup", "MusicDevice",&MusicDevice);
-
- // if (MusicDevice != NumSoundCards)
- // MusicDevice = SoundScape;
-
-// FIX_00015: Forced NumVoices=8, NumChannels=2, NumBits=16, MixRate=44100, ScreenMode = x(
-// (ScreenMode has no meaning anymore)
-
SCRIPT_GetNumber( scripthandle, "Sound Setup", "FXVolume",&FXVolume);
SCRIPT_GetNumber( scripthandle, "Sound Setup", "MusicVolume",&MusicVolume);
SCRIPT_GetNumber( scripthandle, "Sound Setup", "SoundToggle",&SoundToggle);
@@ -706,30 +697,15 @@
SCRIPT_GetNumber( scripthandle, "Sound Setup", "MusicToggle",&MusicToggle);
SCRIPT_GetNumber( scripthandle, "Sound Setup", "VoiceToggle",&VoiceToggle);
SCRIPT_GetNumber( scripthandle, "Sound Setup", "AmbienceToggle",&AmbienceToggle);
- SCRIPT_GetNumber( scripthandle, "Sound Setup", "OpponentSoundToggle",&OpponentSoundToggle);
- SCRIPT_GetNumber( scripthandle, "Sound Setup", "NumVoices",&NumVoices);
+ SCRIPT_GetNumber( scripthandle, "Sound Setup", "OpponentSoundToggle",&OpponentSoundToggle);
+
NumVoices = 32;
- SCRIPT_GetNumber( scripthandle, "Sound Setup", "NumChannels",&NumChannels);
NumChannels = 2;
- SCRIPT_GetNumber( scripthandle, "Sound Setup", "NumBits",&NumBits);
NumBits = 16;
- SCRIPT_GetNumber( scripthandle, "Sound Setup", "MixRate",&MixRate);
MixRate = 44100;
+
SCRIPT_GetNumber( scripthandle, "Sound Setup", "MidiPort",&MidiPort);
- SCRIPT_GetNumber( scripthandle, "Sound Setup", "BlasterAddress",&dummy);
- BlasterConfig.Address = dummy;
- SCRIPT_GetNumber( scripthandle, "Sound Setup", "BlasterType",&dummy);
- BlasterConfig.Type = dummy;
- SCRIPT_GetNumber( scripthandle, "Sound Setup", "BlasterInterrupt",&dummy);
- BlasterConfig.Interrupt = dummy;
- SCRIPT_GetNumber( scripthandle, "Sound Setup", "BlasterDma8",&dummy);
- BlasterConfig.Dma8 = dummy;
- SCRIPT_GetNumber( scripthandle, "Sound Setup", "BlasterDma16",&dummy);
- BlasterConfig.Dma16 = dummy;
- SCRIPT_GetNumber( scripthandle, "Sound Setup", "BlasterEmu",&dummy);
- BlasterConfig.Emu = dummy;
SCRIPT_GetNumber( scripthandle, "Sound Setup", "ReverseStereo",&ReverseStereo);
-
SCRIPT_GetNumber( scripthandle, "Controls","ControllerType",&ControllerType);
SCRIPT_GetNumber( scripthandle, "Controls","MouseAimingFlipped",&ud.mouseflip);
SCRIPT_GetNumber( scripthandle, "Controls","MouseAiming",&MouseAiming);
--- a/Game/src/sounds.c
+++ b/Game/src/sounds.c
@@ -45,65 +45,42 @@
===================
*/
-void SoundStartup( void )
- {
- int32 status;
+void SoundStartup(void)
+{
+ int32 status;
- // if they chose None lets return
- if (FXDevice == NumSoundCards) return;
+ // if they chose None lets return
+ if (FXDevice == NumSoundCards) return;
- // Do special Sound Blaster, AWE32 stuff
- if (
- ( FXDevice == SoundBlaster ) ||
- ( FXDevice == Awe32 )
- )
- {
- int MaxVoices;
- int MaxBits;
- int MaxChannels;
+ if (eightytwofifty && numplayers > 1)
+ {
+ status = FX_Init(FXDevice, min(NumVoices, 4), 1, 8, 8000);
+ }
+ else
+ {
+ status = FX_Init(FXDevice, NumVoices, NumChannels, NumBits, MixRate);
+ }
+ if (status == FX_Ok)
+ {
- status = FX_SetupSoundBlaster
- (
- BlasterConfig, (int *)&MaxVoices, (int *)&MaxBits, (int *)&MaxChannels
- );
- }
- else
- {
- status = FX_Ok;
- }
-
- if ( status == FX_Ok )
- {
- if ( eightytwofifty && numplayers > 1)
- {
- status = FX_Init( FXDevice, min( NumVoices,4 ), 1, 8, 8000 );
- }
- else
- {
- status = FX_Init( FXDevice, NumVoices, NumChannels, NumBits, MixRate );
- }
- if ( status == FX_Ok )
- {
-
- FX_SetVolume( FXVolume );
- if (ReverseStereo == 1)
- {
+ FX_SetVolume(FXVolume);
+ if (ReverseStereo == 1)
+ {
FX_SetReverseStereo(!FX_GetReverseStereo());
- }
- }
- }
- if ( status != FX_Ok )
- {
- Error(EXIT_FAILURE, FX_ErrorString( FX_Error ));
- }
+ }
+ }
+ if (status != FX_Ok)
+ {
+ Error(EXIT_FAILURE, FX_ErrorString(FX_Error));
+ }
- status = FX_SetCallBack( TestCallBack );
+ status = FX_SetCallBack(TestCallBack);
- if ( status != FX_Ok )
- {
- Error(EXIT_FAILURE, FX_ErrorString( FX_Error ));
- }
- }
+ if (status != FX_Ok)
+ {
+ Error(EXIT_FAILURE, FX_ErrorString(FX_Error));
+ }
+}
/*
===================
@@ -144,24 +121,6 @@
if ((MusicDevice == NumSoundCards) || (eightytwofifty && numplayers > 1) )
return;
- // satisfy AWE32 and WAVEBLASTER stuff
- BlasterConfig.Midi = MidiPort;
-
- // Do special Sound Blaster, AWE32 stuff
- if (
- ( FXDevice == SoundBlaster ) ||
- ( FXDevice == Awe32 )
- )
- {
- int MaxVoices;
- int MaxBits;
- int MaxChannels;
-
- FX_SetupSoundBlaster
- (
- BlasterConfig, (int *)&MaxVoices, (int *)&MaxBits, (int *)&MaxChannels
- );
- }
status = MUSIC_Init( MusicDevice, MidiPort );
if ( status == MUSIC_Ok )
--- a/Game/src/sounds.h
+++ b/Game/src/sounds.h
@@ -29,7 +29,6 @@
// sounds.h
//
//****************************************************************************
-#include "audiolib/fx_man.h"
#ifndef _sounds_public_
#define _sounds_public_
@@ -40,7 +39,6 @@
extern int32 MusicDevice;
extern int32 FXVolume;
extern int32 MusicVolume;
-extern fx_blaster_config BlasterConfig;
extern int32 NumVoices;
extern int32 NumChannels;
extern int32 NumBits;