1
1
using HarmonyLib ;
2
2
using MelonLoader ;
3
3
using System ;
4
+ using System . Linq ;
4
5
using System . Reflection ;
5
6
using VRC . SDKBase ;
6
7
using VRC . Udon . Wrapper . Modules ;
7
8
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" ) ]
9
10
[ assembly: MelonGame ( "VRChat" , "VRChat" ) ]
10
11
[ assembly: MelonColor ( ConsoleColor . DarkMagenta ) ]
12
+ [ assembly: MelonOptionalDependencies ( "AstralCore" ) ]
11
13
12
14
namespace Astrum
13
15
{
@@ -26,6 +28,13 @@ public override void OnApplicationStart()
26
28
HarmonyInstance . Patch ( typeof ( ExternVRCSDK3ComponentsVRCPickup ) . GetMethod ( nameof ( ExternVRCSDK3ComponentsVRCPickup . __set_pickupable__SystemBoolean ) ) , hkNoOp ) ;
27
29
HarmonyInstance . Patch ( typeof ( ExternVRCSDK3ComponentsVRCPickup ) . GetMethod ( nameof ( ExternVRCSDK3ComponentsVRCPickup . __set_allowManipulationWhenEquipped__SystemBoolean ) ) , hkNoOp ) ;
28
30
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" ) ;
29
38
}
30
39
31
40
private static bool HookNoOp ( ) => false ;
@@ -36,5 +45,26 @@ private static void HookAwake(ref VRC_Pickup __instance)
36
45
__instance . allowManipulationWhenEquipped = true ;
37
46
__instance . proximity = float . MaxValue ;
38
47
}
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
+ }
39
69
}
40
70
}
0 commit comments