Skip to content
This repository has been archived by the owner on May 15, 2023. It is now read-only.

TSAC: Always wait for RoomManager to improve world shaders avoid being filtered #201

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 12 additions & 15 deletions TrueShaderAntiCrash/TrueShaderAntiCrashMod.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
using UnityEngine.SceneManagement;
using VRC.Core;

[assembly:MelonInfo(typeof(TrueShaderAntiCrashMod), "True Shader Anticrash", "1.0.6", "knah", "https://github.com/knah/VRCMods")]
[assembly:MelonInfo(typeof(TrueShaderAntiCrashMod), "True Shader Anticrash", "1.0.7", "knah", "https://github.com/knah/VRCMods")]
[assembly:MelonGame("VRChat", "VRChat")]

namespace TrueShaderAntiCrash
Expand Down Expand Up @@ -110,20 +110,17 @@ IEnumerator WaitForRoomManagerAndUpdate()

void UpdateLimiters()
{
if (enabledInPublicsOnly.Value)
var room = RoomManager.field_Internal_Static_ApiWorldInstance_0;
if (room == null)
{
var room = RoomManager.field_Internal_Static_ApiWorldInstance_0;
if (room == null)
{
MelonCoroutines.Start(WaitForRoomManagerAndUpdate());
return;
}

if (room.type != InstanceAccessType.Public)
{
ShaderFilterApi.SetFilteringState(false, false, false);
return;
}
MelonCoroutines.Start(WaitForRoomManagerAndUpdate());
return;
}

if (enabledInPublicsOnly.Value && room.type != InstanceAccessType.Public)
{
ShaderFilterApi.SetFilteringState(false, false, false);
return;
}

ShaderFilterApi.SetFilteringState(loopsEnabled.Value, geometryEnabled.Value, tessEnabled.Value);
Expand Down Expand Up @@ -177,4 +174,4 @@ private static void AddNewUixProperties(string categoryName)
[UnmanagedFunctionPointer(CallingConvention.FastCall)]
private delegate void FindAndLoadUnityPlugin(IntPtr name, out IntPtr loadedModule, byte bEnableSomeDebug);
}
}
}