Skip to content

Commit

Permalink
added documentation for my changes
Browse files Browse the repository at this point in the history
  • Loading branch information
alterNERDtive committed Sep 23, 2020
1 parent 94630e0 commit 95b8b76
Show file tree
Hide file tree
Showing 7 changed files with 95 additions and 4 deletions.
7 changes: 7 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# All files
[*]
guidelines = 80

# C# or VB files
[*.{cs,vb}]
guidelines = 80, 120
File renamed without changes.
53 changes: 53 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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).
2 changes: 1 addition & 1 deletion bindED.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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))
{
Expand Down
12 changes: 9 additions & 3 deletions bindEDplugin.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -55,22 +55,28 @@
<Content Include="EDMap-de-neo2.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="EDMap-us.txt">
<Content Include="EDMap-en-us.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="ReadMe.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<None Include=".editorconfig" />
<None Include="LICENSE">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="README.md">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PreBuildEvent>
</PreBuildEvent>
<PreBuildEvent>powershell if (Test-Path '$(SolutionDir)bindEDplugin.zip') { Remove-Item -Path '$(SolutionDir)bindEDplugin.zip' }</PreBuildEvent>
</PropertyGroup>
<PropertyGroup>
<PostBuildEvent>if $(ConfigurationName) == Release (powershell Compress-Archive -Path '$(TargetDir)' -DestinationPath '$(SolutionDir)bindEDplugin.zip' -Force)</PostBuildEvent>
</PropertyGroup>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
Expand Down
25 changes: 25 additions & 0 deletions bindEDplugin.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30517.126
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "bindEDplugin", "bindEDplugin.csproj", "{C8AC9134-639D-45D2-B5EF-138E0550E0C9}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{C8AC9134-639D-45D2-B5EF-138E0550E0C9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C8AC9134-639D-45D2-B5EF-138E0550E0C9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C8AC9134-639D-45D2-B5EF-138E0550E0C9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C8AC9134-639D-45D2-B5EF-138E0550E0C9}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {BBABAD60-B8A8-464D-BDA0-0F30A40E54A6}
EndGlobalSection
EndGlobal
Binary file added bindEDplugin.zip
Binary file not shown.

0 comments on commit 95b8b76

Please sign in to comment.