[VC] Add don't lose clothes on wasted/busted

This commit is contained in:
Grinch_ 2022-08-06 00:49:09 +06:00
parent 8db76a2ce7
commit 9e1b5db4d9
13 changed files with 80 additions and 15 deletions

View File

@ -368,6 +368,8 @@ NeedCJSkin = "You need to be in CJ skin"
NeverGetHungry = "Never get hungry" NeverGetHungry = "Never get hungry"
NeverWanted = "Never wanted" NeverWanted = "Never wanted"
NoFee = "No arrest fee" NoFee = "No arrest fee"
NoUndress = "Don't lose clothes"
NoUndressTip = "Don't lose clothes after being busted/wasted"
PedSkinsTab = "Ped skins" PedSkinsTab = "Ped skins"
PlayerFlags = "Player flags," PlayerFlags = "Player flags,"
PlayerRegen = "Player regeneration" PlayerRegen = "Player regeneration"

View File

@ -237,7 +237,7 @@ void CheatMenu::Init()
return; return;
} }
if (!D3dHook::InjectHook(DrawWindow)) if (!D3dHook::Init(DrawWindow))
{ {
return; return;
} }

View File

@ -21,9 +21,9 @@ private:
}; };
static inline eMenuPages m_nMenuPage = eMenuPages::WELCOME; // current visible menu page 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 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<HeaderData> m_headerList; static inline std::vector<HeaderData> m_headerList;
// Applies imgui theme to the menu // Applies imgui theme to the menu
@ -44,8 +44,13 @@ public:
CheatMenu() = delete; CheatMenu() = delete;
CheatMenu(const CheatMenu&) = delete; CheatMenu(const CheatMenu&) = delete;
// Initilizes the menu, page, hooks etc
static void Init(); static void Init();
// Returns true if the menu is being shown
static bool IsMenuShown(); static bool IsMenuShown();
// Resets the menu height & width to default
static void ResetMenuSize(); static void ResetMenuSize();
// Generates menu headers // Generates menu headers

View File

@ -253,7 +253,7 @@ void D3dHook::ProcessMouse()
} }
} }
bool D3dHook::InjectHook(void *pCallback) bool D3dHook::Init(void *pCallback)
{ {
static bool hookInjected; static bool hookInjected;
if (hookInjected) if (hookInjected)
@ -291,7 +291,7 @@ bool D3dHook::InjectHook(void *pCallback)
return hookInjected; return hookInjected;
} }
void D3dHook::RemoveHook() void D3dHook::Shutdown()
{ {
pCallbackFunc = nullptr; pCallbackFunc = nullptr;
SetWindowLongPtr(RsGlobal.ps->window, GWL_WNDPROC, (LRESULT)oWndProc); SetWindowLongPtr(RsGlobal.ps->window, GWL_WNDPROC, (LRESULT)oWndProc);

View File

@ -36,8 +36,15 @@ public:
D3dHook(D3dHook const&) = delete; D3dHook(D3dHook const&) = delete;
void operator=(D3dHook const&) = delete; void operator=(D3dHook const&) = delete;
// Returns the current mouse visibility state
static bool GetMouseState(); 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); static void SetMouseState(bool state);
// Cleans up hooks
static void Shutdown();
}; };

View File

