joncampbell123 / dosbox-x

DOSBox-X fork of the DOSBox project
GNU General Public License v2.0
2.68k stars 381 forks source link

Please add CJK keyboard layout. #99

Open hecatomcales opened 9 years ago

hecatomcales commented 9 years ago

Please add Chinese, Japanese,Korean keyboard layout.

joncampbell123 commented 9 years ago

I have keybindings for the extra keys on Japanese and Korean keyboards (as far as I know they are correct scan-code wise enough to satisfy the Korean and Japanese editions of Windows 95), look at the DOSBox-X keymapper UI. I do not have such keyboards to test against to validate the layout is correct if it is implemented. Anyone want to take this on?

hecatomcales commented 9 years ago

I can test only Japanese keyboard.

By the way, a Japanese developer added Japanese keyboard layout to Dosbox before. http://www.mediafire.com/download/t968ydz6ky92myl/dosbox74.zip Souce code include. I hope it will be helpful to you.

joncampbell123 commented 9 years ago

I incorporated the KBD_ constants and mapper additions from that version's source code. In my version the Yen and underscore keys are shown in the mapper down by the Japanese-specific keys (Hiragana, Henken, etc.) instead of by the shift and backspace keys, but they're there.

Can you test that you are able to use them along with keyboard mapping configuration in DOS?

hecatomcales commented 9 years ago

Please upload binary,thanks

joncampbell123 commented 9 years ago

I can do this when I get home tonight. I think you should be able to compile with Visual Studio 2008 from the same source tree.

joncampbell123 commented 9 years ago

Sorry about the long delay. Here's a win32 build (hosted from my own firewall):

http://jon.nerdgrounds.com/dl/dosbox-x-beta-20150719-jp-keyboard-testing-1.zip

[edit] Look in the keyboard mapper for the Yen and underscore keys, down by the Hanaku, etc. key group.

joncampbell123 commented 9 years ago

http://www.amazon.com/Japanese-Computer-Keyboard-Background-Characters/dp/B002BKI8IS/ref=sr_1_6?ie=UTF8&qid=1437418806&sr=8-6&keywords=japanese+keyboard

If I were to buy this off of Amazon's website would the keyboard be close enough to your layout to make it suitable for testing? Not sure about Linux, but Windows 7 I know I can add a JP IME to simulate a typical setup even though the rest of the OS is still in English.

joncampbell123 commented 9 years ago

I have Japanese keyboard handling and layout mostly done. I went ahead and bought a USB keyboard with the JP layout (106-key) and so far in Windows 10 I have successfully made the capture mode pass through all the special keys plus yen and backslash. There is only one of the special IME keys that I am not yet able to get DOSBox to work with.

zipplet commented 7 years ago

I also live in Japan and have similar issues with DOSbox. I have Japanese keyboards only, so this is a rather large annoyance. If I can assist, please reach out. I am able to program and submit patches etc; but I am unfamiliar with setting up a working compilation environment for DOSbox. I would like to help fix this for all platforms ideally, but I have more experience with programming on Windows than Linux or OS X. However, I do have Linux knowledge/experience and a MacBook Pro (also Japanese).

By the way, I cannot assist (beyond testing only) if it involves paying for a compiler. I see mentions of Visual Studio above.

joncampbell123 commented 7 years ago

I thought I did? I added keyboard scancodes internally to map the extra keys on JP keyboard.

This codebase is supported by Visual Studio 2015 community edition, which is free.

joncampbell123 commented 7 years ago

At least on the Windows systems here in the US, I've been able to respond to the extra keys by adding a JP keyboard layout and switching to it.

zipplet commented 7 years ago

Hmm, is this supposed to work in DOSBox 0.74? Your keycode wiki does not mention JP as a supported language. Do I need to compile from source or is the wiki just out of date? I am more than happy to test even if compiling from source is necessary, if it's a simple matter of installing VS community and compiling it.

zipplet commented 7 years ago

I would like to add I would also like to get this working on the Raspberry Pi build of DOSbox; if I can get this to work on Windows first I'll investigate that myself - but if you are aware of any pitfalls (e.g. "modern DOSbox does not compile on Pi, the Pi version uses some ancient branch") please tell me.

joncampbell123 commented 7 years ago

DOSBox 0.74 is the original project that this is forked from. It's named DOSBox-X because of the gradual changes I've made over the years and different goals from the main project, where the original project concerns itself only with DOS games while this project aims to improve emulation accuracy.

I added SDL keycodes (well, hacks actually) for the extra Japanese and Korean keys. Boot up DOSBox-X and look at the SDL mapper. I tried to stick with the official key names, these keys concern themselves with the Input Method Editor functions of Windows. At the time I added them I only got them working with Windows. I'm not yet sure how to work with the X keymapper stuff for Linux and JP keyboards.

I don't see any reason why DOSBox-X should not compile on the Raspberry Pi, unless yours is big endian instead of little endian (byte order). There is a lot of code in DOSBox-X that assumes the host is little endian. Make sure you're using GCC 4.6.x or later and that C++11 or C++0x is supported. DOSBox-X needs SDL 1.2. There is an experimental branch for porting DOSBox-X to SDL 2.x. You may need to install GCC 4.6 and make it default. I can't guarantee it will work because I haven't tested it. I should really pull out my Raspberry Pi 2 and try it.

zipplet commented 7 years ago

Thanks for the information. I shall give it a try and report back here if I find any issues. I'm also interested in better accuracy, hence interest in this fork 👍 I will indeed be testing with a JP keyboard on Linux as well and see if I can do anything.

nzjpnboy commented 7 years ago

Japanese keyboard, Japanese Windows 10 OS. I can set the key mappings for the "^" to be the "+" key as it is next to the "-" key on the keyboard, however, after safely closing DosBox-X and then restarting it, it loses the bindings. I did click the save button.

Also the Keymapper says that the binding is "bind: key unknown key". This issue is also in the original Dosbox 0.74 (Also happens in Windows 7).

Compiled with VS2017 using the source date: 2017/08/19

joncampbell123 commented 7 years ago

This is where SDL gets complicated with keyboard layout.

So far the only testing the CJK keyboard layout has gotten is with a USA build of Windows 10, connected to a Japanese USB keyboard, and Windows 10 instructed to apply the Japanese locale to DOSBox-X.

However to help, the keyboard mapping editor does have a mode to show you the scan codes coming into through SDL.

I only do Linux development myself, but Windows patches are welcome. Does anyone else here have more experience than I do with keyboard layouts and the Win32 API?

nzjpnboy commented 7 years ago

I can give you the scan codes that I see when I press them in the mapper, for the "bind: key unknown key" ones:

^ = scan:144; sym:0 \ (yen mark next to ^) = scan:125; sym:0 henkaku = scan:148; sym:0 muhenkan = scan:123; sym:0 henkan = scan:121; sym:0 hirigana = scan:112; sym:0 @ = scan:145; sym:0 : = scan:146; sym:0

joncampbell123 commented 6 years ago

DOSBox-X and SDL 1.x were updated to at least offer support for Japanese keyboards.

There is JP keyboard layout emulation but only at this time for PC-98 emulation.