From a49b23d3d5bc577d29d3580cdb321bdd911cb49b Mon Sep 17 00:00:00 2001 From: Sky Swimmer Date: Fri, 15 Mar 2024 16:56:54 +0100 Subject: [PATCH] Fixes & improvements --- discord-rpc-mod/RpcMod.cs | 5 ++-- feraltweaks/FeralTweaks.cs | 5 ++++ .../Fixes/DisplayNameManagerPatches.cs | 25 +++++++++++++++++++ .../Functionality/ChartPatches.cs | 5 ++-- 4 files changed, 36 insertions(+), 4 deletions(-) create mode 100644 feraltweaks/Patches/AssemblyCSharp/Fixes/DisplayNameManagerPatches.cs diff --git a/discord-rpc-mod/RpcMod.cs b/discord-rpc-mod/RpcMod.cs index 5919aed..d78ed39 100644 --- a/discord-rpc-mod/RpcMod.cs +++ b/discord-rpc-mod/RpcMod.cs @@ -81,7 +81,7 @@ public override void PostInit() + " \"enabled\": true,\n" + " \"pipe\": -1,\n" + " \"joiningEnabled\": " + (Environment.GetEnvironmentVariable("CENTURIA_LAUNCHER_PATH") != null ? "true" : "false") + ",\n" - + " \"disableAskToJoin\": false," + + " \"disableAskToJoin\": false,\n" + " \"joinExecutableWindows\": \"\",\n" + " \"joinExecutableLinux\": \"\",\n" + " \"joinExecutableOSX\": \"\",\n" @@ -169,7 +169,8 @@ public override void PostInit() // Bind updates client.OnReady += (sender, e) => { - LogInfo("Received Ready from user " + e.User.Username); + if (config.enableLogging) + LogInfo("Received Ready from user " + e.User.Username); if (client.CurrentPresence != null) { RichPresence pr = client.CurrentPresence.Clone(); diff --git a/feraltweaks/FeralTweaks.cs b/feraltweaks/FeralTweaks.cs index 9f92c33..82e0679 100644 --- a/feraltweaks/FeralTweaks.cs +++ b/feraltweaks/FeralTweaks.cs @@ -10,6 +10,7 @@ using FeralTweaks; using FeralTweaks.Actions; using FeralTweaks.BundleInjection; +using Razorwhip.Sentinel.Feral; namespace feraltweaks { @@ -54,6 +55,9 @@ public override void Init() // Start action thread FeralTweaksActionManager.StartActionThread(); + // Sentinel + FeralSentinelInitializer.Init(); + // Patch with harmony LogInfo("Applying patches..."); ApplyPatches(); @@ -173,6 +177,7 @@ private void ApplyPatches() ApplyPatch(typeof(DragonSparkSkeletonPatch)); ApplyPatch(typeof(NpcHeadRotationPatch)); ApplyPatch(typeof(PlayerJoinNotifPatch)); + ApplyPatch(typeof(DisplayNameManagerPatches)); ApplyPatch(typeof(NotificationPatches)); } diff --git a/feraltweaks/Patches/AssemblyCSharp/Fixes/DisplayNameManagerPatches.cs b/feraltweaks/Patches/AssemblyCSharp/Fixes/DisplayNameManagerPatches.cs new file mode 100644 index 0000000..b7e9018 --- /dev/null +++ b/feraltweaks/Patches/AssemblyCSharp/Fixes/DisplayNameManagerPatches.cs @@ -0,0 +1,25 @@ +using HarmonyLib; +using Il2CppInterop.Runtime.Injection; +using Il2CppInterop.Runtime.InteropTypes.Arrays; +using Il2CppSystem.Threading.Tasks; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading; +using UnityEngine; + +namespace feraltweaks.Patches.AssemblyCSharp +{ + public class DisplayNameManagerPatches + { + [HarmonyPrefix] + [HarmonyPatch(typeof(UserManager), "GetDisplayNameBatched")] + public static bool GetDisplayNameBatched(UserManager __instance, string inUUID, ref Task __result) + { + __result = IdentityService.GetDisplayName(inUUID, NetworkManager.JWT); + return false; + } + } +} \ No newline at end of file diff --git a/feraltweaks/Patches/AssemblyCSharp/Functionality/ChartPatches.cs b/feraltweaks/Patches/AssemblyCSharp/Functionality/ChartPatches.cs index b036536..6c38694 100644 --- a/feraltweaks/Patches/AssemblyCSharp/Functionality/ChartPatches.cs +++ b/feraltweaks/Patches/AssemblyCSharp/Functionality/ChartPatches.cs @@ -564,11 +564,12 @@ public static void SetChartObjectInstances() if (!FeralTweaks.PatchConfig.ContainsKey("DisableClientChartPatches") || FeralTweaks.PatchConfig["DisableClientChartPatches"] != "True") { // Create patch directory - Directory.CreateDirectory(FeralTweaksLoader.GetLoadedMod().ConfigDir + "/chartpatches"); + string pth = System.Collections.Generic.CollectionExtensions.GetValueOrDefault(FeralTweaks.PatchConfig, "ChartPatchSource", FeralTweaksLoader.GetLoadedMod().ConfigDir + "/chartpatches"); + Directory.CreateDirectory(pth); // Read patches FeralTweaksLoader.GetLoadedMod().LogInfo("Applying chart patches from configuration..."); - foreach (FileInfo file in new DirectoryInfo(FeralTweaksLoader.GetLoadedMod().ConfigDir + "/chartpatches").GetFiles("*.cdpf", SearchOption.AllDirectories)) + foreach (FileInfo file in new DirectoryInfo(pth).GetFiles("*.cdpf", SearchOption.AllDirectories)) { string patch = File.ReadAllText(file.FullName).Replace("\t", " ").Replace("\r", ""); ApplyPatch(patch, file.Name);