Finished scene explorer, lots of cleanups. Inspector and Search left now.

This commit is contained in:
sinaioutlander
2020-10-28 06:39:26 +11:00
parent 7328610252
commit ff684d4d4b
64 changed files with 2376 additions and 1624 deletions

View File

@ -1,18 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;
using UnityEngine;
namespace Explorer.Unstrip.ColorUtility
namespace ExplorerBeta.Unstrip.ColorUtility
{
public static class ColorUtilityUnstrip
{
public static string ToHex(this Color color)
{
var r = (byte)Mathf.Clamp(Mathf.RoundToInt(color.r * 255f), 0, 255);
var g = (byte)Mathf.Clamp(Mathf.RoundToInt(color.g * 255f), 0, 255);
var b = (byte)Mathf.Clamp(Mathf.RoundToInt(color.b * 255f), 0, 255);
byte r = (byte)Mathf.Clamp(Mathf.RoundToInt(color.r * 255f), 0, 255);
byte g = (byte)Mathf.Clamp(Mathf.RoundToInt(color.g * 255f), 0, 255);
byte b = (byte)Mathf.Clamp(Mathf.RoundToInt(color.b * 255f), 0, 255);
return $"{r:X2}{g:X2}{b:X2}";
}

View File

@ -1,15 +1,9 @@
#if CPP
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnhollowerBaseLib;
using UnityEngine;
using System.IO;
using ExplorerBeta.Helpers;
using System.Runtime.InteropServices;
using Unity.Collections;
using Unity.Collections.LowLevel.Unsafe;
using UnhollowerBaseLib;
using UnityEngine;
namespace ExplorerBeta.Unstrip.ImageConversion
{
@ -21,7 +15,7 @@ namespace ExplorerBeta.Unstrip.ImageConversion
public static byte[] EncodeToPNG(this Texture2D tex)
{
var data = ICallHelper.GetICall<d_EncodeToPNG>("UnityEngine.ImageConversion::EncodeToPNG")
byte[] data = ICallHelper.GetICall<d_EncodeToPNG>("UnityEngine.ImageConversion::EncodeToPNG")
.Invoke(tex.Pointer);
// The Il2Cpp EncodeToPNG() method does return System.Byte[],
@ -31,7 +25,7 @@ namespace ExplorerBeta.Unstrip.ImageConversion
byte[] safeData = new byte[data.Length];
for (int i = 0; i < data.Length; i++)
{
safeData[i] = (byte)data[i];
safeData[i] = (byte)data[i];
}
return safeData;
@ -43,13 +37,13 @@ namespace ExplorerBeta.Unstrip.ImageConversion
public static bool LoadImage(this Texture2D tex, byte[] data, bool markNonReadable)
{
var il2cppArray = new Il2CppStructArray<byte>(data.Length);
Il2CppStructArray<byte> il2cppArray = new Il2CppStructArray<byte>(data.Length);
for (int i = 0; i < data.Length; i++)
{
il2cppArray[i] = data[i];
}
var ret = ICallHelper.GetICall<d_LoadImage>("UnityEngine.ImageConversion::LoadImage")
bool ret = ICallHelper.GetICall<d_LoadImage>("UnityEngine.ImageConversion::LoadImage")
.Invoke(tex.Pointer, il2cppArray.Pointer, markNonReadable);
return ret;
@ -64,7 +58,7 @@ namespace ExplorerBeta.Unstrip.ImageConversion
return false;
}
var data = File.ReadAllBytes(filePath);
byte[] data = File.ReadAllBytes(filePath);
return tex.LoadImage(data, markNonReadable);
}
}

View File

@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;
using ExplorerBeta.Helpers;
#if CPP
using UnhollowerBaseLib;
@ -17,7 +13,7 @@ namespace ExplorerBeta.Unstrip.LayerMasks
public static string LayerToName(int layer)
{
var iCall = ICallHelper.GetICall<d_LayerToName>("UnityEngine.LayerMask::LayerToName");
d_LayerToName iCall = ICallHelper.GetICall<d_LayerToName>("UnityEngine.LayerMask::LayerToName");
return IL2CPP.Il2CppStringToManaged(iCall.Invoke(layer));
}
#else

View File

@ -1,9 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ExplorerBeta.Helpers;
using UnityEngine;
#if CPP
using UnhollowerBaseLib;
#endif
@ -17,12 +13,12 @@ namespace ExplorerBeta.Unstrip.Resources
public static UnityEngine.Object[] FindObjectsOfTypeAll(Il2CppSystem.Type type)
{
var arrayPtr = ICallHelper.GetICall<d_FindObjectsOfTypeAll>("UnityEngine.Resources::FindObjectsOfTypeAll")
IntPtr arrayPtr = ICallHelper.GetICall<d_FindObjectsOfTypeAll>("UnityEngine.Resources::FindObjectsOfTypeAll")
.Invoke(type.Pointer);
var array = new Il2CppReferenceArray<UnityEngine.Object>(arrayPtr);
Il2CppReferenceArray<UnityEngine.Object> array = new Il2CppReferenceArray<UnityEngine.Object>(arrayPtr);
var ret = new UnityEngine.Object[array.Length];
UnityEngine.Object[] ret = new UnityEngine.Object[array.Length];
for (int i = 0; i < array.Length; i++)
{

View File

@ -1,10 +1,6 @@
#if CPP
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ExplorerBeta.Helpers;
using UnhollowerBaseLib;
using UnityEngine;
using UnityEngine.SceneManagement;
@ -21,11 +17,13 @@ namespace ExplorerBeta.Unstrip.Scenes
public static GameObject[] GetRootGameObjects(int handle)
{
if (handle == -1)
{
return new GameObject[0];
}
var list = new Il2CppSystem.Collections.Generic.List<GameObject>(GetRootCount(handle));
Il2CppSystem.Collections.Generic.List<GameObject> list = new Il2CppSystem.Collections.Generic.List<GameObject>(GetRootCount(handle));
var iCall = ICallHelper.GetICall<d_GetRootGameObjects>("UnityEngine.SceneManagement.Scene::GetRootGameObjectsInternal");
d_GetRootGameObjects iCall = ICallHelper.GetICall<d_GetRootGameObjects>("UnityEngine.SceneManagement.Scene::GetRootGameObjectsInternal");
iCall.Invoke(handle, list.Pointer);
@ -40,7 +38,7 @@ namespace ExplorerBeta.Unstrip.Scenes
public static int GetRootCount(int handle)
{
var iCall = ICallHelper.GetICall<GetRootCountInternal_delegate>("UnityEngine.SceneManagement.Scene::GetRootCountInternal");
GetRootCountInternal_delegate iCall = ICallHelper.GetICall<GetRootCountInternal_delegate>("UnityEngine.SceneManagement.Scene::GetRootCountInternal");
return iCall.Invoke(handle);
}
}