Re: D3D7 & WineD3D success

2005-11-21 Thread Antoine Chavasse
On 11/20/05, Stefan Dösinger <[EMAIL PROTECTED]> wrote:
>
> Does anyone know any other games which are running with the old Direct3D 7
> implementation? I will give Prince of Persia 3D a try tomorrow, but the last
> time I tried it crashed before initialising DDraw.
>

Anarchy Online. You can get the game and a free account at
http://www.anarchy-online.com/free/ad_campaigns/freecampaign (it's a
free MMORPG with ingame ads)

It was almost working with the old direct7 implementation last time I
checked it, although with lots of rendering problems. I haven't been
able to work further on making it work for a few months because I
currently have no internet access at home, but when I last tried to
figure out what was wrong, it seemed that the old direct3d7
implementation didn't set material colors when rendering stuff with
dynamic lighting and no vertex colors, so it actually may work better
with your patch.




[RESEND] [d3d] Light management API test cases

2005-06-06 Thread Antoine Chavasse
ChangeLog:
 - Test cases for the direct3d7 light api.

Index: dlls/ddraw/tests/.cvsignore
===
RCS file: /home/wine/wine/dlls/ddraw/tests/.cvsignore,v
retrieving revision 1.3
diff -u -p -r1.3 .cvsignore
--- dlls/ddraw/tests/.cvsignore 30 May 2005 11:11:34 -  1.3
+++ dlls/ddraw/tests/.cvsignore 6 Jun 2005 18:13:18 -
@@ -1,4 +1,5 @@
 Makefile
 ddrawmodes.ok
 dsurface.ok
+d3d7light.ok
 testlist.c
Index: dlls/ddraw/tests/Makefile.in
===
RCS file: /home/wine/wine/dlls/ddraw/tests/Makefile.in,v
retrieving revision 1.4
diff -u -p -r1.4 Makefile.in
--- dlls/ddraw/tests/Makefile.in30 May 2005 11:11:34 -  1.4
+++ dlls/ddraw/tests/Makefile.in6 Jun 2005 18:13:18 -
@@ -3,11 +3,12 @@ TOPOBJDIR = ../../..
 SRCDIR= @srcdir@
 VPATH = @srcdir@
 TESTDLL   = ddraw.dll
-IMPORTS   = ddraw user32 gdi32 kernel32
+IMPORTS   = ddraw dxguid user32 gdi32 kernel32
 
 CTESTS = \
ddrawmodes.c \
-   dsurface.c
+   dsurface.c \
+   d3d7light.c
 
 @MAKE_TEST_RULES@
 
