Davidobot / BetterJoy

Allows the Nintendo Switch Pro Controller, Joycons and SNES controller to be used with CEMU, Citra, Dolphin, Yuzu and as generic XInput
Other
3.89k stars 344 forks source link

[Bug] Lag present in v6, but not in Nightly version #266

Closed cdmoras closed 4 years ago

cdmoras commented 4 years ago

I have a 2seg lag after updating to V6 when 2 Joys are connected (vertical as one, AND horizontal as two controllers).

I had the V5 Nightly version downloaded on March 28th and it worked fine. With 2 joys horizontal it worked perfect. With 2 joys vertical as one, it had a little lag in some random occasions.

I had to return to the previous version in order to play.

aescalona commented 4 years ago

I have a 2seg lag after updating to V6 when 2 Joys are connected (vertical as one, AND horizontal as two controllers).

I had the V5 Nightly version downloaded on March 28th and it worked fine. With 2 joys horizontal it worked perfect. With 2 joys vertical as one, it had a little lag in some random occasions.

I had to return to the previous version in order to play.

Happened the same thing for me, is there any chance for me to get that V5 Nightly that you have or is it the same in the releases section, the only thing is that it wasn't tagged as Nightly.

Davidobot commented 4 years ago

If it's the one released on Jan 18th - here is the README page from the time: https://github.com/Davidobot/BetterJoyForCemu/tree/ebc3640121aa430cb430f6ce89ee4be9cb9617bb

In general, you can browse the "commits" and go back to any point in history.

cdmoras commented 4 years ago

Yes that's the version that works for me

Davidobot commented 4 years ago

Hm, thanks for letting me know. Not much has changed between them. I'll look into it.

Davidobot commented 4 years ago

@cdmoras @aescalona BetterJoy_v6.1_Test.zip Could you please test the above version and see if it eliminates the lag?

EveofSelimay commented 4 years ago

I've had the same issue on V6, but I've managed to find a somewhat consistent workaround for the time being. My process is:

Turn on Controllers, Launch BJFC, Launch Cemu and open the input menu to test delay, Turn off controllers, Reconnect controllers.

Seems to work fairly well, but requires more testing to see if it's as consistent as it looks.

EveofSelimay commented 4 years ago

The v6.1 Test seems to have completely fixed the input lag issue I was experiencing. I only tested it twice so far, but it looks good from my end.

cdmoras commented 4 years ago

v6.1 test looks like it works like nigthly version. It does not have the 2 seg lag, but it istill has some small lag on left joy when both are connected. Right Joy works perfect. Thank you for your support. Attached a video at 1/2 slowmo:

Video.zip

Unarelith commented 4 years ago

Same as @cdmoras.

I don't have the 2 sec lag with the 6.1 either. But after using two joycons as a single controller for some time, like 15/20 minutes, the left joycon starts to lag as hell, even though the right one is completely fine.

FlaminSarge commented 4 years ago

As far as I can tell, for Pro Controller, the lag happens for me solely when the controller is rumbling. In v6 release after disabling rumble I don't get any lag. Will try the 6.1 test above with rumble enabled as well. EDIT 6.1 above fixed the issue with Pro controller lag during rumble as well. ^ I only did bluetooth testing

Davidobot commented 4 years ago

Nice to know. I'll close this issue then!

cdmoras commented 4 years ago

Using the v6.1, I avoid the lag on the left Joy doing the following steps:

Done. With this turning off and on the Joys, I don't face any lag at all.

EDIT: when you connect the left Joy, you have to click on it on BJFC, until it is set as horizontal. That's when you can connect the right Joy.

aescalona commented 4 years ago

Well, when I try input settings on cemu, it recognizes the joy cons and the pro controller but when I am going to play it doesn't work, I don't know what happened, I guess the problem is cemu.

Davidobot commented 4 years ago

Well, when I try input settings on cemu, it recognizes the joy cons and the pro controller but when I am going to play it doesn't work, I don't know what happened, I guess the problem is cemu.

Make sure your source device is set correctly.

FlaminSarge commented 4 years ago

@Davidobot this issue should potentially just remain open until v6.1 release so that duplicates aren't created, and since finding this thread gets more difficult if it's closed.

okwilkins commented 4 years ago

@Davidobot This lag issue is caused by the rumble feature, from my testing. Is that what v6.1 adjusted? v6.1 fixes the issues I had in issue #316.

Davidobot commented 4 years ago

@HomelessSandwich yeah, it adjusted when it sends rumble and how it sends it

FlaminSarge commented 4 years ago

@Davidobot the 6.1 release still has the issue and is also maxing out the motor on my Switch Pro controller when it tries to rumble. Any idea what might be up? Of note, the default high/low frequency are both 20 for this release (seems like it was only set like this in the release zip), where the previous had 400/20. Changing them back to 400/20 does fix the fact that it's maxing out the rumble motor, but the lag is still present during rumble (though only at particular rumble strengths/frequencies, it seems).

(I just went back and tested the 6.1 test with the VigEm drivers included in 6.1 release, and I still get the lag issue during rumble; is it possible it's the VigEm drivers?)

Davidobot commented 4 years ago

@FlaminSarge yeah the 20/20 thing was set accidentally. Do you lag in the nightly?

Are you running USB? If BT, do you have an Intel card? ViGEm can't be responsible for this.

FlaminSarge commented 4 years ago

It's BT, with an Intel CPU; is the nightly the same as 6.1 Test from https://github.com/Davidobot/BetterJoy/issues/266#issuecomment-610471126, or is there another build somewhere? I can also build it myself and give it a go (without the DS4 custom VigEm stuff) if you need. Patch for what I can successfully build locally attached if you wanna doublecheck.

diff --git a/BetterJoyForCemu/BetterJoy.csproj b/BetterJoyForCemu/BetterJoy.csproj
index 242ed33..e37291f 100644
--- a/BetterJoyForCemu/BetterJoy.csproj
+++ b/BetterJoyForCemu/BetterJoy.csproj
@@ -102,8 +102,8 @@
     <Reference Include="JetBrains.Annotations, Version=2020.1.0.0, Culture=neutral, PublicKeyToken=1010a0d8d6380325, processorArchitecture=MSIL">
       <HintPath>..\packages\JetBrains.Annotations.2020.1.0\lib\net20\JetBrains.Annotations.dll</HintPath>
     </Reference>
-    <Reference Include="Nefarius.ViGEm.Client, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
-      <HintPath>..\packages\Nefarius.ViGEm.Client.1.0.0\lib\net452\Nefarius.ViGEm.Client.dll</HintPath>
+    <Reference Include="Nefarius.ViGEm.Client, Version=1.16.150.0, Culture=neutral, processorArchitecture=MSIL">
+      <HintPath>..\packages\Nefarius.ViGEm.Client.1.16.150\lib\net452\Nefarius.ViGEm.Client.dll</HintPath>
     </Reference>
     <Reference Include="System" />
     <Reference Include="System.Configuration" />
diff --git a/BetterJoyForCemu/Joycon.cs b/BetterJoyForCemu/Joycon.cs
index e1917dc..9e01839 100644
--- a/BetterJoyForCemu/Joycon.cs
+++ b/BetterJoyForCemu/Joycon.cs
@@ -1003,7 +1003,7 @@ namespace BetterJoyForCemu {
                ds4.SetSliderValue(DualShock4Slider.LeftTrigger, (byte)(buttons[(int)(isLeft ? Button.SHOULDER_2 : Button.SHOULDER_1)] ? Byte.MaxValue : 0));
                ds4.SetSliderValue(DualShock4Slider.RightTrigger, (byte)(buttons[(int)(isLeft ? Button.SHOULDER_1 : Button.SHOULDER_2)] ? Byte.MaxValue : 0));
            }
-
+           /*
            // Gyro and accel
            // Timestamp is in us. DS4 is in 5.33us
            ushort dt = (ushort)((Timestamp - lag) * 3 / 16);
@@ -1020,6 +1020,7 @@ namespace BetterJoyForCemu {
            ds4.SetIMUValue(DualShock4IMU.AccelZ, (short) -acc.X);

            lag = Timestamp;
+           */
        }

        // Get Gyro/Accel data
diff --git a/BetterJoyForCemu/packages.config b/BetterJoyForCemu/packages.config
index 3be009d..2d15399 100644
--- a/BetterJoyForCemu/packages.config
+++ b/BetterJoyForCemu/packages.config
@@ -2,6 +2,6 @@
 <packages>
   <package id="Crc32.NET" version="1.2.0" targetFramework="net461" />
   <package id="JetBrains.Annotations" version="2020.1.0" targetFramework="net461" />
-  <package id="Nefarius.ViGEm.Client" version="1.0.0" targetFramework="net461" />
+  <package id="Nefarius.ViGEm.Client" version="1.16.150" targetFramework="net461" />
   <package id="WindowsInput" version="6.1.1" targetFramework="net461" />
 </packages>
\ No newline at end of file
Davidobot commented 4 years ago

@FlaminSarge there is the full v6.1 release: https://github.com/Davidobot/BetterJoy/releases/tag/v6.1

FlaminSarge commented 4 years ago

Right, I'm saying that with 6.1 release I get the lag during rumble over BT again, which is really odd. Settings are 300/20/400 for rumble timing/low freq/high freq. I'll try to find whether there's specific conditions for it other than just 'rumble is happening'.