[PR #3290] [CLOSED] Create templates for exposing C++ class member functions to guest code #3361

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

📋 Pull Request Information

Original PR: https://github.com/shadps4-emu/shadPS4/pull/3290
Author: @kalaposfos13
Created: 7/22/2025
Status: Closed

Base: mainHead: json


📝 Commits (9)

  • a36e812 Stubbed library
  • 0a1c93d Demangling
  • 5d936b0 Creating classes and structs from demangled function names
  • 66ddee6 Why it no build
  • f43c382 These are not functions
  • 488519c Sure it compiles but will it insta crash upon trying to call a function with this setup tho
  • c21bf76 Register HLE alternative to libSceJson
  • c2a5673 cleanup
  • cc9857f The RegisterLib saga continues

📊 Changes

15 files changed (+845 additions, -10 deletions)

View changed files

📝 CMakeLists.txt (+2 -0)
📝 src/common/logging/filter.cpp (+1 -0)
📝 src/common/logging/types.h (+1 -0)
src/core/libraries/json/json.cpp (+624 -0)
src/core/libraries/json/json.h (+157 -0)
📝 src/core/libraries/libc_internal/libc_internal.cpp (+1 -1)
📝 src/core/libraries/libc_internal/libc_internal.h (+1 -1)
📝 src/core/libraries/libs.cpp (+2 -0)
📝 src/core/libraries/libs.h (+30 -0)
📝 src/core/libraries/ngs2/ngs2.cpp (+1 -1)
📝 src/core/libraries/ngs2/ngs2.h (+1 -1)
📝 src/core/libraries/rtc/rtc.cpp (+1 -1)
📝 src/core/libraries/rtc/rtc.h (+1 -1)
📝 src/core/tls.h (+17 -0)
📝 src/emulator.cpp (+5 -4)

📄 Description

The two main features added in this PR are LIB_MEMBER_FUNCTION and LIB_OVERLOADED_MEMBER_FUNCTION, which are similar to LIB_FUNCTION but hopefully should work with class member functions instead. I'm not sure yet if they actually work as I haven't had the chance to test it yet, since the stubbed libSceJson library isn't used by any game I know of, which is what I made these for in the first place.
The PR also contains the stubbed libSceJson library itself with hopefully correct classes and function signatures (except the return values) based on me demangling the exported function names, and a small continuation of my earlier RegisterLib PR, where I've apparently missed a few libraries (which could have gone into a different PR I guess, but it's only just me renaming stuff so it's not too important).


🔄 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/3290 **Author:** [@kalaposfos13](https://github.com/kalaposfos13) **Created:** 7/22/2025 **Status:** ❌ Closed **Base:** `main` ← **Head:** `json` --- ### 📝 Commits (9) - [`a36e812`](https://github.com/shadps4-emu/shadPS4/commit/a36e8126ce377d12a9411439cb5c70fc7f62e054) Stubbed library - [`0a1c93d`](https://github.com/shadps4-emu/shadPS4/commit/0a1c93d9ec1eeaffe5ce0e9e048116d71da52a5b) Demangling - [`5d936b0`](https://github.com/shadps4-emu/shadPS4/commit/5d936b004c918b78f22c46910f9320a4368f7ebf) Creating classes and structs from demangled function names - [`66ddee6`](https://github.com/shadps4-emu/shadPS4/commit/66ddee63655c14038d5379082242ffa3dfee200c) Why it no build - [`f43c382`](https://github.com/shadps4-emu/shadPS4/commit/f43c382f8ca70c42fb8ca3bf598e2830c4c3bf9a) These are not functions - [`488519c`](https://github.com/shadps4-emu/shadPS4/commit/488519cad44e9640f2ed3b2c08d27525dda0db33) Sure it compiles but will it insta crash upon trying to call a function with this setup tho - [`c21bf76`](https://github.com/shadps4-emu/shadPS4/commit/c21bf769419e1e234447321e1556040bdddbcb1d) Register HLE alternative to libSceJson - [`c2a5673`](https://github.com/shadps4-emu/shadPS4/commit/c2a56731954c67bf8b2ff4b0913fb8f6a534661e) cleanup - [`cc9857f`](https://github.com/shadps4-emu/shadPS4/commit/cc9857f8385a9203c2ce4d87ceaec270e0194436) The RegisterLib saga continues ### 📊 Changes **15 files changed** (+845 additions, -10 deletions) <details> <summary>View changed files</summary> 📝 `CMakeLists.txt` (+2 -0) 📝 `src/common/logging/filter.cpp` (+1 -0) 📝 `src/common/logging/types.h` (+1 -0) ➕ `src/core/libraries/json/json.cpp` (+624 -0) ➕ `src/core/libraries/json/json.h` (+157 -0) 📝 `src/core/libraries/libc_internal/libc_internal.cpp` (+1 -1) 📝 `src/core/libraries/libc_internal/libc_internal.h` (+1 -1) 📝 `src/core/libraries/libs.cpp` (+2 -0) 📝 `src/core/libraries/libs.h` (+30 -0) 📝 `src/core/libraries/ngs2/ngs2.cpp` (+1 -1) 📝 `src/core/libraries/ngs2/ngs2.h` (+1 -1) 📝 `src/core/libraries/rtc/rtc.cpp` (+1 -1) 📝 `src/core/libraries/rtc/rtc.h` (+1 -1) 📝 `src/core/tls.h` (+17 -0) 📝 `src/emulator.cpp` (+5 -4) </details> ### 📄 Description The two main features added in this PR are LIB_MEMBER_FUNCTION and LIB_OVERLOADED_MEMBER_FUNCTION, which are similar to LIB_FUNCTION but hopefully should work with class member functions instead. I'm not sure yet if they actually work as I haven't had the chance to test it yet, since the stubbed libSceJson library isn't used by any game I know of, which is what I made these for in the first place. The PR also contains the stubbed libSceJson library itself with hopefully correct classes and function signatures (except the return values) based on me demangling the exported function names, and a small continuation of my earlier [RegisterLib PR](https://github.com/shadps4-emu/shadPS4/pull/3234), where I've apparently missed a few libraries (which could have gone into a different PR I guess, but it's only just me renaming stuff so it's not too important). --- <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:25 +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#3361
No description provided.