-
Notifications
You must be signed in to change notification settings - Fork 56
Expand file tree
/
Copy pathhide_ui.cpp
More file actions
58 lines (43 loc) · 1.11 KB
/
Copy pathhide_ui.cpp
File metadata and controls
58 lines (43 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#include "pch.h"
#include "hide_ui.h"
namespace HideUi
{
static float LastUpdateTime = 0.0f;
static HOOK OnUpdateHook = {};
static System::Void OnUpdateDetour(RPG::Client::RPGApplication* _this)
{
float CurrentTime = UnityEngine::Time::get_unscaledTime();
if (CurrentTime - LastUpdateTime >= 0.1f)
{
UnityEngine::Camera** Camera = RPG::Client::GlobalVars::StaticGet_s_UICamera();
if (Camera && *Camera)
{
(*Camera)->set_enabled(!Options.HideUi || !Input::GetKeyStateValue(Options.HideUiKey, Options.HideUiKeyHeld));
}
LastUpdateTime = CurrentTime;
}
CALL_ORIGINAL(OnUpdateHook, OnUpdateDetour, _this);
}
void Menu()
{
ImGui::BeginGroupPanel("Hide UI");
ImGui::Checkbox("Enable", &Options.HideUi);
ImGui::SameLine();
ImGui::Hotkey("##HideUiHotkey", &Options.HideUiKey, &Options.HideUiKeyHeld);
ImGui::EndGroupPanel();
}
void BeforeFrame()
{
}
void OnFrame()
{
}
bool Setup()
{
if (!IsHookActive(&OnUpdateHook) && !CreateHook(&OnUpdateHook, (PBYTE)hIl2Cpp + RPG_CLIENT_RPGAPPLICATION_ONUPDATE_OFFSET, OnUpdateDetour, FALSE))
{
return FALSE;
}
return TRUE;
}
}