Skip to content

Commit

Permalink
Reworked to support Melon Loader 0.6.2
Browse files Browse the repository at this point in the history
  • Loading branch information
SuiMachine committed Mar 2, 2024
1 parent 6d9f905 commit 7ed42d1
Show file tree
Hide file tree
Showing 6 changed files with 89 additions and 52 deletions.
Binary file modified Release/GlobalGameManagersPatcher.exe
Binary file not shown.
Binary file modified Release/GlobalGameManagersPatcher.pdb
Binary file not shown.
Binary file modified Release/Mods/SuisHack.dll
Binary file not shown.
Binary file modified Release/Mods/SuisHack.pdb
Binary file not shown.
111 changes: 74 additions & 37 deletions Source/Hacks/PostProcessLayerHook.cs
Original file line number Diff line number Diff line change
Expand Up @@ -256,55 +256,84 @@ private static void ApplySSRChange()
{
foreach (var volume in PostProcessVolumeInstances)
{
if(volume!.profile.TryGetSettings<ScreenSpaceReflections>(out var ssr))
if (volume == null)
{
if (m_SSR_Enabled)
SuisHackMain.loggerInst!.Msg("Volume was null!");
continue;
}
else if (volume!.profile == null)
{
SuisHackMain.loggerInst!.Msg("Profile was null!");
continue;
}

ScreenSpaceReflections ssr = volume!.profile!.GetSetting<ScreenSpaceReflections>();
if (ssr == null)
{
SuisHackMain.loggerInst!.Msg("Ssr was null");
continue;
}

if (m_SSR_Enabled)
{
ssr.enabled.overrideState = true;
if (volume.gameObject.scene.name.ToLower() == "map_002_1_coldwarehouse")
{
ssr.enabled.overrideState = true;
if (volume.gameObject.scene.name.ToLower() == "map_002_1_coldwarehouse")
{
ssr.enabled.value = false;
ssr.active = false;
}
else
{
ssr.enabled.value = true;
ssr.active = true;
}

ssr.preset.overrideState = true;
ssr.preset.value = m_SSR_Preset;

ssr.resolution.overrideState = true;
ssr.resolution.value = m_SSR_Resolution;

ssr.thickness.overrideState = true;
ssr.thickness.value = m_SSR_Tickness; //0.3

ssr.vignette.overrideState = true;
ssr.vignette.value = m_SSR_Vignette; //0.3

ssr.distanceFade.overrideState = true;
ssr.distanceFade.value = m_SSR_DistanceFade; //0.1

ssr.maximumMarchDistance.overrideState = true;
ssr.maximumMarchDistance.value = m_SSR_MaxMarchingDistance;
ssr.enabled.value = false;
ssr.active = false;
}
else
ssr.enabled.overrideState = false;
{
ssr.enabled.value = true;
ssr.active = true;
}

ssr.preset.overrideState = true;
ssr.preset.value = m_SSR_Preset;

ssr.resolution.overrideState = true;
ssr.resolution.value = m_SSR_Resolution;

ssr.thickness.overrideState = true;
ssr.thickness.value = m_SSR_Tickness; //0.3

ssr.vignette.overrideState = true;
ssr.vignette.value = m_SSR_Vignette; //0.3

ssr.distanceFade.overrideState = true;
ssr.distanceFade.value = m_SSR_DistanceFade; //0.1

ssr.maximumMarchDistance.overrideState = true;
ssr.maximumMarchDistance.value = m_SSR_MaxMarchingDistance;
}
else
ssr.enabled.overrideState = false;
}
}

private static void ApplyEdgeDetectionChange()
{
foreach (var volume in PostProcessVolumeInstances)
{
if(volume!.profile.TryGetSettings<EdgeDetection>(out var edgeDetection))
if (volume == null)
{
edgeDetection!.enabled.value = m_EnableEdgeDetectionFilter;
edgeDetection!.sensitivityDepth.value = m_EnableEdgeDetectionFilterDepth;
SuisHackMain.loggerInst!.Msg("Volume was null!");
continue;
}
else if (volume!.profile == null)
{
SuisHackMain.loggerInst!.Msg("Profile was null!");
continue;
}

EdgeDetection edgeDetection = volume!.profile!.GetSetting<EdgeDetection>();
if (edgeDetection == null)
{
SuisHackMain.loggerInst!.Msg("EdgeDetection was null");
continue;
}
edgeDetection!.enabled.value = m_EnableEdgeDetectionFilter;
edgeDetection!.sensitivityDepth.value = m_EnableEdgeDetectionFilterDepth;
}
}

