various header files added/updated

- Created a header file called players. added a helper function to get the gameobject of all players, the gameobject of the local player and the NolanBehaviour component
- Added UnityCore file to make it easier for us to use unity functions
- Misc file fully updated
- Added Wrapper class to make it easier to use il2cpp functions
- ClientHelper updated
- color.hpp library was included in the project to make the console colorful
This commit is contained in:
Jadis0x
2024-05-16 21:37:01 +03:00
parent 17df650819
commit f69767f794
13 changed files with 1593 additions and 292 deletions

44
lib/UnityCore.h Normal file
View File

@@ -0,0 +1,44 @@
#pragma once
#include "Wrapper.h"
#include <vector>
namespace Unity {
namespace GameObject {
// DO_APP_FUNC(0x02D34DA0, Component *, GameObject_GetComponentByName, (GameObject * __this, String * type, MethodInfo * method));
app::Component* GetComponentByName(app::GameObject* go, const char* type);
}
}
namespace UnityCore {
template<typename T>
class Object {
public:
Object() = default;
static T* FindObjectOfType(const char* className, const char* classNamespace = "");
};
template<typename T>
inline T* Object<T>::FindObjectOfType(const char* className, const char* classNamespace)
{
Wrapper obj("Assembly-CSharp.dll");
Il2CppObject* object = obj.find_class(classNamespace, className).get_class();
if (object) {
if (app::Object_1_FindObjectOfType == nullptr) return nullptr;
app::Object_1* obj_1 = app::Object_1_FindObjectOfType(reinterpret_cast<app::Type*>(object), nullptr);
if (obj_1) {
T* foundObject = reinterpret_cast<T*>(obj_1);
if (foundObject) {
return foundObject;
}
}
}
return nullptr;
}
}