Keyboard support?

Subforum for discussion and help with ScummVM's Nintendo Wii port

Moderator: ScummVM Team

User avatar
Mr_Nick666
Posts: 132
Joined: Wed Apr 11, 2007 9:59 am
Location: Bideford, Devon, UK
Contact:

Post by Mr_Nick666 »

Red_Breast sums it up nicely :wink: Ive seen calls for USB Mouse support now (personally I dont see the need when the Wiimote makes a perfectly good mouse substitute and is just as accurate) do you think it will be added?
brijohn
Posts: 16
Joined: Sun Jan 25, 2009 5:35 am

Post by brijohn »

Mr_Nick666 wrote:Ive seen calls for USB Mouse support now (personally I dont see the need when the Wiimote makes a perfectly good mouse substitute and is just as accurate) do you think it will be added?
Not by me since I agree that we already have a perfectly good pointer device in the form of the wiimote.

However I am in the process of adding key-mapping support into libwiikeyboard. When i get this finished it will allow you to use different keyboard layouts. This will allow you to use it with non US keyboards that have the keys in different places.

Except for the US layout, which is built into the library and is the default, all keymaps will be loaded off of an SD card from the directory /keymaps. In the root of your Sd card you simply have to put a file called kbd.map whcih contains a single line specifying the name of the mapping to use. So if you want to add a German layout you create a keymap file called de.map and stick it under your keymaps directory and then edit the kbd.map file so the first line says de (the map suffix is appended automatically)

When I finish this up and do some testing I'll post an updated version of scummvm using the new libwiikeyboard library.
User avatar
Red_Breast
Posts: 773
Joined: Tue Sep 30, 2008 10:33 pm
Location: The Bar Of Gold, Upper Swandam Lane.

Post by Red_Breast »

Well yesterday (Sunday) not having much to do I thought I'd try some games with the Keyboard build.
I started with Indy4 Atlantis but that's as far as I got.
I'd forgotten what a gem of a game it is and ended up playing it to completion via the Fists route.
I can report that the keyboard works fine.
As for mouse. Don't know. Are there any games that need such pinpoint precision? Maybe. Probably.
It wasn't until yesterday when my Wiimote batteries went, and I was trying to find 2 more, that I found out that my Wavebird can be used. I guess it's a given really.
The Wavebird seemed better for moving the mouse cursor around the screen but the Wiimote was better for actually placing it, if you know what I mean?
brijohn
Posts: 16
Joined: Sun Jan 25, 2009 5:35 am

Post by brijohn »

Alright here it is the updated vesion that supports using different keyboard layouts. Included in the archive is a keymaps directory and a file called kbd.map that must be placed in the root of your SD Card. Once placed there you can change the layout that your keyboard uses by editing the kbd.map file to specify the correct layout file. For example to use the US dvorak layout enter us/dvorak on the first line of the file. At the moment i've only created two layouts besides the default us/qwerty layout those are us/dvorak and de/qwertz. If anyone wants any additional layouts or there are issues with the current ones let me know.

ScummVM r36196
- Added keyboard layouts (us/qwerty, us/dvorak, de/qwertz)
User avatar
chojin
Posts: 48
Joined: Tue May 27, 2008 7:51 pm
Location: Berlin, Germany

Post by chojin »

Very nice again. I tried the german layout, and all keys appear to work as expected, except the € (euro) symbol, which is an "e" but probably not relevant. The "first line" in kbp.map must be the only line, it did not work when I had accidently a carriage return at the end of that line.

Why I mentioned the USB mouse: My cordless desktop contains keyboard and mouse, but it was more a joke. I'm not sure whether I would make use of it, although I guess it's easier to implement than a keyboard.

My problem with the WiiMote: Clicking the A-button often results in a little cursor jump, probably depending on the distance between wiimote and tv. In some game scenes the click-area is very small and timing relevant, I needed some attempts there. Doubleclicking folders in SCUMMVM GUI is likewise, maybe a singleclick is sufficent here.
User avatar
Bossk
Posts: 101
Joined: Mon Nov 03, 2008 2:15 pm

Post by Bossk »

Nice work brijohn. Your work is much appreciated.

I've noticed a few quirks with the virtual keyboard, I haven't had the time to dig in to check for myself yet for the cause:

- When calling and dismissing the VKBD the shift state is set (seen when the add buttons becomes mass-add).
- The numbers don't work in the VKBD (probably to do with the shift state?)

The cause most likely is the remapping of VKBD to shift-F7 instead of F7, and mapping shift-F7 to the down key.
User avatar
Red_Breast
Posts: 773
Joined: Tue Sep 30, 2008 10:33 pm
Location: The Bar Of Gold, Upper Swandam Lane.

Post by Red_Breast »

