diff --git a/src/CacheObject/CacheField.cs b/src/CacheObject/CacheField.cs
index 6495225..54025b3 100644
--- a/src/CacheObject/CacheField.cs
+++ b/src/CacheObject/CacheField.cs
@@ -38,8 +38,6 @@ namespace Explorer.CacheObject
{
var fi = MemInfo as FieldInfo;
fi.SetValue(fi.IsStatic ? null : DeclaringInstance, IValue.Value);
-
- base.SetValue();
}
}
}
diff --git a/src/CacheObject/CacheMember.cs b/src/CacheObject/CacheMember.cs
index bd55929..5cae830 100644
--- a/src/CacheObject/CacheMember.cs
+++ b/src/CacheObject/CacheMember.cs
@@ -126,10 +126,12 @@ namespace Explorer.CacheObject
GUIUnstrip.BeginHorizontal(new GUILayoutOption[0]);
GUI.skin.label.alignment = TextAnchor.MiddleCenter;
+
GUILayout.Label(i.ToString(), new GUILayoutOption[] { GUILayout.Width(15) });
- this.m_argumentInput[i] = GUIUnstrip.TextField(input, new GUILayoutOption[] { GUILayout.Width(150) });
+ GUILayout.Label(label, new GUILayoutOption[] { GUILayout.ExpandWidth(false) });
+ this.m_argumentInput[i] = GUILayout.TextField(input, new GUILayoutOption[] { GUILayout.ExpandWidth(true) });
+
GUI.skin.label.alignment = TextAnchor.MiddleLeft;
- GUILayout.Label(label, new GUILayoutOption[0]);
GUILayout.EndHorizontal();
}
diff --git a/src/CacheObject/CacheProperty.cs b/src/CacheObject/CacheProperty.cs
index 5959f44..3a23272 100644
--- a/src/CacheObject/CacheProperty.cs
+++ b/src/CacheObject/CacheProperty.cs
@@ -53,8 +53,6 @@ namespace Explorer.CacheObject
var target = pi.GetAccessors()[0].IsStatic ? null : DeclaringInstance;
pi.SetValue(target, IValue.Value, ParseArguments());
-
- base.SetValue();
}
}
}
diff --git a/src/Explorer.csproj b/src/Explorer.csproj
index 45bcfc7..0469294 100644
--- a/src/Explorer.csproj
+++ b/src/Explorer.csproj
@@ -41,6 +41,7 @@
CPP,ML
true
true
+ true
v3.5
@@ -49,6 +50,7 @@
false
false
true
+ true
v4.7.2
@@ -56,6 +58,7 @@
CPP,BIE
true
false
+ true
v3.5
@@ -63,6 +66,7 @@
MONO,BIE
false
false
+ true
@@ -230,7 +234,6 @@
-
@@ -254,13 +257,14 @@
-
-
-
-
+
+
+
+
+
-
-
+
+
diff --git a/src/ExplorerCore.cs b/src/ExplorerCore.cs
index 28b0b90..d6605dc 100644
--- a/src/ExplorerCore.cs
+++ b/src/ExplorerCore.cs
@@ -10,7 +10,7 @@ namespace Explorer
public class ExplorerCore
{
public const string NAME = "Explorer " + VERSION + " (" + PLATFORM + ", " + MODLOADER + ")";
- public const string VERSION = "2.0.0";
+ public const string VERSION = "2.0.1";
public const string AUTHOR = "Sinai";
public const string GUID = "com.sinai.explorer";
@@ -68,7 +68,7 @@ namespace Explorer
if (ShowMenu)
{
- //CursorControl.Update();
+ ForceUnlockCursor.Update();
InspectUnderMouse.Update();
MainMenu.Instance.Update();
diff --git a/src/Input/InputManager.cs b/src/Input/InputManager.cs
index eb3dbf0..926d097 100644
--- a/src/Input/InputManager.cs
+++ b/src/Input/InputManager.cs
@@ -2,6 +2,9 @@
using System.Reflection;
using UnityEngine;
using Explorer.Input;
+#if CPP
+using UnhollowerBaseLib;
+#endif
namespace Explorer
{
@@ -15,7 +18,7 @@ namespace Explorer
{
inputModule = new InputSystem();
}
- else if (LegacyInput.TInput != null || TryLoadModule("UnityEngine.Input", LegacyInput.TInput))
+ else if (LegacyInput.TInput != null || TryLoadModule("UnityEngine.InputLegacyModule", LegacyInput.TInput))
{
inputModule = new LegacyInput();
}
@@ -38,5 +41,34 @@ namespace Explorer
public static bool GetMouseButtonDown(int btn) => inputModule.GetMouseButtonDown(btn);
public static bool GetMouseButton(int btn) => inputModule.GetMouseButton(btn);
+
+ //#if CPP
+ //#pragma warning disable IDE1006
+ // // public extern static string compositionString { get; }
+
+ // internal delegate string get_compositionString_delegate();
+ // internal static get_compositionString_delegate get_compositionString_iCall =
+ // IL2CPP.ResolveICall("UnityEngine.Input::get_compositionString");
+
+ // public static string compositionString => get_compositionString_iCall();
+
+ // // public extern static Vector2 compositionCursorPos { get; set; }
+
+ // internal delegate Vector2 get_compositionCursorPos_delegate();
+ // internal static get_compositionCursorPos_delegate get_compositionCursorPos_iCall =
+ // IL2CPP.ResolveICall("UnityEngine.Input::get_compositionCursorPos");
+
+ // internal delegate void set_compositionCursorPos_delegate(Vector2 value);
+ // internal static set_compositionCursorPos_delegate set_compositionCursorPos_iCall =
+ // IL2CPP.ResolveICall("UnityEngine.Input::set_compositionCursorPos");
+
+ // public static Vector2 compositionCursorPos
+ // {
+ // get => get_compositionCursorPos_iCall();
+ // set => set_compositionCursorPos_iCall(value);
+ // }
+
+ //#pragma warning restore IDE1006
+ //#endif
}
-}
+}
\ No newline at end of file
diff --git a/src/Tests/TestClass.cs b/src/Tests/TestClass.cs
index ff57f2b..a220d44 100644
--- a/src/Tests/TestClass.cs
+++ b/src/Tests/TestClass.cs
@@ -3,6 +3,11 @@ using System.Collections.Generic;
using System;
using UnityEngine;
using System.Reflection;
+using System.Runtime.InteropServices;
+#if CPP
+using UnhollowerBaseLib;
+using UnityEngine.SceneManagement;
+#endif
namespace Explorer.Tests
{
@@ -32,6 +37,14 @@ namespace Explorer.Tests
public static int StaticField = 5;
public int NonStaticField;
+#if CPP
+ public static IntPtr FindICall(string name) => il2cpp_resolve_icall(name);
+
+ [DllImport("GameAssembly", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
+ private static extern IntPtr il2cpp_resolve_icall([MarshalAs(UnmanagedType.LPStr)] string name);
+
+#endif
+
#if CPP
public static Il2CppSystem.Collections.Generic.HashSet ILHashSetTest;
#endif
diff --git a/src/UnstripFixes/GUIUnstrip.cs b/src/Unstrip/IMGUI/GUIUnstrip.cs
similarity index 96%
rename from src/UnstripFixes/GUIUnstrip.cs
rename to src/Unstrip/IMGUI/GUIUnstrip.cs
index d34accc..b5912ac 100644
--- a/src/UnstripFixes/GUIUnstrip.cs
+++ b/src/Unstrip/IMGUI/GUIUnstrip.cs
@@ -3,17 +3,17 @@ using System.Collections.Generic;
using System.Reflection;
using UnityEngine;
#if CPP
-using Explorer.UnstripInternals;
+using Explorer.Unstrip.IMGUI;
#endif
namespace Explorer
{
public class GUIUnstrip
{
- public static void BeginHorizontal(params GUILayoutOption[] options)
+ public static void BeginHorizontal(params GUILayoutOption[] options)
=> BeginHorizontal(GUIContent.none, GUIStyle.none, options);
- public static void BeginHorizontal(GUIStyle style, params GUILayoutOption[] options)
+ public static void BeginHorizontal(GUIStyle style, params GUILayoutOption[] options)
=> BeginHorizontal(GUIContent.none, style, options);
public static void BeginHorizontal(GUIContent content, GUIStyle style, params GUILayoutOption[] options)
@@ -25,11 +25,11 @@ namespace Explorer
#endif
}
- public static void BeginVertical(params GUILayoutOption[] options)
+ public static void BeginVertical(params GUILayoutOption[] options)
=> BeginVertical(GUIContent.none, GUIStyle.none, options);
public static void BeginVertical(GUIStyle style, params GUILayoutOption[] options)
- => BeginVertical(GUIContent.none, style, options);
+ => BeginVertical(GUIContent.none, style, options);
public static void BeginVertical(GUIContent content, GUIStyle style, params GUILayoutOption[] options)
{
diff --git a/src/UnstripFixes/Internal.cs b/src/Unstrip/IMGUI/Internal.cs
similarity index 99%
rename from src/UnstripFixes/Internal.cs
rename to src/Unstrip/IMGUI/Internal.cs
index c7759ba..3c2d056 100644
--- a/src/UnstripFixes/Internal.cs
+++ b/src/Unstrip/IMGUI/Internal.cs
@@ -6,7 +6,7 @@ using UnityEngine;
using UnityEngineInternal;
using UnhollowerRuntimeLib;
-namespace Explorer.UnstripInternals
+namespace Explorer.Unstrip.IMGUI
{
public class Internal
{
@@ -14,7 +14,7 @@ namespace Explorer.UnstripInternals
public static int s_ScrollControlId;
public static bool ScrollFailed = false;
- public static bool ManualUnstripFailed = false;
+ public static bool ManualUnstripFailed = false;
public static GenericStack ScrollStack => m_scrollStack ?? GetScrollStack();
public static PropertyInfo m_scrollViewStatesInfo;
@@ -73,7 +73,7 @@ namespace Explorer.UnstripInternals
if (m_stateCacheDict == null) throw new Exception();
}
- catch
+ catch
{
m_stateCacheDict = new Dictionary();
}
@@ -117,7 +117,7 @@ namespace Explorer.UnstripInternals
public static string TextField(string text, GUILayoutOption[] options)
{
- text = text ?? "";
+ text = text ?? string.Empty;
int controlID = GUIUtility.GetControlID(FocusType.Keyboard);
GUIContent guicontent = GUIContent.Temp(text);
@@ -275,7 +275,7 @@ namespace Explorer.UnstripInternals
GUI.EndGroup();
}
-#endregion
+ #endregion
#region Scrolling
@@ -422,7 +422,7 @@ namespace Explorer.UnstripInternals
var scrollViewState = GetStateObject(Il2CppType.Of(), controlID)
.TryCast();
- if (scrollViewState == null)
+ if (scrollViewState == null)
return scrollPosition;
var scrollExt = Internal_ScrollViewState.FromPointer(scrollViewState.Pointer);
@@ -660,7 +660,7 @@ namespace Explorer.UnstripInternals
return result;
}
-#endregion
+ #endregion
}
#region Extensions
diff --git a/src/UnstripFixes/Internal_LayoutUtility.cs b/src/Unstrip/IMGUI/Internal_LayoutUtility.cs
similarity index 98%
rename from src/UnstripFixes/Internal_LayoutUtility.cs
rename to src/Unstrip/IMGUI/Internal_LayoutUtility.cs
index b491449..5300430 100644
--- a/src/UnstripFixes/Internal_LayoutUtility.cs
+++ b/src/Unstrip/IMGUI/Internal_LayoutUtility.cs
@@ -1,7 +1,7 @@
#if CPP
using UnityEngine;
-namespace Explorer.UnstripInternals
+namespace Explorer.Unstrip.IMGUI
{
public class Internal_LayoutUtility
{
@@ -85,7 +85,7 @@ namespace Explorer.UnstripInternals
last = GUILayoutUtility.kDummyRect;
}
return last;
- }
+ }
}
}
#endif
\ No newline at end of file
diff --git a/src/UnstripFixes/Internal_ScrollViewState.cs b/src/Unstrip/IMGUI/Internal_ScrollViewState.cs
similarity index 94%
rename from src/UnstripFixes/Internal_ScrollViewState.cs
rename to src/Unstrip/IMGUI/Internal_ScrollViewState.cs
index 64af6fb..472e254 100644
--- a/src/UnstripFixes/Internal_ScrollViewState.cs
+++ b/src/Unstrip/IMGUI/Internal_ScrollViewState.cs
@@ -3,7 +3,7 @@ using System;
using System.Collections.Generic;
using UnityEngine;
-namespace Explorer.UnstripInternals
+namespace Explorer.Unstrip.IMGUI
{
public class Internal_ScrollViewState
{
diff --git a/src/Unstrip/IMGUI/Internal_SliderHandler.cs b/src/Unstrip/IMGUI/Internal_SliderHandler.cs
new file mode 100644
index 0000000..5cf9c02
--- /dev/null
+++ b/src/Unstrip/IMGUI/Internal_SliderHandler.cs
@@ -0,0 +1,411 @@
+#if CPP
+using System;
+using UnhollowerRuntimeLib;
+using UnityEngine;
+
+namespace Explorer.Unstrip.IMGUI
+{
+ public struct Internal_SliderHandler
+ {
+ public static int ScrollTroughSide
+ {
+ get
+ {
+ if (!m_getScrollTroughSideFailed)
+ {
+ try
+ {
+ return GUI.scrollTroughSide;
+ }
+ catch
+ {
+ m_getScrollTroughSideFailed = true;
+ }
+ }
+
+ return m_manualScrollTrough;
+ }
+ set
+ {
+ if (!m_setScrollTroughSideFailed)
+ {
+ try
+ {
+ GUI.scrollTroughSide = value;
+ return;
+ }
+ catch
+ {
+ m_setScrollTroughSideFailed = true;
+ }
+ }
+ m_manualScrollTrough = value;
+ }
+ }
+ private static bool m_getScrollTroughSideFailed;
+ private static bool m_setScrollTroughSideFailed;
+ private static int m_manualScrollTrough;
+
+
+ private readonly Rect position;
+ private readonly float currentValue;
+ private readonly float size;
+ private readonly float start;
+ private readonly float end;
+ private readonly GUIStyle slider;
+ private readonly GUIStyle thumb;
+ private readonly bool horiz;
+ private readonly int id;
+
+ public Internal_SliderHandler(Rect position, float currentValue, float size, float start,
+ float end, GUIStyle slider, GUIStyle thumb, bool horiz, int id)
+ {
+ this.position = position;
+ this.currentValue = currentValue;
+ this.size = size;
+ this.start = start;
+ this.end = end;
+ this.slider = slider;
+ this.thumb = thumb;
+ this.horiz = horiz;
+ this.id = id;
+ }
+
+ public float Handle()
+ {
+ float result;
+ if (this.slider == null || this.thumb == null)
+ {
+ result = this.currentValue;
+ }
+ else
+ {
+ switch (this.CurrentEventType())
+ {
+ case EventType.MouseDown:
+ return this.OnMouseDown();
+ case EventType.MouseUp:
+ return this.OnMouseUp();
+ case EventType.MouseDrag:
+ return this.OnMouseDrag();
+ case EventType.Repaint:
+ return this.OnRepaint();
+ }
+ result = this.currentValue;
+ }
+ return result;
+ }
+
+ private float OnMouseDown()
+ {
+ float result;
+ if (!this.position.Contains(this.CurrentEvent().mousePosition) || this.IsEmptySlider())
+ {
+ result = this.currentValue;
+ }
+ else
+ {
+ ScrollTroughSide = 0;
+ GUIUtility.hotControl = this.id;
+ this.CurrentEvent().Use();
+ if (this.ThumbSelectionRect().Contains(this.CurrentEvent().mousePosition))
+ {
+ this.StartDraggingWithValue(this.ClampedCurrentValue());
+ result = this.currentValue;
+ }
+ else
+ {
+ GUI.changed = true;
+ if (this.SupportsPageMovements())
+ {
+ var ext = Internal_SliderState.FromPointer(GetSliderState().Pointer);
+ ext.isDragging = false;
+ Internal.nextScrollStepTime = DateTime.Now.AddMilliseconds(250.0);
+ ScrollTroughSide = this.CurrentScrollTroughSide();
+ result = this.PageMovementValue();
+ }
+ else
+ {
+ float num = this.ValueForCurrentMousePosition();
+ this.StartDraggingWithValue(num);
+ result = this.Clamp(num);
+ }
+ }
+ }
+ return result;
+ }
+
+ private float OnMouseDrag()
+ {
+ float result;
+ if (GUIUtility.hotControl != this.id)
+ {
+ result = this.currentValue;
+ }
+ else
+ {
+ var ext = Internal_SliderState.FromPointer(GetSliderState().Pointer);
+ if (!ext.isDragging)
+ {
+ result = this.currentValue;
+ }
+ else
+ {
+ GUI.changed = true;
+ this.CurrentEvent().Use();
+ float num = this.MousePosition() - ext.dragStartPos;
+ float value = ext.dragStartValue + num / this.ValuesPerPixel();
+ result = this.Clamp(value);
+ }
+ }
+ return result;
+ }
+
+ private float OnMouseUp()
+ {
+ if (GUIUtility.hotControl == this.id)
+ {
+ this.CurrentEvent().Use();
+ GUIUtility.hotControl = 0;
+ }
+ return this.currentValue;
+ }
+
+ private float OnRepaint()
+ {
+ this.slider.Draw(this.position, GUIContent.none, this.id);
+ if (!this.IsEmptySlider() && this.currentValue >= this.MinValue() && this.currentValue <= this.MaxValue())
+ {
+ this.thumb.Draw(this.ThumbRect(), GUIContent.none, this.id);
+ }
+ float result;
+ if (GUIUtility.hotControl != this.id || !this.position.Contains(this.CurrentEvent().mousePosition) || this.IsEmptySlider())
+ {
+ result = this.currentValue;
+ }
+ else if (this.ThumbRect().Contains(this.CurrentEvent().mousePosition))
+ {
+ if (ScrollTroughSide != 0)
+ {
+ GUIUtility.hotControl = 0;
+ }
+ result = this.currentValue;
+ }
+ else
+ {
+ GUI.InternalRepaintEditorWindow();
+ if (DateTime.Now < Internal.nextScrollStepTime)
+ {
+ result = this.currentValue;
+ }
+ else if (this.CurrentScrollTroughSide() != ScrollTroughSide)
+ {
+ result = this.currentValue;
+ }
+ else
+ {
+ Internal.nextScrollStepTime = DateTime.Now.AddMilliseconds(30.0);
+ if (this.SupportsPageMovements())
+ {
+ Internal_SliderState.FromPointer(GetSliderState().Pointer).isDragging = false;
+ GUI.changed = true;
+ result = this.PageMovementValue();
+ }
+ else
+ {
+ result = this.ClampedCurrentValue();
+ }
+ }
+ }
+ return result;
+ }
+
+ private EventType CurrentEventType()
+ {
+ return this.CurrentEvent().GetTypeForControl(this.id);
+ }
+
+
+ private int CurrentScrollTroughSide()
+ {
+ float num = (!this.horiz) ? this.CurrentEvent().mousePosition.y : this.CurrentEvent().mousePosition.x;
+ float num2 = (!this.horiz) ? this.ThumbRect().y : this.ThumbRect().x;
+ return (num <= num2) ? -1 : 1;
+ }
+
+ private bool IsEmptySlider()
+ {
+ return this.start == this.end;
+ }
+
+ private bool SupportsPageMovements()
+ {
+ return this.size != 0f && GUI.usePageScrollbars;
+ }
+
+ private float PageMovementValue()
+ {
+ float num = this.currentValue;
+ int num2 = (this.start <= this.end) ? 1 : -1;
+ if (this.MousePosition() > this.PageUpMovementBound())
+ {
+ num += this.size * (float)num2 * 0.9f;
+ }
+ else
+ {
+ num -= this.size * (float)num2 * 0.9f;
+ }
+ return this.Clamp(num);
+ }
+
+ private float PageUpMovementBound()
+ {
+ float result;
+ if (this.horiz)
+ {
+ result = this.ThumbRect().xMax - this.position.x;
+ }
+ else
+ {
+ result = this.ThumbRect().yMax - this.position.y;
+ }
+ return result;
+ }
+
+ private Event CurrentEvent()
+ {
+ return Event.current;
+ }
+
+ private float ValueForCurrentMousePosition()
+ {
+ float result;
+ if (this.horiz)
+ {
+ result = (this.MousePosition() - this.ThumbRect().width * 0.5f) / this.ValuesPerPixel() + this.start - this.size * 0.5f;
+ }
+ else
+ {
+ result = (this.MousePosition() - this.ThumbRect().height * 0.5f) / this.ValuesPerPixel() + this.start - this.size * 0.5f;
+ }
+ return result;
+ }
+
+ private float Clamp(float value)
+ {
+ return Mathf.Clamp(value, this.MinValue(), this.MaxValue());
+ }
+
+ private Rect ThumbSelectionRect()
+ {
+ return this.ThumbRect();
+ }
+
+ private void StartDraggingWithValue(float dragStartValue)
+ {
+ var ext = Internal_SliderState.FromPointer(GetSliderState().Pointer);
+ ext.dragStartPos = this.MousePosition();
+ ext.dragStartValue = dragStartValue;
+ ext.isDragging = true;
+ }
+
+ private SliderState GetSliderState()
+ {
+ return GUIUtility.GetStateObject(Il2CppType.Of(), this.id).TryCast();
+ }
+
+ private Rect ThumbRect()
+ {
+ return (!this.horiz) ? this.VerticalThumbRect() : this.HorizontalThumbRect();
+ }
+
+ private Rect VerticalThumbRect()
+ {
+ float num = this.ValuesPerPixel();
+ Rect result;
+ if (this.start < this.end)
+ {
+ result = new Rect(this.position.x + (float)this.slider.padding.left, (this.ClampedCurrentValue() - this.start) * num + this.position.y + (float)this.slider.padding.top, this.position.width - (float)this.slider.padding.horizontal, this.size * num + this.ThumbSize());
+ }
+ else
+ {
+ result = new Rect(this.position.x + (float)this.slider.padding.left, (this.ClampedCurrentValue() + this.size - this.start) * num + this.position.y + (float)this.slider.padding.top, this.position.width - (float)this.slider.padding.horizontal, this.size * -num + this.ThumbSize());
+ }
+ return result;
+ }
+
+ private Rect HorizontalThumbRect()
+ {
+ float num = this.ValuesPerPixel();
+ Rect result;
+ if (this.start < this.end)
+ {
+ result = new Rect((this.ClampedCurrentValue() - this.start) * num + this.position.x + (float)this.slider.padding.left, this.position.y + (float)this.slider.padding.top, this.size * num + this.ThumbSize(), this.position.height - (float)this.slider.padding.vertical);
+ }
+ else
+ {
+ result = new Rect((this.ClampedCurrentValue() + this.size - this.start) * num + this.position.x + (float)this.slider.padding.left, this.position.y, this.size * -num + this.ThumbSize(), this.position.height);
+ }
+ return result;
+ }
+
+ private float ClampedCurrentValue()
+ {
+ return this.Clamp(this.currentValue);
+ }
+
+ private float MousePosition()
+ {
+ float result;
+ if (this.horiz)
+ {
+ result = this.CurrentEvent().mousePosition.x - this.position.x;
+ }
+ else
+ {
+ result = this.CurrentEvent().mousePosition.y - this.position.y;
+ }
+ return result;
+ }
+
+ private float ValuesPerPixel()
+ {
+ float result;
+ if (this.horiz)
+ {
+ result = (this.position.width - (float)this.slider.padding.horizontal - this.ThumbSize()) / (this.end - this.start);
+ }
+ else
+ {
+ result = (this.position.height - (float)this.slider.padding.vertical - this.ThumbSize()) / (this.end - this.start);
+ }
+ return result;
+ }
+
+ private float ThumbSize()
+ {
+ float result;
+ if (this.horiz)
+ {
+ result = ((this.thumb.fixedWidth == 0f) ? ((float)this.thumb.padding.horizontal) : this.thumb.fixedWidth);
+ }
+ else
+ {
+ result = ((this.thumb.fixedHeight == 0f) ? ((float)this.thumb.padding.vertical) : this.thumb.fixedHeight);
+ }
+ return result;
+ }
+
+ private float MaxValue()
+ {
+ return Mathf.Max(this.start, this.end) - this.size;
+ }
+
+ private float MinValue()
+ {
+ return Mathf.Min(this.start, this.end);
+ }
+
+ }
+}
+#endif
\ No newline at end of file
diff --git a/src/UnstripFixes/Internal_SliderState.cs b/src/Unstrip/IMGUI/Internal_SliderState.cs
similarity index 94%
rename from src/UnstripFixes/Internal_SliderState.cs
rename to src/Unstrip/IMGUI/Internal_SliderState.cs
index 4934e4d..989e8af 100644
--- a/src/UnstripFixes/Internal_SliderState.cs
+++ b/src/Unstrip/IMGUI/Internal_SliderState.cs
@@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
-namespace Explorer.UnstripInternals
+namespace Explorer.Unstrip.IMGUI
{
public class Internal_SliderState
{
diff --git a/src/Unstrip/Scene/SceneUnstrip.cs b/src/Unstrip/Scene/SceneUnstrip.cs
new file mode 100644
index 0000000..deaab91
--- /dev/null
+++ b/src/Unstrip/Scene/SceneUnstrip.cs
@@ -0,0 +1,41 @@
+#if CPP
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using UnhollowerBaseLib;
+using UnityEngine;
+
+namespace Explorer.Unstrip.Scene
+{
+ public class SceneUnstrip
+ {
+ internal delegate void getRootSceneObjects(int handle, IntPtr list);
+ internal static getRootSceneObjects getRootSceneObjects_iCall =
+ IL2CPP.ResolveICall("UnityEngine.SceneManagement.Scene::GetRootGameObjectsInternal");
+
+ public static void GetRootGameObjects_Internal(UnityEngine.SceneManagement.Scene scene, IntPtr list)
+ {
+ getRootSceneObjects_iCall(scene.handle, list);
+ }
+
+ public static GameObject[] GetRootSceneObjects(UnityEngine.SceneManagement.Scene scene)
+ {
+ var list = new Il2CppSystem.Collections.Generic.List(GetRootCount_Internal(scene));
+
+ GetRootGameObjects_Internal(scene, list.Pointer);
+
+ return list.ToArray();
+ }
+
+ internal delegate int getRootCount(int handle);
+ internal static getRootCount getRootCount_iCall =
+ IL2CPP.ResolveICall("UnityEngine.SceneManagement.Scene::GetRootCountInternal");
+
+ public static int GetRootCount_Internal(UnityEngine.SceneManagement.Scene scene)
+ {
+ return getRootCount_iCall(scene.handle);
+ }
+ }
+}
+#endif
\ No newline at end of file
diff --git a/src/UnstripFixes/Internal_SliderHandler.cs b/src/UnstripFixes/Internal_SliderHandler.cs
deleted file mode 100644
index 1a458e8..0000000
--- a/src/UnstripFixes/Internal_SliderHandler.cs
+++ /dev/null
@@ -1,413 +0,0 @@
-#if CPP
-using System;
-using UnhollowerRuntimeLib;
-using UnityEngine;
-using Explorer.UnstripInternals;
-using Il2CppSystem.Reflection;
-
-namespace Explorer.UnstripInternals
-{
- public struct Internal_SliderHandler
- {
- public static int ScrollTroughSide
- {
- get
- {
- if (!m_getScrollTroughSideFailed)
- {
- try
- {
- return GUI.scrollTroughSide;
- }
- catch
- {
- m_getScrollTroughSideFailed = true;
- }
- }
-
- return m_manualScrollTrough;
- }
- set
- {
- if (!m_setScrollTroughSideFailed)
- {
- try
- {
- GUI.scrollTroughSide = value;
- return;
- }
- catch
- {
- m_setScrollTroughSideFailed = true;
- }
- }
- m_manualScrollTrough = value;
- }
- }
- private static bool m_getScrollTroughSideFailed;
- private static bool m_setScrollTroughSideFailed;
- private static int m_manualScrollTrough;
-
-
- private readonly Rect position;
- private readonly float currentValue;
- private readonly float size;
- private readonly float start;
- private readonly float end;
- private readonly GUIStyle slider;
- private readonly GUIStyle thumb;
- private readonly bool horiz;
- private readonly int id;
-
- public Internal_SliderHandler(Rect position, float currentValue, float size, float start,
- float end, GUIStyle slider, GUIStyle thumb, bool horiz, int id)
- {
- this.position = position;
- this.currentValue = currentValue;
- this.size = size;
- this.start = start;
- this.end = end;
- this.slider = slider;
- this.thumb = thumb;
- this.horiz = horiz;
- this.id = id;
- }
-
- public float Handle()
- {
- float result;
- if (this.slider == null || this.thumb == null)
- {
- result = this.currentValue;
- }
- else
- {
- switch (this.CurrentEventType())
- {
- case EventType.MouseDown:
- return this.OnMouseDown();
- case EventType.MouseUp:
- return this.OnMouseUp();
- case EventType.MouseDrag:
- return this.OnMouseDrag();
- case EventType.Repaint:
- return this.OnRepaint();
- }
- result = this.currentValue;
- }
- return result;
- }
-
- private float OnMouseDown()
- {
- float result;
- if (!this.position.Contains(this.CurrentEvent().mousePosition) || this.IsEmptySlider())
- {
- result = this.currentValue;
- }
- else
- {
- ScrollTroughSide = 0;
- GUIUtility.hotControl = this.id;
- this.CurrentEvent().Use();
- if (this.ThumbSelectionRect().Contains(this.CurrentEvent().mousePosition))
- {
- this.StartDraggingWithValue(this.ClampedCurrentValue());
- result = this.currentValue;
- }
- else
- {
- GUI.changed = true;
- if (this.SupportsPageMovements())
- {
- var ext = Internal_SliderState.FromPointer(GetSliderState().Pointer);
- ext.isDragging = false;
- Internal.nextScrollStepTime = DateTime.Now.AddMilliseconds(250.0);
- ScrollTroughSide = this.CurrentScrollTroughSide();
- result = this.PageMovementValue();
- }
- else
- {
- float num = this.ValueForCurrentMousePosition();
- this.StartDraggingWithValue(num);
- result = this.Clamp(num);
- }
- }
- }
- return result;
- }
-
- private float OnMouseDrag()
- {
- float result;
- if (GUIUtility.hotControl != this.id)
- {
- result = this.currentValue;
- }
- else
- {
- var ext = Internal_SliderState.FromPointer(GetSliderState().Pointer);
- if (!ext.isDragging)
- {
- result = this.currentValue;
- }
- else
- {
- GUI.changed = true;
- this.CurrentEvent().Use();
- float num = this.MousePosition() - ext.dragStartPos;
- float value = ext.dragStartValue + num / this.ValuesPerPixel();
- result = this.Clamp(value);
- }
- }
- return result;
- }
-
- private float OnMouseUp()
- {
- if (GUIUtility.hotControl == this.id)
- {
- this.CurrentEvent().Use();
- GUIUtility.hotControl = 0;
- }
- return this.currentValue;
- }
-
- private float OnRepaint()
- {
- this.slider.Draw(this.position, GUIContent.none, this.id);
- if (!this.IsEmptySlider() && this.currentValue >= this.MinValue() && this.currentValue <= this.MaxValue())
- {
- this.thumb.Draw(this.ThumbRect(), GUIContent.none, this.id);
- }
- float result;
- if (GUIUtility.hotControl != this.id || !this.position.Contains(this.CurrentEvent().mousePosition) || this.IsEmptySlider())
- {
- result = this.currentValue;
- }
- else if (this.ThumbRect().Contains(this.CurrentEvent().mousePosition))
- {
- if (ScrollTroughSide != 0)
- {
- GUIUtility.hotControl = 0;
- }
- result = this.currentValue;
- }
- else
- {
- GUI.InternalRepaintEditorWindow();
- if (DateTime.Now < Internal.nextScrollStepTime)
- {
- result = this.currentValue;
- }
- else if (this.CurrentScrollTroughSide() != ScrollTroughSide)
- {
- result = this.currentValue;
- }
- else
- {
- Internal.nextScrollStepTime = DateTime.Now.AddMilliseconds(30.0);
- if (this.SupportsPageMovements())
- {
- Internal_SliderState.FromPointer(GetSliderState().Pointer).isDragging = false;
- GUI.changed = true;
- result = this.PageMovementValue();
- }
- else
- {
- result = this.ClampedCurrentValue();
- }
- }
- }
- return result;
- }
-
- private EventType CurrentEventType()
- {
- return this.CurrentEvent().GetTypeForControl(this.id);
- }
-
-
- private int CurrentScrollTroughSide()
- {
- float num = (!this.horiz) ? this.CurrentEvent().mousePosition.y : this.CurrentEvent().mousePosition.x;
- float num2 = (!this.horiz) ? this.ThumbRect().y : this.ThumbRect().x;
- return (num <= num2) ? -1 : 1;
- }
-
- private bool IsEmptySlider()
- {
- return this.start == this.end;
- }
-
- private bool SupportsPageMovements()
- {
- return this.size != 0f && GUI.usePageScrollbars;
- }
-
- private float PageMovementValue()
- {
- float num = this.currentValue;
- int num2 = (this.start <= this.end) ? 1 : -1;
- if (this.MousePosition() > this.PageUpMovementBound())
- {
- num += this.size * (float)num2 * 0.9f;
- }
- else
- {
- num -= this.size * (float)num2 * 0.9f;
- }
- return this.Clamp(num);
- }
-
- private float PageUpMovementBound()
- {
- float result;
- if (this.horiz)
- {
- result = this.ThumbRect().xMax - this.position.x;
- }
- else
- {
- result = this.ThumbRect().yMax - this.position.y;
- }
- return result;
- }
-
- private Event CurrentEvent()
- {
- return Event.current;
- }
-
- private float ValueForCurrentMousePosition()
- {
- float result;
- if (this.horiz)
- {
- result = (this.MousePosition() - this.ThumbRect().width * 0.5f) / this.ValuesPerPixel() + this.start - this.size * 0.5f;
- }
- else
- {
- result = (this.MousePosition() - this.ThumbRect().height * 0.5f) / this.ValuesPerPixel() + this.start - this.size * 0.5f;
- }
- return result;
- }
-
- private float Clamp(float value)
- {
- return Mathf.Clamp(value, this.MinValue(), this.MaxValue());
- }
-
- private Rect ThumbSelectionRect()
- {
- return this.ThumbRect();
- }
-
- private void StartDraggingWithValue(float dragStartValue)
- {
- var ext = Internal_SliderState.FromPointer(GetSliderState().Pointer);
- ext.dragStartPos = this.MousePosition();
- ext.dragStartValue = dragStartValue;
- ext.isDragging = true;
- }
-
- private SliderState GetSliderState()
- {
- return GUIUtility.GetStateObject(Il2CppType.Of(), this.id).TryCast();
- }
-
- private Rect ThumbRect()
- {
- return (!this.horiz) ? this.VerticalThumbRect() : this.HorizontalThumbRect();
- }
-
- private Rect VerticalThumbRect()
- {
- float num = this.ValuesPerPixel();
- Rect result;
- if (this.start < this.end)
- {
- result = new Rect(this.position.x + (float)this.slider.padding.left, (this.ClampedCurrentValue() - this.start) * num + this.position.y + (float)this.slider.padding.top, this.position.width - (float)this.slider.padding.horizontal, this.size * num + this.ThumbSize());
- }
- else
- {
- result = new Rect(this.position.x + (float)this.slider.padding.left, (this.ClampedCurrentValue() + this.size - this.start) * num + this.position.y + (float)this.slider.padding.top, this.position.width - (float)this.slider.padding.horizontal, this.size * -num + this.ThumbSize());
- }
- return result;
- }
-
- private Rect HorizontalThumbRect()
- {
- float num = this.ValuesPerPixel();
- Rect result;
- if (this.start < this.end)
- {
- result = new Rect((this.ClampedCurrentValue() - this.start) * num + this.position.x + (float)this.slider.padding.left, this.position.y + (float)this.slider.padding.top, this.size * num + this.ThumbSize(), this.position.height - (float)this.slider.padding.vertical);
- }
- else
- {
- result = new Rect((this.ClampedCurrentValue() + this.size - this.start) * num + this.position.x + (float)this.slider.padding.left, this.position.y, this.size * -num + this.ThumbSize(), this.position.height);
- }
- return result;
- }
-
- private float ClampedCurrentValue()
- {
- return this.Clamp(this.currentValue);
- }
-
- private float MousePosition()
- {
- float result;
- if (this.horiz)
- {
- result = this.CurrentEvent().mousePosition.x - this.position.x;
- }
- else
- {
- result = this.CurrentEvent().mousePosition.y - this.position.y;
- }
- return result;
- }
-
- private float ValuesPerPixel()
- {
- float result;
- if (this.horiz)
- {
- result = (this.position.width - (float)this.slider.padding.horizontal - this.ThumbSize()) / (this.end - this.start);
- }
- else
- {
- result = (this.position.height - (float)this.slider.padding.vertical - this.ThumbSize()) / (this.end - this.start);
- }
- return result;
- }
-
- private float ThumbSize()
- {
- float result;
- if (this.horiz)
- {
- result = ((this.thumb.fixedWidth == 0f) ? ((float)this.thumb.padding.horizontal) : this.thumb.fixedWidth);
- }
- else
- {
- result = ((this.thumb.fixedHeight == 0f) ? ((float)this.thumb.padding.vertical) : this.thumb.fixedHeight);
- }
- return result;
- }
-
- private float MaxValue()
- {
- return Mathf.Max(this.start, this.end) - this.size;
- }
-
- private float MinValue()
- {
- return Mathf.Min(this.start, this.end);
- }
-
- }
-}
-#endif
\ No newline at end of file