forked from zombieb/undead-universal-patch-il2cpp
OnLogout, Steam platform auth in account creation. Not configurable to ensure server uses ticket to validate.
This commit is contained in:
@@ -16,6 +16,8 @@ public class RecNetInteractions
|
||||
public static List<Action> postAuthenticationActions = [];
|
||||
public static List<Action> postLocalAccountActions = [];
|
||||
public static List<Action> onNotificationsOpen = [];
|
||||
public static List<Action> onLogout = [];
|
||||
public static List<Action> onPlatformInitialize = [];
|
||||
|
||||
public static Il2CppSystem.Uri CreateServiceUri(Service service, string pathAndQuery)
|
||||
{
|
||||
|
||||
@@ -43,6 +43,7 @@ public class Initialization
|
||||
UniversalPatchPlugin.Log.LogInfo("PATCH LIST END =========================");
|
||||
}
|
||||
|
||||
// to be removed in a future update
|
||||
try
|
||||
{
|
||||
CacheChangePatchConfigs();
|
||||
@@ -62,8 +63,9 @@ public class Initialization
|
||||
{
|
||||
UniversalPatchPlugin.Log.LogInfo("Attaching game objects");
|
||||
|
||||
if (ServerPatchesConfig.CustomEmotes.Value) UniversalPatchPlugin.Instance.AddComponent<CustomEmotes>();
|
||||
UniversalPatchPlugin.Instance.AddComponent<SteamPlatform>();
|
||||
UniversalPatchPlugin.Instance.AddComponent<CustomPhoton>();
|
||||
if (ServerPatchesConfig.CustomEmotes.Value) UniversalPatchPlugin.Instance.AddComponent<CustomEmotes>();
|
||||
if (ServerPatchesConfig.CustomKnownDlls.Value) UniversalPatchPlugin.Instance.AddComponent<CustomCheatManager>();
|
||||
if (ServerPatchesConfig.CustomGameConfigurations.Value) UniversalPatchPlugin.Instance.AddComponent<CustomGameManager>();
|
||||
}
|
||||
|
||||
46
Core/SteamPlatform.cs
Normal file
46
Core/SteamPlatform.cs
Normal file
@@ -0,0 +1,46 @@
|
||||
using Il2CppInterop.Runtime;
|
||||
using Steamworks;
|
||||
using System;
|
||||
using undead_universal_patch_il2cpp.Core.Content.CustomRecNet;
|
||||
using UnityEngine;
|
||||
|
||||
namespace undead_universal_patch_il2cpp.Core;
|
||||
|
||||
public class SteamPlatform : MonoBehaviour
|
||||
{
|
||||
public static string AuthTicket { get; set; } = null;
|
||||
|
||||
void GetAuthTicket() {
|
||||
SteamPlatformManager manager = PlatformManager.Instance.GetComponentInChildren<SteamPlatformManager>();
|
||||
manager.GetAuthSessionTicket().Then(
|
||||
DelegateSupport.ConvertDelegate<Il2CppSystem.Action<SteamPlatformManager.AuthSessionTicket>>((SteamPlatformManager.AuthSessionTicket ticket) =>
|
||||
{
|
||||
if (!string.IsNullOrEmpty(ticket.Error)) UniversalPatchPlugin.Log.LogError($"Could not get Steam auth ticket!: {ticket.Error}");
|
||||
else
|
||||
{
|
||||
AuthTicket = BitConverter.ToString(ticket.Ticket).Replace("-", "").ToUpperInvariant().TrimEnd('0');
|
||||
Util.ConditionalDebug($"Got new Steam auth ticket");
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
void Start()
|
||||
{
|
||||
RecNetInteractions.onLogout.Add(GetAuthTicket);
|
||||
RecNetInteractions.onPlatformInitialize.Add(GetAuthTicket);
|
||||
|
||||
/*
|
||||
Every time the user logs out of matchmaking
|
||||
or when PlatformManager initializes, fetch a new ticket.
|
||||
The user might be logging out to the account selection screen
|
||||
where they might create a new one; a Steam auth ticket is added to
|
||||
the auth params in the create request and it must be valid.
|
||||
|
||||
It *is* possible (though very unlikely) that the user creates a new account
|
||||
before the first ticket is fetched, since the method that gets a ticket is
|
||||
an IPromise.
|
||||
|
||||
If this way of doing things isn't the best, fix it and I'll merge
|
||||
*/
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user