Re: GSoC: dinput8 Action Mapping

2011-07-19 Thread Lucas Zawacki
Hey, I've got a couple patches implementing build and setactionmap for
joysticks and I'd like you guys to give them a look.

These implementations are very generic and I think I could use them
for the keyboard and the mouse too. If everything's alright with these
patches that'll be my next step.

The mapping can be tested this small app I built:
https://github.com/downloads/lfzawacki/dinput-samples/dolphin.exe
provided that you have one joystick attached (it will chose the first
one if there are more).

Cheers :)

2011/7/5 Lucas Zawacki :
> Hi guys.
>
> Now that all the initial patches are in I have several smaller tasks
> to work on as listed here
> http://lfzawacki.heroku.com/wine/published/Road+Map and hopefully
> they're more straightforward. I've already started working on getting
> EnumDevicesBySemantics  correct with joysticks and the passed flags
> and, after that, BuildActionMap for the joysticks will follow. Maybe
> now it's time to discuss how to implement EnumDevicesBySemantics as a
> crosscall, but I really don't know how to do it (or if it's worth it)
> and everywhere I look in dinput I see similar cases of this
> "duplication pattern".
>
> Another thing that I've been thinking is that I might as well end up
> rolling a version of ConfigureDevices
> (http://msdn.microsoft.com/en-us/library/microsoft.directx_sdk.idirectinput8.idirectinput8.configuredevices%28v=VS.85%29.aspx)
> because so far I've seen two of the games affected by bug 8754 use it
> to configure controls. I've not had time to find and test all of them,
> but if someone on the list knows about other games that use it I'd
> like to be informed.
>
> Last but not least, thanks for Wylda for testing NFSU and keeping bug
> 8754 informed. I actually can't run the game properly, most likely
> because of the crappy intel graphics card in my laptop.
>
> Anyway, feedback on the tasks is welcome.
>
> ---
> lfz
>
From b492c54d5ca7179e0905f63cec183d0920555e1d Mon Sep 17 00:00:00 2001
From: Lucas Fialho Zawacki 
Date: Tue, 19 Jul 2011 17:52:12 -0300
Subject: [PATCH 1/4] dinput: EnumDevicesBySemantics enumerating joysticks with priority flags

Added an utility function that checks the priority of a device for a given mapping. This can be modified later to return priority 2 mappings, if necessary.
---
 dlls/dinput/dinput_main.c |   50 
 1 files changed, 36 insertions(+), 14 deletions(-)

diff --git a/dlls/dinput/dinput_main.c b/dlls/dinput/dinput_main.c
index b653307..1d59cdc 100644
--- a/dlls/dinput/dinput_main.c
+++ b/dlls/dinput/dinput_main.c
@@ -317,6 +317,38 @@ void _copy_diactionformatWtoA(LPDIACTIONFORMATA to, LPDIACTIONFORMATW from)
 }
 }
 
+/* _diactionformat_priorityA
+ *
+ *  Given a DIACTIONFORMAT structure and a DI genre, returns the enumeration
+ *  priority. Joysticks should pass the game genre, and mouse or keyboard their
+ *  respective DI*_MASK
+ */
+static DWORD _diactionformat_priorityA(LPDIACTIONFORMATA lpdiaf, DWORD genre)
+{
+int i;
+DWORD priorityFlags = 0;
+
+/* If there's at least one action for the device it's priority 1 */
+for(i=0; i < lpdiaf->dwActionSize; i++)
+if ((lpdiaf->rgoAction[i].dwSemantic & genre) == genre)
+priorityFlags |= DIEDBS_MAPPEDPRI1;
+
+return priorityFlags;
+}
+
+static DWORD _diactionformat_priorityW(LPDIACTIONFORMATW lpdiaf, DWORD genre)
+{
+int i;
+DWORD priorityFlags = 0;
+
+/* If there's at least one action for the device it's priority 1 */
+for(i=0; i < lpdiaf->dwActionSize; i++)
+if ((lpdiaf->rgoAction[i].dwSemantic & genre) == genre)
+priorityFlags |= DIEDBS_MAPPEDPRI1;
+
+return priorityFlags;
+}
+
 /**
  *	IDirectInputA_EnumDevices
  */
@@ -877,7 +909,7 @@ static HRESULT WINAPI IDirectInput8AImpl_EnumDevicesBySemantics(
 {
 TRACE(" - checking device %u ('%s')\n", i, dinput_devices[i]->name);
 
-callbackFlags = 0;
+callbackFlags = _diactionformat_priorityA(lpdiActionFormat, lpdiActionFormat->dwGenre);
 /* Default behavior is to enumerate attached game controllers */
 enumSuccess = dinput_devices[i]->enum_deviceA(DI8DEVCLASS_GAMECTRL, DIEDFL_ATTACHEDONLY | dwFlags, &didevi, This->dwVersion, j);
 if (enumSuccess)
@@ -895,16 +927,11 @@ static HRESULT WINAPI IDirectInput8AImpl_EnumDevicesBySemantics(
 /* Enumerate keyboard and mouse */
 for(i=0; i < sizeof(guids)/sizeof(guids[0]); i++)
 {
-callbackFlags = 0;
+callbackFlags = _diactionformat_priorityA(lpdiActionFormat, actionMasks[i]);
 
 IDirectInput_CreateDevice(iface, guids[i], &lpdid, NULL);
 IDirectInputDevice_GetDeviceInfo(lpdid, &didevi);
 
-/* If there's at least one action for the device it's priority 1 */
-for(j=0; j < lpdiActionFormat->dwActionSize; j++)
-if ((lpdiActionFormat->rgo

Re: [PATCH 2/2] ntdll: Set restart_scan on first call to NtQueryDirectoryFile.

2011-07-19 Thread Alexandre Julliard
Grazvydas Ignotas  writes:

> What about abusing F_GETFD/F_SETFD FD_CLOEXEC flag on file descriptor then?

No, we need it to be always set.

-- 
Alexandre Julliard
julli...@winehq.org




Re: [PATCH 2/2] ntdll: Set restart_scan on first call to NtQueryDirectoryFile.

2011-07-19 Thread Grazvydas Ignotas
On Tue, Jul 19, 2011 at 12:39 PM, Alexandre Julliard
 wrote:
> Grazvydas Ignotas  writes:
>> ok, what about expanding fd cache in dlls/ntdll/server.c with some
>> functions to allow attaching a pointer to a handle? That would
>> increase cache memory usage though, but perhaps something else could
>> use this too..
>
> Handles can be shared across processes.

What about abusing F_GETFD/F_SETFD FD_CLOEXEC flag on file descriptor then?


-- 
Gražvydas




Re: [PATCH 10/10] ntdll/tests: add a number of tests for the Nt pipe functions and ioctls

2011-07-19 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=12606

Your paranoid android.


=== WNT4WSSP6 (32 bit pipe) ===
Timeout




Re: d3dx9_36: Use SUCCEEDED instead of !FAILED.

2011-07-19 Thread Michael Stefaniuc
Matteo Bruni wrote:
> 2011/7/19 Michael Stefaniuc :
>> ---
>>  dlls/d3dx9_36/mesh.c |2 +-
>>  1 files changed, 1 insertions(+), 1 deletions(-)
>>
>> diff --git a/dlls/d3dx9_36/mesh.c b/dlls/d3dx9_36/mesh.c
>> index 94a291f..d8f72c4 100644
>> --- a/dlls/d3dx9_36/mesh.c
>> +++ b/dlls/d3dx9_36/mesh.c
>> @@ -3376,7 +3376,7 @@ HRESULT WINAPI D3DXLoadMeshFromXResource(HMODULE 
>> module,
>> if (!resinfo) return D3DXERR_INVALIDDATA;
>>
>> hr = load_resource_into_memory(module, resinfo, &buffer, &size);
>> -if (!FAILED(hr)) return D3DXERR_INVALIDDATA;
>> +if (SUCCEEDED(hr)) return D3DXERR_INVALIDDATA;
>>
>> return D3DXLoadMeshFromXInMemory(buffer, size, options, device, 
>> adjacency,
>> materials, effect_instances, num_materials, mesh);
>> --
>> 1.7.6
>>
>>
>>
> 
> Isn't that supposed to be "if (FAILED(hr))" ? If I'm not mistaken, now
> it is returning failure when the resource is correctly loaded...
> 
> Thumbs up for Michael's scripts finding real bugs ;)
Shame on me for not noticing that :(
Please submit a fixed patch as I don't want to claim credit for it.

thanks
bye
michael




Re: d3dx9_36: Use SUCCEEDED instead of !FAILED.

2011-07-19 Thread Matteo Bruni
2011/7/19 Michael Stefaniuc :
> ---
>  dlls/d3dx9_36/mesh.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/dlls/d3dx9_36/mesh.c b/dlls/d3dx9_36/mesh.c
> index 94a291f..d8f72c4 100644
> --- a/dlls/d3dx9_36/mesh.c
> +++ b/dlls/d3dx9_36/mesh.c
> @@ -3376,7 +3376,7 @@ HRESULT WINAPI D3DXLoadMeshFromXResource(HMODULE module,
>     if (!resinfo) return D3DXERR_INVALIDDATA;
>
>     hr = load_resource_into_memory(module, resinfo, &buffer, &size);
> -    if (!FAILED(hr)) return D3DXERR_INVALIDDATA;
> +    if (SUCCEEDED(hr)) return D3DXERR_INVALIDDATA;
>
>     return D3DXLoadMeshFromXInMemory(buffer, size, options, device, adjacency,
>             materials, effect_instances, num_materials, mesh);
> --
> 1.7.6
>
>
>

Isn't that supposed to be "if (FAILED(hr))" ? If I'm not mistaken, now
it is returning failure when the resource is correctly loaded...

Thumbs up for Michael's scripts finding real bugs ;)




Re: use Lithuanian letter in my name

2011-07-19 Thread max

On 07/19/2011 03:54 AM, Frédéric Delanoy wrote:

On Mon, Jul 18, 2011 at 23:53, Nerijus Baliunas
  wrote:

---
  AUTHORS |2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)

Maybe you should ensure that the name you commit your patches with
(foo in 'foo') is correctly spelled as well. I believe the
authors list is generated from wine git's patch authors

Frédéric

Having looked at some of the code that generates 'contributor' lists 
recently, (specifically tools/c2man.pl), the information is taken from 
the 'copyright' lines in the source files.  At least in the case of 
c2man, the git logs are not consulted.


Max





Re: use Lithuanian letter in my name

2011-07-19 Thread Nerijus Baliūnas
On Tue, 19 Jul 2011 09:54:49 +0200 Frédéric Delanoy 
 wrote:

> On Mon, Jul 18, 2011 at 23:53, Nerijus Baliunas
>  wrote:
> > ---
> >  AUTHORS |    2 +-
> >  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> Maybe you should ensure that the name you commit your patches with
> (foo in 'foo ') is correctly spelled as well. I believe the
> authors list is generated from wine git's patch authors

OK, resent the patch.

Regards,
Nerijus




Re: [PATCH 2/2] ntdll: Set restart_scan on first call to NtQueryDirectoryFile.

2011-07-19 Thread Alexandre Julliard
Grazvydas Ignotas  writes:

> ok, what about expanding fd cache in dlls/ntdll/server.c with some
> functions to allow attaching a pointer to a handle? That would
> increase cache memory usage though, but perhaps something else could
> use this too..

Handles can be shared across processes.

-- 
Alexandre Julliard
julli...@winehq.org




Re: use Lithuanian letter in my name

2011-07-19 Thread Frédéric Delanoy
On Mon, Jul 18, 2011 at 23:53, Nerijus Baliunas
 wrote:
> ---
>  AUTHORS |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)

Maybe you should ensure that the name you commit your patches with
(foo in 'foo ') is correctly spelled as well. I believe the
authors list is generated from wine git's patch authors

Frédéric