This commit is contained in:
sinaioutlander 2020-09-05 01:30:50 +10:00
parent d20461fa0e
commit 9836566e55
5 changed files with 6 additions and 58 deletions

View File

@ -129,8 +129,8 @@
<Compile Include="CachedObjects\CacheMethod.cs" /> <Compile Include="CachedObjects\CacheMethod.cs" />
<Compile Include="CppExplorer.cs" /> <Compile Include="CppExplorer.cs" />
<Compile Include="Extensions\ReflectionExtensions.cs" /> <Compile Include="Extensions\ReflectionExtensions.cs" />
<Compile Include="Unstripping\GUIUnstrip.cs" /> <Compile Include="UnstripFixes\GUIUnstrip.cs" />
<Compile Include="Unstripping\ScrollViewStateUnstrip.cs" /> <Compile Include="UnstripFixes\ScrollViewStateUnstrip.cs" />
<Compile Include="Extensions\UnityExtensions.cs" /> <Compile Include="Extensions\UnityExtensions.cs" />
<Compile Include="Helpers\PageHelper.cs" /> <Compile Include="Helpers\PageHelper.cs" />
<Compile Include="Helpers\ReflectionHelpers.cs" /> <Compile Include="Helpers\ReflectionHelpers.cs" />
@ -138,8 +138,8 @@
<Compile Include="Helpers\UnityHelpers.cs" /> <Compile Include="Helpers\UnityHelpers.cs" />
<Compile Include="MainMenu\InspectUnderMouse.cs" /> <Compile Include="MainMenu\InspectUnderMouse.cs" />
<Compile Include="CachedObjects\CacheObjectBase.cs" /> <Compile Include="CachedObjects\CacheObjectBase.cs" />
<Compile Include="Unstripping\SliderHandlerUnstrip.cs" /> <Compile Include="UnstripFixes\SliderHandlerUnstrip.cs" />
<Compile Include="Unstripping\UnstripExtensions.cs" /> <Compile Include="UnstripFixes\UnstripExtensions.cs" />
<Compile Include="Windows\ResizeDrag.cs" /> <Compile Include="Windows\ResizeDrag.cs" />
<Compile Include="Windows\TabViewWindow.cs" /> <Compile Include="Windows\TabViewWindow.cs" />
<Compile Include="Windows\UIWindow.cs" /> <Compile Include="Windows\UIWindow.cs" />

View File

