haha forgot to push,,,

This commit is contained in:
2025-09-11 19:54:25 -04:00
parent d45fc2c953
commit 9318ac75d6
25 changed files with 296 additions and 86 deletions

View File

@@ -36,11 +36,15 @@ namespace undead_universal_patch_il2cpp.Core.Config
{
public static ConfigEntry<bool> CustomEmotes;
public static ConfigEntry<bool> CustomPhoton;
public static ConfigEntry<bool> CustomMarquee;
public static ConfigEntry<bool> CustomKnownDlls;
}
public static class ServerPatchesConfigDefaults
{
public static bool CustomEmotes = false;
public static bool CustomPhoton = false;
public static bool CustomMarquee = false;
public static bool CustomKnownDlls = false;
}
public static class GameManagerConfig
{

View File

@@ -37,11 +37,11 @@ public class DediConfig<T>
if (loaded) return cached;
string data = GetAlways();
cached = JsonSerializer.Deserialize<T>(data, _options == null ? new JsonSerializerOptions()
cached = JsonSerializer.Deserialize<T>(data, _options ?? new JsonSerializerOptions()
{
PropertyNameCaseInsensitive = true,
AllowTrailingCommas = true
} : _options);
});
loaded = true;
return cached;

View File

@@ -0,0 +1,38 @@
using BestHTTP;
using System.Collections.Generic;
using undead_universal_patch_il2cpp.Core.Config;
using undead_universal_patch_il2cpp.Patches;
using UnityEngine;
namespace undead_universal_patch_il2cpp.Core.Content.CustomRecNet.CheatManager;
public class CustomCheatManager : MonoBehaviour
{
public void Start()
{
if (ServerPatchesConfig.CustomKnownDlls.Value) RecNetInteractions.postNameServerActions.Add(DownloadKnownDlls);
}
void Patch(HTTPResponse _res, List<string> dlls)
{
UniversalPatchPlugin.Log.LogInfo("Setting new KnownDlls (server)");
HilePatch.Patch([.. dlls]);
}
void OnFailed(HTTPResponse _res)
{
if (PatchConfig.HilePatch.Value)
{
UniversalPatchPlugin.Log.LogInfo("Setting new KnownDlls (local fallback)");
HilePatch.Patch();
}
}
void DownloadKnownDlls()
{
RecNetInteractions.SendRequest<List<string>>(HTTPMethods.Get, RecNet.Service.API, "/api/undead/v1/knowndlls", Patch, OnFailed);
}
}

View File

@@ -0,0 +1,30 @@
using System.Collections.Generic;
using System.Runtime.InteropServices;
using BestHTTP;
using undead_universal_patch_il2cpp.Patches.UndeadGameManager;
using UnityEngine;
namespace undead_universal_patch_il2cpp.Core.Content.CustomRecNet.CustomGameManager;
public class CustomFreeSpawns : MonoBehaviour
{
public void Start()
{
RecNetInteractions.postAuthenticationActions.Add(DownloadFreeSpawns);
}
public void OnFailed([Optional] HTTPResponse res)
{
Util.ConditionalDebug($"CustomFreeSpawns failed: HTTP Error {res.StatusCode}");
}
public void Finished(HTTPResponse res, List<string> spawns)
{
FreeSpawnsPatch_Array.spawns = spawns;
}
public void DownloadFreeSpawns()
{
RecNetInteractions.SendRequest<List<string>>(HTTPMethods.Get, RecNet.Service.API, "/api/undead/v1/freespawns", Finished, OnFailed);
}
}

View File

