-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
typo and missing chars #7
Comments
Thanks for catching the error - #8 cap32 uses the Amstrad Keyboard controller profile: https://github.com/kodi-game/controller-topology-project/blob/master/addons/game.controller.amstrad.keyboard/resources/layout.xml The problem might show up in the debug log, if you're able to grab one. |
yes, my research also led me to layout.xml of game.controller.amstrad.keyboard which is responsible for doing some key configurations with the GUI, but many keys are missing there because I was not able to switch on the virtual keyboard with F9, for example, I had to include
with journalctl -f but there is no ! on the CPC screen :( I managed to activate the right CTRL key with my actual better working buttonmap.xml than the shipped version is attached - I would need some more information how exclaim, dollar, less and greater symbol can be made functioning - my goal is to use the emulator like a real programming cpc machine ;-) |
The missing keys will also have to be added to The source of truth for keys is https://github.com/libretro/libretro-cap32/blob/master/libretro/retro_events.c . For every key that cap32 supports, there should be an entry in |
do I guess it right, that the problem is the missing SDL layer in LibreELEC? would explain that the mapping isn't done within DOSbox and cap32 ... |
Unlikely. Keys come from the frontend. In the case of RetroArch, I think it uses SDL initially, but translates keys to the libretro API. With LE, it uses the native OS way of reading keys, and also translates them to the libretro API. Cores only see libretro keys. |
@ajbathe We're getting closer to your dream of programming a cpc machine in kodi - kodi-game/controller-topology-project#249 I tested input in all thee emulators (cap32, crocods and epu128) and all buttons are correctly sent to the core. Can you try and see if input is fixed for you? If you follow the PR links in kodi-game/controller-topology-project#249, you'll see all the XML files you need to copy/update. |
I will happily test every button :) I hope I don't have to build it because I have no compiling environment for xmbc |
Don't worry, you can just copy/paste all the XML files that were modified. Track down each PR to see which XML file should be updated. If there's ever a change that needs to be compiled into Kodi, I'll do a round of test builds. What platform/device do you test on? |
I test with RPi4.aarch64 and nightly-20230417-83ec8ac with a German keyboard, so I have to ask before testing: To have a good basis on what keylayout should I look, the German keys (or English Keyboard position) or the Amstrad English layout of the virtual keyboard? for German with 6128: |
Open the in-game OSD and go to settings and then Controls. You should be able to map the Amstrad keyboard profile to your German layout. I'm interested in seeing the map that you generate. |
in-game OSD in caprice32 under LibreELEC? how can I open that? |
There currently isn't a hotkey for the keyboard, so you'll need to connect controller and press Select + X. Alternatively, remove the mouse profile from topology.xml and then moving the mouse in-game will bring up the OSD. |
I only get the Kodi menu with Continue, reset, exit and so on, also with the mouse, so I guess u mean that. Was a misunderstanding - with that menu I started to fill my first Keyboard.xml within the directory peripheral.joystick/resources/buttonmaps/xml/application - I thought there is an OSD more, sorry that freshly created Keyboard.xml: |
In the menu with Continue, reset and exit, there's a button called "Settings". In that menu is a button called "Controls". This opens the controller mapper dialog that will generate a Keyboard.xml file in your userdata folder. By viewing the auto-generated file, we can see what keycodes the German layout is sending. |
this is exactly above your last comment ;-) |
I've created a diff of your keymap: --- a/peripheral.joystick/resources/buttonmaps/xml/application/Keyboard.xml
+++ b/peripheral.joystick/resources/buttonmaps/xml/application/Keyboard.xml
@@ -13,7 +13,7 @@
<feature name="8" key="8" />
<feature name="9" key="9" />
<feature name="a" key="a" />
- <feature name="at" key="leftbracket" />
+ <feature name="at" key="at" />
<feature name="b" key="b" />
<feature name="backslash" key="grave" />
<feature name="c" key="c" />
@@ -57,7 +57,7 @@
<feature name="mousetoggle" key="insert" />
<feature name="n" key="n" />
<feature name="o" key="o" />
- <feature name="openbracket" key="rightbracket" />
+ <feature name="openbracket" key="leftbracket" />
<feature name="p" key="p" />
<feature name="play" key="home" />
<feature name="q" key="q" />
@@ -66,7 +66,7 @@
<feature name="rewind" key="pageup" />
<feature name="right" key="right" />
<feature name="s" key="s" />
- <feature name="semicolon" key="quote" />
+ <feature name="semicolon" key="semicolon" />
<feature name="shift" key="leftshift" />
<feature name="slash" key="slash" />
<feature name="space" key="space" /> The goal of libretro is to preserve the "ergonomic" mapping. As you can see, "@" and "[" are next to each other, matching the "[" and "]" positions on a US keyboard layout, hence the mapping I've created. Also, because all the artwork I've done may include idiosyncratics or be low resolution, and I'm often not familiar with the platforms, we base the ergonomic mapping on the core's libretro source code instead images. In this case it's https://github.com/libretro/libretro-cap32/blob/master/libretro/retro_events.c. I've matched the layout in layout.xml of kodi-game/controller-topology-project#249 and Keyboard.xml of xbmc/peripheral.joystick#270. I'm open for fixes but I don't think this patch follows the ergonomic mapping in the source. That said, international keyboard layouts like German complicate things. Instead of having layout-specific button maps for all cores (an "N x M" problem), we can just have ergonomic button maps from English to all other languages. What do you think of this approach? |
I have to admit that although I have a good understanding of how software works, it's not very clear to me how to achieve the goal with a perfect keyboard mapping. I see it this way: We have a ground libretro-symbol set definded with all RETROK-tokens. And there should be some mechanism that when the user pushed ! for example - when the emulated machine has this symbol on the original keyboard, it should handle this symbol when it is pressed on any kind of keyboard, German or English version. That a user should know the original position of the emulated keyboard, even me - I had an Amstrad CPC 6128 when I was young :) - don't know that keyboard position in mind. That means: When a user pushes the hash key on an English or German IBM-compatible keyboard, the emulator system should map that to handle to print the HASH symbol. It doesn't care where the HASH key on the original Amstrad keyboard was. That's my intention. The only problem I see how to handle keys on the emulated machine (like POUND) what my PC keyboard does not have. And to conclude: I really don't understand the complicated key mapping mechanism of libretro for DOSbox and Caprice32 till today. There are definitions on so many places. It is really complicated. What I can offer is testing. |
within your last new version (PR) there was |
I faced the same problem with the face buttons on SNES controllers. The A/B and X/Y buttons are reversed compared to the Xbox controller. The reason is because there are two primary layouts for controllers: Western and Japanese. There are two ways to map buttons: ergonomically and logically. I prefer the logical mapping: When I press A on an Xbox controller, the emulator should map that to A on the SNES controller to mirror the game logic. It doesn't care where the A button on the original SNES controller was. However, we never really settled on a mapping type and ended up with inconsistentences. We decided to use the ergonomic mapping for everything in kodi-game/game.libretro#105. Of course, the argument for logical vs. ergonomic can be different for controllers and keyboards. We could decide on ergonomic mappings for controllers, and logical mappings for keyboards. What do you think of this?
Well, going from ergonomic to logical is a permutation, right? Shuffle the keys correctly as best as possible, and you end up with the unhandled keys mapped to a "good enough" key. |
This makes sense to me: It is easier to NOT look on the joystick buttons because your brain learnt that the A button on the trained controller of company X is not A, but B, just for example. I don't look on that. But optionally it should be possible, to change that by an GUI option. So my suggestion: an GUI option for tiny keyboards called joysticks with "logical" (better "real") or "ergonomic" layout. It's not with keyboard that way because our brains can't learn that many keyboard variants completly: We know e.g. that Y and Z are changed between an English and German keyboard, but please don't ask me where the < or > is! Here people look on the keyboard, I am sure ;-) So your suggestion is fine to me. I guess, it will be a longer way to see me programming my CPC in libretro emulation, right? |
|
Auto-switching between Western and Japanese layouts is a feature I'd like to add, but haven't had the time.
Another good point. Keyboards are different from controllers, because people have likely only been using a single keyboard layout their entire life and are very familiar with it, without being able to easily change. I'll update the PR to use a logical mapping. |
Yes, also an good argument. Have success with your PR to use a logical mapping for keyboards. |
OK, before we see the PR successfully passing, I would suggest to start with a freshly created Keyboard.xml of my German PC-keyboard. There are many more keys working but some not. You will see that what's missing within the XML-file: game.controller.keyboard.xml.txt Please insert the XML-file here for reading, I had to give an .txt extension to upload it here. |
If I understand correctly, you mapped your german layout to the IBM Model M keyboard (default keyboard) profile, right? Here's the diff: --- a/peripheral.joystick/resources/buttonmaps/xml/application/Keyboard.xml
+++ b/peripheral.joystick/resources/buttonmaps/xml/application/Keyboard.xml
@@ -173,14 +173,10 @@
<feature name="backslash" key="backslash" />
<feature name="backspace" key="backspace" />
<feature name="bar" key="bar" />
- <feature name="break" key="break" />
<feature name="c" key="c" />
<feature name="capslock" key="capslock" />
- <feature name="caret" key="caret" />
- <feature name="clear" key="clear" />
<feature name="colon" key="colon" />
<feature name="comma" key="comma" />
- <feature name="compose" key="compose" />
<feature name="d" key="d" />
<feature name="delete" key="delete" />
<feature name="dollar" key="dollar" />
@@ -191,16 +187,17 @@
<feature name="enter" key="enter" />
<feature name="equals" key="equals" />
<feature name="escape" key="escape" />
- <feature name="euro" key="euro" />
<feature name="exclaim" key="exclaim" />
<feature name="f" key="f" />
<feature name="f1" key="f1" />
<feature name="f10" key="f10" />
<feature name="f11" key="f11" />
<feature name="f12" key="f12" />
+ <!-- start of manually added keys F13, F14 and F15 -->
<feature name="f13" key="f13" />
<feature name="f14" key="f14" />
<feature name="f15" key="f15" />
+ <!-- end of manually added keys -->
<feature name="f2" key="f2" />
<feature name="f3" key="f3" />
<feature name="f4" key="f4" />
@@ -210,11 +207,9 @@
<feature name="f8" key="f8" />
<feature name="f9" key="f9" />
<feature name="g" key="g" />
- <feature name="grave" key="grave" />
<feature name="greater" key="greater" />
<feature name="h" key="h" />
<feature name="hash" key="hash" />
- <feature name="help" key="help" />
<feature name="home" key="home" />
<feature name="i" key="i" />
<feature name="insert" key="insert" />
@@ -232,10 +227,8 @@
<feature name="kp9" key="kp9" />
<feature name="kpdivide" key="kpdivide" />
<feature name="kpenter" key="kpenter" />
- <feature name="kpequals" key="kpequals" />
<feature name="kpminus" key="kpminus" />
<feature name="kpmultiply" key="kpmultiply" />
- <feature name="kpperiod" key="kpperiod" />
<feature name="kpplus" key="kpplus" />
<feature name="l" key="l" />
<feature name="left" key="left" />
@@ -243,7 +236,6 @@
<feature name="leftbrace" key="leftbrace" />
<feature name="leftbracket" key="leftbracket" />
<feature name="leftctrl" key="leftctrl" />
- <feature name="leftmeta" key="leftmeta" />
<feature name="leftparen" key="leftparen" />
<feature name="leftshift" key="leftshift" />
<feature name="leftsuper" key="leftsuper" />
@@ -251,7 +243,6 @@
<feature name="m" key="m" />
<feature name="menu" key="menu" />
<feature name="minus" key="minus" />
- <feature name="mode" key="mode" />
<feature name="n" key="n" />
<feature name="numlock" key="numlock" />
<feature name="o" key="o" />
@@ -261,18 +252,15 @@
<feature name="pause" key="pause" />
<feature name="period" key="period" />
<feature name="plus" key="plus" />
- <feature name="power" key="power" />
<feature name="printscreen" key="printscreen" />
<feature name="q" key="q" />
<feature name="question" key="question" />
<feature name="quote" key="quote" />
<feature name="r" key="r" />
<feature name="right" key="right" />
- <feature name="rightalt" key="rightalt" />
<feature name="rightbrace" key="rightbrace" />
<feature name="rightbracket" key="rightbracket" />
<feature name="rightctrl" key="rightctrl" />
- <feature name="rightmeta" key="rightmeta" />
<feature name="rightparen" key="rightparen" />
<feature name="rightshift" key="rightshift" />
<feature name="rightsuper" key="rightsuper" />
@@ -281,19 +269,32 @@
<feature name="semicolon" key="semicolon" />
<feature name="slash" key="slash" />
<feature name="space" key="space" />
- <feature name="sysreq" key="sysreq" />
<feature name="t" key="t" />
<feature name="tab" key="tab" />
<feature name="tilde" key="tilde" />
<feature name="u" key="u" />
<feature name="underscore" key="underscore" />
- <feature name="undo" key="undo" />
<feature name="up" key="up" />
<feature name="v" key="v" />
<feature name="w" key="w" />
<feature name="x" key="x" />
<feature name="y" key="y" />
<feature name="z" key="z" />
+ <!-- dead keys means no key handling for
+ for symbol ^ - left of key 1
+ for symbol ° - left of SHIFT key 1 = !
+ for symbol § - SHIFT key 3
+ for symbol % - SHIFT key 5
+ for symbols Ä and ä
+ for symbols Ö and ö
+ for symbols Ü and ü
+ for symbol ² - AltGR 2
+ for symbol ³ - AltGR 3
+ for symbol ´ - dead key left oft BACKSPACE
+ for symbol ` - dead key SHIFT left of BACKSPACE
+ for symbol € - AltGR E
+ for symbol µ - AltGR M
+ -- end of dead keys -->
</controller>
</device>
</buttonmap> I see that some keys don't have a map here, which makes sense because the default keyboard keys are based on operating system scancodes, and not all scancodes have a dedicated key (such as the shifted numbers). For example, see how the Similarly, there's no key for a lot of RETROK_* constants, because these are scancodes, not physical keys. Scancodes are the same for both English and German keyboards (because they're defined by the OS), which is why your buttonmap here only has omissions, not any changes. If you have dead keys, that's a deeper code problem, not a buttonmap problem. But what do you mean by "dead"? What happens when you use the "Select Key" button in the controller mapper dialog? |
I updated kodi-game/controller-topology-project#249 to use QWERTY keys. I sorted the keys to match the ergonomic positions on a regular keyboard, which greatly helps map the "weird" keys. I also updated xbmc/peripheral.joystick#270 to use QWERTY keys. Here's the diff: --- a/peripheral.joystick/resources/buttonmaps/xml/application/Keyboard.xml
+++ b/peripheral.joystick/resources/buttonmaps/xml/application/Keyboard.xml
@@ -13,14 +13,14 @@
<feature name="8" key="8" />
<feature name="9" key="9" />
<feature name="a" key="a" />
- <feature name="at" key="leftbracket" />
+ <feature name="at" key="grave" />
<feature name="b" key="b" />
- <feature name="backslash" key="grave" />
+ <feature name="backslash" key="backslash" />
<feature name="c" key="c" />
<feature name="capslock" key="capslock" />
- <feature name="closebracket" key="backslash" />
+ <feature name="closebracket" key="rightbracket" />
<feature name="clr" key="delete" />
- <feature name="colon" key="semicolon" />
+ <feature name="colon" key="quote" />
<feature name="comma" key="comma" />
<feature name="control" key="leftctrl" />
<feature name="copy" key="leftalt" />
@@ -57,7 +57,7 @@
<feature name="mousetoggle" key="insert" />
<feature name="n" key="n" />
<feature name="o" key="o" />
- <feature name="openbracket" key="rightbracket" />
+ <feature name="openbracket" key="leftbracket" />
<feature name="p" key="p" />
<feature name="play" key="home" />
<feature name="q" key="q" />
@@ -66,7 +66,7 @@
<feature name="rewind" key="pageup" />
<feature name="right" key="right" />
<feature name="s" key="s" />
- <feature name="semicolon" key="quote" />
+ <feature name="semicolon" key="semicolon" />
<feature name="shift" key="leftshift" />
<feature name="slash" key="slash" />
<feature name="space" key="space" /> |
I created the last PC Keyboard.xml with Settings -> System -> Input -> Configure attached controllers -> (under Controller profiles) Keyboard. The last buttons in the list are Power, € and Undo. Hardware keyboard layouts is defined with German. With dead I mean there is no output in the emulator. Sometimes I can see (with debugging on) key messages within kodi.log or with journalctl -f Within DOSbox e.g. I push "<" and get (within kodi.log)
and with journalctl -f nothing.
when I push "a". Hope this answered your questions. |
Are the keys recognized by Kodi? Can you use the "Select Key" button to map these? Can you post a debug log segment showing the keys being pressed? |
key "<" gives that, so answer is YES :)
|
The reason why you get nothing in DOSBox with < is because it maps to RETROK_LESS which isn't defined by dosbox: https://github.com/libretro/dosbox-libretro/blob/master/libretro/mapper.cpp#L56. If you map < to a different key from the list of supported keys, does that work in dosbox? |
No. I mapped "<" to "a":
Pushing "<" within DOSbox gives:
Pushing "a" within DOSbox gives:
|
<?xml version="1.0" ?>
<buttonmap>
<device name="Keyboard" provider="application">
<controller id="game.controller.keyboard">
<feature name="less" key="a" />
</controller>
</device>
</buttonmap> You mapped physical Pressing physical |
<?xml version="1.0" ?>
<buttonmap>
<device name="Keyboard" provider="application">
<controller id="game.controller.keyboard">
<feature name="less" key="a" />
</controller>
</device>
</buttonmap> "key" is the keyboard scancode. It looks like you physically pressed A. "name" is the key name defined in layout.xml. "name" is also the lookup value in buttonmap.xml. It looks like you did the "Select Key" button and pressed < then A. Can you try in reverse? |
Sure, reversing:
Pushing key "<" prints now the "a" within DOSbox. |
Does that address the remaining issues? What's left to merge kodi-game/controller-topology-project#249 and kodi-game/game.libretro.dosbox#14? What still doesn't work for you? |
As I wrote it above (see #7 (comment) ) there is a problem with SHIFT 1 and higher. Please let's concentrate on the CPC emulator now, otherwise I start to get confused ;-) I can't get the EXCLAIM symbol with a short SHIFT and 1. also still weird are COMMA and PERIOD. But when I hold down COMMA till it runs, and press SHIFT, I see LESS, and it continues running although I release all keys. The same with the neighbor: Holding down PERIOD for a while, and pressing SHIFT, I see greater, releasing all buttons, PERIOSs are running. The last is MINUS, short with SHIFT gives nothing. Holding down and SHIFT gives ======== releasing .......... till end of line. It looks like the release of some keys are not handled right enough. I guess, like it is, it could make people mad ;-) PS: PERIOD on the numeric part, should it COMMA or PERIOD? Right now, it is COMMA. And the rest is functional as expected :) |
Were you able to reproduce the keyboard behaviour which I described a week ago? |
Sorry, some work stuff came up and Kodi time went to zero. Not sure when I get a chance next, but I'll try to reproduce your keypresses when I'm able to. |
I had some time for kodi this last week (if you've seen) but unfortunately didn't get Amstrad working yet. I put some thought into it. Could it be that the weird shifting behavior is because libretro doesn't send keyboard modifiers (e.g. shift & x) but instead two separate key presses (one shift press and one x press)? Of course, it's virtually impossible to map a libretro button map that works for both English and German. However, I found this in the codebase: https://github.com/xbmc/xbmc/tree/master/system/keyboardlayouts Now, theoretically, if you were to write an XML file that supported both Kodi keyboard layouts and past historical emulator layouts, how would that XML look? Because we have accurate physical and symbol information it should be possible of solving any keyboard to any other keyboard, similar to how we correctly solve any controller to any other controller. |
I just looked at https://github.com/xbmc/xbmc/blob/master/system/keyboardlayouts/german.xml and see that this keyboard layout is not quite right: https://en.wikipedia.org/wiki/German_keyboard_layout#/media/File:KB_Germany.svg Could this be the reason that some keys are not working properly with some emulators (dosbox and caprice32) ? When I push all keys (under Ubuntu 20.04.6 LTS) I get this german.xml:
|
discovered by not being able to type RUN for Amstrad - CPC (Caprice32) 4.5 HI:
game.libretro.cap32/resources/buttonmap.xml
and many symbols are not reachable like ! or $ for example (also under DOSbox and caprice32 with LE nightly on an RPi4)
The text was updated successfully, but these errors were encountered: