In-game Browser
me and @RyujinZX
This commit is contained in:
parent
d6ec0a570d
commit
0fdfd2492e
@ -50,6 +50,7 @@
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\user\cheat\teleport\CustomTeleports.h" />
|
||||
<ClInclude Include="src\user\cheat\visuals\Browser.h" />
|
||||
<ClInclude Include="src\user\cheat\visuals\CameraZoom.h" />
|
||||
<ClInclude Include="src\user\cheat\visuals\FPSUnlock.h" />
|
||||
<ClInclude Include="src\user\cheat\visuals\HideUI.h" />
|
||||
@ -163,6 +164,7 @@
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\user\cheat\teleport\CustomTeleports.cpp" />
|
||||
<ClCompile Include="src\user\cheat\GenshinCM.cpp" />
|
||||
<ClCompile Include="src\user\cheat\visuals\Browser.cpp" />
|
||||
<ClCompile Include="src\user\cheat\visuals\CameraZoom.cpp" />
|
||||
<ClCompile Include="src\user\cheat\visuals\FPSUnlock.cpp" />
|
||||
<ClCompile Include="src\user\cheat\visuals\HideUI.cpp" />
|
||||
|
@ -234,6 +234,9 @@
|
||||
<ClInclude Include="src\user\cheat\visuals\HideUI.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\user\cheat\visuals\Browser.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Font Include="res\Ruda-Bold.ttf" />
|
||||
@ -426,6 +429,9 @@
|
||||
<ClCompile Include="src\user\cheat\visuals\HideUI.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\user\cheat\visuals\Browser.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="res\res.rc">
|
||||
|
@ -45,6 +45,7 @@
|
||||
#include <cheat/visuals/ProfileChanger.h>
|
||||
#include <cheat/visuals/PaimonFollow.h>
|
||||
#include <cheat/visuals/HideUI.h>
|
||||
#include <cheat/visuals/Browser.h>
|
||||
|
||||
#include "GenshinCM.h"
|
||||
|
||||
@ -101,7 +102,8 @@ namespace cheat
|
||||
FEAT_INST(ChestIndicator),
|
||||
FEAT_INST(ProfileChanger),
|
||||
FEAT_INST(PaimonFollow),
|
||||
FEAT_INST(HideUI)
|
||||
FEAT_INST(HideUI),
|
||||
FEAT_INST(Browser)
|
||||
|
||||
});
|
||||
#undef FEAT_INST
|
||||
|
99
cheat-library/src/user/cheat/visuals/Browser.cpp
Normal file
99
cheat-library/src/user/cheat/visuals/Browser.cpp
Normal file
@ -0,0 +1,99 @@
|
||||
#include "pch-il2cpp.h"
|
||||
#include "Browser.h"
|
||||
|
||||
#include <helpers.h>
|
||||
#include <cheat/events.h>
|
||||
#include <misc/cpp/imgui_stdlib.h>
|
||||
|
||||
#include <cheat/esp/ESPRender.h>
|
||||
|
||||
namespace cheat::feature
|
||||
{
|
||||
app::GameObject* planeObject = nullptr;
|
||||
app::Component_1* BrowserComponents = nullptr;
|
||||
static std::string f_URL;
|
||||
|
||||
Browser::Browser() : Feature(),
|
||||
NF(f_Enabled, "Browser", "Visuals", false),
|
||||
toBeUpdate(), nextUpdate(0)
|
||||
{
|
||||
events::GameUpdateEvent += MY_METHOD_HANDLER(Browser::OnGameUpdate);
|
||||
}
|
||||
|
||||
const FeatureGUIInfo& Browser::GetGUIInfo() const
|
||||
{
|
||||
static const FeatureGUIInfo info{ "Browser", "Visuals", false };
|
||||
return info;
|
||||
}
|
||||
|
||||
void Browser::DrawMain()
|
||||
{
|
||||
ConfigWidget(f_Enabled, "Create in-game Browser");
|
||||
ImGui::InputText("URL", &f_URL);
|
||||
}
|
||||
|
||||
bool Browser::NeedStatusDraw() const
|
||||
{
|
||||
return f_Enabled;
|
||||
}
|
||||
|
||||
void Browser::DrawStatus()
|
||||
{
|
||||
ImGui::Text("Browser");
|
||||
}
|
||||
|
||||
Browser& Browser::GetInstance()
|
||||
{
|
||||
static Browser instance;
|
||||
return instance;
|
||||
}
|
||||
|
||||
void Browser::OnGameUpdate()
|
||||
{
|
||||
auto currentTime = util::GetCurrentTimeMillisec();
|
||||
if (currentTime < nextUpdate)
|
||||
return;
|
||||
|
||||
if (f_Enabled) {
|
||||
if (planeObject == nullptr) {
|
||||
|
||||
auto PrimitiveType = app::PrimitiveType__Enum::Plane;
|
||||
planeObject = app::GameObject_CreatePrimitive(PrimitiveType, nullptr);
|
||||
|
||||
app::Transform* planeObject_Transform = app::GameObject_get_transform(planeObject, nullptr);
|
||||
app::Quaternion planeObject_Transform_Quaternion = { 0.5, 0.5, -0.5, 0.5};
|
||||
auto avatarPos = app::ActorUtils_GetAvatarPos(nullptr);
|
||||
auto relativePos = app::WorldShiftManager_GetRelativePosition(avatarPos, nullptr);
|
||||
app::Vector3 planeObject_Transform_Vector3 = { relativePos.x, relativePos.y + 3, relativePos.z };
|
||||
app::Vector3 planeObject_Transform_Scale = { 1, 1, 1};
|
||||
|
||||
app::Transform_set_localPosition(planeObject_Transform, planeObject_Transform_Vector3, nullptr);
|
||||
app::Transform_set_localScale(planeObject_Transform, planeObject_Transform_Scale, nullptr);
|
||||
app::Transform_set_localRotation(planeObject_Transform, planeObject_Transform_Quaternion, nullptr);
|
||||
}
|
||||
|
||||
if (planeObject != nullptr) {
|
||||
if (BrowserComponents == nullptr) {
|
||||
std::string custom_url = f_URL.length() < 2 || f_URL.c_str() == "" ? "https://www.google.com/" : f_URL.c_str();
|
||||
|
||||
BrowserComponents = app::GameObject_AddComponentInternal(planeObject, string_to_il2cppi("Browser"), nullptr);
|
||||
reinterpret_cast<app::Browser*>(BrowserComponents)->fields._url = string_to_il2cppi(custom_url);
|
||||
reinterpret_cast<app::Browser*>(BrowserComponents)->fields._width = 1920;
|
||||
reinterpret_cast<app::Browser*>(BrowserComponents)->fields._height = 1080;
|
||||
reinterpret_cast<app::Browser*>(BrowserComponents)->fields.forceNextRender = true;
|
||||
reinterpret_cast<app::Browser*>(BrowserComponents)->fields._EnableInput_k__BackingField = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (planeObject != nullptr && BrowserComponents != nullptr)
|
||||
{
|
||||
app::Object_1_DestroyImmediate_1(reinterpret_cast<app::Object_1*>(planeObject), nullptr);
|
||||
app::Object_1_DestroyImmediate_1(reinterpret_cast<app::Object_1*>(BrowserComponents), nullptr);
|
||||
planeObject = nullptr;
|
||||
BrowserComponents = nullptr;
|
||||
}
|
||||
}
|
||||
nextUpdate = currentTime + (int)f_DelayUpdate;
|
||||
}
|
||||
}
|
26
cheat-library/src/user/cheat/visuals/Browser.h
Normal file
26
cheat-library/src/user/cheat/visuals/Browser.h
Normal file
@ -0,0 +1,26 @@
|
||||
#pragma once
|
||||
#include <cheat-base/cheat/Feature.h>
|
||||
#include <cheat-base/config/config.h>
|
||||
#include <cheat-base/thread-safe.h>
|
||||
|
||||
namespace cheat::feature
|
||||
{
|
||||
class Browser : public Feature
|
||||
{
|
||||
public:
|
||||
config::Field<config::Toggle<Hotkey>> f_Enabled;
|
||||
|
||||
static Browser& GetInstance();
|
||||
const FeatureGUIInfo& GetGUIInfo() const override;
|
||||
void DrawMain() override;
|
||||
virtual bool NeedStatusDraw() const override;
|
||||
void DrawStatus() override;
|
||||
|
||||
private:
|
||||
SafeQueue<uint32_t> toBeUpdate;
|
||||
SafeValue<int64_t> nextUpdate;
|
||||
int f_DelayUpdate = 20.f;
|
||||
void OnGameUpdate();
|
||||
Browser();
|
||||
};
|
||||
}
|
Loading…
Reference in New Issue
Block a user