@@ -0,0 +1,31 @@
using System.Collections.Generic;
using System.Runtime.InteropServices;
using BestHTTP;
using undead_universal_patch_il2cpp.Core.Content.UndeadGameManager;
using undead_universal_patch_il2cpp.Patches.UndeadGameManager;
using UnityEngine;
namespace undead_universal_patch_il2cpp.Core.Content.CustomRecNet.CustomGameManager;
public class CustomGameManager : MonoBehaviour
{
public void Start()
{
RecNetInteractions.postAuthenticationActions.Add(DownlaodGameConfigAssets);
}
public void OnFailed([Optional] HTTPResponse res)
{
Util.ConditionalDebug($"CustomGameManager failed: HTTP Error {res.StatusCode}");
}
public void Finished(HTTPResponse res, Dictionary<string, GameConfigurationAssetDTO> configs)
{
GameConfiguratorPatch.gameConfig = configs;
}
public void DownlaodGameConfigAssets()
{
RecNetInteractions.SendRequest<Dictionary<string, GameConfigurationAssetDTO>>(HTTPMethods.Get, RecNet.Service.API, "/api/undead/v1/gameconfigassets", Finished, OnFailed);
}
}

View File

@@ -1,6 +1,5 @@
using System;
using BestHTTP;
using Il2CppInterop.Runtime;
using undead_universal_patch_il2cpp.Core.Config;
using undead_universal_patch_il2cpp.Patches.Photon;
using UnityEngine;
@@ -24,31 +23,32 @@ public class CustomPhoton : MonoBehaviour
public void Start()
{
RecNetInteractions.postLocalAccountActions.Add(DownloadServerConfig);
if (ServerPatchesConfig.CustomPhoton.Value) RecNetInteractions.postLocalAccountActions.Add(DownloadServerConfig);
else if (PhotonConfig.PatchPhotonIds.Value) LocalPatch();
}
void LocalPatch()
{
UniversalPatchPlugin.Log.LogInfo("Attempting Photon patch from local configuration");
PhotonPatch.Patch(new PhotonConfigDTO
{
Logging = PhotonConfig.PunLogging.Value,
AppID = PhotonConfig.AppID.Value,
VoiceAppID = PhotonConfig.VoiceAppID.Value,
SelfHosted = PhotonConfig.SelfHosted.Value,
ServerAddress = PhotonConfig.ServerAddress.Value,
ServerPort = PhotonConfig.ServerPort.Value,
ConnectionProtocol = PhotonConfig.ConnectionProtocol.Value
});
}
void OnServerConfigFailed(HTTPResponse res)
{
ServerConfigFailed = true;
if (PhotonConfig.PatchPhotonIds.Value)
{
UniversalPatchPlugin.Log.LogInfo("Attempting Photon patch from local configuration");
PhotonPatch.Patch(new PhotonConfigDTO
{
Logging = PhotonConfig.PunLogging.Value,
AppID = PhotonConfig.AppID.Value,
VoiceAppID = PhotonConfig.VoiceAppID.Value,
SelfHosted = PhotonConfig.SelfHosted.Value,
ServerAddress = PhotonConfig.ServerAddress.Value,
ServerPort = PhotonConfig.ServerPort.Value,
ConnectionProtocol = PhotonConfig.ConnectionProtocol.Value
});
}
if (PhotonConfig.PatchPhotonIds.Value) LocalPatch();
}
void ApplyPhotonConfig(HTTPResponse res, PhotonConfigDTO photonConfig)
{
if (!ServerPatchesConfig.CustomPhoton.Value) return;
try
{
UniversalPatchPlugin.Log.LogInfo("Attempting Photon patch from server configuration");

View File

@@ -15,6 +15,7 @@ public class RecNetInteractions
public static List<Action> postNameServerActions = [];
public static List<Action> postAuthenticationActions = [];
public static List<Action> postLocalAccountActions = [];
public static List<Action> onNotificationsOpen = [];
public static Il2CppSystem.Uri CreateServiceUri(Service service, string pathAndQuery)
{

View File

@@ -1,10 +0,0 @@
using System.Collections.Generic;
using undead_universal_patch_il2cpp.Core.Config;
namespace undead_universal_patch_il2cpp.Core.Content.UndeadGameManager;
public static class GameConfigurator
{
static readonly string name = "GameConfigurations";
public static DediConfig<Dictionary<string, GameConfigurationAssetDTO>> config = new(name, "{}", null);
}

View File

@@ -1,10 +0,0 @@
using System.Collections.Generic;
using undead_universal_patch_il2cpp.Core.Config;
namespace undead_universal_patch_il2cpp.Core.Content.UndeadGameManager;
public static class GameFreeSpawns
{
static readonly string name = "GameFreeSpawns";
public static DediConfig<List<string>> config = new(name, "[]", null);
}

View File

@@ -1,9 +1,11 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Mapster;
using undead_universal_patch_il2cpp.Core.Config;
using undead_universal_patch_il2cpp.Core.Content.CustomRecNet.CheatManager;
using undead_universal_patch_il2cpp.Core.Content.CustomRecNet.CustomEmotes;
using undead_universal_patch_il2cpp.Core.Content.CustomRecNet.CustomPhoton;
using undead_universal_patch_il2cpp.Core.Content.UndeadGameManager;
@@ -33,7 +35,10 @@ public class Initialization
{
UniversalPatchPlugin.Log.LogInfo("PATCH LIST START =========================");
foreach (var method in UniversalPatchPlugin.Instance.HarmonyInstance.GetPatchedMethods())
UniversalPatchPlugin.Log.LogInfo($"- {method.ToString()}");
{
var paramStr = string.Join(" ", [.. method.GetParameters().Select(param => param.ParameterType.FullName)]);
UniversalPatchPlugin.Log.LogInfo($"- {method.DeclaringType.FullName} {method.Name}({paramStr})");
}
UniversalPatchPlugin.Log.LogInfo("PATCH LIST END =========================");
}
@@ -49,8 +54,6 @@ public class Initialization
private static void CacheChangePatchConfigs()
{
if (GameManagerConfig.AnyGameFreeSpawn.Value) GameFreeSpawns.config.Get();
if (GameManagerConfig.StaticGameConfig.Value) GameConfigurator.config.Get();
VideoTamperPatch.config.Get();
}
@@ -60,6 +63,7 @@ public class Initialization
if (ServerPatchesConfig.CustomEmotes.Value) UniversalPatchPlugin.Instance.AddComponent<CustomEmotes>();
UniversalPatchPlugin.Instance.AddComponent<CustomPhoton>();
if (ServerPatchesConfig.CustomKnownDlls.Value) UniversalPatchPlugin.Instance.AddComponent<CustomCheatManager>();
}
private static void FetchConfigurations()
@@ -91,11 +95,15 @@ public class Initialization
"Patch Photon ServerSettings values with a configuration from the server." +
"\nWhen the server fails to provide a valid configuration, values from the local config will be used." +
"\nPhoton.PatchPhotonIds must be enabled for this fallback to work.");
ServerPatchesConfig.CustomMarquee = UniversalPatchPlugin.Instance.Config.Bind("ServerPatches", "CustomMarquee", ServerPatchesConfigDefaults.CustomMarquee,
"Set custom text on the ^reccenter theater marquee.");
ServerPatchesConfig.CustomKnownDlls = UniversalPatchPlugin.Instance.Config.Bind("ServerPatches", "CustomKnownDlls", ServerPatchesConfigDefaults.CustomKnownDlls,
"Add items to the list of known DLLs.");
GameManagerConfig.AnyGameFreeSpawn = UniversalPatchPlugin.Instance.Config.Bind("GameManagerConfig", "AnyGameFreeSpawn", GameManagerConfigDefaults.AnyGameFreeSpawn,
$"Use patches from '{GameFreeSpawns.config.path}' to spawn in any valid player spawnpoint in specified games. See README.md");
$"Spawn in any valid player spawnpoint in specified games. See README.md");
GameManagerConfig.StaticGameConfig = UniversalPatchPlugin.Instance.Config.Bind("GameManagerConfig", "StaticGameConfig", GameManagerConfigDefaults.StaticGameConfig,
$"Use patches from '{GameConfigurator.config.path}' to set new configurations for built-in games. See README.md");
$"Set new configurations for built-in games. See README.md");
PhotonConfig.PatchPhotonIds = UniversalPatchPlugin.Instance.Config.Bind("Photon", "PatchPhotonIds", PhotonConfigDefaults.PatchPhotonIds,
"Patch Photon configuration.");