# How to Implement Virtual Gamepad Control in webMAN MOD via Web Browser

> Learn how to implement virtual gamepad control in webMAN MOD using your web browser. Discover how HTTP GET requests to pad.ps3 trigger controller input injection via the cellPadLddDataInsert syscall.

- Repository: [Aldo Vargas/webman-mod](https://github.com/aldostools/webman-mod)
- Tags: how-to-guide
- Published: 2026-02-24

---

**Developers can implement virtual gamepad control in webMAN MOD by sending HTTP GET requests to the `/pad.ps3` endpoint, which triggers the V-PAD engine in [`include/feat/vpad.h`](https://github.com/aldostools/webman-mod/blob/main/include/feat/vpad.h) to inject controller input via the `cellPadLddDataInsert` syscall.**

webMAN MOD ships with a built-in **virtual gamepad (V-PAD)** feature that allows any web-enabled device to control a PS3 remotely. The implementation leverages the existing HTTP server to accept button commands through simple query strings, translating them into native controller inputs using the PS3 kernel's LD-D controller interface.

## Understanding the Virtual Gamepad Architecture

The virtual gamepad system consists of two primary components: the HTTP request router that intercepts browser commands and the engine that translates those commands into hardware-level controller signals.

### HTTP Request Routing in www_client.c

When the PS3 receives an HTTP request, the server implementation in [`www_client.c`](https://github.com/aldostools/webman-mod/blob/main/www_client.c) checks for the virtual gamepad endpoint. At line 563, the code sets a flag when the request path starts with `/pad.ps3`:

```c
// www_client.c – line 563
bool is_pad = islike(param, "/pad.ps3");

```

This flag ensures the query string is forwarded to the pad engine rather than processed as a standard file request. The router handles all incoming connections from smartphones, tablets, PCs, or automation scripts uniformly.

### Core Engine Implementation in vpad.h

All virtual pad logic resides in [`include/feat/vpad.h`](https://github.com/aldostools/webman-mod/blob/main/include/feat/vpad.h). This header defines the HTTP API and manages a fake controller registered with the PS3 kernel as an **LD-D controller**.

The engine performs three critical functions:

- **Registration**: The `register_ldd_controller()` function creates a virtual controller instance, while `unregister_ldd_controller()` removes it when sending `/pad.ps3?off`.
- **Command Parsing**: The `parse_pad_command()` function interprets query strings for button presses, analog stick movements, hold/release states, and special actions like swapping X/O buttons.
- **Data Injection**: The engine builds a `CellPadData` structure and injects it into the system via the `cellPadLddDataInsert` syscall.

After each command execution, the default pad state is automatically restored to prevent interference with normal gameplay.

## Virtual Gamepad HTTP API Reference

The virtual gamepad accepts commands through URL query strings. The base endpoint is `http://<ps3-ip>/pad.ps3` followed by these parameters:

- **`/pad.ps3?off`** – Unregisters and disables the virtual controller.
- **`/pad.ps3?cross|square|up`** – Presses **X**, **□**, and **UP** sequentially with auto-handled delays.
- **`/pad.ps3?analogL_up|hold`** – Moves the left analog stick up and maintains the position.
- **`/pad.ps3?cross=enter`** – Maps the **X** button to act as the *Enter* button (requires PS3 reboot).
- **`/pad.ps3?circle=swap`** – Swaps the functions of **O** and **X** buttons (requires PS3 reboot).

Multiple actions can be chained using the pipe (`|`) delimiter for complex inputs.

## Implementation Walkthrough for Developers

Integrating virtual gamepad functionality requires understanding the compile-time configuration and the execution flow from HTTP request to hardware injection.

### Enabling the VIRTUAL_PAD Macro

The entire virtual gamepad implementation is guarded by the **`VIRTUAL_PAD`** compile-time macro. Developers must ensure this flag is defined during the build process to include the pad engine in the binary. Without this macro, the `/pad.ps3` endpoint returns a 404 error.

### Execution Flow and System Integration

When a browser sends a request to `http://<ps3-ip>/pad.ps3?cross`, the following sequence occurs:

1. [`www_client.c`](https://github.com/aldostools/webman-mod/blob/main/www_client.c) detects the `/pad.ps3` prefix and sets `is_pad = true`.
2. The dispatcher in [`cmd/pad_combo_play.h`](https://github.com/aldostools/webman-mod/blob/main/cmd/pad_combo_play.h) invokes `parse_pad_command()`.
3. The parser ensures the virtual controller is registered via `register_ldd_controller()`.
4. The command is translated into a `CellPadData` structure.
5. `cellPadLddDataInsert` injects the data into the PS3 kernel.
6. The system optionally sleeps for hold states, then clears the input.

This flow executes within milliseconds, providing near-real-time responsiveness for remote control scenarios.

## Code Examples for Browser and Automation

Developers can trigger virtual gamepad inputs from any HTTP client. Below are implementation examples in shell, Python, and JavaScript.

Send a button combo from a shell script using **curl**:

```bash

# Press Cross, Square, and Start in sequence

curl "http://192.168.1.42/pad.ps3?cross|square|start"

# Hold the left analog stick up for 2 seconds

curl "http://192.168.1.42/pad.ps3?analogL_up|hold"

# Swap X/O button mapping (requires PS3 reboot)

curl "http://192.168.1.42/pad.ps3?circle=swap"

```

Control the PS3 programmatically using **Python**:

```python
import requests
import time

base = "http://192.168.1.42"

# Press L1 then release

requests.get(f"{base}/pad.ps3?L1")
time.sleep(0.1)
requests.get(f"{base}/pad.ps3?release")

```

Implement browser-based controls using **JavaScript**:

```javascript
function sendPadCommand(cmd) {
  fetch(`http://192.168.1.42/pad.ps3?${cmd}`)
    .then(r => console.log('sent', cmd));
}

// Map a UI button to Triangle + R2 combo
document.getElementById('myBtn')
        .addEventListener('click', () => sendPadCommand('triangle|R2'));

```

## Advanced Integration with Combo Commands

For complex automation, webMAN MOD supports the **`/combo.ps3`** endpoint defined in [`include/cmd/pad_combo_play.h`](https://github.com/aldostools/webman-mod/blob/main/include/cmd/pad_combo_play.h). This allows developers to chain multiple pad commands into a single HTTP request, reducing network overhead for scripted sequences.

The combo handler processes the same query syntax as `/pad.ps3` but executes actions with precise timing intervals. This is particularly useful for automation tools, remote-play overlays, or testing frameworks that require deterministic input sequences.

## Summary

- **webMAN MOD** provides a complete virtual gamepad solution accessible via HTTP requests to `/pad.ps3`.
- The system uses **[`include/feat/vpad.h`](https://github.com/aldostools/webman-mod/blob/main/include/feat/vpad.h)** to register an LD-D controller and inject inputs via **`cellPadLddDataInsert`**.
- **HTTP routing** is handled in [`www_client.c`](https://github.com/aldostools/webman-mod/blob/main/www_client.c) at line 563, which detects the pad endpoint and forwards commands.
- Developers must compile with the **`VIRTUAL_PAD`** macro to enable the feature.
- Simple **query strings** control buttons, analog sticks, and system settings, while **`/combo.ps3`** supports complex input sequences.
- Any device capable of sending HTTP requests—including smartphones, tablets, and automation scripts—can control the PS3 remotely.

## Frequently Asked Questions

### What is the V-PAD feature in webMAN MOD?

The **V-PAD (Virtual Gamepad)** is a software-based controller implementation that allows remote control of a PS3 through HTTP requests. It registers as an LD-D controller with the PS3 kernel and translates web-based commands into native controller inputs using the `cellPadLddDataInsert` syscall, enabling any web-enabled device to function as a gamepad.

### How do I enable virtual gamepad support when compiling webMAN MOD?

Virtual gamepad support is controlled by the **`VIRTUAL_PAD`** compile-time macro. Developers must define this flag during the build process to include the pad engine code from [`include/feat/vpad.h`](https://github.com/aldostools/webman-mod/blob/main/include/feat/vpad.h) in the final binary. Without this macro, the `/pad.ps3` endpoint is unavailable and returns a standard HTTP 404 response.

### Can I use the virtual gamepad from any device with a browser?

Yes. Any device capable of sending HTTP GET requests—including smartphones, tablets, PCs, or IoT devices—can control the virtual gamepad. The interface accepts standard HTTP requests to `http://<ps3-ip>/pad.ps3`, making it compatible with browsers, command-line tools like **curl**, Python **requests**, or JavaScript **fetch** APIs without requiring specialized drivers or apps.

### What is the difference between /pad.ps3 and /combo.ps3?

The **`/pad.ps3`** endpoint processes individual button presses and immediate actions, restoring the default state after each command. The **`/combo.ps3`** endpoint, handled by [`include/cmd/pad_combo_play.h`](https://github.com/aldostools/webman-mod/blob/main/include/cmd/pad_combo_play.h), is optimized for chaining multiple commands with specific timing intervals, making it ideal for automation scripts that require complex input sequences like cheat codes or automated navigation menus.