This commit is contained in:
Dominik G.
2025-10-28 14:49:02 +01:00
parent d0a16d1e44
commit 2c283c6623
7 changed files with 17471 additions and 17182 deletions

View File

@@ -378,9 +378,36 @@ namespace MegaKoop.Steam
private void OnRichPresenceJoinRequestedCb(GameRichPresenceJoinRequested_t cb)
{
// Some Steamworks.NET versions expose only m_rgchConnect here.
// We cannot reliably parse lobby id across versions; log and rely on GameLobbyJoinRequested_t for lobby joins.
Debug.Log("[SteamLobbyService] RichPresence join requested - handle via GameLobbyJoinRequested or custom connect string.");
// Parse steam://joinlobby/<appId>/<lobbyId>/<steamId> and join the lobby
string conn = cb.m_rgchConnect;
if (!string.IsNullOrEmpty(conn))
{
try
{
var s = conn.Trim();
const string prefix = "steam://joinlobby/";
if (s.StartsWith(prefix, StringComparison.OrdinalIgnoreCase))
{
var rest = s.Substring(prefix.Length);
var parts = rest.Split('/');
// Expected: [appId, lobbyId, steamId]
if (parts.Length >= 2)
{
if (ulong.TryParse(parts[1], out var lobbyId))
{
var lobby = new CSteamID(lobbyId);
SteamMatchmaking.JoinLobby(lobby);
return;
}
}
}
}
catch (Exception ex)
{
Debug.LogWarning($"[SteamLobbyService] Failed to parse rich presence connect '{conn}': {ex.Message}");
}
}
Debug.LogWarning($"[SteamLobbyService] RichPresence join requested but could not parse connect '{conn}'.");
}
#endregion