webMAN-MOD icon indicating copy to clipboard operation
webMAN-MOD copied to clipboard

Improved /pad.ps3 Support for Full Remote Controller Emulation (Player 1 Automation) ✔

Open Joaogs344 opened this issue 1 month ago • 5 comments

This is a concept test to use /pad.ps3 as a virtual controller for automated gameplay on PS3, using Python to send HTTP button commands.

It was tested on GTA V, Minecraft, and other games, but it does not fully work, because:

📌 webMAN MOD does not actually register /pad.ps3 as a true Player 1 controller.

So even though the bot can send commands like cross, r2, analogL_left, etc., the game ignores them after the physical controller is unplugged, and the system forces a pause or reconnection message.


⚠ Problem

When the physical DualShock controller is disconnected:

Expected behavior Actual behavior
/pad.ps3 takes over as Player 1 The game pauses immediately
Game accepts HTTP virtual input Game shows "Reconnect controller"
Analog and trigger hold works Only pulses, no hold or movement
Works in any game Works only in some games (Minecraft, etc.)

Even when forcing exit via:

/pad.ps3?psbtn
/pad.ps3?cross
/pad.ps3?start

— the commands do not exit pause or resume control, because the webMAN virtual pad is not recognized as the active controller.


🎯 Goal / Concept

The intention is to simulate a fully functional virtual DualShock controller, usable as Player 1, for:

✔ GTA V (vehicle automation) ✔ Minecraft (AFK farms, walk, jump, mine) ✔ Call of Duty, Gran Turismo, FIFA, etc. ✔ Remote gameplay, scripting, accessibility, bots

But today /pad.ps3 only sends button pulses, not full controller emulation.


🧪 Code Concept (does not work fully due to Player 1 limitation)

import requests  # importa a biblioteca 'requests' para fazer requisições HTTP (usada para falar com o webMAN MOD)
import time      # importa a biblioteca 'time' para trabalhar com pausas (sleep) e temporização

# ================== CONFIGURAÇÃO ==================

PS3_IP = "192.168.1.10"  # define o IP do PS3 na rede local (deve ser ajustado pelo usuário)
BASE_URL = f"http://{PS3_IP}/pad.ps3"  # monta a URL base do endpoint /pad.ps3 do webMAN MOD

PULSO = 0.09  # define o intervalo (em segundos) entre cada “pulso” de comando de direção/aceleração


# ================== FUNÇÃO BÁSICA ==================

def enviar(botao, timeout=0.7):  # define a função 'enviar', que manda um comando de botão para o webMAN
    """
    Envia um comando para o /pad.ps3.
    Exemplos válidos:
      cross, circle, triangle, square,
      start, select, psbtn,
      l1, r1, l2, r2, l3, r3,
      up, down, left, right,
      AnalogL_left, AnalogL_right, AnalogL_up, AnalogL_down,
      release
    """
    url = f"{BASE_URL}?{botao}"  # monta a URL completa incluindo o parâmetro de botão, ex: /pad.ps3?cross
    try:
        requests.get(url, timeout=timeout)  # envia uma requisição HTTP GET para o webMAN com o botão indicado
    except:  # se acontecer qualquer exceção (ex: timeout de rede, PS3 inacessível)
        # se der erro de rede, ignora pra não travar o script
        pass  # simplesmente ignora o erro e segue a execução
    time.sleep(0.03)  # adiciona um pequeno delay para evitar flood de requisições no webMAN


# ================== ETAPA 1: 7s PRA DESLIGAR O CONTROLE ==================

def aviso_desligar_controle(segundos=7):  # define a função que exibe um aviso e faz contagem regressiva
    print(f"\nVocê tem {segundos} segundos para desligar o controle (Player 1)")  # informa ao usuário o tempo disponível
    for i in range(segundos, 0, -1):  # laço que conta de 'segundos' até 1 (contagem regressiva)
        print(f"{i}...")  # imprime o número atual da contagem
        time.sleep(1)  # espera 1 segundo entre cada número (tempo real da contagem)
    print("\n--- Tempo esgotado. Assumindo Player 1 pelo webMAN ---\n")  # mensagem indicando fim da janela para desligar o controle
    time.sleep(1.0)  # pequena folga antes de enviar comandos