--- /dev/null   1970-01-01 01:00:00.0 +0100
+++ dlls/ddraw/tests/d3d7light.c2005-06-06 20:10:12.998103616 +0200
@@ -0,0 +1,185 @@
+/*
+ * Some unit tests for direct3d7 light functions
+ *
+ * Copyright (C) 2005 Antoine Chavasse ([EMAIL PROTECTED])
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include 
+#include "wine/test.h"
+#include "ddraw.h"
+#include "d3d.h"
+
+static LPDIRECTDRAW7lpDD = NULL;
+static LPDIRECT3D7  lpD3D = NULL;
+static LPDIRECTDRAWSURFACE7 lpDDS = NULL;
+static LPDIRECT3DDEVICE7lpD3DDevice = NULL;
+
+static void CreateDirect3D()
+{
+HRESULT rc;
+DDSURFACEDESC2 ddsd;
+
+rc = DirectDrawCreateEx(NULL, (void**)&lpDD,
+&IID_IDirectDraw7, NULL);
+ok(rc==DD_OK, "DirectDrawCreateEx returned: %lx\n", rc);
+
+rc = IDirectDraw_SetCooperativeLevel(lpDD, NULL, DDSCL_NORMAL);
+ok(rc==DD_OK, "SetCooperativeLevel returned: %lx\n", rc);
+
+rc = IDirectDraw7_QueryInterface(lpDD, &IID_IDirect3D7, (void**) &lpD3D);
+ok(rc==DD_OK, "QueryInterface returned: %lx\n", rc);
+
+memset(&ddsd, 0, sizeof(ddsd));
+ddsd.dwSize = sizeof(ddsd);
+ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT;
+ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE;
+ddsd.dwWidth = 256;
+ddsd.dwHeight = 256;
+rc = IDirectDraw7_CreateSurface(lpDD, &ddsd, &lpDDS, NULL);
+ok(rc==DD_OK, "CreateSurface returned: %lx\n", rc);
+
+rc = IDirect3D7_CreateDevice(lpD3D, &IID_IDirect3DTnLHalDevice, lpDDS,
+&lpD3DDevice);
+ok(rc==D3D_OK, "CreateDevice returned: %lx\n", rc);
+}
+
+static void ReleaseDirect3D()
+{
+if (lpD3DDevice != NULL)
+{
+IDirect3DDevice7_Release(lpD3DDevice);
+lpD3DDevice = NULL;
+}
+
+if (lpDDS != NULL)
+{
+IDirectDrawSurface_Release(lpDDS);
+lpDDS = NULL;
+}
+
+if (lpD3D != NULL)
+{
+IDirect3D7_Release(lpD3D);
+lpD3D = NULL;
+}
+
+if (lpDD != NULL)
+{
+IDirectDraw_Release(lpDD);
+lpDD = NULL;
+}
+}
+
+static void LightTest()
+{
+HRESULT rc;
+D3DLIGHT7 light;
+D3DLIGHT7 defaultlight;
+BOOL bEnabled = FALSE;
+
+
+/* Set a few lights with funky indices. */
+memset(&light, 0, sizeof(light));
+light.dltType = D3DLIGHT_DIRECTIONAL;
+light.dcvDiffuse.r = 0.5f;
+light.dcvDiffuse.g = 0.6f;
+light.dcvDiffuse.b = 0.7f;
+light.dvDirection.y = 1.f;
+
+rc = IDirect3DDevice7_SetLight(lpD3DDevice, 5, &light);
+ok(rc==D3D_OK, "SetLight returned: %lx\n", rc);
+rc = IDirect3DDevice7_SetLight(lpD3DDevice, 10, &light);
+ok(rc==D3D_OK, "SetLight returned: %lx\n", rc);
+rc = IDirect3DDevice7_SetLight(lpD3DDevice, 45, &light);
+ok(rc==D3D_OK, "SetLight returned: %lx\n", rc);
+
+
+/* Try to retrieve a light beyond the indices of the lights that have
+   been set. */
+rc = IDirect3DDevice7_GetLight(lpD3DDevice, 50, &light);
+ok(rc==DDERR_I

[RESEND] [d3d] Light management API fix to handle an unlimited number of lights

2005-06-06 Thread Antoine Chavasse
Resend of http://www.winehq.org/hypermail/wine-patches/2005/06/0103.html,
adapted to Christian's reorganisation of ddraw directory, and as
attachment to avoid gmail word-wrapping the patch :)

ChangeLog:
 - Rewrote the light management API to allow for an unlimited amount
of lights to be set, and only a subset of them to be enabled.


lightpatch.diff
Description: Binary data


Re: [d3d] Light management API fix to handle an unlimited number of lights

2005-06-05 Thread Antoine Chavasse
On 6/5/05, Christian Costa <[EMAIL PROTECTED]> wrote:

> 
> May I ask you to wait a little until I finish reorganizing the DDraw
> directory?
> This task involves file renaming so if your patch is aplly later, we can
> save the history
> of your modifications. :-)
> 

Ok. I'll resubmit it when you're done.




Re: [ddraw] Mipmap creation with DDSCAPS_COMPLEX, DDSCAPS_MIPMAP, and no mipmap count

2005-05-29 Thread Antoine Chavasse
Mike Hearn <[EMAIL PROTECTED]> wrote:
> I can't comment on the DirectX side of things, but this looks like a
> textbook case of how to do a patch correct.

Thanks :)


On 5/29/05, Lionel Ulmer <[EMAIL PROTECTED]> wrote:

> 
> The only (minor) gripe I would have with this patch is the use of the 'log()
> / log()' to compute the mipmap count (I usually dislike floating point match
> - it's maybe my background in embedded programming where FPU are inexistant
> :-) )... I would have found it simpler to just have a 'while (min > 0) { min
> >>= 1; count += 1 }'.
> 

Alright. I'll resend the patch with this change.