# 🎮 MimiCon: The Shape-Shifting Gamepad Bridge > **Any Controller. Any Console. Pure Mimicry.** A high-performance controller bridge running on the ultra-compact **Waveshare ESP32-S3-Zero**. **MimiCon** seamlessly translates **Wireless Bluetooth Gamepads** (Xbox Series/One, Google Stadia, 8BitDo, generic BLE HOGP) and **Web Touch Remote Controllers** into native USB wired controller signals for target consoles (**Nintendo Switch**, **Xbox 360**, **Original Xbox**, **PlayStation 3**, **PlayStation 4**, **PC DirectInput**, and **Couch Mouse & Keyboard**). --- ## Architecture Overview MimiCon harnesses the dual-core Xtensa LX7 processor of the ESP32-S3: - **Core 0 (Networking & RF Stack):** Dedicated entirely to Bluetooth LE Central (NimBLE), Wi-Fi Station & SoftAP, LwIP TCP/IP, HTTP Server, WebSocket telemetry, and mDNS. - **Core 1 (Realtime Gaming Engine):** Dedicated 1000 Hz USB gaming loop, handling packet dispatch, input calibration, cryptographic challenges (Xbox 360 XSM3, OG Xbox security handshake), hotkey combo detection, and status LED animations with zero radio interference. ``` ┌──────────────────────────────────────────────┐ │ Wireless Input Sources │ │ - Xbox Wireless (Series X/S, One S) │ │ - Google Stadia Gamepad (BLE Mode) │ │ - 8BitDo Controllers (Switch & D-Input) │ │ - Generic Mobile / PC BLE Gamepads │ │ - Web Touch Controller (Phone / Browser) │ └──────────────────────┬───────────────────────┘ │ BLE GATT / WebSocket ▼ ┌──────────────────────────────────────────────┐ │ Core 0: RF & Input Parser │ │ - Auto-scans & fast-reconnects to bonded │ │ - Parser Pipeline: xbox, stadia, 8bitdo │ │ - WebSocket state streaming (/ws/state) │ └──────────────────────┬───────────────────────┘ │ controller_state_t ▼ ┌──────────────────────────────────────────────┐ │ Core 1: Gaming Engine (1000 Hz) │ │ - Deadzone & axis calibration engine │ │ - Hotkey profile manager (START + Face) │ │ - Cryptographic security (XSM3 & OGX) │ │ - Real-time USB re-enumeration │ └──────────────────────┬───────────────────────┘ │ Native USB (GPIO 19 / 20) ▼ ┌──────────────────────────────────────────────┐ │ Target Host Console │ │ Switch | X360 | OG Xbox | PS3 | PS4 | PC/Mac │ └──────────────────────────────────────────────┘ ``` --- ## Supported Input Controllers | Controller | Connection Type | Parser | Features Supported | | :--- | :--- | :--- | :--- | | **Xbox Wireless Controller** (Series X/S & One S) | Bluetooth Low Energy | `parser_xbox_ble` | Full 16-byte report, dual sticks, analog triggers, D-Pad, face buttons, View, Menu, Share, bi-directional rumble. | | **Google Stadia Controller** (Bluetooth Mode) | Bluetooth Low Energy | `parser_stadia` | Dual sticks, analog triggers, D-Pad, face buttons, Options, Menu, Stadia Home, Assistant, Capture, rumble. | | **8BitDo Controllers** (Pro 2, Ultimate, SN30 Pro, etc.) | Bluetooth Low Energy | `parser_8bitdo` | Switch Mode (0x3F/0x30 reports), D-Input, X-Input, dual rumble motor schemes, Home & Star buttons. | | **Generic Mobile / PC BLE Gamepads** | Bluetooth Low Energy | `parser_generic_hogp` | Standard HID Over GATT Profile (HOGP) 8-bit axis and digital button mapping. | | **Phone / Web Virtual Touch Gamepad** | Wi-Fi WebSocket | Built-in Web Portal | Fullscreen landscape remote with dual analog thumbsticks, L3/R3, face buttons, D-pad, and haptic feedback. | --- ## Output Console Modes & On-The-Fly Switching You can switch the target console output profile **at any time** while playing using **`START + [Face Button]`** (held for ~1.5 seconds) or clicking the onboard **`BOOT`** button: | Button Combo (Hold ~1.5s) | Default Profile | Web Panel Configurable | Onboard RGB LED Color | Description | | :--- | :--- | :--- | :--- | :--- | | **`START + B`** (Circle / East) | **Nintendo Switch** | Yes (Any mode or Disabled) | **Solid Cyan** | Emulates a HORI Pokken Tournament DX Pro Pad (VID `0x0F0D`, PID `0x0092`). Plug & play without popups. | | **`START + A`** (Cross / South) | **PC DirectInput** | Yes (Any mode or Disabled) | **Solid Blue** | Standard 18-button, 6-axis generic USB gamepad. | | **`START + X`** (Square / West) | **PlayStation 3** | Yes (Any mode or Disabled) | **Solid Red** | Sony PS3 gamepad emulation (VID `0x054C`, PID `0x0268`). | | **`START + Y`** (Triangle / North) | **Xbox 360** | Yes (Any mode or Disabled) | **Solid Emerald Green** | Authentic wired Xbox 360 controller emulation (VID `0x045E`, PID `0x028E`) with full **XSM3** cryptographic challenge/response for retail consoles. | | *Configurable / BOOT Button* | **Original Xbox** | Yes (Assign to any combo) | **Solid Amber / Orange** | Native Xbox Input Device (XID) Controller S emulation (VID `0x045E`, PID `0x0289`). Connects to original Xbox consoles (via USB breakout) or Xemu. | | *Configurable / BOOT Button* | **PlayStation 4** | Yes (Assign to any combo) | **Solid Royal Blue / Indigo** | Native Sony DualShock 4 emulation (VID `0x054C`, PID `0x05C4`). 64-byte reports, touchpad click, bi-directional rumble, and in-game Lightbar RGB color sync to the onboard WS2812 LED! | | *Configurable / BOOT Button* | **Couch Mouse & Keys** | Yes (Assign to any combo) | **Solid Teal** | Left stick moves the mouse cursor, triggers act as left/right click, face buttons act as media keys (Volume, Play/Pause, Enter, Esc). | > **Web Customization & Persistence:** Each combo (`START + A/B/X/Y`) can be freely assigned to any console mode in the Web Portal. All mappings, active mode, and LED brightness are persistently stored in non-volatile flash (NVS). --- ## Web Configuration Portal (AP + Home Wi-Fi & mDNS) MimiCon boots directly into **Zero-Latency Gaming Mode** with Wi-Fi disabled by default for maximum radio isolation. You can activate the configuration web server whenever needed: - **Controller Shortcut:** Hold **`SELECT + START + D-PAD UP`** (or `SELECT + START + GUIDE`) for **1.5 seconds**. - **Hardware Button:** Hold the onboard **`BOOT`** button (GPIO0) on the ESP32 for **2 seconds**. ### Accessing the Portal - **Via Home Wi-Fi (Recommended):** Navigate to **`http://mimicon.local/`** (or `http://esp32-hid.local/`). - **Via SoftAP Hotspot:** Connect to Wi-Fi **`MimiCon-Setup`** (open network, no password) and go to **`http://192.168.4.1/`**. ### Portal Features - **Live Controller Visualizer:** High-speed WebSocket streaming (`/ws/state`) renders analog stick positions, trigger bars, D-pad, and face buttons in real time. Clicking **L3** or **R3** illuminates the thumbsticks with a vibrant neon cyan glow. - **Interactive SoftAP Toggle:** Click the **"CONFIG AP ACTIVE"** badge at any time to turn off the open `MimiCon-Setup` hotspot (switching to pure Station mode), freeing radio airtime for Bluetooth gaming while keeping the portal accessible over home Wi-Fi. - **Fullscreen Virtual Gamepad:** Tap the Phone Remote button to launch a fullscreen touch controller with dual spring-loaded thumbsticks, L3/R3 buttons, and haptic feedback. - **Stick Deadzones & Remapping:** Adjust radial inner deadzones (0% to 40%), trigger cutoffs, swap A/B or X/Y buttons, swap bumpers with triggers, and invert stick Y-axes. - **Bluetooth Multi-Bond Memory:** Automatically stores pairings for up to 8 gamepads. The portal lists all remembered controllers with individual **Forget** buttons and a 1-click **Test Rumble 📳** tool. - **Over-The-Air (OTA) Updates:** Upload compiled firmware binaries wirelessly from the browser or via the automated Python script with automated dual-slot validation. --- ## Hardware Pinout Reference (ESP32-S3-Zero) | Pin | Function | Description | | :--- | :--- | :--- | | `GPIO19` | Native USB D- | Connected to USB-C port (Console output) | | `GPIO20` | Native USB D+ | Connected to USB-C port (Console output) | | `GPIO21` | WS2812 RGB LED | Onboard status indicator (profiles, pairing, lightbar sync) | | `GPIO0` | BOOT Button | Short press: cycle console profiles. Hold 2s: toggle Wi-Fi Portal | | `GPIO43` | UART0 TX | Debug serial logs (115200 baud) | | `GPIO44` | UART0 RX | Debug serial input | --- ## Building and Flashing ### 1. Sourcing ESP-IDF Environment In PowerShell: ```powershell . 'C:\Espressif\tools\Microsoft.v6.1.PowerShell_profile.ps1' ``` ### 2. Compiling Firmware ```powershell idf.py build ``` This generates the binary at `build/mimicon.bin`. ### 3. Initial Flash (USB-C) Connect the ESP32-S3-Zero to your computer and run: ```powershell idf.py flash ``` *(If needed: hold **BOOT**, press and release **RESET**, then release **BOOT**).* ### 4. Wireless OTA Updates Once initially flashed, all subsequent updates can be flashed wirelessly without touching the board: **Option A — Automated Python Tool (Recommended):** ```powershell python ota_flash.py ``` *(Optionally specify target host: `python ota_flash.py build/mimicon.bin http://mimicon.local`)* **Option B — Web Browser Portal:** Navigate to `http://mimicon.local/`, choose `build/mimicon.bin` in the Firmware card, and click **⚡ Flash Firmware**. ### 5. Versioning & Releases MimiCon follows [Semantic Versioning (SemVer)](https://semver.org/): - **`version.txt`**: Canonical plain-text version string (e.g. `1.0.0`), automatically ingested by CMake to embed into the ESP-IDF binary descriptor (`esp_app_desc_t`). - **`main/version.h`**: Firmware C macros (`MIMICON_VERSION_MAJOR`, `MIMICON_VERSION_MINOR`, `MIMICON_VERSION_PATCH`, `MIMICON_VERSION_STRING`, `MIMICON_BUILD_NAME`). - **Runtime Telemetry**: The version is reported via `/api/status`, displayed live in the web portal header and OTA card, and output on boot. - **Git Tags**: Official firmware releases can be tagged via: ```powershell git tag -a v1.0.0 -m "Release v1.0.0" ``` --- ## License Licensed under the **GNU General Public License v3.0 (GPLv3) with Commercial Restrictions**: - **Strong Copyleft:** All forks, modifications, and derivative works must remain 100% free and open-source under these identical terms with complete source code made available. - **Non-Commercial Exclusivity:** Commercial use, selling, or distributing this software, firmware binaries, or pre-flashed devices for profit is strictly prohibited. Exclusive commercial rights are reserved by the author (`dark98`).