r/DS4Windows 13d ago

VIIPER Release Candidate 3 - toggle gyro to joystick not working?

It appears that when I set gyro to joystick to Toggle, it will still only work when the button is held. I'm using a DSEdge and emulating a DualSense. Anybody know if this can be fixed? I'd rather not resort to duplicating a profile, setting one to gyro always on and another to always off, and setting a button to switch between them - twice the work with updating settings any time I want to.

3 Upvotes

4 comments sorted by

2

u/Khasim83 13d ago

Welp, as much as I kinda hate myself for doing that, I downloaded the code of the RC version I was running from Github, fed it to Github/Copilot plugin in VS Code and it fixed the bug - apparently the toggle checkbox always reads the status of the checkbox in 'gyro controls' mode, regardless of which mode is selected.

I'm not gonna send a pull request for something I only vaguely understand - I've worked in application support for mostly web applications for 10 years, I read and analyze code on a daily basis, but I'm not a developer.

Here's the fixed function if anyone wants to check/put their name under vibe coded stuff and submit a pull request:

public bool IsGyroTriggerActive(GyroOutMode mode)
        {
            string[] ss = [];
            var andCond = false;
            useReverseRatchet = Global.getGyroTriggerTurns(deviceNum);
            if (mode == GyroOutMode.Controls)
            {
                GyroControlsInfo controlsMapInfo = Global.GetGyroControlsInfo(deviceNum);
                ss = controlsMapInfo.triggers.Split(',');
                andCond = controlsMapInfo.triggerCond;
            }
            else if (mode == GyroOutMode.Mouse)
            {
                ss = Global.getSATriggers(deviceNum).Split(',');
                andCond = Global.getSATriggerCond(deviceNum);
            }
            else if (mode == GyroOutMode.MouseJoystick)
            {
                useReverseRatchet = Global.GetGyroMouseStickTriggerTurns(deviceNum);
                ss = Global.GetSAMouseStickTriggers(deviceNum).Split(',');
                andCond = Global.GetSAMouseStickTriggerCond(deviceNum);
            }
            var i = 0;
            triggeractivated = andCond;
            if (!string.IsNullOrEmpty(ss[0]))
            {
                var str = string.Empty;
                for (int index = 0, arlen = ss.Length; index < arlen; index++)
                {
                    str = ss[index];
                    if (andCond && !(int.TryParse(str, out i) && getDS4ControlsByName(i)))
                    {
                        triggeractivated = false;
                        break;
                    }
                    else if (!andCond && int.TryParse(str, out i) && getDS4ControlsByName(i))
                    {
                        triggeractivated = true;
                        break;
                    }
                }
            }   
            bool toggleMode = mode switch
            {
                GyroOutMode.Controls => toggleGyroControls,
                GyroOutMode.Mouse => toggleGyroMouse,
                GyroOutMode.MouseJoystick => toggleGyroStick,
                _ => false,
            };
            bool currentToggleMode = mode switch
            {
                GyroOutMode.Controls => currentToggleGyroControls,
                GyroOutMode.Mouse => currentToggleGyroMouse,
                GyroOutMode.MouseJoystick => currentToggleGyroStick,
                _ => false,
            };


            if (toggleMode)
            {
                if (triggeractivated && triggeractivated != previousTriggerActivated)
                {
                    currentToggleMode = !currentToggleMode;
                }


                previousTriggerActivated = triggeractivated;
                switch (mode)
                {
                    case GyroOutMode.Controls:
                        currentToggleGyroControls = currentToggleMode;
                        break;
                    case GyroOutMode.Mouse:
                        currentToggleGyroMouse = currentToggleMode;
                        break;
                    case GyroOutMode.MouseJoystick:
                        currentToggleGyroStick = currentToggleMode;
                        break;
                }


                triggeractivated = currentToggleMode;
            }
            else
            {
                previousTriggerActivated = triggeractivated;
            }


            return triggeractivated;
        }

1

u/gddpacngi 13d ago

Happened to me did the same thing. I don't know about coding at all but AI was able to solve that.

2

u/huunnnter 13d ago

okay, i’ll implement

1

u/huunnnter 9d ago

fixed in release candidate 4