Re: DirectDraw -> WineD3D patch

2006-03-05 Thread Stefan Dösinger
Hi,

I've updated the patch to fix a few issues and take the merged header patches 
into account. It can still be found at http://stud4.tuwien.ac.at/~e0526822/

Thanks for all your feedback so far,
Stefan


pgpLnwKMXVJjH.pgp
Description: PGP signature



Re: DirectDraw -> WineD3D patch

2006-03-05 Thread Stefan Dösinger
> That's indeed the reason. Simple fix is to set the rendertarget usage also
> for ddraw offscreen surfaces.Not sure if there are any possible sideeffects
> of this, but until now i haven't seen any.
That looks a bit more complex. I changed the way ddraw and WineD3D interact 
some time ago, but I didn't update the palette code for that change. I think 
I have to re-write the palette setting code, it's pretty crappy ATM.


pgpCdkK9X4UvB.pgp
Description: PGP signature



Re: DirectDraw -> WineD3D patch and Wine-0.9.9

2006-03-05 Thread Stefan Dösinger
Hi,

> No, it isn't. AFAIK this patch modifies DirectDraw and Direct3D 7
Correct.

I started sending 2 header patches, and they were merged. I'll steadily send 
small WineD3D patches until WineD3D is ready for the ddraw merge, then I'll 
provide a last patch for testing. If it works fine and AJ likes it, it can be 
merged.

Don't know if it will be in Wine 1.0, depends on the time and how many 
regressions occur. There's a high number of ddraw / d3d7 apps which work, so 
regressions are likely.

Stefan


pgpHpvIMjBa3V.pgp
Description: PGP signature



Re: DirectDraw -> WineD3D patch

2006-03-04 Thread Peter Beutner
Hi
> I'll look at this, the whole palette code is a bit messy. My suspicion is 
> that 
> IDirectDrawPaletteImpl_SetEntries / IWineD3DPaletteImpl_SetEntries doesn't 
> update all surfaces that use a palette. 
That's indeed the reason. Simple fix is to set the rendertarget usage also for 
ddraw offscreen surfaces.Not sure if there are any possible sideeffects of 
this, 
but until now i haven't seen any.
f005d3af1e8f4cacf1211c6fc3952acbd4766332
diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c
index 34d91da..4b44035 100644
--- a/dlls/ddraw/ddraw.c
+++ b/dlls/ddraw/ddraw.c
@@ -1788,8 +1788,8 @@ IDirectDrawImpl_CreateNewSurface(IDirect
 PixelFormat_WineD3DtoDD(&pDDSD->ddpfPixelFormat, Mode.Format);
 Format = Mode.Format;
 
-/* If it's a off-screen D3D device, set the rendertarget usage */
-if(pDDSD->ddsCaps.dwCaps & DDSCAPS_3DDEVICE)
+/* If it's a off-screen D3D/DDraw device, set the rendertarget 
usage */
+if(pDDSD->ddsCaps.dwCaps & ( DDSCAPS_3DDEVICE | 
DDSCAPS_OFFSCREENPLAIN) )
 Usage |= WINED3DUSAGE_RENDERTARGET;
 }
 }



Re: DirectDraw -> WineD3D patch and Wine-0.9.9

2006-03-04 Thread Olaf Leidinger
Hello!

> Is this patch included in Wine-0.9.9 ?

No, it isn't. AFAIK this patch modifies DirectDraw and Direct3D 7

Ciao,

Olaf


pgpFTqBFPQ4Ii.pgp
Description: PGP signature



Re: DirectDraw -> WineD3D patch and Wine-0.9.9

2006-03-04 Thread Dimitry Naldayev
Stefan Dösinger <[EMAIL PROTECTED]> writes:

