shithub: duke3d

Download patch

ref: 5621ef41a8d5ba36ea9e55aadb150fdc66afcc79
parent: a53c7b8d90c5c5b02de54bca36e4c049d1788421
author: Tanguy Fautre <tanguy@fautre.com>
date: Sun Feb 16 09:19:32 EST 2020

Remove more legacy no-op functions.

--- a/Game/src/audiolib/dpmi.h
+++ b/Game/src/audiolib/dpmi.h
@@ -61,20 +61,7 @@
    uint16_t SS;
    } dpmi_regs;
 
-uint32_t DPMI_GetRealModeVector( int num );
-
-int  DPMI_CallRealModeFunction( dpmi_regs *callregs );
 int  DPMI_GetDOSMemory( void **ptr, void **descriptor, unsigned length );
 int  DPMI_FreeDOSMemory( void *descriptor );
-int  DPMI_LockMemory( void *address, unsigned length );
-int  DPMI_LockMemoryRegion( void *start, void *end );
-int  DPMI_UnlockMemory( void *address, unsigned length );
-int  DPMI_UnlockMemoryRegion( void *start, void *end );
-
-#define DPMI_Lock( variable ) \
-   ( DPMI_LockMemory( &( variable ), sizeof( variable ) ) )
-
-#define DPMI_Unlock( variable ) \
-   ( DPMI_UnlockMemory( &( variable ), sizeof( variable ) ) )
 
 #endif
--- a/Game/src/audiolib/fx_man.c
+++ b/Game/src/audiolib/fx_man.c
@@ -208,13 +208,6 @@
       FX_Shutdown();
       }
 
-   status = LL_LockMemory();
-   if ( status != LL_Ok )
-      {
-      FX_SetErrorCode( FX_DPMI_Error );
-      return( FX_Error );
-      }
-
    FX_MixRate = mixrate;
 
    status = FX_Ok;
@@ -243,14 +236,10 @@
          status = FX_Error;
       }
 
-   if ( status != FX_Ok )
+   if ( status == FX_Ok )
       {
-      LL_UnlockMemory();
+	      FX_Installed = TRUE;
       }
-   else
-      {
-      FX_Installed = TRUE;
-      }
 
    return( status );
    }
@@ -300,7 +289,6 @@
       }
 
    FX_Installed = FALSE;
-   LL_UnlockMemory();
 
    return( status );
    }
--- a/Game/src/audiolib/ll_man.c
+++ b/Game/src/audiolib/ll_man.c
@@ -107,67 +107,3 @@
    OFFSET( item, next ) = NULL;
    OFFSET( item, prev ) = NULL;
    }
-
-
-/*---------------------------------------------------------------------
-   Function: LL_LockEnd
-
-   Used for determining the length of the functions to lock in memory.
----------------------------------------------------------------------*/
-
-static void LL_LockEnd
-   (
-   void
-   )
-
-   {
-   }
-
-
-/*---------------------------------------------------------------------
-   Function: LL_UnlockMemory
-
-   Unlocks all neccessary data.
----------------------------------------------------------------------*/
-
-void LL_UnlockMemory
-   (
-   void
-   )
-
-   {
-#ifdef LOCKMEMORY
-
-   DPMI_UnlockMemoryRegion( LL_LockStart, LL_LockEnd );
-
-#endif
-   }
-
-
-/*---------------------------------------------------------------------
-   Function: LL_LockMemory
-
-   Locks all neccessary data.
----------------------------------------------------------------------*/
-
-int LL_LockMemory
-   (
-   void
-   )
-
-   {
-
-#ifdef LOCKMEMORY
-
-   int status;
-
-   status = DPMI_LockMemoryRegion( LL_LockStart, LL_LockEnd );
-   if ( status != DPMI_Ok )
-      {
-      return( LL_Error );
-      }
-
-#endif
-
-   return( LL_Ok );
-   }
--- a/Game/src/audiolib/ll_man.h
+++ b/Game/src/audiolib/ll_man.h
@@ -46,8 +46,6 @@
 
 void LL_AddNode( char *node, char **head, char **tail, int next, int prev );
 void LL_RemoveNode( char *node, char **head, char **tail, int next, int prev );
