-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathPlugin.cs
More file actions
44 lines (41 loc) · 1.3 KB
/
Copy pathPlugin.cs
File metadata and controls
44 lines (41 loc) · 1.3 KB
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
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using InControl;
using System.Reflection;
namespace Overcooked2DS4BT
{
[BepInPlugin(MyPluginInfo.PLUGIN_GUID, MyPluginInfo.PLUGIN_NAME, MyPluginInfo.PLUGIN_VERSION)]
public class Plugin : BaseUnityPlugin
{
internal static new ManualLogSource Logger;
private void Awake()
{
Logger = base.Logger;
Logger.LogInfo($"Plugin {MyPluginInfo.PLUGIN_GUID} is loaded!");
Harmony harmony = new Harmony(MyPluginInfo.PLUGIN_GUID);
harmony.PatchAll();
}
}
[HarmonyPatch(typeof(PlayStation4MacBTProfile))]
[HarmonyPatch(MethodType.Constructor)]
public class Patch_PS4MacBTProfile
{
static void Postfix(PlayStation4MacBTProfile __instance)
{
var field = typeof(UnityInputDeviceProfile).GetField("JoystickRegex", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
if (field != null)
{
field.SetValue(__instance, new string[]
{
".*DUALSHOCK.*"
});
Plugin.Logger.LogInfo("[Mod] Patched JoystickRegex on PS4 BT profile.");
}
else
{
Plugin.Logger.LogWarning("[Mod] Failed to find JoystickRegex field.");
}
}
}
}