[GH-ISSUE #3997] [Feature Request]: Loading native shared libraries for patching, modding and debugging games #1199

Open
opened 2026-02-27 21:10:27 +03:00 by kerem · 0 comments
Owner

Originally created by @Dasaav-dsv on GitHub (Feb 6, 2026).
Original GitHub issue: https://github.com/shadps4-emu/shadPS4/issues/3997

Checklist

  • I have searched for a similar issue in this repository and did not find one.

Description

ShadPS4 should be able to load native to the user's OS shared libraries (.dll/.so) from a list they provided when launching ShadPS4.

Reason

It would be very useful for executing custom code in the game's context by e.g. placing hooks or applying complex patches, where the existing ShadPS4 patch system does not cut it.

Not having to write assembly and having easy access to all native OS functionality (as opposed to loading a custom-built .prx).

An example of something I had to do to debug Bloodborne bugs was writing a heap allocation sanitizer tool that detects OOB writes with readonly pages:
https://github.com/Dasaav-dsv/bb-heap-x
In order to get it working on windows, I wrote a version.dll proxy DLL that gets loaded by ShadPS4, loads my actual library (on Linux all of this can be replaced by LD_PRELOAD), which then registers an exception handler to catch a software breakpoint I placed at the eboot entrypoint and finally execute my logic. Not having to do this would be great.

Another possibility is game mods, and in the future, proper ShadPS4 plugins (this initial implementation leaves a lot of room for this).

Examples

  1. ShadPS4 should document at least a single symbol it recognizes as a library entrypoint as a part of its API, using the system's native C ABI.
  2. The user should be able to provide a list of libraries to load via the CLI and/or an environment variable.
  3. After the loader has ran but before it starts executing the game's entrypoint, ShadPS4 should load these libraries one by one in the listed order and call their entrypoint (if present).
  4. The loader proceeds with starting the Game:Main thread

Mock-up library entrypoint declaration (in C):

void ShadPS4Ext_init(void* eboot_base_address);

NOTE: I am willing to implement and maintain this feature.

Originally created by @Dasaav-dsv on GitHub (Feb 6, 2026). Original GitHub issue: https://github.com/shadps4-emu/shadPS4/issues/3997 ### Checklist - [x] I have searched for a similar issue in this repository and did not find one. ### Description ShadPS4 should be able to load native to the user's OS shared libraries (.dll/.so) from a list they provided when launching ShadPS4. ### Reason It would be very useful for executing custom code in the game's context by e.g. placing hooks or applying complex patches, where the existing ShadPS4 patch system does not cut it. Not having to write assembly and having easy access to all native OS functionality (as opposed to loading a custom-built .prx). An example of something I had to do to debug Bloodborne bugs was writing a heap allocation sanitizer tool that detects OOB writes with readonly pages: <https://github.com/Dasaav-dsv/bb-heap-x> In order to get it working on windows, I wrote a `version.dll` proxy DLL that gets loaded by ShadPS4, loads my actual library (on Linux all of this can be replaced by `LD_PRELOAD`), which then registers an exception handler to catch a software breakpoint I placed at the eboot entrypoint and finally execute my logic. Not having to do this would be great. Another possibility is game mods, and in the future, proper ShadPS4 plugins (this initial implementation leaves a lot of room for this). ### Examples 1. ShadPS4 should document at least a single symbol it recognizes as a library entrypoint as a part of its API, using the system's native C ABI. 2. The user should be able to provide a list of libraries to load via the CLI and/or an environment variable. 3. After the loader has ran but before it starts executing the game's entrypoint, ShadPS4 should load these libraries one by one in the listed order and call their entrypoint (if present). 4. The loader proceeds with starting the `Game:Main` thread Mock-up library entrypoint declaration (in C): ```C void ShadPS4Ext_init(void* eboot_base_address); ``` NOTE: I am willing to implement and maintain this feature.
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#1199
No description provided.