direct play patch

Tim Beckmann <[email protected]> Mon, 21 Feb 2005 19:14:27 -0600
Newsgroups gmane.comp.emulators.winex.devel
Message-ID <[email protected]>
Hello,

In Icewind Dale 2, going to the load game screen from the main menu, 
then hitting the cancel button results in the game crashing.  I've 
tracked it down to the game crashing in a call to direct play.  It is 
trying to delete players for a direct play connection that isn't 
initialized.  This patch fixes it by making sure direct play is 
initialized in some of the routines.

Please consider applying it...

Tim
dplay.patch (text/x-patch, 2.1 KB)
Index: dlls/dplayx/dplay.c
===================================================================
RCS file: /cvsroot/winex/dlls/dplayx/dplay.c,v
retrieving revision 1.9
diff -u -r1.9 dplay.c
--- dlls/dplayx/dplay.c	1 Apr 2004 12:09:26 -0000	1.9
+++ dlls/dplayx/dplay.c	22 Feb 2005 01:14:38 -0000
@@ -1931,6 +1931,11 @@
   FIXME( "(%p)->(%p,0x%08lx,%u): semi stub\n",
          This, lpMsgHdr, idPlayer, bAnsi );
 
+  if( This->dp2->connectionInitialized == NO_PROVIDER )
+  {
+    return DPERR_UNINITIALIZED;
+  }
+
   if( DP_FindPlayer( This, idPlayer ) == NULL )
   {
     return DPERR_INVALIDPLAYER;
@@ -2038,6 +2043,11 @@
     FIXME( "Should check if session is open already and then enum remote session\n" );
   }
 
+  if( This->dp2->connectionInitialized == NO_PROVIDER )
+  {
+    return DPERR_UNINITIALIZED;
+  }
+
   /* Find the group */
   if( ( lpGData = DP_FindAnyGroup( This, idGroup ) ) == NULL )
   {
@@ -2697,6 +2707,11 @@
   TRACE( "(%p)->(0x%08lx,%p,%p,0x%08lx,%u)\n",
          This, idPlayer, lpData, lpdwDataSize, dwFlags, bAnsi );
 
+  if( This->dp2->connectionInitialized == NO_PROVIDER )
+  {
+    return DPERR_UNINITIALIZED;
+  }
+
   if( ( lpPList = DP_FindPlayer( This, idPlayer ) ) == NULL )
   {
     return DPERR_INVALIDPLAYER;
@@ -2838,6 +2853,11 @@
 
   TRACE( "(%p)->(%p,%p,%u)\n", This, lpData, lpdwDataSize, bAnsi );
 
+  if( This->dp2->connectionInitialized == NO_PROVIDER )
+  {
+    return DPERR_UNINITIALIZED;
+  }
+
   if( ( lpData == NULL ) && ( lpdwDataSize == NULL ) )
   {
     return DPERR_INVALIDPARAMS;
@@ -3039,6 +3059,11 @@
   FIXME( "(%p)->(%p,%p,0x%08lx,%p,%p,%u): stub\n",
          This, lpidFrom, lpidTo, dwFlags, lpData, lpdwDataSize, bAnsi );
 
+  if( This->dp2->connectionInitialized == NO_PROVIDER )
+  {
+    return DPERR_UNINITIALIZED;
+  }
+
   if( dwFlags == 0 )
   {
     dwFlags = DPRECEIVE_ALL;
@@ -3322,6 +3347,11 @@
   TRACE( "(%p)->(%p,0x%08lx,%u,%u)\n",
          This, lpSessDesc, dwFlags, bInitial, bAnsi );
 
+  if( This->dp2->connectionInitialized == NO_PROVIDER )
+  {
+    return DPERR_UNINITIALIZED;
+  }
+
   if( dwFlags )
   {
     return DPERR_INVALIDPARAMS;