Re: NTDLL doesn't compile under Clang

2011-05-29 Thread James McKenzie

On 5/29/11 11:43 AM, Charles Davis wrote:

On 5/29/11 12:41 PM, C.W. Betts wrote:

When compiling the NTDLL component of Wine, I get the following error:
../../../wine-git/./dlls/ntdll/large_int.c:267:13: error: unknown use of
   instruction mnemonic without a size suffix
 __asm__("div %4,%%eax"
 ^
:1:2: note: instantiated into assembly here
 div 12(%esp),%eax
 ^
I'm using Clang 2.0 from Xcode 4.0

That's a Clang bug that's already been fixed. Sadly, it didn't make it
into Xcode 4.0.
Any hope of it making it into a up release of XCode?  Don't like running 
into upstream fixed bugs in a .0 release product. :(


James McKenzie





Re: [PATCH] gdiplus: Convert and pass in 3 points, not 1 (Coverity)

2011-05-29 Thread Vincent Povirk
Good catch. This sort of thing would have been very hard to track down
in a real app.

On Sun, May 29, 2011 at 4:53 PM, Marcus Meissner  wrote:
> Hi,
>
> CID 1147
> We get 3 points, not 1 ... and also need to pass on 3 points.
>
> Ciao, Marcus
> ---
>  dlls/gdiplus/matrix.c |   12 +++-
>  1 files changed, 7 insertions(+), 5 deletions(-)
>
> diff --git a/dlls/gdiplus/matrix.c b/dlls/gdiplus/matrix.c
> index 1035cc2..acfe989 100644
> --- a/dlls/gdiplus/matrix.c
> +++ b/dlls/gdiplus/matrix.c
> @@ -105,7 +105,8 @@ GpStatus WINGDIPAPI GdipCreateMatrix3I(GDIPCONST GpRect 
> *rect, GDIPCONST GpPoint
>     GpMatrix **matrix)
>  {
>     GpRectF rectF;
> -    GpPointF ptF;
> +    GpPointF ptF[3];
> +    int i;
>
>     TRACE("(%p, %p, %p)\n", rect, pt, matrix);
>
> @@ -114,10 +115,11 @@ GpStatus WINGDIPAPI GdipCreateMatrix3I(GDIPCONST GpRect 
> *rect, GDIPCONST GpPoint
>     rectF.Width = (REAL)rect->Width;
>     rectF.Height = (REAL)rect->Height;
>
> -    ptF.X = (REAL)pt->X;
> -    ptF.Y = (REAL)pt->Y;
> -
> -    return GdipCreateMatrix3(&rectF, &ptF, matrix);
> +    for (i = 0; i < 3; i++) {
> +        ptF[i].X = (REAL)pt[i].X;
> +        ptF[i].Y = (REAL)pt[i].Y;
> +    }
> +    return GdipCreateMatrix3(&rectF, ptF, matrix);
>  }
>
>  GpStatus WINGDIPAPI GdipCloneMatrix(GpMatrix *matrix, GpMatrix **clone)
> --
> 1.7.3.4
>
>
>
>




GSoC: dinput8 Action Mapping

2011-05-29 Thread Lucas Zawacki
Hey guys. So last week I finally got a good understanding of dinput as
a whole and nailed some trivial cases of action mapping, the ones with
the keyboard. I'm sending a series of patches so everyone can take a
look before I try commiting them. Please note that these contain a
partial implementation of EnumDevicesBySemantics, BuildActionMap and
SetActionMap, and also they're only the A versions. There are some
tests for EnumDevicesBySemantics. I'm not too sure of how to code the
tests that require user input...

I hope it's not a nuisance to read the code split in 7 files, if you
guys want I can merge it in one big diff.

On a bright note, this patchset results in the input working for these
two games:

* http://appdb.winehq.org/objectManager.php?sClass=application&iId=3678
* http://appdb.winehq.org/objectManager.php?sClass=application&iId=7919

Cheers :)
From 551a2f3bea643add493d50a5580f7c2a3c2f7566 Mon Sep 17 00:00:00 2001
From: Lucas Fialho Zawacki 
Date: Sat, 28 May 2011 14:56:28 -0300
Subject: dinput8/tests: Organized it a little and added a test for the EnumDevicesBySemantics callback.

---
 dlls/dinput8/tests/device.c |   37 +
 1 files changed, 25 insertions(+), 12 deletions(-)

diff --git a/dlls/dinput8/tests/device.c b/dlls/dinput8/tests/device.c
index c18a83a..eca22a9 100644
--- a/dlls/dinput8/tests/device.c
+++ b/dlls/dinput8/tests/device.c
@@ -27,6 +27,23 @@
 #include "initguid.h"
 #include "dinput.h"
 
+/* Dummy GUID */
+static const GUID ACTION_MAPPING_GUID = { 0x1, 0x2, 0x3, { 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb } };
+
+static DIACTION actionMapping[]=
+{
+  /* axis */
+  { 0, 0x01008A01 /* DIAXIS_DRIVINGR_STEER */ ,   0, { "Steer" } },
+  /* button */
+  { 1, 0x01000C01 /* DIBUTTON_DRIVINGR_SHIFTUP */ ,   0, { "Upshift" } },
+  /* keyboard mapping */
+  { 2, DIKEYBOARD_SPACE , 0, { "Missiles" } }
+};
+
+
+/* This will set the number of devices, incrementing it
+   each time a new one is enumerated
+*/
 static BOOL CALLBACK enum_by_semantics(
 LPCDIDEVICEINSTANCE lpddi,
 LPDIRECTINPUTDEVICE8 lpdid,
@@ -34,6 +51,10 @@ static BOOL CALLBACK enum_by_semantics(
 DWORD dwRemaining,
 LPVOID pvRef)
 {
+
+int *ndevices = pvRef;
+if (ndevices != NULL) *ndevices += 1;
+
 return DIENUM_CONTINUE;
 }
 
@@ -44,17 +65,7 @@ static void test_action_mapping(void)
 HINSTANCE hinst = GetModuleHandle(NULL);
 LPDIRECTINPUT8 pDI = NULL;
 DIACTIONFORMAT af;
-/* Dummy GUID */
-const GUID ACTION_MAPPING_GUID = { 0x1, 0x2, 0x3, { 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb } };
-
-DIACTION actionMapping[]=
-{
-  /* axis */
-  { 0, 0x01008A01 /* DIAXIS_DRIVINGR_STEER */ , 0, { "Steer" } },
-
-  /* button */
-  { 1, 0x01000C01 /* DIBUTTON_DRIVINGR_SHIFTUP */ , 0, { "Upshift" } }
-};
+int ndevices = 0;
 
 hr = CoCreateInstance(&CLSID_DirectInput8, 0, 1, &IID_IDirectInput8A, (LPVOID*)&pDI);
 if (hr == DIERR_OLDDIRECTINPUTVERSION ||
@@ -86,9 +97,10 @@ static void test_action_mapping(void)
 af.dwGenre = 0x0100; /* DIVIRTUAL_DRIVING_RACE */
 
 hr = IDirectInput8_EnumDevicesBySemantics(pDI,0, &af,
-enum_by_semantics, 0, 0);
+enum_by_semantics, &ndevices, 0);
 
 ok(SUCCEEDED(hr), "EnumDevicesBySemantics failed: hr=%08x\n",hr);
+todo_wine ok (ndevices > 0, "EnumDevicesBySemantics did not call the callback. hr=%08x ndevices=%d\n", hr, ndevices);
 
 /* The call fails with a zeroed GUID */
 memset(&af.guidActionMap, 0, sizeof(GUID));
@@ -107,3 +119,4 @@ START_TEST(device)
 
 CoUninitialize();
 }
+
-- 
1.7.0.4

From 1829925b178b3c2eb45fe4ea1956a226e6f91628 Mon Sep 17 00:00:00 2001
From: Lucas Fialho Zawacki 
Date: Sun, 29 May 2011 16:49:45 -0300
Subject: dinput: Implement a simple version of EnumDevicesBySemanticsA which enumerates only the keyboard.

---
 dlls/dinput/dinput_main.c |   46 ++--
 1 files changed, 39 insertions(+), 7 deletions(-)

diff --git a/dlls/dinput/dinput_main.c b/dlls/dinput/dinput_main.c
index d3727bc..2d572bf 100644
--- a/dlls/dinput/dinput_main.c
+++ b/dlls/dinput/dinput_main.c
@@ -120,7 +120,7 @@ static struct list direct_input_list = LIST_INIT( direct_input_list );
  */
 HRESULT WINAPI DirectInputCreateEx(
 	HINSTANCE hinst, DWORD dwVersion, REFIID riid, LPVOID *ppDI,
-	LPUNKNOWN punkOuter) 
+	LPUNKNOWN punkOuter)
 {
 IDirectInputImpl* This;
 
@@ -282,7 +282,7 @@ static HRESULT WINAPI IDirectInputAImpl_EnumDevices(
 	}
 	}
 }
