mirror of
https://github.com/SunsetMkt/Akebi-GC.git
synced 2025-09-19 03:56:05 +08:00
@ -15,6 +15,7 @@
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="src\user\cheat\visuals\TextureChanger.h" />
|
||||
<ClInclude Include="src\user\cheat\world\FakeTime.h" />
|
||||
<ClInclude Include="src\user\cheat\debugger.h">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WS|x64'">false</ExcludedFromBuild>
|
||||
@ -116,6 +117,7 @@
|
||||
<Font Include="res\Ruda-ExtraBold.ttf" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="src\user\cheat\visuals\TextureChanger.cpp" />
|
||||
<ClCompile Include="src\user\cheat\world\FakeTime.cpp" />
|
||||
<ClCompile Include="src\user\cheat\debugger.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</ExcludedFromBuild>
|
||||
|
@ -234,6 +234,9 @@
|
||||
<ClInclude Include="src\user\cheat\visuals\EnablePeaking.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\user\cheat\visuals\TextureChanger.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Font Include="res\Ruda-Bold.ttf" />
|
||||
@ -426,6 +429,9 @@
|
||||
<ClCompile Include="src\user\cheat\visuals\EnablePeaking.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\user\cheat\visuals\TextureChanger.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="res\res.rc">
|
||||
|
@ -178,6 +178,11 @@ DO_APP_FUNC(0x065508C0, void, Object_1_DestroyImmediate_1, (Object_1* obj, Metho
|
||||
DO_APP_FUNC(0x06550C00, Object_1*, Object_1_Instantiate_2, (Object_1* original, MethodInfo* method));
|
||||
DO_APP_FUNC(0x041B0BB0, Object*, Object_1_Instantiate_5, (Object* original, MethodInfo* method));
|
||||
DO_APP_FUNC(0x041B0BB0, GameObject*, Object_1_Instantiate_11, (GameObject* original, MethodInfo* method));
|
||||
DO_APP_FUNC(0x06555870, int32_t, Transform_get_childCount, (Transform* __this, MethodInfo* method));
|
||||
DO_APP_FUNC(0x0652EBC0, GameObject*, Component_1_get_gameObject, (Component_1* __this, MethodInfo* method));
|
||||
DO_APP_FUNC(0x06551030, String*, Object_1_get_name, (Object_1* __this, MethodInfo* method));
|
||||
DO_APP_FUNC(0x0665DA90, Material__Array*, Renderer_GetMaterialArray, (Renderer* __this, MethodInfo* method));
|
||||
DO_APP_FUNC(0x0652FB40, void, Material_set_mainTexture, (Material* __this, Texture* value, MethodInfo* method));
|
||||
|
||||
|
||||
// Music game event
|
||||
|
@ -11414,6 +11414,12 @@ namespace app {
|
||||
struct Object_1__Fields _;
|
||||
};
|
||||
|
||||
struct Texture {
|
||||
struct Texture__Class* klass;
|
||||
MonitorData* monitor;
|
||||
struct Texture__Fields fields;
|
||||
};
|
||||
|
||||
struct Texture2D__Fields {
|
||||
struct Texture__Fields _;
|
||||
};
|
||||
@ -11424,9 +11430,6 @@ namespace app {
|
||||
struct Texture2D__Fields fields;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
struct Image_1__Fields {
|
||||
struct MaskableGraphic__Fields _;
|
||||
struct Sprite* m_CachedSprite;
|
||||
@ -11914,6 +11917,24 @@ namespace app {
|
||||
MonitorData* monitor;
|
||||
};
|
||||
|
||||
struct Renderer__Fields {
|
||||
struct Component_1__Fields _;
|
||||
};
|
||||
|
||||
struct Renderer {
|
||||
struct Renderer__Class* klass;
|
||||
MonitorData* monitor;
|
||||
struct Renderer__Fields fields;
|
||||
};
|
||||
|
||||
struct Material__Array {
|
||||
struct Material__Array__Class* klass;
|
||||
MonitorData* monitor;
|
||||
Il2CppArrayBounds* bounds;
|
||||
il2cpp_array_size_t max_length;
|
||||
struct Material* vector[32];
|
||||
};
|
||||
|
||||
#if !defined(_GHIDRA_) && !defined(_IDA_)
|
||||
}
|
||||
#endif
|
||||
|
@ -49,6 +49,7 @@
|
||||
#include <cheat/visuals/HideUI.h>
|
||||
#include <cheat/visuals/Browser.h>
|
||||
#include <cheat/visuals/EnablePeaking.h>
|
||||
#include <cheat/visuals/TextureChanger.h>
|
||||
|
||||
#include "GenshinCM.h"
|
||||
|
||||
@ -109,7 +110,8 @@ namespace cheat
|
||||
FEAT_INST(PaimonFollow),
|
||||
FEAT_INST(HideUI),
|
||||
FEAT_INST(Browser),
|
||||
FEAT_INST(EnablePeaking)
|
||||
FEAT_INST(EnablePeaking),
|
||||
FEAT_INST(TextureChanger),
|
||||
|
||||
});
|
||||
#undef FEAT_INST
|
||||
|
128
cheat-library/src/user/cheat/visuals/TextureChanger.cpp
Normal file
128
cheat-library/src/user/cheat/visuals/TextureChanger.cpp
Normal file
@ -0,0 +1,128 @@
|
||||
#include "pch-il2cpp.h"
|
||||
#include "TextureChanger.h"
|
||||
|
||||
#include <helpers.h>
|
||||
#include <cheat/events.h>
|
||||
#include <misc/cpp/imgui_stdlib.h>
|
||||
#include <fstream>
|
||||
|
||||
namespace cheat::feature
|
||||
{
|
||||
namespace GameObject {
|
||||
app::GameObject* AvatarRoot = nullptr;
|
||||
}
|
||||
|
||||
TextureChanger::TextureChanger() : Feature(),
|
||||
NF(f_Enabled, "Texture Changer", "Visuals::TextureChanger", false),
|
||||
NF(f_HeadPath, "Head", "Visuals::TextureChanger", false),
|
||||
NF(f_BodyPath, "Body", "Visuals::TextureChanger", false),
|
||||
NF(f_DressPath, "Dress", "Visuals::TextureChanger", false),
|
||||
toBeUpdate(), nextUpdate(0)
|
||||
{
|
||||
events::GameUpdateEvent += MY_METHOD_HANDLER(TextureChanger::OnGameUpdate);
|
||||
}
|
||||
|
||||
const FeatureGUIInfo& TextureChanger::GetGUIInfo() const
|
||||
{
|
||||
static const FeatureGUIInfo info{ "TextureChanger", "Visuals", true };
|
||||
return info;
|
||||
}
|
||||
|
||||
void TextureChanger::DrawMain()
|
||||
{
|
||||
ConfigWidget(f_Enabled, "Texture Changer.");
|
||||
ImGui::Text("Active Hero: %s", ActiveHero.c_str());
|
||||
|
||||
ConfigWidget(f_HeadPath, "Head Texture.\n" \
|
||||
"Example path: C:\\Head.png");
|
||||
|
||||
ConfigWidget(f_BodyPath, "Body Texture.\n" \
|
||||
"Example path: C:\\Body.png");
|
||||
|
||||
ConfigWidget(f_DressPath, "Dress Texture.\n" \
|
||||
"Example path: C:\\Dress.png");
|
||||
|
||||
if (ImGui::Button("Apply"))
|
||||
ApplyTexture = true;
|
||||
}
|
||||
|
||||
bool TextureChanger::NeedStatusDraw() const
|
||||
{
|
||||
return f_Enabled;
|
||||
}
|
||||
|
||||
void TextureChanger::DrawStatus()
|
||||
{
|
||||
ImGui::Text("Texture Changer");
|
||||
}
|
||||
|
||||
TextureChanger& TextureChanger::GetInstance()
|
||||
{
|
||||
static TextureChanger instance;
|
||||
return instance;
|
||||
}
|
||||
|
||||
void TextureChanger::OnGameUpdate()
|
||||
{
|
||||
if (!f_Enabled)
|
||||
return;
|
||||
|
||||
auto currentTime = util::GetCurrentTimeMillisec();
|
||||
if (currentTime < nextUpdate)
|
||||
return;
|
||||
|
||||
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);
|
||||
auto HeroCount = app::Transform_get_childCount(reinterpret_cast<app::Transform*>(Transform), nullptr);
|
||||
|
||||
for (int i = 0; i <= HeroCount - 1; i++)
|
||||
{
|
||||
auto HeroComponent = app::Transform_GetChild(reinterpret_cast<app::Transform*>(Transform), i, nullptr);
|
||||
auto HeroGameObject = app::Component_1_get_gameObject(reinterpret_cast<app::Component_1*>(HeroComponent), nullptr);
|
||||
auto isActiveHero = app::GameObject_get_active(HeroGameObject, nullptr);
|
||||
|
||||
if (isActiveHero)
|
||||
{
|
||||
auto GameObjectName = app::Object_1_get_name(reinterpret_cast<app::Object_1*>(HeroGameObject), nullptr);
|
||||
ActiveHero = il2cppi_to_string(GameObjectName);
|
||||
auto OffsetDummy = app::GameObject_Find(string_to_il2cppi("/EntityRoot/AvatarRoot/" + il2cppi_to_string(GameObjectName) + "/OffsetDummy"), nullptr);
|
||||
auto TransformOffsetDummy = app::GameObject_GetComponentByName(OffsetDummy, string_to_il2cppi("Transform"), nullptr);
|
||||
auto TransformChildOffsetDummy = app::Transform_GetChild(reinterpret_cast<app::Transform*>(TransformOffsetDummy), 0, nullptr);
|
||||
auto OffsetGameObject = app::Component_1_get_gameObject(reinterpret_cast<app::Component_1*>(TransformChildOffsetDummy), nullptr);
|
||||
auto OffsetGameObjectName = app::Object_1_get_name(reinterpret_cast<app::Object_1*>(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<app::GameObject*>(GameObjectBody), string_to_il2cppi("SkinnedMeshRenderer"), nullptr);
|
||||
auto Material = app::Renderer_GetMaterialArray(reinterpret_cast<app::Renderer*>(SkinnedMeshRenderer), 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<app::Texture*>(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<app::Texture*>(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<app::Texture*>(DressTexture), nullptr);
|
||||
}
|
||||
ApplyTexture = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
nextUpdate = currentTime + (int)f_DelayUpdate;
|
||||
}
|
||||
|
||||
bool TextureChanger::CheckFile(const std::string& Filename) {
|
||||
struct stat buffer;
|
||||
return (stat(Filename.c_str(), &buffer) == 0);
|
||||
}
|
||||
}
|
33
cheat-library/src/user/cheat/visuals/TextureChanger.h
Normal file
33
cheat-library/src/user/cheat/visuals/TextureChanger.h
Normal file
@ -0,0 +1,33 @@
|
||||
#pragma once
|
||||
#include <cheat-base/cheat/Feature.h>
|
||||
#include <cheat-base/config/config.h>
|
||||
#include <cheat-base/thread-safe.h>
|
||||
|
||||
namespace cheat::feature
|
||||
{
|
||||
class TextureChanger : public Feature
|
||||
{
|
||||
public:
|
||||
config::Field<config::Toggle<Hotkey>> f_Enabled;
|
||||
config::Field<config::Toggle<std::string>> f_HeadPath;
|
||||
config::Field<config::Toggle<std::string>> f_BodyPath;
|
||||
config::Field<config::Toggle<std::string>> f_DressPath;
|
||||
std::string ActiveHero = "NONE";
|
||||
bool ApplyTexture;
|
||||
|
||||
static TextureChanger& GetInstance();
|
||||
const FeatureGUIInfo& GetGUIInfo() const override;
|
||||
void DrawMain() override;
|
||||
bool NeedStatusDraw() const override;
|
||||
void DrawStatus() override;
|
||||
bool CheckFile(const std::string& name);
|
||||
private:
|
||||
SafeQueue<uint32_t> toBeUpdate;
|
||||
SafeValue<int64_t> nextUpdate;
|
||||
int f_DelayUpdate = 15;
|
||||
|
||||
void OnGameUpdate();
|
||||
TextureChanger();
|
||||
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user