From b48ecc3cf584db8176ab1e53a72e5d77360f45de Mon Sep 17 00:00:00 2001 From: Pocopoco Date: Mon, 2 Oct 2023 12:29:09 +0900 Subject: [PATCH 1/4] Update to resonite --- CameraHelperFunctions.cs | 20 ++++----- Introspection.cs | 30 ++++++------- ReFract.cs | 45 ++++++++++++------- ReFract.csproj | 45 ++++++++++--------- ReFract.sln | 25 +++++++++++ SymlinkedLibraries/0Harmony.dll | 2 +- SymlinkedLibraries/Assembly-CSharp.dll | 2 +- SymlinkedLibraries/BaseX.dll | 1 - SymlinkedLibraries/CodeX.dll | 1 - SymlinkedLibraries/Elements.Assets.dll | 1 + SymlinkedLibraries/Elements.Core.dll | 1 + SymlinkedLibraries/FrooxEngine.dll | 2 +- SymlinkedLibraries/NeosModLoader.dll | 1 - SymlinkedLibraries/ResoniteModLoader.dll | 1 + .../Unity.Postprocessing.Runtime.dll | 2 +- .../UnityEngine.AudioModule.dll | 2 +- SymlinkedLibraries/UnityEngine.CoreModule.dll | 2 +- .../UnityEngine.ParticleSystemModule.dll | 2 +- SymlinkedLibraries/UnityEngine.dll | 2 +- SymlinkedLibraries/UnityFrooxEngineRunner.dll | 1 + SymlinkedLibraries/UnityNeos.dll | 1 - 21 files changed, 115 insertions(+), 74 deletions(-) create mode 100644 ReFract.sln delete mode 120000 SymlinkedLibraries/BaseX.dll delete mode 120000 SymlinkedLibraries/CodeX.dll create mode 120000 SymlinkedLibraries/Elements.Assets.dll create mode 120000 SymlinkedLibraries/Elements.Core.dll delete mode 120000 SymlinkedLibraries/NeosModLoader.dll create mode 120000 SymlinkedLibraries/ResoniteModLoader.dll create mode 120000 SymlinkedLibraries/UnityFrooxEngineRunner.dll delete mode 120000 SymlinkedLibraries/UnityNeos.dll diff --git a/CameraHelperFunctions.cs b/CameraHelperFunctions.cs index 4ce41d7..69cb30d 100644 --- a/CameraHelperFunctions.cs +++ b/CameraHelperFunctions.cs @@ -1,12 +1,12 @@ -using NeosModLoader; +using ResoniteModLoader; using FrooxEngine; -using BaseX; +using Elements.Core; using UnityEngine; using Camera = FrooxEngine.Camera; using Component = FrooxEngine.Component; using System.Reflection; using UnityEngine.Rendering.PostProcessing; -using UnityNeos; +using UnityFrooxEngineRunner; namespace ReFract; @@ -52,12 +52,12 @@ public static void SetCameraVariable(DynamicVariableSpace? space, string CameraN UnityCam = cam.ToUnity(); // ToUnity() wants a ton of unity references, if that's why you're questioning the excessive unity libraries >.> Value = ValueTransformer(Value); - NeosMod.Debug("Re:Fract : " + CameraName + " Camera Found"); + ResoniteMod.Debug("Re:Fract : " + CameraName + " Camera Found"); // If the camera is not null, but the unity cam is assume it's still initializing and try running the set variable function again in a bit if (cam != null && UnityCam == null) // My null checks are paranoid, sue me { - NeosMod.Debug($"Re:Fract : {CameraName} Camera Connector Found on {cam?.Slot.Name} but no UnityCamera, looping again"); + ResoniteMod.Debug($"Re:Fract : {CameraName} Camera Connector Found on {cam?.Slot.Name} but no UnityCamera, looping again"); Engine.Current.WorldManager.FocusedWorld.RunInSeconds(0.25f, () => SetCameraVariable(space, CameraName, ComponentName, ParamName, Value)); return; } @@ -82,8 +82,8 @@ public static void SetCameraVariable(DynamicVariableSpace? space, string CameraN if (target == null) return; - NeosMod.Debug($"Re:Fract : Camera is {cam}"); - NeosMod.Debug($"Re:Fract : setting the {ParamName} parameter of the {target.GetType()} on camera {cam?.Slot.Name} to {Value} (of type {Value.GetType()}"); + ResoniteMod.Debug($"Re:Fract : Camera is {cam}"); + ResoniteMod.Debug($"Re:Fract : setting the {ParamName} parameter of the {target.GetType()} on camera {cam?.Slot.Name} to {Value} (of type {Value.GetType()}"); // Call into introspection and give it our override for parameters. Introspection again lets us set values on private fields without reflection // Also checking to see if the field name ends with an exclamaition mark, it's an easy way to tell if you wanna set a property or a field if (ParamName.EndsWith("!")) @@ -132,14 +132,14 @@ public static void RefreshCameraState(DynamicReferenceVariable camVar, C // Make sure the variables follow the naming conventions for Re:Fract if (splitName.Length == 3 && stringTokens != null && stringTokens.Length == 4 && stringTokens[1] == splitName[2]) { - NeosMod.Debug("Re:Fract : " + keyName + " interacts with this camera"); + ResoniteMod.Debug("Re:Fract : " + keyName + " interacts with this camera"); object? val = spaceDict[key].GetType().GetProperty("Value")?.GetValue(spaceDict[key]); - NeosMod.Debug("Re:Fract : " + keyName + " is " + val + " from " + handler); + ResoniteMod.Debug("Re:Fract : " + keyName + " is " + val + " from " + handler); if (val != null && handler != null) { // If all is well, set the camera's post processing variables back to the ones provided by the space SetCameraVariable(handler.CurrentSpace, stringTokens[1], stringTokens[2], stringTokens[3], val, altCameraInstance); - NeosMod.Debug("Re:Fract : Tokens are " + stringTokens[1] + " " + stringTokens[2] + " " + stringTokens[3]); + ResoniteMod.Debug("Re:Fract : Tokens are " + stringTokens[1] + " " + stringTokens[2] + " " + stringTokens[3]); } } } diff --git a/Introspection.cs b/Introspection.cs index 2c769e7..dcac238 100644 --- a/Introspection.cs +++ b/Introspection.cs @@ -1,4 +1,4 @@ -using NeosModLoader; +using ResoniteModLoader; using System.Reflection; using System.Reflection.Emit; namespace ReFract; @@ -22,17 +22,17 @@ public static class Introspection { if (obj == null || fieldName == null || fieldName.Length == 0) return null; - NeosMod.Debug("Introspection : Getting field"); + ResoniteMod.Debug("Introspection : Getting field"); // Get the target field FieldInfo field = obj.GetField(fieldName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); - NeosMod.Debug("Introspection : Field is " + (field == null ? "null" : "not null")); + ResoniteMod.Debug("Introspection : Field is " + (field == null ? "null" : "not null")); if (field == null) return null; - NeosMod.Debug("Introspection : Field is " + field.Name); + ResoniteMod.Debug("Introspection : Field is " + field.Name); // Get the delegate that acts as a field accessor the target field var del = GetDynamicMethod(obj, field, ilOverride); - NeosMod.Debug("Introspection : Delegate is " + (del == null ? "null" : "not null & " + del.GetType().ToString())); + ResoniteMod.Debug("Introspection : Delegate is " + (del == null ? "null" : "not null & " + del.GetType().ToString())); if (del == null) return null; @@ -42,7 +42,7 @@ public static class Introspection _cachedSetters.Add(obj, new Dictionary>()); _cachedSetters[obj].Add(fieldName, del); - NeosMod.Debug("Introspection : Added delegate to dictionary at " + obj.ToString() + "." + fieldName); + ResoniteMod.Debug("Introspection : Added delegate to dictionary at " + obj.ToString() + "." + fieldName); return del; } } @@ -61,17 +61,17 @@ public static class Introspection if (obj == null || propName == null || propName.Length == 0) return null; - NeosMod.Debug("Introspection : Getting property"); + ResoniteMod.Debug("Introspection : Getting property"); // Get the target property PropertyInfo prop = obj.GetProperty(propName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); - NeosMod.Debug("Introspection : Property is " + (prop == null ? "null" : "not null")); + ResoniteMod.Debug("Introspection : Property is " + (prop == null ? "null" : "not null")); if (prop == null) return null; - NeosMod.Debug("Introspection : Property is " + prop.Name); + ResoniteMod.Debug("Introspection : Property is " + prop.Name); // Get the delegate that acts as a property accessor the target property var del = GetDynamicPropMethod(obj, prop); - NeosMod.Debug("Introspection : Delegate is " + (del == null ? "null" : "not null & " + del.GetType().ToString())); + ResoniteMod.Debug("Introspection : Delegate is " + (del == null ? "null" : "not null & " + del.GetType().ToString())); if (del == null) return null; @@ -81,7 +81,7 @@ public static class Introspection _cachedPropSetters.Add(obj, new Dictionary>()); _cachedPropSetters[obj].Add(propName, del); - NeosMod.Debug("Introspection : Added delegate to dictionary at " + obj.ToString() + "." + propName); + ResoniteMod.Debug("Introspection : Added delegate to dictionary at " + obj.ToString() + "." + propName); return del; } } @@ -136,11 +136,11 @@ public static RefAction GetDynamicMethod(Type obj, FieldInfo fie // If the type doesn't match, print out a message and return, doing nothing. il.MarkLabel(typeFailed); il.Emit(OpCodes.Ldstr, $"Re:Fract : Wrong type for field \"{field.Name}\" which takes \"{field.FieldType}\""); - il.Emit(OpCodes.Call, typeof(NeosMod).GetMethod("Msg", new Type[] { typeof(string) })); + il.Emit(OpCodes.Call, typeof(ResoniteMod).GetMethod("Msg", new Type[] { typeof(string) })); il.Emit(OpCodes.Ret); - NeosMod.Debug("Introspection : Generated dynamic method with default IL"); + ResoniteMod.Debug("Introspection : Generated dynamic method with default IL"); } - NeosMod.Debug("Introspection : Creation of DynamicMethod was successful for " + obj.ToString() + "." + field.Name); + ResoniteMod.Debug("Introspection : Creation of DynamicMethod was successful for " + obj.ToString() + "." + field.Name); return (RefAction)method.CreateDelegate(typeof(RefAction<,>).MakeGenericType(typeof(object), typeof(object))); } @@ -164,7 +164,7 @@ public static RefAction GetDynamicMethod(Type obj, FieldInfo fie il.Emit(OpCodes.Call, method); il.Emit(OpCodes.Ret); - NeosMod.Debug("Introspection : Created delegate for property " + prop.Name); + ResoniteMod.Debug("Introspection : Created delegate for property " + prop.Name); var ret = (Action)del.CreateDelegate(typeof(Action)); // Add the delegate to the dictionary diff --git a/ReFract.cs b/ReFract.cs index 53b2507..74e0da0 100644 --- a/ReFract.cs +++ b/ReFract.cs @@ -1,18 +1,17 @@ using HarmonyLib; -using NeosModLoader; +using ResoniteModLoader; using FrooxEngine; -using BaseX; +using Elements.Core; using UnityEngine; using Camera = FrooxEngine.Camera; using Component = FrooxEngine.Component; -using System.Text; using System.Reflection; using UnityEngine.Rendering.PostProcessing; using System.Reflection.Emit; -using UnityNeos; +using UnityFrooxEngineRunner; namespace ReFract; -public class ReFract : NeosMod +public class ReFract : ResoniteMod { public override string Author => "Cyro"; public override string Name => "ReFract"; @@ -72,7 +71,7 @@ public static bool ILOverride(Type obj, FieldInfo field, ILGenerator il) // Call Msg() and print out a silly message if we failed to cast the argument il.MarkLabel(typeFailed); il.Emit(OpCodes.Ldstr, $"Re:Fract : Wrong type for field \"{field.Name}\" which takes \"{BaseFieldType.GetGenericArguments()[0]}\"! You fool!"); - il.Emit(OpCodes.Call, typeof(NeosMod).GetMethod("Msg", new Type[] { typeof(string) })); + il.Emit(OpCodes.Call, typeof(ResoniteMod).GetMethod("Msg", new Type[] { typeof(string) })); il.Emit(OpCodes.Ret); return true; } @@ -98,16 +97,30 @@ public override void OnEngineInit() Harmony harmony = new Harmony("net.Cyro.ReFract"); // Get all types that inherit from PostProcessEffectSettings - foreach (Assembly assembly in AppDomain.CurrentDomain.GetAssemblies()) - { - foreach (Type type in assembly.GetTypes()) - { - if (type.IsSubclassOf(typeof(PostProcessEffectSettings))) - { - TypeLookups.Add(type.Name, type); - } - } - } + // foreach (Assembly assembly in AppDomain.CurrentDomain.GetAssemblies()) + // { + // foreach (Type type in assembly.GetTypes()) + // { + // if (type.IsSubclassOf(typeof(PostProcessEffectSettings))) + // { + // TypeLookups.Add(type.Name, type); + // } + // } + // } + + // Manual + TypeLookups.Add("AmbientOcclusion", typeof(AmbientOcclusion)); + TypeLookups.Add("AutoExposure", typeof(AutoExposure)); + TypeLookups.Add("Bloom", typeof(Bloom)); + TypeLookups.Add("ChromaticAberration", typeof(ChromaticAberration)); + TypeLookups.Add("ColorGrading", typeof(ColorGrading)); + TypeLookups.Add("DepthOfField", typeof(DepthOfField)); + TypeLookups.Add("Grain", typeof(Grain)); + TypeLookups.Add("LensDistortion", typeof(LensDistortion)); + TypeLookups.Add("MotionBlur", typeof(MotionBlur)); + TypeLookups.Add("ScreenSpaceReflections", typeof(ScreenSpaceReflections)); + TypeLookups.Add("Vignette", typeof(Vignette)); + TypeLookups.Add("AmplifyOcclusionBase", typeof(AmplifyOcclusionBase)); // Include this specifically since it does post processing, but is not part of the bundle stack // TypeLookups will be used to easily get a type from one specified in a dynamic variable name string diff --git a/ReFract.csproj b/ReFract.csproj index 4afbfe5..c1683cc 100644 --- a/ReFract.csproj +++ b/ReFract.csproj @@ -11,46 +11,49 @@ + + + + + + SymlinkedLibraries\0Harmony.dll - - SymlinkedLibraries\BaseX.dll + + SymlinkedLibraries\Assembly-CSharp.dll + + + SymlinkedLibraries\Elements.Assets.dll - - SymlinkedLibraries\CodeX.dll + + SymlinkedLibraries\Elements.Core.dll SymlinkedLibraries\FrooxEngine.dll - - SymlinkedLibraries\NeosModLoader.dll - - - SymlinkedLibraries\UnityNeos.dll - - - SymlinkedLibraries\UnityEngine.CoreModule.dll + + SymlinkedLibraries\ResoniteModLoader.dll - + SymlinkedLibraries\Unity.Postprocessing.Runtime.dll - - SymlinkedLibraries\Assembly-CSharp.dll + + SymlinkedLibraries\UnityEngine.dll SymlinkedLibraries\UnityEngine.AudioModule.dll + + SymlinkedLibraries\UnityEngine.CoreModule.dll + SymlinkedLibraries\UnityEngine.ParticleSystemModule.dll - - - - - - + + SymlinkedLibraries\UnityFrooxEngineRunner.dll + diff --git a/ReFract.sln b/ReFract.sln new file mode 100644 index 0000000..fa72d27 --- /dev/null +++ b/ReFract.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.7.34031.279 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ReFract", "ReFract.csproj", "{7E0630EC-DE03-4697-B369-5205863EDCE0}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {7E0630EC-DE03-4697-B369-5205863EDCE0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7E0630EC-DE03-4697-B369-5205863EDCE0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7E0630EC-DE03-4697-B369-5205863EDCE0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7E0630EC-DE03-4697-B369-5205863EDCE0}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {3AA62700-EF27-4CA8-9031-C0B787D4A8C8} + EndGlobalSection +EndGlobal diff --git a/SymlinkedLibraries/0Harmony.dll b/SymlinkedLibraries/0Harmony.dll index 2eaf6f5..1b50a10 120000 --- a/SymlinkedLibraries/0Harmony.dll +++ b/SymlinkedLibraries/0Harmony.dll @@ -1 +1 @@ -C:/Program Files (x86)/Steam/steamapps/common/NeosVR/0Harmony.dll \ No newline at end of file +C:/Program Files (x86)/Steam/steamapps/common/Resonite/rml_libs/0Harmony.dll \ No newline at end of file diff --git a/SymlinkedLibraries/Assembly-CSharp.dll b/SymlinkedLibraries/Assembly-CSharp.dll index 27f10df..d938d41 120000 --- a/SymlinkedLibraries/Assembly-CSharp.dll +++ b/SymlinkedLibraries/Assembly-CSharp.dll @@ -1 +1 @@ -../../../../../../../Program Files (x86)/Steam/steamapps/common/NeosVR/Neos_Data/Managed/Assembly-CSharp.dll \ No newline at end of file +C:/Program Files (x86)/Steam/steamapps/common/Resonite/Resonite_Data/Managed/Assembly-CSharp.dll \ No newline at end of file diff --git a/SymlinkedLibraries/BaseX.dll b/SymlinkedLibraries/BaseX.dll deleted file mode 120000 index c7ace73..0000000 --- a/SymlinkedLibraries/BaseX.dll +++ /dev/null @@ -1 +0,0 @@ -C:/Program Files (x86)/Steam/steamapps/common/NeosVR/BaseX.dll \ No newline at end of file diff --git a/SymlinkedLibraries/CodeX.dll b/SymlinkedLibraries/CodeX.dll deleted file mode 120000 index 95683d3..0000000 --- a/SymlinkedLibraries/CodeX.dll +++ /dev/null @@ -1 +0,0 @@ -C:/Program Files (x86)/Steam/steamapps/common/NeosVR/Neos_Data/Managed/CodeX.dll \ No newline at end of file diff --git a/SymlinkedLibraries/Elements.Assets.dll b/SymlinkedLibraries/Elements.Assets.dll new file mode 120000 index 0000000..7d95296 --- /dev/null +++ b/SymlinkedLibraries/Elements.Assets.dll @@ -0,0 +1 @@ +C:/Program Files (x86)/Steam/steamapps/common/Resonite/Resonite_Data/Managed/Elements.Assets.dll \ No newline at end of file diff --git a/SymlinkedLibraries/Elements.Core.dll b/SymlinkedLibraries/Elements.Core.dll new file mode 120000 index 0000000..0bd777c --- /dev/null +++ b/SymlinkedLibraries/Elements.Core.dll @@ -0,0 +1 @@ +C:/Program Files (x86)/Steam/steamapps/common/Resonite/Resonite_Data/Managed/Elements.Core.dll \ No newline at end of file diff --git a/SymlinkedLibraries/FrooxEngine.dll b/SymlinkedLibraries/FrooxEngine.dll index 3c2f113..60ece7b 120000 --- a/SymlinkedLibraries/FrooxEngine.dll +++ b/SymlinkedLibraries/FrooxEngine.dll @@ -1 +1 @@ -C:/Program Files (x86)/Steam/steamapps/common/NeosVR/Neos_Data/Managed/FrooxEngine.dll \ No newline at end of file +C:/Program Files (x86)/Steam/steamapps/common/Resonite/Resonite_Data/Managed/FrooxEngine.dll \ No newline at end of file diff --git a/SymlinkedLibraries/NeosModLoader.dll b/SymlinkedLibraries/NeosModLoader.dll deleted file mode 120000 index a486d86..0000000 --- a/SymlinkedLibraries/NeosModLoader.dll +++ /dev/null @@ -1 +0,0 @@ -C:/Program Files (x86)/Steam/steamapps/common/NeosVR/Libraries/NeosModLoader.dll \ No newline at end of file diff --git a/SymlinkedLibraries/ResoniteModLoader.dll b/SymlinkedLibraries/ResoniteModLoader.dll new file mode 120000 index 0000000..64e0833 --- /dev/null +++ b/SymlinkedLibraries/ResoniteModLoader.dll @@ -0,0 +1 @@ +C:/Program Files (x86)/Steam/steamapps/common/Resonite/Libraries/ResoniteModLoader.dll \ No newline at end of file diff --git a/SymlinkedLibraries/Unity.Postprocessing.Runtime.dll b/SymlinkedLibraries/Unity.Postprocessing.Runtime.dll index dac4a75..6c5345e 120000 --- a/SymlinkedLibraries/Unity.Postprocessing.Runtime.dll +++ b/SymlinkedLibraries/Unity.Postprocessing.Runtime.dll @@ -1 +1 @@ -../../../../../../../Program Files (x86)/Steam/steamapps/common/NeosVR/Neos_Data/Managed/Unity.Postprocessing.Runtime.dll \ No newline at end of file +C:/Program Files (x86)/Steam/steamapps/common/Resonite/Resonite_Data/Managed/Unity.Postprocessing.Runtime.dll \ No newline at end of file diff --git a/SymlinkedLibraries/UnityEngine.AudioModule.dll b/SymlinkedLibraries/UnityEngine.AudioModule.dll index 8985555..2dfdfc8 120000 --- a/SymlinkedLibraries/UnityEngine.AudioModule.dll +++ b/SymlinkedLibraries/UnityEngine.AudioModule.dll @@ -1 +1 @@ -../../../../../../../Program Files (x86)/Steam/steamapps/common/NeosVR/Neos_Data/Managed/UnityEngine.AudioModule.dll \ No newline at end of file +C:/Program Files (x86)/Steam/steamapps/common/Resonite/Resonite_Data/Managed/UnityEngine.AudioModule.dll \ No newline at end of file diff --git a/SymlinkedLibraries/UnityEngine.CoreModule.dll b/SymlinkedLibraries/UnityEngine.CoreModule.dll index a23521c..8f7b34b 120000 --- a/SymlinkedLibraries/UnityEngine.CoreModule.dll +++ b/SymlinkedLibraries/UnityEngine.CoreModule.dll @@ -1 +1 @@ -../../../../../../../Program Files (x86)/Steam/steamapps/common/NeosVR/Neos_Data/Managed/UnityEngine.CoreModule.dll \ No newline at end of file +C:/Program Files (x86)/Steam/steamapps/common/Resonite/Resonite_Data/Managed/UnityEngine.CoreModule.dll \ No newline at end of file diff --git a/SymlinkedLibraries/UnityEngine.ParticleSystemModule.dll b/SymlinkedLibraries/UnityEngine.ParticleSystemModule.dll index ccf4a7a..3445761 120000 --- a/SymlinkedLibraries/UnityEngine.ParticleSystemModule.dll +++ b/SymlinkedLibraries/UnityEngine.ParticleSystemModule.dll @@ -1 +1 @@ -../../../../../../../Program Files (x86)/Steam/steamapps/common/NeosVR/Neos_Data/Managed/UnityEngine.ParticleSystemModule.dll \ No newline at end of file +C:/Program Files (x86)/Steam/steamapps/common/Resonite/Resonite_Data/Managed/UnityEngine.ParticleSystemModule.dll \ No newline at end of file diff --git a/SymlinkedLibraries/UnityEngine.dll b/SymlinkedLibraries/UnityEngine.dll index a976878..77064dd 120000 --- a/SymlinkedLibraries/UnityEngine.dll +++ b/SymlinkedLibraries/UnityEngine.dll @@ -1 +1 @@ -../../../../../../../Program Files (x86)/Steam/steamapps/common/NeosVR/Neos_Data/Managed/UnityEngine.dll \ No newline at end of file +C:/Program Files (x86)/Steam/steamapps/common/Resonite/Resonite_Data/Managed/UnityEngine.dll \ No newline at end of file diff --git a/SymlinkedLibraries/UnityFrooxEngineRunner.dll b/SymlinkedLibraries/UnityFrooxEngineRunner.dll new file mode 120000 index 0000000..db378f7 --- /dev/null +++ b/SymlinkedLibraries/UnityFrooxEngineRunner.dll @@ -0,0 +1 @@ +C:/Program Files (x86)/Steam/steamapps/common/Resonite/Resonite_Data/Managed/UnityFrooxEngineRunner.dll \ No newline at end of file diff --git a/SymlinkedLibraries/UnityNeos.dll b/SymlinkedLibraries/UnityNeos.dll deleted file mode 120000 index d30e261..0000000 --- a/SymlinkedLibraries/UnityNeos.dll +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../Program Files (x86)/Steam/steamapps/common/NeosVR/Neos_Data/Managed/UnityNeos.dll \ No newline at end of file From 73958fb22e45ec3fcd0e76863937b63cf70ef6cf Mon Sep 17 00:00:00 2001 From: Pocopoco <109301833+pocoworks@users.noreply.github.com> Date: Mon, 2 Oct 2023 12:43:28 +0900 Subject: [PATCH 2/4] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index fefbc16..9e18a2d 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Re:Fract -## Re:Fract is a [NeosModLoader](https://github.com/zkxs/NeosModLoader) mod that exposes many settings on the unity post processing stack for Neos cameras. +## Re:Fract is a [ResoniteModLoader](https://github.com/resonite-modding-group/ResoniteModLoader) mod that exposes many settings on the unity post processing stack for Neos cameras. ## You can find usage instructions in: [Usage.md](Usage.md) ## Main Features: From 3719747ba9e90b78ef3334fa1d27fdb674399642 Mon Sep 17 00:00:00 2001 From: Pocopoco Date: Wed, 11 Oct 2023 14:15:10 +0900 Subject: [PATCH 3/4] Fix an issue where camera photos become dark --- ReFract.cs | 81 +++++++++++++++++++++++++++--------------------------- 1 file changed, 41 insertions(+), 40 deletions(-) diff --git a/ReFract.cs b/ReFract.cs index 74e0da0..de8216d 100644 --- a/ReFract.cs +++ b/ReFract.cs @@ -15,7 +15,7 @@ public class ReFract : ResoniteMod { public override string Author => "Cyro"; public override string Name => "ReFract"; - public override string Version => "1.1.1"; + public override string Version => "1.1.2"; public static string DynVarKeyString => "Re.Fract_"; public static string DynVarCamKeyString => "Re.Fract_Camera_"; public static string ReFractTag => "Re:FractCameraSpace"; @@ -399,47 +399,48 @@ public static bool RenderImmediatePrefix(ref byte[] __result, RenderConnector __ int2 queriedRes = renderSettings.size; - if ((queriedRes > camRes).Any()) - { - Msg("Re:Fract: RenderConnector_Patch: Queried resolution is bigger than camera resolution"); - UnityEngine.Texture2D tex = new UnityEngine.Texture2D(queriedRes.x, queriedRes.y, renderSettings.textureFormat.ToUnity(true), false); - UnityEngine.RenderTexture temp = UnityEngine.RenderTexture.GetTemporary(queriedRes.x, queriedRes.y, 24, RenderTextureFormat.ARGB32); - UnityEngine.RenderTexture active = UnityEngine.RenderTexture.active; + //if ((queriedRes > camRes).Any()) + //{ + // Msg("Re:Fract: RenderConnector_Patch: Queried resolution is bigger than camera resolution"); + UnityEngine.Texture2D tex = new UnityEngine.Texture2D(queriedRes.x, queriedRes.y, renderSettings.textureFormat.ToUnity(true), false); + UnityEngine.RenderTexture temp = UnityEngine.RenderTexture.GetTemporary(queriedRes.x, queriedRes.y, 24, RenderTextureFormat.ARGB32); + UnityEngine.RenderTexture active = UnityEngine.RenderTexture.active; - UnityEngine.RenderTexture old = unityCam.targetTexture; - unityCam.targetTexture = temp; - unityCam.Render(); - unityCam.targetTexture = old; - - UnityEngine.RenderTexture.active = temp; - tex.ReadPixels(new UnityEngine.Rect(0, 0, queriedRes.x, queriedRes.y), 0, 0, false); - tex.Apply(); - UnityEngine.RenderTexture.active = active; + UnityEngine.RenderTexture old = unityCam.targetTexture; + unityCam.targetTexture = temp; + unityCam.Render(); + unityCam.targetTexture = old; + + UnityEngine.RenderTexture.active = temp; + tex.ReadPixels(new UnityEngine.Rect(0, 0, queriedRes.x, queriedRes.y), 0, 0, false); + tex.Apply(); + UnityEngine.RenderTexture.active = active; - UnityEngine.RenderTexture.ReleaseTemporary(temp); - byte[] bytes = tex.GetRawTextureData(); - UnityEngine.Object.Destroy(tex); - __result = bytes; - return false; - } - else - { - UnityEngine.RenderTexture active = UnityEngine.RenderTexture.active; - UnityEngine.Texture2D tex = new UnityEngine.Texture2D(camRes.x, camRes.y, renderSettings.textureFormat.ToUnity(true), false); - - unityCam.Render(); - UnityEngine.RenderTexture.active = renderTexture; - tex.ReadPixels(new UnityEngine.Rect(0, 0, camRes.x, camRes.y), 0, 0, false); - tex.Apply(); - UnityEngine.RenderTexture.active = active; - - UnityEngine.Texture2D resized = tex.ResizeReal(queriedRes.x, queriedRes.y); - byte[] bytes = resized.GetRawTextureData(); - UnityEngine.Object.Destroy(tex); - UnityEngine.Object.Destroy(resized); - __result = bytes; - return false; - } + UnityEngine.RenderTexture.ReleaseTemporary(temp); + byte[] bytes = tex.GetRawTextureData(); + UnityEngine.Object.Destroy(tex); + __result = bytes; + return false; + //} + //else + //{ + //TODO: This logic causes the screen to become darker. So I disable it. Need to debug that part + // UnityEngine.RenderTexture active = UnityEngine.RenderTexture.active; + // UnityEngine.Texture2D tex = new UnityEngine.Texture2D(camRes.x, camRes.y, renderSettings.textureFormat.ToUnity(true), false); + + // unityCam.Render(); + // UnityEngine.RenderTexture.active = renderTexture; + // tex.ReadPixels(new UnityEngine.Rect(0, 0, camRes.x, camRes.y), 0, 0, false); + // tex.Apply(); + // UnityEngine.RenderTexture.active = active; + + // UnityEngine.Texture2D resized = tex.ResizeReal(queriedRes.x, queriedRes.y); + // byte[] bytes = resized.GetRawTextureData(); + // UnityEngine.Object.Destroy(tex); + // UnityEngine.Object.Destroy(resized); + // __result = bytes; + // return false; + //} } } } From ee6091a396ec698a95121f45619ed8d02453277c Mon Sep 17 00:00:00 2001 From: Pocopoco Date: Wed, 11 Oct 2023 15:22:32 +0900 Subject: [PATCH 4/4] After reverting the bypassed logic, add the Linear option to Texture2D. --- ReFract.cs | 81 +++++++++++++++++++++++++++--------------------------- 1 file changed, 40 insertions(+), 41 deletions(-) diff --git a/ReFract.cs b/ReFract.cs index de8216d..fbec48e 100644 --- a/ReFract.cs +++ b/ReFract.cs @@ -15,7 +15,7 @@ public class ReFract : ResoniteMod { public override string Author => "Cyro"; public override string Name => "ReFract"; - public override string Version => "1.1.2"; + public override string Version => "1.1.3"; public static string DynVarKeyString => "Re.Fract_"; public static string DynVarCamKeyString => "Re.Fract_Camera_"; public static string ReFractTag => "Re:FractCameraSpace"; @@ -399,48 +399,47 @@ public static bool RenderImmediatePrefix(ref byte[] __result, RenderConnector __ int2 queriedRes = renderSettings.size; - //if ((queriedRes > camRes).Any()) - //{ - // Msg("Re:Fract: RenderConnector_Patch: Queried resolution is bigger than camera resolution"); - UnityEngine.Texture2D tex = new UnityEngine.Texture2D(queriedRes.x, queriedRes.y, renderSettings.textureFormat.ToUnity(true), false); - UnityEngine.RenderTexture temp = UnityEngine.RenderTexture.GetTemporary(queriedRes.x, queriedRes.y, 24, RenderTextureFormat.ARGB32); - UnityEngine.RenderTexture active = UnityEngine.RenderTexture.active; + if ((queriedRes > camRes).Any()) + { + Msg("Re:Fract: RenderConnector_Patch: Queried resolution is bigger than camera resolution"); + UnityEngine.Texture2D tex = new UnityEngine.Texture2D(queriedRes.x, queriedRes.y, renderSettings.textureFormat.ToUnity(true), false); + UnityEngine.RenderTexture temp = UnityEngine.RenderTexture.GetTemporary(queriedRes.x, queriedRes.y, 24, RenderTextureFormat.ARGB32); + UnityEngine.RenderTexture active = UnityEngine.RenderTexture.active; - UnityEngine.RenderTexture old = unityCam.targetTexture; - unityCam.targetTexture = temp; - unityCam.Render(); - unityCam.targetTexture = old; - - UnityEngine.RenderTexture.active = temp; - tex.ReadPixels(new UnityEngine.Rect(0, 0, queriedRes.x, queriedRes.y), 0, 0, false); - tex.Apply(); - UnityEngine.RenderTexture.active = active; + UnityEngine.RenderTexture old = unityCam.targetTexture; + unityCam.targetTexture = temp; + unityCam.Render(); + unityCam.targetTexture = old; + + UnityEngine.RenderTexture.active = temp; + tex.ReadPixels(new UnityEngine.Rect(0, 0, queriedRes.x, queriedRes.y), 0, 0, false); + tex.Apply(); + UnityEngine.RenderTexture.active = active; - UnityEngine.RenderTexture.ReleaseTemporary(temp); - byte[] bytes = tex.GetRawTextureData(); - UnityEngine.Object.Destroy(tex); - __result = bytes; - return false; - //} - //else - //{ - //TODO: This logic causes the screen to become darker. So I disable it. Need to debug that part - // UnityEngine.RenderTexture active = UnityEngine.RenderTexture.active; - // UnityEngine.Texture2D tex = new UnityEngine.Texture2D(camRes.x, camRes.y, renderSettings.textureFormat.ToUnity(true), false); - - // unityCam.Render(); - // UnityEngine.RenderTexture.active = renderTexture; - // tex.ReadPixels(new UnityEngine.Rect(0, 0, camRes.x, camRes.y), 0, 0, false); - // tex.Apply(); - // UnityEngine.RenderTexture.active = active; - - // UnityEngine.Texture2D resized = tex.ResizeReal(queriedRes.x, queriedRes.y); - // byte[] bytes = resized.GetRawTextureData(); - // UnityEngine.Object.Destroy(tex); - // UnityEngine.Object.Destroy(resized); - // __result = bytes; - // return false; - //} + UnityEngine.RenderTexture.ReleaseTemporary(temp); + byte[] bytes = tex.GetRawTextureData(); + UnityEngine.Object.Destroy(tex); + __result = bytes; + return false; + } + else + { + UnityEngine.RenderTexture active = UnityEngine.RenderTexture.active; + UnityEngine.Texture2D tex = new UnityEngine.Texture2D(camRes.x, camRes.y, renderSettings.textureFormat.ToUnity(true), false, true); + + unityCam.Render(); + UnityEngine.RenderTexture.active = renderTexture; + tex.ReadPixels(new UnityEngine.Rect(0, 0, camRes.x, camRes.y), 0, 0, false); + tex.Apply(); + UnityEngine.RenderTexture.active = active; + + UnityEngine.Texture2D resized = tex.ResizeReal(queriedRes.x, queriedRes.y); + byte[] bytes = resized.GetRawTextureData(); + UnityEngine.Object.Destroy(tex); + UnityEngine.Object.Destroy(resized); + __result = bytes; + return false; + } } } }