Skip to content
This repository was archived by the owner on Jul 27, 2022. It is now read-only.

Commit 0f644a9

Browse files
committed
add WallReach/GhostHand
1 parent fe7272c commit 0f644a9

File tree

2 files changed

+34
-1
lines changed

2 files changed

+34
-1
lines changed

AstralPickups.cs

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
using HarmonyLib;
22
using MelonLoader;
33
using System;
4+
using System.Linq;
45
using System.Reflection;
56
using VRC.SDKBase;
67
using VRC.Udon.Wrapper.Modules;
78

8-
[assembly: MelonInfo(typeof(Astrum.AstralPickups), "AstralPickups", "0.2.1", downloadLink: "github.com/Astrum-Project/AstralPickups")]
9+
[assembly: MelonInfo(typeof(Astrum.AstralPickups), "AstralPickups", "0.3.0", downloadLink: "github.com/Astrum-Project/AstralPickups")]
910
[assembly: MelonGame("VRChat", "VRChat")]
1011
[assembly: MelonColor(ConsoleColor.DarkMagenta)]
12+
[assembly: MelonOptionalDependencies("AstralCore")]
1113

1214
namespace Astrum
1315
{
@@ -26,6 +28,13 @@ public override void OnApplicationStart()
2628
HarmonyInstance.Patch(typeof(ExternVRCSDK3ComponentsVRCPickup).GetMethod(nameof(ExternVRCSDK3ComponentsVRCPickup.__set_pickupable__SystemBoolean)), hkNoOp);
2729
HarmonyInstance.Patch(typeof(ExternVRCSDK3ComponentsVRCPickup).GetMethod(nameof(ExternVRCSDK3ComponentsVRCPickup.__set_allowManipulationWhenEquipped__SystemBoolean)), hkNoOp);
2830
HarmonyInstance.Patch(typeof(ExternVRCSDK3ComponentsVRCPickup).GetMethod(nameof(ExternVRCSDK3ComponentsVRCPickup.__set_proximity__SystemSingle)), hkNoOp);
31+
32+
if (AppDomain.CurrentDomain.GetAssemblies().Any(f => f.GetName().Name == "AstralCore"))
33+
{
34+
if (UnityEngine.Application.version.Contains("1134"))
35+
External.RemoveWallCheck(External.FindWallCheck());
36+
}
37+
else MelonLogger.Warning("AstralCore is missing, running at reduced functionality");
2938
}
3039

3140
private static bool HookNoOp() => false;
@@ -36,5 +45,26 @@ private static void HookAwake(ref VRC_Pickup __instance)
3645
__instance.allowManipulationWhenEquipped = true;
3746
__instance.proximity = float.MaxValue;
3847
}
48+
49+
private static class External
50+
{
51+
public static IntPtr FindWallCheck()
52+
{
53+
return AstralCore.Utils.PatternScanner.Scan(
54+
"GameAssembly.dll",
55+
"0F 85 C9 00 00 00" + // jne GameAssembly.dll + AE40E0
56+
"48 8B 0D ????????" + // mov rcx, [GameAssembly.dll + 7200EC0]
57+
"F6 81 2F 01 00 00 02" + // test byte ptr [rcx+12F], 2
58+
"74 0E" + // je GameAssembly.dll + AE4035
59+
"44 39 B1 E0 00 00 00" + // cmp [rcx + E0],r14d
60+
"75 05" + // jne GameAssembly.dll + AE4035??
61+
"E8 ????????" + // call GameAssembly.il2cpp_runtime_class_init
62+
"33 D2" // xor edx, edx
63+
);
64+
}
65+
66+
public static void RemoveWallCheck(IntPtr address) => AstralCore.Utils.MemoryUtils.WriteBytes(address, new byte[6] { 0xE9, 0xCA, 0x00, 0x00, 0x00, 0x90 });
67+
public static void RepairWallCheck(IntPtr address) => AstralCore.Utils.MemoryUtils.WriteBytes(address, new byte[6] { 0x0F, 0x85, 0xC9, 0x00, 0x00, 0x00 });
68+
}
3969
}
4070
}

AstralPickups.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@
3434
<RunPostBuildEvent>OnOutputUpdated</RunPostBuildEvent>
3535
</PropertyGroup>
3636
<ItemGroup>
37+
<Reference Include="AstralCore">
38+
<HintPath>C:\Program Files (x86)\Steam\steamapps\common\VRChat\Mods\AstralCore.dll</HintPath>
39+
</Reference>
3740
<Reference Include="Il2Cppmscorlib, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
3841
<HintPath>D:\SteamLibary\steamapps\common\VRChat\MelonLoader\Managed\Il2Cppmscorlib.dll</HintPath>
3942
</Reference>

0 commit comments

Comments
 (0)