Refactored code

This commit is contained in:
Grinch_ 2021-03-03 01:18:37 +06:00
parent 28d7a752a8
commit a2b7561933
36 changed files with 320 additions and 568 deletions

View File

@ -27,8 +27,6 @@ set(src_files
"src/Animation.h"
"src/CheatMenu.cpp"
"src/CheatMenu.h"
"src/Events.cpp"
"src/Events.h"
"src/Game.cpp"
"src/Game.h"
"src/Hook.cpp"
@ -38,6 +36,8 @@ set(src_files
"src/Menu.cpp"
"src/Menu.h"
"src/MenuInfo.h"
"src/MoreEvents.cpp"
"src/MoreEvents.h"
"src/Neon.cpp"
"src/Neon.h"
"src/Paint.cpp"

View File

@ -3,26 +3,6 @@
#include "Ui.h"
#include "Util.h"
bool Animation::loop = false;
bool Animation::secondary = false;
char Animation::ifp_buffer[INPUT_BUFFER_SIZE] = "";
char Animation::anim_buffer[INPUT_BUFFER_SIZE] = "";
ImGuiTextFilter Animation::filter = "";
std::vector<std::string> Animation::search_categories;
std::string Animation::selected_item = "All";
CJson Animation::json = CJson("animation");
std::vector<std::string> fighting_vec{ "Default","Boxing","Kung fu","Kick Boxing","Punch Kick" };
int fighting_selected = 0;
std::vector<std::string> walking_vec{ "default", "man", "shuffle", "oldman", "gang1", "gang2",
"oldfatman", "fatman", "jogger", "drunkman", "blindman", "swat", "woman", "shopping", "busywoman",
"sexywoman", "pro", "oldwoman", "fatwoman", "jogwoman", "oldfatwoman", "skate" };
std::string walking_selected = "default";
Animation::Animation()
{
json.LoadData(search_categories, selected_item);

View File

@ -2,16 +2,23 @@
class Animation
{
private:
static bool loop;
static bool secondary;
inline static bool loop = false;
inline static bool secondary = false;
static CJson json;
static ImGuiTextFilter filter;
static std::vector<std::string> search_categories;
static std::string selected_item;
inline static CJson json = CJson("animation");
inline static ImGuiTextFilter filter = "";
inline static std::vector<std::string> search_categories;
inline static std::string selected_item = "All";
static char anim_buffer[INPUT_BUFFER_SIZE];
static char ifp_buffer[INPUT_BUFFER_SIZE];
inline static char anim_buffer[INPUT_BUFFER_SIZE] = "";
inline static char ifp_buffer[INPUT_BUFFER_SIZE] = "";
inline static std::vector<std::string> fighting_vec{ "Default","Boxing","Kung fu","Kick Boxing","Punch Kick" };
inline static int fighting_selected = 0;
inline static std::vector<std::string> walking_vec{ "default", "man", "shuffle", "oldman", "gang1", "gang2",
"oldfatman", "fatman", "jogger", "drunkman", "blindman", "swat", "woman", "shopping", "busywoman",
"sexywoman", "pro", "oldwoman", "fatwoman", "jogwoman", "oldfatwoman", "skate" };
inline static std::string walking_selected = "default";
protected:
Animation();

View File

@ -3,12 +3,6 @@
#include "MenuInfo.h"
#include "Ui.h"
CallbackTable CheatMenu::header{
{ "Teleport", &Teleport::Draw },{ "Player", &Player::Draw },{ "Ped", &Ped::Draw },
{ "Animation", &Animation::Draw },{ "Vehicle", &Vehicle::Draw },{ "Weapon", &Weapon::Draw },
{ "Game", &Game::Draw },{ "Visual", &Visual::Draw },{ "Menu", &Menu::Draw }
};
void CheatMenu::DrawWindow()
{
ImGuiIO& io = ImGui::GetIO();

View File

@ -21,7 +21,12 @@
class CheatMenu : Hook, Animation, Game, Menu, Ped, Player, Teleport, Vehicle, Visual, Weapon
{
private:
static CallbackTable header;
inline static CallbackTable header
{
{ "Teleport", &Teleport::Draw },{ "Player", &Player::Draw },{ "Ped", &Ped::Draw },
{ "Animation", &Animation::Draw },{ "Vehicle", &Vehicle::Draw },{ "Weapon", &Weapon::Draw },
{ "Game", &Game::Draw },{ "Visual", &Visual::Draw },{ "Menu", &Menu::Draw }
};
static void ApplyStyle();
static void DrawWindow();

View File

@ -5,61 +5,8 @@
#include "Util.h"
#include "CIplStore.h"
ImGuiTextFilter Game::filter = "";
std::vector<std::string> Game::search_categories;
std::string Game::selected_item = "All";
std::vector<std::string> Game::day_names{ "Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday" };
char Game::save_game_name[22] = "";
CJson Game::json = CJson("mission");
CJson Game::stat::json = CJson("stat");
std::vector<std::string> Game::stat::search_categories;
std::string Game::stat::selected_item = "All";
ImGuiTextFilter Game::stat::filter = "";
bool Game::random_cheats::enable = false;
int Game::random_cheats::enable_wait_time = 10;
uint Game::random_cheats::timer = 0;
std::string Game::random_cheats::enabled_cheats[92][2];
bool Game::freecam::init_done = false;
bool Game::freecam::enable = false;
float Game::freecam::speed = 0.08f;
float Game::freecam::tmouseX = 0;
float Game::freecam::tmouseY = 0;
float Game::freecam::mouseX = 0;
float Game::freecam::mouseY = 0;
int Game::freecam::hped = -1;
float Game::freecam::fov = -1;
CPed* Game::freecam::ped = nullptr;
bool Game::hard_mode::state = false;
float Game::hard_mode::prev_armour = 0.0f;
float Game::hard_mode::prev_health = 0.0f;
float Game::hard_mode::prev_max_health = 0.0f;
float Game::hard_mode::prev_stamina = 0.0f;
bool Game::disable_cheats = false;
bool Game::disable_replay = false;
bool Game::forbidden_area_wl = true;
bool Game::freeze_mission_timer = false;
bool Game::freeze_time = false;
bool Game::keep_stuff = false;
bool Game::solid_water = false;
bool Game::ss_shortcut = false;
bool Game::sync_time = false;
uint Game::sync_time_timer = 0;
uint Game::solid_water_object = 0;
CJson Game::random_cheats::name_json = CJson("cheat name");
static bool mission_warning_shown = false;
// Thanks to aap
void RealTimeClock(void)
void Game::RealTimeClock()
{
static int lastday;
time_t tmp = time(NULL);

View File

@ -2,66 +2,71 @@
class Game
{
public:
static CJson json;
static ImGuiTextFilter filter;
static std::vector<std::string> search_categories;
static std::string selected_item;
static std::vector<std::string> day_names;
inline static CJson json = CJson("mission");
inline static ImGuiTextFilter filter = "";
inline static std::vector<std::string> search_categories;
inline static std::string selected_item = "All";
inline static std::vector<std::string> day_names = { "Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday" };
static char save_game_name[22];
inline static char save_game_name[22] = "";
struct random_cheats
{
static bool enable;
static int enable_wait_time;
static CJson name_json;
static uint timer;
static std::string enabled_cheats[92][2];
inline static bool enable = false;
inline static int enable_wait_time = 10;
inline static CJson name_json = CJson("cheat name");
inline static uint timer = 0;
inline static std::string enabled_cheats[92][2];
};
struct freecam
{
static bool enable;
static float speed;
static float fov;
static bool init_done;
static CPed* ped;
static int hped;
static float mouseX, mouseY, tmouseX, tmouseY;
inline static bool enable = false;
inline static float speed = 0.08f;
inline static float fov = -1;
inline static bool init_done = false;
inline static CPed* ped = nullptr;
inline static int hped = -1;
inline static float mouseX = 0.0f;
inline static float mouseY = 0.0f;
inline static float tmouseX = 0.0f;
inline static float tmouseY = 0.0f;
};
struct hard_mode
{
static bool state;
static float prev_health;
static float prev_max_health;
static float prev_armour;
static float prev_stamina;
inline static bool state = false;
inline static float prev_health = 0.0f;
inline static float prev_max_health = 0.0f;
inline static float prev_armour = 0.0f;
inline static float prev_stamina = 0.0f;
};
static bool disable_cheats;
static bool disable_replay;
static bool forbidden_area_wl;
static bool freeze_mission_timer;
static bool freeze_time;
static bool keep_stuff;
static bool solid_water;
static bool ss_shortcut;
static bool sync_time;
static uint sync_time_timer;
static uint solid_water_object;
inline static bool disable_cheats = false;
inline static bool disable_replay = false;
inline static bool forbidden_area_wl = true;
inline static bool freeze_mission_timer = false;
inline static bool freeze_time = false;
inline static bool keep_stuff = false;
inline static bool solid_water = false;
inline static bool ss_shortcut = false;
inline static bool sync_time = false;
inline static uint sync_time_timer = 0;
inline static uint solid_water_object = 0;
inline static bool mission_warning_shown = false;
struct stat
{
static CJson json;
static ImGuiTextFilter filter;
static std::vector<std::string> search_categories;
static std::string selected_item;
inline static CJson json = CJson("stat");
inline static ImGuiTextFilter filter = "";
inline static std::vector<std::string> search_categories;
inline static std::string selected_item = "All";
};
Game();
static void Draw();
static void FreeCam();
static void ClearFreecamStuff();
static void RealTimeClock();
};

View File

@ -2,16 +2,6 @@
#include "kiero/kiero.h"
#include "kiero/minhook/MinHook.h"
WNDPROC Hook::oWndProc = NULL;
f_Present11 Hook::oPresent11 = NULL;
f_Present9 Hook::oPresent9 = NULL;
f_Reset Hook::oReset9 = NULL;
bool Hook::mouse_visibility = false;
bool Hook::show_mouse = false;
std::function<void()> Hook::window_callback = NULL;
LRESULT Hook::WndProc(const HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
ImGui_ImplWin32_WndProcHandler(hWnd, uMsg, wParam, lParam);

View File

@ -10,11 +10,11 @@ extern IMGUI_IMPL_API LRESULT ImGui_ImplWin32_WndProcHandler(HWND hWnd, UINT msg
class Hook
{
private:
static WNDPROC oWndProc;
static f_Present11 oPresent11;
static f_Present9 oPresent9;
static f_Reset oReset9;
static bool mouse_visibility;
inline static WNDPROC oWndProc = NULL;
inline static f_Present11 oPresent11 = NULL;
inline static f_Present9 oPresent9 = NULL;
inline static f_Reset oReset9 = NULL;
inline static bool mouse_visibility = false;
static void CALLBACK Present(void* ptr);
static HRESULT CALLBACK PresentDx9Handler(IDirect3DDevice9* pDevice, RECT* pSourceRect, RECT* pDestRect, HWND hDestWindowOverride, RGNDATA* pDirtyRegion);
@ -24,8 +24,8 @@ private:
static void ShowMouse(bool state);
protected:
static bool show_mouse;
static std::function<void()> window_callback;
inline static bool show_mouse = false;
inline static std::function<void()> window_callback = NULL;
Hook();
~Hook();
};

View File

@ -7,34 +7,6 @@
#include "Ui.h"
#include "Util.h"
bool Menu::overlay::coord = false;
bool Menu::overlay::fps = false;
bool Menu::overlay::loc_name = false;
bool Menu::overlay::transparent = false;
bool Menu::overlay::veh_health = false;
bool Menu::overlay::veh_speed = false;
std::vector<std::string> Menu::overlay::pos_names{ "Custom", "Top left", "Top right", "Bottom left", "Bottom right" };
int Menu::overlay::selected_pos = 4;
float Menu::overlay::posX = NULL;
float Menu::overlay::posY = NULL;
HotKeyData Menu::hotkeys::aim_skin_changer{};
HotKeyData Menu::hotkeys::freecam{};
HotKeyData Menu::hotkeys::command_window{};
HotKeyData Menu::hotkeys::flip_veh{};
HotKeyData Menu::hotkeys::fix_veh{};
HotKeyData Menu::hotkeys::free_cam_tp_player{ VK_RETURN,VK_RETURN };
HotKeyData Menu::hotkeys::god_mode{};
HotKeyData Menu::hotkeys::menu_open{};
HotKeyData Menu::hotkeys::quick_ss{};
HotKeyData Menu::hotkeys::quick_tp{};
HotKeyData Menu::hotkeys::veh_engine{};
HotKeyData Menu::hotkeys::veh_instant_start{};
HotKeyData Menu::hotkeys::veh_instant_stop{};
bool Menu::commands::show_menu = false;
char Menu::commands::input_buffer[INPUT_BUFFER_SIZE] = "";
Menu::Menu()
{
// TODO: use structs

View File

@ -5,38 +5,38 @@ class Menu
private:
struct overlay
{
static bool coord;
static bool fps;
static bool loc_name;
static bool transparent;
static bool veh_health;
static bool veh_speed;
static std::vector<std::string> pos_names;
static int selected_pos;
static float posX;
static float posY;
inline static bool coord = false;
inline static bool fps = false;
inline static bool loc_name = false;
inline static bool transparent = false;
inline static bool veh_health = false;
inline static bool veh_speed = false;
inline static std::vector<std::string> pos_names = { "Custom", "Top left", "Top right", "Bottom left", "Bottom right" };
inline static int selected_pos = 4; // TODO: Create Enum
inline static float posX = 0.0f;
inline static float posY = 0.0f;
};
public:
struct hotkeys
{
static HotKeyData aim_skin_changer;
static HotKeyData freecam;
static HotKeyData command_window;
static HotKeyData fix_veh;
static HotKeyData flip_veh;
static HotKeyData free_cam_tp_player;
static HotKeyData god_mode;
static HotKeyData menu_open;
static HotKeyData quick_ss;
static HotKeyData quick_tp;
static HotKeyData veh_engine;
static HotKeyData veh_instant_start;
static HotKeyData veh_instant_stop;
inline static HotKeyData aim_skin_changer;
inline static HotKeyData freecam;
inline static HotKeyData command_window;
inline static HotKeyData fix_veh;
inline static HotKeyData flip_veh;
inline static HotKeyData free_cam_tp_player{VK_RETURN,VK_RETURN};
inline static HotKeyData god_mode;
inline static HotKeyData menu_open;
inline static HotKeyData quick_ss;
inline static HotKeyData quick_tp;
inline static HotKeyData veh_engine;
inline static HotKeyData veh_instant_start;
inline static HotKeyData veh_instant_stop;
};
struct commands
{
static bool show_menu;
static char input_buffer[INPUT_BUFFER_SIZE];
inline static bool show_menu = false;
inline static char input_buffer[INPUT_BUFFER_SIZE] = "";
};
Menu();

View File

@ -1,5 +1,5 @@
#pragma once
#define MENU_NAME "Cheat Menu"
#define MENU_VERSION "2.6-beta"
#define BUILD_NUMBER "20210225"
#define BUILD_NUMBER "20210303"
#define MENU_TITLE MENU_NAME " v" MENU_VERSION "(" BUILD_NUMBER ")"

View File

@ -2,9 +2,6 @@
#include "Neon.h"
#include "Util.h"
VehExtender<Neon::NeonData> Neon::VehNeon;
RwTexture* Neon::neon_texture = nullptr;
void Neon::RenderEvent(CVehicle *pVeh)
{
NeonData* data = &VehNeon.Get(pVeh);

View File

@ -3,8 +3,6 @@
class Neon
{
private:
static RwTexture* neon_texture;
class NeonData {
public:
CRGBA color;
@ -22,8 +20,9 @@ private:
increment = true;
}
};
static VehExtender<NeonData> VehNeon;
inline static RwTexture* neon_texture = nullptr;
inline static VehExtender<NeonData> VehNeon;
public:
Neon();

View File

@ -28,12 +28,6 @@
#include "NodeName.h"
#include "Util.h"
std::vector<std::string> Paint::veh_nodes::names_vec{ "Default" };
std::string Paint::veh_nodes::selected = "Default";
VehExtender<Paint::VehData> Paint::vehdata;
std::map<std::string, std::shared_ptr<RwTexture>> Paint::textures;
void Paint::RenderEvent(CVehicle* pVeh)
{
VehData& data = vehdata.Get(pVeh);

View File

@ -73,15 +73,15 @@ private:
void resetMaterialTexture(RpMaterial* material);
};
static VehExtender<VehData> vehdata;
inline static VehExtender<VehData> vehdata;
protected:
static std::map<std::string, std::shared_ptr<RwTexture>> textures;
inline static std::map<std::string, std::shared_ptr<RwTexture>> textures;
struct veh_nodes
{
static std::vector<std::string> names_vec;
static std::string selected;
inline static std::vector<std::string> names_vec{ "Default" };
inline static std::string selected = "Default";
};
Paint();

View File

@ -3,32 +3,6 @@
#include "Ui.h"
#include "Util.h"
ImGuiTextFilter Ped::filter = "";
std::string Ped::selected_item = "All";
std::vector<std::string> Ped::search_categories;
std::vector<std::unique_ptr<TextureStructure>> Ped::peds_vec;
bool Ped::images_loaded = false;
CJson Ped::ped_json = CJson("ped");
CJson Ped::pedspecial_json = CJson("ped special");
std::vector<std::string> Ped::gang_names = { "Ballas", "Grove street families", "Los santos vagos", "San fierro rifa",
"Da nang boys", "Mafia", "Mountain cloud triad", "Varrio los aztecas", "Gang9", "Gang10" };
bool Ped::exgangwars_installed = false;
int Ped::ped_remove_radius = 5;
std::vector<CPed*> Ped::spawn_ped::list;
int Ped::spawn_ped::accuracy = 50;
int Ped::spawn_ped::health = 100;
int Ped::spawn_ped::selected_ped_type = 0;
bool Ped::spawn_ped::dont_move = false;
bool Ped::spawn_ped::ped_bleed = false;
int Ped::spawn_ped::weapon_id = 0;
std::vector<std::string> Ped::spawn_ped::ped_type = { "Civ male","Civ female","Cop","Ballas","Grove Street Families","Los Santos Vagos",
"San Fierro Rifa","Da Nang Boys","Mafia","Mountain Cloud Triads","Varrio Los Aztecas",
"Gang 9","Medic","Dealer","Criminal","Fireman","Prostitute" };
Ped::Ped()
{
if (GetModuleHandle("ExGangWars.asi"))

View File

@ -5,29 +5,37 @@
class Ped
{
private:
static ImGuiTextFilter filter;
static std::string selected_item;
static std::vector<std::string> search_categories;
static std::vector<std::unique_ptr<TextureStructure>> peds_vec;
static bool images_loaded;
inline static ImGuiTextFilter filter = "";
inline static std::string selected_item = "All";
inline static std::vector<std::string> search_categories;
inline static std::vector<std::unique_ptr<TextureStructure>> peds_vec;
inline static bool images_loaded = false;
static CJson ped_json;
static CJson pedspecial_json;
inline static CJson ped_json = CJson("ped");
inline static CJson pedspecial_json = CJson("ped special");
static std::vector<std::string> gang_names;
static bool exgangwars_installed;
static int ped_remove_radius;
inline static std::vector<std::string> gang_names =
{
"Ballas", "Grove street families", "Los santos vagos", "San fierro rifa",
"Da nang boys", "Mafia", "Mountain cloud triad", "Varrio los aztecas", "Gang9", "Gang10"
};
inline static bool exgangwars_installed = false;
inline static int ped_remove_radius = 5;
struct spawn_ped {
static std::vector<CPed*> list;
static int accuracy;
static int health;
static bool dont_move;
static bool ped_bleed;
static std::vector<std::string> ped_type;
static int selected_ped_type;
static int weapon_id;
inline static std::vector<CPed*> list;
inline static int accuracy = 50;
inline static int health = 100;
inline static bool dont_move = false;
inline static bool ped_bleed = false;
inline static std::vector<std::string> ped_type =
{
"Civ male","Civ female","Cop","Ballas","Grove Street Families","Los Santos Vagos",
"San Fierro Rifa","Da Nang Boys","Mafia","Mountain Cloud Triads","Varrio Los Aztecas",
"Gang 9","Medic","Dealer","Criminal","Fireman","Prostitute"
};
inline static int selected_ped_type;
inline static int weapon_id = 0;
};
friend class Player;

View File

@ -5,25 +5,7 @@
#include "Ui.h"
#include "Util.h"
bool Player::keep_position::state = false;
CVector Player::keep_position::pos = CVector();
bool Player::god_mode = false;
int Player::body = 0;
bool Player::aim_skin_changer = false;
ImGuiTextFilter Player::filter = "";
std::vector<std::string> Player::search_categories;
std::vector<std::unique_ptr<TextureStructure>> Player::clothes_vec;
std::string Player::selected_item = "All";
bool Player::images_loaded = false;
std::string Player::custom_skins::dir = paths::GetGameDirPathA() + std::string("\\modloader\\Custom Skins\\");
std::vector<std::string> Player::custom_skins::store_vec;
ImGuiTextFilter Player::custom_skins::filter = "";
bool Player::modloader_installed = false;
static void PlayerModelBrokenFix()
inline static void PlayerModelBrokenFix()
{
CPlayerPed* player = FindPlayerPed();

View File

@ -4,30 +4,30 @@ class Player
private:
struct keep_position
{
static bool state;
static CVector pos;
inline static bool state = false;
inline static CVector pos;
};
static bool god_mode;
static int body;
static bool aim_skin_changer;
static ImGuiTextFilter filter;
static std::string selected_item;
static std::vector<std::string> search_categories;
static std::vector<std::unique_ptr<TextureStructure>> clothes_vec;
static bool images_loaded;
inline static bool god_mode = false;
inline static int body = 0;
inline static bool aim_skin_changer = false;
inline static ImGuiTextFilter filter = "";
inline static std::string selected_item = "All";
inline static std::vector<std::string> search_categories;
inline static std::vector<std::unique_ptr<TextureStructure>> clothes_vec;
inline static bool images_loaded = false;
struct custom_skins
{
static std::string dir;
static ImGuiTextFilter filter;
static std::vector<std::string> store_vec;
inline static std::string dir = paths::GetGameDirPathA() + std::string("\\modloader\\Custom Skins\\");;
inline static ImGuiTextFilter filter = "";
inline static std::vector<std::string> store_vec;
};
static bool modloader_installed;
inline static bool modloader_installed = false;
public:
Player();
static void ChangePlayerCloth(std::string& model);
static void ChangePlayerModel(std::string& model);
Player();
static void Draw();
};

View File

@ -7,23 +7,6 @@
// FlA
tRadarTrace* CRadar::ms_RadarTrace = reinterpret_cast<tRadarTrace *>(patch::GetPointer(0x5838B0 + 2));
bool Teleport::insert_coord = false;
bool Teleport::quick_teleport = false;
char Teleport::input_buffer[INPUT_BUFFER_SIZE] = "";
char Teleport::location_buffer[INPUT_BUFFER_SIZE] = "";
CVector Teleport::STeleport::pos{ -1, -1, -1 };
bool Teleport::STeleport::_bool = false;
uint Teleport::STeleport::timer = 0;
ImGuiTextFilter Teleport::filter = "";
std::vector<std::string> Teleport::search_categories;
std::string Teleport::selected_item = "All";
uint quick_teleport_timer = 0;
CJson Teleport::json = CJson("teleport");
CJson Teleport::sprite_name_json = CJson("radar sprite");
void Teleport::FetchRadarSpriteData()
{
uint cur_timer = CTimer::m_snTimeInMilliseconds;

View File

@ -5,23 +5,24 @@
class Teleport
{
private:
static bool insert_coord;
static bool quick_teleport;
static char input_buffer[INPUT_BUFFER_SIZE];
static CJson json;
static ImGuiTextFilter filter;
static std::vector<std::string> search_categories;
static std::string selected_item;
static char location_buffer[INPUT_BUFFER_SIZE];
inline static bool insert_coord = false;
inline static bool quick_teleport = false;
inline static char input_buffer[INPUT_BUFFER_SIZE] = "";
inline static CJson json = CJson("teleport");
inline static ImGuiTextFilter filter = "";
inline static std::vector<std::string> search_categories;
inline static std::string selected_item = "All";
inline static char location_buffer[INPUT_BUFFER_SIZE] = "";
inline static uint quick_teleport_timer = 0;
struct STeleport
{
static bool _bool;
static CVector pos;
static uint timer;
inline static bool _bool = false;
inline static CVector pos = { -1, -1, -1 };
inline static uint timer = 0;
};
static CJson sprite_name_json;
inline static CJson sprite_name_json = CJson("radar sprite");
/*
Generates radar sprite coordinates on the fly.

View File

@ -1,5 +1,3 @@
#include "plugin.h"
uchar* m_nDirectionalMult = (uchar*)0x55F7C7; //m_nDirectionalMult[184]
uchar* m_nWaterFogAlpha = (uchar*)0x55F7B8; //m_nWaterFogAlpha[184]

View File

@ -1,11 +1,6 @@
#include "pch.h"
#include "Ui.h"
std::string Ui::current_hotkey = "";
static Ui::JsonPopUpData json_popup;
static Ui::ImgPopUpData img_popup;
bool Ui::ListBox(const char* label, std::vector<std::string>& all_items, int& selected)
{
bool rtn = false;

View File

@ -5,7 +5,8 @@ class Ui
{
private:
static std::string current_hotkey;
inline static std::string current_hotkey = "";
public:
struct NamedMemory {
std::string name;
@ -30,6 +31,9 @@ public:
std::function<void(std::string&)> function;
std::string value;
};
inline static JsonPopUpData json_popup;
inline static ImgPopUpData img_popup;
static void CenterdText(const std::string& text);
static bool ColorButton(int color_id, std::vector<float>& color, ImVec2 size);
static bool CheckboxAddress(const char* label, const int addr = NULL, const char* hint = nullptr);

View File

@ -5,25 +5,43 @@
#pragma once
#include <vector>
#include "CVehicle.h"
#include "Events.h"
template <class T>
class VehExtender
{
public:
VehExtender(){};
VehExtender(const VehExtender&) = delete;
T& Get(CVehicle *veh)
{
static std::vector<std::pair<CVehicle*,T>> data;
private:
inline static std::vector<std::pair<CVehicle*,T>> data;
public:
static void RemoveVehEntry(CVehicle *pVeh)
{
for (auto it = data.begin(); it < data.end(); ++it)
{
if (it->first == veh)
if (it->first == pVeh)
data.erase(it);
}
}
VehExtender()
{
plugin::Events::vehicleCtorEvent.after += RemoveVehEntry;
}
~VehExtender()
{
plugin::Events::vehicleCtorEvent.after -= RemoveVehEntry;
}
VehExtender(const VehExtender&) = delete;
T& Get(CVehicle *pVeh)
{
for (auto it = data.begin(); it < data.end(); ++it)
{
if (it->first == pVeh)
return it->second;
}
data.push_back({veh, T(veh)});
data.push_back({pVeh, T(pVeh)});
return data.back().second;
}
};

View File

@ -4,71 +4,6 @@
#include "Ui.h"
#include "Util.h"
bool Vehicle::bike_fly = false;
bool Vehicle::dont_fall_bike = false;
bool Vehicle::veh_heavy = false;
bool Vehicle::veh_watertight = false;
bool Vehicle::veh_nodmg = false;
int Vehicle::veh_remove_radius = 5;
bool Vehicle::lock_speed = false;
float Vehicle::lock_speed_val = 0;
int Vehicle::door_menu_button = 0;
std::string Vehicle::door_names[6] = { "Hood","Boot","Front left door","Front right door","Rear left door","Rear right door" };
std::map<int, std::string> Vehicle::vehicle_ide;
std::vector<std::vector<float>> Vehicle::carcols_color_values;
std::map<std::string, std::vector<int>> Vehicle::carcols_car_data;
int Vehicle::color::radio_btn = 1;
bool Vehicle::color::show_all = false;
bool Vehicle::color::material_filter = true;
float Vehicle::color::color_picker[3]{ 0,0,0 };
ImGuiTextFilter Vehicle::spawner::filter = "";
std::vector<std::string> Vehicle::spawner::search_categories;
std::vector<std::unique_ptr<TextureStructure>> Vehicle::spawner::image_vec;
std::string Vehicle::spawner::selected_item = "All";
bool Vehicle::spawner::spawn_inside = true;
bool Vehicle::spawner::spawn_in_air = true;
char Vehicle::spawner::license_text[9] = "";
ImGuiTextFilter Vehicle::texture9::filter = "";
std::vector<std::string> Vehicle::texture9::search_categories;
std::vector<std::unique_ptr<TextureStructure>> Vehicle::texture9::image_vec;
std::string Vehicle::texture9::selected_item = "All";
ImGuiTextFilter Vehicle::tune::filter = "";
std::vector<std::string> Vehicle::tune::search_categories;
std::vector<std::unique_ptr<TextureStructure>> Vehicle::tune::image_vec;
std::string Vehicle::tune::selected_item = "All";
bool Vehicle::images_loaded = false;
float Vehicle::neon::color_picker[3]{ 0,0,0 };
bool Vehicle::neon::rainbow = false;
uint Vehicle::neon::rainbow_timer = 0;
bool Vehicle::neon::traffic = false;
uint Vehicle::neon::traffic_timer = 0;
bool Vehicle::unlimited_nitro::enabled = false;
bool Vehicle::unlimited_nitro::comp_added = false;
static std::vector<std::string>(handling_flag_names) = // 32 flags
{
"1G_BOOST","2G_BOOST","NPC_ANTI_ROLL","NPC_NEUTRAL_HANDL","NO_HANDBRAKE","STEER_REARWHEELS","HB_REARWHEEL_STEER","ALT_STEER_OPT",
"WHEEL_F_NARROW2","WHEEL_F_NARROW","WHEEL_F_WIDE","WHEEL_F_WIDE2","WHEEL_R_NARROW2","WHEEL_R_NARROW","WHEEL_R_WIDE","WHEEL_R_WIDE2",
"HYDRAULIC_GEOM","HYDRAULIC_INST","HYDRAULIC_NONE","NOS_INST","OFFROAD_ABILITY","OFFROAD_ABILITY2","HALOGEN_LIGHTS","PROC_REARWHEEL_1ST",
"USE_MAXSP_LIMIT","LOW_RIDER","STREET_RACER","SWINGING_CHASSIS","Unused 1","Unused 2","Unused 3","Unused 4"
};
static std::vector<std::string>(model_flag_names) = // 32 flags
{
"IS_VAN","IS_BUS","IS_LOW","IS_BIG","REVERSE_BONNET","HANGING_BOOT","TAILGATE_BOOT","NOSWING_BOOT","NO_DOORS","TANDEM_SEATS",
"SIT_IN_BOAT","CONVERTIBLE","NO_EXHAUST","DOUBLE_EXHAUST","NO1FPS_LOOK_BEHIND","FORCE_DOOR_CHECK","AXLE_F_NOTILT","AXLE_F_SOLID","AXLE_F_MCPHERSON",
"AXLE_F_REVERSE","AXLE_R_NOTILT","AXLE_R_SOLID","AXLE_R_MCPHERSON","AXLE_R_REVERSE","IS_BIKE","IS_HELI","IS_PLANE","IS_BOAT","BOUNCE_PANELS",
"DOUBLE_RWHEELS","FORCE_GROUND_CLEARANCE","IS_HATCHBAC1K"
};
Vehicle::Vehicle()
{
ParseVehiclesIDE();

View File

@ -5,72 +5,90 @@
class Vehicle : Paint, Neon
{
private:
static bool bike_fly;
static bool dont_fall_bike;
static bool veh_heavy;
static bool veh_watertight;
static bool veh_nodmg;
static int door_menu_button;
static std::string door_names[6];
static int veh_remove_radius;
inline static bool bike_fly = false;
inline static bool dont_fall_bike = false;
inline static bool veh_heavy = false;
inline static bool veh_watertight = false;
inline static bool veh_nodmg = false;
inline static int door_menu_button = 0;
inline static std::string door_names[6] =
{ "Hood","Boot","Front left door","Front right door","Rear left door","Rear right door" };
inline static int veh_remove_radius = 0;
static bool lock_speed;
static float lock_speed_val;
inline static bool lock_speed = false;
inline static float lock_speed_val = 0.0f;
static std::map<int, std::string> vehicle_ide;
static std::vector<std::vector<float>> carcols_color_values;
static std::map<std::string, std::vector<int>> carcols_car_data;
inline static std::map<int, std::string> vehicle_ide;
inline static std::vector<std::vector<float>> carcols_color_values;
inline static std::map<std::string, std::vector<int>> carcols_car_data;
struct color
{
static bool material_filter;
static int radio_btn;
static bool show_all;
static float color_picker[3];
inline static bool material_filter = true;
inline static int radio_btn = 1;
inline static bool show_all = false;
inline static float color_picker[3]{ 0,0,0 };
};
struct neon
{
static float color_picker[3];
static bool rainbow;
static uint rainbow_timer;
static bool traffic;
static uint traffic_timer;
inline static float color_picker[3]{ 0,0,0 };
inline static bool rainbow = false;
inline static uint rainbow_timer = 0;
inline static bool traffic = false;
inline static uint traffic_timer = 0;
};
struct spawner
{
static ImGuiTextFilter filter;
static std::string selected_item;
static std::vector<std::string> search_categories;
static std::vector<std::unique_ptr<TextureStructure>> image_vec;
static bool spawn_inside;
static bool spawn_in_air;
static char license_text[9];
inline static ImGuiTextFilter filter = "";
inline static std::string selected_item = "All";
inline static std::vector<std::string> search_categories;
inline static std::vector<std::unique_ptr<TextureStructure>> image_vec;
inline static bool spawn_inside = true;
inline static bool spawn_in_air = true;
inline static char license_text[9] = "";
};
struct texture9
{
static ImGuiTextFilter filter;
static std::string selected_item;
static std::vector<std::string> search_categories;
static std::vector<std::unique_ptr<TextureStructure>> image_vec;
inline static ImGuiTextFilter filter = "";
inline static std::string selected_item = "All";
inline static std::vector<std::string> search_categories;
inline static std::vector<std::unique_ptr<TextureStructure>> image_vec;
};
static bool images_loaded;
inline static bool images_loaded = false;
struct tune
{
static ImGuiTextFilter filter;
static std::string selected_item;
static std::vector<std::string> search_categories;
static std::vector<std::unique_ptr<TextureStructure>> image_vec;
inline static ImGuiTextFilter filter = "";
inline static std::string selected_item = "All";
inline static std::vector<std::string> search_categories;
inline static std::vector<std::unique_ptr<TextureStructure>> image_vec;
};
struct unlimited_nitro
{
static bool enabled;
static bool comp_added;
inline static bool enabled = false;
inline static bool comp_added = false;
};
inline static std::vector<std::string>(handling_flag_names) = // 32 flags
{
"1G_BOOST","2G_BOOST","NPC_ANTI_ROLL","NPC_NEUTRAL_HANDL","NO_HANDBRAKE","STEER_REARWHEELS","HB_REARWHEEL_STEER","ALT_STEER_OPT",
"WHEEL_F_NARROW2","WHEEL_F_NARROW","WHEEL_F_WIDE","WHEEL_F_WIDE2","WHEEL_R_NARROW2","WHEEL_R_NARROW","WHEEL_R_WIDE","WHEEL_R_WIDE2",
"HYDRAULIC_GEOM","HYDRAULIC_INST","HYDRAULIC_NONE","NOS_INST","OFFROAD_ABILITY","OFFROAD_ABILITY2","HALOGEN_LIGHTS","PROC_REARWHEEL_1ST",
"USE_MAXSP_LIMIT","LOW_RIDER","STREET_RACER","SWINGING_CHASSIS","Unused 1","Unused 2","Unused 3","Unused 4"
};
inline static std::vector<std::string>(model_flag_names) = // 32 flags
{
"IS_VAN","IS_BUS","IS_LOW","IS_BIG","REVERSE_BONNET","HANGING_BOOT","TAILGATE_BOOT","NOSWING_BOOT","NO_DOORS","TANDEM_SEATS",
"SIT_IN_BOAT","CONVERTIBLE","NO_EXHAUST","DOUBLE_EXHAUST","NO1FPS_LOOK_BEHIND","FORCE_DOOR_CHECK","AXLE_F_NOTILT","AXLE_F_SOLID","AXLE_F_MCPHERSON",
"AXLE_F_REVERSE","AXLE_R_NOTILT","AXLE_R_SOLID","AXLE_R_MCPHERSON","AXLE_R_REVERSE","IS_BIKE","IS_HELI","IS_PLANE","IS_BOAT","BOUNCE_PANELS",
"DOUBLE_RWHEELS","FORCE_GROUND_CLEARANCE","IS_HATCHBAC1K"
};
public:
static void AddComponent(const std::string& component, const bool display_message = true);
static void RemoveComponent(const std::string& component, const bool display_message = true);

View File

@ -6,26 +6,6 @@
#include "CHudColours.h"
#include "TimeCycle.h"
bool Visual::lock_weather = false;
int Visual::weather_type_backup = 0;
int Visual::timecyc_hour = 8;
std::vector<std::string> Visual::weather_names{
"EXTRASUNNY LA","SUNNY LA","EXTRASUNNY SMOG LA","SUNNY SMOG LA","CLOUDY LA","SUNNY SF","EXTRASUNNY SF","CLOUDY SF","RAINY SF","FOGGY SF",
"SUNNY VEGAS","EXTRASUNNY VEGAS","CLOUDY VEGAS","EXTRASUNNY COUNTRYSIDE","SUNNY COUNTRYSIDE","CLOUDY COUNTRYSIDE","RAINY COUNTRYSIDE",
"EXTRASUNNY DESERT","SUNNY DESERT","SANDSTORM DESERT","UNDERWATER","EXTRACOLOURS 1","EXTRACOLOURS 2"
};
// Let's just use our own variables
static float radar_posX;
static float radar_posY;
static float radar_width = 76.0f;
static float radar_height = 104.0f;
static CHudColour health_bar;
//static CHudColour armour_bar;
static bool init_patches = false;
Visual::Visual()
{
if (GetModuleHandle("timecycle24.asi"))
@ -226,17 +206,17 @@ void Visual::Draw()
}
if (ImGui::BeginTabItem("Menus"))
{
static bool init_patches = false;
static float radar_posX = *(float*)*(int*)0x5834D4;
static float radar_posY = *(float*)*(int*)0x583500;
static float radar_width = *(float*)*(int*)0x5834C2;
static float radar_height = *(float*)*(int*)0x5834F6;
static CHudColour health_bar = HudColour.m_aColours[0];
if (!init_patches)
{
// read those values from game
health_bar = HudColour.m_aColours[0];
//armour_bar = HudColour.m_aColours[4];
radar_posX = *(float*)*(int*)0x5834D4;
radar_posY = *(float*)*(int*)0x583500;
radar_height = *(float*)*(int*)0x5834F6;
radar_width = *(float*)*(int*)0x5834C2;
// patch radar stuff oof
patch::SetPointer(0x5834D4, &radar_posX);
@ -262,7 +242,6 @@ void Visual::Draw()
patch::SetPointer(0x58A99D, &radar_width);
patch::SetPointer(0x589331, &health_bar);
//patch::SetPointer(0x5890FC,&armour_bar);
init_patches = true;
}

View File

@ -2,12 +2,17 @@
class Visual
{
private:
static bool lock_weather;
static int weather_type_backup;
inline static bool lock_weather = false;
inline static int weather_type_backup = 0;
// Timecyc
static std::vector<std::string> weather_names;
static int timecyc_hour;
inline static int timecyc_hour = 8;
inline static std::vector<std::string> weather_names
{
"EXTRASUNNY LA","SUNNY LA","EXTRASUNNY SMOG LA","SUNNY SMOG LA","CLOUDY LA","SUNNY SF","EXTRASUNNY SF","CLOUDY SF","RAINY SF","FOGGY SF",
"SUNNY VEGAS","EXTRASUNNY VEGAS","CLOUDY VEGAS","EXTRASUNNY COUNTRYSIDE","SUNNY COUNTRYSIDE","CLOUDY COUNTRYSIDE","RAINY COUNTRYSIDE",
"EXTRASUNNY DESERT","SUNNY DESERT","SANDSTORM DESERT","UNDERWATER","EXTRACOLOURS 1","EXTRACOLOURS 2"
};
static void GenerateTimecycFile();
static int GetCurrentHourTimeId();

View File

@ -2,42 +2,7 @@
#include "Weapon.h"
#include "Ui.h"
#include "Util.h"
ImGuiTextFilter Weapon::filter = "";
std::string Weapon::selected_item = "All";
std::vector<std::string> Weapon::search_categories;
std::vector<std::unique_ptr<TextureStructure>> Weapon::weapon_vec;
bool Weapon::images_loaded = false;
CJson Weapon::weapon_json = CJson("weapon");
bool Weapon::auto_aim = false;
bool Weapon::fast_reload = false;
bool Weapon::huge_damage = false;
bool Weapon::long_range = false;
bool Weapon::rapid_fire = false;
bool Weapon::dual_weild = false;
bool Weapon::move_aim = false;
bool Weapon::move_fire = false;
uchar Weapon::cur_weapon_slot = -1;
int Weapon::ammo_count = 99999;
int Weapon::selected_gang = 0;
int Weapon::selected_weapon_count = 0;
int Weapon::gang_weapons[10][3] =
{
{WEAPON_PISTOL, WEAPON_MICRO_UZI, WEAPON_UNARMED }, // Ballas
{WEAPON_PISTOL, WEAPON_UNARMED, WEAPON_UNARMED}, // Grove
{WEAPON_PISTOL, WEAPON_UNARMED, WEAPON_UNARMED}, // Vagos
{WEAPON_UNARMED, WEAPON_UNARMED, WEAPON_UNARMED}, // SF Rifa
{WEAPON_PISTOL, WEAPON_MICRO_UZI, WEAPON_UNARMED}, // Da Nang Boys
{WEAPON_DESERT_EAGLE , WEAPON_UNARMED, WEAPON_UNARMED}, // Mafia
{WEAPON_PISTOL, WEAPON_AK47, WEAPON_UNARMED}, // Triads
{WEAPON_PISTOL, WEAPON_MICRO_UZI, WEAPON_UNARMED}, // VLA
{WEAPON_UNARMED, WEAPON_UNARMED, WEAPON_UNARMED}, // Gang 9
{WEAPON_UNARMED, WEAPON_UNARMED, WEAPON_UNARMED}, // Gang 10
};
#include "Ped.h"
Weapon::Weapon()
{

View File

@ -1,35 +1,44 @@
#pragma once
#include "Ped.h"
class Weapon
{
private:
static ImGuiTextFilter filter;
static std::string selected_item;
static std::vector<std::string> search_categories;
static std::vector<std::unique_ptr<TextureStructure>> weapon_vec;
static bool images_loaded;
static CJson weapon_json;
static bool auto_aim;
static bool fast_reload;
static bool huge_damage;
static bool long_range;
static bool rapid_fire;
static bool dual_weild;
static bool move_aim;
static bool move_fire;
static int ammo_count;
static uchar cur_weapon_slot;
static int selected_gang;
static int selected_weapon_count;
static int cur_weapon;
static int gang_weapons[10][3];
friend class Ped;
public:
inline static ImGuiTextFilter filter = "";
inline static std::string selected_item = "All";
inline static std::vector<std::string> search_categories;
inline static std::vector<std::unique_ptr<TextureStructure>> weapon_vec;
inline static bool images_loaded = false;
inline static CJson weapon_json = CJson("weapon");
inline static bool auto_aim = false;
inline static bool fast_reload = false;
inline static bool huge_damage = false;
inline static bool long_range = false;
inline static bool rapid_fire = false;
inline static bool dual_weild = false;
inline static bool move_aim = false;
inline static bool move_fire = false;
inline static int ammo_count = 99999;
inline static uchar cur_weapon_slot = -1;
inline static int selected_gang = 0;
inline static int selected_weapon_count = 0;
inline static int gang_weapons[10][3] =
{
{WEAPON_PISTOL, WEAPON_MICRO_UZI, WEAPON_UNARMED }, // Ballas
{WEAPON_PISTOL, WEAPON_UNARMED, WEAPON_UNARMED}, // Grove
{WEAPON_PISTOL, WEAPON_UNARMED, WEAPON_UNARMED}, // Vagos
{WEAPON_UNARMED, WEAPON_UNARMED, WEAPON_UNARMED}, // SF Rifa
{WEAPON_PISTOL, WEAPON_MICRO_UZI, WEAPON_UNARMED}, // Da Nang Boys
{WEAPON_DESERT_EAGLE , WEAPON_UNARMED, WEAPON_UNARMED}, // Mafia
{WEAPON_PISTOL, WEAPON_AK47, WEAPON_UNARMED}, // Triads
{WEAPON_PISTOL, WEAPON_MICRO_UZI, WEAPON_UNARMED}, // VLA
{WEAPON_UNARMED, WEAPON_UNARMED, WEAPON_UNARMED}, // Gang 9
{WEAPON_UNARMED, WEAPON_UNARMED, WEAPON_UNARMED}, // Gang 10
};
Weapon();
~Weapon();

View File

@ -1,13 +1 @@
#include "pch.h"
std::string Globals::header_id = "";
ImVec2 Globals::menu_size = ImVec2(screen::GetScreenWidth() / 4, screen::GetScreenHeight() / 1.2);
ImVec2 Globals::screen_size = ImVec2(-1, -1);
bool Globals::show_menu = false;
bool Globals::init_done = false;
Renderer Globals::renderer = Render_Unknown;
void* Globals::device = nullptr;
bool Globals::game_init = false;
std::ofstream flog = std::ofstream("CheatMenu.log");
CJson config = CJson("config");

View File

@ -58,7 +58,7 @@
#include "imgui/imgui_impl_dx11.h"
#include "imgui/imgui_impl_win32.h"
#include "Events.h"
#include "MoreEvents.h"
#include "Json.h"
#include "VKeys.h"
#include "VehExtender.h"
@ -77,16 +77,19 @@ enum Renderer
struct Globals
{
static std::string header_id;
static ImVec2 menu_size;
static ImVec2 screen_size;
static bool show_menu;
static bool init_done;
static bool game_init;
static Renderer renderer;
static void* device;
inline static std::string header_id = "";
inline static ImVec2 menu_size = ImVec2(screen::GetScreenWidth() / 4, screen::GetScreenHeight() / 1.2);
inline static ImVec2 screen_size = ImVec2(-1, -1);
inline static bool show_menu = false;
inline static bool init_done = false;
inline static bool game_init = false;
inline static Renderer renderer = Render_Unknown;
inline static void* device = nullptr;
};
inline static std::ofstream flog = std::ofstream("CheatMenu.log");
inline static CJson config = CJson("config");
struct TextureStructure
{
std::string file_name;
@ -99,7 +102,4 @@ struct HotKeyData
int key1;
int key2;
bool is_down = false;
};
extern CJson config;
extern std::ofstream flog;
};