diff --git a/Depend/fla/IDaccess.cpp b/depend/fla/IDaccess.cpp similarity index 100% rename from Depend/fla/IDaccess.cpp rename to depend/fla/IDaccess.cpp diff --git a/Depend/fla/IDaccess.h b/depend/fla/IDaccess.h similarity index 100% rename from Depend/fla/IDaccess.h rename to depend/fla/IDaccess.h diff --git a/Depend/fla/Library/Library.cpp b/depend/fla/Library/Library.cpp similarity index 100% rename from Depend/fla/Library/Library.cpp rename to depend/fla/Library/Library.cpp diff --git a/Depend/fla/Library/Library.h b/depend/fla/Library/Library.h similarity index 100% rename from Depend/fla/Library/Library.h rename to depend/fla/Library/Library.h diff --git a/Depend/fla/Main.cpp b/depend/fla/Main.cpp similarity index 100% rename from Depend/fla/Main.cpp rename to depend/fla/Main.cpp diff --git a/Depend/fla/Main.h b/depend/fla/Main.h similarity index 100% rename from Depend/fla/Main.h rename to depend/fla/Main.h diff --git a/Depend/fla/common/CValueExtension.h b/depend/fla/common/CValueExtension.h similarity index 100% rename from Depend/fla/common/CValueExtension.h rename to depend/fla/common/CValueExtension.h diff --git a/Depend/fla/common/CdDirectory.h b/depend/fla/common/CdDirectory.h similarity index 100% rename from Depend/fla/common/CdDirectory.h rename to depend/fla/common/CdDirectory.h diff --git a/Depend/fla/common/common.h b/depend/fla/common/common.h similarity index 100% rename from Depend/fla/common/common.h rename to depend/fla/common/common.h diff --git a/Depend/imgui/imconfig.h b/depend/imgui/imconfig.h similarity index 100% rename from Depend/imgui/imconfig.h rename to depend/imgui/imconfig.h diff --git a/Depend/imgui/imgui.cpp b/depend/imgui/imgui.cpp similarity index 100% rename from Depend/imgui/imgui.cpp rename to depend/imgui/imgui.cpp diff --git a/Depend/imgui/imgui.h b/depend/imgui/imgui.h similarity index 100% rename from Depend/imgui/imgui.h rename to depend/imgui/imgui.h diff --git a/Depend/imgui/imgui_demo.cpp b/depend/imgui/imgui_demo.cpp similarity index 100% rename from Depend/imgui/imgui_demo.cpp rename to depend/imgui/imgui_demo.cpp diff --git a/Depend/imgui/imgui_draw.cpp b/depend/imgui/imgui_draw.cpp similarity index 100% rename from Depend/imgui/imgui_draw.cpp rename to depend/imgui/imgui_draw.cpp diff --git a/Depend/imgui/imgui_impl_dx11.cpp b/depend/imgui/imgui_impl_dx11.cpp similarity index 100% rename from Depend/imgui/imgui_impl_dx11.cpp rename to depend/imgui/imgui_impl_dx11.cpp diff --git a/Depend/imgui/imgui_impl_dx11.h b/depend/imgui/imgui_impl_dx11.h similarity index 100% rename from Depend/imgui/imgui_impl_dx11.h rename to depend/imgui/imgui_impl_dx11.h diff --git a/Depend/imgui/imgui_impl_dx9.cpp b/depend/imgui/imgui_impl_dx9.cpp similarity index 100% rename from Depend/imgui/imgui_impl_dx9.cpp rename to depend/imgui/imgui_impl_dx9.cpp diff --git a/Depend/imgui/imgui_impl_dx9.h b/depend/imgui/imgui_impl_dx9.h similarity index 100% rename from Depend/imgui/imgui_impl_dx9.h rename to depend/imgui/imgui_impl_dx9.h diff --git a/Depend/imgui/imgui_impl_win32.cpp b/depend/imgui/imgui_impl_win32.cpp similarity index 100% rename from Depend/imgui/imgui_impl_win32.cpp rename to depend/imgui/imgui_impl_win32.cpp diff --git a/Depend/imgui/imgui_impl_win32.h b/depend/imgui/imgui_impl_win32.h similarity index 100% rename from Depend/imgui/imgui_impl_win32.h rename to depend/imgui/imgui_impl_win32.h diff --git a/Depend/imgui/imgui_internal.h b/depend/imgui/imgui_internal.h similarity index 100% rename from Depend/imgui/imgui_internal.h rename to depend/imgui/imgui_internal.h diff --git a/Depend/imgui/imgui_tables.cpp b/depend/imgui/imgui_tables.cpp similarity index 100% rename from Depend/imgui/imgui_tables.cpp rename to depend/imgui/imgui_tables.cpp diff --git a/Depend/imgui/imgui_widgets.cpp b/depend/imgui/imgui_widgets.cpp similarity index 100% rename from Depend/imgui/imgui_widgets.cpp rename to depend/imgui/imgui_widgets.cpp diff --git a/Depend/imgui/imstb_rectpack.h b/depend/imgui/imstb_rectpack.h similarity index 100% rename from Depend/imgui/imstb_rectpack.h rename to depend/imgui/imstb_rectpack.h diff --git a/Depend/imgui/imstb_textedit.h b/depend/imgui/imstb_textedit.h similarity index 100% rename from Depend/imgui/imstb_textedit.h rename to depend/imgui/imstb_textedit.h diff --git a/Depend/imgui/imstb_truetype.h b/depend/imgui/imstb_truetype.h similarity index 100% rename from Depend/imgui/imstb_truetype.h rename to depend/imgui/imstb_truetype.h diff --git a/Depend/json.hpp b/depend/json.hpp similarity index 100% rename from Depend/json.hpp rename to depend/json.hpp diff --git a/Depend/kiero/kiero.cpp b/depend/kiero/kiero.cpp similarity index 100% rename from Depend/kiero/kiero.cpp rename to depend/kiero/kiero.cpp diff --git a/Depend/kiero/kiero.h b/depend/kiero/kiero.h similarity index 100% rename from Depend/kiero/kiero.h rename to depend/kiero/kiero.h diff --git a/Depend/kiero/minhook/MinHook.h b/depend/kiero/minhook/MinHook.h similarity index 100% rename from Depend/kiero/minhook/MinHook.h rename to depend/kiero/minhook/MinHook.h diff --git a/Depend/kiero/minhook/buffer.c b/depend/kiero/minhook/buffer.c similarity index 100% rename from Depend/kiero/minhook/buffer.c rename to depend/kiero/minhook/buffer.c diff --git a/Depend/kiero/minhook/buffer.h b/depend/kiero/minhook/buffer.h similarity index 100% rename from Depend/kiero/minhook/buffer.h rename to depend/kiero/minhook/buffer.h diff --git a/Depend/kiero/minhook/hde/hde32.c b/depend/kiero/minhook/hde/hde32.c similarity index 100% rename from Depend/kiero/minhook/hde/hde32.c rename to depend/kiero/minhook/hde/hde32.c diff --git a/Depend/kiero/minhook/hde/hde32.h b/depend/kiero/minhook/hde/hde32.h similarity index 100% rename from Depend/kiero/minhook/hde/hde32.h rename to depend/kiero/minhook/hde/hde32.h diff --git a/Depend/kiero/minhook/hde/pstdint.h b/depend/kiero/minhook/hde/pstdint.h similarity index 100% rename from Depend/kiero/minhook/hde/pstdint.h rename to depend/kiero/minhook/hde/pstdint.h diff --git a/Depend/kiero/minhook/hde/table32.h b/depend/kiero/minhook/hde/table32.h similarity index 100% rename from Depend/kiero/minhook/hde/table32.h rename to depend/kiero/minhook/hde/table32.h diff --git a/Depend/kiero/minhook/hook.c b/depend/kiero/minhook/hook.c similarity index 100% rename from Depend/kiero/minhook/hook.c rename to depend/kiero/minhook/hook.c diff --git a/Depend/kiero/minhook/trampoline.c b/depend/kiero/minhook/trampoline.c similarity index 100% rename from Depend/kiero/minhook/trampoline.c rename to depend/kiero/minhook/trampoline.c diff --git a/Depend/kiero/minhook/trampoline.h b/depend/kiero/minhook/trampoline.h similarity index 100% rename from Depend/kiero/minhook/trampoline.h rename to depend/kiero/minhook/trampoline.h diff --git a/src/cheatmenu.h b/src/cheatmenu.h index 980cfb0..414a7ea 100644 --- a/src/cheatmenu.h +++ b/src/cheatmenu.h @@ -9,16 +9,16 @@ */ #pragma once -#include "Animation.h" -#include "Hook.h" -#include "Menu.h" -#include "Teleport.h" -#include "Player.h" -#include "Ped.h" -#include "Vehicle.h" -#include "Weapon.h" -#include "Game.h" -#include "Visual.h" +#include "animation.h" +#include "hook.h" +#include "menu.h" +#include "teleport.h" +#include "player.h" +#include "ped.h" +#include "vehicle.h" +#include "weapon.h" +#include "game.h" +#include "visual.h" class CheatMenu : Hook, Animation, Game, Menu, Ped, Player, Teleport, Vehicle, Visual, Weapon { diff --git a/src/dllmain.cpp b/src/dllmain.cpp index bd9233a..4b80d5c 100644 --- a/src/dllmain.cpp +++ b/src/dllmain.cpp @@ -6,17 +6,24 @@ void MenuThread(void* param) { + /* + Had to put this in place since some people put the folder in root + directory and the asi in modloader. Why?? + + TODO: Unlikely they'd even read the log so have to do something else + */ 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 + static bool bGameInit = false; + // Wait till game init Events::initRwEvent += [] { @@ -43,11 +50,13 @@ void MenuThread(void* param) CFastman92limitAdjuster::Init(); CheatMenu menu; + + // Checking for updates once a day time_t now = time(0); struct tm tstruct = *localtime(&now); - int last_check_date = gConfig.GetValue("config.last_update_checked", 0); + int lastCheckDate = gConfig.GetValue("config.last_update_checked", 0); - if (last_check_date != tstruct.tm_mday) + if (lastCheckDate != tstruct.tm_mday) { Updater::CheckForUpdate(); gConfig.SetValue("config.last_update_checked", tstruct.tm_mday); @@ -70,7 +79,7 @@ BOOL WINAPI DllMain(HINSTANCE hDllHandle, DWORD nReason, LPVOID Reserved) { uint gameVersion = GetGameVersion(); #ifdef GTASA - if (gameVersion == GAME_10US_HOODLUM || gameVersion == GAME_10US_COMPACT) + if (gameVersion == GAME_10US_HOODLUM) { CreateThread(nullptr, NULL, (LPTHREAD_START_ROUTINE)&MenuThread, nullptr, NULL, nullptr); } @@ -79,7 +88,6 @@ BOOL WINAPI DllMain(HINSTANCE hDllHandle, DWORD nReason, LPVOID Reserved) 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); diff --git a/src/game.cpp b/src/game.cpp index c8ac8e1..f386414 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -107,6 +107,7 @@ Game::Game() CStats::SetStatValue(STAT_STAMINA, 0.0f); } + static int m_nSolidWaterObj; if (m_bSolidWater) { CVector pos = pPlayer->GetPosition(); @@ -130,13 +131,13 @@ Game::Game() Command(m_nSolidWaterObj, pos.x, pos.y, waterHeight); } } - else + } + else + { + if (m_nSolidWaterObj) { - if (m_nSolidWaterObj != 0) - { - Command(m_nSolidWaterObj); - m_nSolidWaterObj = 0; - } + Command(m_nSolidWaterObj); + m_nSolidWaterObj = 0; } } @@ -160,7 +161,8 @@ Game::Game() #endif // improve this later - if (m_bSyncTime && timer - m_nSyncTimer > 50) + static uint syncTimer; + if (m_bSyncTime && timer - syncTimer > 50) { std::time_t t = std::time(nullptr); std::tm* now = std::localtime(&t); @@ -168,7 +170,7 @@ Game::Game() CClock::ms_nGameClockHours = now->tm_hour; CClock::ms_nGameClockMinutes = now->tm_min; - m_nSyncTimer = timer; + syncTimer = timer; } #ifdef GTASA @@ -492,15 +494,8 @@ Lowers armour, health, stamina etc.")) Ui::CheckboxWithHint("Screenshot shortcut", &m_bScreenShot, (("Take screenshot using ") + quickSceenShot.GetNameString() + "\nSaved inside 'GTA San Andreas User Files\\Gallery'").c_str()); - if (Ui::CheckboxWithHint("Solid water", &m_bSolidWater, - "Player can walk on water\nTurn this off if you want to swim.")) - { - if (!m_bSolidWater && m_nSolidWaterObj != 0) - { - Command(m_nSolidWaterObj); - m_nSolidWaterObj = 0; - } - } + Ui::CheckboxWithHint("Solid water", &m_bSolidWater, + "Player can walk on water\nTurn this off if you want to swim."); #endif if (ImGui::Checkbox("Sync system time", &m_bSyncTime)) { @@ -652,7 +647,8 @@ Lowers armour, health, stamina etc.")) { ImGui::Spacing(); - if (!m_bMissionLoaderWarningShown) + static bool bMissionLoaderWarningShown; + if (!bMissionLoaderWarningShown) { ImGui::TextWrapped("Mission loader may cause,\n\ 1. Game crashes\n\ @@ -662,7 +658,9 @@ Lowers armour, health, stamina etc.")) It's recommanded not to save after using the mission loader. Use it at your own risk!"); ImGui::Spacing(); if (ImGui::Button("Show mission loader", ImVec2(Ui::GetSize()))) - m_bMissionLoaderWarningShown = true; + { + bMissionLoaderWarningShown = true; + } } else { diff --git a/src/game.h b/src/game.h index bbbd6dd..f7f6fa2 100644 --- a/src/game.h +++ b/src/game.h @@ -5,11 +5,15 @@ class Game public: static inline ResourceStore m_MissionData{ "mission", eResourceType::TYPE_TEXT }; + static inline bool m_bDisableCheats; + static inline bool m_bDisableReplay; + static inline bool m_bMissionTimer; + static inline bool m_bFreezeTime; + static inline bool m_bSyncTime; #ifdef GTASA - static inline bool m_bForbiddenArea = true; - static inline bool m_bSolidWater; + static inline bool m_bForbiddenArea = true; // wanted level when going outside playable aea + static inline bool m_bSolidWater; // walk on water hack static inline bool m_bScreenShot; - static inline uint m_nSolidWaterObj; static inline bool m_bKeepStuff; static inline ResourceStore m_StatData{ "stat", eResourceType::TYPE_TEXT }; @@ -50,19 +54,13 @@ public: }; #endif - static inline bool m_bDisableCheats; - static inline bool m_bDisableReplay; - static inline bool m_bMissionTimer; - static inline bool m_bFreezeTime; - static inline bool m_bSyncTime; - static inline uint m_nSyncTimer; - static inline bool m_bMissionLoaderWarningShown; Game(); static void Draw(); static void RealTimeClock(); #ifdef GTASA + // TODO: Update freecam with aap's code static void FreeCam(); static void ClearFreecamStuff(); #endif diff --git a/src/visual.cpp b/src/visual.cpp index dfec33b..4b83d06 100644 --- a/src/visual.cpp +++ b/src/visual.cpp @@ -21,11 +21,16 @@ Visual::Visual() Events::processScriptsEvent += [] { // TODO: Needs improvement + static short m_nBacWeatherType; if (m_bLockWeather) { CWeather::OldWeatherType = m_nBacWeatherType; CWeather::NewWeatherType = m_nBacWeatherType; } + else + { + m_nBacWeatherType = CWeather::OldWeatherType; + } }; } @@ -320,11 +325,7 @@ void Visual::Draw() } } } - if (Ui::CheckboxWithHint("Lock weather", &m_bLockWeather)) - { - m_nBacWeatherType = CWeather::OldWeatherType; - } - + Ui::CheckboxWithHint("Lock weather", &m_bLockWeather); if (Ui::CheckboxWithHint("No water", &m_bNoWater)) { if (m_bNoWater) @@ -357,10 +358,7 @@ void Visual::Draw() Ui::CheckboxAddressEx("Unfog map", 0xBA372C, 0x50, 0x0); #elif GTAVC Ui::CheckboxAddress("Hide radar", 0xA10AB6); - if (Ui::CheckboxWithHint("Lock weather", &m_bLockWeather)) - { - m_nBacWeatherType = CWeather::OldWeatherType; - } + Ui::CheckboxWithHint("Lock weather", &m_bLockWeather); Ui::CheckboxAddress("Show hud", 0x86963A); ImGui::NextColumn(); diff --git a/src/visual.h b/src/visual.h index 66a04e2..aa51076 100644 --- a/src/visual.h +++ b/src/visual.h @@ -1,17 +1,18 @@ #pragma once #include "pch.h" + class Visual { private: static inline bool m_bLockWeather; - static inline int m_nBacWeatherType; #ifdef GTASA static inline bool m_bInvisibleWater; static inline bool m_bNoWater; static inline bool m_bDisableHydrant; #endif - // Timecyc + + // Timecyc stuff static inline int m_nTimecycHour = 8; static inline std::vector m_WeatherNames { @@ -25,8 +26,7 @@ private: static void GenerateTimecycFile(); static int CalcArrayIndex(); static bool TimeCycColorEdit3(const char* label, uchar* r, uchar* g, uchar* b, ImGuiColorEditFlags flags = 0); - static bool TimeCycColorEdit4(const char* label, uchar* r, uchar* g, uchar* b, uchar* a, - ImGuiColorEditFlags flags = 0); + static bool TimeCycColorEdit4(const char* label, uchar* r, uchar* g, uchar* b, uchar* a, ImGuiColorEditFlags flags = 0); template static void TimecycSlider(const char* label, T* data, int min, int max); public: @@ -39,6 +39,7 @@ void Visual::TimecycSlider(const char* label, T* ptr, int min, int max) { int val = CalcArrayIndex(); #ifdef GTASA + // Compatable with 24h TimeCyc T* arr = static_cast(patch::GetPointer(int(ptr))); #elif GTAVC T* arr = static_cast(ptr);