[+] Fixes required to run SDGA

This commit is contained in:
Clansty
2024-07-09 18:11:06 +08:00
parent 60a0c8726e
commit c6e471323f
7 changed files with 102 additions and 2 deletions

45
AquaMai/Fix/BasicFix.cs Normal file
View File

@@ -0,0 +1,45 @@
using AMDaemon;
using AMDaemon.Allnet;
using HarmonyLib;
using Manager;
using Manager.Operation;
using IniFile = MAI2System.IniFile;
using Network = AMDaemon.Network;
namespace AquaMai.Fix;
public class BasicFix
{
[HarmonyPrefix]
[HarmonyPatch(typeof(IniFile), "clear")]
private static bool PreIniFileClear()
{
return false;
}
[HarmonyPrefix]
[HarmonyPatch(typeof(LanInstall), "IsServer", MethodType.Getter)]
private static bool PreIsServer(ref bool __result)
{
__result = true;
return false;
}
[HarmonyPrefix]
[HarmonyPatch(typeof(Network), "IsLanAvailable", MethodType.Getter)]
private static bool PreIsLanAvailable(ref bool __result)
{
__result = false;
return false;
}
[HarmonyPostfix]
[HarmonyPatch(typeof(OperationManager), "CheckAuth_Proc")]
private static void PostCheckAuthProc(ref OperationData ____operationData)
{
if (Auth.GameServerUri.StartsWith("http://") || Auth.GameServerUri.StartsWith("https://"))
{
____operationData.ServerUri = Auth.GameServerUri;
}
}
}

View File

@@ -0,0 +1,47 @@
using System.Collections.Generic;
using System.Reflection;
using HarmonyLib;
using Net.Packet;
namespace AquaMai.Fix;
public class RemoveEncryption
{
[HarmonyPrefix]
[HarmonyPatch(typeof(Packet), "Obfuscator")]
private static bool PreObfuscator(string srcStr, ref string __result)
{
__result = srcStr.Replace("MaimaiExp", "").Replace("MaimaiChn", "");
return false;
}
[HarmonyPatch]
public class Encrypt
{
public static IEnumerable<MethodBase> TargetMethods()
{
return new[] { AccessTools.Method("Net.CipherAES:Encrypt") };
}
public static bool Prefix(byte[] data, ref byte[] __result)
{
__result = data;
return false;
}
}
[HarmonyPatch]
public class Decrypt
{
public static IEnumerable<MethodBase> TargetMethods()
{
return new[] { AccessTools.Method("Net.CipherAES:Decrypt") };
}
public static bool Prefix(byte[] encryptData, ref byte[] __result)
{
__result = encryptData;
return false;
}
}
}

View File

@@ -0,0 +1,16 @@
using HarmonyLib;
using Process.Entry.State;
namespace AquaMai.Fix
{
public class SkipVersionCheck
{
[HarmonyPrefix]
[HarmonyPatch(typeof(ConfirmPlay), "IsValidVersion")]
public static bool IsValidVersion(ref bool __result)
{
__result = true;
return false;
}
}
}