[PR #3235] [CLOSED] Implement libusb callbacks with correct ABI #3326

Closed
opened 2026-02-27 22:03:17 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/shadps4-emu/shadPS4/pull/3235
Author: @connorh315
Created: 7/12/2025
Status: Closed

Base: mainHead: dimensions-usb-fix


📝 Commits (3)

📊 Changes

1 file changed (+40 additions, -2 deletions)

View changed files

📝 src/core/libraries/usbd/usbd.cpp (+40 -2)

📄 Description

The libusb library executes the emulated callback, but does not respect the PS4's ABI, as such passing the libusb_transfer argument into the RAX register rather than the RDI register.

This pull request introduces a "trampoline" that registers a host-machine callback that then executes the emulated callback with the correct ABI, fixing the issue.

Only tested on Windows.

This now makes LEGO Dimensions enter the game and seems to be fully playable.

To be considered:

  • Should this be applied to all types of transfer (i.e. bulk, control, isochronous)
  • Is there a better alternative to creating and maintaining a dictionary of transfers?

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/shadps4-emu/shadPS4/pull/3235 **Author:** [@connorh315](https://github.com/connorh315) **Created:** 7/12/2025 **Status:** ❌ Closed **Base:** `main` ← **Head:** `dimensions-usb-fix` --- ### 📝 Commits (3) - [`9aabc60`](https://github.com/shadps4-emu/shadPS4/commit/9aabc609a49e23d79d847dd5be9a52d588a42524) Callback ABI fix - [`ac89b22`](https://github.com/shadps4-emu/shadPS4/commit/ac89b22e5946f13e802119b4c808a4413f4cc0ae) Removed pointer from warning message - [`3815fb9`](https://github.com/shadps4-emu/shadPS4/commit/3815fb91172d5a2faf58ac8e5fdda0da8ac6c312) clang-format ### 📊 Changes **1 file changed** (+40 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `src/core/libraries/usbd/usbd.cpp` (+40 -2) </details> ### 📄 Description The libusb library executes the emulated callback, but does not respect the PS4's ABI, as such passing the libusb_transfer argument into the RAX register rather than the RDI register. This pull request introduces a "trampoline" that registers a host-machine callback that then executes the emulated callback with the correct ABI, fixing the issue. Only tested on Windows. This now makes LEGO Dimensions enter the game and seems to be fully playable. To be considered: - Should this be applied to all types of transfer (i.e. bulk, control, isochronous) - Is there a better alternative to creating and maintaining a dictionary of transfers? --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-27 22:03:17 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/shadPS4#3326
No description provided.