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

Commit 9985ed0

Browse files
committed
Update to UniverseLib 1.2, cleanups
1 parent f35232b commit 9985ed0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+312
-262
lines changed

README.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,18 @@
3535
| ------- | ------ | ---- |
3636
| ML 0.4+ |[link](https://github.com/sinai-dev/UnityExplorer/releases/latest/download/UnityExplorer.MelonLoader.Il2Cpp.zip) |[link](https://github.com/sinai-dev/UnityExplorer/releases/latest/download/UnityExplorer.MelonLoader.Mono.zip) |
3737

38-
1. Take the `UnityExplorer.ML.[version].dll` and the `UniverseLib.[version].dll` files and put them in the `Mods\` folder created by MelonLoader.
38+
1. Take the `UnityExplorer.ML.[version].dll` file and put them in the `Mods\` folder created by MelonLoader, and then put the `UniverseLib.[version].dll` file in the `UserLibs\` folder.
3939

4040
## Standalone
4141

4242
| IL2CPP | Mono |
4343
| ------ | ---- |
4444
|[link](https://github.com/sinai-dev/UnityExplorer/releases/latest/download/UnityExplorer.Standalone.Il2Cpp.zip) |[link](https://github.com/sinai-dev/UnityExplorer/releases/latest/download/UnityExplorer.Standalone.Mono.zip) |
4545

46-
The standalone release can be used with any injector or loader of your choice, but it requires you to load the dependencies manually: HarmonyX, and the IL2CPP version also requires that you set up an [Il2CppAssemblyUnhollower runtime](https://github.com/knah/Il2CppAssemblyUnhollower#required-external-setup).
46+
The standalone release can be used with any injector or loader of your choice, but it requires you to load the dependencies manually.
4747

48-
1. Load the required libs - UniverseLib, HarmonyX, and Il2CppAssemblyUnhollower if IL2CPP
48+
1. Ensure the required libs are loaded - UniverseLib, HarmonyX and MonoMod
49+
2. For IL2CPP, load Il2CppAssemblyUnhollower and start an [Il2CppAssemblyUnhollower runtime](https://github.com/knah/Il2CppAssemblyUnhollower#required-external-setup)
4950
2. Load the UnityExplorer DLL
5051
3. Create an instance of Unity Explorer with `UnityExplorer.ExplorerStandalone.CreateInstance();`
5152
4. Optionally subscribe to the `ExplorerStandalone.OnLog` event to handle logging if you wish
@@ -130,11 +131,9 @@ The inspector is used to see detailed information on objects of any type and man
130131

131132
# Building
132133

133-
For Visual Studio:
134-
135134
0. Clone the repository and run `git submodule update --init --recursive` to get the submodules.
136135
1. Open the `src\UnityExplorer.sln` project.
137-
2. Build `mcs` (Release/AnyCPU, you may need to run `nuget restore mcs.sln`), and if using IL2CPP then build `Il2CppAssemblyUnhollower` (Release/AnyCPU) as well.
136+
2. Build `mcs` (Release/AnyCPU, you may need to run `nuget restore mcs.sln`)
138137
3. Build the UnityExplorer release(s) you want to use, either by selecting the config as the Active Config, or batch-building.
139138

140139
If you fork the repository on GitHub you can build using the [dotnet workflow](https://github.com/sinai-dev/UnityExplorer/blob/master/.github/workflows/dotnet.yml):
@@ -146,7 +145,7 @@ If you fork the repository on GitHub you can build using the [dotnet workflow](h
146145
# Acknowledgments
147146

148147
* [ManlyMarco](https://github.com/ManlyMarco) for [Runtime Unity Editor](https://github.com/ManlyMarco/RuntimeUnityEditor) \[[license](THIRDPARTY_LICENSES.md#runtimeunityeditor-license)\], the ScriptEvaluator from RUE's REPL console was used as the base for UnityExplorer's C# console.
149-
* [denikson](https://github.com/denikson) (aka Horse) for [mcs-unity](https://github.com/denikson/mcs-unity) \[no license\], used as the `Mono.CSharp` reference for the C# Console.
148+
* [Geoffrey Horsington](https://github.com/ghorsington) for [mcs-unity](https://github.com/sinai-dev/mcs-unity) \[no license\], used as the `Mono.CSharp` reference for the C# Console.
150149

151150
### Disclaimer
152151

src/CSConsole/CSAutoCompleter.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
using UnityExplorer.UI.Widgets.AutoComplete;
99
using UniverseLib;
1010
using UniverseLib.UI;
11+
using UniverseLib.UI.Models;
12+
using UniverseLib.Utility;
1113

1214
namespace UnityExplorer.CSConsole
1315
{
@@ -25,7 +27,7 @@ public void OnSuggestionClicked(Suggestion suggestion)
2527
AutoCompleteModal.Instance.ReleaseOwnership(this);
2628
}
2729

28-
private readonly HashSet<char> delimiters = new HashSet<char>
30+
private readonly HashSet<char> delimiters = new()
2931
{
3032
'{', '}', ',', ';', '<', '>', '(', ')', '[', ']', '=', '|', '&', '?'
3133
};

src/CSConsole/ConsoleController.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
using UnityExplorer.UI.Widgets.AutoComplete;
1717
using UniverseLib.UI;
1818
using UniverseLib;
19+
using UniverseLib.UI.Models;
20+
using UniverseLib.Utility;
1921

2022
namespace UnityExplorer.CSConsole
2123
{
@@ -357,7 +359,7 @@ private static void UpdateCaret(out bool caretMoved)
357359
var charTop = charInfo.cursorPos.y;
358360
var charBot = charTop - CSCONSOLE_LINEHEIGHT;
359361

360-
var viewportMin = Input.Rect.rect.height - Input.Rect.anchoredPosition.y - (Input.Rect.rect.height * 0.5f);
362+
var viewportMin = Input.Transform.rect.height - Input.Transform.anchoredPosition.y - (Input.Transform.rect.height * 0.5f);
361363
var viewportMax = viewportMin - Panel.InputScroller.ViewportRect.rect.height;
362364

363365
float diff = 0f;
@@ -368,7 +370,7 @@ private static void UpdateCaret(out bool caretMoved)
368370

369371
if (Math.Abs(diff) > 1)
370372
{
371-
var rect = Input.Rect;
373+
var rect = Input.Transform;
372374
rect.anchoredPosition = new Vector2(rect.anchoredPosition.x, rect.anchoredPosition.y - diff);
373375
}
374376
}
@@ -378,7 +380,7 @@ private static void SetCaretPosition(int caretPosition)
378380
{
379381
settingCaretCoroutine = true;
380382
Input.Component.readOnly = true;
381-
RuntimeProvider.Instance.StartCoroutine(SetCaretCoroutine(caretPosition));
383+
RuntimeHelper.StartCoroutine(SetCaretCoroutine(caretPosition));
382384
}
383385

384386
internal static PropertyInfo SelectionGuardProperty => selectionGuardPropInfo ?? GetSelectionGuardPropInfo();
@@ -438,7 +440,7 @@ private static bool HighlightVisibleInput()
438440

439441
// the top and bottom position of the viewport in relation to the text height
440442
// they need the half-height adjustment to normalize against the 'line.topY' value.
441-
var viewportMin = Input.Rect.rect.height - Input.Rect.anchoredPosition.y - (Input.Rect.rect.height * 0.5f);
443+
var viewportMin = Input.Transform.rect.height - Input.Transform.anchoredPosition.y - (Input.Transform.rect.height * 0.5f);
442444
var viewportMax = viewportMin - Panel.InputScroller.ViewportRect.rect.height;
443445

444446
for (int i = 0; i < Input.TextGenerator.lineCount; i++)

src/CSConsole/LexerBuilder.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
using UnityEngine.UI;
88
using UnityExplorer.CSConsole.Lexers;
99
using UniverseLib;
10+
using UniverseLib.Utility;
1011

1112
namespace UnityExplorer.CSConsole
1213
{

src/CSConsole/Lexers/Lexer.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using System.Linq;
33
using UnityEngine;
44
using UniverseLib;
5+
using UniverseLib.Utility;
56

67
namespace UnityExplorer.CSConsole.Lexers
78
{

src/CSConsole/ScriptInteraction.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using Mono.CSharp;
1+
using HarmonyLib;
2+
using Mono.CSharp;
23
using System;
34
using System.Collections;
45
using System.Collections.Generic;
@@ -29,7 +30,7 @@ public static void Inspect(Type type)
2930
=> InspectorManager.Inspect(type);
3031

3132
public static void Start(IEnumerator ienumerator)
32-
=> RuntimeProvider.Instance.StartCoroutine(ienumerator);
33+
=> RuntimeHelper.StartCoroutine(ienumerator);
3334

3435
public static void Copy(object obj)
3536
=> ClipboardPanel.Copy(obj);
@@ -51,7 +52,7 @@ public static void GetVars()
5152

5253
public static void GetClasses()
5354
{
54-
if (ReflectionUtility.GetFieldInfo(typeof(Evaluator), "source_file")
55+
if (AccessTools.Field(typeof(Evaluator), "source_file")
5556
.GetValue(Evaluator) is CompilationSourceFile sourceFile
5657
&& sourceFile.Containers.Any())
5758
{

src/CacheObject/CacheKeyValuePair.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using UnityExplorer.CacheObject.IValues;
66
using UnityExplorer.CacheObject.Views;
77
using UniverseLib;
8+
using UniverseLib.Utility;
89

910
namespace UnityExplorer.CacheObject
1011
{

src/CacheObject/CacheMember.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
using UniverseLib;
1313
using UniverseLib.UI;
1414
using UnityExplorer.UI.Widgets;
15+
using UniverseLib.Utility;
16+
using UniverseLib.UI.ObjectPool;
1517

1618
namespace UnityExplorer.CacheObject
1719
{
@@ -111,14 +113,14 @@ protected override bool TryAutoEvaluateIfUnitialized(CacheObjectCell objectcell)
111113
{
112114
cell.EvaluateButton.ButtonText.text = "Hide";
113115
Evaluator.UIRoot.transform.SetParent(cell.EvaluateHolder.transform, false);
114-
RuntimeProvider.Instance.SetColorBlock(cell.EvaluateButton.Component, evalEnabledColor, evalEnabledColor * 1.3f);
116+
RuntimeHelper.SetColorBlock(cell.EvaluateButton.Component, evalEnabledColor, evalEnabledColor * 1.3f);
115117
}
116118
}
117119
else
118120
cell.EvaluateButton.ButtonText.text = "Evaluate";
119121

120122
if (!Evaluating)
121-
RuntimeProvider.Instance.SetColorBlock(cell.EvaluateButton.Component, evalDisabledColor, evalDisabledColor * 1.3f);
123+
RuntimeHelper.SetColorBlock(cell.EvaluateButton.Component, evalDisabledColor, evalDisabledColor * 1.3f);
122124
}
123125

124126
if (State == ValueState.NotEvaluated && !ShouldAutoEvaluate)
@@ -235,7 +237,7 @@ private static void TryCacheMember(MemberInfo member, List<CacheMember> list, Ha
235237
{
236238
try
237239
{
238-
if (RuntimeHelper.IsBlacklisted(member))
240+
if (UERuntimeHelper.IsBlacklisted(member))
239241
return;
240242

241243
var sig = GetSig(member);

src/CacheObject/CacheMethod.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using System.Text;
66
using UnityExplorer.Inspectors;
77
using UniverseLib;
8+
using UniverseLib.Utility;
89

910
namespace UnityExplorer.CacheObject
1011
{

src/CacheObject/CacheObjectBase.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
using UnityExplorer.UI;
1414
using UniverseLib;
1515
using UniverseLib.UI;
16+
using UniverseLib.Utility;
17+
using UniverseLib.UI.ObjectPool;
1618

1719
namespace UnityExplorer.CacheObject
1820
{

0 commit comments

Comments
 (0)