- Fixed DS4 joycon joining bug
This commit is contained in:
parent
cd659366b5
commit
7b722dddb3
3 changed files with 31 additions and 21 deletions
|
@ -44,7 +44,7 @@
|
|||
<!-- Determines whether or not to use HidGuardian (improves compatibility with other programs, like Steam, when set to "false") -->
|
||||
<!-- When "true", BetterJoyForCemu will hide the Pro/Joycons from other programs to prevent glitching out on exit and to prevent DI/XI clashes in certain programs -->
|
||||
<!-- Default: false -->
|
||||
<add key="UseHIDG" value="false" />
|
||||
<add key="UseHIDG" value="true" />
|
||||
|
||||
|
||||
<!-- Determines whether or not to enable (experimental - currently default controller to pro) support for 3rd-party controllers. Adds a "Calibrate" button. -->
|
||||
|
|
|
@ -283,18 +283,18 @@ namespace BetterJoyForCemu {
|
|||
}
|
||||
}
|
||||
|
||||
private void Ds4_FeedbackReceived(object sender, DualShock4FeedbackReceivedEventArgs e) {
|
||||
public void getActiveData() {
|
||||
this.activeData = form.activeCaliData(serial_number);
|
||||
}
|
||||
|
||||
public void ReceiveRumble(object sender, Nefarius.ViGEm.Client.Targets.Xbox360.Xbox360FeedbackReceivedEventArgs e) {
|
||||
SetRumble(lowFreq, highFreq, (float)(e.LargeMotor + e.SmallMotor) / (float)255, rumblePeriod);
|
||||
|
||||
if (other != null && other != this)
|
||||
other.SetRumble(lowFreq, highFreq, (float)(e.LargeMotor + e.SmallMotor) / (float)255, rumblePeriod);
|
||||
}
|
||||
|
||||
public void getActiveData() {
|
||||
this.activeData = form.activeCaliData(serial_number);
|
||||
}
|
||||
|
||||
public void ReceiveRumble(object sender, Nefarius.ViGEm.Client.Targets.Xbox360.Xbox360FeedbackReceivedEventArgs e) {
|
||||
public void Ds4_FeedbackReceived(object sender, DualShock4FeedbackReceivedEventArgs e) {
|
||||
SetRumble(lowFreq, highFreq, (float)(e.LargeMotor + e.SmallMotor) / (float)255, rumblePeriod);
|
||||
|
||||
if (other != null && other != this)
|
||||
|
@ -531,7 +531,6 @@ namespace BetterJoyForCemu {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
if (ret > 0) {
|
||||
// Process packets as soon as they come
|
||||
for (int n = 0; n < 3; n++) {
|
||||
|
|
|
@ -138,6 +138,7 @@ namespace BetterJoyForCemu {
|
|||
|
||||
bool toRumble = Boolean.Parse(ConfigurationManager.AppSettings["EnableRumble"]);
|
||||
bool showAsXInput = Boolean.Parse(ConfigurationManager.AppSettings["ShowAsXInput"]);
|
||||
bool showAsDS4 = Boolean.Parse(ConfigurationManager.AppSettings["ShowAsDS4"]);
|
||||
|
||||
public void locBtnClick(object sender, EventArgs e) {
|
||||
Button bb = sender as Button;
|
||||
|
@ -177,8 +178,15 @@ namespace BetterJoyForCemu {
|
|||
jc.SetPlayerLED(led);
|
||||
v.SetPlayerLED(led);
|
||||
|
||||
v.xin.Disconnect();
|
||||
v.xin = null;
|
||||
if (v.xin != null) {
|
||||
v.xin.Disconnect();
|
||||
v.xin = null;
|
||||
}
|
||||
|
||||
if (v.ds4 != null) {
|
||||
v.ds4.Disconnect();
|
||||
v.ds4 = null;
|
||||
}
|
||||
|
||||
// setting the other joycon's button image
|
||||
foreach (Button b in con)
|
||||
|
@ -196,15 +204,8 @@ namespace BetterJoyForCemu {
|
|||
if (b.Tag == v)
|
||||
b.BackgroundImage = v.isLeft ? Properties.Resources.jc_left : Properties.Resources.jc_right;
|
||||
} else if (v.other != null && !v.isPro) { // needs disconnecting from other joycon
|
||||
if (v.xin == null) {
|
||||
ReenableXinput(v);
|
||||
v.xin.Connect();
|
||||
}
|
||||
|
||||
if (v.other.xin == null) {
|
||||
ReenableXinput(v.other);
|
||||
v.other.xin.Connect();
|
||||
}
|
||||
ReenableViGEm(v);
|
||||
ReenableViGEm(v.other);
|
||||
|
||||
button.BackgroundImage = v.isLeft ? Properties.Resources.jc_left_s : Properties.Resources.jc_right_s;
|
||||
|
||||
|
@ -260,12 +261,22 @@ namespace BetterJoyForCemu {
|
|||
Environment.Exit(0);
|
||||
}
|
||||
|
||||
void ReenableXinput(Joycon v) {
|
||||
if (showAsXInput) {
|
||||
void ReenableViGEm(Joycon v) {
|
||||
if (showAsXInput && v.xin == null) {
|
||||
v.xin = Program.emClient.CreateXbox360Controller();
|
||||
|
||||
if (toRumble)
|
||||
v.xin.FeedbackReceived += v.ReceiveRumble;
|
||||
v.xin.Connect();
|
||||
}
|
||||
|
||||
if (showAsDS4 && v.ds4 == null) {
|
||||
v.ds4 = Program.emClient.CreateDualShock4Controller();
|
||||
v.ds4.AutoSubmitReport = false;
|
||||
|
||||
if (toRumble)
|
||||
v.ds4.FeedbackReceived += v.Ds4_FeedbackReceived;
|
||||
v.ds4.Connect();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue