diff --git a/resource/common/locale/English.toml b/resource/common/locale/English.toml index 61afc0c..bdd7b70 100644 --- a/resource/common/locale/English.toml +++ b/resource/common/locale/English.toml @@ -368,6 +368,8 @@ NeedCJSkin = "You need to be in CJ skin" NeverGetHungry = "Never get hungry" NeverWanted = "Never wanted" NoFee = "No arrest fee" +NoUndress = "Don't lose clothes" +NoUndressTip = "Don't lose clothes after being busted/wasted" PedSkinsTab = "Ped skins" PlayerFlags = "Player flags," PlayerRegen = "Player regeneration" diff --git a/src/cheatmenu.cpp b/src/cheatmenu.cpp index 7cb8350..e7337d0 100644 --- a/src/cheatmenu.cpp +++ b/src/cheatmenu.cpp @@ -237,7 +237,7 @@ void CheatMenu::Init() return; } - if (!D3dHook::InjectHook(DrawWindow)) + if (!D3dHook::Init(DrawWindow)) { return; } diff --git a/src/cheatmenu.h b/src/cheatmenu.h index 8d9b1c2..8acea97 100644 --- a/src/cheatmenu.h +++ b/src/cheatmenu.h @@ -21,9 +21,9 @@ private: }; static inline eMenuPages m_nMenuPage = eMenuPages::WELCOME; // current visible menu page - static inline bool m_bShowMenu = false; + static inline bool m_bShowMenu = false; // should the menu be drawn static inline ImVec2 m_fMenuSize = ImVec2(screen::GetScreenWidth() / 4, screen::GetScreenHeight() / 1.2); - static inline bool m_bSizeChangedExternal = false; // Was menu size change requested + static inline bool m_bSizeChangedExternal = false; // Was menu size change requested static inline std::vector m_headerList; // Applies imgui theme to the menu @@ -44,8 +44,13 @@ public: CheatMenu() = delete; CheatMenu(const CheatMenu&) = delete; + // Initilizes the menu, page, hooks etc static void Init(); + + // Returns true if the menu is being shown static bool IsMenuShown(); + + // Resets the menu height & width to default static void ResetMenuSize(); // Generates menu headers diff --git a/src/d3dhook.cpp b/src/d3dhook.cpp index 0738a01..d626147 100644 --- a/src/d3dhook.cpp +++ b/src/d3dhook.cpp @@ -253,7 +253,7 @@ void D3dHook::ProcessMouse() } } -bool D3dHook::InjectHook(void *pCallback) +bool D3dHook::Init(void *pCallback) { static bool hookInjected; if (hookInjected) @@ -291,7 +291,7 @@ bool D3dHook::InjectHook(void *pCallback) return hookInjected; } -void D3dHook::RemoveHook() +void D3dHook::Shutdown() { pCallbackFunc = nullptr; SetWindowLongPtr(RsGlobal.ps->window, GWL_WNDPROC, (LRESULT)oWndProc); diff --git a/src/d3dhook.h b/src/d3dhook.h index eaef9ef..85e4509 100644 --- a/src/d3dhook.h +++ b/src/d3dhook.h @@ -36,8 +36,15 @@ public: D3dHook(D3dHook const&) = delete; void operator=(D3dHook const&) = delete; + // Returns the current mouse visibility state static bool GetMouseState(); - static bool InjectHook(void *pCallback); - static void RemoveHook(); + + // Injects game hooks & stuff + static bool Init(void *pCallback); + + // Sets the current mouse visibility state static void SetMouseState(bool state); + + // Cleans up hooks + static void Shutdown(); }; diff --git a/src/menu.cpp b/src/menu.cpp index b10f3bc..fb1b72d 100644 --- a/src/menu.cpp +++ b/src/menu.cpp @@ -28,6 +28,11 @@ void Menu::ShowPage() static int selected = Locale::GetCurrentLocaleIndex(); static std::vector& vec = Locale::GetLocaleList(); + + /* + Chinese fonts is huge & adds overhead + Only download & use it if the user asks for it + */ if (Locale::GetLocaleList()[Locale::GetCurrentLocaleIndex()] == "Chinese" && !FontMgr::IsSupportPackageInstalled()) { diff --git a/src/menu.h b/src/menu.h index e913067..d7d8df9 100644 --- a/src/menu.h +++ b/src/menu.h @@ -1,16 +1,23 @@ #pragma once #include "pch.h" +/* + Menu Class + Handles code for the Menu page +*/ class Menu { public: - static inline bool m_bAutoCheckUpdate; - static inline bool m_bDiscordRPC; - static inline bool m_bTextOnlyMode; + static inline bool m_bAutoCheckUpdate; // Should updates be checked automatically + static inline bool m_bDiscordRPC; // Is the discord rich presence enabled + static inline bool m_bTextOnlyMode; // Hide all menu images mode Menu() = delete; Menu(const Menu&) = delete; + // Inits the class static void Init(); + + // Displays the menu page static void ShowPage(); }; diff --git a/src/neon.cpp b/src/neon.cpp index 9be0cea..bb7b2e5 100644 --- a/src/neon.cpp +++ b/src/neon.cpp @@ -178,7 +178,7 @@ static RwTexture* LoadTextureFromMemory(char* data, unsigned int size) return RwTextureCreate(raster); } -void Neon::InjectHooks() +void Neon::Init() { static bool init; if (init) @@ -235,7 +235,7 @@ void Neon::InjectHooks() init = true; } -void Neon::RemoveHooks() +void Neon::Shutdown() { if (m_pNeonTexture) { diff --git a/src/neon.h b/src/neon.h index 915b67a..b6783c3 100644 --- a/src/neon.h +++ b/src/neon.h @@ -36,7 +36,7 @@ public: Neon(Neon&) = delete; // Injects necessary hooks into the game - static void InjectHooks(); + static void Init(); // Installs neons with color static void Install(CVehicle* veh, int r, int g, int b); @@ -51,7 +51,7 @@ public: static void SetPulsing(CVehicle* veh, bool state); // Removes the neon game hooks - static void RemoveHooks(); + static void Shutdown(); // Removes neon from vehicle static void Remove(CVehicle* veh); diff --git a/src/player.cpp b/src/player.cpp index 333cd0b..12d1038 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -447,6 +447,39 @@ void Player::ShowPage() patch::Set(0x8D2458, m_bFastSprint ? 0.1f : 5.0f); } ImGui::EndDisabled(); +#endif +#ifdef GTAVC + if (Widget::Checkbox(TEXT("Player.NoUndress"), &m_bNoUndress, TEXT("Player.NoUndressTip"))) + { + if (m_bNoUndress) + { + // pop ecx + patch::SetUChar(0x42BDC5, 0x59); + patch::SetUChar(0x42C1B0, 0x59); + patch::SetUChar(0x42C3B2, 0x59); + patch::SetUChar(0x42BDC5, 0x59); + patch::SetUChar(0x42C1B0, 0x59); + patch::SetUChar(0x42C3B2, 0x59); + // nop Undress() + patch::RedirectShortJump(0x42BDC6, (void*)0x42BDE1); + patch::RedirectShortJump(0x42C1B1, (void*)0x42C1CC); + patch::RedirectShortJump(0x42C3B3, (void*)0x42C3CE); + // nop Dress() + patch::RedirectShortJump(0x42BDC6, (void*)0x42BE05); + patch::RedirectShortJump(0x42C1B1, (void*)0x42C1F0); + patch::RedirectShortJump(0x42C3B3, (void*)0x42C3F2); + } + else + { + // restore + patch::SetRaw(0x42BDC5, (void*)"\x0F\xB6\x05\xFB\x0A\xA1", 6); + patch::SetRaw(0x42C1B0, (void*)"\x0F\xB6\x05\xFB\x0A\xA1", 6); + patch::SetRaw(0x42C3B2, (void*)"\x0F\xB6\x05\xFB\x0A\xA1", 6); + patch::SetRaw(0x42BDC5, (void*)"\x0F\xB6\x05\xFB\x0A\xA1", 6); + patch::SetRaw(0x42C1B0, (void*)"\x0F\xB6\x05\xFB\x0A\xA1", 6); + patch::SetRaw(0x42C3B2, (void*)"\x0F\xB6\x05\xFB\x0A\xA1", 6); + } + } #endif Widget::CheckboxAddr(TEXT("Player.FreeHealthcare"), (int)&pInfo->m_bGetOutOfHospitalFree); @@ -575,6 +608,7 @@ void Player::ShowPage() } #endif Widget::CheckboxAddr(TEXT("Player.NoFee"), (int)&pInfo->m_bGetOutOfJailFree); + Widget::Checkbox(TEXT("Player.RespawnDieLoc"), &KeepPosition::m_bEnabled, TEXT("Player.RespawnDieLocTip")); Widget::Checkbox(TEXT("Player.PlayerRegen"), &m_bPlayerRegen, TEXT("Player.PlayerRegenTip")); #ifdef GTASA diff --git a/src/player.h b/src/player.h index 8d2b067..f10e3f4 100644 --- a/src/player.h +++ b/src/player.h @@ -14,6 +14,10 @@ private: }; static inline bool m_bFreezeWantedLevel; +#ifdef GTAVC + static inline bool m_bNoUndress; +#endif + #ifdef GTASA static inline bool m_bAimSkinChanger; static inline bool m_bDrunkEffect; diff --git a/src/teleport.h b/src/teleport.h index 24fcd18..dc2c6d2 100644 --- a/src/teleport.h +++ b/src/teleport.h @@ -35,6 +35,7 @@ public: Teleport() = delete; Teleport(const Teleport&) = delete; + // Initialized the class, hooks etc. static void Init(); // Warp player to position, marker, map etc diff --git a/src/vehicle.cpp b/src/vehicle.cpp index 84e0ff3..431365a 100644 --- a/src/vehicle.cpp +++ b/src/vehicle.cpp @@ -18,7 +18,7 @@ void Vehicle::Init() { #ifdef GTASA FileHandler::FetchHandlingID(m_VehicleIDE); - Neon::InjectHooks(); + Neon::Init(); Paint::InjectHooks(); #endif