From 95b8b7688a61e80b7ed347980e5dbe84796c1c09 Mon Sep 17 00:00:00 2001 From: alterNERDtive Date: Wed, 23 Sep 2020 19:37:40 +0200 Subject: [PATCH] added documentation for my changes --- .editorconfig | 7 +++++ EDMap-us.txt => EDMap-en-us.txt | 0 README.md | 53 ++++++++++++++++++++++++++++++++ bindED.cs | 2 +- bindEDplugin.csproj | 12 ++++++-- bindEDplugin.sln | 25 +++++++++++++++ bindEDplugin.zip | Bin 0 -> 20416 bytes 7 files changed, 95 insertions(+), 4 deletions(-) create mode 100644 .editorconfig rename EDMap-us.txt => EDMap-en-us.txt (100%) create mode 100644 README.md create mode 100644 bindEDplugin.sln create mode 100644 bindEDplugin.zip diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..7cc3eb8 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,7 @@ +# All files +[*] +guidelines = 80 + +# C# or VB files +[*.{cs,vb}] +guidelines = 80, 120 \ No newline at end of file diff --git a/EDMap-us.txt b/EDMap-en-us.txt similarity index 100% rename from EDMap-us.txt rename to EDMap-en-us.txt diff --git a/README.md b/README.md new file mode 100644 index 0000000..8387ebf --- /dev/null +++ b/README.md @@ -0,0 +1,53 @@ +# bindED + +This VoiceAttack plugin reads keybindings in Elite:Dangerous and stores them as +VoiceAttack variables. It has originally been written by Gary (the developer of +VoiceAttack) [and published on the VoiceAttack +forums](https://forum.voiceattack.com/smf/index.php?topic=564.0). + +You can find the [original README here](ReadMe.txt). + +I have taken the original source code and added automatic detection of the +correct bindings file and support for non-US keyboard layouts. + +## Automatic Bindings Detection + +Elite creates a file `StartPreset.start` in the Bindings directory that contains +the name of the currently active profile. The plugin now reads that file and +loads the correct profile automatically. + +Should the file for some reason a) not exist, b) be empty or c) contain an +invalid preset name the old default is used: the most recently changed `.binds` +file. + +You can still manually provide a bindings file to use instead by setting it as +the plugin context, as before. + +## Support for non-US Keyboard Layouts + +If you are using any non-US layout you might have noticed that some binds don’t +work. Elite internally uses keycode values (a number assigned to each key on the +keyboard) for its bindings but for some reason both displays and saves them as +keysyms (the label on the key), according to the UK QWERTY keyboard layout. That +means VoiceAttack can’t just send the keysym it reads from a binding, it has to +translate it into the corresponding keycode. + +The original plugin contained a `EDMap.txt` file that contains infomration on +that conversion _for the US keyboard layout_. If you are using any other layout +that information will be incorrect for any symbols that are on a different key +than they are on the US layout. + +I have added the option to use maps for other keyboard layouts. In order to do +so you will have to set a text variable in VoiceAttack called `bindED.layout` to +the layout you want to use before invoking the plugin. If the variable is not +set it will defaut to “en-us”, leaving the original behaviour intact. + +I have included a map file for [Neo2](https://neo-layout.org) +(`EDMap-de-neo2.txt`) which is the layout that I am using personally. If you are +on a different layout, you will have to create a corresponding map file yourself +or prod me to add it. E.g. for the french AZERTY it would be `EDMap-fr-fr.text` +and set `bindED.layout` to “fr-fr”. For US Dvorak, `EDmap-en-us-dvorak` and +“en-us-dvorak”. You can see where this is going. + +For more information on [creating new supported keyboard layouts see the +Wiki](https://github.com/alterNERDtive/bindED/wiki/Keyboard-Layouts). \ No newline at end of file diff --git a/bindED.cs b/bindED.cs index a956aec..943ef03 100644 --- a/bindED.cs +++ b/bindED.cs @@ -35,7 +35,7 @@ public static void LoadBinds(dynamic vaProxy, Boolean fromInvoke) try { string layout = vaProxy.GetText("bindED.layout"); - string mapFile = (layout == null ? "EDMap-us.txt" : $"EDMap-{layout.ToLower()}.txt"); + string mapFile = (layout == null ? "EDMap-en-us.txt" : $"EDMap-{layout.ToLower()}.txt"); String strMap = Path.Combine(strDir, mapFile); if (File.Exists(strMap)) { diff --git a/bindEDplugin.csproj b/bindEDplugin.csproj index 071648a..d7fb5e6 100644 --- a/bindEDplugin.csproj +++ b/bindEDplugin.csproj @@ -55,7 +55,7 @@ PreserveNewest - + PreserveNewest @@ -63,14 +63,20 @@ + PreserveNewest + + PreserveNewest + - - + powershell if (Test-Path '$(SolutionDir)bindEDplugin.zip') { Remove-Item -Path '$(SolutionDir)bindEDplugin.zip' } + + + if $(ConfigurationName) == Release (powershell Compress-Archive -Path '$(TargetDir)' -DestinationPath '$(SolutionDir)bindEDplugin.zip' -Force)