Expand Down Expand Up @@ -348,8 +377,15 @@ public static void PostProcessVolumeOnEnablePostfix(PostProcessVolume __instance
if (!PostProcessVolumeInstances.Contains(__instance))
PostProcessVolumeInstances.Add(__instance);

else if (__instance.profile == null)
{
SuisHackMain.loggerInst!.Msg("Profile was null!");
return;
}


if(__instance.profile.TryGetSettings<EdgeDetection>(out var edgeDetection))
EdgeDetection edgeDetection = __instance.profile.GetSetting<EdgeDetection>();
if (edgeDetection != null)
{
edgeDetection.enabled.value = m_EnableEdgeDetectionFilter;
edgeDetection.sensitivityDepth.value = m_EnableEdgeDetectionFilterDepth;
Expand All @@ -358,7 +394,8 @@ public static void PostProcessVolumeOnEnablePostfix(PostProcessVolume __instance
if (!m_SSR_Enabled)
return;

if(__instance.profile.TryGetSettings<ScreenSpaceReflections>(out var ssr))
ScreenSpaceReflections ssr = __instance.profile.GetSetting<ScreenSpaceReflections>();
if (ssr != null)
{
ssr.enabled.overrideState = true;
if (__instance.gameObject.scene.name.ToLower() == "map_002_1_coldwarehouse")
Expand Down
30 changes: 15 additions & 15 deletions Source/SuisHack.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,64 +6,64 @@
<Nullable>enable</Nullable>
<AppendTargetFrameworkToOutputPath>False</AppendTargetFrameworkToOutputPath>
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
<OutputPath>H:\\Steam\\steamapps\\common\\Deadly Premonition 2\\Mods</OutputPath>
<OutputPath>F:\\Steam\\steamapps\\common\\Deadly Premonition 2\\Mods</OutputPath>
</PropertyGroup>

<ItemGroup>
<Reference Include="0Harmony">
<HintPath>H:\Steam\steamapps\common\Deadly Premonition 2\MelonLoader\net6\0Harmony.dll</HintPath>
<HintPath>F:\Steam\steamapps\common\Deadly Premonition 2\MelonLoader\net6\0Harmony.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Assembly-CSharp">
<HintPath>H:\Steam\steamapps\common\Deadly Premonition 2\MelonLoader\Il2CppAssemblies\Assembly-CSharp.dll</HintPath>
<HintPath>F:\Steam\steamapps\common\Deadly Premonition 2\MelonLoader\Il2CppAssemblies\Assembly-CSharp.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Assembly-CSharp-firstpass">
<HintPath>H:\Steam\steamapps\common\Deadly Premonition 2\MelonLoader\Il2CppAssemblies\Assembly-CSharp-firstpass.dll</HintPath>
<HintPath>F:\Steam\steamapps\common\Deadly Premonition 2\MelonLoader\Il2CppAssemblies\Assembly-CSharp-firstpass.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Il2CppInterop.Runtime">
<HintPath>H:\Steam\steamapps\common\Deadly Premonition 2\MelonLoader\net6\Il2CppInterop.Runtime.dll</HintPath>
<HintPath>F:\Steam\steamapps\common\Deadly Premonition 2\MelonLoader\net6\Il2CppInterop.Runtime.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Il2Cppmscorlib">
<HintPath>H:\Steam\steamapps\common\Deadly Premonition 2\MelonLoader\Il2CppAssemblies\Il2Cppmscorlib.dll</HintPath>
<HintPath>F:\Steam\steamapps\common\Deadly Premonition 2\MelonLoader\Il2CppAssemblies\Il2Cppmscorlib.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Il2CppSystem">
<HintPath>H:\Steam\steamapps\common\Deadly Premonition 2\MelonLoader\Il2CppAssemblies\Il2CppSystem.dll</HintPath>
<HintPath>F:\Steam\steamapps\common\Deadly Premonition 2\MelonLoader\Il2CppAssemblies\Il2CppSystem.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="MelonLoader">
<HintPath>H:\Steam\steamapps\common\Deadly Premonition 2\MelonLoader\net6\MelonLoader.dll</HintPath>
<HintPath>F:\Steam\steamapps\common\Deadly Premonition 2\MelonLoader\net6\MelonLoader.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Unity.Postprocessing.Runtime">
<HintPath>H:\Steam\steamapps\common\Deadly Premonition 2\MelonLoader\Il2CppAssemblies\Unity.Postprocessing.Runtime.dll</HintPath>
<HintPath>F:\Steam\steamapps\common\Deadly Premonition 2\MelonLoader\Il2CppAssemblies\Unity.Postprocessing.Runtime.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.AssetBundleModule">
<HintPath>H:\Steam\steamapps\common\Deadly Premonition 2\MelonLoader\Il2CppAssemblies\UnityEngine.AssetBundleModule.dll</HintPath>
<HintPath>F:\Steam\steamapps\common\Deadly Premonition 2\MelonLoader\Il2CppAssemblies\UnityEngine.AssetBundleModule.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.CoreModule">
<HintPath>H:\Steam\steamapps\common\Deadly Premonition 2\MelonLoader\Il2CppAssemblies\UnityEngine.CoreModule.dll</HintPath>
<HintPath>F:\Steam\steamapps\common\Deadly Premonition 2\MelonLoader\Il2CppAssemblies\UnityEngine.CoreModule.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.IMGUIModule">
<HintPath>H:\Steam\steamapps\common\Deadly Premonition 2\MelonLoader\Il2CppAssemblies\UnityEngine.IMGUIModule.dll</HintPath>
<HintPath>F:\Steam\steamapps\common\Deadly Premonition 2\MelonLoader\Il2CppAssemblies\UnityEngine.IMGUIModule.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.InputModule">
<HintPath>H:\Steam\steamapps\common\Deadly Premonition 2\MelonLoader\Il2CppAssemblies\UnityEngine.InputModule.dll</HintPath>
<HintPath>F:\Steam\steamapps\common\Deadly Premonition 2\MelonLoader\Il2CppAssemblies\UnityEngine.InputModule.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.PhysicsModule">
<HintPath>H:\Steam\steamapps\common\Deadly Premonition 2\MelonLoader\Il2CppAssemblies\UnityEngine.PhysicsModule.dll</HintPath>
<HintPath>F:\Steam\steamapps\common\Deadly Premonition 2\MelonLoader\Il2CppAssemblies\UnityEngine.PhysicsModule.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.UI">
<HintPath>H:\Steam\steamapps\common\Deadly Premonition 2\MelonLoader\Il2CppAssemblies\UnityEngine.UI.dll</HintPath>
<HintPath>F:\Steam\steamapps\common\Deadly Premonition 2\MelonLoader\Il2CppAssemblies\UnityEngine.UI.dll</HintPath>
<Private>False</Private>
</Reference>
</ItemGroup>
Expand Down

0 comments on commit 7ed42d1

Please sign in to comment.