Skip to content

Connect polcore to the profile server over TLS - #55

Merged
sruon merged 3 commits into
LandSandBoat:mainfrom
sruon:friend_list
Sep 27, 2026
Merged

sruon merged 3 commits into
LandSandBoat:mainfrom
sruon:friend_list

Conversation

@sruon

@sruon sruon commented Sep 25, 2026

Copy link
Copy Markdown
Contributor

This will be a breaking change and require an updated LSB

Summary

Have xiloader connect to an actual implementation of the profile server (read: PlayOnline) serving the required subset of the profile protocol and the IRC communication mechanism to enable several features in game.

Do note this is not an attempt at emulating the commercial service and anything happening outside of what's required by the FFXI client is entirely out of scope.

Implementation

  • Get rid of the existing POL thread stub
    • The remote server will now provide the necessary responses to get to the lobby
  • Replaces --serverport with --profileport (CLI and JSON config)
  • Routes all relevant POL addresses through a local relay
    • The relay forwards each connection to the remote profile server over TLS, resuming sessions since polcore opens a new connection per request
    • Each xiloader instance gets its own relay ports, so multiple clients on the same machine work fine
  • Disables the POL cipher (replaced with a plain copy) so we do not need to reimplement and expose POL's encryption. The TLS channel to the profile server protects the traffic instead
  • Calls the relevant polcore functions:
    • Initializes the polcore file system (for storing messages)
    • Computes a POL ID and PW (derived from account ID / session hash) and sets them in polcore
    • Opens the connection to the profile server
    • Waits until the state machine manages to connect to the profile server
    • Sets the user slot (for user home, slightly customized here for collision purposes)
    • Requests various profile bits from the profile server (friends, groups, status...)
    • Sets English texts for friend and group messages, which polcore otherwise ships in Japanese
  • In a notable variation from how the retail service operates, hooks the polcore poll function the game calls every frame so it never returns error codes directly to the game client
    • Otherwise a loss of connection to the profile server would disconnect users. Instead, it tries reconnecting after a randomized delay, and restores the game's message handler so notifications keep working afterwards.

Tests

The code in this PR has been tested with success against an unreleased implementation of the profile servers with end to end functioning friend list system (presence + messaging) and saving macros to the server.

Sources

  • Many bits and pieces from atom0s
  • My own former research on the IRC communication related to emitting error messages
  • PS2 debug build decomp for the original names of the requests, structures and IRC handlers
  • Static analysis of the retail polcore.dll / FFXiMain.dll
  • Retail captures of the flows implemented here (login, friend requests / accept / decline / removal, block, online and offline messages, status changes, settings backup), taken with a private Ashita plugin sniffing all PlayOnline communications. I'll share the plugin privately if you reach out, not looking to publicize my captures.

@zach2good zach2good left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I've sent you my review points, we'll merge at the same time as the LSB PR and bump all relevant versions

@sruon
sruon force-pushed the friend_list branch 2 times, most recently from 0b5fe86 to 41d6dbc Compare September 26, 2026 17:34
@sruon

sruon commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor Author
  • Bumped mbedtls to the latest patch version
  • Enforced TLS 1.3
  • Addressed review comments: comments style and aliases
  • Covered more failure paths with logging statements

@sruon
sruon merged commit ceb79a0 into LandSandBoat:main Sep 27, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants