winehq.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
January
2003
December
November
October
September
August
July
June
May
April
March
February
January
2002
December
November
October
September
August
July
June
May
April
March
February
January
2001
December
November
October
September
August
July
June
May
April
March
February
List overview
wine-commits
February 2018
----- 2025 -----
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
wine-commits@winehq.org
2 participants
804 discussions
Start a n
N
ew thread
Alexandre Julliard : server: Implement the various image flags in SECTION_IMAGE_INFORMATION.
by Alexandre Julliard
15 Feb '18
15 Feb '18
Module: wine Branch: master Commit: 4a2ad423a62c90036707bc3e5f91611b37e5e451 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=4a2ad423a62c90036707bc3e…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Thu Feb 15 12:22:43 2018 +0100 server: Implement the various image flags in SECTION_IMAGE_INFORMATION. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/kernel32/tests/loader.c | 6 ---- server/mapping.c | 77 +++++++++++++++++++++++++++++++++++++------- 2 files changed, 65 insertions(+), 18 deletions(-) Diff:
https://source.winehq.org/git/wine.git/?a=commitdiff;h=4a2ad423a62c90036707…
1
0
0
0
Alexandre Julliard : kernel32/tests: Add some tests for CIL 32-bit image flags.
by Alexandre Julliard
15 Feb '18
15 Feb '18
Module: wine Branch: master Commit: 2df367a4f7e84a5c97d26ae326167755c7197207 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=2df367a4f7e84a5c97d26ae3…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Thu Feb 15 08:07:09 2018 +0100 kernel32/tests: Add some tests for CIL 32-bit image flags. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/kernel32/tests/loader.c | 29 ++++++++++++++++++++++++++++- include/winnt.h | 3 ++- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/dlls/kernel32/tests/loader.c b/dlls/kernel32/tests/loader.c index b4fb1c6..877d381 100644 --- a/dlls/kernel32/tests/loader.c +++ b/dlls/kernel32/tests/loader.c @@ -405,7 +405,8 @@ static BOOL query_image_section( int id, const char *dll_name, const IMAGE_NT_HE todo_wine ok( S(U(image)).ComPlusILOnly || broken(is_winxp), "%u: wrong ComPlusILOnly flags %02x\n", id, U(image).ImageFlags ); - if (nt_header->OptionalHeader.Magic == IMAGE_NT_OPTIONAL_HDR32_MAGIC) + if (nt_header->OptionalHeader.Magic == IMAGE_NT_OPTIONAL_HDR32_MAGIC && + !(cor_header->Flags & COMIMAGE_FLAGS_32BITREQUIRED)) todo_wine ok( S(U(image)).ComPlusNativeReady || broken(is_winxp), "%u: wrong ComPlusNativeReady flags %02x\n", id, U(image).ImageFlags ); @@ -1019,6 +1020,14 @@ static void test_Loader(void) status = map_image_section( &nt_header, §ion, &cor_header, __LINE__ ); ok( status == STATUS_SUCCESS, "NtCreateSection error %08x\n", status ); + cor_header.Flags = COMIMAGE_FLAGS_ILONLY | COMIMAGE_FLAGS_32BITREQUIRED; + status = map_image_section( &nt_header, §ion, &cor_header, __LINE__ ); + ok( status == STATUS_SUCCESS, "NtCreateSection error %08x\n", status ); + + cor_header.Flags = COMIMAGE_FLAGS_ILONLY | COMIMAGE_FLAGS_32BITPREFERRED; + status = map_image_section( &nt_header, §ion, &cor_header, __LINE__ ); + ok( status == STATUS_SUCCESS, "NtCreateSection error %08x\n", status ); + cor_header.Flags = 0; status = map_image_section( &nt_header, §ion, &cor_header, __LINE__ ); ok( status == STATUS_SUCCESS, "NtCreateSection error %08x\n", status ); @@ -1122,6 +1131,16 @@ static void test_Loader(void) ok( status == (is_wow64 ? STATUS_SUCCESS : STATUS_INVALID_IMAGE_WIN_64), "NtCreateSection error %08x\n", status ); + cor_header.Flags = COMIMAGE_FLAGS_ILONLY | COMIMAGE_FLAGS_32BITREQUIRED; + status = map_image_section( (IMAGE_NT_HEADERS *)&nt64, §ion, &cor_header, __LINE__ ); + ok( status == (is_wow64 ? STATUS_SUCCESS : STATUS_INVALID_IMAGE_WIN_64), + "NtCreateSection error %08x\n", status ); + + cor_header.Flags = COMIMAGE_FLAGS_ILONLY | COMIMAGE_FLAGS_32BITPREFERRED; + status = map_image_section( (IMAGE_NT_HEADERS *)&nt64, §ion, &cor_header, __LINE__ ); + ok( status == (is_wow64 ? STATUS_SUCCESS : STATUS_INVALID_IMAGE_WIN_64), + "NtCreateSection error %08x\n", status ); + cor_header.Flags = 0; status = map_image_section( (IMAGE_NT_HEADERS *)&nt64, §ion, &cor_header, __LINE__ ); ok( status == (is_wow64 ? STATUS_SUCCESS : STATUS_INVALID_IMAGE_WIN_64), @@ -1218,6 +1237,14 @@ static void test_Loader(void) status = map_image_section( (IMAGE_NT_HEADERS *)&nt32, §ion, &cor_header, __LINE__ ); ok( status == STATUS_SUCCESS, "NtCreateSection error %08x\n", status ); + cor_header.Flags = COMIMAGE_FLAGS_ILONLY | COMIMAGE_FLAGS_32BITREQUIRED; + status = map_image_section( (IMAGE_NT_HEADERS *)&nt32, §ion, &cor_header, __LINE__ ); + ok( status == STATUS_SUCCESS, "NtCreateSection error %08x\n", status ); + + cor_header.Flags = COMIMAGE_FLAGS_ILONLY | COMIMAGE_FLAGS_32BITPREFERRED; + status = map_image_section( (IMAGE_NT_HEADERS *)&nt32, §ion, &cor_header, __LINE__ ); + ok( status == STATUS_SUCCESS, "NtCreateSection error %08x\n", status ); + cor_header.Flags = 0; status = map_image_section( (IMAGE_NT_HEADERS *)&nt32, §ion, &cor_header, __LINE__ ); ok( status == STATUS_SUCCESS, "NtCreateSection error %08x\n", status ); diff --git a/include/winnt.h b/include/winnt.h index 855d2a8..56b533c 100644 --- a/include/winnt.h +++ b/include/winnt.h @@ -3621,10 +3621,11 @@ typedef enum ReplacesCorHdrNumericDefines COMIMAGE_FLAGS_STRONGNAMESIGNED = 0x00000008, COMIMAGE_FLAGS_NATIVE_ENTRYPOINT= 0x00000010, COMIMAGE_FLAGS_TRACKDEBUGDATA = 0x00010000, + COMIMAGE_FLAGS_32BITPREFERRED = 0x00020000, COR_VERSION_MAJOR_V2 = 2, COR_VERSION_MAJOR = COR_VERSION_MAJOR_V2, - COR_VERSION_MINOR = 0, + COR_VERSION_MINOR = 5, COR_DELETED_NAME_LENGTH = 8, COR_VTABLEGAP_NAME_LENGTH = 8,
1
0
0
0
Aric Stewart : xinput: Implement XInputEnable.
by Alexandre Julliard
15 Feb '18
15 Feb '18
Module: wine Branch: master Commit: 50e53643300da159a7680fb862a4f4c747a12697 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=50e53643300da159a7680fb8…
Author: Aric Stewart <aric(a)codeweavers.com> Date: Wed Feb 14 12:42:00 2018 -0600 xinput: Implement XInputEnable. Signed-off-by: Aric Stewart <aric(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/xinput1_3/hid.c | 59 ++++++++++++++++++++++++++++++++--------- dlls/xinput1_3/xinput_main.c | 12 ++++++++- dlls/xinput1_3/xinput_private.h | 1 + 3 files changed, 58 insertions(+), 14 deletions(-) diff --git a/dlls/xinput1_3/hid.c b/dlls/xinput1_3/hid.c index 33a92e1..3c54890 100644 --- a/dlls/xinput1_3/hid.c +++ b/dlls/xinput1_3/hid.c @@ -63,6 +63,7 @@ struct hid_platform_private { PHIDP_PREPARSED_DATA ppd; HANDLE device; WCHAR *device_path; + BOOL enabled; CRITICAL_SECTION crit; @@ -212,6 +213,7 @@ static void build_private(struct hid_platform_private *private, PHIDP_PREPARSED_ size = (strlenW(path) + 1) * sizeof(WCHAR); private->device_path = HeapAlloc(GetProcessHeap(), 0, size); memcpy(private->device_path, path, size); + private->enabled = TRUE; InitializeCriticalSection(&private->crit); private->crit.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": JoystickImpl*->generic.base.crit"); @@ -351,6 +353,9 @@ void HID_update_state(xinput_controller* device) ULONG button_length; ULONG value; + if (!private->enabled) + return; + EnterCriticalSection(&private->crit); if (!HidD_GetInputReport(private->device, target_report, private->report_length)) { @@ -431,25 +436,53 @@ DWORD HID_set_state(xinput_controller* device, XINPUT_VIBRATION* state) if (device->caps.Flags & XINPUT_CAPS_FFB_SUPPORTED) { - BOOLEAN rc; - device->caps.Vibration.wLeftMotorSpeed = state->wLeftMotorSpeed; device->caps.Vibration.wRightMotorSpeed = state->wRightMotorSpeed; - report.report = 0; - report.pad1[0] = 0x8; - report.pad1[1] = 0x0; - report.left = (BYTE)(state->wLeftMotorSpeed / 255); - report.right = (BYTE)(state->wRightMotorSpeed / 255); - memset(&report.pad2, 0, sizeof(report.pad2)); + if (private->enabled) + { + BOOLEAN rc; + + report.report = 0; + report.pad1[0] = 0x8; + report.pad1[1] = 0x0; + report.left = (BYTE)(state->wLeftMotorSpeed / 255); + report.right = (BYTE)(state->wRightMotorSpeed / 255); + memset(&report.pad2, 0, sizeof(report.pad2)); + + EnterCriticalSection(&private->crit); + rc = HidD_SetOutputReport(private->device, &report, sizeof(report)); + LeaveCriticalSection(&private->crit); + if (rc) + return ERROR_SUCCESS; + return GetLastError(); + } + return ERROR_SUCCESS; + } + + return ERROR_NOT_SUPPORTED; +} +void HID_enable(xinput_controller* device, BOOL enable) +{ + struct hid_platform_private *private = device->platform_private; + + if (device->caps.Flags & XINPUT_CAPS_FFB_SUPPORTED) + { EnterCriticalSection(&private->crit); - rc = HidD_SetOutputReport(private->device, &report, sizeof(report)); + if (private->enabled && !enable) + { + XINPUT_VIBRATION state; + state.wLeftMotorSpeed = 0; + state.wRightMotorSpeed = 0; + HID_set_state(device, &state); + } + else if (!private->enabled && enable) + { + HID_set_state(device, &device->caps.Vibration); + } LeaveCriticalSection(&private->crit); - if (rc) - return ERROR_SUCCESS; - return GetLastError(); } - return ERROR_NOT_SUPPORTED; + private->enabled = enable; } diff --git a/dlls/xinput1_3/xinput_main.c b/dlls/xinput1_3/xinput_main.c index 680aba3..46d9918 100644 --- a/dlls/xinput1_3/xinput_main.c +++ b/dlls/xinput1_3/xinput_main.c @@ -54,11 +54,21 @@ BOOL WINAPI DllMain(HINSTANCE inst, DWORD reason, LPVOID reserved) void WINAPI DECLSPEC_HOTPATCH XInputEnable(BOOL enable) { + int index; + + TRACE("(enable %d)\n", enable); + /* Setting to false will stop messages from XInputSetState being sent to the controllers. Setting to true will send the last vibration value (sent to XInputSetState) to the controller and allow messages to be sent */ - FIXME("(enable %d) Stub!\n", enable); + HID_find_gamepads(controllers); + + for (index = 0; index < XUSER_MAX_COUNT; index ++) + { + if (!controllers[index].connected) continue; + HID_enable(&controllers[index], enable); + } } DWORD WINAPI XInputSetState(DWORD index, XINPUT_VIBRATION* vibration) diff --git a/dlls/xinput1_3/xinput_private.h b/dlls/xinput1_3/xinput_private.h index c10f869..00888f4 100644 --- a/dlls/xinput1_3/xinput_private.h +++ b/dlls/xinput1_3/xinput_private.h @@ -30,3 +30,4 @@ void HID_find_gamepads(xinput_controller *devices) DECLSPEC_HIDDEN; void HID_destroy_gamepads(xinput_controller *devices) DECLSPEC_HIDDEN; void HID_update_state(xinput_controller* device) DECLSPEC_HIDDEN; DWORD HID_set_state(xinput_controller* device, XINPUT_VIBRATION* state) DECLSPEC_HIDDEN; +void HID_enable(xinput_controller* device, BOOL enable) DECLSPEC_HIDDEN;
1
0
0
0
Aric Stewart : xinput: Implement XInputSetState.
by Alexandre Julliard
15 Feb '18
15 Feb '18
Module: wine Branch: master Commit: f3391311f3f1b730df97b65cf5650301c5714d16 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=f3391311f3f1b730df97b65c…
Author: Aric Stewart <aric(a)codeweavers.com> Date: Wed Feb 14 12:41:44 2018 -0600 xinput: Implement XInputSetState. Signed-off-by: Aric Stewart <aric(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/xinput1_3/hid.c | 42 +++++++++++++++++++++++++++++++++++++++++ dlls/xinput1_3/xinput_main.c | 6 ++++-- dlls/xinput1_3/xinput_private.h | 1 + include/xinput.h | 2 ++ 4 files changed, 49 insertions(+), 2 deletions(-) diff --git a/dlls/xinput1_3/hid.c b/dlls/xinput1_3/hid.c index 5d82f05..33a92e1 100644 --- a/dlls/xinput1_3/hid.c +++ b/dlls/xinput1_3/hid.c @@ -192,6 +192,11 @@ static BOOL VerifyGamepad(PHIDP_PREPARSED_DATA ppd, XINPUT_CAPABILITIES *xinput_ xinput_caps->Type = XINPUT_DEVTYPE_GAMEPAD; xinput_caps->SubType = XINPUT_DEVSUBTYPE_GAMEPAD; + + value_caps_count = caps->NumberOutputValueCaps; + if (value_caps_count > 0) + xinput_caps->Flags |= XINPUT_CAPS_FFB_SUPPORTED; + return TRUE; } @@ -411,3 +416,40 @@ void HID_update_state(xinput_controller* device) device->state.Gamepad.bLeftTrigger = SCALE_BYTE(value, private->LeftTriggerRange); LeaveCriticalSection(&private->crit); } + +DWORD HID_set_state(xinput_controller* device, XINPUT_VIBRATION* state) +{ + struct hid_platform_private *private = device->platform_private; + + struct { + BYTE report; + BYTE pad1[2]; + BYTE left; + BYTE right; + BYTE pad2[3]; + } report; + + if (device->caps.Flags & XINPUT_CAPS_FFB_SUPPORTED) + { + BOOLEAN rc; + + device->caps.Vibration.wLeftMotorSpeed = state->wLeftMotorSpeed; + device->caps.Vibration.wRightMotorSpeed = state->wRightMotorSpeed; + + report.report = 0; + report.pad1[0] = 0x8; + report.pad1[1] = 0x0; + report.left = (BYTE)(state->wLeftMotorSpeed / 255); + report.right = (BYTE)(state->wRightMotorSpeed / 255); + memset(&report.pad2, 0, sizeof(report.pad2)); + + EnterCriticalSection(&private->crit); + rc = HidD_SetOutputReport(private->device, &report, sizeof(report)); + LeaveCriticalSection(&private->crit); + if (rc) + return ERROR_SUCCESS; + return GetLastError(); + } + + return ERROR_NOT_SUPPORTED; +} diff --git a/dlls/xinput1_3/xinput_main.c b/dlls/xinput1_3/xinput_main.c index 83ecb71..680aba3 100644 --- a/dlls/xinput1_3/xinput_main.c +++ b/dlls/xinput1_3/xinput_main.c @@ -63,14 +63,16 @@ void WINAPI DECLSPEC_HOTPATCH XInputEnable(BOOL enable) DWORD WINAPI XInputSetState(DWORD index, XINPUT_VIBRATION* vibration) { - FIXME("(index %u, vibration %p) Stub!\n", index, vibration); + TRACE("(index %u, vibration %p)\n", index, vibration); + + HID_find_gamepads(controllers); if (index >= XUSER_MAX_COUNT) return ERROR_BAD_ARGUMENTS; if (!controllers[index].connected) return ERROR_DEVICE_NOT_CONNECTED; - return ERROR_NOT_SUPPORTED; + return HID_set_state(&controllers[index], vibration); } DWORD WINAPI DECLSPEC_HOTPATCH XInputGetState(DWORD index, XINPUT_STATE* state) diff --git a/dlls/xinput1_3/xinput_private.h b/dlls/xinput1_3/xinput_private.h index 67ddbe4..c10f869 100644 --- a/dlls/xinput1_3/xinput_private.h +++ b/dlls/xinput1_3/xinput_private.h @@ -29,3 +29,4 @@ typedef struct _xinput_controller void HID_find_gamepads(xinput_controller *devices) DECLSPEC_HIDDEN; void HID_destroy_gamepads(xinput_controller *devices) DECLSPEC_HIDDEN; void HID_update_state(xinput_controller* device) DECLSPEC_HIDDEN; +DWORD HID_set_state(xinput_controller* device, XINPUT_VIBRATION* state) DECLSPEC_HIDDEN; diff --git a/include/xinput.h b/include/xinput.h index 99ff0cc..dae8cad 100644 --- a/include/xinput.h +++ b/include/xinput.h @@ -156,6 +156,8 @@ #define XUSER_MAX_COUNT 4 #define XUSER_INDEX_ANY 0x000000FF +#define XINPUT_CAPS_FFB_SUPPORTED 0x0001 + /* * Defines the structure of an xbox 360 joystick. */
1
0
0
0
Aric Stewart : xinput: Update state of HID device.
by Alexandre Julliard
15 Feb '18
15 Feb '18
Module: wine Branch: master Commit: 9e321a6f96714111c51466303caed89c9fabacf0 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=9e321a6f96714111c5146630…
Author: Aric Stewart <aric(a)codeweavers.com> Date: Wed Feb 14 12:41:33 2018 -0600 xinput: Update state of HID device. Signed-off-by: Aric Stewart <aric(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/xinput1_3/hid.c | 94 ++++++++++++++++++++++++++++++++++++++--- dlls/xinput1_3/xinput_main.c | 14 +++--- dlls/xinput1_3/xinput_private.h | 1 + 3 files changed, 96 insertions(+), 13 deletions(-) diff --git a/dlls/xinput1_3/hid.c b/dlls/xinput1_3/hid.c index 32a7ef5..5d82f05 100644 --- a/dlls/xinput1_3/hid.c +++ b/dlls/xinput1_3/hid.c @@ -66,9 +66,9 @@ struct hid_platform_private { CRITICAL_SECTION crit; - CHAR *last_report; - CHAR *current_report; DWORD report_length; + BYTE current_report; + CHAR *reports[2]; LONG ThumbLXRange[3]; LONG ThumbLYRange[3]; @@ -201,8 +201,9 @@ static void build_private(struct hid_platform_private *private, PHIDP_PREPARSED_ private->ppd = ppd; private->device = device; private->report_length = caps->InputReportByteLength + 1; - private->current_report = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, private->report_length); - private->last_report = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, private->report_length); + private->current_report = 0; + private->reports[0] = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, private->report_length); + private->reports[1] = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, private->report_length); size = (strlenW(path) + 1) * sizeof(WCHAR); private->device_path = HeapAlloc(GetProcessHeap(), 0, size); memcpy(private->device_path, path, size); @@ -309,8 +310,8 @@ static void remove_gamepad(xinput_controller *device) EnterCriticalSection(&private->crit); CloseHandle(private->device); - HeapFree(GetProcessHeap(), 0, private->current_report); - HeapFree(GetProcessHeap(), 0, private->last_report); + HeapFree(GetProcessHeap(), 0, private->reports[0]); + HeapFree(GetProcessHeap(), 0, private->reports[1]); HeapFree(GetProcessHeap(), 0, private->device_path); HidD_FreePreparsedData(private->ppd); device->platform_private = NULL; @@ -329,3 +330,84 @@ void HID_destroy_gamepads(xinput_controller *devices) remove_gamepad(&devices[i]); LeaveCriticalSection(&hid_xinput_crit); } + +#define SIGN(v,b) ((b==8)?(BYTE)v:(b==16)?(SHORT)v:(INT)v) +#define SCALE_SHORT(v,r) (SHORT)((((0xffff)*(SIGN(v,r[1]) - r[0]))/r[2])-32767) +#define SCALE_BYTE(v,r) (BYTE)((((0xff)*(SIGN(v,r[1]) - r[0]))/r[2])) + +void HID_update_state(xinput_controller* device) +{ + struct hid_platform_private *private = device->platform_private; + int i; + CHAR *report = private->reports[(private->current_report)%2]; + CHAR *target_report = private->reports[(private->current_report+1)%2]; + + USAGE buttons[15]; + ULONG button_length; + ULONG value; + + EnterCriticalSection(&private->crit); + if (!HidD_GetInputReport(private->device, target_report, private->report_length)) + { + if (GetLastError() == ERROR_ACCESS_DENIED || GetLastError() == ERROR_INVALID_HANDLE) + remove_gamepad(device); + else + ERR("Failed to get Input Report (%x)\n", GetLastError()); + LeaveCriticalSection(&private->crit); + return; + } + if (memcmp(report, target_report, private->report_length) == 0) + { + LeaveCriticalSection(&private->crit); + return; + } + + private->current_report = (private->current_report+1)%2; + + device->state.dwPacketNumber++; + button_length = 15; + HidP_GetUsages(HidP_Input, HID_USAGE_PAGE_BUTTON, 0, buttons, &button_length, private->ppd, target_report, private->report_length); + + device->state.Gamepad.wButtons = 0; + for (i = 0; i < button_length; i++) + { + switch (buttons[i]) + { + case 1: device->state.Gamepad.wButtons |= XINPUT_GAMEPAD_A; break; + case 2: device->state.Gamepad.wButtons |= XINPUT_GAMEPAD_B; break; + case 3: device->state.Gamepad.wButtons |= XINPUT_GAMEPAD_X; break; + case 4: device->state.Gamepad.wButtons |= XINPUT_GAMEPAD_Y; break; + case 5: device->state.Gamepad.wButtons |= XINPUT_GAMEPAD_LEFT_SHOULDER; break; + case 6: device->state.Gamepad.wButtons |= XINPUT_GAMEPAD_RIGHT_SHOULDER; break; + case 7: device->state.Gamepad.wButtons |= XINPUT_GAMEPAD_LEFT_THUMB; break; + case 8: device->state.Gamepad.wButtons |= XINPUT_GAMEPAD_RIGHT_THUMB; break; + + case 9: device->state.Gamepad.wButtons |= XINPUT_GAMEPAD_START; break; + case 10: device->state.Gamepad.wButtons |= XINPUT_GAMEPAD_BACK; break; + case 11: device->state.Gamepad.wButtons |= XINPUT_GAMEPAD_GUIDE; break; + case 12: device->state.Gamepad.wButtons |= XINPUT_GAMEPAD_DPAD_UP; break; + case 13: device->state.Gamepad.wButtons |= XINPUT_GAMEPAD_DPAD_DOWN; break; + case 14: device->state.Gamepad.wButtons |= XINPUT_GAMEPAD_DPAD_LEFT; break; + case 15: device->state.Gamepad.wButtons |= XINPUT_GAMEPAD_DPAD_RIGHT; break; + } + } + + HidP_GetUsageValue(HidP_Input, HID_USAGE_PAGE_GENERIC, 0, HID_USAGE_GENERIC_X, &value, private->ppd, target_report, private->report_length); + device->state.Gamepad.sThumbLX = SCALE_SHORT(value, private->ThumbLXRange); + + HidP_GetUsageValue(HidP_Input, HID_USAGE_PAGE_GENERIC, 0, HID_USAGE_GENERIC_Y, &value, private->ppd, target_report, private->report_length); + device->state.Gamepad.sThumbLY = -SCALE_SHORT(value, private->ThumbLYRange); + + HidP_GetUsageValue(HidP_Input, HID_USAGE_PAGE_GENERIC, 0, HID_USAGE_GENERIC_RX, &value, private->ppd, target_report, private->report_length); + device->state.Gamepad.sThumbRX = SCALE_SHORT(value, private->ThumbRXRange); + + HidP_GetUsageValue(HidP_Input, HID_USAGE_PAGE_GENERIC, 0, HID_USAGE_GENERIC_RY, &value, private->ppd, target_report, private->report_length); + device->state.Gamepad.sThumbRY = -SCALE_SHORT(value, private->ThumbRYRange); + + HidP_GetUsageValue(HidP_Input, HID_USAGE_PAGE_GENERIC, 0, HID_USAGE_GENERIC_RZ, &value, private->ppd, target_report, private->report_length); + device->state.Gamepad.bRightTrigger = SCALE_BYTE(value, private->RightTriggerRange); + + HidP_GetUsageValue(HidP_Input, HID_USAGE_PAGE_GENERIC, 0, HID_USAGE_GENERIC_Z, &value, private->ppd, target_report, private->report_length); + device->state.Gamepad.bLeftTrigger = SCALE_BYTE(value, private->LeftTriggerRange); + LeaveCriticalSection(&private->crit); +} diff --git a/dlls/xinput1_3/xinput_main.c b/dlls/xinput1_3/xinput_main.c index a796688..83ecb71 100644 --- a/dlls/xinput1_3/xinput_main.c +++ b/dlls/xinput1_3/xinput_main.c @@ -76,10 +76,8 @@ DWORD WINAPI XInputSetState(DWORD index, XINPUT_VIBRATION* vibration) DWORD WINAPI DECLSPEC_HOTPATCH XInputGetState(DWORD index, XINPUT_STATE* state) { DWORD ret; - static int warn_once; - if (!warn_once++) - FIXME("(index %u, state %p) Stub!\n", index, state); + TRACE("(index %u, state %p)!\n", index, state); ret = XInputGetStateEx(index, state); if (ret != ERROR_SUCCESS) @@ -93,17 +91,19 @@ DWORD WINAPI DECLSPEC_HOTPATCH XInputGetState(DWORD index, XINPUT_STATE* state) DWORD WINAPI DECLSPEC_HOTPATCH XInputGetStateEx(DWORD index, XINPUT_STATE* state) { - static int warn_once; + TRACE("(index %u, state %p)!\n", index, state); - if (!warn_once++) - FIXME("(index %u, state %p) Stub!\n", index, state); + HID_find_gamepads(controllers); if (index >= XUSER_MAX_COUNT) return ERROR_BAD_ARGUMENTS; if (!controllers[index].connected) return ERROR_DEVICE_NOT_CONNECTED; - return ERROR_NOT_SUPPORTED; + HID_update_state(&controllers[index]); + memcpy(state, &controllers[index].state, sizeof(XINPUT_STATE)); + + return ERROR_SUCCESS; } DWORD WINAPI XInputGetKeystroke(DWORD index, DWORD reserved, PXINPUT_KEYSTROKE keystroke) diff --git a/dlls/xinput1_3/xinput_private.h b/dlls/xinput1_3/xinput_private.h index 35414ac..67ddbe4 100644 --- a/dlls/xinput1_3/xinput_private.h +++ b/dlls/xinput1_3/xinput_private.h @@ -28,3 +28,4 @@ typedef struct _xinput_controller void HID_find_gamepads(xinput_controller *devices) DECLSPEC_HIDDEN; void HID_destroy_gamepads(xinput_controller *devices) DECLSPEC_HIDDEN; +void HID_update_state(xinput_controller* device) DECLSPEC_HIDDEN;
1
0
0
0
Aric Stewart : xinput: Detect and setup HID gamepads.
by Alexandre Julliard
15 Feb '18
15 Feb '18
Module: wine Branch: master Commit: 755422a2be2db4641ad33c9d41d5d0f0e9226e48 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=755422a2be2db4641ad33c9d…
Author: Aric Stewart <aric(a)codeweavers.com> Date: Wed Feb 14 12:40:59 2018 -0600 xinput: Detect and setup HID gamepads. Signed-off-by: Aric Stewart <aric(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/xinput1_1/Makefile.in | 2 + dlls/xinput1_2/Makefile.in | 2 + dlls/xinput1_3/Makefile.in | 2 + dlls/xinput1_3/hid.c | 331 ++++++++++++++++++++++++++++++++++++++++ dlls/xinput1_3/xinput_main.c | 27 ++-- dlls/xinput1_3/xinput_private.h | 30 ++++ dlls/xinput1_4/Makefile.in | 2 + dlls/xinput9_1_0/Makefile.in | 2 + 8 files changed, 387 insertions(+), 11 deletions(-) Diff:
https://source.winehq.org/git/wine.git/?a=commitdiff;h=755422a2be2db4641ad3…
1
0
0
0
Aric Stewart : winebus.sys: Be more specific as to what we offer as IG_ enumerated devices.
by Alexandre Julliard
15 Feb '18
15 Feb '18
Module: wine Branch: master Commit: e48296c2f02081d224505c90e645985f95b30d1d URL:
https://source.winehq.org/git/wine.git/?a=commit;h=e48296c2f02081d224505c90…
Author: Aric Stewart <aric(a)codeweavers.com> Date: Wed Feb 14 12:24:27 2018 -0600 winebus.sys: Be more specific as to what we offer as IG_ enumerated devices. Signed-off-by: Aric Stewart <aric(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/winebus.sys/bus.h | 1 + dlls/winebus.sys/bus_iohid.c | 48 +++++++++++++++++++++++++-- dlls/winebus.sys/bus_udev.c | 79 +++++++++++++++++++++++++++++++++----------- dlls/winebus.sys/main.c | 29 ++++++++++++++++ 4 files changed, 135 insertions(+), 22 deletions(-) diff --git a/dlls/winebus.sys/bus.h b/dlls/winebus.sys/bus.h index 34783f2..141e6d6 100644 --- a/dlls/winebus.sys/bus.h +++ b/dlls/winebus.sys/bus.h @@ -49,3 +49,4 @@ DEVICE_OBJECT* bus_enumerate_hid_devices(const platform_vtbl *vtbl, enum_func fu /* General Bus Functions */ DWORD check_bus_option(UNICODE_STRING *registry_path, const UNICODE_STRING *option, DWORD default_value) DECLSPEC_HIDDEN; +BOOL is_xbox_gamepad(WORD vid, WORD pid) DECLSPEC_HIDDEN; diff --git a/dlls/winebus.sys/bus_iohid.c b/dlls/winebus.sys/bus_iohid.c index 10635f8..501a40d 100644 --- a/dlls/winebus.sys/bus_iohid.c +++ b/dlls/winebus.sys/bus_iohid.c @@ -287,7 +287,7 @@ static void handle_DeviceMatchingCallback(void *context, IOReturn result, void * DWORD vid, pid, version; CFStringRef str = NULL; WCHAR serial_string[256]; - BOOL is_gamepad; + BOOL is_gamepad = FALSE; TRACE("OS/X IOHID Device Added %p\n", IOHIDDevice); @@ -297,8 +297,50 @@ static void handle_DeviceMatchingCallback(void *context, IOReturn result, void * str = IOHIDDeviceGetProperty(IOHIDDevice, CFSTR(kIOHIDSerialNumberKey)); if (str) CFStringToWSTR(str, serial_string, sizeof(serial_string) / sizeof(WCHAR)); - is_gamepad = (IOHIDDeviceConformsTo(IOHIDDevice, kHIDPage_GenericDesktop, kHIDUsage_GD_GamePad) || - IOHIDDeviceConformsTo(IOHIDDevice, kHIDPage_GenericDesktop, kHIDUsage_GD_Joystick)); + if (IOHIDDeviceConformsTo(IOHIDDevice, kHIDPage_GenericDesktop, kHIDUsage_GD_GamePad) || + IOHIDDeviceConformsTo(IOHIDDevice, kHIDPage_GenericDesktop, kHIDUsage_GD_Joystick)) + { + if (is_xbox_gamepad(vid, pid)) + is_gamepad = TRUE; + else + { + int axes=0, buttons=0; + CFArrayRef element_array = IOHIDDeviceCopyMatchingElements( + IOHIDDevice, NULL, kIOHIDOptionsTypeNone); + + if (element_array) { + CFIndex index; + CFIndex count = CFArrayGetCount(element_array); + for (index = 0; index < count; index++) + { + IOHIDElementRef element = (IOHIDElementRef)CFArrayGetValueAtIndex(element_array, index); + if (element) + { + int type = IOHIDElementGetType(element); + if (type == kIOHIDElementTypeInput_Button) buttons++; + if (type == kIOHIDElementTypeInput_Axis) axes++; + if (type == kIOHIDElementTypeInput_Misc) + { + uint32_t usage = IOHIDElementGetUsage(element); + switch (usage) + { + case kHIDUsage_GD_X: + case kHIDUsage_GD_Y: + case kHIDUsage_GD_Z: + case kHIDUsage_GD_Rx: + case kHIDUsage_GD_Ry: + case kHIDUsage_GD_Rz: + case kHIDUsage_GD_Slider: + axes ++; + } + } + } + } + CFRelease(element_array); + } + is_gamepad = (axes == 6 && buttons >= 14); + } + } device = bus_create_hid_device(iohid_driver_obj, busidW, vid, pid, version, 0, str?serial_string:NULL, is_gamepad, &GUID_DEVCLASS_IOHID, &iohid_vtbl, sizeof(struct platform_private)); if (!device) diff --git a/dlls/winebus.sys/bus_udev.c b/dlls/winebus.sys/bus_udev.c index f80c5d7..18e1854 100644 --- a/dlls/winebus.sys/bus_udev.c +++ b/dlls/winebus.sys/bus_udev.c @@ -439,13 +439,55 @@ static void set_rel_axis_value(struct wine_input_private *ext, int code, int val } } +static INT count_buttons(int device_fd, BYTE *map) +{ + int i; + int button_count = 0; + BYTE keybits[(KEY_MAX+7)/8]; + + if (ioctl(device_fd, EVIOCGBIT(EV_KEY, sizeof(keybits)), keybits) == -1) + { + WARN("ioctl(EVIOCGBIT, EV_KEY) failed: %d %s\n", errno, strerror(errno)); + return FALSE; + } + + for (i = BTN_MISC; i < KEY_MAX; i++) + { + if (test_bit(keybits, i)) + { + if (map) map[i] = button_count; + button_count++; + } + } + return button_count; +} + +static INT count_abs_axis(int device_fd) +{ + BYTE absbits[(ABS_MAX+7)/8]; + int abs_count = 0; + int i; + + if (ioctl(device_fd, EVIOCGBIT(EV_ABS, sizeof(absbits)), absbits) == -1) + { + WARN("ioctl(EVIOCGBIT, EV_ABS) failed: %d %s\n", errno, strerror(errno)); + return 0; + } + + for (i = 0; i < HID_ABS_MAX; i++) + if (test_bit(absbits, i) && + (ABS_TO_HID_MAP[i][1] >= HID_USAGE_GENERIC_X && + ABS_TO_HID_MAP[i][1] <= HID_USAGE_GENERIC_WHEEL)) + abs_count++; + return abs_count; +} + static BOOL build_report_descriptor(struct wine_input_private *ext, struct udev_device *dev) { int abs_pages[TOP_ABS_PAGE][HID_ABS_MAX+1]; int rel_pages[TOP_REL_PAGE][HID_REL_MAX+1]; BYTE absbits[(ABS_MAX+7)/8]; BYTE relbits[(REL_MAX+7)/8]; - BYTE keybits[(KEY_MAX+7)/8]; BYTE *report_ptr; INT i, descript_size; INT report_size; @@ -462,25 +504,12 @@ static BOOL build_report_descriptor(struct wine_input_private *ext, struct udev_ WARN("ioctl(EVIOCGBIT, EV_ABS) failed: %d %s\n", errno, strerror(errno)); return FALSE; } - if (ioctl(ext->base.device_fd, EVIOCGBIT(EV_KEY, sizeof(keybits)), keybits) == -1) - { - WARN("ioctl(EVIOCGBIT, EV_KEY) failed: %d %s\n", errno, strerror(errno)); - return FALSE; - } descript_size = sizeof(REPORT_HEADER) + sizeof(REPORT_TAIL); report_size = 0; /* For now lump all buttons just into incremental usages, Ignore Keys */ - button_count = 0; - for (i = BTN_MISC; i < KEY_MAX; i++) - { - if (test_bit(keybits, i)) - { - ext->button_map[i] = button_count; - button_count++; - } - } + button_count = count_buttons(ext->base.device_fd, ext->button_map); if (button_count) { descript_size += sizeof(REPORT_BUTTONS); @@ -1138,7 +1167,7 @@ static void try_add_device(struct udev_device *dev) const char *subsystem; const char *devnode; WCHAR *serial = NULL; - const char* gamepad = NULL; + BOOL is_gamepad = FALSE; int fd; if (!(devnode = udev_device_get_devnode(dev))) @@ -1188,7 +1217,6 @@ static void try_add_device(struct udev_device *dev) if (ioctl(fd, EVIOCGUNIQ(254), device_uid) >= 0 && device_uid[0]) serial = strdupAtoW(device_uid); - gamepad = udev_device_get_property_value(dev, "ID_INPUT_JOYSTICK"); vid = device_id.vendor; pid = device_id.product; version = device_id.version; @@ -1198,18 +1226,31 @@ static void try_add_device(struct udev_device *dev) WARN("Could not get device to query VID, PID, Version and Serial\n"); #endif + if (is_xbox_gamepad(vid, pid)) + is_gamepad = TRUE; +#ifdef HAS_PROPER_INPUT_HEADER + else + { + int axes=0, buttons=0; + axes = count_abs_axis(fd); + buttons = count_buttons(fd, NULL); + is_gamepad = (axes == 6 && buttons >= 14); + } +#endif + + TRACE("Found udev device %s (vid %04x, pid %04x, version %u, serial %s)\n", debugstr_a(devnode), vid, pid, version, debugstr_w(serial)); if (strcmp(subsystem, "hidraw") == 0) { - device = bus_create_hid_device(udev_driver_obj, hidraw_busidW, vid, pid, version, 0, serial, FALSE, + device = bus_create_hid_device(udev_driver_obj, hidraw_busidW, vid, pid, version, 0, serial, is_gamepad, &GUID_DEVCLASS_HIDRAW, &hidraw_vtbl, sizeof(struct platform_private)); } #ifdef HAS_PROPER_INPUT_HEADER else if (strcmp(subsystem, "input") == 0) { - device = bus_create_hid_device(udev_driver_obj, lnxev_busidW, vid, pid, version, 0, serial, (gamepad != NULL), + device = bus_create_hid_device(udev_driver_obj, lnxev_busidW, vid, pid, version, 0, serial, is_gamepad, &GUID_DEVCLASS_LINUXEVENT, &lnxev_vtbl, sizeof(struct wine_input_private)); } #endif diff --git a/dlls/winebus.sys/main.c b/dlls/winebus.sys/main.c index 87d05f0..6334477 100644 --- a/dlls/winebus.sys/main.c +++ b/dlls/winebus.sys/main.c @@ -43,6 +43,22 @@ WINE_DEFAULT_DEBUG_CHANNEL(plugplay); WINE_DECLARE_DEBUG_CHANNEL(hid_report); +#define VID_MICROSOFT 0x045e + +static const WORD PID_XBOX_CONTROLLERS[] = { + 0x0202, /* Xbox Controller */ + 0x0285, /* Xbox Controller S */ + 0x0289, /* Xbox Controller S */ + 0x028e, /* Xbox360 Controller */ + 0x028f, /* Xbox360 Wireless Controller */ + 0x02d1, /* Xbox One Controller */ + 0x02dd, /* Xbox One Controller (Covert Forces/Firmware 2015) */ + 0x02e3, /* Xbox One Elite Controller */ + 0x02e6, /* Wireless XBox Controller Dongle */ + 0x02ea, /* Xbox One S Controller */ + 0x0719, /* Xbox 360 Wireless Adapter */ +}; + struct pnp_device { struct list entry; @@ -673,6 +689,19 @@ DWORD check_bus_option(UNICODE_STRING *registry_path, const UNICODE_STRING *opti return output; } +BOOL is_xbox_gamepad(WORD vid, WORD pid) +{ + int i; + + if (vid != VID_MICROSOFT) + return FALSE; + + for (i = 0; i < sizeof(PID_XBOX_CONTROLLERS)/sizeof(*PID_XBOX_CONTROLLERS); i++) + if (pid == PID_XBOX_CONTROLLERS[i]) return TRUE; + + return FALSE; +} + NTSTATUS WINAPI DriverEntry( DRIVER_OBJECT *driver, UNICODE_STRING *path ) { static const WCHAR udevW[] = {'\\','D','r','i','v','e','r','\\','U','D','E','V',0};
1
0
0
0
Henri Verbeet : dxgi/tests: Introduce an ARRAY_SIZE macro.
by Alexandre Julliard
15 Feb '18
15 Feb '18
Module: wine Branch: master Commit: 8a167d85132d083fe5c90e4444c2871d938d8a4f URL:
https://source.winehq.org/git/wine.git/?a=commit;h=8a167d85132d083fe5c90e44…
Author: Henri Verbeet <hverbeet(a)codeweavers.com> Date: Thu Feb 15 09:53:19 2018 +0330 dxgi/tests: Introduce an ARRAY_SIZE macro. Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/dxgi/tests/device.c | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/dlls/dxgi/tests/device.c b/dlls/dxgi/tests/device.c index 148cd73..8351a32 100644 --- a/dlls/dxgi/tests/device.c +++ b/dlls/dxgi/tests/device.c @@ -23,6 +23,10 @@ #include "d3d11.h" #include "wine/test.h" +#ifndef ARRAY_SIZE +#define ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0])) +#endif + enum frame_latency { DEFAULT_FRAME_LATENCY = 3, @@ -1179,7 +1183,7 @@ static void test_create_swapchain(void) refcount = get_refcount((IUnknown *)factory); ok(refcount == 2, "Got unexpected refcount %u.\n", refcount); - for (i = 0; i < sizeof(refresh_list) / sizeof(*refresh_list); ++i) + for (i = 0; i < ARRAY_SIZE(refresh_list); ++i) { creation_desc.BufferDesc.RefreshRate.Numerator = refresh_list[i].numerator; creation_desc.BufferDesc.RefreshRate.Denominator = refresh_list[i].denominator; @@ -1275,7 +1279,7 @@ static void test_create_swapchain(void) creation_desc.Windowed = FALSE; - for (i = 0; i < sizeof(refresh_list) / sizeof(*refresh_list); ++i) + for (i = 0; i < ARRAY_SIZE(refresh_list); ++i) { creation_desc.BufferDesc.RefreshRate.Numerator = refresh_list[i].numerator; creation_desc.BufferDesc.RefreshRate.Denominator = refresh_list[i].denominator; @@ -1637,16 +1641,16 @@ static void test_get_containing_output(void) break; } - for (j = 0; j < sizeof(offsets) / sizeof(*offsets); ++j) + for (j = 0; j < ARRAY_SIZE(offsets); ++j) { - unsigned int idx = (sizeof(offsets) / sizeof(*offsets)) * i + j; - assert(idx < sizeof(points) / sizeof(*points)); + unsigned int idx = ARRAY_SIZE(offsets) * i + j; + assert(idx < ARRAY_SIZE(points)); points[idx].x = x + offsets[j].x; points[idx].y = y + offsets[j].y; } } - for (i = 0; i < sizeof(points) / sizeof(*points); ++i) + for (i = 0; i < ARRAY_SIZE(points); ++i) { ret = SetWindowPos(swapchain_desc.OutputWindow, 0, points[i].x, points[i].y, 0, 0, SWP_NOSIZE | SWP_NOZORDER); @@ -2089,7 +2093,7 @@ static void test_windowed_resize_target(IDXGISwapChain *swapchain, HWND window, expected_state = *state; e = &expected_state.fullscreen_state; - for (i = 0; i < sizeof(sizes) / sizeof(*sizes); ++i) + for (i = 0; i < ARRAY_SIZE(sizes); ++i) { SetRect(&e->client_rect, 0, 0, sizes[i].width, sizes[i].height); e->window_rect = e->client_rect; @@ -2260,7 +2264,7 @@ static void test_resize_target(void) swapchain_desc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD; swapchain_desc.Flags = 0; - for (i = 0; i < sizeof(tests) / sizeof(*tests); ++i) + for (i = 0; i < ARRAY_SIZE(tests); ++i) { swapchain_desc.Flags = tests[i].flags; swapchain_desc.OutputWindow = CreateWindowA("static", "dxgi_test", 0, @@ -2425,7 +2429,7 @@ static void test_inexact_modes(void) check_window_fullscreen_state(swapchain_desc.OutputWindow, &initial_state.fullscreen_state); - for (i = 0; i < sizeof(sizes) / sizeof(*sizes); ++i) + for (i = 0; i < ARRAY_SIZE(sizes); ++i) { /* Test CreateSwapChain(). */ swapchain_desc.BufferDesc.Width = sizes[i].width; @@ -3190,7 +3194,7 @@ static void test_swapchain_parameters(void) hr = IDXGIAdapter_GetParent(adapter, &IID_IDXGIFactory, (void **)&factory); ok(SUCCEEDED(hr), "GetParent failed, hr %#x.\n", hr); - for (i = 0; i < sizeof(tests) / sizeof(*tests); ++i) + for (i = 0; i < ARRAY_SIZE(tests); ++i) { memset(&desc, 0, sizeof(desc)); desc.BufferDesc.Width = registry_mode.dmPelsWidth; @@ -3278,7 +3282,7 @@ static void test_swapchain_parameters(void) IDXGISwapChain_Release(swapchain); } - for (i = 0; i < sizeof(usage_tests) / sizeof(*usage_tests); ++i) + for (i = 0; i < ARRAY_SIZE(usage_tests); ++i) { usage = usage_tests[i];
1
0
0
0
Henri Verbeet : dxgi: Translate swap effects in dxgi_factory_CreateSwapChainForHwnd().
by Alexandre Julliard
15 Feb '18
15 Feb '18
Module: wine Branch: master Commit: d612495a72a4368d9c28acf5dd3b7d0845115257 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=d612495a72a4368d9c28acf5…
Author: Henri Verbeet <hverbeet(a)codeweavers.com> Date: Thu Feb 15 09:53:18 2018 +0330 dxgi: Translate swap effects in dxgi_factory_CreateSwapChainForHwnd(). Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/dxgi/factory.c | 13 ++++++++++--- dlls/wined3d/swapchain.c | 3 ++- include/wine/wined3d.h | 1 + 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/dlls/dxgi/factory.c b/dlls/dxgi/factory.c index 00ca122..7fc3279 100644 --- a/dlls/dxgi/factory.c +++ b/dlls/dxgi/factory.c @@ -275,12 +275,22 @@ static HRESULT STDMETHODCALLTYPE dxgi_factory_CreateSwapChainForHwnd(IWineDXGIFa switch (swapchain_desc->SwapEffect) { case DXGI_SWAP_EFFECT_DISCARD: + wined3d_desc.swap_effect = WINED3D_SWAP_EFFECT_DISCARD; + min_buffer_count = 1; + break; + case DXGI_SWAP_EFFECT_SEQUENTIAL: + wined3d_desc.swap_effect = WINED3D_SWAP_EFFECT_SEQUENTIAL; min_buffer_count = 1; break; case DXGI_SWAP_EFFECT_FLIP_DISCARD: + wined3d_desc.swap_effect = WINED3D_SWAP_EFFECT_FLIP_DISCARD; + min_buffer_count = 2; + break; + case DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL: + wined3d_desc.swap_effect = WINED3D_SWAP_EFFECT_FLIP_SEQUENTIAL; min_buffer_count = 2; break; @@ -303,8 +313,6 @@ static HRESULT STDMETHODCALLTYPE dxgi_factory_CreateSwapChainForHwnd(IWineDXGIFa if (swapchain_desc->Scaling != DXGI_SCALING_STRETCH) FIXME("Ignoring scaling %#x.\n", swapchain_desc->Scaling); - if (swapchain_desc->SwapEffect) - FIXME("Ignoring swap effect %#x.\n", swapchain_desc->SwapEffect); if (swapchain_desc->AlphaMode != DXGI_ALPHA_MODE_IGNORE) FIXME("Ignoring alpha mode %#x.\n", swapchain_desc->AlphaMode); if (fullscreen_desc && fullscreen_desc->ScanlineOrdering) @@ -319,7 +327,6 @@ static HRESULT STDMETHODCALLTYPE dxgi_factory_CreateSwapChainForHwnd(IWineDXGIFa wined3d_desc.backbuffer_usage = wined3d_usage_from_dxgi_usage(swapchain_desc->BufferUsage); wined3d_sample_desc_from_dxgi(&wined3d_desc.multisample_type, &wined3d_desc.multisample_quality, &swapchain_desc->SampleDesc); - wined3d_desc.swap_effect = WINED3D_SWAP_EFFECT_DISCARD; wined3d_desc.device_window = window; wined3d_desc.windowed = fullscreen_desc ? fullscreen_desc->Windowed : TRUE; wined3d_desc.enable_auto_depth_stencil = FALSE; diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c index 2729df2..0d76b67 100644 --- a/dlls/wined3d/swapchain.c +++ b/dlls/wined3d/swapchain.c @@ -505,7 +505,8 @@ static void swapchain_gl_present(struct wined3d_swapchain *swapchain, * The FLIP swap effect is not implemented yet. We could mark WINED3D_LOCATION_DRAWABLE * up to date and hope WGL flipped front and back buffers and read this data into * the FBO. Don't bother about this for now. */ - if (swapchain->desc.swap_effect == WINED3D_SWAP_EFFECT_DISCARD) + if (swapchain->desc.swap_effect == WINED3D_SWAP_EFFECT_DISCARD + || swapchain->desc.swap_effect == WINED3D_SWAP_EFFECT_FLIP_DISCARD) wined3d_texture_validate_location(swapchain->back_buffers[swapchain->desc.backbuffer_count - 1], 0, WINED3D_LOCATION_DISCARDED); diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h index 22bb2d8..1e3c08b 100644 --- a/include/wine/wined3d.h +++ b/include/wine/wined3d.h @@ -507,6 +507,7 @@ enum wined3d_swap_effect { WINED3D_SWAP_EFFECT_DISCARD, WINED3D_SWAP_EFFECT_SEQUENTIAL, + WINED3D_SWAP_EFFECT_FLIP_DISCARD, WINED3D_SWAP_EFFECT_FLIP_SEQUENTIAL, WINED3D_SWAP_EFFECT_COPY, WINED3D_SWAP_EFFECT_COPY_VSYNC,
1
0
0
0
Henri Verbeet : d3d9: Explicitly translate swap effects.
by Alexandre Julliard
15 Feb '18
15 Feb '18
Module: wine Branch: master Commit: 5057df1f3e066897cc5978ec3e9f3b594886e862 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=5057df1f3e066897cc5978ec…
Author: Henri Verbeet <hverbeet(a)codeweavers.com> Date: Thu Feb 15 09:53:17 2018 +0330 d3d9: Explicitly translate swap effects. Note that previously D3DSWAPEFFECT_OVERLAY would get mapped to WINED3D_SWAP_EFFECT_COPY_VSYNC. That didn't matter so much because neither is currently implemented. Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/d3d9/device.c | 44 ++++++++++++++++++++++++++++++++++++++++++-- include/wine/wined3d.h | 10 ++++++---- 2 files changed, 48 insertions(+), 6 deletions(-) diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c index 4c1006c..ff95bef 100644 --- a/dlls/d3d9/device.c +++ b/dlls/d3d9/device.c @@ -186,6 +186,26 @@ static UINT vertex_count_from_primitive_count(D3DPRIMITIVETYPE primitive_type, U } } +static D3DSWAPEFFECT d3dswapeffect_from_wined3dswapeffect(enum wined3d_swap_effect effect) +{ + switch (effect) + { + case WINED3D_SWAP_EFFECT_DISCARD: + return D3DSWAPEFFECT_DISCARD; + case WINED3D_SWAP_EFFECT_SEQUENTIAL: + return D3DSWAPEFFECT_FLIP; + case WINED3D_SWAP_EFFECT_COPY: + return D3DSWAPEFFECT_COPY; + case WINED3D_SWAP_EFFECT_OVERLAY: + return D3DSWAPEFFECT_OVERLAY; + case WINED3D_SWAP_EFFECT_FLIP_SEQUENTIAL: + return D3DSWAPEFFECT_FLIPEX; + default: + FIXME("Unhandled swap effect %#x.\n", effect); + return D3DSWAPEFFECT_FLIP; + } +} + void present_parameters_from_wined3d_swapchain_desc(D3DPRESENT_PARAMETERS *present_parameters, const struct wined3d_swapchain_desc *swapchain_desc) { @@ -195,7 +215,7 @@ void present_parameters_from_wined3d_swapchain_desc(D3DPRESENT_PARAMETERS *prese present_parameters->BackBufferCount = swapchain_desc->backbuffer_count; present_parameters->MultiSampleType = swapchain_desc->multisample_type; present_parameters->MultiSampleQuality = swapchain_desc->multisample_quality; - present_parameters->SwapEffect = swapchain_desc->swap_effect; + present_parameters->SwapEffect = d3dswapeffect_from_wined3dswapeffect(swapchain_desc->swap_effect); present_parameters->hDeviceWindow = swapchain_desc->device_window; present_parameters->Windowed = swapchain_desc->windowed; present_parameters->EnableAutoDepthStencil = swapchain_desc->enable_auto_depth_stencil; @@ -206,6 +226,26 @@ void present_parameters_from_wined3d_swapchain_desc(D3DPRESENT_PARAMETERS *prese present_parameters->PresentationInterval = swapchain_desc->swap_interval; } +static enum wined3d_swap_effect wined3dswapeffect_from_d3dswapeffect(D3DSWAPEFFECT effect) +{ + switch (effect) + { + case D3DSWAPEFFECT_DISCARD: + return WINED3D_SWAP_EFFECT_DISCARD; + case D3DSWAPEFFECT_FLIP: + return WINED3D_SWAP_EFFECT_SEQUENTIAL; + case D3DSWAPEFFECT_COPY: + return WINED3D_SWAP_EFFECT_COPY; + case D3DSWAPEFFECT_OVERLAY: + return WINED3D_SWAP_EFFECT_OVERLAY; + case D3DSWAPEFFECT_FLIPEX: + return WINED3D_SWAP_EFFECT_FLIP_SEQUENTIAL; + default: + FIXME("Unhandled swap effect %#x.\n", effect); + return WINED3D_SWAP_EFFECT_SEQUENTIAL; + } +} + static BOOL wined3d_swapchain_desc_from_present_parameters(struct wined3d_swapchain_desc *swapchain_desc, const D3DPRESENT_PARAMETERS *present_parameters, BOOL extended) { @@ -232,7 +272,7 @@ static BOOL wined3d_swapchain_desc_from_present_parameters(struct wined3d_swapch swapchain_desc->backbuffer_usage = WINED3DUSAGE_RENDERTARGET; swapchain_desc->multisample_type = present_parameters->MultiSampleType; swapchain_desc->multisample_quality = present_parameters->MultiSampleQuality; - swapchain_desc->swap_effect = present_parameters->SwapEffect; + swapchain_desc->swap_effect = wined3dswapeffect_from_d3dswapeffect(present_parameters->SwapEffect); swapchain_desc->device_window = present_parameters->hDeviceWindow; swapchain_desc->windowed = present_parameters->Windowed; swapchain_desc->enable_auto_depth_stencil = present_parameters->EnableAutoDepthStencil; diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h index cca4476..22bb2d8 100644 --- a/include/wine/wined3d.h +++ b/include/wine/wined3d.h @@ -505,10 +505,12 @@ enum wined3d_patch_edge_style enum wined3d_swap_effect { - WINED3D_SWAP_EFFECT_DISCARD = 1, - WINED3D_SWAP_EFFECT_SEQUENTIAL = 2, - WINED3D_SWAP_EFFECT_COPY = 3, - WINED3D_SWAP_EFFECT_COPY_VSYNC = 4, + WINED3D_SWAP_EFFECT_DISCARD, + WINED3D_SWAP_EFFECT_SEQUENTIAL, + WINED3D_SWAP_EFFECT_FLIP_SEQUENTIAL, + WINED3D_SWAP_EFFECT_COPY, + WINED3D_SWAP_EFFECT_COPY_VSYNC, + WINED3D_SWAP_EFFECT_OVERLAY, }; enum wined3d_sampler_state
1
0
0
0
← Newer
1
...
35
36
37
38
39
40
41
...
81
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
Results per page:
10
25
50
100
200