added ~bindsFile optional parameter to loadbinds context

fixes #18
This commit is contained in:
alterNERDtive 2021-05-22 17:55:34 +02:00
parent e63ff1bbab
commit d431e899bd
3 changed files with 29 additions and 2 deletions

View file

@ -1,3 +1,11 @@
# devel
## Added
* optional `~bindsFile` parameter for the `loadbinds` plugin context: use that
to specify a binds file instead of auto-detecting it from the currently active
preset.
# 4.0 (2021-05-19)
**Note**: If you do not own Odyssey, everything will work just as before!

View file

@ -53,6 +53,20 @@ by default overwrite Horizons
separate binds, you can set `bindED.disableHorizonsSync#` (yes, including the
pound sign) to `true` in your VoiceAttack profile.
### Specifying a Binds File to Load
This should generally not be necessary!
You can set the text variable `~bindsFile` to a specific file name (e.g.
`custom.3.0.binds`) before executing the `loadbinds` context to have that
specific binds file loaded.
Make sure to only use the _file name_ of an existing binds file, do _not_
specify the full path.
This should be a last resort effort for when the game introduces changes that
break the plugins auto detection.
## Support for non-US Keyboard Layouts
Shipped layouts:

View file

@ -90,7 +90,7 @@ namespace bindEDplugin
}
private static Dictionary<string, List<string>>? _binds;
public static string VERSION = "4.0";
public static string VERSION = "4.1";
public static string VA_DisplayName() => $"bindED Plugin v{VERSION}-alterNERDtive";
@ -137,6 +137,10 @@ namespace bindEDplugin
// force reset everything
Layout = null;
Preset = null;
if (!String.IsNullOrWhiteSpace(_VA.GetText("~bindsFile")))
{
Binds = ReadBinds(Path.Combine(_bindingsDir, _VA.GetText("~bindsFile")));
}
LoadBinds(Binds);
}
else if (context == "missingbinds")
@ -226,7 +230,8 @@ namespace bindEDplugin
}
}
}
LogInfo($"Elite binds '{Preset}' for layout '{Layout}' loaded successfully.");
LogInfo($"Elite binds '{(String.IsNullOrWhiteSpace(_VA!.GetText("~bindsFile")) ? Preset : _VA!.GetText("~bindsFile"))}' for layout '{Layout}' loaded successfully.");
}
private static void MissingBinds(Dictionary<string, List<string>>? binds)