@ -13,13 +13,6 @@ using Harmony;
namespace Explorer namespace Explorer
{ {
// This is a copy+paste of UnityEngine source code, fixed for Il2Cpp.
// Taken from dnSpy output using Unity 2018.4.20.
// Subject to Unity's License and ToS.
// https://unity3d.com/legal/terms-of-service
// https://unity3d.com/legal/terms-of-service/software
public class GUIUnstrip public class GUIUnstrip
{ {
public static int s_ScrollControlId; public static int s_ScrollControlId;
@ -41,9 +34,6 @@ namespace Explorer
// ======= public methods ======= // // ======= public methods ======= //
// Fix for GUILayoutUtility.GetLastRect().
// Calls UnstripExtensions.GetLastUnstripped().
public static Rect GetLastRect() public static Rect GetLastRect()
{ {
EventType type = Event.current.type; EventType type = Event.current.type;
@ -59,8 +49,6 @@ namespace Explorer
return last; return last;
} }
// Simple unstrips for HorizontalScrollbar and VerticalScrollbar, they just call the Scroller unstrip.
public static float HorizontalScrollbar(Rect position, float value, float size, float leftValue, float rightValue, GUIStyle style) public static float HorizontalScrollbar(Rect position, float value, float size, float leftValue, float rightValue, GUIStyle style)
{ {
return Scroller_Impl(position, value, size, leftValue, rightValue, style, return Scroller_Impl(position, value, size, leftValue, rightValue, style,
@ -80,7 +68,6 @@ namespace Explorer
} }
// Fix for BeginScrollView. // Fix for BeginScrollView.
// Uses several manually unstripped methods.
public static Vector2 BeginScrollView(Vector2 scroll, params GUILayoutOption[] options) public static Vector2 BeginScrollView(Vector2 scroll, params GUILayoutOption[] options)
{ {
@ -98,7 +85,7 @@ namespace Explorer
} }
} }
// Try manual unstripping implementation. // Try manual implementation.
if (!ManualUnstripFailed) if (!ManualUnstripFailed)
{ {
try try
@ -107,7 +94,7 @@ namespace Explorer
} }
catch (Exception e) catch (Exception e)
{ {
MelonLogger.Log("Exception on GUIUnstrip.BeginScrollView_Impl: " + e.GetType() + ", " + e.Message + "\r\n" + e.StackTrace); MelonLogger.Log("Exception on GUIUnstrip.BeginScrollView_ImplLayout: " + e.GetType() + ", " + e.Message + "\r\n" + e.StackTrace);
ManualUnstripFailed = true; ManualUnstripFailed = true;
return scroll; return scroll;
@ -136,8 +123,6 @@ namespace Explorer
// ======= private methods ======= // // ======= private methods ======= //
// Actual unstrip of GUILayout.BeginScrollView()
private static Vector2 BeginScrollView_ImplLayout(Vector2 scrollPosition, bool alwaysShowHorizontal, bool alwaysShowVertical, private static Vector2 BeginScrollView_ImplLayout(Vector2 scrollPosition, bool alwaysShowHorizontal, bool alwaysShowVertical,
GUIStyle horizontalScrollbar, GUIStyle verticalScrollbar, GUIStyle background, params GUILayoutOption[] options) GUIStyle horizontalScrollbar, GUIStyle verticalScrollbar, GUIStyle background, params GUILayoutOption[] options)
{ {
@ -171,8 +156,6 @@ namespace Explorer
); );
} }
// Actual unstrip of GUI.BeginScrollView()
private static Vector2 BeginScrollView_Impl(Rect position, Vector2 scrollPosition, Rect viewRect, bool alwaysShowHorizontal, private static Vector2 BeginScrollView_Impl(Rect position, Vector2 scrollPosition, Rect viewRect, bool alwaysShowHorizontal,
bool alwaysShowVertical, GUIStyle horizontalScrollbar, GUIStyle verticalScrollbar, GUIStyle background) bool alwaysShowVertical, GUIStyle horizontalScrollbar, GUIStyle verticalScrollbar, GUIStyle background)
{ {
@ -296,8 +279,6 @@ namespace Explorer
return scrollPosition; return scrollPosition;
} }
// Actual unstrip of GUI.EndScrollView()
private static void EndScrollView_Impl(bool handleScrollWheel) private static void EndScrollView_Impl(bool handleScrollWheel)
{ {
GUIUtility.CheckOnGUI(); GUIUtility.CheckOnGUI();
@ -336,8 +317,6 @@ namespace Explorer
} }
} }
// Actual unstrip of GUI.Scroller
private static float Scroller_Impl(Rect position, float value, float size, float leftValue, float rightValue, GUIStyle slider, GUIStyle thumb, GUIStyle leftButton, GUIStyle rightButton, bool horiz) private static float Scroller_Impl(Rect position, float value, float size, float leftValue, float rightValue, GUIStyle slider, GUIStyle thumb, GUIStyle leftButton, GUIStyle rightButton, bool horiz)
{ {
GUIUtility.CheckOnGUI(); GUIUtility.CheckOnGUI();
@ -384,8 +363,6 @@ namespace Explorer
return value; return value;
} }
// Actual unstrip of GUI.Slider
public static float Slider(Rect position, float value, float size, float start, float end, GUIStyle slider, GUIStyle thumb, bool horiz, int id) public static float Slider(Rect position, float value, float size, float start, float end, GUIStyle slider, GUIStyle thumb, bool horiz, int id)
{ {
if (id == 0) if (id == 0)
@ -396,8 +373,6 @@ namespace Explorer
return sliderHandler.Handle(); return sliderHandler.Handle();
} }
// Actual unstrip of GUI.ScrollerRepeatButton
private static bool ScrollerRepeatButton_Impl(int scrollerID, Rect rect, GUIStyle style) private static bool ScrollerRepeatButton_Impl(int scrollerID, Rect rect, GUIStyle style)
{ {
bool result = false; bool result = false;

View File

@ -9,13 +9,6 @@ using UnityEngine;
namespace Explorer namespace Explorer
{ {
// This is a copy+paste of UnityEngine source code, fixed for Il2Cpp.
// Taken from dnSpy output using Unity 2018.4.20.
// Subject to Unity's License and ToS.
// https://unity3d.com/legal/terms-of-service
// https://unity3d.com/legal/terms-of-service/software
public class ScrollViewStateUnstrip public class ScrollViewStateUnstrip
{ {
public Rect position; public Rect position;
@ -24,9 +17,6 @@ namespace Explorer
public Vector2 scrollPosition; public Vector2 scrollPosition;
public bool apply; public bool apply;
// The code below is not unstripped.
// This is a custom dictionary to allow for the manual implementation.
public static Dictionary<IntPtr, ScrollViewStateUnstrip> Dict = new Dictionary<IntPtr, ScrollViewStateUnstrip>(); public static Dictionary<IntPtr, ScrollViewStateUnstrip> Dict = new Dictionary<IntPtr, ScrollViewStateUnstrip>();
public static ScrollViewStateUnstrip FromPointer(IntPtr ptr) public static ScrollViewStateUnstrip FromPointer(IntPtr ptr)

View File

@ -8,13 +8,6 @@ using UnhollowerRuntimeLib;
namespace Explorer namespace Explorer
{ {
// This is a copy+paste of UnityEngine source code, fixed for Il2Cpp.
// Taken from dnSpy output using Unity 2018.4.20.
// Subject to Unity's License and ToS.
// https://unity3d.com/legal/terms-of-service
// https://unity3d.com/legal/terms-of-service/software
public struct SliderHandlerUnstrip public struct SliderHandlerUnstrip
{ {
private readonly Rect position; private readonly Rect position;

View File

@ -7,18 +7,8 @@ using UnityEngine;
namespace Explorer namespace Explorer
{ {
// This is a copy+paste of UnityEngine source code, fixed for Il2Cpp.
// Taken from dnSpy output using Unity 2018.4.20.
// Subject to Unity's License and ToS.
// https://unity3d.com/legal/terms-of-service
// https://unity3d.com/legal/terms-of-service/software
public static class UnstripExtensions public static class UnstripExtensions
{ {
// This is a manual unstrip of GUILayoutGroup.GetLast().
// I'm using it as an Extension because it's easier this way.
public static Rect GetLastUnstripped(this GUILayoutGroup group) public static Rect GetLastUnstripped(this GUILayoutGroup group)
{ {
Rect result; Rect result;