PC AZERTY keyboard layout for SS/BII on non-OSX hosts

About SheepShaver, a PPC Mac emulator for Windows, MacOS X, and Linux that can run System 7.5.3 to MacOS 9.0.4.

Moderators: Cat_7, Ronald P. Regensburg, ClockWise

Post Reply
User avatar
Talking Yogurt
Space Cadet
Posts: 3
Joined: Tue Apr 25, 2023 10:02 pm

PC AZERTY keyboard layout for SS/BII on non-OSX hosts

Post by Talking Yogurt »

Hello everyone ! First post here. Before anything else, a big THANK YOU to all the emulator developers, maintainers and packagers out there. :smile:

After much swearing and gnashing of teeth, I created a keyboard layout for my own use but it may be useful to others.

The Mac French AZERTY keyboard is a pretty good layout and allows typing in quite a few more languages than just French, however it's also quite different from the usual 105-key PC layout. For instance the € is on key R, while the @ is on key ².
This keyboard layout tries to mimic as best as possible the PC French AZERTY layout, with very few changes (for instance I couldn't find the character ² in ResEdit's KCHR editor, so I kept the @ instead). Option is used for AltGr, eg. Option-' = { [left curly brace].

Image

It isn't much but it saved me a ton of frustration when trying to type non-alphanumeric characters in SheepShaver.

DOWNLOAD LINK :arrow: https://transfert.free.fr/2G012vM

Right now it is hosted for 30 days but if anyone knows of a free/permanent hosting service, I am all ears (all eyes ?).

TO INSTALL : just unstuff the archive, quit all apps, drag the layout to the system file and it should become available. Same in reverse to uninstall.

It also needs a few adjustments to the keycodes file in order to have a 1:1 layout: the order of modifiers should be Control - Command - Option - [space] - Option - Command - Control.
This is how I set them up (again, for Windows / SDL2) :

Code: Select all

224	54	# Ctrl Left --> Control
227	55	# Logo Left --> Command
226	58	# Alt Left --> Option
230	58	# Alt Right --> Option
231	55	# Logo Right --> Command
228	54	# Ctrl Right --> Control
Also, the = key on the numpad is absent from the PC layout, so I mapped = to the Menu key.

Tell me if it works for you, or if it exploded your computer !
User avatar
Ronald P. Regensburg
Expert User
Posts: 7821
Joined: Thu Feb 09, 2006 10:24 pm
Location: Amsterdam, Netherlands

Re: PC AZERTY keyboard layout for SS/BII on non-OSX hosts

Post by Ronald P. Regensburg »

Apparently the French AZERTY keyboard layout differs between (Windows) PC and (Classic?) Mac. I did not know that.

Which keycodes file did you use? The current keycode files (since January 2022) are exactly as in your adjusted keycodes file for the modification keys. In combination with the default swapping of option and command keys in recent Windows and Linux builds (from kanjitalk755 source) that will result in the correct (Mac) order of these keys when used with a PC keyboard. But your order of modification keys is different. Maybe you use an older SheepShaver build or maybe in you prefs file the default is reversed by an entry "swap_opt_cmd false"?

The newer keycodes files (plus a ReadMe) should be (and were) added to the Windows build downloads that Cat_7 provides here, but I notice that he included the old keycodes file again with his latest build.

A separate download of the newer keycodes file can be found here: https://ronaldpr.home.xs4all.nl/keycode ... y_2022.zip
User avatar
Talking Yogurt
Space Cadet
Posts: 3
Joined: Tue Apr 25, 2023 10:02 pm

Re: PC AZERTY keyboard layout for SS/BII on non-OSX hosts

Post by Talking Yogurt »

Ronald P. Regensburg wrote: Wed Apr 26, 2023 3:06 pm Apparently the French AZERTY keyboard layout differs between (Windows) PC and (Classic?) Mac. I did not know that.
The difference is really between Apple and non-Apple : current French Apple keyboards have mostly the same physical and virtual layout as old ADB keyboards. In the distant past before Unicode, back when we had to specify codepages, Apple was proudly pushing international language support and realized that the "regular" AZERTY layout was pretty much garbage and missing a lot of French characters and typographical signs (like the « chevrons » we use as quote signs), so they made an (admittedly) better one... which is not a problem if you use a Mac emulator on a Mac host, because your muscle memory is probably tuned to Apple's layout.

But I use a (heavily customized) French layout on Windows 10, which really clashes with SheepShaver, hence this layout.

Ideally SheepShaver would be aware of the glyphs produced by the host input system, but that would be nightmarishly complex to implement properly. Or everyone could stick to QWERTY. :razz:

Ronald P. Regensburg wrote: Wed Apr 26, 2023 3:06 pm Which keycodes file did you use?
Ouch... I honestly cannot tell you. My SheepShaver folder has changed so many times between builds from this forum and my own, I have no idea which keycodes file it was originally. :???:

I had a look at the newer version, and the Read Me is not much help IMO : there should be a list, or at list a link to 1) Scancodes for every supported host system, and 2) target Keycodes. Right now it pretty much looks like voodoo magic. :shock:
User avatar
Ronald P. Regensburg
Expert User
Posts: 7821
Joined: Thu Feb 09, 2006 10:24 pm
Location: Amsterdam, Netherlands

Re: PC AZERTY keyboard layout for SS/BII on non-OSX hosts

Post by Ronald P. Regensburg »

The SDL2 scancodes are related to the keys on any physical keyboard, independent of the host system and not related to the characters produced by pressing the keys. The Mac keycodes are related to the keys on a physical Mac keyboard, also not to the characters produced with those keys.

The keycodes file translates SDL2 scancodes to Mac keycodes. This way a key press on any keyboard should produce in the emulator the result of pressing the corresponding key on a Mac keyboard.

So the SDL scancode for the Q key on any English QWERTY keyboard and the SDL scancode for the A on any French AZERTY keyboard are identical: 20
Similarly, the keycode for the Q on an English QWERT Mac keyboard and the keycode for the A on a French AZERTY Mac keyboard are identical: 12

The keycodes file translates the SDL scancode 20 to the Mac keycode 12.

The location of the keys as identified by scancode and keycode are the same on most keyboards, with a few differences between ANSI, ISO, and other keyboards as used in different parts of the world. The locations of the "Logo" key (Windows key, Control key) and the "Alt" key (Alt key, Option key) are always swapped between Mac keyboards and other keyboards.

Below are links to descriptions of SDL scancodes and Mac keycodes. While viewing these descriptions, keep in mind that the keys in such overviews are always identified by the character they will produce on a USA English system. The codes represent the actual physical keys, not the characters used to describe the keys.

An extensive list of SDL scancodes can be found here: https://www.libsdl.org/tmp/SDL/include/SDL_scancode.h
All Mac keycodes (also AppleScript keycodes) are shown here (on an ANSI keyboard): https://eastmanreference.com/complete-l ... -key-codes
Most keyboard layouts as used in different parts of the world are shown here: https://commons.wikimedia.org/wiki/File ... NT_JIS.png

I hope this will give some insight in the keycodes file and its limitations.
User avatar
Talking Yogurt
Space Cadet
Posts: 3
Joined: Tue Apr 25, 2023 10:02 pm

Re: PC AZERTY keyboard layout for SS/BII on non-OSX hosts

Post by Talking Yogurt »

Thank you for the links, it seems that SDL2 has unified scancodes between platforms (it wasn't the case with SDL1, which is obvious just by looking at the keycodes file).

However the information on keycodes you provide is only good in theory, or at least on real machine, but definitely not always in SheepShaver.
Case in point : the aforementioned list of keycodes shows Control as keycode 59, however in SheepShaver (9.0.4), I just checked and Control actually responds to keycode 54... while 59 is actually Cursor Left.
User avatar
Ronald P. Regensburg
Expert User
Posts: 7821
Joined: Thu Feb 09, 2006 10:24 pm
Location: Amsterdam, Netherlands

Re: PC AZERTY keyboard layout for SS/BII on non-OSX hosts

Post by Ronald P. Regensburg »

Talking Yogurt wrote: Wed Apr 26, 2023 11:33 pmCase in point : the aforementioned list of keycodes shows Control as keycode 59, however in SheepShaver (9.0.4), I just checked and Control actually responds to keycode 54... while 59 is actually Cursor Left.
Yes, you are right. I suppose it is a glitch in BasiliskII and SheepShaver code that has been there forever. 54 has always been used for the Control key in the keycode files and as that worked with existing BasiliskII and SheepShaver no one cared to investigate this.

Here is another reference for Apple keycodes: http://macbiblioblog.blogspot.com/2014/ ... -keys.html
Left arrow is keycode 123
54 is listed as "unassigned" keycode.
Post Reply