Add Xbox / PlayStation controller platform selection

Introduces a ControllerPlatform enum (Xbox, PlayStation) and a full
DualShock 4 translation path alongside the existing Xbox 360 one.
Switching platforms live tears down and recreates the virtual device.
The selection persists in the registry and is exposed via a
"Controller Platform" submenu in the tray context menu.

DS4 translation maps face buttons to Cross/Circle/Square/Triangle,
encodes the D-pad as a HAT switch (with diagonal support), converts
signed 16-bit axes to uint8 with Y-axis inversion, and routes right
trackpad clicks to the DS4 touchpad button.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Dylan DeverillandClaude Sonnet 4.6 committed 2026-06-21 01:22:28 -07:00
1 parent 9599372101
commit a8a9e539ac
7 files changed
+250 -51

No files matched your search

+10
View File
@@ -148,6 +148,15 @@ void ControllerManager::SetBackButtonsEnabled(bool enabled) {
slot->trackpad.SetBackButtonsEnabled(enabled);
}
void ControllerManager::SetControllerPlatform(ControllerPlatform platform) {
if (m_controllerPlatform == platform) return;
m_controllerPlatform = platform;
if (IsGameModeActive()) {
DisableGameMode();
EnableGameMode();
}
}
void ControllerManager::StartButtonCapture(std::function<void(BackButtonAction)> callback) {
std::lock_guard<std::mutex> lk(m_captureMutex);
m_captureCallback = std::move(callback);
@@ -215,6 +224,7 @@ void ControllerManager::EnableGameModeSlot(Slot& slot, bool& vigemMissingOut) {
if (!slot.sc->DisableLizardMode()) return;
slot.vc = std::make_unique<VirtualController>(
m_controllerPlatform,
[sc = slot.sc.get()](uint8_t largeMotor, uint8_t smallMotor) {
if (!sc->IsOpen()) return;
const uint16_t leftSpeed = static_cast<uint16_t>(static_cast<uint32_t>(largeMotor) * 257u);