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

Commit 9836566

Browse files
committed
tidy up
1 parent d20461f commit 9836566

File tree

5 files changed

+6
-58
lines changed

5 files changed

+6
-58
lines changed

src/CppExplorer.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,17 +129,17 @@
129129
<Compile Include="CachedObjects\CacheMethod.cs" />
130130
<Compile Include="CppExplorer.cs" />
131131
<Compile Include="Extensions\ReflectionExtensions.cs" />
132-
<Compile Include="Unstripping\GUIUnstrip.cs" />
133-
<Compile Include="Unstripping\ScrollViewStateUnstrip.cs" />
132+
<Compile Include="UnstripFixes\GUIUnstrip.cs" />
133+
<Compile Include="UnstripFixes\ScrollViewStateUnstrip.cs" />
134134
<Compile Include="Extensions\UnityExtensions.cs" />
135135
<Compile Include="Helpers\PageHelper.cs" />
136136
<Compile Include="Helpers\ReflectionHelpers.cs" />
137137
<Compile Include="Helpers\UIHelpers.cs" />
138138
<Compile Include="Helpers\UnityHelpers.cs" />
139139
<Compile Include="MainMenu\InspectUnderMouse.cs" />
140140
<Compile Include="CachedObjects\CacheObjectBase.cs" />
141-
<Compile Include="Unstripping\SliderHandlerUnstrip.cs" />
142-
<Compile Include="Unstripping\UnstripExtensions.cs" />
141+
<Compile Include="UnstripFixes\SliderHandlerUnstrip.cs" />
142+
<Compile Include="UnstripFixes\UnstripExtensions.cs" />
143143
<Compile Include="Windows\ResizeDrag.cs" />
144144
<Compile Include="Windows\TabViewWindow.cs" />
145145
<Compile Include="Windows\UIWindow.cs" />

src/Unstripping/GUIUnstrip.cs renamed to src/UnstripFixes/GUIUnstrip.cs

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,6 @@
1313

