seerge / g-helper

Lightweight Armoury Crate alternative for Asus laptops and ROG Ally. Control tool for ROG Zephyrus G14, G15, G16, M16, Flow X13, Flow X16, TUF, Strix, Scar and other models
https://g-helper.com
GNU General Public License v3.0
7.61k stars 266 forks source link

Feature Request - Disable Touchscreen Toggle #1258

Closed updawg closed 1 year ago

updawg commented 1 year ago

Is your feature request related to a problem? Please describe. Certain games like the Lego series and Diablo 2 Resurrected will not show a cursor in game when a touchscreen is present.

Describe the solution you'd like The ability to toggle the touchscreen on or off.

Describe alternatives you've considered I can open device manager and disable the touch screen driver before launching the game without issue.

Additional context Although this isn't a feature in Armoury Crate it would be a nice to have to disable the touchscreen for laptops/rog ally to aid with finicky games and accidental touch screen presses when not in use.

seerge commented 1 year ago

@updawg hello, I don't know how to do that. I would recommend just use windows settings to disable touchscreen :) Sorry

updawg commented 1 year ago

It would require using pinvoke - something like this. I do however understand not wanting feature bloat:

using System; using System.Runtime.InteropServices;

class Program { // Declare P/Invoke functions [DllImport("setupapi.dll", SetLastError = true)] public static extern IntPtr SetupDiGetClassDevs(ref Guid classGuid, IntPtr enumerator, IntPtr hwndParent, uint flags);

[DllImport("setupapi.dll", SetLastError = true)]
public static extern int SetupDiEnumDeviceInfo(IntPtr deviceInfoSet,

uint memberIndex, ref SP_DEVINFO_DATA deviceInfoData);

[DllImport("setupapi.dll", SetLastError = true)]
public static extern int SetupDiCallClassInstaller(uint

installFunction, IntPtr deviceInfoSet, ref SP_DEVINFO_DATA deviceInfoData);

[StructLayout(LayoutKind.Sequential)]
public struct SP_DEVINFO_DATA
{
    public uint cbSize;
    public Guid classGuid;
    public uint devInst;
    public IntPtr reserved;
}

const uint DIGCF_PRESENT = 0x02;
const uint DIF_PROPERTYCHANGE = 0x12;
const int STATE_CHANGE_MASK = 3;
const int DICS_DISABLE = 2;

static void Main(string[] args)
{
    Guid GUID_DEVCLASS_NET = new

Guid("4d36e972-e325-11ce-bfc1-08002be10318"); // Network adapters IntPtr deviceInfoSet = SetupDiGetClassDevs(ref GUID_DEVCLASS_NET, IntPtr.Zero, IntPtr.Zero, DIGCF_PRESENT);

    if (deviceInfoSet == IntPtr.Zero)
    {
        Console.WriteLine("Failed to get device information set.");
        return;
    }

    SP_DEVINFO_DATA deviceInfoData = new SP_DEVINFO_DATA();
    deviceInfoData.cbSize =

(uint)Marshal.SizeOf(typeof(SP_DEVINFO_DATA));

    uint deviceIndex = 0;

    while (SetupDiEnumDeviceInfo(deviceInfoSet, deviceIndex, ref

deviceInfoData) != 0) { // Identify the device you want to disable here. // For demonstration, let's disable the first network adapter.

        if (deviceIndex == 0) // Replace this condition with your own

logic. { SetupDiCallClassInstaller(DIF_PROPERTYCHANGE, deviceInfoSet, ref deviceInfoData);

            // Disable the device
            int newState = STATE_CHANGE_MASK | DICS_DISABLE;
            int result = SetupDiCallClassInstaller((uint)newState,

deviceInfoSet, ref deviceInfoData);

            if (result == 0)
            {
                Console.WriteLine("Successfully disabled the device.");
            }
            else
            {
                Console.WriteLine("Failed to disable the device.");
            }

            break;
        }

        deviceIndex++;
    }
}

}

On Tue, Sep 5, 2023 at 6:39 PM Serge @.***> wrote:

Closed #1258 https://github.com/seerge/g-helper/issues/1258 as not planned.

— Reply to this email directly, view it on GitHub https://github.com/seerge/g-helper/issues/1258#event-10288635584, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACMSYAEEXXPUCMXETVNV5W3XY6SZXANCNFSM6AAAAAA4MN6GQU . You are receiving this because you were mentioned.Message ID: @.***>

seerge commented 1 year ago

@updawg I also can use ChatGPT :) what you copy-pasted here won't work. And I don't want to overload app with features for every specific narrow case (especially ones that are not directly related to Asus / Armoury functionality)

updawg commented 1 year ago

Understood, and I know this is output from chatgpt, I use it with pinvoke type functions because they are not documented well,and it's a decent enough boiler plate starting point.

On Tue, Sep 5, 2023, 6:55 PM Serge @.***> wrote:

@updawg https://github.com/updawg I also can use ChatGPT :) what you copy-pasted here won't work. And I don't want to overload app with features for every specific narrow case (especially ones that are not directly related to Asus / Armoury functionality)

— Reply to this email directly, view it on GitHub https://github.com/seerge/g-helper/issues/1258#issuecomment-1707414144, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACMSYAGGSRXWWWRTP3M4U2LXY6UVHANCNFSM6AAAAAA4MN6GQU . You are receiving this because you were mentioned.Message ID: @.***>