@ -28,6 +28,11 @@ void Menu::ShowPage()
static int selected = Locale::GetCurrentLocaleIndex(); static int selected = Locale::GetCurrentLocaleIndex();
static std::vector<std::string>& vec = Locale::GetLocaleList(); static std::vector<std::string>& 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" if (Locale::GetLocaleList()[Locale::GetCurrentLocaleIndex()] == "Chinese"
&& !FontMgr::IsSupportPackageInstalled()) && !FontMgr::IsSupportPackageInstalled())
{ {

View File

@ -1,16 +1,23 @@
#pragma once #pragma once
#include "pch.h" #include "pch.h"
/*
Menu Class
Handles code for the Menu page
*/
class Menu class Menu
{ {
public: public:
static inline bool m_bAutoCheckUpdate; static inline bool m_bAutoCheckUpdate; // Should updates be checked automatically
static inline bool m_bDiscordRPC; static inline bool m_bDiscordRPC; // Is the discord rich presence enabled
static inline bool m_bTextOnlyMode; static inline bool m_bTextOnlyMode; // Hide all menu images mode
Menu() = delete; Menu() = delete;
Menu(const Menu&) = delete; Menu(const Menu&) = delete;
// Inits the class
static void Init(); static void Init();
// Displays the menu page
static void ShowPage(); static void ShowPage();
}; };

View File

@ -178,7 +178,7 @@ static RwTexture* LoadTextureFromMemory(char* data, unsigned int size)
return RwTextureCreate(raster); return RwTextureCreate(raster);
} }
void Neon::InjectHooks() void Neon::Init()
{ {
static bool init; static bool init;
if (init) if (init)
@ -235,7 +235,7 @@ void Neon::InjectHooks()
init = true; init = true;
} }
void Neon::RemoveHooks() void Neon::Shutdown()
{ {
if (m_pNeonTexture) if (m_pNeonTexture)
{ {

View File

@ -36,7 +36,7 @@ public:
Neon(Neon&) = delete; Neon(Neon&) = delete;
// Injects necessary hooks into the game // Injects necessary hooks into the game
static void InjectHooks(); static void Init();
// Installs neons with color // Installs neons with color
static void Install(CVehicle* veh, int r, int g, int b); static void Install(CVehicle* veh, int r, int g, int b);
@ -51,7 +51,7 @@ public:
static void SetPulsing(CVehicle* veh, bool state); static void SetPulsing(CVehicle* veh, bool state);
// Removes the neon game hooks // Removes the neon game hooks
static void RemoveHooks(); static void Shutdown();
// Removes neon from vehicle // Removes neon from vehicle
static void Remove(CVehicle* veh); static void Remove(CVehicle* veh);

View File

@ -447,6 +447,39 @@ void Player::ShowPage()
patch::Set<float>(0x8D2458, m_bFastSprint ? 0.1f : 5.0f); patch::Set<float>(0x8D2458, m_bFastSprint ? 0.1f : 5.0f);
} }
ImGui::EndDisabled(); 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 #endif
Widget::CheckboxAddr(TEXT("Player.FreeHealthcare"), (int)&pInfo->m_bGetOutOfHospitalFree); Widget::CheckboxAddr(TEXT("Player.FreeHealthcare"), (int)&pInfo->m_bGetOutOfHospitalFree);
@ -575,6 +608,7 @@ void Player::ShowPage()
} }
#endif #endif
Widget::CheckboxAddr(TEXT("Player.NoFee"), (int)&pInfo->m_bGetOutOfJailFree); Widget::CheckboxAddr(TEXT("Player.NoFee"), (int)&pInfo->m_bGetOutOfJailFree);
Widget::Checkbox(TEXT("Player.RespawnDieLoc"), &KeepPosition::m_bEnabled, TEXT("Player.RespawnDieLocTip")); Widget::Checkbox(TEXT("Player.RespawnDieLoc"), &KeepPosition::m_bEnabled, TEXT("Player.RespawnDieLocTip"));
Widget::Checkbox(TEXT("Player.PlayerRegen"), &m_bPlayerRegen, TEXT("Player.PlayerRegenTip")); Widget::Checkbox(TEXT("Player.PlayerRegen"), &m_bPlayerRegen, TEXT("Player.PlayerRegenTip"));
#ifdef GTASA #ifdef GTASA

View File

@ -14,6 +14,10 @@ private:
}; };
static inline bool m_bFreezeWantedLevel; static inline bool m_bFreezeWantedLevel;
#ifdef GTAVC
static inline bool m_bNoUndress;
#endif
#ifdef GTASA #ifdef GTASA
static inline bool m_bAimSkinChanger; static inline bool m_bAimSkinChanger;
static inline bool m_bDrunkEffect; static inline bool m_bDrunkEffect;

View File

@ -35,6 +35,7 @@ public:
Teleport() = delete; Teleport() = delete;
Teleport(const Teleport&) = delete; Teleport(const Teleport&) = delete;
// Initialized the class, hooks etc.
static void Init(); static void Init();
// Warp player to position, marker, map etc // Warp player to position, marker, map etc

View File

@ -18,7 +18,7 @@ void Vehicle::Init()
{ {
#ifdef GTASA #ifdef GTASA
FileHandler::FetchHandlingID(m_VehicleIDE); FileHandler::FetchHandlingID(m_VehicleIDE);
Neon::InjectHooks(); Neon::Init();
Paint::InjectHooks(); Paint::InjectHooks();
#endif #endif