1414
namespace Explorer
1515
{
16-
// This is a copy+paste of UnityEngine source code, fixed for Il2Cpp.
17-
// Taken from dnSpy output using Unity 2018.4.20.
18-
19-
// Subject to Unity's License and ToS.
20-
// https://unity3d.com/legal/terms-of-service
21-
// https://unity3d.com/legal/terms-of-service/software
22-
2316
public class GUIUnstrip
2417
{
2518
public static int s_ScrollControlId;
@@ -41,9 +34,6 @@ private static GenericStack ScrollStack
4134

4235
// ======= public methods ======= //
4336

44-
// Fix for GUILayoutUtility.GetLastRect().
45-
// Calls UnstripExtensions.GetLastUnstripped().
46-
4737
public static Rect GetLastRect()
4838
{
4939
EventType type = Event.current.type;
@@ -59,8 +49,6 @@ public static Rect GetLastRect()
5949
return last;
6050
}
6151

62-
// Simple unstrips for HorizontalScrollbar and VerticalScrollbar, they just call the Scroller unstrip.
63-
6452
public static float HorizontalScrollbar(Rect position, float value, float size, float leftValue, float rightValue, GUIStyle style)
6553
{
6654
return Scroller_Impl(position, value, size, leftValue, rightValue, style,
@@ -80,7 +68,6 @@ public static float VerticalScrollbar(Rect position, float value, float size, fl
8068
}
8169

8270
// Fix for BeginScrollView.
83-
// Uses several manually unstripped methods.
8471

8572
public static Vector2 BeginScrollView(Vector2 scroll, params GUILayoutOption[] options)
8673
{
@@ -98,7 +85,7 @@ public static Vector2 BeginScrollView(Vector2 scroll, params GUILayoutOption[] o
9885
}
9986
}
10087

101-
// Try manual unstripping implementation.
88+
// Try manual implementation.
10289
if (!ManualUnstripFailed)
10390
{
10491
try
@@ -107,7 +94,7 @@ public static Vector2 BeginScrollView(Vector2 scroll, params GUILayoutOption[] o
10794
}
10895
catch (Exception e)
10996
{
110-
MelonLogger.Log("Exception on GUIUnstrip.BeginScrollView_Impl: " + e.GetType() + ", " + e.Message + "\r\n" + e.StackTrace);
97+
MelonLogger.Log("Exception on GUIUnstrip.BeginScrollView_ImplLayout: " + e.GetType() + ", " + e.Message + "\r\n" + e.StackTrace);
11198

11299
ManualUnstripFailed = true;
113100
return scroll;
@@ -136,8 +123,6 @@ public static void EndScrollView(bool handleScrollWheel = true)
136123

137124
// ======= private methods ======= //
138125

139-
// Actual unstrip of GUILayout.BeginScrollView()
140-
141126
private static Vector2 BeginScrollView_ImplLayout(Vector2 scrollPosition, bool alwaysShowHorizontal, bool alwaysShowVertical,
142127
GUIStyle horizontalScrollbar, GUIStyle verticalScrollbar, GUIStyle background, params GUILayoutOption[] options)
143128
{
@@ -171,8 +156,6 @@ private static Vector2 BeginScrollView_ImplLayout(Vector2 scrollPosition, bool a
171156
);
172157
}
173158

174-
// Actual unstrip of GUI.BeginScrollView()
175-
176159
private static Vector2 BeginScrollView_Impl(Rect position, Vector2 scrollPosition, Rect viewRect, bool alwaysShowHorizontal,
177160
bool alwaysShowVertical, GUIStyle horizontalScrollbar, GUIStyle verticalScrollbar, GUIStyle background)
178161
{
@@ -296,8 +279,6 @@ private static Vector2 BeginScrollView_Impl(Rect position, Vector2 scrollPositio
296279
return scrollPosition;
297280
}
298281

299-
// Actual unstrip of GUI.EndScrollView()
300-
301282
private static void EndScrollView_Impl(bool handleScrollWheel)
302283
{
303284
GUIUtility.CheckOnGUI();
@@ -336,8 +317,6 @@ private static void EndScrollView_Impl(bool handleScrollWheel)
336317
}
337318
}
338319

339-
// Actual unstrip of GUI.Scroller
340-
341320
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)
342321
{
343322
GUIUtility.CheckOnGUI();
@@ -384,8 +363,6 @@ private static float Scroller_Impl(Rect position, float value, float size, float
384363
return value;
385364
}
386365

387-
// Actual unstrip of GUI.Slider
388-
389366
public static float Slider(Rect position, float value, float size, float start, float end, GUIStyle slider, GUIStyle thumb, bool horiz, int id)
390367
{
391368
if (id == 0)
@@ -396,8 +373,6 @@ public static float Slider(Rect position, float value, float size, float start,
396373
return sliderHandler.Handle();
397374
}
398375

399-
// Actual unstrip of GUI.ScrollerRepeatButton
400-
401376
private static bool ScrollerRepeatButton_Impl(int scrollerID, Rect rect, GUIStyle style)
402377
{
403378
bool result = false;

src/Unstripping/ScrollViewStateUnstrip.cs renamed to src/UnstripFixes/ScrollViewStateUnstrip.cs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,6 @@
99

1010
namespace Explorer
1111
{
12-
// This is a copy+paste of UnityEngine source code, fixed for Il2Cpp.
13-
// Taken from dnSpy output using Unity 2018.4.20.
14-
15-
// Subject to Unity's License and ToS.
16-
// https://unity3d.com/legal/terms-of-service
17-
// https://unity3d.com/legal/terms-of-service/software
18-
1912
public class ScrollViewStateUnstrip
2013
{
2114
public Rect position;
@@ -24,9 +17,6 @@ public class ScrollViewStateUnstrip
2417
public Vector2 scrollPosition;
2518
public bool apply;
2619

27-
// The code below is not unstripped.
28-
// This is a custom dictionary to allow for the manual implementation.
29-
3020
public static Dictionary<IntPtr, ScrollViewStateUnstrip> Dict = new Dictionary<IntPtr, ScrollViewStateUnstrip>();
3121

3222
public static ScrollViewStateUnstrip FromPointer(IntPtr ptr)

src/Unstripping/SliderHandlerUnstrip.cs renamed to src/UnstripFixes/SliderHandlerUnstrip.cs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,6 @@
88

99
namespace Explorer
1010
{
11-
// This is a copy+paste of UnityEngine source code, fixed for Il2Cpp.
12-
// Taken from dnSpy output using Unity 2018.4.20.
13-
14-
// Subject to Unity's License and ToS.
15-
// https://unity3d.com/legal/terms-of-service
16-
// https://unity3d.com/legal/terms-of-service/software
17-
1811
public struct SliderHandlerUnstrip
1912
{
2013
private readonly Rect position;

src/Unstripping/UnstripExtensions.cs renamed to src/UnstripFixes/UnstripExtensions.cs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,8 @@
77

88
namespace Explorer
99
{
10-
// This is a copy+paste of UnityEngine source code, fixed for Il2Cpp.
11-
// Taken from dnSpy output using Unity 2018.4.20.
12-
13-
// Subject to Unity's License and ToS.
14-
// https://unity3d.com/legal/terms-of-service
15-
// https://unity3d.com/legal/terms-of-service/software
16-
1710
public static class UnstripExtensions
1811
{
19-
// This is a manual unstrip of GUILayoutGroup.GetLast().
20-
// I'm using it as an Extension because it's easier this way.
21-
2212
public static Rect GetLastUnstripped(this GUILayoutGroup group)
2313
{
2414
Rect result;

0 commit comments

Comments
 (0)