Merged with master and kept new updates.

This commit is contained in:
David Khachaturov 2019-10-21 20:31:39 +01:00
commit 5b7f16a876
7 changed files with 64 additions and 22 deletions

View file

@ -29,8 +29,13 @@ namespace BetterJoyForCemu {
private bool ContainsText(ListBox a, String manu) {
foreach (var v in a.Items)
if ((v as dynamic).Text.Equals(manu))
{
dynamic d = v as dynamic;
if (d.Text == null)
continue;
if (d.Text.Equals(manu))
return true;
}
return false;
}

View file

@ -49,5 +49,7 @@
<!-- When enabled, can only calibrate one controller at a time. -->
<!-- Default: false -->
<add key="NonOriginalController" value="false" />
<!-- The program will keep the HOME button LED ring light on at all times-->
<add key="HomeLEDOn" value="false"/>
</appSettings>
</configuration>

View file

@ -175,7 +175,6 @@
</ItemGroup>
<ItemGroup>
<None Include="Properties\app.manifest" />
<None Include="FodyWeavers.xml" />
<Content Include="Icons\betterjoyforcemu_icon.ico" />
<Content Include="hidapi.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>

View file

@ -347,7 +347,7 @@ namespace BetterJoyForCemu {
dump_calibration_data();
}
BlinkLED();
BlinkHomeLight();
a[0] = leds_;
Subcommand(0x30, a, 1);
@ -364,16 +364,29 @@ namespace BetterJoyForCemu {
return 0;
}
public void SetLED(byte leds_ = 0x0) {
public void SetPlayerLED(byte leds_ = 0x0) {
Subcommand(0x30, new byte[] { leds_ }, 1);
}
public void BlinkLED() { // do not call after initial setup
byte[] a = Enumerable.Repeat((byte)0xFF, 25).ToArray(); // LED ring
public void BlinkHomeLight() { // do not call after initial setup
byte[] a = Enumerable.Repeat((byte)0xFF, 25).ToArray();
a[0] = 0x18;
a[1] = 0x01;
Subcommand(0x38, a, 25, false);
}
}
public void SetHomeLight(bool on) {
byte[] a = Enumerable.Repeat((byte)0xFF, 25).ToArray();
if(on) {
a[0] = 0x1F;
a[1] = 0xF0;
}
else {
a[0] = 0x10;
a[1] = 0x01;
}
Subcommand(0x38, a, 25, false);
}
private void BatteryChanged() { // battery changed level
foreach (var v in form.con) {

View file

@ -166,12 +166,12 @@ namespace BetterJoyForCemu {
v.other = jc;
jc.other = v;
// Set both Joycon LEDs to the one with the lowest ID
byte led = jc.LED <= v.LED ? jc.LED : v.LED;
jc.LED = led;
v.LED = led;
jc.SetLED(led);
v.SetLED(led);
//Set both Joycon LEDs to the one with the lowest ID
byte led = jc.LED <= v.LED ? jc.LED : v.LED;
jc.LED = led;
v.LED = led;
jc.SetPlayerLED(led);
v.SetPlayerLED(led);
v.xin.Dispose();
v.xin = null;
@ -211,8 +211,8 @@ namespace BetterJoyForCemu {
//Set original Joycon LEDs
v.other.LED = (byte)(0x1 << v.other.PadId);
v.LED = (byte)(0x1 << v.PadId);
v.other.SetLED(v.other.LED);
v.SetLED(v.LED);
v.other.SetPlayerLED(v.other.LED);
v.SetPlayerLED(v.LED);
v.other.other = null;
v.other = null;
@ -263,6 +263,12 @@ namespace BetterJoyForCemu {
} else if (sender.GetType() == typeof(TextBox) && settings[KeyCtl] != null) {
settings[KeyCtl].Value = ((TextBox)valCtl).Text.ToLower();
}
if(KeyCtl == "HomeLEDOn") {
bool on = settings[KeyCtl].Value.ToLower() == "true";
foreach(Joycon j in Program.mgr.j) {
j.SetHomeLight(on);
}
}
configFile.Save(ConfigurationSaveMode.Modified);
ConfigurationManager.RefreshSection(configFile.AppSettings.SectionInformation.Name);
} catch (ConfigurationErrorsException) {

View file

@ -230,8 +230,8 @@ namespace BetterJoyForCemu {
byte led = temp.LED <= v.LED ? temp.LED : v.LED;
temp.LED = led;
v.LED = led;
temp.SetLED(led);
v.SetLED(led);
temp.SetPlayerLED(led);
v.SetPlayerLED(led);
temp.xin.Dispose();
temp.xin = null;
@ -256,7 +256,14 @@ namespace BetterJoyForCemu {
jc.xin.Connect();
jc.Attach(leds_: jc.LED);
jc.Begin();
bool on = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None).AppSettings.Settings["HomeLEDOn"].Value.ToLower() == "true";
foreach (Joycon j in Program.mgr.j)
{
j.SetHomeLight(on);
}
jc.Begin();
if (form.nonOriginal) {
jc.getActiveData();
}

View file

@ -3,10 +3,10 @@ Allows the Nintendo Switch Pro Controller and Joycons to be used with [Cemu](htt
If anyone would like to donate (for whatever reason), [you can do so here](https://www.paypal.me/DavidKhachaturov/5).
## Nightly builds (updated 16/04/19)
## Nightly builds (updated 28/04/19)
Due to popular request (and my fear of releasing full builds without many new features), I will post newer "unofficial" builds here so you can test out the latest features and fixes.
* [64-bit](https://drive.google.com/open?id=1PV5Ecxj5sFzFNHqgYz5TLXVP6WF4CKQL)
* [32-bit](https://drive.google.com/open?id=1lR9nzBc4zznRj0lIaf78fCtAdh71fka6)
* [64-bit](https://drive.google.com/open?id=1-OEP7yV9RkTOzNhjiISl_9KDxpMAu9yR)
* [32-bit](https://drive.google.com/open?id=1gFknJU6RO6SR_ddHTWxs6qdStl8gLGY0)
### Screenshots
Collapsed | Expanded
@ -31,6 +31,12 @@ Collapsed | Expanded
* Added way to automatically enumerate options and enable to control them directly from the UI. Any further options can be supported.
* Click the arrow to open config panel.
* thanks [StarryTony](https://github.com/StarryTony)
* Fixed joycon LED bug and minimising behaviour.
* thanks [agustinmorantes](https://github.com/agustinmorantes)
* Added option to calibrate gyroscope for 3rd (and 1st) party controllers.
* Experimental - only supports pro controllers at the moment
* thanks [xqdoo00o](https://github.com/xqdoo00o)
* see _NonOriginalController_ option
### v5
* Progressive scanning
@ -125,7 +131,11 @@ Current settings are:
* Determines whether or not to use HidGuardian (improves compatibility with other programs, like Steam, when set to "false")
* ShowAsXInput *(default: true)*
* Determines whether or not the program will expose detected controllers as Xbox 360 controllers
* PurgeAffectedDevices *(default: true)*
* Determines whether or not the program should purge the affected devices list upon exit
* Should prevent any more issues of the controller being unusable after the program
* NonOriginalController *(default: false)*
* When "true", click the "Calibrate" button once to calibrate the gyroscope on your connect pro controller
# Problems
__Make sure you installed the drivers!!__