-
+
 return 0;
 }
 /**
@@ -290,7 +290,7 @@ static HRESULT WINAPI IDirectInputAImpl_EnumDevices(
  */
 static HRESULT WINAPI IDirectInputWImpl_EnumDevices(
 	LPDIRECTINPUT7W iface, DWORD dwDevType, LPDIENUMDEVICESCALLBACKW lpCallback,
-	LPVOID pvRef, DWORD dwFlags) 
+	LPVOID pvRef, DWORD dwFlags)
 {
 IDirectInputImpl *This = impl_from_IDirectInput7W( iface );
 DIDEVICEINSTA

Re: ddraw: Add tests for SetCooperativeLevel

2011-05-29 Thread Marvin
Hi,

While running your changed tests on Windows, I think I found new failures.
Being a bot and all I'm not very good at pattern recognition, so I might be
wrong, but could you please double-check?
Full results can be found at
http://testbot.winehq.org/JobDetails.pl?Key=11295

Your paranoid android.


=== W7PROX64 (64 bit ddrawmodes) ===
Timeout




Re: NTDLL doesn't compile under Clang

2011-05-29 Thread Marcus Meissner
On Sun, May 29, 2011 at 12:43:35PM -0600, Charles Davis wrote:
> On 5/29/11 12:41 PM, C.W. Betts wrote:
> > When compiling the NTDLL component of Wine, I get the following error:
> > ../../../wine-git/./dlls/ntdll/large_int.c:267:13: error: unknown use of
> >   instruction mnemonic without a size suffix
> > __asm__("div %4,%%eax"
> > ^
> > :1:2: note: instantiated into assembly here
> > div 12(%esp),%eax
> > ^
> > I'm using Clang 2.0 from Xcode 4.0
> That's a Clang bug that's already been fixed. Sadly, it didn't make it
> into Xcode 4.0.

Try this patch?

Ciao, Marcus

Subject: [PATCH] ntdll: specify div to be divl

Hi,

avoids a clang build issue.

Ciao, Marcus
---
 dlls/ntdll/large_int.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/dlls/ntdll/large_int.c b/dlls/ntdll/large_int.c
index cb98bae..54ce6b0 100644
--- a/dlls/ntdll/large_int.c
+++ b/dlls/ntdll/large_int.c
@@ -264,7 +264,7 @@ UINT WINAPI RtlEnlargedUnsignedDivide( ULONGLONG a, UINT b, 
UINT *remptr )
 p1 = a >> 32;
 p2 = a &  0xLL;
 
-__asm__("div %4,%%eax"
+__asm__("divl %4,%%eax"
 : "=a" (ret), "=d" (rem)
 : "0" (p2), "1" (p1), "g" (b) );
 if (remptr) *remptr = rem;
-- 
1.7.3.4





Re: NTDLL doesn't compile under Clang

2011-05-29 Thread Charles Davis
On 5/29/11 12:41 PM, C.W. Betts wrote:
> When compiling the NTDLL component of Wine, I get the following error:
> ../../../wine-git/./dlls/ntdll/large_int.c:267:13: error: unknown use of
>   instruction mnemonic without a size suffix
> __asm__("div %4,%%eax"
> ^
> :1:2: note: instantiated into assembly here
> div 12(%esp),%eax
> ^
> I'm using Clang 2.0 from Xcode 4.0
That's a Clang bug that's already been fixed. Sadly, it didn't make it
into Xcode 4.0.

Chip





NTDLL doesn't compile under Clang

2011-05-29 Thread C.W. Betts
When compiling the NTDLL component of Wine, I get the following error:
../../../wine-git/./dlls/ntdll/large_int.c:267:13: error: unknown use of
  instruction mnemonic without a size suffix
__asm__("div %4,%%eax"
^
:1:2: note: instantiated into assembly here
div 12(%esp),%eax
^
I'm using Clang 2.0 from Xcode 4.0




Re: GSoC-2011: Implement Missing Mesh Functions in Wine’s D3DX9

2011-05-29 Thread Michael Mc Donnell
On Sat, May 28, 2011 at 10:08 PM, Stefan Dösinger
 wrote:
> On Saturday 28 May 2011 19:55:55 you wrote:
>
>> It was implemented by setting the vertex declaration to null when the
>> declaration is invalid. That seems to match what happens on Windows,
>> because if a program has set an invalid declaration and then calls
>> GetDeclaration or DrawSubset it will fail with an access violation.
>> Should Wine also fail with an access violation or should it be
>> slightly more graceful and return E_FAIL instead (which my new patch
>> does)?
> Yes, I think returning E_FAIL is a good idea, but write a WARN if
> CreateVertexDeclaration fails or when you catch a NULL vdecl. A WARN will not
> be shown by default(unlike a FIXME), it is used when the app does something
> fishy but you think you handled it correctly.
>
>> +    if (FAILED(hr))
>> +        new_vertex_declaration = NULL;
>> +
>> +    /* Free old vertex declaration */
>> +    if (This->vertex_declaration)
>> +        IDirect3DVertexDeclaration9_Release(This->vertex_declaration);
> In this situation you can just release the old decl before calling
> CreateVertexDeclaration and pass &This->vertex_declaration to CreateVdecl.
> That simplified the code a bit. Don't forget to set This->vertex_declaration 
> to
> NULL in case of an error though

Ok I've simplified the code. I've also inserted three WARNs. I've
skipped a WARN when freeing the mesh because that works fine on
Windows with an invalid declaration.

>> +    /* Set the position type to color instead of float3 (invalid
> declaration) */
>> +    hr = mesh->lpVtbl->UpdateSemantics(mesh, declaration_wrong_type_color);
>> +    todo_wine ok(hr == D3D_OK, "Test UpdateSematics wrong type color, "
>> +        "got %#x expected D3D_OK\n", hr);
> Is this really invalid? I don't know it on top of my head, but in general
> types and usage are independent, especially with shaders. I don't see a check
> in d3d9 or wined3d for this case.

You're right it isn't invalid. It doesn't crash, it just doesn't draw
anything. I've change that comment and re-ordered the tests.

> Beyond that I think the patches look OK. I'd recommend to send them to wine-
> devel one more time and then next week to wine-patches. Henri is on Vacation
> this week, and he's usually more picky than I am. I also hope some of the
> people who regularly contribute to d3dx9 will have a look and comment.

Ok, I've attached the newest version. I'll let the patches sit here
for a week, and start working on the other functions in the mean time.
diff --git a/dlls/d3dx9_36/tests/mesh.c b/dlls/d3dx9_36/tests/mesh.c
index cedef32..975c0e8 100644
--- a/dlls/d3dx9_36/tests/mesh.c
+++ b/dlls/d3dx9_36/tests/mesh.c
@@ -2,6 +2,7 @@
  * Copyright 2008 David Adam
  * Copyright 2008 Luis Busquets
  * Copyright 2009 Henri Verbeet for CodeWeavers
+ * Copyright 2011 Michael Mc Donnell
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -61,6 +62,93 @@ static BOOL compare_face(face a, face b)
 return (a[0]==b[0] && a[1] == b[1] && a[2] == b[2]);
 }
 
+struct TestContext
+{
+HWND hwnd;
+IDirect3D9 *d3d;
+IDirect3DDevice9 *device;
+};
+
+/*
+ * Initializes a TestContext. Use this to initialize DirectX.
+ *
+ * Returns NULL if an error occured.
+ */
+static struct TestContext* NewTestContext(void)
+{
+HRESULT hr;
+HWND hwnd = NULL;
+IDirect3D9 *d3d = NULL;
+IDirect3DDevice9 *device = NULL;
+D3DPRESENT_PARAMETERS d3dpp = {0};
+struct TestContext *testContext;
+
+hwnd = CreateWindow("static", "d3dx9_test", 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL);
+if (!hwnd)
+{
+skip("Couldn't create application window\n");
+goto error;
+}
+
+d3d = Direct3DCreate9(D3D_SDK_VERSION);
+if (!d3d)
+{
+skip("Couldn't create IDirect3D9 object\n");
+goto error;
+}
+
+memset(&d3dpp, 0, sizeof(d3dpp));
+d3dpp.Windowed = TRUE;
+d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
+hr = IDirect3D9_CreateDevice(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hwnd, D3DCREATE_MIXED_VERTEXPROCESSING, &d3dpp, &device);
+if (FAILED(hr))
+{
+skip("Couldn't create IDirect3DDevice9 object %#x\n", hr);
+goto error;
+}
+
+testContext = HeapAlloc(GetProcessHeap(), 0, sizeof(struct TestContext));
+if (!testContext)
+{
+skip("Couldn't allocate memory for TestContext\n");
+goto error;
+}
+testContext->hwnd = hwnd;
+testContext->d3d = d3d;
+testContext->device = device;
+
+return testContext;
+
+error:
+if (device)
+IDirect3DDevice9_Release(device);
+
+if (d3d)
+IDirect3D9_Release(d3d);
+
+if (hwnd)
+DestroyWindow(hwnd);
+
+return NULL;
+}
+
+static void FreeTestContext(struct TestContext *testContext)
+{
+if (!testContext)
+return;
+
+if (testContext->device)
+IDirect3DDevice9_Release(testContext->device

Re: [7/8] d3d8: Use D3DRENDERSTATETYPE -> WINED3DRENDERSTATETYPE enum conversion function instead of implicit conversion (clang)

2011-05-29 Thread Stefan Dösinger
On Sunday 29 May 2011 09:46:10 Frédéric Delanoy wrote:

>  default:
> -hr = wined3d_device_set_render_state(This->wined3d_device,
> State, Value);
> +hr =
> wined3d_device_set_render_state(This->wined3d_device, +   
> wined3drenderstatetype_from_d3drenderstatetype(State), Value); }
>  wined3d_mutex_unlock();
d3d8's SetRenderState and GetRenderState already have a switch-case statement 
because ZBIAS doesn't exist in wined3d, so strictly speaking a direct cast is 
not possible. You cannot move the switch-case from SetRenderState to the state 
conversion function because the meaning of the Value parameter is different 
between D3DRS_ZBIAS and WINED3DRS_DEPTHBIAS. So I'd suggest to put the cast 
into the default cases of d3ddevice8::SetRenderState and 
d3device8::GetRenderState

In d3d9 you can cast between the d3d9 and wined3d render state types.


signature.asc
Description: This is a digitally signed message part.