-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathMenu.h
More file actions
181 lines (133 loc) · 4.27 KB
/
Copy pathMenu.h
File metadata and controls
181 lines (133 loc) · 4.27 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
#pragma once
#include <Windows.h>
#include <string>
#include <string_view>
#include "ImGui/imgui_internal.h"
#include "Console.h"
#include "Utils.h"
#include "Variables.h"
#include "SDK/Entity/CObj.h"
class CConfig;
struct ImColorScheme : public ImColor
{
//constexpr ImColorScheme(ImColor& Color, float flAlpha)
//{
// this->Value = Color.Value;
// this->Value.w = flAlpha;
//}
// Slightly Skewed for alpha blending
static void Analogous(ImColor& Color, ImColor& Secondary, ImColor& Tertiary, float flVariance)
{
WORD H, L, S;
//WORD Alpha = 0xFF;
WORD Alpha = (WORD)((1.0f - sinf(M_PI_F * flVariance)) * 255.f);
ColorRGBToHLS(Color, &H, &L, &S);
Secondary = (Alpha << IM_COL32_A_SHIFT) | ColorHLSToRGB(ImLerp<WORD>(H, 255, flVariance), L, S);
Tertiary = (Alpha << IM_COL32_A_SHIFT) | ColorHLSToRGB(ImLerp<WORD>(H, 0, -flVariance), L, S);
}
static ImColor AlphaModulate(ImColor& Color, float flAlpha)
{
ImColor ColorOut = Color;
ColorOut.Value.w *= flAlpha;
return ColorOut;
}
static ImColor Secondary(ImColor& Color)
{
float h = 0.0f, s = 0.0f, v = 0.0f;
float r = 0.0f, g = 0.0f, b = 0.0f;
ImGui::ColorConvertRGBtoHSV(Color.Value.x, Color.Value.y, Color.Value.z, h, s, v);
ImGui::ColorConvertHSVtoRGB(h, s, v * 0.60f, r, g, b);
return ImColor(r, g, b, Color.Value.w * (1.0f - v));
}
//static constexpr ImColor ()
};
class CMenu
{
public:
CMenu(const CAdapterOutputPair& AdapterOutput);
~CMenu(void);
void Draw(const ImVec2 vSize);
HRESULT KeyboardHandler(HRESULT Result, LPVOID lpvData, DWORD cbData);
HRESULT MouseHandler(LPVOID lpvData, DWORD cbData);
bool IsOpen(void) const;
ImGuiStyle* ApplyStyle(ImColor& Primary = ImColor(7, 74, 25, 255),
ImColor& PrimaryBg = ImColor(7, 17, 74, 220));
void LoadConfig(LPCWSTR szConfig);
void SaveConfig(LPCWSTR szConfig);
private:
void GameplayTab(Pl0000* pCameraEnt);
void VisualsTab(CBehaviorAppBase* pCameraEnt);
void SpawnTab(Pl0000* pCameraEnt);
void MiscTab(void);
void ConfigTab(void);
void DisplayEntityHandles(void);
bool m_bOpened;
bool m_bIgnoreInputWhenOpened;
char m_szAdapterUtf8[128 * 4];
char m_szOutputUtf8[32 * 4];
BOOLEAN m_KeyboardState[256]; // c_dfDIKeyboard
BOOLEAN m_OldKeyboardState[256];
DIMOUSESTATE2 MouseState; // c_dfDIMouse2
DIMOUSESTATE2 OldMouseState;
ImColor m_Primary;
ImColor m_PrimaryBg;
// TODO:
// IConfig* m_pConfig;
CConfigXml* m_pConfig;
struct Config_t
{
PWIN32_FIND_DATA_LIST pHead;
INT iSelectedConfig;
TCHAR szName[MAX_PATH];
} Config;
constexpr static const char* s_MenuTitle = "2B Hook! ~ 2B Owns Me and All :^)";
};
extern CMenu* g_pMenu;
static void ApplyModelMods(Pl0000* pEntity);
static bool BlacklistItemCallback(void* data, int idx, const char** out_text);
static bool ConfigCallback(void* data, int idx, const char** out_text);
// NPC
//Pl0000* pCurrent = (Pl0000*)GetEntityFromHandleGlobal(&hCurrent);
static const char* EntityHandlesCallback(void* user_data, int idx)
{
static char s_Buffer[64];
EntityHandle_t hCurrent = {};
CBehaviorAppBase* pCurrent = nullptr;
const char* szType = "Unknown";
if (idx < 0)
return nullptr;
if (idx < g_pNPCManager->m_handles.m_Count)
{
hCurrent = g_pNPCManager->m_handles[idx];
pCurrent = g_pEntityList->GetEntity<CBehaviorAppBase>(hCurrent);
szType = "NPC";
}
else if (idx < g_pNPCManager->m_handles.m_Count + g_pEnemyManager->m_handles.m_Count)
{
hCurrent = g_pEnemyManager->m_handles[idx];
pCurrent = g_pEntityList->GetEntity<CBehaviorAppBase>(hCurrent);
szType = "Enemy";
}
else
{
hCurrent = g_pYorhaManager->m_handles[idx];
pCurrent = g_pEntityList->GetEntity<CBehaviorAppBase>(hCurrent);
szType = "Yorha";
}
((EntityHandle*)(user_data))[idx] = hCurrent;
sprintf_s(s_Buffer, "%s: %s | Handle: %x | ObjectId: %x", szType,
pCurrent ? pCurrent->m_pInfo->m_szEntityType : 0, hCurrent, pCurrent ? pCurrent->m_ObjectId : 0);
return s_Buffer;
}
static const char* EntityCallback(void* user_data, int idx)
{
static char s_Buffer[1024];
CEntityInfo* pInfo = g_pEntityList->m_pItems[idx].second;
if (pInfo)
{
sprintf_s(s_Buffer, "%s (ObjectId %x, SetType %x) Base %llx EHANDLE %08x\n",
(pInfo->m_szEntityType) ? pInfo->m_szEntityType : "EntityLayout",
pInfo->m_ObjectId, pInfo->m_uSetType, pInfo->m_pEntity, pInfo->m_hEntity);
}
return s_Buffer;
}