Skip to content

Commit

Permalink
Fixing mod support issues
Browse files Browse the repository at this point in the history
  • Loading branch information
cybensis committed Dec 8, 2024
1 parent 18a07f5 commit fc28ca7
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ModSupport/AmandsGraphicsSupport.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ private static bool BlockOpticPatch(AmandsGraphicsOpticPatch __instance)
return false;
}
[HarmonyPrefix]
[HarmonyPatch(typeof(AmandsGraphicsmethod_22Patch), "PatchPostFix")]
private static bool BlockSomeOtherOpticPatch(AmandsGraphicsmethod_22Patch __instance)
[HarmonyPatch(typeof(AmandsGraphicsmethod_25Patch), "PatchPostFix")]
private static bool BlockSomeOtherOpticPatch(AmandsGraphicsmethod_25Patch __instance)
{
return false;
}
Expand Down
56 changes: 56 additions & 0 deletions Plugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,17 @@ private void InitializeConditionalPatches()
return; // Skip patching if VR failed to initialize

string modDllPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "BepInEx\\plugins\\kmyuhkyuk-EFTApi\\EFTConfiguration.dll");

if (File.Exists(modDllPath))
{
// Load the assembly
Assembly modAssembly = Assembly.LoadFrom(modDllPath);

// Check for the required types and methods in the loaded assembly
Type configViewType = modAssembly.GetType("EFTConfiguration.Views.EFTConfigurationView");
if (configViewType != null)
{
// Apply conditional patches
InstalledMods.EFTApiInstalled = true;
ApplyPatches("TarkovVR.ModSupport.EFTApi");
MyLog.LogInfo("Dependent mod found and patches applied.");
Expand All @@ -112,6 +117,57 @@ private void InitializeConditionalPatches()
MyLog.LogWarning("Dependent mod DLL not found. Some functionality will be disabled.");
}

modDllPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "BepInEx\\plugins\\AmandsGraphics.dll");

if (File.Exists(modDllPath))
{
// Load the assembly
Assembly modAssembly = Assembly.LoadFrom(modDllPath);

// Check for the required types and methods in the loaded assembly
Type configViewType = modAssembly.GetType("AmandsGraphics.AmandsGraphicsClass");
if (configViewType != null)
{
// Apply conditional patches
InstalledMods.AmandsGraphicsInstalled = true;
ApplyPatches("TarkovVR.ModSupport.AmandsGraphics");
MyLog.LogInfo("Dependent mod found and patches applied.");
}
else
{
MyLog.LogWarning("Required types/methods not found in the dependent mod.");
}
}
else
{
MyLog.LogWarning("Dependent mod DLL not found. Some functionality will be disabled.");
}

modDllPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "BepInEx\\plugins\\Fika.Core.dll");

if (File.Exists(modDllPath))
{
// Load the assembly
Assembly modAssembly = Assembly.LoadFrom(modDllPath);

// Check for the required types and methods in the loaded assembly
Type configViewType = modAssembly.GetType("MatchMakerUI");
if (configViewType != null)
{
// Apply conditional patches
InstalledMods.FIKAInstalled = true;
ApplyPatches("TarkovVR.ModSupport.FIKA");
MyLog.LogInfo("Dependent mod found and patches applied.");
}
else
{
MyLog.LogWarning("Required types/methods not found in the dependent mod.");
}
}
else
{
MyLog.LogWarning("Dependent mod DLL not found. Some functionality will be disabled.");
}
// Repeat for other mods (AmandsGraphics, FIKA) as needed
}

Expand Down
Binary file modified libs/ModSupport/AmandsGraphics.dll
Binary file not shown.

0 comments on commit fc28ca7

Please sign in to comment.