Welcome, Guest. Please login or register.

Author Topic: Reasons why I don't like emulators - or why xx-UAE is really unusable  (Read 6518 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline Georg

  • Jr. Member
  • **
  • Join Date: Feb 2002
  • Posts: 90
    • Show all replies
Quote from: Thomas Richter;776105

However, if I cannot enter a backslash from the keyboard, then that's a real show-stopper. I cannot work with it if the backslash is missing, no chance.


Make your own keymap by modifying the asm source of the Amiga "d" keymap (can be found on Amiga Dev CD 2.1).

Code: [Select]

-       DC.B    '_','-','?',$DF ; sharp s, ?, -, _
+       DC.B    '|','\','?',$DF ; sharp s, ?, -, _
 

Offline Georg

  • Jr. Member
  • **
  • Join Date: Feb 2002
  • Posts: 90
    • Show all replies
Re: Reasons why I don't like emulators - or why xx-UAE is really unusable
« Reply #1 on: October 30, 2014, 10:51:55 AM »
Quote from: Thomas Richter;776065
Write a C program without the backslash is challenging.


Btw, when using UAE it makes more sense to use text editors running in the host OS (UAE can mount host directories as volumes). AOS needs to be rebooted -> host text editors stay open. No need to restart/reopen all your source files.
 

Offline Georg

  • Jr. Member
  • **
  • Join Date: Feb 2002
  • Posts: 90
    • Show all replies
Re: Reasons why I don't like emulators - or why xx-UAE is really unusable
« Reply #2 on: October 31, 2014, 08:08:17 AM »
Quote from: Thomas Richter;776217
Because the German Amiga keyboard has one extra key to the right of the backspace key, with the | and \ symbols printed on it a German PC keyboard does not have. The key does not exist. On the Amiga keyboard, it is cut off from the backspace key which has only half the size of its PC equivalent. Hence, you cannot type backspaces on UAE, neither pipes.


So what should UAE do during each of this "stages":

1) User presses ALTGR key
2) User presses "ß ? \" key (UAE can detect this now as host vanilla backspace key)
3) User releases ALTGR key
4) User releases "ß ?`\" key

UAE needs to pass Amiga rawkey codes to the emulated hardware.

On a french PC keyboard the stages would be like this (if I used xkb tools correctly):

1) User presses ALTGR key
2) User presses "_ 8 \" key (UAE can detect this now as host vanilla backspace key)
3) User releases ALTGR key
4) User releases "_ 8 \" key

On an italian PC keyboard it would be:

1) User presses key at the left side of "1" (UAE can detect this now as host vanilla backspace key)
2) User releases key at the left side of "1"
 

Offline Georg

  • Jr. Member
  • **
  • Join Date: Feb 2002
  • Posts: 90
    • Show all replies
Re: Reasons why I don't like emulators - or why xx-UAE is really unusable
« Reply #3 on: November 01, 2014, 09:22:52 AM »
Quote from: Thomas Richter;776330
Or build a keymap myself because the emulator fails emulating the keyboard in a useful way?


So you want UAE to be full of (pseudo)code like this:

Code: [Select]

if (host_vanilla_key_pressed == '\\')
{
  if (host_keymap == german)
  {
      generate_amiga_rawkey(ALT_RELEASE); /* because user pressed ALTGR + ß */
      generate_amiga_rawkey(RAWKEY_BACKSPACE_PRESSED);
      generate_amiga_rawkey(ALT_PRESSED);
  }
}

if (host_vanilla_key_released == '\\')
{
   if (host_keymap == german)
   {
      if (alt_pressed) generate_amiga_rawkey(ALT_RELEASE);
      generate_amiga_rawkey(RAWKEY_BACKSPACE_RELEASED);
      if (alt_pressed) generate_amiga_rawkey(ALT_PRESSED);
   }
}


This is ugly as hell and wrong too, because now the emulated Amiga sees key presses/releases which never happened (ALT key).

Apart from building/modifying a keymap you could also just use FKey commodity to make it insert the backspace key event when alt + ß is pressed.
 

Offline Georg

  • Jr. Member
  • **
  • Join Date: Feb 2002
  • Posts: 90
    • Show all replies
Re: Reasons why I don't like emulators - or why xx-UAE is really unusable
« Reply #4 on: November 01, 2014, 01:38:33 PM »
Quote from: Thomas Richter;776374
a) Read the keycode from X11, b) translate the key-code into ASCII (X11 has functions for that, yes) c) translate this ASCII code into the press for the key that translates to this ASCII on the corresponding Amiga keyboard.


That's broken, too. Rawkey code of one and same physical key can then differ, depending on whether a key like ALT is currently pressed down, or not. Think of a game which allows you to redefine action keys. It will most likely store the configured key using the rawkey code. This will not work with your approach on a German keyboard for the "ß ? \" key. During gameplay different rawkey code event received depending on whether ALT (maybe used for strafing) is held down, or not.

And what about runtime switching of the keymap in AmigaOS. My A500 had American keyboard layout, my A1200 Italian keyboard layout. I often used it with American keyboard layout as I was used to that from A500. But I also switched to German or Italian layout, depending on what I was doing.
 

Offline Georg

  • Jr. Member
  • **
  • Join Date: Feb 2002
  • Posts: 90
    • Show all replies
Re: Reasons why I don't like emulators - or why xx-UAE is really unusable
« Reply #5 on: November 02, 2014, 07:44:06 AM »
Quote from: Thomas Richter;776447

More workarounds, then? Ok, let me see, how do I get it into the Amiga... Emulated network card, with emulated ssh connection, probably cvs on the Amiga side...


??? As said you can mount Linux directories in UAE as AmigaOS volume. Edit a text file with Linux text editor and when saved to Linux directory it is immediately available in AmigaOS under UAE.
 

Offline Georg

  • Jr. Member
  • **
  • Join Date: Feb 2002
  • Posts: 90
    • Show all replies
Re: Reasons why I don't like emulators - or why xx-UAE is really unusable
« Reply #6 on: November 03, 2014, 07:33:02 AM »
Quote from: Thomas Richter;776447
No, the level a key has to be handled depends on the key, and there's more than ASCII and scancode, really. Scancode is completely wrong, because the user can re-assign keys, and the scan code doesn't get that. ASCII is wrong because some keys do not even generate ASCII.  You need a multi-level translation: 1) Get the key function from the Os (not the scan code!). 2) Check whether that function maps to a printable "non-dead" key. 3) If not so, map to the corresponding function key on the host keyboard. For the Amiga, there is no multi-level translation, so just map it to the scancode. 4) If so, get the Amiga keyboard (by GUI configuration, or by a smarter way from AmigaOs through an emulation layer). From there, find the scancode for the key. Send one or multiple scan codes to emulate that key (or keys) to generate the same effect.

This algorithm works, and yes, I had this implemented, though not for xxx-UAE purposes.


No, there are other problems with this algorithm, too. Keyboard is used for more things than just typing text. For example think about keyboard shortcuts in a paint/music/cad/3d program. Or about commodity hotkeys. For these it is irrelevant what ASCII the key would produce when used in a text typing program/editor.

A shortcut like "CTRL ALT Q" should always remain on the Q key, even if on the host this sequence would produce the "@" key which on the Amiga keyboard may not be on the Q keq but somewhere else.