amerkoleci / Vortice.Windows

.NET bindings for Direct3D12, Direct3D11, WIC, Direct2D1, XInput, XAudio, X3DAudio, DXC, Direct3D9 and DirectInput.
MIT License
1.01k stars 73 forks source link

Implement GetObjectPropertiesById #393

Closed CasualPokePlayer closed 1 year ago

CasualPokePlayer commented 1 year ago

I'm currently working on switching the BizHawk project over from SlimDX over to Vortice for most of our DirectX methods, and I've run into a small issue. We had normally used GetObjectPropertiesById in order to obtain properties of joystick objects, although that method is not implemented on your side. GetObjectPropertiesByName appeared to be a suitable alternative, except for a small problem. We used GetObjects in order to obtain all the joystick objects, and the objects there have localized names. So this ends up crashing for non-English users (one of our devs testing this had crashes due to them being German).

I'd propose implementing a GetObjectPropertiesByOffset, which just takes in a raw offset, which a device object obtained with GetObjects would have and would be mostly the same method, just skipping the lookup with the name for the offset.

EDIT: On more examination, the offset from GetObjects is not the same as the offset expected to be sent through. Having GetObjectPropertiesById implemented (like what our project was using with SlimDX), would probably be the proper solution.

amerkoleci commented 1 year ago

Feel free to submit PR!

Thanks