diff --git a/cheat-library/src/user/cheat/visuals/TextureChanger.cpp b/cheat-library/src/user/cheat/visuals/TextureChanger.cpp index 36f1c15..f400cf8 100644 --- a/cheat-library/src/user/cheat/visuals/TextureChanger.cpp +++ b/cheat-library/src/user/cheat/visuals/TextureChanger.cpp @@ -17,6 +17,7 @@ namespace cheat::feature NF(f_HeadPath, "Head", "Visuals::TextureChanger", false), NF(f_BodyPath, "Body", "Visuals::TextureChanger", false), NF(f_DressPath, "Dress", "Visuals::TextureChanger", false), + NF(f_GliderPath, "Glider", "Visuals::TextureChanger", false), toBeUpdate(), nextUpdate(0) { events::GameUpdateEvent += MY_METHOD_HANDLER(TextureChanger::OnGameUpdate); @@ -32,6 +33,7 @@ namespace cheat::feature { ConfigWidget(f_Enabled, "Texture Changer."); ImGui::Text("Active Hero: %s", ActiveHero.c_str()); + ImGui::Text("Active Glider: %s", ActiveGlider.c_str()); ConfigWidget(f_HeadPath, "Head Texture.\n" \ "Example path: C:\\Head.png"); @@ -42,6 +44,9 @@ namespace cheat::feature ConfigWidget(f_DressPath, "Dress Texture.\n" \ "Example path: C:\\Dress.png"); + ConfigWidget(f_GliderPath, "Glider Texture.\n" \ + "Example path: C:\\Glider.png"); + if (ImGui::Button("Apply")) ApplyTexture = true; } @@ -74,7 +79,7 @@ namespace cheat::feature if (ApplyTexture) { GameObject::AvatarRoot = app::GameObject_Find(string_to_il2cppi("/EntityRoot/AvatarRoot"), nullptr); - + if (GameObject::AvatarRoot != nullptr) { auto Transform = app::GameObject_GetComponentByName(GameObject::AvatarRoot, string_to_il2cppi("Transform"), nullptr); @@ -95,24 +100,47 @@ namespace cheat::feature auto TransformChildOffsetDummy = app::Transform_GetChild(reinterpret_cast(TransformOffsetDummy), 0, nullptr); auto OffsetGameObject = app::Component_1_get_gameObject(reinterpret_cast(TransformChildOffsetDummy), nullptr); auto OffsetGameObjectName = app::Object_1_get_name(reinterpret_cast(OffsetGameObject), nullptr); - auto GameObjectBody = app::GameObject_Find(string_to_il2cppi("/EntityRoot/AvatarRoot/" + il2cppi_to_string(GameObjectName) + "/OffsetDummy/" + il2cppi_to_string(OffsetGameObjectName) + "/Body"), nullptr); - auto SkinnedMeshRenderer = app::GameObject_GetComponentByName(reinterpret_cast(GameObjectBody), string_to_il2cppi("SkinnedMeshRenderer"), nullptr); - auto Material = app::Renderer_GetMaterialArray(reinterpret_cast(SkinnedMeshRenderer), nullptr); + + //Specific to Avatar + auto AvatarBody = app::GameObject_Find(string_to_il2cppi("/EntityRoot/AvatarRoot/" + il2cppi_to_string(GameObjectName) + "/OffsetDummy/" + il2cppi_to_string(OffsetGameObjectName) + "/Body"), nullptr); + auto AvatarSkinnedMeshRenderer = app::GameObject_GetComponentByName(reinterpret_cast(AvatarBody), string_to_il2cppi("SkinnedMeshRenderer"), nullptr); + auto AvatarMaterial = app::Renderer_GetMaterialArray(reinterpret_cast(AvatarSkinnedMeshRenderer), nullptr); + + //Specific to Glider + auto GliderRoot = app::GameObject_Find(string_to_il2cppi("/EntityRoot/AvatarRoot/" + il2cppi_to_string(GameObjectName) + "/OffsetDummy/" + il2cppi_to_string(OffsetGameObjectName) + "/Bip001/Bip001 Pelvis/Bip001 Spine/Bip001 Spine1/Bip001 Spine2/+FlycloakRootB CB A01"), nullptr); + auto TransformGliderRoot = app::GameObject_GetComponentByName(GliderRoot, string_to_il2cppi("Transform"), nullptr); + auto TransformGlider = app::Transform_GetChild(reinterpret_cast(TransformGliderRoot), 0, nullptr); + auto Glider = app::Component_1_get_gameObject(reinterpret_cast(TransformGlider), nullptr); + auto GliderName = app::Object_1_get_name(reinterpret_cast(Glider), nullptr); + ActiveGlider = il2cppi_to_string(GliderName); + auto TransformGliderModelRoot = app::Transform_GetChild(reinterpret_cast(TransformGlider), 1, nullptr); + auto TransformGliderModel = app::Transform_GetChild(reinterpret_cast(TransformGliderModelRoot), 0, nullptr); + auto GliderModel = app::Component_1_get_gameObject(reinterpret_cast(TransformGliderModel), nullptr); + auto GliderSkinnedMeshRenderer = app::GameObject_GetComponentByName(reinterpret_cast(GliderModel), string_to_il2cppi("SkinnedMeshRenderer"), nullptr); + auto GliderMaterial = app::Renderer_GetMaterialArray(reinterpret_cast(GliderSkinnedMeshRenderer), nullptr); + // 0 - Hair, 1 - Body, 2 - Dress if (f_HeadPath && CheckFile(f_HeadPath)) { auto HeadTexture = app::NativeGallery_LoadImageAtPath(string_to_il2cppi(f_HeadPath), 100, false, false, false, nullptr); - app::Material_set_mainTexture(Material->vector[0], reinterpret_cast(HeadTexture), nullptr); + app::Material_set_mainTexture(AvatarMaterial->vector[0], reinterpret_cast(HeadTexture), nullptr); } if (f_BodyPath && CheckFile(f_BodyPath)) { auto BodyTexture = app::NativeGallery_LoadImageAtPath(string_to_il2cppi(f_BodyPath), 100, false, false, false, nullptr); - app::Material_set_mainTexture(Material->vector[1], reinterpret_cast(BodyTexture), nullptr); + app::Material_set_mainTexture(AvatarMaterial->vector[1], reinterpret_cast(BodyTexture), nullptr); } if (f_DressPath && CheckFile(f_DressPath)) { auto DressTexture = app::NativeGallery_LoadImageAtPath(string_to_il2cppi(f_DressPath), 100, false, false, false, nullptr); - if (Material->vector[2] != nullptr) - app::Material_set_mainTexture(Material->vector[2], reinterpret_cast(DressTexture), nullptr); + if (AvatarMaterial->vector[2] != nullptr) + app::Material_set_mainTexture(AvatarMaterial->vector[2], reinterpret_cast(DressTexture), nullptr); } + + //Glider + if (f_GliderPath && CheckFile(f_GliderPath)) + { + auto GliderTexture = app::NativeGallery_LoadImageAtPath(string_to_il2cppi(f_GliderPath), 100, false, false, false, nullptr); + app::Material_set_mainTexture(GliderMaterial->vector[0], reinterpret_cast(GliderTexture), nullptr); + } ApplyTexture = false; } } diff --git a/cheat-library/src/user/cheat/visuals/TextureChanger.h b/cheat-library/src/user/cheat/visuals/TextureChanger.h index 934d355..d2e893c 100644 --- a/cheat-library/src/user/cheat/visuals/TextureChanger.h +++ b/cheat-library/src/user/cheat/visuals/TextureChanger.h @@ -12,7 +12,9 @@ namespace cheat::feature config::Field> f_HeadPath; config::Field> f_BodyPath; config::Field> f_DressPath; + config::Field> f_GliderPath; std::string ActiveHero = "NONE"; + std::string ActiveGlider = "NONE"; bool ApplyTexture; static TextureChanger& GetInstance();