Improved hotkeys & more

1. Improved hotkey code #46
2. Added airbreak mode hotkey #47
3. Refactored code
This commit is contained in:
Grinch_ 2021-01-16 23:48:06 +06:00
parent 91ac2f02fe
commit 3a909e8aba
23 changed files with 131 additions and 166 deletions

View File

@ -5,7 +5,6 @@
"includePath": [
"${workspaceFolder}/src/",
"${DIRECTX9_SDK_DIR}/Include",
"C:/Program Files (x86)/DirectXSDK/Include",
"${PLUGIN_SDK_DIR}/plugin_sa",
"${PLUGIN_SDK_DIR}/plugin_sa/game_sa",
"${PLUGIN_SDK_DIR}/shared",

View File

@ -75,7 +75,8 @@
"shared_mutex": "cpp",
"thread": "cpp",
"trampoline.h": "c",
"minhook.h": "c"
"minhook.h": "c",
"*.rh": "cpp"
},
"C_Cpp.errorSquiggles": "Enabled",
"C_Cpp.intelliSenseEngineFallback": "Enabled"

View File

@ -59,16 +59,12 @@ CheatMenu::CheatMenu()
Events::processScriptsEvent += [this]
{
if (Globals::init_done && !FrontEndMenuManager.m_bMenuActive
&& CTimer::m_snTimeInMilliseconds - Globals::last_key_timer > 250*CTimer::ms_fTimeScale)
if (Globals::init_done && !FrontEndMenuManager.m_bMenuActive)
{
if (Ui::HotKeyPressed(hotkey::menu_open))
{
if (Ui::HotKeyPressed(hotkeys::menu_open))
Globals::show_menu = !Globals::show_menu;
Globals::last_key_timer = CTimer::m_snTimeInMilliseconds;
}
if (Ui::HotKeyPressed(hotkey::command_window))
if (Ui::HotKeyPressed(hotkeys::command_window))
{
if (Menu::commands::show_menu)
{
@ -76,8 +72,6 @@ CheatMenu::CheatMenu()
strcpy(commands::input_buffer,"");
}
Menu::commands::show_menu = !Menu::commands::show_menu;
Globals::last_key_timer = CTimer::m_snTimeInMilliseconds;
}
if (Hook::show_mouse != Globals::show_menu)

View File

@ -94,7 +94,7 @@ Game::Game()
if (ss_shortcut)
{
if (Ui::HotKeyPressed(Menu::hotkey::quick_ss) && timer - ss_shotcut_timer > 1000)
if (Ui::HotKeyPressed(Menu::hotkeys::quick_ss) && timer - ss_shotcut_timer > 1000)
{
Command<Commands::TAKE_PHOTO>();
CHud::SetHelpMessage("Screenshot taken", false, false, false);
@ -160,11 +160,18 @@ Game::Game()
}
}
}
if (airbreak::enable)
if (Ui::HotKeyPressed(Menu::hotkeys::airbreak))
{
AirbreakMode(player,hplayer);
if (airbreak::enable)
{
airbreak::enable = false;
ClearAirbreakStuff();
}
else airbreak::enable = true;
}
if (airbreak::enable)
AirbreakMode(player,hplayer);
};
}
@ -250,6 +257,28 @@ void Game::AirbreakMode(CPlayerPed* player, int hplayer)
player->SetPosn(pos);
}
void Game::ClearAirbreakStuff()
{
CPlayerPed *player = FindPlayerPed();
uint hplayer = CPools::GetPedRef(player);
airbreak::init_done = false;
Command<Commands::SET_EVERYONE_IGNORE_PLAYER>(0, false);
Command<Commands::FREEZE_CHAR_POSITION_AND_DONT_LOAD_COLLISION>(hplayer, false);
Command<Commands::SET_CHAR_COLLISION>(hplayer, true);
Command<Commands::SET_LOAD_COLLISION_FOR_CHAR_FLAG>(hplayer, true);
player->m_nPedFlags.bDontRender = false;
CHud::bScriptDontDisplayRadar = false;
CHud::m_Wants_To_Draw_Hud = true;
CVector pos = player->GetPosition();
CEntity* player_entity = FindPlayerEntity(-1);
pos.z = CWorld::FindGroundZFor3DCoord(pos.x, pos.y, 1000, 0, &player_entity) + 0.5f;
player->SetPosn(pos);
Command<Commands::RESTORE_CAMERA_JUMPCUT>();
}
void Game::Main()
{
ImGui::Spacing();
@ -308,7 +337,7 @@ of LS without completing missions"))
Command<Commands::SWITCH_ARREST_PENALTIES>(keep_stuff);
Command<Commands::SWITCH_DEATH_PENALTIES>(keep_stuff);
}
Ui::CheckboxWithHint("Screenshot shortcut", &ss_shortcut, (("Take screenshot using ") + Ui::GetHotKeyNameString(Menu::hotkey::quick_ss)
Ui::CheckboxWithHint("Screenshot shortcut", &ss_shortcut, (("Take screenshot using ") + Ui::GetHotKeyNameString(Menu::hotkeys::quick_ss)
+ "\nSaved inside 'GTA San Andreas User Files\\Gallery'").c_str());
if (Ui::CheckboxWithHint("Solid water", &solid_water, "Player can walk on water"))
{
@ -320,7 +349,6 @@ of LS without completing missions"))
}
if (ImGui::Checkbox("Sync system time", &sync_time))
{
Globals::gsync_time = sync_time;
if (sync_time)
patch::RedirectCall(0x53BFBD, &RealTimeClock);
else
@ -338,23 +366,7 @@ of LS without completing missions"))
\nLeft: J\t\t Right: L\n\nSlower: RCtrl\tFaster: RShift"))
{
if (!airbreak::enable)
{
airbreak::init_done = false;
Command<Commands::SET_EVERYONE_IGNORE_PLAYER>(0, false);
Command<Commands::FREEZE_CHAR_POSITION_AND_DONT_LOAD_COLLISION>(hplayer, false);
Command<Commands::SET_CHAR_COLLISION>(hplayer, true);
Command<Commands::SET_LOAD_COLLISION_FOR_CHAR_FLAG>(hplayer, true);
player->m_nPedFlags.bDontRender = false;
CHud::bScriptDontDisplayRadar = false;
CHud::m_Wants_To_Draw_Hud = true;
CVector pos = player->GetPosition();
CEntity* player_entity = FindPlayerEntity(-1);
pos.z = CWorld::FindGroundZFor3DCoord(pos.x, pos.y, 1000, 0, &player_entity) + 0.5f;
player->SetPosn(pos);
Command<Commands::RESTORE_CAMERA_JUMPCUT>();
}
ClearAirbreakStuff();
}
ImGui::Spacing();

View File

@ -1,7 +1,7 @@
#pragma once
class Game
{
private:
public:
static CJson json;
static ImGuiTextFilter filter;
static std::vector<std::string> search_categories;
@ -49,10 +49,10 @@ private:
static std::string selected_item;
};
public:
Game();
~Game();
static void Main();
static void AirbreakMode(CPlayerPed* player, int hplayer);
static void ClearAirbreakStuff();
};

View File

@ -18,11 +18,12 @@ int Menu::overlay::selected_pos = 4;
float Menu::overlay::posX = NULL;
float Menu::overlay::posY = NULL;
int Menu::hotkey::command_window[]{ VK_LMENU ,VK_KEY_C };
int Menu::hotkey::menu_open[]{VK_LCONTROL ,VK_KEY_M};
int Menu::hotkey::aim_skin_changer[]{ VK_RETURN ,VK_RETURN };
int Menu::hotkey::quick_ss[]{ VK_LCONTROL ,VK_KEY_S };
int Menu::hotkey::quick_tp[]{ VK_KEY_X ,VK_KEY_Y };
HotKeyData Menu::hotkeys::command_window{};
HotKeyData Menu::hotkeys::menu_open{};
HotKeyData Menu::hotkeys::aim_skin_changer{};
HotKeyData Menu::hotkeys::quick_ss{};
HotKeyData Menu::hotkeys::quick_tp{};
HotKeyData Menu::hotkeys::airbreak{};
bool Menu::commands::show_menu = false;
char Menu::commands::input_buffer[INPUT_BUFFER_SIZE] = "";
@ -44,20 +45,23 @@ Menu::Menu()
overlay::posY = config.GetValue("overlay.posY", 0);
// Hotkeys
hotkey::aim_skin_changer[0] = config.GetValue("hotkey.aim_skin_changer.key1", VK_RETURN);
hotkey::aim_skin_changer[1] = config.GetValue("hotkey.aim_skin_changer.key2", VK_RETURN);
hotkeys::aim_skin_changer.key1 = config.GetValue("hotkey.aim_skin_changer.key1", VK_RETURN);
hotkeys::aim_skin_changer.key2 = config.GetValue("hotkey.aim_skin_changer.key2", VK_RETURN);
hotkey::quick_ss[0] = config.GetValue("hotkey.quick_screenshot.key1", VK_LCONTROL);
hotkey::quick_ss[1] = config.GetValue("hotkey.quick_screenshot.key2", VK_KEY_S);
hotkeys::airbreak.key1 = config.GetValue("hotkey.airbreak.key1", VK_LMENU);
hotkeys::airbreak.key2 = config.GetValue("hotkey.airbreak.key2", VK_KEY_A);
hotkey::quick_tp[0] = config.GetValue("hotkey.quick_tp.key1", VK_KEY_X);
hotkey::quick_tp[1] = config.GetValue("hotkey.quick_tp.key2", VK_KEY_Y);
hotkeys::quick_ss.key1 = config.GetValue("hotkey.quick_screenshot.key1", VK_LCONTROL);
hotkeys::quick_ss.key2 = config.GetValue("hotkey.quick_screenshot.key2", VK_KEY_S);
hotkey::menu_open[0] = config.GetValue("hotkey.menu_open.key1", VK_LCONTROL);
hotkey::menu_open[1] = config.GetValue("hotkey.menu_open.key2", VK_KEY_M);
hotkeys::quick_tp.key1 = config.GetValue("hotkey.quick_tp.key1", VK_KEY_X);
hotkeys::quick_tp.key2 = config.GetValue("hotkey.quick_tp.key2", VK_KEY_Y);
hotkey::command_window[0] = config.GetValue("hotkey.command_window.key1", VK_LMENU);
hotkey::command_window[1] = config.GetValue("hotkey.command_window.key2", VK_KEY_C);
hotkeys::menu_open.key1 = config.GetValue("hotkey.menu_open.key1", VK_LCONTROL);
hotkeys::menu_open.key2 = config.GetValue("hotkey.menu_open.key2", VK_KEY_M);
hotkeys::command_window.key1 = config.GetValue("hotkey.command_window.key1", VK_LMENU);
hotkeys::command_window.key2 = config.GetValue("hotkey.command_window.key2", VK_KEY_C);
};
}
@ -315,33 +319,38 @@ void Menu::Main()
ImGui::Spacing();
ImGui::BeginChild("Hotkeys");
if (Ui::HotKey("Open/ close cheat menu", hotkey::menu_open))
if (Ui::HotKey("Open/ close cheat menu", hotkeys::menu_open))
{
config.SetValue("hotkey.menu_open.key1", hotkey::menu_open[0]);
config.SetValue("hotkey.menu_open.key2", hotkey::menu_open[1]);
config.SetValue("hotkey.menu_open.key1", hotkeys::menu_open.key1);
config.SetValue("hotkey.menu_open.key2", hotkeys::menu_open.key2);
}
if (Ui::HotKey("Open/ close command window", hotkey::command_window))
if (Ui::HotKey("Open/ close command window", hotkeys::command_window))
{
config.SetValue("hotkey.command_window.key1", hotkey::command_window[0]);
config.SetValue("hotkey.command_window.key2", hotkey::command_window[1]);
config.SetValue("hotkey.command_window.key1", hotkeys::command_window.key1);
config.SetValue("hotkey.command_window.key2", hotkeys::command_window.key2);
}
ImGui::Dummy(ImVec2(0,10));
if (Ui::HotKey("Activate aim skin changer", hotkey::aim_skin_changer))
if (Ui::HotKey("Activate aim skin changer", hotkeys::aim_skin_changer))
{
config.SetValue("hotkey.aim_skin_changer.key1", hotkey::aim_skin_changer[0]);
config.SetValue("hotkey.aim_skin_changer.key2", hotkey::aim_skin_changer[1]);
config.SetValue("hotkey.aim_skin_changer.key1", hotkeys::aim_skin_changer.key1);
config.SetValue("hotkey.aim_skin_changer.key2", hotkeys::aim_skin_changer.key2);
}
if (Ui::HotKey("Take quick screenshot", hotkey::quick_ss))
if (Ui::HotKey("Airbreak mode", hotkeys::airbreak))
{
config.SetValue("hotkey.quick_screenshot.key1", hotkey::quick_ss[0]);
config.SetValue("hotkey.quick_screenshot.key2", hotkey::quick_ss[1]);
config.SetValue("hotkey.airbreak.key1", hotkeys::airbreak.key1);
config.SetValue("hotkey.airbreak.key2", hotkeys::airbreak.key2);
}
if (Ui::HotKey("Toggle quick teleport", hotkey::quick_tp))
if (Ui::HotKey("Take quick screenshot", hotkeys::quick_ss))
{
config.SetValue("hotkey.quick_tp.key1", hotkey::quick_tp[0]);
config.SetValue("hotkey.quick_tp.key2", hotkey::quick_tp[1]);
config.SetValue("hotkey.quick_screenshot.key1", hotkeys::quick_ss.key1);
config.SetValue("hotkey.quick_screenshot.key2", hotkeys::quick_ss.key2);
}
if (Ui::HotKey("Toggle quick teleport", hotkeys::quick_tp))
{
config.SetValue("hotkey.quick_tp.key1", hotkeys::quick_tp.key1);
config.SetValue("hotkey.quick_tp.key2", hotkeys::quick_tp.key2);
}
ImGui::Dummy(ImVec2(0, 10));
@ -353,7 +362,7 @@ void Menu::Main()
{
if (ImGui::BeginChild("CommandsChild"))
{
ImGui::TextWrapped(std::string("Open or close command window using " + Ui::GetHotKeyNameString(hotkey::command_window)).c_str());
ImGui::TextWrapped(std::string("Open or close command window using " + Ui::GetHotKeyNameString(hotkeys::command_window)).c_str());
ImGui::Spacing();
if (ImGui::CollapsingHeader("Set health"))
{

View File

@ -17,13 +17,14 @@ private:
static float posY;
};
public:
struct hotkey
struct hotkeys
{
static int command_window[2];
static int menu_open[2];
static int aim_skin_changer[2];
static int quick_ss[2];
static int quick_tp[2];
static HotKeyData command_window;
static HotKeyData menu_open;
static HotKeyData aim_skin_changer;
static HotKeyData quick_ss;
static HotKeyData quick_tp;
static HotKeyData airbreak;
};
struct commands
{

View File

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

View File

@ -10,7 +10,6 @@ std::map<std::string, std::shared_ptr<RwTexture>> Paint::textures;
Paint::Paint()
{
Events::initGameEvent += []
{
for (auto &p : fs::recursive_directory_iterator(PLUGIN_PATH((char*)"\\CheatMenu\\vehicles\\paintjobs\\")))

View File

@ -14,8 +14,6 @@ public:
};
static std::map<std::string, std::shared_ptr<RwTexture>> textures;
protected:
static void UpdateNodeListRecursive(CVehicle* pVeh);
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);

View File

@ -98,7 +98,7 @@ Player::Player()
player->m_nPhysicalFlags.bMeeleProof = 1;
}
if (aim_skin_changer && Ui::HotKeyPressed(Menu::hotkey::aim_skin_changer))
if (aim_skin_changer && Ui::HotKeyPressed(Menu::hotkeys::aim_skin_changer))
{
CPed *target_ped = player->m_pPlayerTargettedPed;
if (target_ped)
@ -343,7 +343,7 @@ void Player::Main()
if (ImGui::BeginTabItem("Appearance"))
{
ImGui::Spacing();
if (Ui::CheckboxWithHint("Aim skin changer", &aim_skin_changer,(("Activate using Aim ped + ") + Ui::GetHotKeyNameString(Menu::hotkey::aim_skin_changer)).c_str()))
if (Ui::CheckboxWithHint("Aim skin changer", &aim_skin_changer,(("Activate using Aim ped + ") + Ui::GetHotKeyNameString(Menu::hotkeys::aim_skin_changer)).c_str()))
config.SetValue("aim_skin_changer", aim_skin_changer);
if (ImGui::BeginTabBar("AppearanceTabBar"))

View File

@ -85,7 +85,7 @@ Teleport::Teleport()
if (quick_teleport)
{
if (Ui::HotKeyPressed(Menu::hotkey::quick_tp)
if (Ui::HotKeyPressed(Menu::hotkeys::quick_tp)
&& ((CTimer::m_snTimeInMilliseconds - quick_teleport_timer) > 500))
{
quick_teleport_timer = CTimer::m_snTimeInMilliseconds;
@ -195,7 +195,7 @@ void Teleport::Main()
ImGui::Checkbox("Insert coordinates", &insert_coord);
ImGui::NextColumn();
if (Ui::CheckboxWithHint("Quick teleport", &quick_teleport,
(std::string("Teleport to marker using ") + Ui::GetHotKeyNameString(Menu::hotkey::quick_tp)).c_str()))
(std::string("Teleport to marker using ") + Ui::GetHotKeyNameString(Menu::hotkeys::quick_tp)).c_str()))
{
config.SetValue("quick_teleport", quick_teleport);
}

View File

@ -782,7 +782,7 @@ void Ui::EditFloat(const char *label, const int address, const float min, const
}
}
bool Ui::HotKey(const char* label, int* key_array)
bool Ui::HotKey(const char* label, HotKeyData& key_data)
{
bool active = current_hotkey == label;
bool state = false;
@ -795,7 +795,7 @@ bool Ui::HotKey(const char* label, int* key_array)
{
if (KeyPressed(key))
{
key_array[0] = key;
key_data.key1 = key;
break;
}
}
@ -804,16 +804,16 @@ bool Ui::HotKey(const char* label, int* key_array)
{
if (KeyPressed(key))
{
key_array[1] = key;
key_data.key2 = key;
break;
}
}
}
std::string text = key_names[key_array[0]-1];
std::string text = key_names[key_data.key1-1];
if (key_array[0] != key_array[1])
text += (" + " + key_names[key_array[1]-1]);
if (key_data.key1 != key_data.key2)
text += (" + " + key_names[key_data.key2-1]);
if (ImGui::Button((text + std::string("##") + std::string(label)).c_str(), ImVec2(ImGui::GetWindowContentRegionWidth() / 3, ImGui::GetFrameHeight())))
{
@ -837,22 +837,27 @@ bool Ui::HotKey(const char* label, int* key_array)
return state;
}
bool Ui::HotKeyPressed(int *hotkey)
bool Ui::HotKeyPressed(HotKeyData& hotkey)
{
return current_hotkey == "" && KeyPressed(hotkey[0]) && KeyPressed(hotkey[1]);
if (CTimer::m_snTimeInMilliseconds - hotkey.timer > 250*CTimer::ms_fTimeScale)
{
hotkey.timer = CTimer::m_snTimeInMilliseconds;
return current_hotkey == "" && KeyPressed(hotkey.key1) && KeyPressed(hotkey.key2);
}
else
return false;
}
std::string Ui::GetHotKeyNameString(int *hotkey)
std::string Ui::GetHotKeyNameString(HotKeyData& hotkey)
{
std::string text = key_names[hotkey[0] - 1];
std::string text = key_names[hotkey.key1 - 1];
if (hotkey[0] != hotkey[1])
text += (" + " + key_names[hotkey[1] - 1]);
if (hotkey.key1 != hotkey.key2)
text += (" + " + key_names[hotkey.key2 - 1]);
return text;
}
bool Ui::ColorButton(int color_id, std::vector<float> &color, ImVec2 size)
{
bool rtn = false;

View File

@ -61,9 +61,9 @@ public:
static ImVec2 GetSize(short count = 1, bool spacing = true);
static bool HotKey(const char* label, int* key_array);
static bool HotKeyPressed(int *hotkey);
static std::string GetHotKeyNameString(int *hotkey);
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 ListBoxStr(const char* label, std::vector<std::string>& all_items, std::string& selected);

View File

@ -15,7 +15,6 @@ public:
static std::string GetLocationName(CVector *pos);
static void RainbowValues(int &r, int&g, int &b, float speed);
// This below source is taken from MoonAdditions https://github.com/THE-FYP/MoonAdditions
// MIT License

View File

@ -156,8 +156,8 @@ Vehicle::Vehicle()
if (veh->m_nVehicleClass == CLASS_EXECUTIVE) // Executive
chance = rand() % 3 + 1;
if (chance == 1 && !IsNeonInstalled(veh) && veh->m_pDriver != player)
InstallNeon(veh, rand() % 255, rand() % 255, rand() % 255);
if (chance == 1 && !NeonAPI::IsNeonInstalled(veh) && veh->m_pDriver != player)
NeonAPI::InstallNeon(veh, rand() % 255, rand() % 255, rand() % 255);
}
neon::traffic_timer = timer;
}

View File

@ -1,8 +1,8 @@
#pragma once
#include "NeonAPI.h"
#include "Paint.h"
#pragma once
class Vehicle : NeonAPI, Paint
class Vehicle : Paint, NeonAPI
{
private:
static bool bike_fly;

View File

@ -2,6 +2,7 @@
#include "Visual.h"
#include "Ui.h"
#include "Util.h"
#include "Game.h"
bool Visual::lock_weather = false;
int Visual::weather_type_backup = 0;
@ -257,28 +258,27 @@ void Visual::Main()
int hour = CClock::ms_nGameClockHours;
int minute = CClock::ms_nGameClockMinutes;
if (Globals::gsync_time)
if (Game::sync_time)
{
ImGui::PushItemFlag(ImGuiItemFlags_Disabled, true);
ImGui::PushStyleVar(ImGuiStyleVar_Alpha, ImGui::GetStyle().Alpha * 0.5f);
}
if (ImGui::InputInt("Hour", &hour) & !Globals::gsync_time)
if (ImGui::InputInt("Hour", &hour) & !Game::sync_time)
{
if (hour < 0) hour = 23;
if (hour > 23) hour = 0;
CClock::ms_nGameClockHours = hour;
}
if (ImGui::InputInt("Minute", &minute) & !Globals::gsync_time)
if (ImGui::InputInt("Minute", &minute) & !Game::sync_time)
{
if (minute < 0) minute = 59;
if (minute > 59) minute = 0;
CClock::ms_nGameClockMinutes = minute;
}
if (Globals::gsync_time)
if (Game::sync_time)
{
ImGui::PopStyleVar();
ImGui::PopItemFlag();

View File

@ -1,13 +1,11 @@
#include "pch.h"
std::string Globals::header_id = "";
int Globals::last_key_timer = 0;
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;
bool Globals::gsync_time = false;
void *Globals::device = nullptr;
std::ofstream flog = std::ofstream("CheatMenu.log");

View File

@ -81,13 +81,11 @@ enum Renderer
struct Globals
{
static std::string header_id;
static int last_key_timer;
static ImVec2 menu_size;
static ImVec2 screen_size;
static bool show_menu;
static bool init_done;
static Renderer renderer;
static bool gsync_time;
static void* device;
};
@ -98,5 +96,12 @@ struct TextureStructure
void *texture = nullptr;
};
struct HotKeyData
{
int key1;
int key2;
uint timer = 0;
};
extern CJson config;
extern std::ofstream flog;

View File

@ -11,14 +11,7 @@ project(Test)
################################################################################
set(test_files
"../vendor/fla/Main.h"
"../vendor/fla/Main.cpp"
"../vendor/fla/IDaccess.h"
"../vendor/fla/IDaccess.cpp"
"../vendor/fla/Library/Library.h"
"../vendor/fla/Library/Library.cpp"
"Test.cpp"
"Dllmain.cpp"
)
add_library(${PROJECT_NAME} SHARED ${test_files})

View File

@ -1,31 +0,0 @@
#include <Windows.h>
#include "../vendor\fla\Main.h"
BOOL WINAPI DllMain(
HINSTANCE hinstDLL, // handle to DLL module
DWORD fdwReason, // reason for calling function
LPVOID lpReserved ) // reserved
{
// Perform actions based on the reason for calling.
switch( fdwReason )
{
case DLL_PROCESS_ATTACH:
// Initialize once for each new process.
// Return FALSE to fail DLL load.
CFastman92limitAdjuster::Init();
break;
case DLL_THREAD_ATTACH:
// Do thread-specific initialization.
break;
case DLL_THREAD_DETACH:
// Do thread-specific cleanup.
break;
case DLL_PROCESS_DETACH:
// Perform any necessary cleanup.
break;
}
return TRUE; // Successful DLL_PROCESS_ATTACH.
}

View File

@ -1,5 +1,4 @@
#include "plugin.h"
#include "../vendor/fla/IDaccess.h"
#include "CHud.h"
using namespace plugin;
@ -9,25 +8,9 @@ class Test
public:
Test()
{
Events::initRwEvent += []
{
CFastman92limitAdjuster::Init();
};
Events::processScriptsEvent += []
{
CPlayerPed *player = FindPlayerPed();
if(KeyPressed(VK_UP) && player && player->m_pVehicle)
{
uint8_replacement &primary_color = *(uint8_replacement*)&player->m_pVehicle->m_nPrimaryColor;
primary_color = 74;
CHud::SetHelpMessage("Color changed",false,false,false);
}
if(KeyPressed(VK_DOWN))
{
}
};
}
} test;