shithub: duke3d

Download patch

ref: fffc1875f5823796015581a1f0803fcf8173c685
parent: a07f39dff7742c963d107f84853d4d1c791d5858
author: Tanguy Fautre <tanguy@fautre.com>
date: Tue Feb 11 16:38:50 EST 2020

64-bit: Fixed MV_BufferDescriptor.

--- a/Game/src/audiolib/dpmi.h
+++ b/Game/src/audiolib/dpmi.h
@@ -64,8 +64,8 @@
 uint32_t DPMI_GetRealModeVector( int num );
 
 int  DPMI_CallRealModeFunction( dpmi_regs *callregs );
-int  DPMI_GetDOSMemory( void **ptr, int *descriptor, unsigned length );
-int  DPMI_FreeDOSMemory( int descriptor );
+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 );
--- a/Game/src/audiolib/multivoc.c
+++ b/Game/src/audiolib/multivoc.c
@@ -114,7 +114,7 @@
 static int MV_TotalMemory;
 static int MV_FooMemory;
 
-static int   MV_BufferDescriptor;
+static void* MV_BufferDescriptor;
 static int   MV_BufferEmpty[ NumberOfBuffers ];
 char *MV_MixBuffer[ NumberOfBuffers + 1 ];
 double *MV_FooBuffer = NULL;
@@ -2967,8 +2967,7 @@
       }
 
    // Allocate mix buffer within 1st megabyte
-   status = DPMI_GetDOSMemory( ( void ** )&ptr, &MV_BufferDescriptor,
-      2 * TotalBufferSize);
+   status = DPMI_GetDOSMemory( ( void ** )&ptr, &MV_BufferDescriptor, 2 * TotalBufferSize);
 
    if ( status )
       {
--- a/Game/src/audiolib/nodpmi.c
+++ b/Game/src/audiolib/nodpmi.c
@@ -147,20 +147,19 @@
    return( status );
    }
 
-int DPMI_GetDOSMemory( void **ptr, int *descriptor, unsigned length )
+int DPMI_GetDOSMemory( void **ptr, void **descriptor, unsigned length )
 {
 	/* Lovely... */
 	
-	*ptr = (void *)malloc(length);
+    *ptr = (void*)malloc(length);
+	*descriptor = *ptr;
 	
-	*descriptor = (int) *ptr;
-	
 	return (descriptor == 0) ? DPMI_Error : DPMI_Ok;
 }
 
-int DPMI_FreeDOSMemory( int descriptor )
+int DPMI_FreeDOSMemory( void* descriptor )
 {
-	free((void *)descriptor);
+	free(descriptor);
 	
 	return (descriptor == 0) ? DPMI_Error : DPMI_Ok;
 }