mirror of https://github.com/hykilpikonna/AquaDX
[F] RemoveEncryption error with SDEZ
parent
b7c5d18df1
commit
776c08e605
|
@ -1,6 +1,8 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using HarmonyLib;
|
||||
using MelonLoader;
|
||||
using Net.Packet;
|
||||
|
||||
namespace AquaMai.Fix;
|
||||
|
@ -8,7 +10,7 @@ namespace AquaMai.Fix;
|
|||
public class RemoveEncryption
|
||||
{
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(Packet), "Obfuscator")]
|
||||
[HarmonyPatch(typeof(Packet), "Obfuscator", typeof(string))]
|
||||
private static bool PreObfuscator(string srcStr, ref string __result)
|
||||
{
|
||||
__result = srcStr.Replace("MaimaiExp", "").Replace("MaimaiChn", "");
|
||||
|
@ -20,19 +22,27 @@ public class RemoveEncryption
|
|||
{
|
||||
public static IEnumerable<MethodBase> TargetMethods()
|
||||
{
|
||||
return new[] { AccessTools.Method("Net.CipherAES:Encrypt") };
|
||||
# if SDGA145
|
||||
return [AccessTools.Method("Net.CipherAES:Encrypt", [typeof(byte[])])];
|
||||
# else
|
||||
return [AccessTools.TypeByName("Net.CipherAES").GetMethods().FirstOrDefault(it => it.Name == "Encrypt")];
|
||||
# endif
|
||||
}
|
||||
|
||||
# if SDGA145
|
||||
public static bool Prefix(byte[] data, ref byte[] __result)
|
||||
{
|
||||
if (AquaMai.AppConfig.Fix.RemoveEncryption)
|
||||
{
|
||||
__result = data;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
__result = data;
|
||||
return false;
|
||||
}
|
||||
# else
|
||||
public static bool Prefix(byte[] data, out byte[] encryptData, ref bool __result)
|
||||
{
|
||||
encryptData = data;
|
||||
__result = true;
|
||||
return false;
|
||||
}
|
||||
# endif
|
||||
}
|
||||
|
||||
[HarmonyPatch]
|
||||
|
@ -40,18 +50,26 @@ public class RemoveEncryption
|
|||
{
|
||||
public static IEnumerable<MethodBase> TargetMethods()
|
||||
{
|
||||
return new[] { AccessTools.Method("Net.CipherAES:Decrypt") };
|
||||
# if SDGA145
|
||||
return [AccessTools.Method("Net.CipherAES:Decrypt", [typeof(byte[])])];
|
||||
# else
|
||||
return [AccessTools.TypeByName("Net.CipherAES").GetMethods().FirstOrDefault(it => it.Name == "Decrypt")];
|
||||
# endif
|
||||
}
|
||||
|
||||
# if SDGA145
|
||||
public static bool Prefix(byte[] encryptData, ref byte[] __result)
|
||||
{
|
||||
if (AquaMai.AppConfig.Fix.RemoveEncryption)
|
||||
{
|
||||
__result = encryptData;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
__result = encryptData;
|
||||
return false;
|
||||
}
|
||||
# else
|
||||
public static bool Prefix(byte[] encryptData, out byte[] plainData, ref bool __result)
|
||||
{
|
||||
plainData = encryptData;
|
||||
__result = true;
|
||||
return false;
|
||||
}
|
||||
# endif
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue