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

Commit b550356

Browse files
committed
1.8.0, merging Mono and Il2Cpp builds, adding BepInEx support
* Project renamed to Explorer to reflect the new scope * Merged Mono and Il2Cpp builds * Merged BepInEx and MelonLoader builds * Some minor changes to accommodate for this * The release DLL and the config file now use "Explorer" in place of "CppExplorer" for file and folder names
1 parent 8c6202c commit b550356

Some content is hidden

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

47 files changed

+1226
-519
lines changed

README.md

Lines changed: 43 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,20 @@
1-
# CppExplorer [![Version](https://img.shields.io/badge/MelonLoader-0.2.7.1-green.svg)](https://github.com/HerpDerpinstine/MelonLoader)
1+
# Explorer [![Version](https://img.shields.io/badge/MelonLoader-0.2.7.1-green.svg)](https://github.com/HerpDerpinstine/MelonLoader) [![Version](https://img.shields.io/badge/BepInEx-5.3.0.svg)](https://github.com/BepInEx/BepInEx)
22

33
<p align="center">
44
<img align="center" src="icon.png">
55
</p>
66

77
<p align="center">
8-
An in-game explorer and a suite of debugging tools for <a href="https://docs.unity3d.com/Manual/IL2CPP.html">IL2CPP</a> Unity games, using <a href="https://github.com/HerpDerpinstine/MelonLoader">MelonLoader</a>.<br><br>
8+
An in-game explorer and a suite of debugging tools for <a href="https://docs.unity3d.com/Manual/IL2CPP.html">IL2CPP</a> and <b>Mono</b> Unity games, using <a href="https://github.com/HerpDerpinstine/MelonLoader">MelonLoader</a> and <a href="https://github.com/BepInEx/BepInEx">BepInEx</a>.<br><br>
99

1010
<a href="../../releases/latest">
11-
<img src="https://img.shields.io/github/release/sinai-dev/CppExplorer.svg" />
11+
<img src="https://img.shields.io/github/release/sinai-dev/Explorer.svg" />
1212
</a>
1313

14-
<img src="https://img.shields.io/github/downloads/sinai-dev/CppExplorer/total.svg" />
15-
</p>
16-
<p align="center">
17-
<a href="https://github.com/sinai-dev/MonoExplorer">Looking for a Mono version?</a>
14+
<img src="https://img.shields.io/github/downloads/sinai-dev/Explorer/total.svg" />
1815
</p>
1916

20-
- [Known issues](#known-issues)
17+
- [Current status](#current-status)
2118
- [How to install](#how-to-install)
2219
- [How to use](#how-to-use)
2320
- [Mod Config](#mod-config)
@@ -26,21 +23,34 @@
2623
- [Building](#building)
2724
- [Credits](#credits)
2825

29-
## Known issues
30-
As of version 1.7+, CppExplorer has reached a fairly stable state for most Il2Cpp games.
26+
## Current status
27+
28+
| Mod Loader | Il2Cpp | Mono |
29+
| ----------- | ------ | ---- |
30+
| MelonLoader |||
31+
| BepInEx | <b>?</b> (WIP) ||
3132

33+
<B>IL2CPP Issues:</b>
3234
* .NET 3.5 is not currently supported (Unity 5.6.1 and older), this might change in the future.
3335
* Some methods may still fail with a `MissingMethodException`, please let me know if you experience this (with full MelonLoader log please).
3436
* Reflection may fail with certain types, see [here](https://github.com/knah/Il2CppAssemblyUnhollower#known-issues) for more details.
35-
* Scrolling with mouse wheel in the CppExplorer menu may not work on all games at the moment.
37+
* Scrolling with mouse wheel in the Explorer menu may not work on all games at the moment.
3638

3739
## How to install
3840

41+
### MelonLoader
3942
Requires [MelonLoader](https://github.com/HerpDerpinstine/MelonLoader) to be installed for your game.
4043

41-
1. Download <b>CppExplorer.zip</b> from [Releases](https://github.com/sinai-dev/CppExplorer/releases).
44+
1. Download the relevant <b>Explorer_MelonLoader_.zip</b> from [Releases](https://github.com/sinai-dev/Explorer/releases).
4245
2. Unzip the file into the `Mods` folder in your game's installation directory, created by MelonLoader.
43-
3. Make sure it's not in a sub-folder, `CppExplorer.dll` and `mcs.dll` should be directly in the `Mods\` folder.
46+
3. Make sure it's not in a sub-folder, `Explorer.dll` and `mcs.dll` should be directly in the `Mods\` folder.
47+
48+
### BepInEx
49+
Requires [BepInEx](https://github.com/BepInEx/BepInEx) to be installed for your game.
50+
51+
1. Download the relevant <b>Explorer_BepInEx_.zip</b> from [Releases](https://github.com/sinai-dev/Explorer/releases).
52+
2. Unzip the file into the `BepInEx\plugins\` folder in your game's installation directory, created by MelonLoader.
53+
3. Make sure it's not in a sub-folder, `Explorer.dll` and `mcs.dll` should be directly in the `plugins\` folder.
4454

4555
## How to use
4656

@@ -50,24 +60,24 @@ Requires [MelonLoader](https://github.com/HerpDerpinstine/MelonLoader) to be ins
5060

5161
### Mod Config
5262

53-
There is a simple Mod Config for the CppExplorer, which is generated the first time you run it.
63+
There is a simple Mod Config for the Explorer, which is generated the first time you run it.
5464

55-
This config is generated to `Mods\CppExplorer\config.xml`. Edit the config while the game is closed if you wish to change it.
65+
This config is generated to `[Game_Directory]\Mods\Explorer\config.xml`. Edit the config while the game is closed if you wish to change it.
5666

5767
`Main_Menu_Toggle` (KeyCode)
58-
* Sets the keybinding for the Main Menu toggle (show/hide all CppExplorer windows)
68+
* Sets the keybinding for the Main Menu toggle (show/hide all Explorer windows)
5969
* See [this article](https://docs.unity3d.com/ScriptReference/KeyCode.html) for a full list of all accepted KeyCodes.
6070
* Default: `F7`
6171

6272
`Default_Window_Size` (Vector2)
63-
* Sets the default width and height for all CppExplorer windows when created.
73+
* Sets the default width and height for all Explorer windows when created.
6474
* `x` is width, `y` is height.
6575
* Default: `<x>550</x> <y>700</y>`
6676

6777
## Features
68-
[![](overview.png)](https://raw.githubusercontent.com/sinai-dev/CppExplorer/master/overview.png)
78+
[![](overview.png)](https://raw.githubusercontent.com/sinai-dev/Explorer/master/overview.png)
6979

70-
<i>An overview of the different CppExplorer menus.</i>
80+
<i>An overview of the different Explorer menus.</i>
7181

7282
### Scene Explorer
7383

@@ -76,7 +86,7 @@ This config is generated to `Mods\CppExplorer\config.xml`. Edit the config while
7686

7787
### Inspectors
7888

79-
CppExplorer has two main inspector modes: <b>GameObject Inspector</b>, and <b>Reflection Inspector</b>.
89+
Explorer has two main inspector modes: <b>GameObject Inspector</b>, and <b>Reflection Inspector</b>.
8090

8191
<b>Tips:</b>
8292
* When in Tab View, GameObjects are denoted by a [G] prefix, and Reflection objects are denoted by a [R] prefix.
@@ -105,13 +115,13 @@ CppExplorer has two main inspector modes: <b>GameObject Inspector</b>, and <b>Re
105115

106116
### Inspect-under-mouse
107117

108-
* Press Shift+RMB (Right Mouse Button) while the CppExplorer menu is open to begin Inspect-Under-Mouse.
118+
* Press Shift+RMB (Right Mouse Button) while the Explorer menu is open to begin Inspect-Under-Mouse.
109119
* Hover over your desired object, if you see the name appear then you can click on it to inspect it.
110120
* Only objects with Colliders are supported.
111121

112122
### Mouse Control
113123

114-
CppExplorer can force the mouse to be visible and unlocked when the menu is open, if you have enabled "Force Unlock Mouse" (Left-Alt toggle). However, you may also want to prevent the mouse clicking-through onto the game behind CppExplorer, this is possible but it requires specific patches for that game.
124+
Explorer can force the mouse to be visible and unlocked when the menu is open, if you have enabled "Force Unlock Mouse" (Left-Alt toggle). However, you may also want to prevent the mouse clicking-through onto the game behind Explorer, this is possible but it requires specific patches for that game.
115125

116126
* For VRChat, use [VRCExplorerMouseControl](https://github.com/sinai-dev/VRCExplorerMouseControl)
117127
* For Hellpoint, use [HPExplorerMouseControl](https://github.com/sinai-dev/Hellpoint-Mods/tree/master/HPExplorerMouseControl/HPExplorerMouseControl)
@@ -125,12 +135,12 @@ using Harmony;
125135
[HarmonyPatch(typeof(MyGame.MenuClass), nameof(MyGame.MenuClass.CursorUpdate)]
126136
public class MenuClass_CursorUpdate
127137
{
128-
[HarmonyPrefix]
129-
public static bool Prefix()
130-
{
131-
// prevent method running if menu open, let it run if not.
132-
return !CppExplorer.ShowMenu;
133-
}
138+
[HarmonyPrefix]
139+
public static bool Prefix()
140+
{
141+
// prevent method running if menu open, let it run if not.
142+
return !ExplorerCore.ShowMenu;
143+
}
134144
}
135145
```
136146

@@ -139,11 +149,11 @@ public class MenuClass_CursorUpdate
139149
If you'd like to build this yourself, everything you need (other than MelonLoader) is included with this repository, there is no need for recursive cloning etc.
140150

141151
1. Install MelonLoader for your game.
142-
2. Open the `src\CppExplorer.csproj` file in a text editor.
143-
3. Scroll down until you see the `<ItemGroup>` containing the References.
144-
4. Fix all of the paths in the `..\Steam\` directory for your game (use the full path if you need to).
145-
5. Open the `src\CppExplorer.sln` project and build it.
146-
6. The dll is built to the `Release\` folder in the root of the repository.
152+
2. Open the `src\Explorer.csproj` file in a text editor.
153+
3. Set the relevant `GameFolder` value(s) for the version(s) you want to build, eg. set `MLCppGameFolder` if you want to build for a MelonLoader Il2Cpp game.
154+
4. Open the `src\Explorer.sln` project.
155+
5. Select `Solution 'Explorer' (1 of 1 project)` in the Solution Explorer panel, and set the <b>Active config</b> to the version you want to build, then build it.
156+
5. The DLLs are built to the `Release\` folder in the root of the repository.
147157

148158
## Credits
149159

icon.png

-1.93 KB
Loading

lib/UnityEngine.dll

1.37 MB
Binary file not shown.

overview.png

-44.5 KB
Loading

src/CachedObjects/CacheObjectBase.cs

Lines changed: 28 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
using System.Collections.Generic;
33
using System.Linq;
44
using System.Reflection;
5-
using MelonLoader;
65
using UnityEngine;
76

87
namespace Explorer
@@ -272,13 +271,13 @@ public object[] ParseArguments()
272271
}
273272
catch
274273
{
275-
MelonLogger.Log($"Argument #{i} '{m_arguments[i].Name}' ({type.Name}), could not parse input '{input}'.");
274+
ExplorerCore.Log($"Argument #{i} '{m_arguments[i].Name}' ({type.Name}), could not parse input '{input}'.");
276275
}
277276
}
278277
}
279278

280279
// Didn't use input, see if there is a default value.
281-
if (m_arguments[i].HasDefaultValue)
280+
if (HasDefaultValue(m_arguments[i]))
282281
{
283282
parsedArgs.Add(m_arguments[i].DefaultValue);
284283
continue;
@@ -291,6 +290,16 @@ public object[] ParseArguments()
291290
return parsedArgs.ToArray();
292291
}
293292

293+
public static bool HasDefaultValue(ParameterInfo arg)
294+
{
295+
return
296+
#if NET35
297+
arg.DefaultValue != null; // rip null default args in NET35
298+
#else
299+
arg.HasDefaultValue;
300+
#endif
301+
}
302+
294303
public virtual void UpdateValue()
295304
{
296305
if (MemInfo == null)
@@ -348,13 +357,13 @@ public void SetValue()
348357
}
349358
else
350359
{
351-
pi.SetValue(pi.GetAccessors()[0].IsStatic ? null : DeclaringInstance, Value);
360+
pi.SetValue(pi.GetAccessors()[0].IsStatic ? null : DeclaringInstance, Value, null);
352361
}
353362
}
354363
}
355364
catch (Exception e)
356365
{
357-
MelonLogger.LogWarning($"Error setting value: {e.GetType()}, {e.Message}");
366+
ExplorerCore.LogWarning($"Error setting value: {e.GetType()}, {e.Message}");
358367
}
359368
}
360369

@@ -391,13 +400,13 @@ public void Draw(Rect window, float labelWidth = 215f)
391400

392401
if (HasParameters)
393402
{
394-
GUILayout.BeginVertical(null);
403+
GUILayout.BeginVertical(new GUILayoutOption[0]);
395404

396405
if (m_isEvaluating)
397406
{
398407
if (cm != null && cm.GenericArgs.Length > 0)
399408
{
400-
GUILayout.Label($"<b><color=orange>Generic Arguments:</color></b>", null);
409+
GUILayout.Label($"<b><color=orange>Generic Arguments:</color></b>", new GUILayoutOption[0]);
401410

402411
for (int i = 0; i < cm.GenericArgs.Length; i++)
403412
{
@@ -424,21 +433,21 @@ public void Draw(Rect window, float labelWidth = 215f)
424433
}
425434
var input = cm.GenericArgInput[i];
426435

427-
GUILayout.BeginHorizontal(null);
436+
GUILayout.BeginHorizontal(new GUILayoutOption[0]);
428437

429438
GUI.skin.label.alignment = TextAnchor.MiddleCenter;
430439
GUILayout.Label($"<color={UIStyles.Syntax.StructGreen}>{cm.GenericArgs[i].Name}</color>", new GUILayoutOption[] { GUILayout.Width(15) });
431440
cm.GenericArgInput[i] = GUILayout.TextField(input, new GUILayoutOption[] { GUILayout.Width(150) });
432441
GUI.skin.label.alignment = TextAnchor.MiddleLeft;
433-
GUILayout.Label(types, null);
442+
GUILayout.Label(types, new GUILayoutOption[0]);
434443

435444
GUILayout.EndHorizontal();
436445
}
437446
}
438447

439448
if (m_arguments.Length > 0)
440449
{
441-
GUILayout.Label($"<b><color=orange>Arguments:</color></b>", null);
450+
GUILayout.Label($"<b><color=orange>Arguments:</color></b>", new GUILayoutOption[0]);
442451
for (int i = 0; i < m_arguments.Length; i++)
443452
{
444453
var name = m_arguments[i].Name;
@@ -447,24 +456,24 @@ public void Draw(Rect window, float labelWidth = 215f)
447456

448457
var label = $"<color={UIStyles.Syntax.Class_Instance}>{type}</color> ";
449458
label += $"<color={UIStyles.Syntax.Local}>{name}</color>";
450-
if (m_arguments[i].HasDefaultValue)
459+
if (HasDefaultValue(m_arguments[i]))
451460
{
452461
label = $"<i>[{label} = {m_arguments[i].DefaultValue ?? "null"}]</i>";
453462
}
454463

455-
GUILayout.BeginHorizontal(null);
464+
GUILayout.BeginHorizontal(new GUILayoutOption[0]);
456465

457466
GUI.skin.label.alignment = TextAnchor.MiddleCenter;
458467
GUILayout.Label(i.ToString(), new GUILayoutOption[] { GUILayout.Width(15) });
459468
m_argumentInput[i] = GUILayout.TextField(input, new GUILayoutOption[] { GUILayout.Width(150) });
460469
GUI.skin.label.alignment = TextAnchor.MiddleLeft;
461-
GUILayout.Label(label, null);
470+
GUILayout.Label(label, new GUILayoutOption[0]);
462471

463472
GUILayout.EndHorizontal();
464473
}
465474
}
466475

467-
GUILayout.BeginHorizontal(null);
476+
GUILayout.BeginHorizontal(new GUILayoutOption[0]);
468477
if (GUILayout.Button(EVALUATE_LABEL, new GUILayoutOption[] { GUILayout.Width(70) }))
469478
{
470479
if (cm != null)
@@ -499,7 +508,7 @@ public void Draw(Rect window, float labelWidth = 215f)
499508

500509
// new line and space
501510
GUILayout.EndHorizontal();
502-
GUILayout.BeginHorizontal(null);
511+
GUILayout.BeginHorizontal(new GUILayoutOption[0]);
503512
GUIUnstrip.Space(labelWidth);
504513
}
505514
else if (cm != null)
@@ -513,23 +522,23 @@ public void Draw(Rect window, float labelWidth = 215f)
513522

514523
// new line and space
515524
GUILayout.EndHorizontal();
516-
GUILayout.BeginHorizontal(null);
525+
GUILayout.BeginHorizontal(new GUILayoutOption[0]);
517526
GUIUnstrip.Space(labelWidth);
518527
}
519528

520529
string typeName = $"<color={UIStyles.Syntax.Class_Instance}>{ValueType.FullName}</color>";
521530

522531
if (!string.IsNullOrEmpty(ReflectionException))
523532
{
524-
GUILayout.Label("<color=red>Reflection failed!</color> (" + ReflectionException + ")", null);
533+
GUILayout.Label("<color=red>Reflection failed!</color> (" + ReflectionException + ")", new GUILayoutOption[0]);
525534
}
526535
else if ((HasParameters || this is CacheMethod) && !m_evaluated)
527536
{
528-
GUILayout.Label($"<color=grey><i>Not yet evaluated</i></color> ({typeName})", null);
537+
GUILayout.Label($"<color=grey><i>Not yet evaluated</i></color> ({typeName})", new GUILayoutOption[0]);
529538
}
530539
else if (Value == null && !(this is CacheMethod))
531540
{
532-
GUILayout.Label($"<i>null ({typeName})</i>", null);
541+
GUILayout.Label($"<i>null ({typeName})</i>", new GUILayoutOption[0]);
533542
}
534543
else
535544
{

0 commit comments

Comments
 (0)