-
Notifications
You must be signed in to change notification settings - Fork 0
/
Loader.cs
99 lines (81 loc) · 3.16 KB
/
Loader.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
using System;
using System.IO;
using System.Linq;
using System.Reflection;
using UnityEngine;
using HarmonyLib;
namespace Hax;
public class Loader : MonoBehaviour {
static GameObject HaxGameObject { get; } = new GameObject();
public static GameObject HaxModules { get; } = new GameObject();
public static GameObject HaxStealthModules { get; } = new GameObject();
static void AddHaxModules<T>() where T : Component => Loader.HaxModules.AddComponent<T>();
static void AddHaxGameObject<T>() where T : Component => Loader.HaxGameObject.AddComponent<T>();
static void DontDisableOnStealth<T>() where T : Component => Loader.HaxStealthModules.AddComponent<T>();
static Assembly OnResolveAssembly(object _, ResolveEventArgs args) {
Assembly assembly = Assembly.GetExecutingAssembly();
using Stream stream = assembly.GetManifestResourceStream(
assembly.GetManifestResourceNames()
.First(name => name.EndsWith($"{new AssemblyName(args.Name).Name}.dll"))
);
byte[] block = new byte[stream.Length];
stream.Read(block, 0, block.Length);
return Assembly.Load(block);
}
public static void Load() {
AppDomain.CurrentDomain.AssemblyResolve += Loader.OnResolveAssembly;
Loader.LoadHarmonyPatches();
Loader.LoadHaxGameObjects();
Loader.LoadHaxModules();
AppDomain.CurrentDomain.AssemblyResolve -= Loader.OnResolveAssembly;
}
static void LoadHarmonyPatches() {
new Harmony("winstxnhdw.rc15-hax").PatchAll();
}
static void LoadHaxGameObjects() {
DontDestroyOnLoad(Loader.HaxGameObject);
AddHaxGameObject<CursorController>();
AddHaxGameObject<DebugController>();
AddHaxGameObject<InputListener>();
AddHaxGameObject<Console>();
AddHaxGameObject<ConsoleInputField>();
AddHaxGameObject<Menu>();
AddHaxGameObject<Hax>();
AddHaxGameObject<HaxObjects>();
}
static void LoadHaxModules() {
DontDestroyOnLoad(Loader.HaxModules);
DontDestroyOnLoad(Loader.HaxStealthModules);
AddHaxModules<Aimbot>();
AddHaxModules<PlayerESP>();
AddHaxModules<NoClip>();
AddHaxModules<Freecam>();
AddHaxModules<Voodoo>();
AddHaxModules<PingMod>();
AddHaxModules<NetworkDesync>();
AddHaxModules<SelfDestruct>();
DontDisableOnStealth<Enemy>();
AddHaxModules<Player>();
AddHaxModules<Teams>();
AddHaxModules<FakeCrosshair>();
AddHaxModules<NoFog>();
AddHaxModules<NoCameraShake>();
AddHaxModules<UndergroundSpawn>();
AddHaxModules<WeaponMod>();
AddHaxModules<PlasmaMod>();
AddHaxModules<NanoMod>();
AddHaxModules<RailMod>();
AddHaxModules<SMGMod>();
AddHaxModules<TeslaMod>();
AddHaxModules<EnemyRadarMod>();
AddHaxModules<WheelMod>();
// AddHaxModules<AerofoilMod>();
// AddHaxModules<JetMod>();
// AddHaxModules<RotorMod>();
// AddHaxModules<LegMod>();
}
public static void Unload() {
Destroy(Loader.HaxModules);
Destroy(Loader.HaxGameObject);
}
}