LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 01-03-2008, 03:35 PM   #1
iro_number1
Member
 
Registered: Jan 2007
Location: Shirley, NY
Distribution: Gentoo
Posts: 128
Blog Entries: 1

Rep: Reputation: 15
Unhappy How to edit some file through git


Sorry for the lame title but couldn't think of anything short...

I'm trying to play Baldur's Gate on Wine 0.9.52 And you cannot start a new game. I found a Patch for it but i don't know how to apply it... can Anyone help?

I'm on Ubuntu 7.10

Here is the patch:
Code:
commit 8ac4d6a452a0bfec85ebec38528b9a97aa88c62d
Author: Günther Brammer <gbrammer@gmx.de>
Date:   Wed Dec 26 13:01:44 2007 +0100

    Fix 8489

diff --git a/dlls/ddraw/surface.c b/dlls/ddraw/surface.c
index c8b3d5d..1888174 100644
--- a/dlls/ddraw/surface.c
+++ b/dlls/ddraw/surface.c
@@ -577,6 +577,7 @@ IDirectDrawSurfaceImpl_Lock(IDirectDrawSurface7 *iface,
 
     /* This->surface_desc.dwWidth and dwHeight are changeable, thus lock */
     EnterCriticalSection(&ddraw_cs);
+    DD_STRUCT_COPY_BYSIZE(DDSD,&(This->surface_desc));
     if (Rect)
     {
         if ((Rect->left < 0)
@@ -631,7 +632,10 @@ IDirectDrawSurfaceImpl_Lock(IDirectDrawSurface7 *iface,
      * DDSD->dwFlags |= DDSD_LPSURFACE;
      */
     This->surface_desc.lpSurface = LockedRect.pBits;
-    DD_STRUCT_COPY_BYSIZE(DDSD,&(This->surface_desc));
+    DDSD->lpSurface = LockedRect.pBits;
 
     TRACE("locked surface returning description :\n");
     if (TRACE_ON(ddraw)) DDRAW_dump_surface_desc(DDSD);
And here is another:

Code:
commit e84ac6e86152835a5edde285142b18c58dfabd97
Author: Günther Brammer <gbrammer@gmx.de>
Date:   Wed Dec 26 21:27:55 2007 +0100

    ddraw: Return a nullpointer as lpSurface in Lock() if the rect is invalid
    
    Baldurs Gate depends on that, see bug 8489.
    
    Also only write the members of the surface_desc that Windows-DDraw writes.

diff --git a/dlls/ddraw/surface.c b/dlls/ddraw/surface.c
index c8b3d5d..5ac31a4 100644
--- a/dlls/ddraw/surface.c
+++ b/dlls/ddraw/surface.c
@@ -577,20 +577,6 @@ IDirectDrawSurfaceImpl_Lock(IDirectDrawSurface7 *iface,
 
     /* This->surface_desc.dwWidth and dwHeight are changeable, thus lock */
     EnterCriticalSection(&ddraw_cs);
-    if (Rect)
-    {
-        if ((Rect->left < 0)
-                || (Rect->top < 0)
-                || (Rect->left > Rect->right)
-                || (Rect->top > Rect->bottom)
-                || (Rect->right > This->surface_desc.dwWidth)
-                || (Rect->bottom > This->surface_desc.dwHeight))
-        {
-            WARN("Trying to lock an invalid rectangle, returning DDERR_INVALIDPARAMS\n");
-            LeaveCriticalSection(&ddraw_cs);
-            return DDERR_INVALIDPARAMS;
-        }
-    }
 
     /* Should I check for the handle to be NULL?
      *
@@ -605,6 +591,24 @@ IDirectDrawSurfaceImpl_Lock(IDirectDrawSurface7 *iface,
         LeaveCriticalSection(&ddraw_cs);
         return DDERR_INVALIDPARAMS;
     }
+	
+    /* Windows zeroes this if the rect is invalid */
+    DDSD->lpSurface = 0;
+		
+    if (Rect)
+    {
+        if ((Rect->left < 0)
+                || (Rect->top < 0)
+                || (Rect->left > Rect->right)
+                || (Rect->top > Rect->bottom)
+                || (Rect->right > This->surface_desc.dwWidth)
+                || (Rect->bottom > This->surface_desc.dwHeight))
+        {
+            WARN("Trying to lock an invalid rectangle, returning DDERR_INVALIDPARAMS\n");
+            LeaveCriticalSection(&ddraw_cs);
+            return DDERR_INVALIDPARAMS;
+        }
+    }
 
     hr = IWineD3DSurface_LockRect(This->WineD3DSurface,
                                   &LockedRect,
@@ -631,7 +635,24 @@ IDirectDrawSurfaceImpl_Lock(IDirectDrawSurface7 *iface,
      * DDSD->dwFlags |= DDSD_LPSURFACE;
      */
     This->surface_desc.lpSurface = LockedRect.pBits;
-    DD_STRUCT_COPY_BYSIZE(DDSD,&(This->surface_desc));
+    DDSD->dwFlags = This->surface_desc.dwFlags;
+    DDSD->dwHeight = This->surface_desc.dwHeight;
+    DDSD->dwWidth = This->surface_desc.dwWidth;
+    DDSD->u1.lPitch = This->surface_desc.u1.lPitch;
+    DDSD->lpSurface = This->surface_desc.lpSurface;
+
+    DDSD->u3.ddckCKDestOverlay = This->surface_desc.u3.ddckCKDestOverlay;
+    DDSD->ddckCKSrcOverlay = This->surface_desc.ddckCKSrcOverlay;
+    DDSD->u4.ddpfPixelFormat = This->surface_desc.u4.ddpfPixelFormat;
+    if (DDSD->dwSize == sizeof(DDSURFACEDESC2))
+    {
+        DDSD->ddsCaps = This->surface_desc.ddsCaps;
+        DDSD->dwTextureStage = This->surface_desc.dwTextureStage;
+    }
+    else
+    {
+        ((DDSURFACEDESC*)DDSD)->ddsCaps = ((DDSURFACEDESC*)&(This->surface_desc))->ddsCaps;
+    }
 
     TRACE("locked surface returning description :\n");
     if (TRACE_ON(ddraw)) DDRAW_dump_surface_desc(DDSD);
diff --git a/dlls/ddraw/tests/dsurface.c b/dlls/ddraw/tests/dsurface.c
index 0f522db..4541b4c 100644
--- a/dlls/ddraw/tests/dsurface.c
+++ b/dlls/ddraw/tests/dsurface.c
@@ -1611,6 +1611,7 @@ static void test_lockrect_invalid(void)
     {
         IDirectDrawSurface *surface = 0;
         DDSURFACEDESC surface_desc = {0};
+        DDSURFACEDESC compare_desc = {0};
         DDSURFACEDESC locked_desc = {0};
         HRESULT hr;
 
@@ -1629,33 +1630,57 @@ static void test_lockrect_invalid(void)
         hr = IDirectDraw_CreateSurface(lpDD, &surface_desc, &surface, NULL);
         ok(SUCCEEDED(hr), "CreateSurface failed (0x%08x)\n", hr);
         if (FAILED(hr)) {
-	    skip("failed to create surface\n");
-	    continue;
-	}
+            skip("failed to create surface\n");
+            continue;
+        }
+        
+        hr = IDirectDrawSurface_GetSurfaceDesc(surface, &surface_desc);
+        ok(SUCCEEDED(hr), "GetSurfaceDesc failed (0x%08x)\n", hr);
+        
+        memset(&compare_desc, 1, sizeof(compare_desc));
+        compare_desc.dwSize = surface_desc.dwSize;
+        compare_desc.dwFlags = surface_desc.dwFlags;
+        compare_desc.dwHeight = surface_desc.dwHeight;
+        compare_desc.dwWidth = surface_desc.dwWidth;
+        compare_desc.dwLinearSize = surface_desc.dwLinearSize;
+        compare_desc.ddckCKDestOverlay = surface_desc.ddckCKDestOverlay;
+        compare_desc.ddckCKSrcOverlay = surface_desc.ddckCKSrcOverlay;
+        compare_desc.ddpfPixelFormat = surface_desc.ddpfPixelFormat;
+        compare_desc.ddsCaps = surface_desc.ddsCaps;
 
         for (i = 0; i < (sizeof(valid) / sizeof(*valid)); ++i)
         {
             RECT *rect = &valid[i];
 
-            memset(&locked_desc, 0, sizeof(locked_desc));
+            memset(&locked_desc, 1, sizeof(locked_desc));
             locked_desc.dwSize = sizeof(locked_desc);
 
             hr = IDirectDrawSurface_Lock(surface, rect, &locked_desc, DDLOCK_WAIT, NULL);
             ok(SUCCEEDED(hr), "Lock failed (0x%08x) for rect [%d, %d]->[%d, %d]\n",
                     hr, rect->left, rect->top, rect->right, rect->bottom);
 
+            compare_desc.lpSurface = locked_desc.lpSurface;
+            ok(!memcmp(&locked_desc, &compare_desc, sizeof(locked_desc)), "IDirectDrawSurface_Lock did not fill in the surface desc\n");
+
             hr = IDirectDrawSurface_Unlock(surface, NULL);
             ok(SUCCEEDED(hr), "Unlock failed (0x%08x)\n", hr);
         }
 
+        memset(&compare_desc, 1, sizeof(compare_desc));
+        compare_desc.dwSize = sizeof(compare_desc);
+        compare_desc.lpSurface = 0;
         for (i = 0; i < (sizeof(invalid) / sizeof(*invalid)); ++i)
         {
             RECT *rect = &invalid[i];
 
+            memset(&locked_desc, 1, sizeof(locked_desc));
+            locked_desc.dwSize = sizeof(locked_desc);
+
             hr = IDirectDrawSurface_Lock(surface, rect, &locked_desc, DDLOCK_WAIT, NULL);
             ok(hr == DDERR_INVALIDPARAMS, "Lock returned 0x%08x for rect [%d, %d]->[%d, %d]"
                     ", expected DDERR_INVALIDPARAMS (0x%08x)\n", hr, rect->left, rect->top,
                     rect->right, rect->bottom, DDERR_INVALIDPARAMS);
+            ok(!memcmp(&locked_desc, &compare_desc, sizeof(locked_desc)), "IDirectDrawSurface_Lock did not fill in the surface desc\n");
         }
 
         hr = IDirectDrawSurface_Lock(surface, NULL, &locked_desc, DDLOCK_WAIT, NULL);
So how do you apply those?
 
Old 01-04-2008, 07:50 AM   #2
XavierP
Moderator
 
Registered: Nov 2002
Location: Kent, England
Distribution: Debian Testing
Posts: 19,192
Blog Entries: 4

Rep: Reputation: 475Reputation: 475Reputation: 475Reputation: 475Reputation: 475
http://www.linuxheadquarters.com/how...nelpatch.shtml - the instructions are specific to the kernel but will apply to any folder. Basically, untar the patch file into the directory that needs to be patched and then run the command "patch -p1 < <patchname>". The patch will then put it's files into the correct place or amend existing files.

Make sure that the patch files are in the directory to be patched. Also look a man patch to see the various switches that can be used.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
help to edit Edit my bootloader's config file from kernel prompt jagdishpandey Linux - Kernel 5 07-03-2007 06:59 AM
Changing file permission, How to edit a file? rainchild Linux - Newbie 8 01-14-2007 10:18 PM
How to edit a file jimbrechin Linux - Newbie 6 03-26-2005 12:25 AM
edit a file - how? michaeltweak Linux - Software 6 02-01-2004 10:25 AM
how do i edit a file andym Linux - Software 6 04-16-2003 11:09 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 02:20 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration