How to Hide Mouse Cursor if a Controller is Detected?

Hi There,
I would like to know if there are any approaches to hide mouse cursor if a controller is detected when playing a RPG Maker game. Any direct approaches, script calls or plugins that could achieve this would be appreciated. Thanks in advance.
This is 100% out of my depth (all I do around here is mess with the battle HUD :aswt2:), but I wanted to give this a try. So, try adding this as a plugin:

JavaScript:
var gamepadToggle = gamepadToggle || {};
(() => {
const $ = gamepadToggle;
$.updateGamepadState = Input._updateGamepadState;
Input._updateGamepadState = function(gamepad) {
    $.updateGamepadState.call(this, gamepad)
    if (this._currentState[this._latestButton]) {
        document.body.style.cursor = 'none';
    }
}
$.Scene_Update = Scene_Base.prototype.update;
Scene_Base.prototype.update = function() {
    $.Scene_Update.apply(this);
    if (TouchInput.isPressed()) {
        document.body.style.cursor = 'default';
    }
}
})();

It should hide the cursor after a gamepad button press and show the cursor after a mouse left click.

I haven't tested this beyond that specific functionality and I do not have enough knowledge re: MV / MZ's input code to know whether or not this could eventually cause an issue for you. Perhaps someone more knowledgeable with the input code can step in.
This is 100% out of my depth (all I do around here is mess with the battle HUD :aswt2:), but I wanted to give this a try. So, try adding this as a plugin:

JavaScript:
var gamepadToggle = gamepadToggle || {};
(() => {
const $ = gamepadToggle;
$.updateGamepadState = Input._updateGamepadState;
Input._updateGamepadState = function(gamepad) {
    $.updateGamepadState.call(this, gamepad)
    if (this._currentState[this._latestButton]) {
        document.body.style.cursor = 'none';
    }
}
$.Scene_Update = Scene_Base.prototype.update;
Scene_Base.prototype.update = function() {
    $.Scene_Update.apply(this);
    if (TouchInput.isPressed()) {
        document.body.style.cursor = 'default';
    }
}
})();

It should hide the cursor after a gamepad button press and show the cursor after a mouse left click.

I haven't tested this beyond that specific functionality and I do not have enough knowledge re: MV / MZ's input code to know whether or not this could eventually cause an issue for you. Perhaps someone more knowledgeable with the input code can step in.
Thank you very much. This snippet looks like something good to start with. I will refer back after some debugs

Original thread: https://forums.rpgmakerweb.com/threads/how-to-hide-mouse-cursor-if-a-controller-is-detected.159948/