How do I go about creating a keyboard .map file? I actually want a uk.map file.
There are some differences compared to the 2 US versions.
(I didn't know there were 2 US versions until reading Wiki)

http://en.wikipedia.org/wiki/British_an ... _keyboards
brijohn
Posts: 16
Joined: Sun Jan 25, 2009 5:35 am

Post by brijohn »

Bossk: I discoverd what the issue with shift is. The problem is that libwiikeyboard does not send press/release events for shift, ctrl, and alt modifiers. Instead when you press a key it will send a bit flag telling you the state of each modifier. This means that scummvm does not detect that you pressed shift until you press a key while holding shift nor does it detect that you released shift till you press a key without holding shift.

Red_Breast: I have created a program that will take a text file describing a keymap and create a compiled version for use with libwiikeyboard. There are some brief instructions in the README about using it, and you can also look at the us based description files located in the data directory. If you have any questions or problems with it let me know.

Keymap Compiler
User avatar
Badablek
Posts: 58
Joined: Sun Jan 28, 2007 3:53 pm

Post by Badablek »

Hi brijohn,

is this tool supposed to work under Windows Vista ? I'm trying to make a french (azerty) keyboard map, but it doesn't work well.

ScummVM can read through A to F, but stop respond from G to N, keypad, F Keys, Space, enter, etc. do not work too.
I tried to compile Us keyboard map too (I did NOT modify it) and same problem, like your tool does not compile correctly.


ps : when using your precompiled binary, everything works like it should be.
brijohn
Posts: 16
Joined: Sun Jan 25, 2009 5:35 am

Post by brijohn »

Ok so yeah there was a slight bug in the windows compiled version. I forgot that windows is rather stupid and thinks that translating certain characters during file read and write operations is somehow a good thing. At any rate i've uploaded a fixed version that should work correctly under windows.

Keymap Compiler
User avatar
Badablek
Posts: 58
Joined: Sun Jan 28, 2007 3:53 pm

Post by Badablek »

Thank you for this quick bugfix, works much better now.

I've made a french keyboard map (azerty), if you want to add it to the next version of ScummVM

http://www.gx-mod.com/team/perso/Badabl ... keymap.zip
(source data is included)

ps : keyboard support rocks !
User avatar
Red_Breast
Posts: 773
Joined: Tue Sep 30, 2008 10:33 pm
Location: The Bar Of Gold, Upper Swandam Lane.

Post by Red_Breast »

brijohn wrote:Ok so yeah there was a slight bug in the windows compiled version. I forgot that windows is rather stupid and thinks that translating certain characters during file read and write operations is somehow a good thing. At any rate i've uploaded a fixed version that should work correctly under windows.

Keymap Compiler
Nice one thanks.

Edit.
I guess the best way to do this is to take the us one from your data folder and just modify it. Is that right?
So I downloaded the .pdf but I can't even find '£'(pound) listed.
Is there any chance you could make me one? Please.
I'm not sure I'm doing this right. I'm slowly playing with Linux but it still scares me and I have no Win compiler. Thanks.

Copy and paste from Wiki. UK differences.
"map the £ to where the US layout has a #
add a 102nd key to accommodate the #
reversal of @ and "
the movement of ~ to the # key to accommodate a ¬ on the `(backquote) key
the movement of the \ key to the left of Z"
brijohn
Posts: 16
Joined: Sun Jan 25, 2009 5:35 am

Post by brijohn »

Red_Breast:

I can probably create a mapping but it might take a day or to to get some time for it.

Below is hopefully some information that might explain abit more...hopefully.

The pdf file only lists the number representing physical keys on the keyboard, so what you look for is in the case of the pound sign the key that claims to represents 3 and #. That is number 32 i think. The symbols listed in the pdf are just what that key is on a normal us keyboard. With that number we can map that physical key to any symbols we want. In the case of a UK keyboard this will be 3 and £. Other things to note are the pound sign should be according to the pdf number 50 (Keyboard Non-US # and ~). Basically the pdf shows what the normal mappings are plus the number representing the physical key and we use the keyboard map files to rearrange what keys are used. Also the symbol name you use for the pound sign when mapping is called sterling and ¬ is called notsign.
brijohn
Posts: 16
Joined: Sun Jan 25, 2009 5:35 am

Post by brijohn »

Ok I've fixed the previous issue with the shift key that Bossk pointed out. libwikkeyboard now sends back discrete keyboard events for modifier keys, this also means the all modifier keys are fully mappable in the keymap files as well. So now if you want to say moved your left shift key over to your space bar or swap it with your escape key you can. :) More to the point however is that scummvm should now be able to detect an individual shift key press instead of only knowing about when pressed with a secondary key.

I've also created the UK based keymapping as well as one for Japanese keyboards and updated my keymap_compiler to take some of these changes into account.

Keymap Compiler
- Updated keymaps with modifier keys
- Added gb(uk) and jp keymaps
- definition files now support # style comments

ScummVM r36255
- Includes updated keymaps
- Fix bug with shift
User avatar
Badablek
Posts: 58
Joined: Sun Jan 28, 2007 3:53 pm

Post by Badablek »

brijohn, something seems broken with your latest release.

French keyboard : e, j and x do not work anymore (tried with azerty.map from r36255 and my compiled one). Same with Us keyboard.


and same when using old .map. So I think this bug comes from your latest build of scummvm.


ps :
it seems that pressing x = return, e = backspace, j = enter

and when pressing (without holding) the right Alt key (altGr on french keyboard), the "Alt" status is locked and only alt keys can be used...and impossible to go back to the "normal" state.
Post Reply