-void LL_UnlockMemory( void );
-int  LL_LockMemory( void );
 
 #define LL_AddToHead( type, listhead, node )         \
     LL_AddNode( ( char * )( node ),                  \
--- a/Game/src/audiolib/multivoc.c
+++ b/Game/src/audiolib/multivoc.c
@@ -2558,30 +2558,14 @@
 
    MV_SetErrorCode( MV_Ok );
 
-   status = MV_LockMemory();
-   if ( status != MV_Ok )
-      {
-      return( status );
-      }
-
    MV_TotalMemory = Voices * sizeof( VoiceNode ); // + sizeof( HARSH_CLIP_TABLE_8 );
    status = USRHOOKS_GetMem( ( void ** )&ptr, MV_TotalMemory );
    if ( status != USRHOOKS_Ok )
       {
-      MV_UnlockMemory();
       MV_SetErrorCode( MV_NoMem );
       return( MV_Error );
       }
 
-   status = DPMI_LockMemory( ptr, MV_TotalMemory );
-   if ( status != DPMI_Ok )
-      {
-      USRHOOKS_FreeMem( ptr );
-      MV_UnlockMemory();
-      MV_SetErrorCode( MV_DPMI_Error );
-      return( MV_Error );
-      }
-
    MV_Voices = ( VoiceNode * )ptr;
 //   MV_HarshClipTable = ptr + ( MV_TotalMemory - sizeof( HARSH_CLIP_TABLE_8 ) );
 
@@ -2601,12 +2585,9 @@
 
    if ( status )
       {
-      DPMI_UnlockMemory( MV_Voices, MV_TotalMemory );
       USRHOOKS_FreeMem( MV_Voices );
       MV_Voices      = NULL;
       MV_TotalMemory = 0;
-      MV_UnlockMemory();
-
       MV_SetErrorCode( MV_NoMem );
       return( MV_Error );
       }
@@ -2624,14 +2605,10 @@
       {
       status = MV_ErrorCode;
 
-      DPMI_UnlockMemory( MV_Voices, MV_TotalMemory );
       USRHOOKS_FreeMem( MV_Voices );
       MV_Voices      = NULL;
       MV_TotalMemory = 0;
-
       DPMI_FreeDOSMemory( MV_BufferDescriptor );
-      MV_UnlockMemory();
-
       MV_SetErrorCode( status );
       return( MV_Error );
       }
@@ -2670,28 +2647,13 @@
    status = USRHOOKS_GetMem( ( void ** )&ptr, MV_FooMemory);
    if ( status != USRHOOKS_Ok )
    {
-       DPMI_UnlockMemory( MV_Voices, MV_TotalMemory );
        USRHOOKS_FreeMem( MV_Voices );
        MV_Voices      = NULL;
        MV_TotalMemory = 0;
-	   MV_UnlockMemory();
 	   MV_SetErrorCode( MV_NoMem );
 	   return( MV_Error);
    }
 
-   status = DPMI_LockMemory( ptr, MV_FooMemory );
-   if ( status != DPMI_Ok )
-   {
-	   USRHOOKS_FreeMem( ptr );
-       DPMI_UnlockMemory( MV_Voices, MV_TotalMemory );
-       USRHOOKS_FreeMem( MV_Voices );
-       MV_Voices      = NULL;
-       MV_TotalMemory = 0;
-	   MV_UnlockMemory();
-	   MV_SetErrorCode( MV_DPMI_Error );
-	   return( MV_Error );
-   }
-
    MV_FooBuffer = ptr;
 
 // Start the playback engine
@@ -2758,12 +2720,10 @@
    DSL_Shutdown();
 
    // Free any voices we allocated
-   DPMI_UnlockMemory( MV_FooBuffer, MV_FooMemory );
    USRHOOKS_FreeMem( MV_FooBuffer );
    MV_FooBuffer = NULL;
    MV_FooMemory = 0;
 
-   DPMI_UnlockMemory( MV_Voices, MV_TotalMemory );
    USRHOOKS_FreeMem( MV_Voices );
    MV_Voices      = NULL;
    MV_TotalMemory = 0;
@@ -2783,134 +2743,6 @@
    return( MV_Ok );
    }
 
