[+] Fixes required to run SDGA

pull/46/head
Clansty 2024-07-09 18:11:06 +08:00
parent 60a0c8726e
commit c6e471323f
7 changed files with 102 additions and 2 deletions

View File

@ -33,6 +33,9 @@
<Reference Include="0Harmony">
<HintPath>Libs\0Harmony.dll</HintPath>
</Reference>
<Reference Include="AMDaemon.NET">
<HintPath>Libs\AMDaemon.NET.dll</HintPath>
</Reference>
<Reference Include="Assembly-CSharp">
<HintPath>Libs\Assembly-CSharp.dll</HintPath>
</Reference>
@ -271,7 +274,10 @@
<Compile Include="Cheat\TicketUnlock.cs" />
<Compile Include="Cheat\UnlockUtage.cs" />
<Compile Include="Config.cs" />
<Compile Include="Fix\BasicFix.cs" />
<Compile Include="Fix\FixCharaCrash.cs" />
<Compile Include="Fix\RemoveEncryption.cs" />
<Compile Include="Fix\SkipVersionCheck.cs" />
<Compile Include="Performance\ImproveLoadSpeed.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Main.cs" />
@ -288,7 +294,6 @@
<Compile Include="UX\RunCommandOnEvents.cs" />
<Compile Include="UX\SinglePlayer.cs" />
<Compile Include="UX\SkipEventInfo.cs" />
<Compile Include="UX\SkipVersionCheck.cs" />
<Compile Include="UX\SkipWarningScreen.cs" />
<Compile Include="UX\SkipToMusicSelection.cs" />
</ItemGroup>

View File

@ -50,3 +50,4 @@ ImproveLoadSpeed=false
[Fix]
# Allow login with higher data version
SkipVersionCheck=true
RemoveEncryption=true

View File

@ -44,6 +44,7 @@ namespace AquaMai
public class FixConfig
{
public bool SkipVersionCheck { get; set; }
public bool RemoveEncryption { get; set; }
}
}
}

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

@ -1,7 +1,7 @@
using HarmonyLib;
using Process.Entry.State;
namespace AquaMai.UX
namespace AquaMai.Fix
{
public class SkipVersionCheck
{

View File

@ -81,6 +81,7 @@ namespace AquaMai
Patch(typeof(CustomVersionString));
Patch(typeof(DisableReboot));
Patch(typeof(RunCommandOnEvents));
Patch(typeof(BasicFix));
MelonLogger.Msg("Loaded!");
}