M2KB icon indicating copy to clipboard operation
M2KB copied to clipboard

Hardware Scan Codes

Open dkwasny opened this issue 2 years ago • 3 comments

M2KB, along with nearly every other MIDI->KB application, stopped working with DJMax Respect due to Neowiz ignoring keystrokes sent by SendInput() in the traditional way. I found a post on DJMax Respect's Steam forums that details how this program can be modified to use hardware scan codes instead of the normal values passed to SendInput(). M2KB works like a charm after this.

I have very little experience in low level Windows stuff, so I don't fully understand the change. I also am unsure if this change even has a benefit to you since OSU presumably still works.

Regardless, I have a hacky version of the change in a fork if you ever want to replicate it. Feel free to close this issue if you have no intentions to investigate this change. If nothing else, thank you for making this elegant little program.

dkwasny avatar Oct 21 '22 03:10 dkwasny

Hello @dkwasny ! Thank you for spending your time! I mentioned in readme that the program could help OSU players, cause I had been playing OSU that time (I've switched to Etterna), but it doesn't really matter - any modification making M2KB better in terms of compatibility is welcome. It has been like half a year since I had messed with windows' key-mapping and emulation stuff, so I can't make a new release today, but I'll investigate into this (particularly the problem that even changed version doesn't work for Rafs, locale issue maybe) tomorrow and either include your work in new version (you can make a pull request if you want) or introduce another solution.

k5md avatar Oct 21 '22 17:10 k5md

Not sure how much this will help, but I found some interesting StackOverflow questions on "extended keys" which actually have two values in the scan code. https://stackoverflow.com/questions/36972524/winapi-extended-keyboard-scan-codes

Another post mentions how MapVirtualKeyEx(MAPVK_VK_TO_VSC_EX) is actually pretty buggy when it comes to these extended scan codes. https://stackoverflow.com/a/30485060

These extended keys seem to be dedicated to special keys like pause and left arrow, which I avoid by using letter keys. I was thinking you might be using those keys since they caused my build to work incorrectly, but they don't work right on your release build either.

You mentioned potential locale issues. I'm unsure what Rafs is in your message, but I do have a few keyboard locales installed on my PC already. Let me know if I can help test anything in particular.

dkwasny avatar Oct 21 '22 23:10 dkwasny

My googling also informed me that the wVk value is actually unnecessary when using scan codes. I made a small change to reflect this. It's unnecessary for it to work correctly, but it's a little cleaner.

dkwasny avatar Oct 21 '22 23:10 dkwasny