-
-/*---------------------------------------------------------------------
-   Function: MV_UnlockMemory
-
-   Unlocks all neccessary data.
----------------------------------------------------------------------*/
-
-void MV_UnlockMemory
-   (
-   void
-   )
-
-   {
-   PITCH_UnlockMemory();
-
-   DPMI_UnlockMemoryRegion( MV_LockStart, MV_LockEnd );
-//   DPMI_Unlock( MV_VolumeTable );
-   DPMI_Unlock( MV_PanTable );
-   DPMI_Unlock( MV_Installed );
-   DPMI_Unlock( MV_SoundCard );
-   DPMI_Unlock( MV_TotalVolume );
-   DPMI_Unlock( MV_MaxVoices );
-   DPMI_Unlock( MV_BufferSize );
-   DPMI_Unlock( MV_BufferLength );
-   DPMI_Unlock( MV_SampleSize );
-   DPMI_Unlock( MV_NumberOfBuffers );
-   DPMI_Unlock( MV_MixMode );
-   DPMI_Unlock( MV_Channels );
-   DPMI_Unlock( MV_Bits );
-   DPMI_Unlock( MV_Silence );
-   DPMI_Unlock( MV_SwapLeftRight );
-   DPMI_Unlock( MV_RequestedMixRate );
-   DPMI_Unlock( MV_MixRate );
-   DPMI_Unlock( MV_BufferDescriptor );
-   DPMI_Unlock( MV_MixBuffer );
-   DPMI_Unlock( MV_BufferEmpty );
-   DPMI_Unlock( MV_Voices );
-   DPMI_Unlock( MV_FooBuffer );
-   DPMI_Unlock( VoiceList );
-   DPMI_Unlock( VoicePool );
-   DPMI_Unlock( MV_MixPage );
-   DPMI_Unlock( MV_VoiceHandle );
-   DPMI_Unlock( MV_CallBackFunc );
-   DPMI_Unlock( MV_RecordFunc );
-   DPMI_Unlock( MV_Recording );
-   DPMI_Unlock( MV_MixFunction );
-//   DPMI_Unlock( MV_HarshClipTable );
-   DPMI_Unlock( MV_MixDestination );
-   DPMI_Unlock( MV_LeftVolume );
-   DPMI_Unlock( MV_RightVolume );
-   DPMI_Unlock( MV_MixPosition );
-   DPMI_Unlock( MV_ErrorCode );
-   DPMI_Unlock( MV_DMAChannel );
-   DPMI_Unlock( MV_BuffShift );
-   DPMI_Unlock( MV_ReverbLevel );
-   DPMI_Unlock( MV_ReverbDelay );
-   DPMI_Unlock( MV_ReverbTable );
-   }
-
-
-/*---------------------------------------------------------------------
-   Function: MV_LockMemory
-
-   Locks all neccessary data.
----------------------------------------------------------------------*/
-
-int MV_LockMemory
-   (
-   void
-   )
-
-   {
-   int status;
-   int pitchstatus;
-
-   status  = DPMI_LockMemoryRegion( MV_LockStart, MV_LockEnd );
-//   status |= DPMI_Lock( MV_VolumeTable );
-   status |= DPMI_Lock( MV_PanTable );
-   status |= DPMI_Lock( MV_Installed );
-   status |= DPMI_Lock( MV_SoundCard );
-   status |= DPMI_Lock( MV_TotalVolume );
-   status |= DPMI_Lock( MV_MaxVoices );
-   status |= DPMI_Lock( MV_BufferSize );
-   status |= DPMI_Lock( MV_BufferLength );
-   status |= DPMI_Lock( MV_SampleSize );
-   status |= DPMI_Lock( MV_NumberOfBuffers );
-   status |= DPMI_Lock( MV_MixMode );
-   status |= DPMI_Lock( MV_Channels );
-   status |= DPMI_Lock( MV_Bits );
-   status |= DPMI_Lock( MV_Silence );
-   status |= DPMI_Lock( MV_SwapLeftRight );
-   status |= DPMI_Lock( MV_RequestedMixRate );
-   status |= DPMI_Lock( MV_MixRate );
-   status |= DPMI_Lock( MV_BufferDescriptor );
-   status |= DPMI_Lock( MV_MixBuffer );
-   status |= DPMI_Lock( MV_BufferEmpty );
-   status |= DPMI_Lock( MV_Voices );
-   status |= DPMI_Lock( MV_FooBuffer );
-   status |= DPMI_Lock( VoiceList );
-   status |= DPMI_Lock( VoicePool );
-   status |= DPMI_Lock( MV_MixPage );
-   status |= DPMI_Lock( MV_VoiceHandle );
-   status |= DPMI_Lock( MV_CallBackFunc );
-   status |= DPMI_Lock( MV_RecordFunc );
-   status |= DPMI_Lock( MV_Recording );
-   status |= DPMI_Lock( MV_MixFunction );
-//   status |= DPMI_Lock( MV_HarshClipTable );
-   status |= DPMI_Lock( MV_MixDestination );
-   status |= DPMI_Lock( MV_LeftVolume );
-   status |= DPMI_Lock( MV_RightVolume );
-   status |= DPMI_Lock( MV_MixPosition );
-   status |= DPMI_Lock( MV_ErrorCode );
-   status |= DPMI_Lock( MV_DMAChannel );
-   status |= DPMI_Lock( MV_BuffShift );
-   status |= DPMI_Lock( MV_ReverbLevel );
-   status |= DPMI_Lock( MV_ReverbDelay );
-   status |= DPMI_Lock( MV_ReverbTable );
-
-   pitchstatus = PITCH_LockMemory();
-   if ( ( pitchstatus != PITCH_Ok ) || ( status != DPMI_Ok ) )
-      {
-      MV_UnlockMemory();
-      MV_SetErrorCode( MV_DPMI_Error );
-      return( MV_Error );
-      }
-
-   return( MV_Ok );
-   }
 
 void ClearBuffer_DW( void *ptr, unsigned data, int length )
 {
--- a/Game/src/audiolib/multivoc.h
+++ b/Game/src/audiolib/multivoc.h
@@ -121,8 +121,6 @@
 int   MV_Init( int soundcard, int MixRate, int Voices, int numchannels,
          int samplebits );
 int   MV_Shutdown( void );
-void  MV_UnlockMemory( void );
-int   MV_LockMemory( void );
 
 //CRITICAL_SECTION reverbCS;
 SDL_mutex* reverbMutex;
--- a/Game/src/audiolib/nodpmi.c
+++ b/Game/src/audiolib/nodpmi.c
@@ -29,129 +29,11 @@
 **********************************************************************/
 
 #include <stdlib.h>
-#include <string.h>
 #include "dpmi.h"
 
-#define TRUE  ( 1 == 1 )
-#define FALSE ( !TRUE )
-
-/*---------------------------------------------------------------------
-   Function: DPMI_GetRealModeVector
-
-   Returns the vector of a real mode interrupt.
----------------------------------------------------------------------*/
-
-uint32_t DPMI_GetRealModeVector
-   (
-   int num
-   )
-
-   {
-   return 0;
-   }
-
-
-
-
-
-/*---------------------------------------------------------------------
-   Function: DPMI_CallRealModeFunction
-
-   Performs a call to a real mode function.
----------------------------------------------------------------------*/
-
-int DPMI_CallRealModeFunction
-   (
-   dpmi_regs *callregs
-   )
-
-   {
-   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
-   )
-
-   {
-   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
-   )
-
-   {
-   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_GetDOSMemory( void **ptr, void **descriptor, unsigned length )
 {
-	/* Lovely... */
-	
-    *ptr = (void*)malloc(length);
+    *ptr = malloc(length);
 	*descriptor = *ptr;
 	
 	return (descriptor == 0) ? DPMI_Error : DPMI_Ok;
--- a/Game/src/audiolib/pitch.c
+++ b/Game/src/audiolib/pitch.c
@@ -195,64 +195,3 @@
 
    return( scale );
    }
-
-
-/*---------------------------------------------------------------------
-   Function: PITCH_LockEnd
-
-   Used for determining the length of the functions to lock in memory.
----------------------------------------------------------------------*/
-
-static void PITCH_LockEnd
-   (
-   void
-   )
-
-   {
-   }
-
-
-/*---------------------------------------------------------------------
-   Function: PITCH_UnlockMemory
-
-   Unlocks all neccessary data.
----------------------------------------------------------------------*/
-
-void PITCH_UnlockMemory
-   (
-   void
-   )
-
-   {
-   DPMI_UnlockMemoryRegion( PITCH_LockStart, PITCH_LockEnd );
-   DPMI_Unlock( PitchTable );
-//   DPMI_Unlock( PITCH_Installed );
-   }
-
-
-/*---------------------------------------------------------------------
-   Function: PITCH_LockMemory
-
-   Unlocks all neccessary data.
----------------------------------------------------------------------*/
-
-int PITCH_LockMemory
-   (
-   void
-   )
-
-   {
-   int status;
-
-   status  = DPMI_LockMemoryRegion( PITCH_LockStart, PITCH_LockEnd );
-   status |= DPMI_Lock( PitchTable );
-//   status |= DPMI_Lock( PITCH_Installed );
-
-   if ( status != DPMI_Ok )
-      {
-      PITCH_UnlockMemory();
-      return( PITCH_Error );
-      }
-
-   return( PITCH_Ok );
-   }
--- a/Game/src/audiolib/pitch.h
+++ b/Game/src/audiolib/pitch.h
@@ -42,6 +42,5 @@
 
 //void          PITCH_Init( void );
 uint32_t PITCH_GetScale( int pitchoffset );
-void          PITCH_UnlockMemory( void );
-int           PITCH_LockMemory( void );
+
 #endif
--