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
Welcome to
LinuxQuestions.org , a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free.
Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please
contact us . If you need to reset your password,
click here .
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a
virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month.
Click here for more info.
01-03-2008, 03:35 PM
#1
Member
Registered: Jan 2007
Location: Shirley, NY
Distribution: Gentoo
Posts: 128
Rep:
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?
01-04-2008, 07:50 AM
#2
Moderator
Registered: Nov 2002
Location: Kent, England
Distribution: Debian Testing
Posts: 19,192
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.
All times are GMT -5. The time now is 02:20 AM .
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know .
Latest Threads
LQ News