> Hi,
> I've brought my DirectDraw over WineD3D patch in a form where I want to show 
> it to the public for review. I've uploaded it to 
> http://stud4.tuwien.ac.at/~e0526822/, where it is described in detail(below 
> the game list).
>
> If there are no fundamental objections against it, I'll start sending patches 
> for WineD3D. The changes I'll make in small patches :) are:
>
> -> Header fixes, that wined3d_interface.h can be included with d3d.h
> -> Adding methods to WineD3D for DirectDraw rendering
> -> Adding the 2D only surface implementation to WineD3D
>
> When WineD3D is ready, I'll send a patch for dlls/ddraw to wine-devel and 
> wine-user for a broad regression testing, and when the regressions are out, 
> the ddraw can be replaced(From my POV, AJ has the last word of course ;) )
>
Is this patch included in Wine-0.9.9 ?
The summary for Wine-0.9.9 say "+ Direct3D 8 and 9 now use the same code"
or this is separate thing from yours patch ?

--
Dimitry






Re: DirectDraw -> WineD3D patch

2006-03-04 Thread Stefan Dösinger
Hi,
> from IWineD3DDeviceImpl_CreatePalette:
> +memset(&palVersion, 0, sizeof(LOGPALETTE));
> +object->hpal = CreatePalette(&palVersion);
> +memcpy(&object->palVersion, &palVersion, sizeof(LOGPALETTE));
> +/* FIXME Using the palVersion member from IWineD3DPaletteImpl for
> CreatePalette + * directly causes a heap corruption. Why? In original
> ddraw this was a WORD, + * which failed too. Confused ...
> + */
> +object->palNumEntries = IWineD3DPaletteImpl_Size(Flags);
>
> That can't really work. This only creates a palette with zero entries.
> You need to set palNumEntries before calling CreatePalette.
> Attached patch( applies on top of yours ) should fix it( i.e. do it the
> same way it is done in the current implementation).
> But the text colors in AoE are still lacking :/.
> Needs some more investigation ...
I'll look at this, the whole palette code is a bit messy. My suspicion is that 
IDirectDrawPaletteImpl_SetEntries / IWineD3DPaletteImpl_SetEntries doesn't 
update all surfaces that use a palette. I also have to take 
IWineD3DDevice::SetCurrentTexturePalette, 
IWineD3DDevice::GetCurrentTexturePalette as well as 
IWineD3DDevice::SetPaletteEntries and GetPaletteEntries in account.


pgp6mJk8g7LRl.pgp
Description: PGP signature



Re: DirectDraw -> WineD3D patch

2006-03-03 Thread Peter Beutner
Stefan Dösinger schrieb:
> Hi,
> I've brought my DirectDraw over WineD3D patch in a form where I want to show 
> it to the public for review. I've uploaded it to 
> http://stud4.tuwien.ac.at/~e0526822/, where it is described in detail(below 
> the game list).

nice work :).

I just looked a bit into the palette issue( aka lost text color etc):

from IWineD3DDeviceImpl_CreatePalette:
+memset(&palVersion, 0, sizeof(LOGPALETTE));
+object->hpal = CreatePalette(&palVersion);
+memcpy(&object->palVersion, &palVersion, sizeof(LOGPALETTE));
+/* FIXME Using the palVersion member from IWineD3DPaletteImpl for 
CreatePalette
+ * directly causes a heap corruption. Why? In original ddraw this was a 
WORD,
+ * which failed too. Confused ...
+ */
+object->palNumEntries = IWineD3DPaletteImpl_Size(Flags);

That can't really work. This only creates a palette with zero entries.
You need to set palNumEntries before calling CreatePalette.
Attached patch( applies on top of yours ) should fix it( i.e. do it the same 
way 
it is done in the current implementation). 
But the text colors in AoE are still lacking :/.
Needs some more investigation ...