# ================== ETAPA 2: SAIR DO PAUSE ==================

def recuperar_e_sair_do_pause():  # tenta sair da tela de reconexão/pause
    print("1) Tentando sair da tela de reconexão com PS (psbtn)...")
    for _ in range(8):
        enviar("psbtn")
        time.sleep(0.25)
    time.sleep(2.5)

    print("2) Tentando confirmar usuário com X (cross)...")
    for _ in range(8):
        enviar("cross")
        time.sleep(0.25)
    time.sleep(2.5)

    print("3) Tentando sair do menu de pausa com START...")
    for _ in range(10):
        enviar("start")
        time.sleep(0.25)
    time.sleep(3.0)

    print("\n--- Se tudo deu certo, o jogo agora deve estar rodando ---\n")


# ================== ETAPA 3: DIRIGIR EM VOLTAS ==================

def dirigir_em_voltas(sentido="esquerda"):
    if sentido == "esquerda":
        direcao = "AnalogL_left"
    else:
        direcao = "AnalogL_right"

    print(f"Começando a dirigir em voltas para {sentido}. Ctrl + C para parar.\n")

    try:
        while True:
            enviar("r2")       # acelera
            enviar(direcao)    # curva
            time.sleep(PULSO)
    except KeyboardInterrupt:
        print("\nBot parado pelo usuário. Soltando comandos...")
        enviar("release")


# ================== MAIN ==================

def main():
    aviso_desligar_controle(segundos=7)
    recuperar_e_sair_do_pause()
    dirigir_em_voltas(sentido="esquerda")

if __name__ == "__main__":
    main()

🚀 Proposal / Suggestion

It would be very powerful if webMAN MOD could:

Register /pad.ps3 as a valid Player 1 virtual controller ✔ Prevent system/game from pausing or asking for reconnection ✔ Allow real analog hold control (not only button pulses) ✔ Enable remote, automated or scripted gameplay for games like ➡ GTA V, Minecraft, Call of Duty, Gran Turismo, FIFA, etc.

This would unlock:

🎮 Remote play via browser/mobile 🤖 AI bots / macro automation 🛠 Accessibility (play without physical controller) 🧪 Input testing / scripting

I can help test or provide more examples if needed.

gta_bot.py

Joaogs344 avatar Nov 23 '25 04:11 Joaogs344

The problem occurs because your physical gamepad is already connected as player 1. This behavior is handled by GameOS, not by webMAN MOD. If you turn off the gamepad before call /pad.ps3 for the first time or if you reassign the controller port or number assigment before start the game, you should be able to control the game remotely using /pad.ps3 as player 1.

aldostools avatar Nov 23 '25 16:11 aldostools

The problem occurs because your physical gamepad is already connected as player 1. This behavior is handled by GameOS, not by webMAN MOD. If you turn off the gamepad before call /pad.ps3 for the first time or if you reassign the controller port or number assigment before start the game, you should be able to control the game remotely using /pad.ps3 as player 1.

https://youtu.be/GURIZ9IESDo?si=ltollYEV2-gE6d0w

Yeah, that's exactly what I did. I reassigned the controller and even disconnected it, but it still doesn't work right. Could it be an issue with my code? 🤔

Joaogs344 avatar Nov 23 '25 19:11 Joaogs344

You can test the pad feature using http://PS3-IP-ADDRESS/pad.html or http://pad.aldostools.org

aldostools avatar Nov 23 '25 19:11 aldostools

You can test the pad feature using http://PS3-IP-ADDRESS/pad.html or http://pad.aldostools.org

Tested it out, XMB is all good. The issue is definitely GameOS. Do you know how we can make it work inside games? Would we have to reverse engineer the source code or something like that?

Joaogs344 avatar Nov 26 '25 10:11 Joaogs344

I don't think we need to patch Gameos. In my tests, almost all the games work fine with /pad.ps3

However, the behavior is different for each game depending on how the game reads the controller. In the website I added 2 modes: game mode and normal mode for XMB. In game mode, the buttons are held down until the next button is pressed. This gives the game enough time to read the buttons and improves the game's handling. But this mode does not work well in all games, including XMB.

aldostools avatar Nov 26 '25 13:11 aldostools