helper functions added

- Added helper functions to facilitate Vector3 and Transform operations.
- Defined operator overloads for Vector3 (not tested).
- Added fly and spawnPrefab functions to the Misc namespace (not tested).
- Added fly speed to settings.
This commit is contained in:
Jadis0x
2024-05-19 02:43:52 +03:00
parent 0c809fc44b
commit d32b92d1e3
9 changed files with 156 additions and 7 deletions

View File

@@ -1,4 +1,4 @@
// Generated C++ file by Il2CppInspector - http://www.djkaty.com - https://github.com/djkaty // Generated C++ file by Il2CppInspector - http://www.djkaty.com - https://github.com/djkaty
// Target Unity version: 2021.2.0 - 2021.2.99 // Target Unity version: 2021.2.0 - 2021.2.99
#if defined(_GHIDRA_) || defined(_IDA_) #if defined(_GHIDRA_) || defined(_IDA_)
@@ -84572,6 +84572,18 @@ struct Vector3 {
float x; float x;
float y; float y;
float z; float z;
app::Vector3 operator+(const app::Vector3& other) const {
return { x + other.x, y + other.y, z + other.z };
}
app::Vector3 operator*(float scalar) const {
return { x * scalar, y * scalar, z * scalar };
}
app::Vector3 operator-(const app::Vector3& other) const {
return { x - other.x, y - other.y, z - other.z };
}
}; };
struct Vector3__Boxed { struct Vector3__Boxed {

View File

@@ -1,6 +1,7 @@
#include "pch-il2cpp.h" #include "pch-il2cpp.h"
#include "UnityCore.h" #include "UnityCore.h"
#include <helpers.h>
app::Component* Unity::GameObject::GetComponentByName(app::GameObject* go, const char* type) app::Component* Unity::GameObject::GetComponentByName(app::GameObject* go, const char* type)
{ {
@@ -16,3 +17,47 @@ app::Component* Unity::GameObject::GetComponentByName(app::GameObject* go, const
return nullptr; return nullptr;
} }
std::string Unity::Math::Vector3::ToString(app::Vector3* v)
{
app::String* str = app::Vector3_ToString(v, nullptr);
if (str == NULL) {
return std::string("NULL");
}
return il2cppi_to_string(str);
}
std::string Unity::Math::Vector3::ToString(app::Vector3 v)
{
return ("x: " + std::to_string(v.x) + " y: " + std::to_string(v.y) + " z: " + std::to_string(v.z));
}
app::Transform* Unity::Transform::Get(app::GameObject* go)
{
if (go != nullptr) {
if (app::GameObject_get_transform != nullptr) {
app::Transform* __transform = app::GameObject_get_transform(go, nullptr);
if (__transform) {
return __transform;
}
}
}
return nullptr;
}
app::Vector3 Unity::Transform::Position(app::Transform* transform)
{
if (transform != nullptr) {
if (app::Transform_get_position != nullptr) {
return app::Transform_get_position(transform, nullptr);
}
}
return app::Vector3();
}

View File

@@ -2,12 +2,25 @@
#include "Wrapper.h" #include "Wrapper.h"
#include <vector> #include <vector>
#include <iostream>
namespace Unity { namespace Unity {
namespace GameObject { namespace GameObject {
// DO_APP_FUNC(0x02D34DA0, Component *, GameObject_GetComponentByName, (GameObject * __this, String * type, MethodInfo * method)); // DO_APP_FUNC(0x02D34DA0, Component *, GameObject_GetComponentByName, (GameObject * __this, String * type, MethodInfo * method));
app::Component* GetComponentByName(app::GameObject* go, const char* type); app::Component* GetComponentByName(app::GameObject* go, const char* type);
} }
namespace Math{
namespace Vector3 {
std::string ToString(app::Vector3* v);
std::string ToString(app::Vector3 v);
}
}
namespace Transform{
app::Transform* Get(app::GameObject* go);
app::Vector3 Position(app::Transform* transform);
}
} }
namespace UnityCore { namespace UnityCore {

View File

@@ -277,9 +277,10 @@ void DrawMiscTab() {
/* /*
if (ImGui::Button("Unlock Achievements")) { if (ImGui::Button("Unlock Achievements")) {
//Unlock Achievements Misc::CustomizedLobby();
} }
if (ImGui::Button("TP Keys")) { if (ImGui::Button("TP Keys")) {
//Misc::TPKeys(); //Misc::TPKeys();
} }
@@ -289,13 +290,17 @@ void DrawMiscTab() {
ImGui::Checkbox("Change server name", &settings::server_name_spoof); ImGui::Checkbox("Change server name", &settings::server_name_spoof);
ImGui::InputText("New name##server", &settings::server_name); ImGui::InputText("New name##server", &settings::server_name);
*/
ImGui::Checkbox("Fly", &settings::fly); ImGui::Checkbox("Fly", &settings::fly);
ImGui::SliderFloat("Speed: ", &settings::fly_speed, 1.f, 10.f);
/*
if (ImGui::Button("Make random noise")) { if (ImGui::Button("Make random noise")) {
//Misc::PlayRandomSound(); //Misc::PlayRandomSound();
} }
ImGui::Checkbox("Walk in lobby", &settings::walk_in_lobby); ImGui::Checkbox("Walk in lobby", &settings::walk_in_lobby);
ImGui::Checkbox("Auto respawn", &settings::auto_respawn); ImGui::Checkbox("Auto respawn", &settings::auto_respawn);

View File

@@ -1,4 +1,4 @@
#include "pch-il2cpp.h" #include "pch-il2cpp.h"
#include "Misc.h" #include "Misc.h"
#include "Wrapper.h" #include "Wrapper.h"
@@ -138,9 +138,80 @@ void Misc::InstantWin()
} }
} }
// This function has not been tested
// This function has not been tested
// This function has not been tested
void Misc::Fly(float speed) {
auto localPlayer = Player::GetLocalPlayer();
if (localPlayer == nullptr) return;
auto nb = Player::GetNolan();
app::Transform* _transform = Unity::Transform::Get(localPlayer);
if (_transform) {
app::Vector3 pos = Unity::Transform::Position(_transform);
if (GetAsyncKeyState('W') & 0x8000) {
pos = pos + (app::Transform_get_forward(_transform, nullptr) * speed * Time_DeltaTime());
}
if (GetAsyncKeyState('S') & 0x8000) {
pos = pos - (app::Transform_get_forward(_transform, nullptr) * speed * Time_DeltaTime());
}
if (GetAsyncKeyState('D') & 0x8000) {
pos = pos + (app::Transform_get_right(_transform, nullptr) * speed * Time_DeltaTime());
}
if (GetAsyncKeyState('A') & 0x8000) {
pos = pos - (app::Transform_get_right(_transform, nullptr) * speed * Time_DeltaTime());
}
if (GetAsyncKeyState(VK_SPACE) & 0x8000) {
pos = pos + (app::Transform_get_up(_transform, nullptr) * speed * Time_DeltaTime());
}
if (GetAsyncKeyState(VK_LCONTROL) & 0x8000) {
pos = pos - (app::Transform_get_up(_transform, nullptr) * speed * Time_DeltaTime());
}
auto component = Unity::GameObject::GetComponentByName(localPlayer, "UltimateCharacterLocomotion");
if (component) {
app::UltimateCharacterLocomotion* locomotion = reinterpret_cast<app::UltimateCharacterLocomotion*>(component);
if (locomotion) {
if (app::UltimateCharacterLocomotion_SetPosition_1 == nullptr) return;
app::UltimateCharacterLocomotion_SetPosition_1(locomotion, pos, false, nullptr);
}
}
}
}
void Misc::CustomizedLobby() void Misc::CustomizedLobby()
{ {
}
// This function has not been tested
// This function has not been tested
// This function has not been tested
void Misc::SpawnPrefab(app::PrefabId id) {
if (il2cppi_is_initialized(app::BoltPrefabs__TypeInfo)) {
app::PrefabId pGate = (*app::BoltPrefabs__TypeInfo)->static_fields->ManorGate;
app::Quaternion rotation = app::Quaternion_get_identity(NULL);
auto localPlayer = Player::GetLocalPlayer();
if (localPlayer) {
app::Transform* _transform = Unity::Transform::Get(localPlayer);
if (_transform == nullptr) return;
app::Vector3 pos = Unity::Transform::Position(_transform);
// CRASH????????????????
app::BoltNetwork_Instantiate_6(pGate, pos, rotation, NULL);
}
}
} }
void Misc::RankSpoofer(int value) { void Misc::RankSpoofer(int value) {
@@ -182,9 +253,6 @@ void Misc::FullBright()
} }
} }
void Misc::Fly() {
}
void Misc::Revive(bool self) void Misc::Revive(bool self)
{ {

View File

@@ -9,9 +9,10 @@ namespace Misc {
void CarryItem(const char* itemName); void CarryItem(const char* itemName);
void CarryAnimal(const char* animalName); void CarryAnimal(const char* animalName);
void InstantWin(); void InstantWin();
void Fly(float speed);
void CustomizedLobby(); void CustomizedLobby();
void SpawnPrefab(app::PrefabId id);
void FullBright(); void FullBright();
void Fly();
void Revive(bool self); void Revive(bool self);
void GetKeys(); void GetKeys();
void Jumpscare(); void Jumpscare();

View File

@@ -113,6 +113,9 @@ void Run()
if (settings::fullBright) if (settings::fullBright)
Misc::FullBright(); Misc::FullBright();
if (settings::fly)
Misc::Fly(settings::fly_speed);
std::this_thread::sleep_for(std::chrono::milliseconds(400)); std::this_thread::sleep_for(std::chrono::milliseconds(400));
} }
CreateThread(0, 0, EjectThread, 0, 0, 0); CreateThread(0, 0, EjectThread, 0, 0, 0);

View File

@@ -35,6 +35,7 @@ namespace settings {
bool server_name_spoof = false; bool server_name_spoof = false;
std::string server_name = "Jadis0x"; std::string server_name = "Jadis0x";
bool fly = false; bool fly = false;
float fly_speed = 1.f;
bool unlock_all = true; bool unlock_all = true;
bool exp_modifier = false; bool exp_modifier = false;
int new_exp = 2000; int new_exp = 2000;

View File

@@ -39,6 +39,7 @@ namespace settings {
extern bool server_name_spoof; extern bool server_name_spoof;
extern std::string server_name; extern std::string server_name;
extern bool fly; extern bool fly;
extern float fly_speed;
extern bool unlock_all; extern bool unlock_all;
extern bool exp_modifier; extern bool exp_modifier;
extern int new_exp; extern int new_exp;