Open Valkirie opened 1 year ago
Thanks for this!
Just because a long string adds a lot to the size of JOY_SETTINGS, I think it'd be better to have a dedicated function for getting the string. The caller would give it a char array and the length of the array, and the function would fill the array with the path up to the given length.
Would you be up for giving that a go?
I could implement a dedicated function I guess. The only "issue" is that I'm not sure we can guess the hid path size in advance. Bluetooth devices have a longer path than wired devices. I'll investigate.
It doesn't need to know the size in advance, just have an array that's big enough. Just like how you pre-allocated 256 in the JOY_SETTINGS version, the caller could say "it's probably not more than 256 bytes" and use an array that big.
I think this is a common pattern for strings in C. Commonly, something like this would also return an int that's the length of the actual string
C# implementation has to be: