Linux fix w/ config. Might implement properly later.

This commit is contained in:
2025-09-23 23:10:24 -04:00
parent b861c0236a
commit 9f5eb531b6
3 changed files with 33 additions and 0 deletions

View File

@@ -23,6 +23,7 @@ namespace undead_universal_patch_il2cpp.Core.Config
public static ConfigEntry<bool> RegistrationPatch; public static ConfigEntry<bool> RegistrationPatch;
public static ConfigEntry<bool> AFKPatch; public static ConfigEntry<bool> AFKPatch;
public static ConfigEntry<bool> RefreshTokenFix; public static ConfigEntry<bool> RefreshTokenFix;
public static ConfigEntry<bool> ProtonDeviceIdFix;
} }
public static class PatchConfigDefaults public static class PatchConfigDefaults
{ {
@@ -33,6 +34,7 @@ namespace undead_universal_patch_il2cpp.Core.Config
public static bool RegistrationPatch = false; public static bool RegistrationPatch = false;
public static bool AFKPatch = false; public static bool AFKPatch = false;
public static bool RefreshTokenFix = false; public static bool RefreshTokenFix = false;
public static bool ProtonDeviceIdFix = false;
} }
public static class ServerPatchesConfig public static class ServerPatchesConfig
{ {

View File

@@ -95,6 +95,8 @@ public class Initialization
PatchConfig.RefreshTokenFix = UniversalPatchPlugin.Instance.Config.Bind("Patches", "RefreshTokenFix", PatchConfigDefaults.RefreshTokenFix, PatchConfig.RefreshTokenFix = UniversalPatchPlugin.Instance.Config.Bind("Patches", "RefreshTokenFix", PatchConfigDefaults.RefreshTokenFix,
"Fix for the game needlessly requesting a refresh token in a loop. Cause for this issue is unknown." + "Fix for the game needlessly requesting a refresh token in a loop. Cause for this issue is unknown." +
"\nDon't enable unless you know what this does."); "\nDon't enable unless you know what this does.");
PatchConfig.ProtonDeviceIdFix = UniversalPatchPlugin.Instance.Config.Bind("Patches", "ProtonDeviceIdFix", PatchConfigDefaults.ProtonDeviceIdFix,
"Fix for device IDs on Wine/Proton. Enable if you get a null reference exception related to cryptography APIs during connect/token.");
ServerPatchesConfig.CustomEmotes = UniversalPatchPlugin.Instance.Config.Bind("ServerPatches", "CustomEmotes", ServerPatchesConfigDefaults.CustomEmotes, ServerPatchesConfig.CustomEmotes = UniversalPatchPlugin.Instance.Config.Bind("ServerPatches", "CustomEmotes", ServerPatchesConfigDefaults.CustomEmotes,
"Modify the game's emote text with a configuration from the server."); "Modify the game's emote text with a configuration from the server.");

View File

@@ -0,0 +1,29 @@
using System.Reflection;
using System.Text;
using HarmonyLib;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using undead_universal_patch_il2cpp.Core;
using undead_universal_patch_il2cpp.Core.Config;
namespace undead_universal_patch_il2cpp.Patches.Internals;
[HarmonyPatch]
public class DeviceIdBuilder
{
static PatchTypesResult typesResult = Util.ConfigPreparePatchTypes(
PatchConfig.ProtonDeviceIdFix,
"Proton quickfix for device ID errors",
"RecRoom.Utils.DeviceIdBuilder",
"CalculateOtherDeviceId"
);
static MethodBase TargetMethod() => typesResult.Method;
static bool Prepare() => typesResult.Success;
static bool Prefix(ref Il2CppStructArray<byte> __result)
{
Util.ConditionalDebug("Device ID patched");
__result = new Il2CppStructArray<byte>(Encoding.UTF8.GetBytes("Wine/Proton"));
return false;
}
}