Code cleanup

This commit is contained in:
Grinch_ 2021-09-20 18:41:40 +06:00
parent 0083ad86cd
commit 99cc388209
45 changed files with 987 additions and 962 deletions

View File

@ -73,6 +73,7 @@
"xstring": "cpp", "xstring": "cpp",
"xtr1common": "cpp", "xtr1common": "cpp",
"xtree": "cpp", "xtree": "cpp",
"xutility": "cpp" "xutility": "cpp",
"*.rh": "cpp"
} }
} }

View File

@ -1,8 +1,8 @@
#include "pch.h" #include "pch.h"
#include "Animation.h" #include "animation.h"
#ifdef GTASA #ifdef GTASA
#include "Ui.h" #include "ui.h"
#include "Util.h" #include "util.h"
Animation::Animation() Animation::Animation()
{ {
@ -42,6 +42,7 @@ void Animation::PlayCutscene(std::string& rootKey, std::string& cutsceneId, std:
SetHelpMessage("Another cutscene is running", false, false, false); SetHelpMessage("Another cutscene is running", false, false, false);
return; return;
} }
CPlayerPed* pPlayer = FindPlayerPed(); CPlayerPed* pPlayer = FindPlayerPed();
if (!pPlayer) if (!pPlayer)
{ {

View File

@ -5,22 +5,28 @@
class Animation class Animation
{ {
private: private:
inline static char m_nAnimBuffer[INPUT_BUFFER_SIZE];
inline static ResourceStore m_AnimData{ "animation", eResourceType::TYPE_TEXT }; // Animation player
static inline ResourceStore m_AnimData{ "animation", eResourceType::TYPE_TEXT };
static inline char m_nAnimBuffer[INPUT_BUFFER_SIZE];
static inline char m_nIfpBuffer[INPUT_BUFFER_SIZE];
static inline bool m_Loop; // loop animation
static inline bool m_bSecondary; // play animation as secondary
// Cutscene player
struct m_Cutscene struct m_Cutscene
{ {
inline static ResourceStore m_Data{ "cutscene", eResourceType::TYPE_TEXT }; static inline ResourceStore m_Data{ "cutscene", eResourceType::TYPE_TEXT };
inline static std::string m_SceneName; static inline std::string m_SceneName;
inline static int m_nInterior; static inline int m_nInterior; // player interior backup
inline static bool m_bRunning; static inline bool m_bRunning;
}; };
inline static int m_nFightingStyle;
inline static char m_nIfpBuffer[INPUT_BUFFER_SIZE]; static inline int m_nFightingStyle;
inline static bool m_Loop; static inline std::string m_nWalkingStyle = "default";
inline static bool m_bSecondary; static inline std::vector<std::string> m_FightingStyleList =
inline static std::string m_nWalkingStyle = "default"; { "Default", "Boxing", "Kung fu", "Kick Boxing", "Punch Kick" };
inline static std::vector<std::string> m_FightingStyleList = { "Default", "Boxing", "Kung fu", "Kick Boxing", "Punch Kick" }; static inline std::vector<std::string> m_WalkingStyleList =
inline static std::vector<std::string> m_WalkingStyleList =
{ {
"default", "man", "shuffle", "oldman", "gang1", "gang2", "oldfatman", "default", "man", "shuffle", "oldman", "gang1", "gang2", "oldfatman",
"fatman", "jogger", "drunkman", "blindman", "swat", "woman", "shopping", "busywoman", "fatman", "jogger", "drunkman", "blindman", "swat", "woman", "shopping", "busywoman",

View File

@ -1,8 +1,8 @@
#include "pch.h" #include "pch.h"
#include "CheatMenu.h" #include "cheatMenu.h"
#include "MenuInfo.h" #include "menuinfo.h"
#include "Ui.h" #include "ui.h"
#include "Updater.h" #include "updater.h"
void CheatMenu::DrawWindow() void CheatMenu::DrawWindow()
{ {
@ -13,7 +13,7 @@ void CheatMenu::DrawWindow()
{ {
if (bRunning) if (bRunning)
{ {
config.WriteToDisk(); gConfig.WriteToDisk();
bRunning = false; bRunning = false;
m_bShowMouse = false; m_bShowMouse = false;
} }
@ -21,12 +21,21 @@ void CheatMenu::DrawWindow()
else else
{ {
bRunning = true; bRunning = true;
if (Globals::m_bShowMenu || BY_GAME(m_Commands::m_bShowMenu, true)) if (m_bShowMenu || BY_GAME(m_Commands::m_bShowMenu, true))
{ {
if (Globals::m_bShowMenu) if (m_bShowMenu)
{ {
ImGui::SetNextWindowSize(Globals::m_fMenuSize); static ImVec2 fScreenSize = ImVec2(-1, -1);
if (ImGui::Begin(MENU_TITLE, &Globals::m_bShowMenu, ImGuiWindowFlags_NoCollapse)) ImVec2 size(screen::GetScreenWidth(), screen::GetScreenHeight());
if (fScreenSize.x != -1 && fScreenSize.y != -1)
{
m_fMenuSize.x += (size.x - fScreenSize.x) / 4.0f;
m_fMenuSize.y += (size.y - fScreenSize.y) / 1.2f;
}
ImGui::SetNextWindowSize(m_fMenuSize);
if (ImGui::Begin(MENU_TITLE, &m_bShowMenu, ImGuiWindowFlags_NoCollapse))
{ {
ImGui::PushStyleVar(ImGuiStyleVar_WindowMinSize, ImVec2(250, 350)); ImGui::PushStyleVar(ImGuiStyleVar_WindowMinSize, ImVec2(250, 350));
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImGui::PushStyleVar(ImGuiStyleVar_FramePadding,
@ -37,9 +46,9 @@ void CheatMenu::DrawWindow()
else else
Ui::DrawHeaders(header); Ui::DrawHeaders(header);
Globals::m_fMenuSize = ImGui::GetWindowSize(); m_fMenuSize = ImGui::GetWindowSize();
config.SetValue("window.sizeX", Globals::m_fMenuSize.x); gConfig.SetValue("window.sizeX", m_fMenuSize.x);
config.SetValue("window.sizeY", Globals::m_fMenuSize.y); gConfig.SetValue("window.sizeY", m_fMenuSize.y);
ImGui::PopStyleVar(2); ImGui::PopStyleVar(2);
ImGui::End(); ImGui::End();
@ -62,27 +71,21 @@ CheatMenu::CheatMenu()
windowCallback = std::bind(&DrawWindow); windowCallback = std::bind(&DrawWindow);
// Load menu settings // Load menu settings
Globals::m_HeaderId = config.GetValue("window.id", std::string("")); Ui::m_HeaderId = gConfig.GetValue("window.id", std::string(""));
Globals::m_fMenuSize.x = config.GetValue("window.sizeX", screen::GetScreenWidth() / 4.0f); m_fMenuSize.x = gConfig.GetValue("window.sizeX", screen::GetScreenWidth() / 4.0f);
Globals::m_fMenuSize.y = config.GetValue("window.sizeY", screen::GetScreenHeight() / 1.2f); m_fMenuSize.y = gConfig.GetValue("window.sizeY", screen::GetScreenHeight() / 1.2f);
srand(CTimer::m_snTimeInMilliseconds); srand(CTimer::m_snTimeInMilliseconds);
Events::processScriptsEvent += []() Events::processScriptsEvent += []()
{ {
if (Globals::m_bInit && if (!BY_GAME(FrontEndMenuManager.m_bMenuActive, FrontendMenuManager.m_bMenuVisible))
#ifdef GTASA
!FrontEndMenuManager.m_bMenuActive
#elif GTAVC
!FrontendMenuManager.m_bMenuVisible
#endif
)
{ {
if (Ui::HotKeyPressed(Menu::m_HotKeys::menuOpen)) if (menuOpen.Pressed())
{ {
Globals::m_bShowMenu = !Globals::m_bShowMenu; m_bShowMenu = !m_bShowMenu;
} }
if (Ui::HotKeyPressed(Menu::m_HotKeys::commandWindow)) if (commandWindow.Pressed())
{ {
if (m_Commands::m_bShowMenu) if (m_Commands::m_bShowMenu)
{ {
@ -92,14 +95,14 @@ CheatMenu::CheatMenu()
m_Commands::m_bShowMenu = !m_Commands::m_bShowMenu; m_Commands::m_bShowMenu = !m_Commands::m_bShowMenu;
} }
if (m_bShowMouse != Globals::m_bShowMenu) if (m_bShowMouse != m_bShowMenu)
{ {
if (m_bShowMouse) // Only write when the menu closes if (m_bShowMouse) // Only write when the menu closes
{ {
config.WriteToDisk(); gConfig.WriteToDisk();
} }
m_bShowMouse = Globals::m_bShowMenu; m_bShowMouse = m_bShowMenu;
} }
} }
}; };
@ -178,89 +181,3 @@ void CheatMenu::ApplyStyle()
colors[ImGuiCol_NavWindowingDimBg] = ImVec4(0.80f, 0.80f, 0.80f, 0.20f); colors[ImGuiCol_NavWindowingDimBg] = ImVec4(0.80f, 0.80f, 0.80f, 0.20f);
colors[ImGuiCol_ModalWindowDimBg] = ImVec4(0.26f, 0.59f, 0.98f, 0.35f); colors[ImGuiCol_ModalWindowDimBg] = ImVec4(0.26f, 0.59f, 0.98f, 0.35f);
} }
void MenuThread(void* param)
{
if (!fs::is_directory(PLUGIN_PATH((char*)"CheatMenu")))
{
flog << "CheatMenu folder not found. You need to put both \"CheatMenu.asi\" & \"CheatMenu\" folder in the same directory" << std::endl;
return;
}
static bool bGameInit = false;
#ifdef GTASA
Hook::ApplyMouseFix();
#endif
// Wait till game init
Events::initRwEvent += []
{
bGameInit = true;
};
while (!bGameInit)
{
Sleep(1000);
}
if (GetModuleHandle("SAMP.dll"))
{
MessageBox(RsGlobal.ps->window, "SAMP detected. Exiting CheatMenu.", "CheatMenu", MB_ICONERROR);
return;
}
flog << "Starting...\nVersion: " MENU_TITLE "\nAuthor: Grinch_\nDiscord: " DISCORD_INVITE "\nMore Info: "
GITHUB_LINK "\n" << std::endl;
CFastman92limitAdjuster::Init();
CheatMenu menu;
time_t now = time(0);
struct tm tstruct = *localtime(&now);
int last_check_date = config.GetValue("config.last_update_checked", 0);
if (last_check_date != tstruct.tm_mday)
{
Updater::CheckForUpdate();
config.SetValue("config.last_update_checked", tstruct.tm_mday);
}
while (true)
{
Sleep(5000);
if (Updater::m_State == UPDATER_CHECKING)
{
Updater::CheckForUpdate();
}
}
}
BOOL WINAPI DllMain(HINSTANCE hDllHandle, DWORD nReason, LPVOID Reserved)
{
if (nReason == DLL_PROCESS_ATTACH)
{
uint gameVersion = GetGameVersion();
#ifdef GTASA
if (gameVersion == GAME_10US_HOODLUM || gameVersion == GAME_10US_COMPACT)
{
CreateThread(nullptr, NULL, (LPTHREAD_START_ROUTINE)&MenuThread, nullptr, NULL, nullptr);
}
else
{
MessageBox(HWND_DESKTOP, "Unknown game version. GTA SA v1.0 US is required.", "CheatMenu", MB_ICONERROR);
}
#elif GTAVC
if (gameVersion == GAME_10EN)
{
CreateThread(nullptr, NULL, (LPTHREAD_START_ROUTINE)&MenuThread, nullptr, NULL, nullptr);
}
else
{
MessageBox(HWND_DESKTOP, "Unknown game version. GTA VC v1.0 EN is required.", "CheatMenu", MB_ICONERROR);
}
#endif
}
return TRUE;
}

View File

@ -23,7 +23,10 @@
class CheatMenu : Hook, Animation, Game, Menu, Ped, Player, Teleport, Vehicle, Visual, Weapon class CheatMenu : Hook, Animation, Game, Menu, Ped, Player, Teleport, Vehicle, Visual, Weapon
{ {
private: private:
inline static CallbackTable header static inline bool m_bShowMenu = false;
static inline ImVec2 m_fMenuSize = ImVec2(screen::GetScreenWidth() / 4, screen::GetScreenHeight() / 1.2);
static inline CallbackTable header
{ {
{"Teleport", &Teleport::Draw}, {"Player", &Player::Draw}, {"Ped", &Ped::Draw}, {"Teleport", &Teleport::Draw}, {"Player", &Player::Draw}, {"Ped", &Ped::Draw},
#ifdef GTASA #ifdef GTASA

View File

@ -1,6 +1,6 @@
#include "pch.h" #include "pch.h"
#include "FileHandler.h" #include "filehandler.h"
#include "Visual.h" #include "visual.h"
// TODO: Clean up this mess, use structures instead? // TODO: Clean up this mess, use structures instead?
void FileHandler::GenerateHandlingFile(int pHandling, std::map<int, std::string>& storeMap) void FileHandler::GenerateHandlingFile(int pHandling, std::map<int, std::string>& storeMap)
@ -126,7 +126,7 @@ void FileHandler::FetchColorData(std::vector<std::vector<float>>& storeVec,
} }
catch (...) catch (...)
{ {
flog << "Error parsing carcols.dat, " << line << std::endl; gLog << "Error parsing carcols.dat, " << line << std::endl;
} }
} }
@ -156,7 +156,7 @@ void FileHandler::FetchColorData(std::vector<std::vector<float>>& storeVec,
} }
catch (...) catch (...)
{ {
flog << "Error parsing carcols.dat, " << line << std::endl; gLog << "Error parsing carcols.dat, " << line << std::endl;
} }
} }
} }
@ -166,7 +166,7 @@ void FileHandler::FetchColorData(std::vector<std::vector<float>>& storeVec,
} }
else else
{ {
flog << "Carcols.dat not found"; gLog << "Carcols.dat not found";
} }
} }
@ -212,7 +212,7 @@ void FileHandler::FetchHandlingID(std::map<int, std::string>& storeMap)
} }
catch (...) catch (...)
{ {
flog << "Error parsing vehicles.ide, " << line << std::endl; gLog << "Error parsing vehicles.ide, " << line << std::endl;
} }
} }
@ -220,6 +220,6 @@ void FileHandler::FetchHandlingID(std::map<int, std::string>& storeMap)
} }
else else
{ {
flog << "Vehicle.ide not found"; gLog << "Vehicle.ide not found";
} }
} }

View File

@ -1,8 +1,8 @@
#include "pch.h" #include "pch.h"
#include "Menu.h" #include "menu.h"
#include "Game.h" #include "game.h"
#include "Ui.h" #include "ui.h"
#include "Util.h" #include "util.h"
#ifdef GTASA #ifdef GTASA
#include <CIplStore.h> #include <CIplStore.h>
#include <CMessages.h> #include <CMessages.h>
@ -90,7 +90,7 @@ Game::Game()
#ifdef GTASA #ifdef GTASA
if (m_bScreenShot) if (m_bScreenShot)
{ {
if (Ui::HotKeyPressed(Menu::m_HotKeys::quickSceenShot)) if (quickSceenShot.Pressed())
{ {
Command<Commands::TAKE_PHOTO>(); Command<Commands::TAKE_PHOTO>();
SetHelpMessage("Screenshot taken", false, false, false); SetHelpMessage("Screenshot taken", false, false, false);
@ -140,7 +140,7 @@ Game::Game()
} }
} }
if (Ui::HotKeyPressed(Menu::m_HotKeys::freeCam)) if (freeCam.Pressed())
{ {
if (m_Freecam::m_bEnabled) if (m_Freecam::m_bEnabled)
{ {
@ -267,7 +267,7 @@ void Game::FreeCam()
m_Freecam::m_fTotalMouse.y = -150; m_Freecam::m_fTotalMouse.y = -150;
} }
if (Ui::HotKeyPressed(Menu::m_HotKeys::freeCamTeleportPlayer)) if (freeCamTeleportPlayer.Pressed())
{ {
CPlayerPed* player = FindPlayerPed(-1); CPlayerPed* player = FindPlayerPed(-1);
CVector pos = m_Freecam::m_pPed->GetPosition(); CVector pos = m_Freecam::m_pPed->GetPosition();
@ -490,7 +490,7 @@ Lowers armour, health, stamina etc."))
Command<Commands::SWITCH_DEATH_PENALTIES>(m_bKeepStuff); Command<Commands::SWITCH_DEATH_PENALTIES>(m_bKeepStuff);
} }
Ui::CheckboxWithHint("Screenshot shortcut", &m_bScreenShot, Ui::CheckboxWithHint("Screenshot shortcut", &m_bScreenShot,
(("Take screenshot using ") + Ui::GetHotKeyNameString(Menu::m_HotKeys::quickSceenShot) (("Take screenshot using ") + quickSceenShot.GetNameString()
+ "\nSaved inside 'GTA San Andreas User Files\\Gallery'").c_str()); + "\nSaved inside 'GTA San Andreas User Files\\Gallery'").c_str());
if (Ui::CheckboxWithHint("Solid water", &m_bSolidWater, if (Ui::CheckboxWithHint("Solid water", &m_bSolidWater,
"Player can walk on water\nTurn this off if you want to swim.")) "Player can walk on water\nTurn this off if you want to swim."))

View File

@ -3,60 +3,60 @@
class Game class Game
{ {
public: public:
inline static ResourceStore m_MissionData{ "mission", eResourceType::TYPE_TEXT }; static inline ResourceStore m_MissionData{ "mission", eResourceType::TYPE_TEXT };
#ifdef GTASA #ifdef GTASA
inline static bool m_bForbiddenArea = true; static inline bool m_bForbiddenArea = true;
inline static bool m_bSolidWater; static inline bool m_bSolidWater;
inline static bool m_bScreenShot; static inline bool m_bScreenShot;
inline static uint m_nSolidWaterObj; static inline uint m_nSolidWaterObj;
inline static bool m_bKeepStuff; static inline bool m_bKeepStuff;
inline static ResourceStore m_StatData{ "stat", eResourceType::TYPE_TEXT }; static inline ResourceStore m_StatData{ "stat", eResourceType::TYPE_TEXT };
inline static std::vector<std::string> m_DayNames = static inline std::vector<std::string> m_DayNames =
{ {
"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"
}; };
struct m_RandomCheats struct m_RandomCheats
{ {
inline static bool m_bEnabled; static inline bool m_bEnabled;
inline static bool m_bProgressBar = true; static inline bool m_bProgressBar = true;
inline static std::string m_EnabledCheats[92][2]; static inline std::string m_EnabledCheats[92][2];
inline static int m_nInterval = 10; static inline int m_nInterval = 10;
inline static CJson m_Json = CJson("cheat name"); static inline CJson m_Json = CJson("cheat name");
inline static uint m_nTimer; static inline uint m_nTimer;
}; };
struct m_Freecam struct m_Freecam
{ {
inline static bool m_bEnabled; static inline bool m_bEnabled;
inline static float m_fSpeed = 0.08f; static inline float m_fSpeed = 0.08f;
inline static float m_fFOV = 60.0f; static inline float m_fFOV = 60.0f;
inline static bool m_bInitDone; static inline bool m_bInitDone;
inline static CPed* m_pPed; static inline CPed* m_pPed;
inline static int m_nPed = -1; static inline int m_nPed = -1;
inline static CVector m_fMouse; static inline CVector m_fMouse;
inline static CVector m_fTotalMouse; static inline CVector m_fTotalMouse;
inline static BYTE m_bHudState; static inline BYTE m_bHudState;
inline static BYTE m_bRadarState; static inline BYTE m_bRadarState;
}; };
struct m_HardMode struct m_HardMode
{ {
inline static bool m_bEnabled; static inline bool m_bEnabled;
inline static float m_fBacHealth = 0.0f; static inline float m_fBacHealth = 0.0f;
inline static float m_fBacMaxHealth = 0.0f; static inline float m_fBacMaxHealth = 0.0f;
inline static float m_fBacArmour = 0.0f; static inline float m_fBacArmour = 0.0f;
inline static float m_fBacStamina = 0.0f; static inline float m_fBacStamina = 0.0f;
}; };
#endif #endif
inline static bool m_bDisableCheats; static inline bool m_bDisableCheats;
inline static bool m_bDisableReplay; static inline bool m_bDisableReplay;
inline static bool m_bMissionTimer; static inline bool m_bMissionTimer;
inline static bool m_bFreezeTime; static inline bool m_bFreezeTime;
inline static bool m_bSyncTime; static inline bool m_bSyncTime;
inline static uint m_nSyncTimer; static inline uint m_nSyncTimer;
inline static bool m_bMissionLoaderWarningShown; static inline bool m_bMissionLoaderWarningShown;
Game(); Game();
static void Draw(); static void Draw();

View File

@ -1,7 +1,10 @@
#include "pch.h" #include "pch.h"
#include "Hook.h" #include "hook.h"
#include "../depend/kiero/kiero.h" #include "../depend/kiero/kiero.h"
#include "../depend/kiero/minhook/MinHook.h" #include "../depend/kiero/minhook/MinHook.h"
#include "../depend/imgui/imgui_impl_dx9.h"
#include "../depend/imgui/imgui_impl_dx11.h"
#include "../depend/imgui/imgui_impl_win32.h"
LRESULT Hook::WndProc(const HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) LRESULT Hook::WndProc(const HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{ {
@ -33,21 +36,23 @@ void Hook::RenderFrame(void* ptr)
} }
ImGuiIO& io = ImGui::GetIO(); ImGuiIO& io = ImGui::GetIO();
static bool bInit = false;
if (Globals::m_bInit) if (bInit)
{ {
ShowMouse(m_bShowMouse); ShowMouse(m_bShowMouse);
// handle window scaling here // handle window scaling here
static ImVec2 fScreenSize = ImVec2(-1, -1);
ImVec2 size(screen::GetScreenWidth(), screen::GetScreenHeight()); ImVec2 size(screen::GetScreenWidth(), screen::GetScreenHeight());
if (Globals::m_fScreenSize.x != size.x && Globals::m_fScreenSize.y != size.y) if (fScreenSize.x != size.x && fScreenSize.y != size.y)
{ {
int fontSize = static_cast<int>(size.y / 54.85f); // manually tested int fontSize = static_cast<int>(size.y / 54.85f); // manually tested
io.FontDefault = io.Fonts->AddFontFromFileTTF("C:/Windows/Fonts/trebucbd.ttf", fontSize); io.FontDefault = io.Fonts->AddFontFromFileTTF("C:/Windows/Fonts/trebucbd.ttf", fontSize);
io.Fonts->Build(); io.Fonts->Build();
if (Globals::renderer == Render_DirectX9) if (gRenderer == Render_DirectX9)
{ {
ImGui_ImplDX9_InvalidateDeviceObjects(); ImGui_ImplDX9_InvalidateDeviceObjects();
} }
@ -56,12 +61,6 @@ void Hook::RenderFrame(void* ptr)
ImGui_ImplDX11_InvalidateDeviceObjects(); ImGui_ImplDX11_InvalidateDeviceObjects();
} }
if (Globals::m_fScreenSize.x != -1 && Globals::m_fScreenSize.y != -1)
{
Globals::m_fMenuSize.x += (size.x - Globals::m_fScreenSize.x) / 4.0f;
Globals::m_fMenuSize.y += (size.y - Globals::m_fScreenSize.y) / 1.2f;
}
ImGuiStyle* style = &ImGui::GetStyle(); ImGuiStyle* style = &ImGui::GetStyle();
float scaleX = size.x / 1366.0f; float scaleX = size.x / 1366.0f;
float scaleY = size.y / 768.0f; float scaleY = size.y / 768.0f;
@ -72,11 +71,11 @@ void Hook::RenderFrame(void* ptr)
style->IndentSpacing = 20 * scaleX; style->IndentSpacing = 20 * scaleX;
style->ItemInnerSpacing = ImVec2(4 * scaleX, 4 * scaleY); style->ItemInnerSpacing = ImVec2(4 * scaleX, 4 * scaleY);
Globals::m_fScreenSize = size; fScreenSize = size;
} }
ImGui_ImplWin32_NewFrame(); ImGui_ImplWin32_NewFrame();
if (Globals::renderer == Render_DirectX9) if (gRenderer == Render_DirectX9)
{ {
ImGui_ImplDX9_NewFrame(); ImGui_ImplDX9_NewFrame();
} }
@ -95,7 +94,7 @@ void Hook::RenderFrame(void* ptr)
ImGui::EndFrame(); ImGui::EndFrame();
ImGui::Render(); ImGui::Render();
if (Globals::renderer == Render_DirectX9) if (gRenderer == Render_DirectX9)
{ {
ImGui_ImplDX9_RenderDrawData(ImGui::GetDrawData()); ImGui_ImplDX9_RenderDrawData(ImGui::GetDrawData());
} }
@ -106,7 +105,7 @@ void Hook::RenderFrame(void* ptr)
} }
else else
{ {
Globals::m_bInit = true; bInit = true;
ImGui::CreateContext(); ImGui::CreateContext();
ImGuiStyle& style = ImGui::GetStyle(); ImGuiStyle& style = ImGui::GetStyle();
@ -114,23 +113,22 @@ void Hook::RenderFrame(void* ptr)
ImGui_ImplWin32_Init(RsGlobal.ps->window); ImGui_ImplWin32_Init(RsGlobal.ps->window);
#ifdef GTASA #ifdef GTASA
// shift trigger fix // shift trigger fix
patch::Nop(0x00531155, 5); patch::Nop(0x00531155, 5);
#endif #endif
if (Globals::renderer == Render_DirectX9) if (gRenderer == Render_DirectX9)
{ {
Globals::device = ptr; ImGui_ImplDX9_Init(reinterpret_cast<IDirect3DDevice9*>(ptr));
ImGui_ImplDX9_Init(reinterpret_cast<IDirect3DDevice9*>(Globals::device));
} }
else else
{ {
// for dx11 device ptr is swapchain // for dx11 device ptr is swapchain
reinterpret_cast<IDXGISwapChain*>(ptr)->GetDevice(__uuidof(ID3D11Device), &Globals::device); reinterpret_cast<IDXGISwapChain*>(ptr)->GetDevice(__uuidof(ID3D11Device), &ptr);
ID3D11DeviceContext* context; ID3D11DeviceContext* context;
reinterpret_cast<ID3D11Device*>(Globals::device)->GetImmediateContext(&context); reinterpret_cast<ID3D11Device*>(ptr)->GetImmediateContext(&context);
ImGui_ImplDX11_Init(reinterpret_cast<ID3D11Device*>(Globals::device), context); ImGui_ImplDX11_Init(reinterpret_cast<ID3D11Device*>(ptr), context);
} }
ImGui_ImplWin32_EnableDpiAwareness(); ImGui_ImplWin32_EnableDpiAwareness();
@ -192,7 +190,7 @@ Hook::Hook()
// Nvidia Overlay crash fix // Nvidia Overlay crash fix
if (init(kiero::RenderType::D3D9) == kiero::Status::Success) if (init(kiero::RenderType::D3D9) == kiero::Status::Success)
{ {
Globals::renderer = Render_DirectX9; gRenderer = Render_DirectX9;
kiero::bind(16, (void**)&oReset, Reset); kiero::bind(16, (void**)&oReset, Reset);
kiero::bind(42, (void**)&oEndScene, Dx9Handler); kiero::bind(42, (void**)&oEndScene, Dx9Handler);
} }
@ -201,7 +199,7 @@ Hook::Hook()
// gtaRenderHook // gtaRenderHook
if (init(kiero::RenderType::D3D11) == kiero::Status::Success) if (init(kiero::RenderType::D3D11) == kiero::Status::Success)
{ {
Globals::renderer = Render_DirectX11; gRenderer = Render_DirectX11;
kiero::bind(8, (void**)&oPresent11, Dx11Handler); kiero::bind(8, (void**)&oPresent11, Dx11Handler);
} }
} }

View File

@ -10,11 +10,11 @@ extern IMGUI_IMPL_API LRESULT ImGui_ImplWin32_WndProcHandler(HWND hWnd, UINT msg
class Hook class Hook
{ {
private: private:
inline static WNDPROC oWndProc; static inline WNDPROC oWndProc;
inline static f_Present11 oPresent11; static inline f_Present11 oPresent11;
inline static f_EndScene oEndScene; static inline f_EndScene oEndScene;
inline static f_Reset oReset; static inline f_Reset oReset;
inline static bool m_bMouseVisibility; static inline bool m_bMouseVisibility;
static void CALLBACK RenderFrame(void* ptr); static void CALLBACK RenderFrame(void* ptr);
static HRESULT CALLBACK Dx9Handler(IDirect3DDevice9* pDevice); static HRESULT CALLBACK Dx9Handler(IDirect3DDevice9* pDevice);
@ -24,8 +24,8 @@ private:
static void ShowMouse(bool state); static void ShowMouse(bool state);
public: public:
inline static bool m_bShowMouse = false; static inline bool m_bShowMouse = false;
inline static std::function<void()> windowCallback = nullptr; static inline std::function<void()> windowCallback = nullptr;
#ifdef GTASA #ifdef GTASA
static void ApplyMouseFix(); static void ApplyMouseFix();

View File

@ -1,16 +1,16 @@
#include "pch.h" #include "pch.h"
#include "Json.h" #include "json.h"
CJson::CJson(const char* name) CJson::CJson(const char* name)
{ {
if (name == "" || !fs::is_directory(PLUGIN_PATH((char*)"CheatMenu"))) if (name == "" || !std::filesystem::is_directory(PLUGIN_PATH((char*)"CheatMenu")))
{ {
return; return;
} }
m_FilePath = PLUGIN_PATH((char*)"/CheatMenu/json/") + std::string(name) + ".json"; m_FilePath = PLUGIN_PATH((char*)"/CheatMenu/json/") + std::string(name) + ".json";
if (fs::exists(m_FilePath)) if (std::filesystem::exists(m_FilePath))
{ {
try try
{ {
@ -20,7 +20,7 @@ CJson::CJson(const char* name)
} }
catch (...) catch (...)
{ {
flog << "Error trying to read " << m_FilePath << std::endl; gLog << "Error trying to read " << m_FilePath << std::endl;
m_Data = "{}"_json; m_Data = "{}"_json;
} }
} }
@ -30,11 +30,11 @@ CJson::CJson(const char* name)
if (m_FilePath.find("config")) if (m_FilePath.find("config"))
{ {
flog << "Creating config.json file" << std::endl; gLog << "Creating config.json file" << std::endl;
} }
else else
{ {
flog << "Failed to locate file " << m_FilePath << std::endl; gLog << "Failed to locate file " << m_FilePath << std::endl;
} }
} }
} }

View File

@ -1,5 +1,5 @@
#pragma once #pragma once
#include "../Depend/json.hpp" #include "../depend/json.hpp"
/* /*
Wrapper class for nlohmann::json Wrapper class for nlohmann::json

View File

@ -1,68 +1,68 @@
#include "pch.h" #include "pch.h"
#include "MenuInfo.h" #include "menuinfo.h"
#include "Menu.h" #include "menu.h"
#include "Ui.h" #include "ui.h"
#include "Util.h" #include "util.h"
#include "Updater.h" #include "updater.h"
#ifdef GTASA #ifdef GTASA
#include "Teleport.h" #include "teleport.h"
#include "Weapon.h" #include "weapon.h"
#include "Vehicle.h" #include "vehicle.h"
#endif #endif
Menu::Menu() Menu::Menu()
{ {
// TODO: use structs // TODO: use structs
// Load config data // Load config data
m_Overlay::bCoord = config.GetValue("overlay.coord", false); m_Overlay::bCoord = gConfig.GetValue("overlay.coord", false);
m_Overlay::bCpuUsage = config.GetValue("overlay.cpu_usage", false); m_Overlay::bCpuUsage = gConfig.GetValue("overlay.cpu_usage", false);
m_Overlay::bFPS = config.GetValue("overlay.fps", false); m_Overlay::bFPS = gConfig.GetValue("overlay.fps", false);
m_Overlay::bLocName = config.GetValue("overlay.loc_name", false); m_Overlay::bLocName = gConfig.GetValue("overlay.loc_name", false);
m_Overlay::bTransparent = config.GetValue("overlay.transparent", false); m_Overlay::bTransparent = gConfig.GetValue("overlay.transparent", false);
m_Overlay::bMemUsage = config.GetValue("overlay.mem_usage", false); m_Overlay::bMemUsage = gConfig.GetValue("overlay.mem_usage", false);
m_Overlay::bVehHealth = config.GetValue("overlay.veh_health", false); m_Overlay::bVehHealth = gConfig.GetValue("overlay.veh_health", false);
m_Overlay::bVehSpeed = config.GetValue("overlay.veh_speed", false); m_Overlay::bVehSpeed = gConfig.GetValue("overlay.veh_speed", false);
m_Overlay::mSelectedPos = (DISPLAY_POS)config.GetValue("overlay.selected_pos", (int)DISPLAY_POS::BOTTOM_RIGHT); m_Overlay::mSelectedPos = (DISPLAY_POS)gConfig.GetValue("overlay.selected_pos", (int)DISPLAY_POS::BOTTOM_RIGHT);
m_Overlay::fPosX = config.GetValue("overlay.pox", 0); m_Overlay::fPosX = gConfig.GetValue("overlay.pox", 0);
m_Overlay::fPosY = config.GetValue("overlay.posy", 0); m_Overlay::fPosY = gConfig.GetValue("overlay.posy", 0);
// Hotkeys // Hotkeys
m_HotKeys::aimSkinChanger.m_key1 = config.GetValue("hotkey.aim_skin_changer.key1", VK_RETURN); aimSkinChanger.m_key1 = gConfig.GetValue("hotkey.aim_skin_changer.key1", VK_RETURN);
m_HotKeys::aimSkinChanger.m_key2 = config.GetValue("hotkey.aim_skin_changer.key2", VK_RETURN); aimSkinChanger.m_key2 = gConfig.GetValue("hotkey.aim_skin_changer.key2", VK_RETURN);
m_HotKeys::freeCam.m_key1 = config.GetValue("hotkey.freecam.key1", VK_F6); freeCam.m_key1 = gConfig.GetValue("hotkey.freecam.key1", VK_F6);
m_HotKeys::freeCam.m_key2 = config.GetValue("hotkey.freecam.key2", VK_F6); freeCam.m_key2 = gConfig.GetValue("hotkey.freecam.key2", VK_F6);
m_HotKeys::quickSceenShot.m_key1 = config.GetValue("hotkey.quick_screenshot.key1", VK_F5); quickSceenShot.m_key1 = gConfig.GetValue("hotkey.quick_screenshot.key1", VK_F5);
m_HotKeys::quickSceenShot.m_key2 = config.GetValue("hotkey.quick_screenshot.key2", VK_F5); quickSceenShot.m_key2 = gConfig.GetValue("hotkey.quick_screenshot.key2", VK_F5);
m_HotKeys::quickTeleport.m_key1 = config.GetValue("hotkey.quick_tp.key1", VK_KEY_X); quickTeleport.m_key1 = gConfig.GetValue("hotkey.quick_tp.key1", VK_KEY_X);
m_HotKeys::quickTeleport.m_key2 = config.GetValue("hotkey.quick_tp.key2", VK_KEY_Y); quickTeleport.m_key2 = gConfig.GetValue("hotkey.quick_tp.key2", VK_KEY_Y);
m_HotKeys::menuOpen.m_key1 = config.GetValue("hotkey.menu_open.key1", VK_LCONTROL); menuOpen.m_key1 = gConfig.GetValue("hotkey.menu_open.key1", VK_LCONTROL);
m_HotKeys::menuOpen.m_key2 = config.GetValue("hotkey.menu_open.key2", VK_KEY_M); menuOpen.m_key2 = gConfig.GetValue("hotkey.menu_open.key2", VK_KEY_M);
m_HotKeys::commandWindow.m_key1 = config.GetValue("hotkey.command_window.key1", VK_LMENU); commandWindow.m_key1 = gConfig.GetValue("hotkey.command_window.key1", VK_LMENU);
m_HotKeys::commandWindow.m_key2 = config.GetValue("hotkey.command_window.key2", VK_KEY_C); commandWindow.m_key2 = gConfig.GetValue("hotkey.command_window.key2", VK_KEY_C);
m_HotKeys::flipVeh.m_key1 = config.GetValue("hotkey.flip_veh.key1", VK_NONE); flipVeh.m_key1 = gConfig.GetValue("hotkey.flip_veh.key1", VK_NONE);
m_HotKeys::flipVeh.m_key2 = config.GetValue("hotkey.flip_veh.key2", VK_NONE); flipVeh.m_key2 = gConfig.GetValue("hotkey.flip_veh.key2", VK_NONE);
m_HotKeys::fixVeh.m_key1 = config.GetValue("hotkey.fix_veh.key1", VK_NONE); fixVeh.m_key1 = gConfig.GetValue("hotkey.fix_veh.key1", VK_NONE);
m_HotKeys::fixVeh.m_key2 = config.GetValue("hotkey.fix_veh.key2", VK_NONE); fixVeh.m_key2 = gConfig.GetValue("hotkey.fix_veh.key2", VK_NONE);
m_HotKeys::godMode.m_key1 = config.GetValue("hotkey.god_mode.key1", VK_NONE); godMode.m_key1 = gConfig.GetValue("hotkey.god_mode.key1", VK_NONE);
m_HotKeys::godMode.m_key2 = config.GetValue("hotkey.god_mode.key2", VK_NONE); godMode.m_key2 = gConfig.GetValue("hotkey.god_mode.key2", VK_NONE);
m_HotKeys::vehEngine.m_key1 = config.GetValue("hotkey.veh_engine.key1", VK_NONE); vehEngine.m_key1 = gConfig.GetValue("hotkey.veh_engine.key1", VK_NONE);
m_HotKeys::vehEngine.m_key2 = config.GetValue("hotkey.veh_engine.key2", VK_NONE); vehEngine.m_key2 = gConfig.GetValue("hotkey.veh_engine.key2", VK_NONE);
m_HotKeys::vehInstantStart.m_key1 = config.GetValue("hotkey.veh_instant_start.key1", VK_NONE); vehInstantStart.m_key1 = gConfig.GetValue("hotkey.veh_instant_start.key1", VK_NONE);
m_HotKeys::vehInstantStart.m_key2 = config.GetValue("hotkey.veh_instant_start.key2", VK_NONE); vehInstantStart.m_key2 = gConfig.GetValue("hotkey.veh_instant_start.key2", VK_NONE);
m_HotKeys::vehInstantStop.m_key1 = config.GetValue("hotkey.veh_instant_stop.key1", VK_NONE); vehInstantStop.m_key1 = gConfig.GetValue("hotkey.veh_instant_stop.key1", VK_NONE);
m_HotKeys::vehInstantStop.m_key2 = config.GetValue("hotkey.veh_instant_stop.key2", VK_NONE); vehInstantStop.m_key2 = gConfig.GetValue("hotkey.veh_instant_stop.key2", VK_NONE);
Util::GetCPUUsageInit(); Util::GetCPUUsageInit();
MEMORYSTATUSEX memInfo; MEMORYSTATUSEX memInfo;
@ -74,122 +74,126 @@ Menu::Menu()
void Menu::DrawOverlay() void Menu::DrawOverlay()
{ {
CPlayerPed* player = FindPlayerPed(); CPlayerPed* pPlayer = FindPlayerPed();
bool m_bShowMenu = m_Overlay::bCoord || m_Overlay::bFPS || m_Overlay::bLocName || m_Overlay::bCpuUsage || m_Overlay::bMemUsage || if (pPlayer)
((m_Overlay::bVehHealth || m_Overlay::bVehSpeed) && player && player->m_pVehicle && player->m_pVehicle->IsDriver(player));
const float offset = 10.0f;
ImGuiIO& io = ImGui::GetIO();
ImGuiWindowFlags window_flags = ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_AlwaysAutoResize |
ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoFocusOnAppearing | ImGuiWindowFlags_NoNav;
if (m_Overlay::mSelectedPos == DISPLAY_POS::CUSTOM)
{ {
if (m_Overlay::fPosX != NULL && m_Overlay::fPosY != NULL) bool m_bShowMenu = m_Overlay::bCoord || m_Overlay::bFPS || m_Overlay::bLocName || m_Overlay::bCpuUsage || m_Overlay::bMemUsage ||
((m_Overlay::bVehHealth || m_Overlay::bVehSpeed) && pPlayer && pPlayer->m_pVehicle && pPlayer->m_pVehicle->IsDriver(pPlayer));
const float offset = 10.0f;
ImGuiIO& io = ImGui::GetIO();
ImGuiWindowFlags window_flags = ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_AlwaysAutoResize |
ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoFocusOnAppearing | ImGuiWindowFlags_NoNav;
if (m_Overlay::mSelectedPos == DISPLAY_POS::CUSTOM)
{ {
config.SetValue("overlay.posx", m_Overlay::fPosX); if (m_Overlay::fPosX != NULL && m_Overlay::fPosY != NULL)
config.SetValue("overlay.posy", m_Overlay::fPosY);
ImGui::SetNextWindowPos(ImVec2(m_Overlay::fPosX, m_Overlay::fPosY), ImGuiCond_Once);
}
}
else
{
window_flags |= ImGuiWindowFlags_NoMove;
ImVec2 pos, pivot;
if (m_Overlay::mSelectedPos == DISPLAY_POS::TOP_LEFT)
{
pos = ImVec2(offset, offset);
pivot = ImVec2(0.0f, 0.0f);
}
if (m_Overlay::mSelectedPos == DISPLAY_POS::TOP_RIGHT)
{
pos = ImVec2(io.DisplaySize.x - offset, offset);
pivot = ImVec2(1.0f, 0.0f);
}
if (m_Overlay::mSelectedPos == DISPLAY_POS::BOTTOM_LEFT)
{
pos = ImVec2(offset, io.DisplaySize.y - offset);
pivot = ImVec2(0.0f, 1.0f);
}
if (m_Overlay::mSelectedPos == DISPLAY_POS::BOTTOM_RIGHT)
{
pos = ImVec2(io.DisplaySize.x - offset, io.DisplaySize.y - offset);
pivot = ImVec2(1.0f, 1.0f);
}
ImGui::SetNextWindowPos(pos, ImGuiCond_Always, pivot);
}
ImGui::SetNextWindowBgAlpha(m_Overlay::bTransparent ? 0.0f : 0.5f);
if (m_bShowMenu && ImGui::Begin("Overlay", nullptr, window_flags))
{
CVector pos{0,0,0};
if (player)
{
pos = player->GetPosition();
}
size_t game_ms = CTimer::m_snTimeInMilliseconds;
if (game_ms - m_Overlay::mLastInterval > m_Overlay::mInterval)
{
m_Overlay::fCpuUsage = static_cast<float>(Util::GetCurrentCPUUsage());
MEMORYSTATUSEX memInfo;
memInfo.dwLength = sizeof(MEMORYSTATUSEX);
GlobalMemoryStatusEx(&memInfo);
int mUsedRam = static_cast<int>((memInfo.ullTotalPhys - memInfo.ullAvailPhys) * 1e-6);
m_Overlay::fMemUsage = 100.0f * (static_cast<float>(mUsedRam) / static_cast<float>(m_Overlay::mTotalRam));
m_Overlay::mFPS = static_cast<size_t>
(
#ifdef GTASA
CTimer::game_FPS
#elif GTAVC
io.Framerate
#endif
);
m_Overlay::mLastInterval = game_ms;
}
if (m_Overlay::bCoord)
ImGui::Text("Coord: %.2f, %.2f, %.2f", pos.x, pos.y, pos.z);
if (m_Overlay::bCpuUsage)
ImGui::Text("CPU usage: %.2f%%", m_Overlay::fCpuUsage);
if (m_Overlay::bFPS)
ImGui::Text("Frames: %d", m_Overlay::mFPS);
if (m_Overlay::bLocName)
ImGui::Text("Location: %s", Util::GetLocationName(&pos).c_str());
if (m_Overlay::bMemUsage)
ImGui::Text("RAM usage: %.2f%%", m_Overlay::fMemUsage);
if (player && player->m_pVehicle && player->m_pVehicle->IsDriver(player))
{
if (m_Overlay::bVehHealth)
ImGui::Text("Veh Health: %.f", player->m_pVehicle->m_fHealth);
if (m_Overlay::bVehSpeed)
{ {
int speed = player->m_pVehicle->m_vecMoveSpeed.Magnitude() * 50.0f; // 02E3 - GET_CAR_SPEED gConfig.SetValue("overlay.posx", m_Overlay::fPosX);
ImGui::Text("Veh Speed: %d", speed); gConfig.SetValue("overlay.posy", m_Overlay::fPosY);
ImGui::SetNextWindowPos(ImVec2(m_Overlay::fPosX, m_Overlay::fPosY), ImGuiCond_Once);
} }
} }
else
{
window_flags |= ImGuiWindowFlags_NoMove;
ImVec2 pos, pivot;
ImVec2 windowPos = ImGui::GetWindowPos(); if (m_Overlay::mSelectedPos == DISPLAY_POS::TOP_LEFT)
m_Overlay::fPosX = windowPos.x; {
m_Overlay::fPosY = windowPos.y; pos = ImVec2(offset, offset);
pivot = ImVec2(0.0f, 0.0f);
}
ImGui::End(); if (m_Overlay::mSelectedPos == DISPLAY_POS::TOP_RIGHT)
{
pos = ImVec2(io.DisplaySize.x - offset, offset);
pivot = ImVec2(1.0f, 0.0f);
}
if (m_Overlay::mSelectedPos == DISPLAY_POS::BOTTOM_LEFT)
{
pos = ImVec2(offset, io.DisplaySize.y - offset);
pivot = ImVec2(0.0f, 1.0f);
}
if (m_Overlay::mSelectedPos == DISPLAY_POS::BOTTOM_RIGHT)
{
pos = ImVec2(io.DisplaySize.x - offset, io.DisplaySize.y - offset);
pivot = ImVec2(1.0f, 1.0f);
}
ImGui::SetNextWindowPos(pos, ImGuiCond_Always, pivot);
}
ImGui::SetNextWindowBgAlpha(m_Overlay::bTransparent ? 0.0f : 0.5f);
if (m_bShowMenu && ImGui::Begin("Overlay", nullptr, window_flags))
{
CVector pos{0,0,0};
pos = pPlayer->GetPosition();
size_t game_ms = CTimer::m_snTimeInMilliseconds;
if (game_ms - m_Overlay::mLastInterval > m_Overlay::mInterval)
{
m_Overlay::fCpuUsage = static_cast<float>(Util::GetCurrentCPUUsage());
MEMORYSTATUSEX memInfo;
memInfo.dwLength = sizeof(MEMORYSTATUSEX);
GlobalMemoryStatusEx(&memInfo);
int mUsedRam = static_cast<int>((memInfo.ullTotalPhys - memInfo.ullAvailPhys) * 1e-6);
m_Overlay::fMemUsage = 100.0f * (static_cast<float>(mUsedRam) / static_cast<float>(m_Overlay::mTotalRam));
m_Overlay::mFPS = static_cast<size_t>(BY_GAME(CTimer::game_FPS, io.Framerate));
m_Overlay::mLastInterval = game_ms;
}
if (m_Overlay::bCoord)
{
ImGui::Text("Coord: %.2f, %.2f, %.2f", pos.x, pos.y, pos.z);
}
if (m_Overlay::bCpuUsage)
{
ImGui::Text("CPU usage: %.2f%%", m_Overlay::fCpuUsage);
}
if (m_Overlay::bFPS)
{
ImGui::Text("Frames: %d", m_Overlay::mFPS);
}
if (m_Overlay::bLocName)
{
ImGui::Text("Location: %s", Util::GetLocationName(&pos).c_str());
}
if (m_Overlay::bMemUsage)
{
ImGui::Text("RAM usage: %.2f%%", m_Overlay::fMemUsage);
}
if (pPlayer->m_pVehicle && pPlayer->m_pVehicle->IsDriver(pPlayer))
{
if (m_Overlay::bVehHealth)
{
ImGui::Text("Veh Health: %.f", pPlayer->m_pVehicle->m_fHealth);
}
if (m_Overlay::bVehSpeed)
{
int speed = pPlayer->m_pVehicle->m_vecMoveSpeed.Magnitude() * 50.0f; // 02E3 - GET_CAR_SPEED
ImGui::Text("Veh Speed: %d", speed);
}
}
ImVec2 windowPos = ImGui::GetWindowPos();
m_Overlay::fPosX = windowPos.x;
m_Overlay::fPosY = windowPos.y;
ImGui::End();
}
} }
} }
@ -345,36 +349,36 @@ void Menu::Draw()
ImGui::Spacing(); ImGui::Spacing();
ImGui::SameLine(); ImGui::SameLine();
if (Ui::ListBox("Overlay", m_Overlay::posNames, (int&)m_Overlay::mSelectedPos)) if (Ui::ListBox("Overlay", m_Overlay::posNames, (int&)m_Overlay::mSelectedPos))
config.SetValue("overlay.selected_pos", m_Overlay::mSelectedPos); gConfig.SetValue("overlay.selected_pos", m_Overlay::mSelectedPos);
ImGui::Spacing(); ImGui::Spacing();
ImGui::Columns(2, nullptr, false); ImGui::Columns(2, nullptr, false);
if (ImGui::Checkbox("No background", &m_Overlay::bTransparent)) if (ImGui::Checkbox("No background", &m_Overlay::bTransparent))
config.SetValue("overlay.transparent", m_Overlay::bTransparent); gConfig.SetValue("overlay.transparent", m_Overlay::bTransparent);
if (ImGui::Checkbox("Show coordinates", &m_Overlay::bCoord)) if (ImGui::Checkbox("Show coordinates", &m_Overlay::bCoord))
config.SetValue("overlay.coord", m_Overlay::bCoord); gConfig.SetValue("overlay.coord", m_Overlay::bCoord);
if (ImGui::Checkbox("Show CPU usage", &m_Overlay::bCpuUsage)) if (ImGui::Checkbox("Show CPU usage", &m_Overlay::bCpuUsage))
config.SetValue("overlay.cpu_usage", m_Overlay::bCpuUsage); gConfig.SetValue("overlay.cpu_usage", m_Overlay::bCpuUsage);
if (ImGui::Checkbox("Show FPS", &m_Overlay::bFPS)) if (ImGui::Checkbox("Show FPS", &m_Overlay::bFPS))
config.SetValue("overlay.fps", m_Overlay::bFPS); gConfig.SetValue("overlay.fps", m_Overlay::bFPS);
ImGui::NextColumn(); ImGui::NextColumn();
if (ImGui::Checkbox("Show location", &m_Overlay::bLocName)) if (ImGui::Checkbox("Show location", &m_Overlay::bLocName))
config.SetValue("overlay.loc_name", m_Overlay::bLocName); gConfig.SetValue("overlay.loc_name", m_Overlay::bLocName);
if (ImGui::Checkbox("Show RAM usage", &m_Overlay::bMemUsage)) if (ImGui::Checkbox("Show RAM usage", &m_Overlay::bMemUsage))
config.SetValue("overlay.mem_usage", m_Overlay::bMemUsage); gConfig.SetValue("overlay.mem_usage", m_Overlay::bMemUsage);
if (ImGui::Checkbox("Show veh health", &m_Overlay::bVehHealth)) if (ImGui::Checkbox("Show veh health", &m_Overlay::bVehHealth))
config.SetValue("overlay.veh_health", m_Overlay::bVehHealth); gConfig.SetValue("overlay.veh_health", m_Overlay::bVehHealth);
if (ImGui::Checkbox("Show veh speed", &m_Overlay::bVehSpeed)) if (ImGui::Checkbox("Show veh speed", &m_Overlay::bVehSpeed))
config.SetValue("overlay.veh_speed", m_Overlay::bVehSpeed); gConfig.SetValue("overlay.veh_speed", m_Overlay::bVehSpeed);
ImGui::Columns(1); ImGui::Columns(1);
@ -388,76 +392,76 @@ void Menu::Draw()
"\nRight click disables hotkey."); "\nRight click disables hotkey.");
ImGui::Spacing(); ImGui::Spacing();
ImGui::BeginChild("Hotkeys"); ImGui::BeginChild("Hotkeys");
if (Ui::HotKey("Open/ close cheat menu", m_HotKeys::menuOpen)) if (menuOpen.DrawUI("Open/ close cheat menu"))
{ {
config.SetValue("hotkey.menu_open.key1", m_HotKeys::menuOpen.m_key1); gConfig.SetValue("hotkey.menu_open.key1", menuOpen.m_key1);
config.SetValue("hotkey.menu_open.key2", m_HotKeys::menuOpen.m_key2); gConfig.SetValue("hotkey.menu_open.key2", menuOpen.m_key2);
} }
if (Ui::HotKey("Open/ close command window", m_HotKeys::commandWindow)) if (commandWindow.DrawUI("Open/ close command window"))
{ {
config.SetValue("hotkey.command_window.key1", m_HotKeys::commandWindow.m_key1); gConfig.SetValue("hotkey.command_window.key1", commandWindow.m_key1);
config.SetValue("hotkey.command_window.key2", m_HotKeys::commandWindow.m_key2); gConfig.SetValue("hotkey.command_window.key2", commandWindow.m_key2);
} }
ImGui::Dummy(ImVec2(0, 10)); ImGui::Dummy(ImVec2(0, 10));
if (Ui::HotKey("Activate aim skin changer", m_HotKeys::aimSkinChanger)) if (aimSkinChanger.DrawUI("Activate aim skin changer"))
{ {
config.SetValue("hotkey.aim_skin_changer.key1", m_HotKeys::aimSkinChanger.m_key1); gConfig.SetValue("hotkey.aim_skin_changer.key1", aimSkinChanger.m_key1);
config.SetValue("hotkey.aim_skin_changer.key2", m_HotKeys::aimSkinChanger.m_key2); gConfig.SetValue("hotkey.aim_skin_changer.key2", aimSkinChanger.m_key2);
} }
if (Ui::HotKey("Freecam", m_HotKeys::freeCam)) if (freeCam.DrawUI("Freecam"))
{ {
config.SetValue("hotkey.freecam.key1", m_HotKeys::freeCam.m_key1); gConfig.SetValue("hotkey.freecam.key1", freeCam.m_key1);
config.SetValue("hotkey.freecam.key2", m_HotKeys::freeCam.m_key2); gConfig.SetValue("hotkey.freecam.key2", freeCam.m_key2);
} }
if (Ui::HotKey("Take quick screenshot", m_HotKeys::quickSceenShot)) if (quickSceenShot.DrawUI("Take quick screenshot"))
{ {
config.SetValue("hotkey.quick_screenshot.key1", m_HotKeys::quickSceenShot.m_key1); gConfig.SetValue("hotkey.quick_screenshot.key1", quickSceenShot.m_key1);
config.SetValue("hotkey.quick_screenshot.key2", m_HotKeys::quickSceenShot.m_key2); gConfig.SetValue("hotkey.quick_screenshot.key2", quickSceenShot.m_key2);
} }
if (Ui::HotKey("Toggle quick teleport", m_HotKeys::quickTeleport)) if (quickTeleport.DrawUI("Toggle quick teleport"))
{ {
config.SetValue("hotkey.quick_tp.key1", m_HotKeys::quickTeleport.m_key1); gConfig.SetValue("hotkey.quick_tp.key1", quickTeleport.m_key1);
config.SetValue("hotkey.quick_tp.key2", m_HotKeys::quickTeleport.m_key2); gConfig.SetValue("hotkey.quick_tp.key2", quickTeleport.m_key2);
} }
ImGui::Dummy(ImVec2(0, 10)); ImGui::Dummy(ImVec2(0, 10));
if (Ui::HotKey("Fix current vehicle", m_HotKeys::fixVeh)) if (fixVeh.DrawUI("Fix current vehicle"))
{ {
config.SetValue("hotkey.fix_veh.key1", m_HotKeys::fixVeh.m_key1); gConfig.SetValue("hotkey.fix_veh.key1", fixVeh.m_key1);
config.SetValue("hotkey.fix_veh.key2", m_HotKeys::fixVeh.m_key2); gConfig.SetValue("hotkey.fix_veh.key2", fixVeh.m_key2);
} }
if (Ui::HotKey("Flip current vehicle", m_HotKeys::flipVeh)) if (flipVeh.DrawUI("Flip current vehicle"))
{ {
config.SetValue("hotkey.flip_veh.key1", m_HotKeys::flipVeh.m_key1); gConfig.SetValue("hotkey.flip_veh.key1", flipVeh.m_key1);
config.SetValue("hotkey.flip_veh.key2", m_HotKeys::flipVeh.m_key2); gConfig.SetValue("hotkey.flip_veh.key2", flipVeh.m_key2);
} }
if (Ui::HotKey("Toggle god mode", m_HotKeys::godMode)) if (godMode.DrawUI("Toggle god mode"))
{ {
config.SetValue("hotkey.god_mode.key1", m_HotKeys::godMode.m_key1); gConfig.SetValue("hotkey.god_mode.key1", godMode.m_key1);
config.SetValue("hotkey.god_mode.key2", m_HotKeys::godMode.m_key2); gConfig.SetValue("hotkey.god_mode.key2", godMode.m_key2);
} }
if (Ui::HotKey("Toggle veh engine", m_HotKeys::vehEngine)) if (vehEngine.DrawUI("Toggle veh engine"))
{ {
config.SetValue("hotkey.veh_engine.key1", m_HotKeys::vehEngine.m_key1); gConfig.SetValue("hotkey.veh_engine.key1", vehEngine.m_key1);
config.SetValue("hotkey.veh_engine.key2", m_HotKeys::vehEngine.m_key2); gConfig.SetValue("hotkey.veh_engine.key2", vehEngine.m_key2);
} }
if (Ui::HotKey("Vehicle instant start", m_HotKeys::vehInstantStart)) if (vehInstantStart.DrawUI("Vehicle instant start"))
{ {
config.SetValue("hotkey.veh_instant_start.key1", m_HotKeys::vehInstantStart.m_key1); gConfig.SetValue("hotkey.veh_instant_start.key1", vehInstantStart.m_key1);
config.SetValue("hotkey.veh_instant_start.key2", m_HotKeys::vehInstantStart.m_key2); gConfig.SetValue("hotkey.veh_instant_start.key2", vehInstantStart.m_key2);
} }
if (Ui::HotKey("Vehicle instant stop", m_HotKeys::vehInstantStop)) if (vehInstantStop.DrawUI("Vehicle instant stop"))
{ {
config.SetValue("hotkey.veh_instant_stop.key1", m_HotKeys::vehInstantStop.m_key1); gConfig.SetValue("hotkey.veh_instant_stop.key1", vehInstantStop.m_key1);
config.SetValue("hotkey.veh_instant_stop.key2", m_HotKeys::vehInstantStop.m_key2); gConfig.SetValue("hotkey.veh_instant_stop.key2", vehInstantStop.m_key2);
} }
ImGui::Dummy(ImVec2(0, 10)); ImGui::Dummy(ImVec2(0, 10));
@ -469,10 +473,7 @@ void Menu::Draw()
{ {
if (ImGui::BeginChild("CommandsChild")) if (ImGui::BeginChild("CommandsChild"))
{ {
ImGui::TextWrapped( ImGui::TextWrapped("Open or close command window using %s", commandWindow.GetNameString());
std::string(
"Open or close command window using " + Ui::GetHotKeyNameString(m_HotKeys::commandWindow)).
c_str());
ImGui::Spacing(); ImGui::Spacing();
if (ImGui::CollapsingHeader("Set health")) if (ImGui::CollapsingHeader("Set health"))
{ {
@ -515,7 +516,9 @@ void Menu::Draw()
if (ImGui::Button("Check update", ImVec2(Ui::GetSize(3)))) if (ImGui::Button("Check update", ImVec2(Ui::GetSize(3))))
{ {
if (Updater::m_State == UPDATER_IDLE) if (Updater::m_State == UPDATER_IDLE)
{
Updater::m_State = UPDATER_CHECKING; Updater::m_State = UPDATER_CHECKING;
}
} }
ImGui::SameLine(); ImGui::SameLine();

View File

@ -15,50 +15,33 @@ private:
struct m_Overlay struct m_Overlay
{ {
inline static bool bCoord = false; static inline bool bCoord = false;
inline static bool bFPS = false; static inline bool bFPS = false;
inline static int mFPS = 0; static inline int mFPS = 0;
inline static bool bLocName = false; static inline bool bLocName = false;
inline static bool bTransparent = false; static inline bool bTransparent = false;
inline static bool bVehHealth = false; static inline bool bVehHealth = false;
inline static bool bVehSpeed = false; static inline bool bVehSpeed = false;
inline static bool bCpuUsage = false; static inline bool bCpuUsage = false;
inline static float fCpuUsage = 0.0f; static inline float fCpuUsage = 0.0f;
inline static bool bMemUsage = false; static inline bool bMemUsage = false;
inline static float fMemUsage = 0.0f; static inline float fMemUsage = 0.0f;
inline static std::vector<std::string> posNames = { static inline std::vector<std::string> posNames = {
"Custom", "Top left", "Top right", "Bottom left", "Bottom right" "Custom", "Top left", "Top right", "Bottom left", "Bottom right"
}; };
inline static DISPLAY_POS mSelectedPos = DISPLAY_POS::BOTTOM_RIGHT; static inline DISPLAY_POS mSelectedPos = DISPLAY_POS::BOTTOM_RIGHT;
inline static float fPosX = 0.0f; static inline float fPosX = 0.0f;
inline static float fPosY = 0.0f; static inline float fPosY = 0.0f;
inline static size_t mInterval = 1000; static inline size_t mInterval = 1000;
inline static size_t mLastInterval = 0; static inline size_t mLastInterval = 0;
inline static int mTotalRam = 0; static inline int mTotalRam = 0;
}; };
public: public:
struct m_HotKeys
{
inline static HotKeyData aimSkinChanger;
inline static HotKeyData freeCam;
inline static HotKeyData commandWindow;
inline static HotKeyData fixVeh;
inline static HotKeyData flipVeh;
inline static HotKeyData freeCamTeleportPlayer{VK_RETURN,VK_RETURN};
inline static HotKeyData godMode;
inline static HotKeyData menuOpen;
inline static HotKeyData quickSceenShot;
inline static HotKeyData quickTeleport;
inline static HotKeyData vehEngine;
inline static HotKeyData vehInstantStart;
inline static HotKeyData vehInstantStop;
};
struct m_Commands struct m_Commands
{ {
inline static bool m_bShowMenu = false; static inline bool m_bShowMenu = false;
inline static char m_nInputBuffer[INPUT_BUFFER_SIZE] = ""; static inline char m_nInputBuffer[INPUT_BUFFER_SIZE] = "";
}; };
Menu(); Menu();

View File

@ -2,5 +2,5 @@
#define MENU_NAME "Cheat Menu" #define MENU_NAME "Cheat Menu"
#define MENU_VERSION_NUMBER "3.0" #define MENU_VERSION_NUMBER "3.0"
#define MENU_VERSION MENU_VERSION_NUMBER"-beta" #define MENU_VERSION MENU_VERSION_NUMBER"-beta"
#define BUILD_NUMBER "20210913" #define BUILD_NUMBER "20210920"
#define MENU_TITLE MENU_NAME " v" MENU_VERSION "(" BUILD_NUMBER ")" #define MENU_TITLE MENU_NAME " v" MENU_VERSION "(" BUILD_NUMBER ")"

View File

@ -1,7 +0,0 @@
#include "pch.h"
#include "Events.h"
namespace plugin::Events
{
decltype(vehicleResetAfterRender) vehicleResetAfterRender;
}

View File

@ -1,7 +0,0 @@
#pragma once
namespace plugin::Events
{
extern ThiscallEvent<AddressList<0x55332A, H_CALL>, PRIORITY_BEFORE, ArgPickN<CVehicle*, 0>, void(CVehicle*)>
vehicleResetAfterRender;
}

View File

@ -1,7 +1,8 @@
#include "pch.h" #include "pch.h"
#include "Neon.h" #include "neon.h"
#include "Util.h" #include "util.h"
// Neon sprite
const unsigned char neon_mask[1689] = const unsigned char neon_mask[1689] =
{ {
0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00,
@ -160,57 +161,60 @@ const unsigned char neon_mask[1689] =
0x4e, 0x44, 0xae, 0x42, 0x60, 0x82 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82
}; };
void Neon::RenderEvent(CVehicle* pVeh)
{
NeonData* data = &m_VehNeon.Get(pVeh);
if (data->m_bNeonInstalled && !pVeh->IsUpsideDown())
{
CVector Pos = CModelInfo::GetModelInfo(pVeh->m_nModelIndex)->m_pColModel->m_boundBox.m_vecMin;
CVector center = pVeh->TransformFromObjectSpace(CVector(0.0f, 0.0f, 0.0f));
CVector up = pVeh->TransformFromObjectSpace(CVector(0.0f, -Pos.y - data->m_fVal, 0.0f)) - center;
CVector right = pVeh->TransformFromObjectSpace(CVector(Pos.x + data->m_fVal, 0.0f, 0.0f)) - center;
CShadows::StoreShadowToBeRendered(5, m_pNeonTexture, &center, up.x, up.y, right.x, right.y, 180, data->m_Color.r,
data->m_Color.g, data->m_Color.b, 2.0f, false, 1.0f, 0, true);
if (CTimer::m_snTimeInMilliseconds - data->m_nTimer > 150)
{
data->m_nTimer = CTimer::m_snTimeInMilliseconds;
if (data->m_bPulsing)
{
if (data->m_fVal < 0.0f)
data->m_bIncrement = true;
if (data->m_fVal > 0.3f)
data->m_bIncrement = false;
if (data->m_bIncrement)
data->m_fVal += 0.1f;
else
data->m_fVal -= 0.1f;
}
}
}
}
Neon::Neon() Neon::Neon()
{ {
Events::processScriptsEvent += [this] Events::processScriptsEvent += [this]
{ {
if (!m_bMaskLoaded) if (!m_pNeonTexture)
{ {
m_pNeonTexture = Util::LoadTextureFromMemory((char*)neon_mask, sizeof(neon_mask)); m_pNeonTexture = Util::LoadTextureFromMemory((char*)neon_mask, sizeof(neon_mask));
m_bMaskLoaded = true;
} }
}; };
Events::vehicleRenderEvent += RenderEvent; Events::vehicleRenderEvent += [](CVehicle* pVeh)
{
NeonData* data = &m_VehNeon.Get(pVeh);
if (data->m_bNeonInstalled && !pVeh->IsUpsideDown())
{
CVector Pos = CModelInfo::GetModelInfo(pVeh->m_nModelIndex)->m_pColModel->m_boundBox.m_vecMin;
CVector center = pVeh->TransformFromObjectSpace(CVector(0.0f, 0.0f, 0.0f));
CVector up = pVeh->TransformFromObjectSpace(CVector(0.0f, -Pos.y - data->m_fVal, 0.0f)) - center;
CVector right = pVeh->TransformFromObjectSpace(CVector(Pos.x + data->m_fVal, 0.0f, 0.0f)) - center;
CShadows::StoreShadowToBeRendered(5, m_pNeonTexture, &center, up.x, up.y, right.x, right.y, 180, data->m_Color.r,
data->m_Color.g, data->m_Color.b, 2.0f, false, 1.0f, 0, true);
if (CTimer::m_snTimeInMilliseconds - data->m_nTimer > 150)
{
data->m_nTimer = CTimer::m_snTimeInMilliseconds;
if (data->m_bPulsing)
{
if (data->m_fVal < 0.0f)
{
data->m_bIncrement = true;
}
if (data->m_fVal > 0.3f)
{
data->m_bIncrement = false;
}
if (data->m_bIncrement)
{
data->m_fVal += 0.1f;
}
else
{
data->m_fVal -= 0.1f;
}
}
}
}
};
} }
Neon::~Neon() Neon::~Neon()
{ {
Events::vehicleRenderEvent -= RenderEvent;
if (m_pNeonTexture) if (m_pNeonTexture)
{ {
RwTextureDestroy(m_pNeonTexture); RwTextureDestroy(m_pNeonTexture);

View File

@ -23,9 +23,8 @@ private:
} }
}; };
inline static bool m_bMaskLoaded = false; static inline RwTexture* m_pNeonTexture = nullptr; // pointer to the neon mask texture
inline static RwTexture* m_pNeonTexture = nullptr; static inline VehicleExtendedData<NeonData> m_VehNeon;
inline static VehicleExtendedData<NeonData> m_VehNeon;
public: public:
Neon(); Neon();
@ -35,5 +34,4 @@ public:
static bool IsPulsingEnabled(CVehicle* veh); static bool IsPulsingEnabled(CVehicle* veh);
static void SetPulsing(CVehicle* veh, bool state); static void SetPulsing(CVehicle* veh, bool state);
static void RemoveNeon(CVehicle* veh); static void RemoveNeon(CVehicle* veh);
static void RenderEvent(CVehicle* veh);
}; };

View File

@ -23,76 +23,68 @@
// SOFTWARE. // SOFTWARE.
#include "pch.h" #include "pch.h"
#include "Paint.h" #include "paint.h"
#include "NodeName.h" #include "NodeName.h"
#include "Util.h" #include "util.h"
void Paint::RenderEvent(CVehicle* pVeh)
{
VehData& data = m_VehData.Get(pVeh);
// reset custom color if color id changed
if (pVeh->m_nPrimaryColor != data.primary_color
|| pVeh->m_nSecondaryColor != data.secondary_color)
{
for (auto& it : data.materialProperties)
data.resetMaterialColor(it.first);
data.primary_color = pVeh->m_nPrimaryColor;
data.secondary_color = pVeh->m_nSecondaryColor;
}
for (auto& it : data.materialProperties)
{
if (it.second._recolor)
{
it.second._originalColor = it.first->color;
it.first->color = it.second._color;
it.second._originalGeometryFlags = it.second._geometry->flags;
it.second._geometry->flags |= rpGEOMETRYMODULATEMATERIALCOLOR;
}
if (it.second._retexture)
{
auto tex = it.second._texture;
if (tex)
{
it.second._originalTexture = it.first->texture;
it.first->texture = tex;
}
else
{
it.second._retexture = false;
}
}
}
}
void Paint::ResetAfterRenderEvent(CVehicle* pVeh)
{
for (auto& it : m_VehData.Get(pVeh).materialProperties)
{
if (it.second._recolor)
{
it.first->color = it.second._originalColor;
it.second._geometry->flags = it.second._originalGeometryFlags;
}
if (it.second._retexture)
{
it.first->texture = it.second._originalTexture;
}
}
}
Paint::Paint() Paint::Paint()
{ {
Events::vehicleRenderEvent.before += RenderEvent; Events::vehicleRenderEvent.before += [](CVehicle* pVeh)
Events::vehicleResetAfterRender += ResetAfterRenderEvent; {
} VehData& data = m_VehData.Get(pVeh);
Paint::~Paint() // reset custom color if color id changed
{ if (pVeh->m_nPrimaryColor != data.primary_color
Events::vehicleRenderEvent.before -= RenderEvent; || pVeh->m_nSecondaryColor != data.secondary_color)
Events::vehicleResetAfterRender -= ResetAfterRenderEvent; {
for (auto& it : data.materialProperties)
data.resetMaterialColor(it.first);
data.primary_color = pVeh->m_nPrimaryColor;
data.secondary_color = pVeh->m_nSecondaryColor;
}
for (auto& it : data.materialProperties)
{
if (it.second._recolor)
{
it.second._originalColor = it.first->color;
it.first->color = it.second._color;
it.second._originalGeometryFlags = it.second._geometry->flags;
it.second._geometry->flags |= rpGEOMETRYMODULATEMATERIALCOLOR;
}
if (it.second._retexture)
{
auto tex = it.second._texture;
if (tex)
{
it.second._originalTexture = it.first->texture;
it.first->texture = tex;
}
else
{
it.second._retexture = false;
}
}
}
};
ThiscallEvent<AddressList<0x55332A, H_CALL>, PRIORITY_BEFORE, ArgPickN<CVehicle*, 0>, void(CVehicle*)> vehicleResetAfterRender;
vehicleResetAfterRender += [](CVehicle* pVeh)
{
for (auto& it : m_VehData.Get(pVeh).materialProperties)
{
if (it.second._recolor)
{
it.first->color = it.second._originalColor;
it.second._geometry->flags = it.second._originalGeometryFlags;
}
if (it.second._retexture)
{
it.first->texture = it.second._originalTexture;
}
}
};
} }
void Paint::VehData::setMaterialColor(RpMaterial* material, RpGeometry* geometry, RwRGBA color, bool filter_mat) void Paint::VehData::setMaterialColor(RpMaterial* material, RpGeometry* geometry, RwRGBA color, bool filter_mat)

View File

@ -1,5 +1,4 @@
// Portion of this source is taken from MoonAdditions https://github.com/THE-FYP/MoonAdditions // Portion of this source is taken from MoonAdditions https://github.com/THE-FYP/MoonAdditions
// To keep the licensing simple this file would go under MIT License, GPLv3 won't apply
// Copyright (c) 2012 DK22Pac // Copyright (c) 2012 DK22Pac
// Copyright (c) 2017 FYP // Copyright (c) 2017 FYP
@ -70,25 +69,22 @@ private:
void resetMaterialColor(RpMaterial* material); void resetMaterialColor(RpMaterial* material);
void resetMaterialTexture(RpMaterial* material); void resetMaterialTexture(RpMaterial* material);
}; };
inline static VehicleExtendedData<VehData> m_VehData; static inline VehicleExtendedData<VehData> m_VehData;
protected: protected:
inline static ResourceStore m_TextureData { "textures", eResourceType::TYPE_IMAGE, ImVec2(100, 80) }; static inline ResourceStore m_TextureData { "textures", eResourceType::TYPE_IMAGE, ImVec2(100, 80) };
struct veh_nodes struct veh_nodes
{ {
inline static std::vector<std::string> names_vec{"Default"}; static inline std::vector<std::string> names_vec{"Default"};
inline static std::string selected = "Default"; static inline std::string selected = "Default";
}; };
Paint(); Paint();
~Paint();
static void UpdateNodeListRecursive(CVehicle* pVeh); static void UpdateNodeListRecursive(CVehicle* pVeh);
static void NodeWrapperRecursive(RwFrame* frame, CVehicle* pVeh, std::function<void(RwFrame*)> func); static void NodeWrapperRecursive(RwFrame* frame, CVehicle* pVeh, std::function<void(RwFrame*)> func);
static void SetNodeColor(CVehicle* pVeh, std::string node_name, CRGBA color, bool filter_mat = false); static void SetNodeColor(CVehicle* pVeh, std::string node_name, CRGBA color, bool filter_mat = false);
static void SetNodeTexture(CVehicle* pVeh, std::string node_name, std::string texturename, bool filter_mat = false); static void SetNodeTexture(CVehicle* pVeh, std::string node_name, std::string texturename, bool filter_mat = false);
static void ResetNodeColor(CVehicle* veh, std::string node_name); static void ResetNodeColor(CVehicle* veh, std::string node_name);
static void ResetNodeTexture(CVehicle* pVeh, std::string node_name); static void ResetNodeTexture(CVehicle* pVeh, std::string node_name);
static void RenderEvent(CVehicle* pVeh);
static void ResetAfterRenderEvent(CVehicle* pVeh);
}; };

View File

@ -1,9 +1,9 @@
#include "pch.h" #include "pch.h"
#include "Ped.h" #include "ped.h"
#include "Ui.h" #include "ui.h"
#include "Util.h" #include "util.h"
#include "weapon.h"
#include <CPopulation.h> #include <CPopulation.h>
#include "Weapon.h"
#ifdef GTASA #ifdef GTASA
#include <ePedBones.h> #include <ePedBones.h>

View File

@ -1,34 +1,35 @@
#pragma once #pragma once
#include "pch.h" #include "pch.h"
#include "Player.h" #include "player.h"
#ifdef GTASA #ifdef GTASA
#include "Weapon.h" #include "weapon.h"
#endif #endif
class Ped class Ped
{ {
private: private:
#ifdef GTASA #ifdef GTASA
inline static bool m_bBigHead; static inline bool m_bBigHead;
inline static bool m_bThinBody; static inline bool m_bThinBody;
inline static CJson m_SpecialPedJson = CJson("ped special"); static inline CJson m_SpecialPedJson = CJson("ped special");
inline static ResourceStore m_PedData{"ped", eResourceType::TYPE_BOTH, ImVec2(65, 110)}; static inline ResourceStore m_PedData{"ped", eResourceType::TYPE_BOTH, ImVec2(65, 110)};
#elif GTAVC #elif GTAVC
inline static ResourceStore m_PedData{"ped", eResourceType::TYPE_TEXT}; static inline ResourceStore m_PedData{"ped", eResourceType::TYPE_TEXT};
#endif #endif
inline static bool m_bImagesLoaded; static inline bool m_bImagesLoaded;
inline static bool m_bExGangWarsInstalled; static inline bool m_bExGangWarsInstalled;
inline static int m_nPedRemoveRadius = 5; static inline int m_nPedRemoveRadius = 5;
struct m_SpawnPed struct m_SpawnPed
{ {
inline static std::vector<CPed*> m_List; static inline std::vector<CPed*> m_List;
inline static int m_nAccuracy = 50; static inline int m_nAccuracy = 50;
inline static int m_nPedHealth = 100; static inline int m_nPedHealth = 100;
inline static bool m_bPedMove; static inline bool m_bPedMove;
inline static bool m_bPedBleed; static inline bool m_bPedBleed;
inline static int m_nSelectedPedType; static inline int m_nSelectedPedType;
inline static int m_nWeaponId; static inline int m_nWeaponId;
inline static std::string m_nWeaponName = "None"; static inline std::string m_nWeaponName = "None";
inline static std::vector<std::string> m_PedTypeList = static inline std::vector<std::string> m_PedTypeList =
{ {
#ifdef GTASA #ifdef GTASA
"Civ Male", "Civ Female", "Cop", "Ballas", "Grove Street Families", "Los Santos Vagos", "Civ Male", "Civ Female", "Cop", "Ballas", "Grove Street Families", "Los Santos Vagos",
@ -41,7 +42,7 @@ private:
#endif #endif
}; };
}; };
inline static std::vector<std::string> m_GangNames = static inline std::vector<std::string> m_GangNames =
{ {
"Ballas", "Grove street families", "Los santos vagos", "San fierro rifa", "Ballas", "Grove street families", "Los santos vagos", "San fierro rifa",
"Da nang boys", "Mafia", "Mountain cloud triad", "Varrio los aztecas", "Gang9", "Gang10" "Da nang boys", "Mafia", "Mountain cloud triad", "Varrio los aztecas", "Gang9", "Gang10"
@ -51,6 +52,7 @@ private:
#ifdef GTASA #ifdef GTASA
friend class Weapon; friend class Weapon;
#endif #endif
public: public:
Ped(); Ped();
~Ped(); ~Ped();

View File

@ -1,10 +1,10 @@
#include "pch.h" #include "pch.h"
#include "Player.h" #include "player.h"
#include "Menu.h" #include "menu.h"
#include "Ui.h" #include "ui.h"
#include "Util.h" #include "util.h"
#ifdef GTASA #ifdef GTASA
#include "Ped.h" #include "ped.h"
// hardcoded cloth category names // hardcoded cloth category names
const char* cloth_category[18] = const char* cloth_category[18] =
@ -29,7 +29,7 @@ const char* cloth_category[18] =
"Extras" "Extras"
}; };
inline static void PlayerModelBrokenFix() static inline void PlayerModelBrokenFix()
{ {
CPlayerPed* pPlayer = FindPlayerPed(); CPlayerPed* pPlayer = FindPlayerPed();
@ -109,16 +109,16 @@ Player::Player()
#ifdef GTASA #ifdef GTASA
// Fix player model being broken after rebuild // Fix player model being broken after rebuild
patch::RedirectCall(0x5A834D, &PlayerModelBrokenFix); patch::RedirectCall(0x5A834D, &PlayerModelBrokenFix);
m_bAimSkinChanger = config.GetValue("aim_skin_changer", false); m_bAimSkinChanger = gConfig.GetValue("aim_skin_changer", false);
#endif #endif
// Custom skins setup // Custom skins setup
if (GetModuleHandle("modloader.asi")) if (GetModuleHandle("modloader.asi"))
{ {
#ifdef GTASA #ifdef GTASA
if (fs::is_directory(m_CustomSkins::m_Path)) if (std::filesystem::is_directory(m_CustomSkins::m_Path))
{ {
for (auto& p : fs::recursive_directory_iterator(m_CustomSkins::m_Path)) for (auto& p : std::filesystem::recursive_directory_iterator(m_CustomSkins::m_Path))
{ {
if (p.path().extension() == ".dff") if (p.path().extension() == ".dff")
{ {
@ -127,13 +127,13 @@ Player::Player()
if (file_name.size() < 9) if (file_name.size() < 9)
m_CustomSkins::m_List.push_back(file_name); m_CustomSkins::m_List.push_back(file_name);
else else
flog << "Custom Skin longer than 8 characters " << file_name << std::endl; gLog << "Custom Skin longer than 8 characters " << file_name << std::endl;
} }
} }
} }
else else
{ {
fs::create_directory(m_CustomSkins::m_Path); std::filesystem::create_directory(m_CustomSkins::m_Path);
} }
#endif #endif
@ -195,7 +195,7 @@ Player::Player()
TopDownCameraView(); TopDownCameraView();
} }
if (m_bAimSkinChanger && Ui::HotKeyPressed(Menu::m_HotKeys::aimSkinChanger)) if (m_bAimSkinChanger && aimSkinChanger.Pressed())
{ {
CPed* targetPed = player->m_pPlayerTargettedPed; CPed* targetPed = player->m_pPlayerTargettedPed;
if (targetPed) if (targetPed)
@ -206,7 +206,7 @@ Player::Player()
} }
#endif #endif
if (Ui::HotKeyPressed(Menu::m_HotKeys::godMode)) if (godMode.Pressed())
{ {
if (m_bGodMode) if (m_bGodMode)
{ {
@ -646,8 +646,8 @@ void Player::Draw()
if (Ui::CheckboxWithHint("Aim skin changer", &m_bAimSkinChanger, if (Ui::CheckboxWithHint("Aim skin changer", &m_bAimSkinChanger,
(("Changes to the ped, player is targeting with a weapon.\nTo use aim a ped with a weapon and press ") (("Changes to the ped, player is targeting with a weapon.\nTo use aim a ped with a weapon and press ")
+ Ui::GetHotKeyNameString(Menu::m_HotKeys::aimSkinChanger)).c_str())) + aimSkinChanger.Pressed())))
config.SetValue("aim_skin_changer", m_bAimSkinChanger); gConfig.SetValue("aim_skin_changer", m_bAimSkinChanger);
if (ImGui::BeginTabBar("AppearanceTabBar")) if (ImGui::BeginTabBar("AppearanceTabBar"))
{ {
if (ImGui::BeginTabItem("Clothes")) if (ImGui::BeginTabItem("Clothes"))

View File

@ -4,34 +4,34 @@
class Player class Player
{ {
private: private:
inline static bool m_bGodMode; static inline bool m_bGodMode;
inline static bool m_bModloaderInstalled; static inline bool m_bModloaderInstalled;
struct m_KeepPosition struct m_KeepPosition
{ {
inline static bool m_bEnabled = false; static inline bool m_bEnabled = false;
inline static CVector m_fPos; static inline CVector m_fPos;
}; };
#ifdef GTASA #ifdef GTASA
inline static bool m_bAimSkinChanger; static inline bool m_bAimSkinChanger;
inline static bool m_bDrunkEffect; static inline bool m_bDrunkEffect;
inline static bool m_bFastSprint; static inline bool m_bFastSprint;
inline static int m_nUiBodyState; static inline int m_nUiBodyState;
inline static ResourceStore m_ClothData { "clothes" , eResourceType::TYPE_IMAGE, ImVec2(70, 100)}; static inline ResourceStore m_ClothData { "clothes" , eResourceType::TYPE_IMAGE, ImVec2(70, 100)};
struct m_CustomSkins struct m_CustomSkins
{ {
inline static std::string m_Path = paths::GetGameDirPathA() + std::string("\\modloader\\Custom Skins\\");; static inline std::string m_Path = paths::GetGameDirPathA() + std::string("\\modloader\\Custom Skins\\");;
inline static ImGuiTextFilter m_Filter; static inline ImGuiTextFilter m_Filter;
inline static std::vector<std::string> m_List; static inline std::vector<std::string> m_List;
}; };
struct m_TopDownCamera struct m_TopDownCamera
{ {
inline static bool m_bEnabled = false; static inline bool m_bEnabled = false;
inline static float m_fOffset = 40.0f; static inline float m_fOffset = 40.0f;
}; };
#elif GTAVC #elif GTAVC
inline static ResourceStore skinData{ "skin", eResourceType::TYPE_TEXT }; static inline ResourceStore skinData{ "skin", eResourceType::TYPE_TEXT };
#endif #endif
public: public:

View File

@ -1,6 +1,6 @@
#include <string> #include <string>
#include <rw/rwcore.h> #include <rw/rwcore.h>
#include "Json.h" #include "json.h"
#include "../depend/imgui/imgui.h" #include "../depend/imgui/imgui.h"
#include "d3d9.h" #include "d3d9.h"

View File

@ -1,8 +1,8 @@
#include "pch.h" #include "pch.h"
#include "Teleport.h" #include "teleport.h"
#include "Menu.h" #include "menu.h"
#include "Ui.h" #include "ui.h"
#include "Util.h" #include "util.h"
#ifdef GTASA #ifdef GTASA
// FlA // FlA
@ -43,7 +43,7 @@ void Teleport::FetchRadarSpriteData()
Teleport::Teleport() Teleport::Teleport()
{ {
m_bQuickTeleport = config.GetValue("quick_teleport", false); m_bQuickTeleport = gConfig.GetValue("quick_teleport", false);
Events::processScriptsEvent += [] Events::processScriptsEvent += []
{ {
@ -78,7 +78,7 @@ Teleport::Teleport()
if (m_bQuickTeleport) if (m_bQuickTeleport)
{ {
if (Ui::HotKeyPressed(Menu::m_HotKeys::quickTeleport) if (quickTeleport.Pressed()
&& ((CTimer::m_snTimeInMilliseconds - m_nQuickTeleportTimer) > 500)) && ((CTimer::m_snTimeInMilliseconds - m_nQuickTeleportTimer) > 500))
{ {
m_nQuickTeleportTimer = CTimer::m_snTimeInMilliseconds; m_nQuickTeleportTimer = CTimer::m_snTimeInMilliseconds;
@ -195,10 +195,10 @@ void Teleport::Draw()
ImGui::NextColumn(); ImGui::NextColumn();
#ifdef GTASA #ifdef GTASA
if (Ui::CheckboxWithHint("Quick teleport", &m_bQuickTeleport, if (Ui::CheckboxWithHint("Quick teleport", &m_bQuickTeleport,
(std::string("Teleport to the location of your radar\ntarget blip using ") std::string(std::string("Teleport to the location of your radar\ntarget blip using ")
+ Ui::GetHotKeyNameString(Menu::m_HotKeys::quickTeleport)).c_str())) + quickTeleport.GetNameString()).c_str()))
{ {
config.SetValue("quick_teleport", m_bQuickTeleport); gConfig.SetValue("quick_teleport", m_bQuickTeleport);
} }
#endif #endif
ImGui::Columns(1); ImGui::Columns(1);

View File

@ -5,22 +5,22 @@
class Teleport class Teleport
{ {
private: private:
inline static bool m_bInsertCoord; static inline bool m_bInsertCoord;
inline static bool m_bQuickTeleport; static inline bool m_bQuickTeleport;
inline static char m_nInputBuffer[INPUT_BUFFER_SIZE]; static inline char m_nInputBuffer[INPUT_BUFFER_SIZE];
inline static ResourceStore m_tpData{ "teleport", eResourceType::TYPE_TEXT }; static inline ResourceStore m_tpData{ "teleport", eResourceType::TYPE_TEXT };
inline static char m_nLocationBuffer[INPUT_BUFFER_SIZE]; static inline char m_nLocationBuffer[INPUT_BUFFER_SIZE];
inline static uint m_nQuickTeleportTimer; static inline uint m_nQuickTeleportTimer;
#ifdef GTASA #ifdef GTASA
inline static CJson m_SpriteJson = CJson("radar sprite"); static inline CJson m_SpriteJson = CJson("radar sprite");
#endif #endif
struct m_Teleport struct m_Teleport
{ {
inline static bool m_bEnabled; static inline bool m_bEnabled;
inline static CVector m_fPos = { -1, -1, -1 }; static inline CVector m_fPos = { -1, -1, -1 };
inline static uint m_nTimer; static inline uint m_nTimer;
}; };

View File

@ -1,6 +1,6 @@
#include "pch.h" #include "pch.h"
#include "Util.h" #include "util.h"
#include "Ui.h" #include "ui.h"
bool Ui::ListBox(const char* label, std::vector<std::string>& all_items, int& selected) bool Ui::ListBox(const char* label, std::vector<std::string>& all_items, int& selected)
{ {
@ -108,7 +108,7 @@ void Ui::DrawHeaders(CallbackTable& data)
{ {
const char* btn_text = it->first.c_str(); const char* btn_text = it->first.c_str();
if (btn_text == Globals::m_HeaderId) if (btn_text == m_HeaderId)
{ {
colors[ImGuiCol_Button] = colors[ImGuiCol_ButtonActive]; colors[ImGuiCol_Button] = colors[ImGuiCol_ButtonActive];
func = it->second; func = it->second;
@ -117,8 +117,8 @@ void Ui::DrawHeaders(CallbackTable& data)
if (ImGui::Button(btn_text, GetSize(3, false))) if (ImGui::Button(btn_text, GetSize(3, false)))
{ {
Globals::m_HeaderId = btn_text; m_HeaderId = btn_text;
config.SetValue("window.id", Globals::m_HeaderId); gConfig.SetValue("window.id", m_HeaderId);
func = it->second; func = it->second;
} }
@ -131,7 +131,7 @@ void Ui::DrawHeaders(CallbackTable& data)
ImGui::PopStyleVar(); ImGui::PopStyleVar();
ImGui::Dummy(ImVec2(0, 10)); ImGui::Dummy(ImVec2(0, 10));
if (Globals::m_HeaderId == "") if (m_HeaderId == "")
{ {
// Show Welcome page // Show Welcome page
ImGui::NewLine(); ImGui::NewLine();
@ -541,7 +541,7 @@ void Ui::DrawImages(ResourceStore &store, std::function<void(std::string&)> onLe
Couldn't figure out how to laod images for Dx11 Couldn't figure out how to laod images for Dx11
Using texts for now Using texts for now
*/ */
if (Globals::renderer == Render_DirectX11) if (gRenderer == Render_DirectX11)
{ {
if (ImGui::MenuItem(modelName.c_str())) if (ImGui::MenuItem(modelName.c_str()))
{ {
@ -563,7 +563,7 @@ void Ui::DrawImages(ResourceStore &store, std::function<void(std::string&)> onLe
imgPopup.value = modelName; imgPopup.value = modelName;
} }
if (Globals::renderer != Render_DirectX11) if (gRenderer != Render_DirectX11)
{ {
if (ImGui::IsItemHovered()) if (ImGui::IsItemHovered())
{ {
@ -853,109 +853,6 @@ void Ui::EditFloat(const char* label, const int address, const float min, const
} }
} }
bool Ui::HotKey(const char* label, HotKeyData& key_data)
{
bool active = m_CurrentHotkey == label;
bool state = false;
if (active)
{
ImGui::PushStyleColor(ImGuiCol_Button, ImGui::GetStyle().Colors[ImGuiCol_ButtonActive]);
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImGui::GetStyle().Colors[ImGuiCol_ButtonActive]);
for (int key = 3; key != 135; ++key)
{
if (KeyPressed(key))
{
key_data.m_key1 = key;
break;
}
}
for (int key = 135; key != 3; --key)
{
if (KeyPressed(key))
{
key_data.m_key2 = key;
break;
}
}
}
std::string text;
if (key_data.m_key1 != VK_NONE)
text = key_names[key_data.m_key1 - 1];
else
text = "None";
if (key_data.m_key1 != key_data.m_key2)
text += (" + " + key_names[key_data.m_key2 - 1]);
if (ImGui::Button((text + std::string("##") + std::string(label)).c_str(),
ImVec2(ImGui::GetWindowContentRegionWidth() / 3.5, ImGui::GetFrameHeight())))
if (!active)
m_CurrentHotkey = label;
if (active && ImGui::IsMouseClicked(ImGuiMouseButton_Left))
{
m_CurrentHotkey = "";
state = true;
}
if (ImGui::IsMouseClicked(ImGuiMouseButton_Right))
{
if (ImGui::IsItemHovered())
{
key_data.m_key1 = VK_NONE;
key_data.m_key2 = VK_NONE;
}
else
m_CurrentHotkey = "";
state = true;
}
ImGui::SameLine();
ImGui::Text(label);
if (active)
ImGui::PopStyleColor(2);
return state;
}
bool Ui::HotKeyPressed(HotKeyData& hotkey)
{
if (KeyPressed(hotkey.m_key1) && KeyPressed(hotkey.m_key2))
hotkey.m_bPressed = true;
else
{
if (hotkey.m_bPressed)
{
hotkey.m_bPressed = false;
return m_CurrentHotkey == "";
}
}
return false;
}
std::string Ui::GetHotKeyNameString(HotKeyData& hotkey)
{
std::string text;
if (hotkey.m_key1 != VK_NONE)
text = key_names[hotkey.m_key1 - 1];
else
text = "None";
if (hotkey.m_key1 != hotkey.m_key2)
text += (" + " + key_names[hotkey.m_key2 - 1]);
return text;
}
bool Ui::ColorButton(int color_id, std::vector<float>& color, ImVec2 size) bool Ui::ColorButton(int color_id, std::vector<float>& color, ImVec2 size)
{ {
bool rtn = false; bool rtn = false;

View File

@ -3,9 +3,6 @@
class Ui class Ui
{ {
private:
inline static std::string m_CurrentHotkey;
public: public:
struct NamedMemory struct NamedMemory
{ {
@ -32,9 +29,13 @@ public:
std::function<void(std::string&)> function; std::function<void(std::string&)> function;
std::string value; std::string value;
}; };
static inline std::string m_HeaderId;
static inline JsonPopUpData jsonPopup;
static inline ImgPopUpData imgPopup;
inline static JsonPopUpData jsonPopup;
inline static ImgPopUpData imgPopup; Ui() = delete;
Ui(Ui&) = delete;
static void CenterdText(const std::string& text); static void CenterdText(const std::string& text);
static bool ColorButton(int color_id, std::vector<float>& color, ImVec2 size); static bool ColorButton(int color_id, std::vector<float>& color, ImVec2 size);
@ -74,10 +75,6 @@ public:
static ImVec2 GetSize(short count = 1, bool spacing = true); static ImVec2 GetSize(short count = 1, bool spacing = true);
static bool HotKey(const char* label, HotKeyData& key_data);
static bool HotKeyPressed(HotKeyData& hotkey);
static std::string GetHotKeyNameString(HotKeyData& hotkey);
static bool ListBox(const char* label, std::vector<std::string>& all_items, int& selected); static bool ListBox(const char* label, std::vector<std::string>& all_items, int& selected);
static bool ListBoxStr(const char* label, std::vector<std::string>& all_items, std::string& selected); static bool ListBoxStr(const char* label, std::vector<std::string>& all_items, std::string& selected);
static bool ListBoxCustomNames(const char* label, std::vector<std::string>& all_items, std::string& selected, const char* custom_names[] = nullptr, size_t length = 0); static bool ListBoxCustomNames(const char* label, std::vector<std::string>& all_items, std::string& selected, const char* custom_names[] = nullptr, size_t length = 0);

View File

@ -1,8 +1,8 @@
#include "pch.h" #include "pch.h"
#include "Updater.h" #include "updater.h"
#include "Ui.h" #include "ui.h"
#include "MenuInfo.h" #include "menuinfo.h"
#include "Util.h" #include "util.h"
void Updater::CheckForUpdate() void Updater::CheckForUpdate()
{ {

View File

@ -11,8 +11,8 @@ enum UPDATER_STATE
class Updater class Updater
{ {
public: public:
inline static UPDATER_STATE m_State = UPDATER_IDLE; static inline UPDATER_STATE m_State = UPDATER_IDLE;
inline static std::string m_LatestVersion; static inline std::string m_LatestVersion;
static void CheckForUpdate(); static void CheckForUpdate();
static void ShowUpdateScreen(); static void ShowUpdateScreen();

View File

@ -1,5 +1,5 @@
#include "pch.h" #include "pch.h"
#include "Util.h" #include "util.h"
#include "psapi.h" #include "psapi.h"
std::string Util::GetLocationName(CVector* pos) std::string Util::GetLocationName(CVector* pos)

View File

@ -1,9 +1,9 @@
#include "pch.h" #include "pch.h"
#include "Vehicle.h" #include "vehicle.h"
#include "Menu.h" #include "menu.h"
#include "Ui.h" #include "ui.h"
#include "Util.h" #include "util.h"
#include "FileHandler.h" #include "filehandler.h"
#include <CPopulation.h> #include <CPopulation.h>
#include <CDamageManager.h> #include <CDamageManager.h>
@ -47,7 +47,7 @@ Vehicle::Vehicle()
int hveh = CPools::GetVehicleRef(pVeh); int hveh = CPools::GetVehicleRef(pVeh);
#ifdef GTASA #ifdef GTASA
if (Ui::HotKeyPressed(Menu::m_HotKeys::flipVeh)) if (flipVeh.Pressed())
{ {
int roll = 0; int roll = 0;
Command<Commands::GET_CAR_ROLL>(hveh, &roll); Command<Commands::GET_CAR_ROLL>(hveh, &roll);
@ -57,13 +57,13 @@ Vehicle::Vehicle()
} }
#endif #endif
if (Ui::HotKeyPressed(Menu::m_HotKeys::fixVeh)) if (fixVeh.Pressed())
{ {
FixVehicle(pVeh); FixVehicle(pVeh);
SetHelpMessage("Vehicle fixed", false, false, false); SetHelpMessage("Vehicle fixed", false, false, false);
} }
if (Ui::HotKeyPressed(Menu::m_HotKeys::vehEngine)) if (vehEngine.Pressed())
{ {
bool state = BY_GAME(!pVeh->m_nVehicleFlags.bEngineBroken, true) || pVeh->m_nVehicleFlags.bEngineOn; bool state = BY_GAME(!pVeh->m_nVehicleFlags.bEngineBroken, true) || pVeh->m_nVehicleFlags.bEngineOn;
@ -81,10 +81,10 @@ Vehicle::Vehicle()
pVeh->m_nVehicleFlags.bEngineOn = !state; pVeh->m_nVehicleFlags.bEngineOn = !state;
} }
if (Ui::HotKeyPressed(Menu::m_HotKeys::vehInstantStart)) if (vehInstantStart.Pressed())
Command<Commands::SET_CAR_FORWARD_SPEED>(hveh, 40.0f); Command<Commands::SET_CAR_FORWARD_SPEED>(hveh, 40.0f);
if (Ui::HotKeyPressed(Menu::m_HotKeys::vehInstantStop)) if (vehInstantStop.Pressed())
Command<Commands::SET_CAR_FORWARD_SPEED>(hveh, 0); Command<Commands::SET_CAR_FORWARD_SPEED>(hveh, 0);
if (m_bNoDamage) if (m_bNoDamage)
@ -219,7 +219,7 @@ void Vehicle::AddComponent(const std::string& component, const bool display_mess
} }
catch (...) catch (...)
{ {
flog << "Failed to component to vehicle " << component << std::endl; gLog << "Failed to component to vehicle " << component << std::endl;
} }
} }
@ -241,7 +241,7 @@ void Vehicle::RemoveComponent(const std::string& component, const bool display_m
} }
catch (...) catch (...)
{ {
flog << "Failed to remove component from vehicle " << component << std::endl; gLog << "Failed to remove component from vehicle " << component << std::endl;
} }
} }
@ -1048,7 +1048,7 @@ void Vehicle::Draw()
ImGui::EndTabItem(); ImGui::EndTabItem();
} }
#ifdef GTASA #ifdef GTASA
if (Globals::renderer != Render_DirectX11) if (gRenderer != Render_DirectX11)
{ {
if (ImGui::BeginTabItem("Neons")) if (ImGui::BeginTabItem("Neons"))
{ {

View File

@ -1,8 +1,8 @@
#pragma once #pragma once
#include "pch.h" #include "pch.h"
#ifdef GTASA #ifdef GTASA
#include "Neon.h" #include "neon.h"
#include "Paint.h" #include "paint.h"
#endif #endif
#ifdef GTASA #ifdef GTASA
@ -12,60 +12,60 @@ class Vehicle
#endif #endif
{ {
private: private:
inline static bool m_bBikeFly; static inline bool m_bBikeFly;
inline static bool m_bDontFallBike; static inline bool m_bDontFallBike;
inline static bool m_bVehHeavy; static inline bool m_bVehHeavy;
inline static bool m_bVehWatertight; static inline bool m_bVehWatertight;
inline static bool m_bNoDamage; static inline bool m_bNoDamage;
inline static int m_nDoorMenuButton; static inline int m_nDoorMenuButton;
inline static std::string m_DoorNames[6] = static inline std::string m_DoorNames[6] =
{ "Hood", "Boot", "Front left door", "Front right door", "Rear left door", "Rear right door" }; { "Hood", "Boot", "Front left door", "Front right door", "Rear left door", "Rear right door" };
inline static int m_nVehRemoveRadius; static inline int m_nVehRemoveRadius;
inline static bool m_bLockSpeed; static inline bool m_bLockSpeed;
inline static float m_fLockSpeed; static inline float m_fLockSpeed;
inline static std::vector<std::vector<float>> m_CarcolsColorData; static inline std::vector<std::vector<float>> m_CarcolsColorData;
inline static std::map<std::string, std::vector<int>> m_CarcolsCarData; static inline std::map<std::string, std::vector<int>> m_CarcolsCarData;
struct m_Color struct m_Color
{ {
inline static bool m_bMatFilter = true; static inline bool m_bMatFilter = true;
inline static int m_nRadioButton = 1; static inline int m_nRadioButton = 1;
inline static bool bShowAll; static inline bool bShowAll;
inline static float m_fColorPicker[3]{ 0, 0, 0 }; static inline float m_fColorPicker[3]{ 0, 0, 0 };
}; };
#ifdef GTASA #ifdef GTASA
inline static bool m_bDisableColDetection; static inline bool m_bDisableColDetection;
inline static std::map<int, std::string> m_VehicleIDE; static inline std::map<int, std::string> m_VehicleIDE;
struct m_Neon struct m_Neon
{ {
inline static float m_fColorPicker[3]{ 0, 0, 0 }; static inline float m_fColorPicker[3]{ 0, 0, 0 };
inline static bool m_bRainbowEffect; static inline bool m_bRainbowEffect;
inline static uint m_nRainbowTimer; static inline uint m_nRainbowTimer;
inline static bool m_bApplyOnTraffic; static inline bool m_bApplyOnTraffic;
inline static uint m_bTrafficTimer; static inline uint m_bTrafficTimer;
}; };
inline static ResourceStore m_TuneData { "components", eResourceType::TYPE_IMAGE, ImVec2(100, 80) }; static inline ResourceStore m_TuneData { "components", eResourceType::TYPE_IMAGE, ImVec2(100, 80) };
#endif #endif
struct m_Spawner struct m_Spawner
{ {
#ifdef GTASA #ifdef GTASA
inline static ResourceStore m_VehData { "vehicles", eResourceType::TYPE_IMAGE, ImVec2(100, 75)}; static inline ResourceStore m_VehData { "vehicles", eResourceType::TYPE_IMAGE, ImVec2(100, 75)};
#elif GTAVC #elif GTAVC
inline static ResourceStore m_VehData{"vehicle", eResourceType::TYPE_TEXT}; static inline ResourceStore m_VehData{"vehicle", eResourceType::TYPE_TEXT};
#endif #endif
inline static bool m_bSpawnInside = true; static inline bool m_bSpawnInside = true;
inline static bool m_bSpawnInAir = true; static inline bool m_bSpawnInAir = true;
inline static char m_nLicenseText[9]; static inline char m_nLicenseText[9];
}; };
struct m_UnlimitedNitro struct m_UnlimitedNitro
{ {
inline static bool m_bEnabled; static inline bool m_bEnabled;
inline static bool m_bCompAdded; static inline bool m_bCompAdded;
}; };
#ifdef GTASA #ifdef GTASA
inline static std::vector<std::string>(m_HandlingFlagNames) = // 32 flags static inline std::vector<std::string>(m_HandlingFlagNames) = // 32 flags
{ {
"1G_BOOST", "2G_BOOST", "NPC_ANTI_ROLL", "NPC_NEUTRAL_HANDL", "NO_HANDBRAKE", "STEER_REARWHEELS", "1G_BOOST", "2G_BOOST", "NPC_ANTI_ROLL", "NPC_NEUTRAL_HANDL", "NO_HANDBRAKE", "STEER_REARWHEELS",
"HB_REARWHEEL_STEER", "ALT_STEER_OPT", "HB_REARWHEEL_STEER", "ALT_STEER_OPT",
@ -77,7 +77,7 @@ private:
"Unused 4" "Unused 4"
}; };
inline static std::vector<std::string>(m_ModelFlagNames) = // 32 flags static inline std::vector<std::string>(m_ModelFlagNames) = // 32 flags
{ {
"IS_VAN", "IS_BUS", "IS_LOW", "IS_BIG", "REVERSE_BONNET", "HANGING_BOOT", "TAILGATE_BOOT", "NOSWING_BOOT", "IS_VAN", "IS_BUS", "IS_LOW", "IS_BIG", "REVERSE_BONNET", "HANGING_BOOT", "TAILGATE_BOOT", "NOSWING_BOOT",
"NO_DOORS", "TANDEM_SEATS", "NO_DOORS", "TANDEM_SEATS",

View File

@ -1,9 +1,9 @@
#include "pch.h" #include "pch.h"
#include "Visual.h" #include "visual.h"
#include "Ui.h" #include "ui.h"
#include "Util.h" #include "util.h"
#include "Game.h" #include "game.h"
#include "TimeCycle.h" #include "timecycle.h"
#ifdef GTASA #ifdef GTASA
#include "CHudColours.h" #include "CHudColours.h"
@ -531,11 +531,7 @@ void Visual::Draw()
int hour = CClock::ms_nGameClockHours; int hour = CClock::ms_nGameClockHours;
int minute = CClock::ms_nGameClockMinutes; int minute = CClock::ms_nGameClockMinutes;
if (Game::m_bSyncTime) ImGui::BeginDisabled(Game::m_bSyncTime);
{
ImGui::PushItemFlag(ImGuiItemFlags_Disabled, true);
ImGui::PushStyleVar(ImGuiStyleVar_Alpha, ImGui::GetStyle().Alpha * 0.5f);
}
if (ImGui::InputInt("Hour", &hour) & !Game::m_bSyncTime) if (ImGui::InputInt("Hour", &hour) & !Game::m_bSyncTime)
{ {
@ -553,8 +549,7 @@ void Visual::Draw()
if (Game::m_bSyncTime) if (Game::m_bSyncTime)
{ {
ImGui::PopStyleVar(); ImGui::EndDisabled();
ImGui::PopItemFlag();
Ui::ShowTooltip("Sync system time is enabled.\n(Game/Sync system time)"); Ui::ShowTooltip("Sync system time is enabled.\n(Game/Sync system time)");
} }

View File

@ -3,17 +3,17 @@
class Visual class Visual
{ {
private: private:
inline static bool m_bLockWeather; static inline bool m_bLockWeather;
inline static int m_nBacWeatherType; static inline int m_nBacWeatherType;
#ifdef GTASA #ifdef GTASA
inline static bool m_bInvisibleWater; static inline bool m_bInvisibleWater;
inline static bool m_bNoWater; static inline bool m_bNoWater;
inline static bool m_bDisableHydrant; static inline bool m_bDisableHydrant;
#endif #endif
// Timecyc // Timecyc
inline static int m_nTimecycHour = 8; static inline int m_nTimecycHour = 8;
inline static std::vector<std::string> m_WeatherNames static inline std::vector<std::string> m_WeatherNames
{ {
"EXTRASUNNY LA", "SUNNY LA", "EXTRASUNNY SMOG LA", "SUNNY SMOG LA", "CLOUDY LA", "SUNNY SF", "EXTRASUNNY SF", "EXTRASUNNY LA", "SUNNY LA", "EXTRASUNNY SMOG LA", "SUNNY SMOG LA", "CLOUDY LA", "SUNNY SF", "EXTRASUNNY SF",
"CLOUDY SF", "RAINY SF", "FOGGY SF", "CLOUDY SF", "RAINY SF", "FOGGY SF",

View File

@ -1,8 +1,8 @@
#include "pch.h" #include "pch.h"
#include "Weapon.h" #include "weapon.h"
#include "Ui.h" #include "ui.h"
#include "Util.h" #include "util.h"
#include "Ped.h" #include "ped.h"
#include "CWeaponInfo.h" #include "CWeaponInfo.h"
Weapon::Weapon() Weapon::Weapon()

View File

@ -5,27 +5,27 @@ class Weapon
{ {
public: public:
#ifdef GTASA #ifdef GTASA
inline static ResourceStore m_WeaponData{ "weapon", eResourceType::TYPE_BOTH, ImVec2(65, 65) }; static inline ResourceStore m_WeaponData{ "weapon", eResourceType::TYPE_BOTH, ImVec2(65, 65) };
inline static bool m_bAutoAim; static inline bool m_bAutoAim;
inline static bool m_bRapidFire; static inline bool m_bRapidFire;
inline static bool m_bDualWeild; static inline bool m_bDualWeild;
inline static bool m_bMoveAim; static inline bool m_bMoveAim;
inline static bool m_bMoveFire; static inline bool m_bMoveFire;
inline static int m_nSelectedGang; static inline int m_nSelectedGang;
#elif GTAVC #elif GTAVC
inline static ResourceStore m_WeaponData{ "weapon", eResourceType::TYPE_TEXT }; static inline ResourceStore m_WeaponData{ "weapon", eResourceType::TYPE_TEXT };
inline static bool m_bInfiniteAmmo; static inline bool m_bInfiniteAmmo;
#endif #endif
inline static bool m_bFastReload; static inline bool m_bFastReload;
inline static bool m_bHugeDamage; static inline bool m_bHugeDamage;
inline static bool m_bLongRange; static inline bool m_bLongRange;
inline static int m_nAmmoCount = 99999; static inline int m_nAmmoCount = 99999;
inline static uchar m_nCurrentWeaponSlot = -1; static inline uchar m_nCurrentWeaponSlot = -1;
inline static int m_nSelectedWeapon; static inline int m_nSelectedWeapon;
#ifdef GTASA #ifdef GTASA
inline static int m_nGangWeaponList[10][3] = static inline int m_nGangWeaponList[10][3] =
{ {
{WEAPON_PISTOL, WEAPON_MICRO_UZI, WEAPON_UNARMED}, // Ballas {WEAPON_PISTOL, WEAPON_MICRO_UZI, WEAPON_UNARMED}, // Ballas
{WEAPON_PISTOL, WEAPON_UNARMED, WEAPON_UNARMED}, // Grove {WEAPON_PISTOL, WEAPON_UNARMED, WEAPON_UNARMED}, // Grove

95
src/dllmain.cpp Normal file
View File

@ -0,0 +1,95 @@
#include "pch.h"
#include "hook.h"
#include "cheatmenu.h"
#include "updater.h"
#include "menuinfo.h"
void MenuThread(void* param)
{
if (!std::filesystem::is_directory(PLUGIN_PATH((char*)"CheatMenu")))
{
gLog << "CheatMenu folder not found. You need to put both \"CheatMenu.asi\" & \"CheatMenu\" folder in the same directory" << std::endl;
return;
}
static bool bGameInit = false;
#ifdef GTASA
Hook::ApplyMouseFix();
#endif
// Wait till game init
Events::initRwEvent += []
{
bGameInit = true;
};
while (!bGameInit)
{
Sleep(1000);
}
/*
TODO: Find a better way
Since you could still name it something else
*/
if (GetModuleHandle("SAMP.dll") || GetModuleHandle("SAMP.asi"))
{
MessageBox(RsGlobal.ps->window, "SAMP detected. Exiting CheatMenu.", "CheatMenu", MB_ICONERROR);
return;
}
gLog << "Starting...\nVersion: " MENU_TITLE "\nAuthor: Grinch_\nDiscord: " DISCORD_INVITE "\nMore Info: "
GITHUB_LINK "\n" << std::endl;
CFastman92limitAdjuster::Init();
CheatMenu menu;
time_t now = time(0);
struct tm tstruct = *localtime(&now);
int last_check_date = gConfig.GetValue("config.last_update_checked", 0);
if (last_check_date != tstruct.tm_mday)
{
Updater::CheckForUpdate();
gConfig.SetValue("config.last_update_checked", tstruct.tm_mday);
}
while (true)
{
Sleep(5000);
if (Updater::m_State == UPDATER_CHECKING)
{
Updater::CheckForUpdate();
}
}
}
BOOL WINAPI DllMain(HINSTANCE hDllHandle, DWORD nReason, LPVOID Reserved)
{
if (nReason == DLL_PROCESS_ATTACH)
{
uint gameVersion = GetGameVersion();
#ifdef GTASA
if (gameVersion == GAME_10US_HOODLUM || gameVersion == GAME_10US_COMPACT)
{
CreateThread(nullptr, NULL, (LPTHREAD_START_ROUTINE)&MenuThread, nullptr, NULL, nullptr);
}
else
{
MessageBox(HWND_DESKTOP, "Unknown game version. GTA SA v1.0 US is required.", "CheatMenu", MB_ICONERROR);
}
#elif GTAVC
if (gameVersion == GAME_10EN)
{
CreateThread(nullptr, NULL, (LPTHREAD_START_ROUTINE)&MenuThread, nullptr, NULL, nullptr);
}
else
{
MessageBox(HWND_DESKTOP, "Unknown game version. GTA VC v1.0 EN is required.", "CheatMenu", MB_ICONERROR);
}
#endif
}
return TRUE;
}

View File

@ -1,57 +0,0 @@
#include <d3d9.h>
#include <d3d11.h>
#include <d3d11Shader.h>
#include <filesystem>
#include <fstream>
#include <functional>
#include <memory>
#include <iostream>
#include <sstream>
#include <vector>
#include <windows.h>
#include "plugin.h"
#include "CBike.h"
#include "CCamera.h"
#include "CClock.h"
#include "CCivilianPed.h"
#include "CGangs.h"
#include "cHandlingDataMgr.h"
#include "CHud.h"
#include "CMenuManager.h"
#include "CModelInfo.h"
#include "RenderWare.h"
#include "CStats.h"
#include "CStreaming.h"
#include "CTheScripts.h"
#include "CTheZones.h"
#include "CTimer.h"
#include "CTimeCycle.h"
#include "CTrain.h"
#include "CWeather.h"
#include "CWorld.h"
#include "extensions/ScriptCommands.h"
#include "extensions/Screen.h"
#include "extensions/Paths.h"
#ifdef GTASA
#include "CCheat.h"
#include "CClothes.h"
#include "CCutsceneMgr.h"
#include "CRadar.h"
#include "CShadows.h"
#include "eVehicleClass.h"
#include "CGangWars.h"
#endif
#include "../Depend/fla/IDaccess.h"
#include "../Depend/imgui/imgui.h"
#include "../Depend/imgui/imgui_internal.h"
#include "../Depend/imgui/imgui_impl_dx9.h"
#include "../Depend/imgui/imgui_impl_dx11.h"
#include "../Depend/imgui/imgui_impl_win32.h"
#include "MoreEvents.h"
#include "Json.h"
#include "VKeys.h"
#include "ResourceStore.h"

138
src/hotkeys.cpp Normal file
View File

@ -0,0 +1,138 @@
#include "pch.h"
#include "hotkeys.h"
Hotkey aimSkinChanger(VK_KEY_N, VK_KEY_N);
Hotkey freeCam(VK_LCONTROL, VK_KEY_C);
Hotkey commandWindow(VK_LCONTROL, VK_KEY_V);
Hotkey fixVeh(VK_DELETE, VK_DELETE);
Hotkey flipVeh(VK_KEY_Z, VK_KEY_Z);
Hotkey freeCamTeleportPlayer(VK_LCONTROL, VK_TAB);
Hotkey godMode(VK_KEY_E, VK_KEY_E);
Hotkey menuOpen(VK_KEY_E, VK_KEY_E);
Hotkey quickSceenShot(VK_KEY_E, VK_KEY_E);
Hotkey quickTeleport(VK_KEY_E, VK_KEY_E);
Hotkey vehEngine(VK_KEY_E, VK_KEY_E);
Hotkey vehInstantStart(VK_KEY_E, VK_KEY_E);
Hotkey vehInstantStop(VK_KEY_E, VK_KEY_E);
bool Hotkey::DrawUI(const char* label)
{
bool active = m_CurrentHotkey == label;
bool state = false;
if (active)
{
ImGui::PushStyleColor(ImGuiCol_Button, ImGui::GetStyle().Colors[ImGuiCol_ButtonActive]);
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImGui::GetStyle().Colors[ImGuiCol_ButtonActive]);
for (int key = 3; key != 135; ++key)
{
if (KeyPressed(key))
{
m_key1 = key;
break;
}
}
for (int key = 135; key != 3; --key)
{
if (KeyPressed(key))
{
m_key2 = key;
break;
}
}
}
std::string text;
if (m_key1 != VK_NONE)
{
text = key_names[m_key1 - 1];
}
else
{
text = "None";
}
if (m_key1 != m_key2)
{
text += (" + " + key_names[m_key2 - 1]);
}
if (ImGui::Button((text + std::string("##") + std::string(label)).c_str(),
ImVec2(ImGui::GetWindowContentRegionWidth() / 3.5, ImGui::GetFrameHeight())))
{
if (!active)
{
m_CurrentHotkey = label;
}
}
if (active && ImGui::IsMouseClicked(ImGuiMouseButton_Left))
{
m_CurrentHotkey = "";
state = true;
}
if (ImGui::IsMouseClicked(ImGuiMouseButton_Right))
{
if (ImGui::IsItemHovered())
{
m_key1 = VK_NONE;
m_key2 = VK_NONE;
}
else
{
m_CurrentHotkey = "";
}
state = true;
}
ImGui::SameLine();
ImGui::Text(label);
if (active)
{
ImGui::PopStyleColor(2);
}
return state;
}
bool Hotkey::Pressed()
{
if (KeyPressed(m_key1) && KeyPressed(m_key2))
m_bPressed = true;
else
{
if (m_bPressed)
{
m_bPressed = false;
return m_CurrentHotkey == "";
}
}
return false;
}
std::string Hotkey::GetNameString()
{
std::string text;
if (m_key1 != VK_NONE)
{
text = key_names[m_key1 - 1];
}
else
{
text = "None";
}
if (m_key1 != m_key2)
{
text += (" + " + key_names[m_key2 - 1]);
}
return text;
}

36
src/hotkeys.h Normal file
View File

@ -0,0 +1,36 @@
#pragma once
#include <string>
class Hotkey
{
private:
static inline std::string m_CurrentHotkey;
bool m_bPressed;
public:
int m_key1;
int m_key2;
Hotkey(int key1, int key2)
: m_key1(key1), m_key2(key2)
{}
// Draws ui to change the hotkeys from frontend
bool DrawUI(const char* label);
bool Pressed();
std::string GetNameString();
};
extern Hotkey aimSkinChanger;
extern Hotkey freeCam;
extern Hotkey commandWindow;
extern Hotkey fixVeh;
extern Hotkey flipVeh;
extern Hotkey freeCamTeleportPlayer;
extern Hotkey godMode;
extern Hotkey menuOpen;
extern Hotkey quickSceenShot;
extern Hotkey quickTeleport;
extern Hotkey vehEngine;
extern Hotkey vehInstantStart;
extern Hotkey vehInstantStop;

View File

@ -1,3 +1,2 @@
#include "pch.h" #include "pch.h"
std::ofstream flog = std::ofstream("CheatMenu.log"); CJson gConfig = CJson("config");
CJson config = CJson("config");

View File

@ -12,42 +12,77 @@
#define BY_GAME(sa, vc) vc #define BY_GAME(sa, vc) vc
#endif #endif
#include "header_includes.h" #include <d3d9.h>
#include <d3d11.h>
#include <d3d11Shader.h>
#include <filesystem>
#include <fstream>
#include <functional>
#include <memory>
#include <iostream>
#include <sstream>
#include <vector>
#include <windows.h>
#include "plugin.h"
#include "CBike.h"
#include "CCamera.h"
#include "CClock.h"
#include "CCivilianPed.h"
#include "CGangs.h"
#include "cHandlingDataMgr.h"
#include "CHud.h"
#include "CMenuManager.h"
#include "CModelInfo.h"
#include "RenderWare.h"
#include "CStats.h"
#include "CStreaming.h"
#include "CTheScripts.h"
#include "CTheZones.h"
#include "CTimer.h"
#include "CTimeCycle.h"
#include "CTrain.h"
#include "CWeather.h"
#include "CWorld.h"
#include "extensions/ScriptCommands.h"
#include "extensions/Screen.h"
#include "extensions/Paths.h"
#ifdef GTASA
#include "CCheat.h"
#include "CClothes.h"
#include "CCutsceneMgr.h"
#include "CRadar.h"
#include "CShadows.h"
#include "eVehicleClass.h"
#include "CGangWars.h"
#endif
#include "../depend/fla/IDaccess.h"
#include "../depend/imgui/imgui.h"
#include "json.h"
#include "hotkeys.h"
#include "vKeys.h"
#include "resourcestore.h"
// Globals
using CallbackTable = std::vector<std::pair<std::string, void(*)()>>; using CallbackTable = std::vector<std::pair<std::string, void(*)()>>;
using namespace plugin; using namespace plugin;
namespace fs = std::filesystem;
enum Renderer enum eRenderer
{ {
Render_DirectX9, Render_DirectX9,
Render_DirectX11, Render_DirectX11,
Render_Unknown Render_Unknown
}; };
struct Globals static eRenderer gRenderer = Render_Unknown;
{ static std::ofstream gLog = std::ofstream("CheatMenu.log");
inline static std::string m_HeaderId; // why doesn't this work?
inline static ImVec2 m_fMenuSize = ImVec2(screen::GetScreenWidth() / 4, screen::GetScreenHeight() / 1.2); // inline CJson gConfig = CJson("config");
inline static ImVec2 m_fScreenSize = ImVec2(-1, -1); extern CJson gConfig;
inline static bool m_bShowMenu = false;
inline static bool m_bInit;
inline static Renderer renderer = Render_Unknown;
inline static void* device;
};
extern std::ofstream flog; // Fix function clashes
extern CJson config;
struct HotKeyData
{
int m_key1;
int m_key2;
bool m_bPressed;
};
// Common defines
static void SetHelpMessage(const char *message, bool b1, bool b2, bool b3) static void SetHelpMessage(const char *message, bool b1, bool b2, bool b3)
{ {
#if GTAVC #if GTAVC