Peter
b0a1e06bddc2bbc17bf7b5d991236a4cd76f0d1a
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index f224c2c..9b0e468 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -1660,12 +1660,11 @@ HRESULT WINAPI IWineD3DDeviceImpl_Create
 HRESULT WINAPI IWineD3DDeviceImpl_CreatePalette(IWineD3DDevice *iface, DWORD 
Flags, PALETTEENTRY *PalEnt, IWineD3DPalette **Palette, IUnknown *Parent) {
 IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface;
 IWineD3DPaletteImpl *object;
-LOGPALETTE palVersion;
 HRESULT hr;
 FIXME("(%p)->(%lx, %p, %p, %p)\n", This, Flags, PalEnt, Palette, Parent);
 
 /* Create the new object */
-object = HeapAlloc(GetProcessHeap(), 0, sizeof(IWineD3DPaletteImpl));
+object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, 
sizeof(IWineD3DPaletteImpl));
 if(!object) {
 ERR("Out of memory when allocating memory for a IWineD3DPalette 
implementation\n");
 return DDERR_OUTOFVIDEOMEMORY;
@@ -1676,15 +1675,14 @@ HRESULT WINAPI IWineD3DDeviceImpl_Create
 object->Flags = Flags;
 object->parent = Parent;
 object->wineD3DDevice = This;
-
-memset(&palVersion, 0, sizeof(LOGPALETTE));
-object->hpal = CreatePalette(&palVersion);
-memcpy(&object->palVersion, &palVersion, sizeof(LOGPALETTE));
-/* FIXME Using the palVersion member from IWineD3DPaletteImpl for 
CreatePalette
- * directly causes a heap corruption. Why? In original ddraw this was a 
WORD,
- * which failed too. Confused ...
- */
 object->palNumEntries = IWineD3DPaletteImpl_Size(Flags);
+   
+object->hpal = CreatePalette((const LOGPALETTE*)&(object->palVersion));
+
+if(!object->hpal) {
+HeapFree( GetProcessHeap(), 0, object);
+return DDERR_OUTOFMEMORY;  /* only reason why CreatePalette could have 
failed */
+}
 
 hr = IWineD3DPalette_SetEntries((IWineD3DPalette *) object, 0, 0, 
IWineD3DPaletteImpl_Size(Flags), PalEnt);
 if(FAILED(hr)) {
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 86b10bb..626154a 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -1309,9 +1309,9 @@ struct IWineD3DPaletteImpl {
 
 /* IWineD3DPalette */
 HPALETTE   hpal;
-LOGPALETTE palVersion;
-WORD   palNumEntries;
-PALETTEENTRY   palents[256];
+WORD   palVersion; /*|   */
+WORD   palNumEntries;  /*|  LOGPALETTE   */
+PALETTEENTRY   palents[256];   /*|   */
 /* This is to store the palette in 'screen format' */
 intscreen_palents[256];
 DWORD  Flags;



Re: DirectDraw -> WineD3D patch

2006-03-02 Thread Aric Cyr
Stefan Dösinger  gmx.at> writes:

> 
> Hi,
> I've brought my DirectDraw over WineD3D patch in a form where I want to show 
> it to the public for review. I've uploaded it to 
> http://stud4.tuwien.ac.at/~e0526822/ , where it is described in detail(below 
> the game list).
> 

Sweet!  Looking forward to playing with this over the weekend.  Seems like you
are getting decent performance out of that radeon mobility 9000.  I'll take a
look at the OpenGL problem you list on the page and see if I can help (I love
OpenGL, so any excuse to play with it is a good one) :)

Good work!  Hope your exams didn't suffer because of this ;)

Regards,
  Aric





DirectDraw -> WineD3D patch

2006-03-02 Thread Stefan Dösinger
Hi,
I've brought my DirectDraw over WineD3D patch in a form where I want to show 
it to the public for review. I've uploaded it to 
http://stud4.tuwien.ac.at/~e0526822/, where it is described in detail(below 
the game list).

If there are no fundamental objections against it, I'll start sending patches 
for WineD3D. The changes I'll make in small patches :) are:

-> Header fixes, that wined3d_interface.h can be included with d3d.h
-> Adding methods to WineD3D for DirectDraw rendering
-> Adding the 2D only surface implementation to WineD3D

When WineD3D is ready, I'll send a patch for dlls/ddraw to wine-devel and 
wine-user for a broad regression testing, and when the regressions are out, 
the ddraw can be replaced(From my POV, AJ has the last word of course ;) )

Have fun playing,
Stefan


pgpLdLqPFbMQd.pgp
Description: PGP signature