Skip to content

Commit

Permalink
removed bindings from dropdown that are only a modifier (alt,ctrl,shift)
Browse files Browse the repository at this point in the history
added appsettings.config (default = empty)

you can use this to overrule the path like this :

<?xml version="1.0" encoding="utf-8" ?>
<appSettings>
  <add key="SCData_p4k" value ="C:\Program Files\Roberts Space Industries\StarCitizen\LIVE\Data.p4k" />
  <add key="SCClientProfilePath" value ="C:\Program Files\Roberts Space Industries\StarCitizen\LIVE\USER\Client\0\Profiles\default" />
</appSettings>
  • Loading branch information
mhwlng committed Aug 10, 2021
1 parent dce054c commit e26f56e
Show file tree
Hide file tree
Showing 8 changed files with 55 additions and 11 deletions.
18 changes: 13 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
# streamdeck-starcitizen

TODO :

* Allow switching between LIVE and PTU versions. (Currently gets binding only from LIVE installation)

**Elgato Stream Deck button plugin for Star Citizen**

![Elgato Stream Deck button plugin for Star Citizen](https://i.imgur.com/FSHsXRG.png)
Expand All @@ -12,7 +8,7 @@ This plugin gets the key bindings from the Star Citizen game files.

The bindings in the streamdeck plugin are automatically updated when changing bindings in Star Citizen options screen.

The key is shown in the dropdown, localised for the current keyboard language (So: US keyboard shows WSAD, French keyboard shows ZSQD)
The bound key is shown in the dropdown, localised for the current keyboard language (So: US keyboard shows WSAD, French keyboard shows ZSQD)

**The plugin does not contain any button images or ready made streamdeck profiles.**

Expand Down Expand Up @@ -48,6 +44,18 @@ and extracts `defaultProfile.xml` and also english text resources. This could ta

**The plugin should automatically find the actual path where Star Citizen was installed.**

The path, that is found by the plugin, is logged in the `pluginlog.log` file.

If the path is incorrect, then the appsettings.config file can be adjusted with the correct paths to the p4k file and actionmaps.xml directory :

```
<?xml version="1.0" encoding="utf-8" ?>
<appSettings>
<add key="SCData_p4k" value ="C:\Program Files\Roberts Space Industries\StarCitizen\LIVE\Data.p4k" />
<add key="SCClientProfilePath" value ="C:\Program Files\Roberts Space Industries\StarCitizen\LIVE\USER\Client\0\Profiles\default" />
</appSettings>
```

Compressed versions (files ending in .scj) are cached in the plugin directory and should be automatically refreshed, the next time Star Citizen is updated to a new version AND the plugin is also restarted.

You can also delete the .scj files and restart the plugin, to extract the files from the p4k file again.
Expand Down
3 changes: 2 additions & 1 deletion starcitizen/App.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<appSettings configSource="appsettings.config" />
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
<runtime>
Expand Down
4 changes: 2 additions & 2 deletions starcitizen/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.4.0")]
[assembly: AssemblyFileVersion("1.0.4.0")]
[assembly: AssemblyVersion("1.0.5.0")]
[assembly: AssemblyFileVersion("1.0.5.0")]
9 changes: 8 additions & 1 deletion starcitizen/SC/DProfileReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,14 @@ public void Actions()
{
actions = maps
.SelectMany(x => x.Value.Actions)
.Where(x => !string.IsNullOrWhiteSpace(x.Value.Keyboard))
.Where(x => !string.IsNullOrWhiteSpace(x.Value.Keyboard) &&
x.Value.Keyboard != "lalt" &&
x.Value.Keyboard != "ralt" &&
x.Value.Keyboard != "lshift" &&
x.Value.Keyboard != "rshift" &&
x.Value.Keyboard != "lctrl" &&
x.Value.Keyboard != "rctrl"
)
.ToDictionary(x => x.Value.Name, x => x.Value);
}

Expand Down
22 changes: 21 additions & 1 deletion starcitizen/SC/SCPath.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Configuration;
using System.Linq;
using System.Text;
using System.IO;
Expand Down Expand Up @@ -101,7 +103,7 @@ static private string SCBasePath
{
//Logger.Instance.LogMessage(TracingLevel.DEBUG,"SCBasePath - Entry");

string scp = "";
string scp = "";

// start the registry search - sequence 5..1 to get the newest method first

Expand Down Expand Up @@ -231,6 +233,15 @@ static public string SCClientProfilePath
{
get
{
if (File.Exists("appSettings.config") &&
ConfigurationManager.GetSection("appSettings") is NameValueCollection appSection)
{
if ((!string.IsNullOrEmpty(appSection["SCClientProfilePath"]) && !string.IsNullOrEmpty(Path.GetDirectoryName(appSection["SCClientProfilePath"]))))
{
return appSection["SCClientProfilePath"];
}
}

//Logger.Instance.LogMessage(TracingLevel.DEBUG,"SCClientProfilePath - Entry");
string scp = SCClientUSERPath;
if (string.IsNullOrEmpty(scp)) return "";
Expand All @@ -254,6 +265,15 @@ static public string SCData_p4k
{
get
{
if (File.Exists("appSettings.config") &&
ConfigurationManager.GetSection("appSettings") is NameValueCollection appSection)
{
if ((!string.IsNullOrEmpty(appSection["SCData_p4k"]) && File.Exists(appSection["SCData_p4k"])))
{
return appSection["SCData_p4k"];
}
}

//Logger.Instance.LogMessage(TracingLevel.DEBUG,"SCDataXML_p4k - Entry");
string scp = SCClientPath;
if (string.IsNullOrEmpty(scp)) return "";
Expand Down
5 changes: 5 additions & 0 deletions starcitizen/appsettings.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8" ?>
<appSettings>
<add key="SCData_p4k" value ="" />
<add key="SCClientProfilePath" value ="" />
</appSettings>
2 changes: 1 addition & 1 deletion starcitizen/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"Name": "Star Citizen",
"Icon": "Images/pluginIcon",
"URL": "https://github.com/mhwlng/streamdeck-starcitizen",
"Version": "1.0.4",
"Version": "1.0.5",
"CodePath": "com.mhwlng.starcitizen",
"Category": "Star Citizen",
"CategoryIcon": "Images/categoryIcon",
Expand Down
3 changes: 3 additions & 0 deletions starcitizen/starcitizen.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,9 @@
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="appsettings.config">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="manifest.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
Expand Down

0 comments on commit e26f56e

Please sign in to comment.