On 1/8/24 06:16, Tyson Whitehead wrote:
I wrote a small test program to see what happens on the bus.
Discovered you can only set the autocenter property on or off while the device is not acquired. This is the steps the program does and what I see on the bus
// DirectInput8Create(...) // EnumDevices(...) // CreateDevice(...) // SetCooperativeLevel(...,DISCL_EXCLUSIVE | DISCL_BACKGROUND) // SetDataFormat(...) // SetProperty(DIPROP_AUTOCENTER_OFF) GET_REPORT 03 46 05 07 01: 03: PID Pool Report 46 05: RAM Pool Size: 0x546 (0-65535) 07: Simultaneous Effect Max: 7 (0-255) 01: Device Managed Pool: 1 (0-1) Shared Parameter Blocks: 0 (0-1) Usused: 000000b // Acquire() INTERRUPT OUT 0c 04: DC Device Reset INTERRUPT OUT 0c 03: DC Stop All Effects INTERRUPT OUT 0d ff: Device Gain: 255 // Unacquire() INTERRUPT OUT 0c 04: DC Device Reset // SetProperty(DIPROP_AUTOCENTER_ON) // Acquire() INTERRUPT OUT 0c 04: DC Device Reset INTERRUPT OUT 0d ff: Device Gain: 255 // Unacquire() INTERRUPT OUT 0c 04: DC Device Reset // SetProperty(DIPROP_AUTOCENTER_OFF) // Acquire() INTERRUPT OUT 0c 04: DC Device Reset INTERRUPT OUT 0c 03: DC Stop All Effects INTERRUPT OUT 0d ff: Device Gain: 255 // Unacquire() INTERRUPT OUT 0c 04: DC Device Reset // Release(...) // Release(...)
Under XP the acquire and unaquire DC device resets are followed by a
INTERRUPT OUT 01 01 00 00 00 00 00 01 00 ff 00 84 00 ff 00 00: Effect Block Index 1 01: Set Effect Report 01: Effect Block Index: 1 (1-40) 00: Effect Type: 0 (1-12) (i.e., NULL) 00 00: Duration: 0 (0-32767) 00 00: Trigger Repeat Interval: 0 (0-32767) 01 00: Sample Period: 1 (0-32767) ff: Gain: 255 (0-255) 00: Trigger Buttons: 0 (1-8) (i.e., NULL) 84: Axes Enable: X: 0 (0-1) Y: 0 (0-1) Direction Enable: 1 (0-1) Unused: 1000b 00 ff: Direction: Instance1: 0 Instance2: 255 00 00: Start Delay: 0 (0-32767)
This is not done under Windows 7.
So, what I see is
- the reset state has a spring effect running in effect slot 1
- a reset command is issued after acquiring or unacquiring
- a stop all effects command is also issued after the acquirinig reset
command if autocenter is disabled
- a set gain command is issued acquiring
- trying to change autocenter while the device is acquired returns
DIERR_ACQUIRED (this is not documented)
Cheers! Tyson
Interesting, thanks for that investigation. I think we can do the same in dinput, and send DISFFC_STOPALL when auto-centering is off.
Then, in winebus.sys, and depending on the backend -in evdev, but maybe also SDL unless it has another better way for doing it- we could implement PID_USAGE_DC_DEVICE_RESET in a way that it adds an implicit spring effect when supported.