araghon007 / X1nput

Xinput hook for Impulse Trigger emulation
MIT License
344 stars 37 forks source link

Fixed failed to inject X1nput*.dll when the dll file path includes non-english characters. #39

Closed onenowy closed 1 year ago

onenowy commented 1 year ago

Some languages consume 3 bytes per character. char type is not enough for these languages.

araghon007 commented 1 year ago

Oh oops, that's what I get for assuming stuff when working with strings. Do the P/Invoke functions work fine with multibyte characters? I'd assume so since it takes in bytes directly, but just want to double check.

Also I don't really like using default anything when it comes to .NET, especially when it comes to globalization/localization because they always mess it up. Would using Encoding.Unicode suffice?

araghon007 commented 1 year ago

I have realized looking at the code now that I contradicted my old self when talking about Encoding.Default, but I'm a better person now! I've also realized that I haven't done any sort of error checking in the function, so good job for finding this mistake.

araghon007 commented 1 year ago

Alright, I have figured it out. I'm gonna merge this pull request and do some changes after. Thank you.

onenowy commented 1 year ago

Thanks, I'm glad to help.