Skip to content

Conversation

@ZephyrCodesStuff
Copy link

This PR implements the Sony Clans subsystem for the RPCS3 emulator.

Used in:

  • PlayStation Home [NPIA00005]
  • ?

The source code for the server is available here and is licensed AGPLv3.

  • It's written in Rust, with my best efforts in readability and documentation.
  • Every feature not-pertaining to RPCS3 has been feature-gated at compile-time.
  • Fully Dockerized deployment
  • Ticket signature verification

NOTE: The server is fully compatible with the PS3 console as well, as it follows the PS3 Clans Library specification.


The emulator code tries its best to follow on the steps of the RPCN client code wherever possible; both in the Client as well as the Settings and Config components.

Features:

  • Clans client implementation in clans_client.[h,cpp]
  • Syscalls implementation in sceNpClans.[h,cpp]
    • A couple of missing structs and/or enum members have been added in sceNp.h
  • Qt GUI for selecting the desired Clans server to use (default: [HTTPS] clans.rpcs3.net)
    • Implemented in clans_settings_dialog.[h,cpp]
    • Prevents modifying during emulator usage
  • clans.yml config file for persistence
    • Implemented in clans_config.[h,cpp]

- Needs GUI implementation to pick the server host
- Needs code to select the server host from config

Signed-off-by: zeph <35661622+ZephyrCodesStuff@users.noreply.github.com>
Signed-off-by: zeph <35661622+ZephyrCodesStuff@users.noreply.github.com>
- Enabled SSL host verification

Signed-off-by: zeph <35661622+ZephyrCodesStuff@users.noreply.github.com>
Signed-off-by: zeph <35661622+ZephyrCodesStuff@users.noreply.github.com>
Signed-off-by: zeph <35661622+ZephyrCodesStuff@users.noreply.github.com>
Signed-off-by: zeph <35661622+ZephyrCodesStuff@users.noreply.github.com>
Signed-off-by: zeph <35661622+ZephyrCodesStuff@users.noreply.github.com>
Signed-off-by: zeph <35661622+ZephyrCodesStuff@users.noreply.github.com>
Copy link
Contributor

@RipleyTom RipleyTom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You also need to add the files to msvc projects.

Apparently, when paging is null we're supposed to return the total count from the server. The game will only access `pageResult->total`.
@ZephyrCodesStuff
Copy link
Author

ZephyrCodesStuff commented Dec 8, 2025

Addressed a good chunk of the suggestions.

Current to-do list of what's left:

  • CURL per-request
  • Actual request instance spawning and handle tracking with a generator
    • CURL ptr could go in here (?)
  • Ticket callback handling instead of busy loop
    • Handling case when ticket requesting fails

ZephyrCodesStuff and others added 4 commits December 8, 2025 13:10
- Renamed some fields
- Implemented fmt::format for consistency
- Made some constant fields `const`
Signed-off-by: zeph <zephyrzefa15@gmail.com>
Signed-off-by: zeph <zephyrzefa15@gmail.com>
@ZephyrCodesStuff
Copy link
Author

I've implemented an IDM for request handling and tested in-game -- everything seems fine and working. Clan search, membership status, sanity checks (don't join a clan you already are in, etc...). Ticket request failure is also now handled, meaning the game will display "Service Unavailable." if a ticket fails to be fetched.

Next step is now improving ticket requesting via callbacks!

Using proper atomic synchronisation primitives, instead of a busy loop

Signed-off-by: zeph <zephyrzefa15@gmail.com>
@ZephyrCodesStuff
Copy link
Author

Everything has been handled. Please let me know if there's anything left to fix!

@ZephyrCodesStuff
Copy link
Author

Switched to fmt::split_sv

Signed-off-by: zeph <zephyrzefa15@gmail.com>
@Megamouse
Copy link
Contributor

The last commit won't work reliably. Since you're passing a temporary object.
You'll have to create a local variable first and pass that

Signed-off-by: zeph <zephyrzefa15@gmail.com>
@ZephyrCodesStuff
Copy link
Author

Oops- my bad, C++ things. Should be fixed!

@ZephyrCodesStuff
Copy link
Author

ZephyrCodesStuff commented Dec 9, 2025

Results of the latest commit, tested on my fork's Actions with public runners:

  • Windows fails to build, it cannot find <curl/curl.h> as an include
  • Linux GCC builds both on x86 and ARM
  • macOS builds
  • FreeBSD and Windows Clang failed to initialise the build environment altogether (not related to Clans)

Will investigate what's causing MSVC to fail.

@ZephyrCodesStuff
Copy link
Author

Problem fixed and now Windows, Linux and macOS build successfully.

NOTE: Windows Clang fails due to an old-style C cast in wolfssl.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants