Add vice city support

This commit is contained in:
Grinch_ 2021-08-02 07:41:48 +06:00
parent 3c3dff6716
commit 257192540d
27 changed files with 420 additions and 130 deletions

View File

@ -6,8 +6,10 @@
"${workspaceFolder}/**", "${workspaceFolder}/**",
"${PLUGIN_SDK_DIR}/*", "${PLUGIN_SDK_DIR}/*",
"${DIRECTX9_SDK_DIR}/Include/*", "${DIRECTX9_SDK_DIR}/Include/*",
"${PLUGIN_SDK_DIR}/plugin_sa/*", // "${PLUGIN_SDK_DIR}/plugin_sa/*",
"${PLUGIN_SDK_DIR}/plugin_sa/game_sa/*", // "${PLUGIN_SDK_DIR}/plugin_sa/game_sa/*",
"${PLUGIN_SDK_DIR}/plugin_vc/*",
"${PLUGIN_SDK_DIR}/plugin_vc/game_vc/*",
"${PLUGIN_SDK_DIR}/shared/*", "${PLUGIN_SDK_DIR}/shared/*",
"${PLUGIN_SDK_DIR}/shared/game/*", "${PLUGIN_SDK_DIR}/shared/game/*",
"C:\\Program Files (x86)\\Windows Kits\\10\\Include\\10.0.19041.0\\ucrt\\*", "C:\\Program Files (x86)\\Windows Kits\\10\\Include\\10.0.19041.0\\ucrt\\*",
@ -18,7 +20,7 @@
"IS_PLATFORM_WIN", "IS_PLATFORM_WIN",
"_CRT_SECURE_NO_WARNINGS", "_CRT_SECURE_NO_WARNINGS",
"_CRT_NON_CONFORMING_SWPRINTFS", "_CRT_NON_CONFORMING_SWPRINTFS",
"GTASA", "GTAVC",
"_DX9_SDK_INSTALLED", "_DX9_SDK_INSTALLED",
"PLUGIN_SGV_10US" "PLUGIN_SGV_10US"
], ],

11
.vscode/launch.json vendored
View File

@ -15,6 +15,17 @@
"environment": [], "environment": [],
"console": "internalConsole" "console": "internalConsole"
}, },
{
"name": "Launch VC",
"type": "cppvsdbg",
"request": "launch",
"program": "F:/GTA Vice City/gta-vc.exe",
"args": [],
"stopAtEntry": false,
"cwd": "C:/Work/GTASanAndreas/",
"environment": [],
"console": "internalConsole"
},
{ {
"name": "Attach", "name": "Attach",
"type": "cppvsdbg", "type": "cppvsdbg",

42
.vscode/tasks.json vendored
View File

@ -4,9 +4,9 @@
"version": "2.0.0", "version": "2.0.0",
"tasks": [ "tasks": [
{ {
"label": "Build Debug", "label": "Build DebugSA",
"type": "shell", "type": "shell",
"command": "${workspaceFolder}/tools/Debug.bat", "command": "${workspaceFolder}/tools/DebugSA.bat",
"presentation": { "presentation": {
"echo": true, "echo": true,
"reveal": "always", "reveal": "always",
@ -21,9 +21,43 @@
} }
}, },
{ {
"label": "Build Release", "label": "Build ReleaseSA",
"type": "shell", "type": "shell",
"command": "${workspaceFolder}/tools/Release.bat", "command": "${workspaceFolder}/tools/ReleaseSA.bat",
"presentation": {
"echo": true,
"reveal": "always",
"focus": false,
"panel": "shared",
"showReuseMessage": false,
"clear": true
},
"group": {
"kind": "build",
"isDefault": true
}
},
{
"label": "Build DebugVC",
"type": "shell",
"command": "${workspaceFolder}/tools/DebugVC.bat",
"presentation": {
"echo": true,
"reveal": "always",
"focus": false,
"panel": "shared",
"showReuseMessage": false,
"clear": true
},
"group": {
"kind": "build",
"isDefault": true
}
},
{
"label": "Build ReleaseVC",
"type": "shell",
"command": "${workspaceFolder}/tools/ReleaseVC.bat",
"presentation": { "presentation": {
"echo": true, "echo": true,
"reveal": "always", "reveal": "always",

View File

@ -39,7 +39,7 @@ void Animation::PlayCutscene(std::string& rootKey, std::string& cutsceneId, std:
{ {
if (Util::IsOnCutscene()) if (Util::IsOnCutscene())
{ {
CHud::SetHelpMessage("Another cutscene is running", false, false, false); SetHelpMessage("Another cutscene is running", false, false, false);
return; return;
} }
@ -97,7 +97,7 @@ void Animation::Draw()
if (Ui::ListBox("Fighting style", m_FightingStyleList, m_nFightingStyle)) if (Ui::ListBox("Fighting style", m_FightingStyleList, m_nFightingStyle))
{ {
Command<Commands::GIVE_MELEE_ATTACK_TO_CHAR>(hPlayer, m_nFightingStyle + 4, 6); Command<Commands::GIVE_MELEE_ATTACK_TO_CHAR>(hPlayer, m_nFightingStyle + 4, 6);
CHud::SetHelpMessage("Fighting anim set", false, false, false); SetHelpMessage("Fighting anim set", false, false, false);
} }
if (Ui::ListBoxStr("Walking style", m_WalkingStyleList, m_nWalkingStyle)) if (Ui::ListBoxStr("Walking style", m_WalkingStyleList, m_nWalkingStyle))
{ {
@ -114,7 +114,7 @@ void Animation::Draw()
Command<Commands::SET_ANIM_GROUP_FOR_CHAR>(hPlayer, m_nWalkingStyle.c_str()); Command<Commands::SET_ANIM_GROUP_FOR_CHAR>(hPlayer, m_nWalkingStyle.c_str());
Command<Commands::REMOVE_ANIMATION>(m_nWalkingStyle.c_str()); Command<Commands::REMOVE_ANIMATION>(m_nWalkingStyle.c_str());
} }
CHud::SetHelpMessage("Walking anim set", false, false, false); SetHelpMessage("Walking anim set", false, false, false);
} }
ImGui::EndTabItem(); ImGui::EndTabItem();
} }
@ -189,8 +189,8 @@ void Animation::RemoveAnimation(std::string& ifp, std::string& anim, std::string
{ {
m_AnimData.m_Json.m_Data["Custom"].erase(anim); m_AnimData.m_Json.m_Data["Custom"].erase(anim);
m_AnimData.m_Json.WriteToDisk(); m_AnimData.m_Json.WriteToDisk();
CHud::SetHelpMessage("Animation removed", false, false, false); SetHelpMessage("Animation removed", false, false, false);
} }
else else
CHud::SetHelpMessage("You can only remove custom anims", false, false, false); SetHelpMessage("You can only remove custom anims", false, false, false);
} }

View File

@ -7,21 +7,29 @@
void CheatMenu::DrawWindow() void CheatMenu::DrawWindow()
{ {
ImGuiIO& io = ImGui::GetIO(); ImGuiIO& io = ImGui::GetIO();
static bool game_running = true; static bool bRunning = true;
#ifdef GTASA
if (FrontEndMenuManager.m_bMenuActive) if (FrontEndMenuManager.m_bMenuActive)
#elif GTAVC
if (FrontendMenuManager.m_bMenuVisible)
#endif
{ {
if (game_running) if (bRunning)
{ {
config.WriteToDisk(); config.WriteToDisk();
game_running = false; bRunning = false;
m_bShowMouse = false; m_bShowMouse = false;
} }
} }
else else
{ {
game_running = true; bRunning = true;
#ifdef GTASA
if (Globals::m_bShowMenu || m_Commands::m_bShowMenu) if (Globals::m_bShowMenu || m_Commands::m_bShowMenu)
#elif GTAVC
if (Globals::m_bShowMenu)
#endif
{ {
if (Globals::m_bShowMenu) if (Globals::m_bShowMenu)
{ {
@ -45,8 +53,12 @@ void CheatMenu::DrawWindow()
ImGui::End(); ImGui::End();
} }
} }
#ifdef GTASA
else else
{
DrawShortcutsWindow(); DrawShortcutsWindow();
}
#endif
} }
} }
DrawOverlay(); DrawOverlay();
@ -65,10 +77,18 @@ CheatMenu::CheatMenu()
Events::processScriptsEvent += []() Events::processScriptsEvent += []()
{ {
if (Globals::m_bInit && !FrontEndMenuManager.m_bMenuActive) if (Globals::m_bInit &&
#ifdef GTASA
!FrontEndMenuManager.m_bMenuActive
#elif GTAVC
!FrontendMenuManager.m_bMenuVisible
#endif
)
{ {
if (Ui::HotKeyPressed(Menu::m_HotKeys::menuOpen)) if (Ui::HotKeyPressed(Menu::m_HotKeys::menuOpen))
{
Globals::m_bShowMenu = !Globals::m_bShowMenu; Globals::m_bShowMenu = !Globals::m_bShowMenu;
}
if (Ui::HotKeyPressed(Menu::m_HotKeys::commandWindow)) if (Ui::HotKeyPressed(Menu::m_HotKeys::commandWindow))
{ {
@ -176,7 +196,9 @@ void MenuThread(void* param)
} }
static bool bGameInit = false; static bool bGameInit = false;
#ifdef GTASA
Hook::ApplyMouseFix(); Hook::ApplyMouseFix();
#endif
// Wait till the game is initialized // Wait till the game is initialized
Events::initRwEvent += [] Events::initRwEvent += []
@ -222,6 +244,7 @@ BOOL WINAPI DllMain(HINSTANCE hDllHandle, DWORD nReason, LPVOID Reserved)
if (nReason == DLL_PROCESS_ATTACH) if (nReason == DLL_PROCESS_ATTACH)
{ {
uint gameVersion = GetGameVersion(); uint gameVersion = GetGameVersion();
#ifdef GTASA
if (gameVersion == GAME_10US_HOODLUM || gameVersion == GAME_10US_COMPACT) if (gameVersion == GAME_10US_HOODLUM || gameVersion == GAME_10US_COMPACT)
{ {
CreateThread(nullptr, NULL, (LPTHREAD_START_ROUTINE)&MenuThread, nullptr, NULL, nullptr); CreateThread(nullptr, NULL, (LPTHREAD_START_ROUTINE)&MenuThread, nullptr, NULL, nullptr);
@ -230,6 +253,16 @@ 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); 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);
}
else
{
MessageBox(HWND_DESKTOP, "Unknown game version. GTA VC v1.0 EN is required.", "CheatMenu", MB_ICONERROR);
}
#endif
} }
return TRUE; return TRUE;

View File

@ -9,26 +9,38 @@
*/ */
#pragma once #pragma once
#include "Animation.h"
#include "Game.h"
#include "Hook.h" #include "Hook.h"
#include "Menu.h" #include "Menu.h"
#include "Ped.h"
#include "Player.h"
#include "Teleport.h" #include "Teleport.h"
#include "Vehicle.h"
#include "Visual.h"
#include "Weapon.h"
class CheatMenu : Hook, Animation, Game, Menu, Ped, Player, Teleport, Vehicle, Visual, Weapon #ifdef GTASA
#include "Animation.h"
#include "Game.h"
#include "Ped.h"
#include "Player.h"
#include "Vehicle.h"
#include "Visual.h"
#include "Weapon.h"
class CheatMenu : Hook, Animation, Game, Menu, Ped, Player, Teleport, Vehicle, Visual, Weapon
#elif defined(GTAVC)
class CheatMenu : Hook, Menu, Teleport
#endif
{ {
private: private:
inline static CallbackTable header #ifdef GTASA
{ inline static CallbackTable header
{"Teleport", &Teleport::Draw}, {"Player", &Player::Draw}, {"Ped", &Ped::Draw}, {
{"Animation", &Animation::Draw}, {"Vehicle", &Vehicle::Draw}, {"Weapon", &Weapon::Draw}, {"Teleport", &Teleport::Draw}, {"Player", &Player::Draw}, {"Ped", &Ped::Draw},
{"Game", &Game::Draw}, {"Visual", &Visual::Draw}, {"Menu", &Menu::Draw} {"Animation", &Animation::Draw}, {"Vehicle", &Vehicle::Draw}, {"Weapon", &Weapon::Draw},
}; {"Game", &Game::Draw}, {"Visual", &Visual::Draw}, {"Menu", &Menu::Draw}
};
#elif GTAVC
inline static CallbackTable header
{
{"Teleport", &Teleport::Draw}, {"Menu", &Menu::Draw}
};
#endif
static void ApplyStyle(); static void ApplyStyle();
static void DrawWindow(); static void DrawWindow();

View File

@ -62,7 +62,7 @@ Game::Game()
if (Ui::HotKeyPressed(Menu::m_HotKeys::quickSceenShot)) if (Ui::HotKeyPressed(Menu::m_HotKeys::quickSceenShot))
{ {
Command<Commands::TAKE_PHOTO>(); Command<Commands::TAKE_PHOTO>();
CHud::SetHelpMessage("Screenshot taken", false, false, false); SetHelpMessage("Screenshot taken", false, false, false);
} }
} }
@ -133,7 +133,7 @@ Game::Game()
if (m_RandomCheats::m_EnabledCheats[i][1] == "true") if (m_RandomCheats::m_EnabledCheats[i][1] == "true")
{ {
((void(*)(int))0x00438370)(id); // cheatEnableLegimate(int CheatID) ((void(*)(int))0x00438370)(id); // cheatEnableLegimate(int CheatID)
CHud::SetHelpMessage(m_RandomCheats::m_EnabledCheats[i][0].c_str(), false, false, false); SetHelpMessage(m_RandomCheats::m_EnabledCheats[i][0].c_str(), false, false, false);
m_RandomCheats::m_nTimer = timer; m_RandomCheats::m_nTimer = timer;
} }
break; break;
@ -174,7 +174,7 @@ void SetPlayerMission(std::string& rootkey, std::string& name, std::string& id)
player->SetWantedLevel(0); player->SetWantedLevel(0);
Command<Commands::LOAD_AND_LAUNCH_MISSION_INTERNAL>(std::stoi(id)); Command<Commands::LOAD_AND_LAUNCH_MISSION_INTERNAL>(std::stoi(id));
} }
else CHud::SetHelpMessage("Can't start mission now", false, false, false); else SetHelpMessage("Can't start mission now", false, false, false);
} }
void Game::FreeCam() void Game::FreeCam()
@ -239,7 +239,7 @@ void Game::FreeCam()
// disble them again cause they get enabled // disble them again cause they get enabled
CHud::bScriptDontDisplayRadar = true; CHud::bScriptDontDisplayRadar = true;
CHud::m_Wants_To_Draw_Hud = false; CHud::m_Wants_To_Draw_Hud = false;
CHud::SetHelpMessage("Player telported", false, false, false); SetHelpMessage("Player telported", false, false, false);
} }
if (KeyPressed(VK_RCONTROL)) if (KeyPressed(VK_RCONTROL))

View File

@ -9,7 +9,9 @@ LRESULT Hook::WndProc(const HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
if (ImGui::GetIO().WantTextInput) if (ImGui::GetIO().WantTextInput)
{ {
#ifdef GTASA
Call<0x53F1E0>(); // CPad::ClearKeyboardHistory Call<0x53F1E0>(); // CPad::ClearKeyboardHistory
#endif
return 1; return 1;
} }
@ -111,8 +113,10 @@ void Hook::RenderFrame(void* ptr)
ImGui_ImplWin32_Init(RsGlobal.ps->window); ImGui_ImplWin32_Init(RsGlobal.ps->window);
#ifdef GTASA
// shift trigger fix // shift trigger fix
patch::Nop(0x00531155, 5); patch::Nop(0x00531155, 5);
#endif
if (Globals::renderer == Render_DirectX9) if (Globals::renderer == Render_DirectX9)
{ {
@ -161,10 +165,26 @@ void Hook::ShowMouse(bool state)
ImGui::GetIO().MouseDrawCursor = state; ImGui::GetIO().MouseDrawCursor = state;
#ifdef GTASA
Hook::ApplyMouseFix(); // Reapply the patches
#elif GTAVC
if (m_bShowMouse)
{
patch::SetUChar(0x6020A0, 0xC3); // psSetMousePos
patch::Nop(0x4AB6CA, 5); // don't call CPad::UpdateMouse()
}
else
{
patch::SetUChar(0x6020A0, 0x53);
patch::SetRaw(0x4AB6CA, (char*)"\xE8\x51\x21\x00\x00", 5);
}
#endif
CPad::NewMouseControllerState.X = 0; CPad::NewMouseControllerState.X = 0;
CPad::NewMouseControllerState.Y = 0; CPad::NewMouseControllerState.Y = 0;
CPad::ClearMouseHistory();
CPad::UpdatePads();
m_bMouseVisibility = m_bShowMouse; m_bMouseVisibility = m_bShowMouse;
Hook::ApplyMouseFix(); // Reapply the patches
} }
} }
@ -199,6 +219,7 @@ Hook::~Hook()
kiero::shutdown(); kiero::shutdown();
} }
#ifdef GTASA
struct Mouse struct Mouse
{ {
unsigned int x, y; unsigned int x, y;
@ -280,3 +301,5 @@ void Hook::ApplyMouseFix()
patch::SetChar(0x746A08, 32); // diMouseOffset patch::SetChar(0x746A08, 32); // diMouseOffset
patch::SetChar(0x746A58, 32); // diDeviceoffset patch::SetChar(0x746A58, 32); // diDeviceoffset
} }
#endif

View File

@ -26,7 +26,10 @@ private:
public: public:
inline static bool m_bShowMouse = false; inline static bool m_bShowMouse = false;
inline static std::function<void()> windowCallback = nullptr; inline static std::function<void()> windowCallback = nullptr;
#ifdef GTASA
static void ApplyMouseFix(); static void ApplyMouseFix();
#endif
Hook(); Hook();
~Hook(); ~Hook();

View File

@ -1,13 +1,16 @@
#include "pch.h" #include "pch.h"
#include "MenuInfo.h" #include "MenuInfo.h"
#include "Menu.h" #include "Menu.h"
#include "Teleport.h"
#include "Weapon.h"
#include "Vehicle.h"
#include "Ui.h" #include "Ui.h"
#include "Util.h" #include "Util.h"
#include "Updater.h" #include "Updater.h"
#ifdef GTASA
#include "Teleport.h"
#include "Weapon.h"
#include "Vehicle.h"
#endif
Menu::Menu() Menu::Menu()
{ {
// TODO: use structs // TODO: use structs
@ -142,7 +145,15 @@ void Menu::DrawOverlay()
GlobalMemoryStatusEx(&memInfo); GlobalMemoryStatusEx(&memInfo);
int mUsedRam = static_cast<int>((memInfo.ullTotalPhys - memInfo.ullAvailPhys) * 1e-6); int mUsedRam = static_cast<int>((memInfo.ullTotalPhys - memInfo.ullAvailPhys) * 1e-6);
m_Overlay::fMemUsage = 100.0f * (static_cast<float>(mUsedRam) / static_cast<float>(m_Overlay::mTotalRam)); m_Overlay::fMemUsage = 100.0f * (static_cast<float>(mUsedRam) / static_cast<float>(m_Overlay::mTotalRam));
m_Overlay::mFPS = static_cast<size_t>(CTimer::game_FPS);
m_Overlay::mFPS = static_cast<size_t>
(
#ifdef GTASA
CTimer::game_FPS
#elif GTAVC
io.Framerate
#endif
);
m_Overlay::mLastInterval = game_ms; m_Overlay::mLastInterval = game_ms;
} }
@ -232,7 +243,7 @@ void Menu::ProcessCommands()
} }
catch (...) catch (...)
{ {
CHud::SetHelpMessage("Invalid value", false, false, false); SetHelpMessage("Invalid value", false, false, false);
} }
} }
@ -249,10 +260,11 @@ void Menu::ProcessCommands()
} }
catch (...) catch (...)
{ {
CHud::SetHelpMessage("Invalid value", false, false, false); SetHelpMessage("Invalid value", false, false, false);
} }
} }
#ifdef GTASA
if (command == "tp") if (command == "tp")
{ {
try try
@ -273,7 +285,7 @@ void Menu::ProcessCommands()
} }
catch (...) catch (...)
{ {
CHud::SetHelpMessage("Invalid location", false, false, false); SetHelpMessage("Invalid location", false, false, false);
} }
} }
@ -286,7 +298,7 @@ void Menu::ProcessCommands()
{ {
std::string weapon = "-1"; std::string weapon = "-1";
Weapon::GiveWeaponToPlayer(weapon); Weapon::GiveWeaponToPlayer(weapon);
CHud::SetHelpMessage("Weapon given", false, false, false); SetHelpMessage("Weapon given", false, false, false);
} }
else else
{ {
@ -297,10 +309,10 @@ void Menu::ProcessCommands()
if (wep_name != "" && pweaponinfo->m_nModelId1 != -1) if (wep_name != "" && pweaponinfo->m_nModelId1 != -1)
{ {
Weapon::GiveWeaponToPlayer(weapon_name); Weapon::GiveWeaponToPlayer(weapon_name);
CHud::SetHelpMessage("Weapon given", false, false, false); SetHelpMessage("Weapon given", false, false, false);
} }
else else
CHud::SetHelpMessage("Invalid command", false, false, false); SetHelpMessage("Invalid command", false, false, false);
} }
return; return;
@ -315,11 +327,12 @@ void Menu::ProcessCommands()
{ {
std::string smodel = std::to_string(model); std::string smodel = std::to_string(model);
Vehicle::SpawnVehicle(smodel); Vehicle::SpawnVehicle(smodel);
CHud::SetHelpMessage("Vehicle spawned", false, false, false); SetHelpMessage("Vehicle spawned", false, false, false);
} }
else else
CHud::SetHelpMessage("Invalid command", false, false, false); SetHelpMessage("Invalid command", false, false, false);
} }
#endif
} }
void Menu::Draw() void Menu::Draw()

View File

@ -31,7 +31,7 @@ void Ped::SpawnPed(std::string& model)
{ {
if (m_SpawnPed::m_List.size() == SPAWN_PED_LIMIT) if (m_SpawnPed::m_List.size() == SPAWN_PED_LIMIT)
{ {
CHud::SetHelpMessage("Max limit reached", false, false, false); SetHelpMessage("Max limit reached", false, false, false);
return; return;
} }

View File

@ -120,7 +120,7 @@ Player::Player()
{ {
if (m_bGodMode) if (m_bGodMode)
{ {
CHud::SetHelpMessage("God mode disabled", false, false, false); SetHelpMessage("God mode disabled", false, false, false);
patch::Set<bool>(0x96916D, m_bGodMode, false); patch::Set<bool>(0x96916D, m_bGodMode, false);
player->m_nPhysicalFlags.bBulletProof = false; player->m_nPhysicalFlags.bBulletProof = false;
@ -132,7 +132,7 @@ Player::Player()
} }
else else
{ {
CHud::SetHelpMessage("God mode enabled", false, false, false); SetHelpMessage("God mode enabled", false, false, false);
m_bGodMode = true; m_bGodMode = true;
} }
} }
@ -223,7 +223,7 @@ void Player::Draw()
std::string text = std::to_string(pos.x) + ", " + std::to_string(pos.y) + ", " + std::to_string(pos.z); std::string text = std::to_string(pos.x) + ", " + std::to_string(pos.y) + ", " + std::to_string(pos.z);
ImGui::SetClipboardText(text.c_str()); ImGui::SetClipboardText(text.c_str());
CHud::SetHelpMessage("Coordinates copied", false, false, false); SetHelpMessage("Coordinates copied", false, false, false);
} }
ImGui::SameLine(); ImGui::SameLine();
if (ImGui::Button("Suicide", ImVec2(Ui::GetSize(2)))) if (ImGui::Button("Suicide", ImVec2(Ui::GetSize(2))))

View File

@ -4,6 +4,7 @@
#include "Ui.h" #include "Ui.h"
#include "Util.h" #include "Util.h"
#ifdef GTASA
// FlA // FlA
tRadarTrace* CRadar::ms_RadarTrace = reinterpret_cast<tRadarTrace*>(patch::GetPointer(0x5838B0 + 2)); tRadarTrace* CRadar::ms_RadarTrace = reinterpret_cast<tRadarTrace*>(patch::GetPointer(0x5838B0 + 2));
@ -36,6 +37,7 @@ void Teleport::FetchRadarSpriteData()
*/ */
} }
} }
#endif
Teleport::Teleport() Teleport::Teleport()
{ {
@ -48,15 +50,20 @@ Teleport::Teleport()
{ {
CPlayerPed* player = FindPlayerPed(); CPlayerPed* player = FindPlayerPed();
CEntity* player_entity = FindPlayerEntity(-1); #ifdef GTASA
CEntity* player_entity = FindPlayerEntity();
m_Teleport::m_fPos.z = CWorld::FindGroundZFor3DCoord(m_Teleport::m_fPos.x, m_Teleport::m_fPos.y, m_Teleport::m_fPos.z = CWorld::FindGroundZFor3DCoord(m_Teleport::m_fPos.x, m_Teleport::m_fPos.y,
m_Teleport::m_fPos.z + 100.0f, nullptr, &player_entity) + 1.0f; m_Teleport::m_fPos.z + 100.0f, nullptr, &player_entity) + 1.0f;
#elif GTAVC
m_Teleport::m_fPos.z = CWorld::FindGroundZFor3DCoord(m_Teleport::m_fPos.x, m_Teleport::m_fPos.y,
m_Teleport::m_fPos.z + 100.0f, nullptr) + 1.0f;
#endif
CVehicle* pVeh = player->m_pVehicle; CVehicle* pVeh = player->m_pVehicle;
if (pVeh && player->m_nPedFlags.bInVehicle) if (pVeh && BY_GAME(player->m_nPedFlags.bInVehicle, player->m_pVehicle))
pVeh->Teleport(m_Teleport::m_fPos, false); BY_GAME(pVeh->Teleport(m_Teleport::m_fPos, false), pVeh->Teleport(m_Teleport::m_fPos));
else else
player->Teleport(m_Teleport::m_fPos, false); BY_GAME(player->Teleport(m_Teleport::m_fPos, false), player->Teleport(m_Teleport::m_fPos));
m_Teleport::m_bEnabled = false; m_Teleport::m_bEnabled = false;
Command<Commands::FREEZE_CHAR_POSITION_AND_DONT_LOAD_COLLISION>(CPools::GetPedRef(player), false); Command<Commands::FREEZE_CHAR_POSITION_AND_DONT_LOAD_COLLISION>(CPools::GetPedRef(player), false);
@ -80,14 +87,15 @@ void Teleport::TeleportPlayer(bool get_marker, CVector pos, short interior_id)
{ {
CPlayerPed* pPlayer = FindPlayerPed(); CPlayerPed* pPlayer = FindPlayerPed();
CVehicle* pVeh = pPlayer->m_pVehicle; CVehicle* pVeh = pPlayer->m_pVehicle;
#ifdef GTASA
if (get_marker) if (get_marker)
{ {
tRadarTrace targetBlip = CRadar::ms_RadarTrace[LOWORD(FrontEndMenuManager.m_nTargetBlipIndex)]; tRadarTrace targetBlip = CRadar::ms_RadarTrace[LOWORD(FrontEndMenuManager.m_nTargetBlipIndex)];
if (targetBlip.m_nBlipSprite != RADAR_SPRITE_WAYPOINT) if (targetBlip.m_nBlipSprite != RADAR_SPRITE_WAYPOINT)
{ {
CHud::SetHelpMessage("Target blip not found. You need to place it on the map first.", false, false, false); SetHelpMessage("Target blip not found. You need to place it on the map first.", false, false, false);
return; return;
} }
CEntity* pPlayerEntity = FindPlayerEntity(-1); CEntity* pPlayerEntity = FindPlayerEntity(-1);
@ -100,28 +108,41 @@ void Teleport::TeleportPlayer(bool get_marker, CVector pos, short interior_id)
TheCamera.Fade(0, 0); TheCamera.Fade(0, 0);
Command<Commands::FREEZE_CHAR_POSITION_AND_DONT_LOAD_COLLISION>(CPools::GetPedRef(pPlayer), true); Command<Commands::FREEZE_CHAR_POSITION_AND_DONT_LOAD_COLLISION>(CPools::GetPedRef(pPlayer), true);
} }
#endif
CStreaming::LoadScene(&pos); CStreaming::LoadScene(&pos);
CStreaming::LoadSceneCollision(&pos); CStreaming::LoadSceneCollision(&pos);
CStreaming::LoadAllRequestedModels(false); CStreaming::LoadAllRequestedModels(false);
#ifdef GTASA
if (pVeh && pPlayer->m_nPedFlags.bInVehicle) if (pVeh && pPlayer->m_nPedFlags.bInVehicle)
{ {
pVeh->Teleport(pos, false); pVeh->Teleport(pos, false);
if (pVeh->m_nVehicleClass == VEHICLE_BIKE) if (pVeh->m_nVehicleClass == VEHICLE_BIKE)
reinterpret_cast<CBike*>(pVeh)->PlaceOnRoadProperly(); reinterpret_cast<CBike*>(pVeh)->PlaceOnRoadProperly();
else if (pVeh->m_nVehicleClass != VEHICLE_BOAT) else if (pVeh->m_nVehicleClass != VEHICLE_BOAT)
reinterpret_cast<CAutomobile*>(pVeh)->PlaceOnRoadProperly(); reinterpret_cast<CAutomobile*>(pVeh)->PlaceOnRoadProperly();
pVeh->m_nAreaCode = interior_id; BY_GAME(pVeh->m_nAreaCode, pVeh->m_nInterior) = interior_id;
} }
else else
{ {
pPlayer->Teleport(pos, false); pPlayer->Teleport(pos, false);
} }
#elif GTAVC
if (pVeh && pPlayer->m_pVehicle)
{
BY_GAME(pVeh->m_nAreaCode, pVeh->m_nInterior) = interior_id;
pVeh->Teleport(pos);
}
else
{
pPlayer->Teleport(pos);
}
#endif
pPlayer->m_nAreaCode = interior_id; BY_GAME(pPlayer->m_nAreaCode, pPlayer->m_nInterior) = interior_id;
Command<Commands::SET_AREA_VISIBLE>(interior_id); Command<Commands::SET_AREA_VISIBLE>(interior_id);
} }
@ -150,7 +171,7 @@ void Teleport::TeleportToLocation(std::string& rootkey, std::string& bLocName, s
} }
catch (...) catch (...)
{ {
CHud::SetHelpMessage("Invalid location", false, false, false); SetHelpMessage("Invalid location", false, false, false);
} }
} }
@ -159,10 +180,10 @@ void Teleport::RemoveTeleportEntry(std::string& category, std::string& key, std:
if (category == "Custom") if (category == "Custom")
{ {
tp_data.m_Json.m_Data["Custom"].erase(key); tp_data.m_Json.m_Data["Custom"].erase(key);
CHud::SetHelpMessage("Location removed", false, false, false); SetHelpMessage("Location removed", false, false, false);
tp_data.m_Json.WriteToDisk(); tp_data.m_Json.WriteToDisk();
} }
else CHud::SetHelpMessage("You can only remove custom location", false, false, false); else SetHelpMessage("You can only remove custom location", false, false, false);
} }
void Teleport::Draw() void Teleport::Draw()
@ -178,13 +199,14 @@ void Teleport::Draw()
ImGui::Columns(2, nullptr, false); ImGui::Columns(2, nullptr, false);
ImGui::Checkbox("Insert coordinates", &m_bInsertCoord); ImGui::Checkbox("Insert coordinates", &m_bInsertCoord);
ImGui::NextColumn(); ImGui::NextColumn();
#ifdef GTASA
if (Ui::CheckboxWithHint("Quick teleport", &m_bQuickTeleport, if (Ui::CheckboxWithHint("Quick teleport", &m_bQuickTeleport,
(std::string("Teleport to the location of your radar\ntarget blip using ") (std::string("Teleport to the location of your radar\ntarget blip using ")
+ Ui::GetHotKeyNameString(Menu::m_HotKeys::quickTeleport)).c_str())) + Ui::GetHotKeyNameString(Menu::m_HotKeys::quickTeleport)).c_str()))
{ {
config.SetValue("quick_teleport", m_bQuickTeleport); config.SetValue("quick_teleport", m_bQuickTeleport);
} }
#endif
ImGui::Columns(1); ImGui::Columns(1);
ImGui::Spacing(); ImGui::Spacing();
@ -201,7 +223,7 @@ void Teleport::Draw()
ImGui::Spacing(); ImGui::Spacing();
if (ImGui::Button("Teleport to Coord", Ui::GetSize(2))) if (ImGui::Button("Teleport to coord", Ui::GetSize(2)))
{ {
std::stringstream ss(m_nInputBuffer); std::stringstream ss(m_nInputBuffer);
std::string temp; std::string temp;
@ -222,13 +244,21 @@ void Teleport::Draw()
} }
catch (...) catch (...)
{ {
CHud::SetHelpMessage("Invalid coordinate", false, false, false); SetHelpMessage("Invalid coordinate", false, false, false);
} }
} }
ImGui::SameLine(); ImGui::SameLine();
#ifdef GTASA
if (ImGui::Button("Teleport to marker", Ui::GetSize(2))) if (ImGui::Button("Teleport to marker", Ui::GetSize(2)))
{
TeleportPlayer(true); TeleportPlayer(true);
}
#else
if (ImGui::Button("Teleport to map center", Ui::GetSize(2)))
{
TeleportPlayer(false, CVector(0, 0, 23));
}
#endif
ImGui::EndChild(); ImGui::EndChild();
} }
ImGui::EndTabItem(); ImGui::EndTabItem();
@ -236,7 +266,10 @@ void Teleport::Draw()
if (ImGui::BeginTabItem("Search")) if (ImGui::BeginTabItem("Search"))
{ {
#ifdef GTASA
FetchRadarSpriteData(); FetchRadarSpriteData();
#endif
ImGui::Spacing(); ImGui::Spacing();
Ui::DrawJSON(tp_data.m_Json, tp_data.m_Categories, tp_data.m_Selected, tp_data.m_Filter, &TeleportToLocation, Ui::DrawJSON(tp_data.m_Json, tp_data.m_Categories, tp_data.m_Selected, tp_data.m_Filter, &TeleportToLocation,
&RemoveTeleportEntry); &RemoveTeleportEntry);

View File

@ -11,7 +11,11 @@ private:
inline static SSearchData tp_data{"teleport"}; inline static SSearchData tp_data{"teleport"};
inline static char m_nLocationBuffer[INPUT_BUFFER_SIZE]; inline static char m_nLocationBuffer[INPUT_BUFFER_SIZE];
inline static uint m_nQuickTeleportTimer; inline static uint m_nQuickTeleportTimer;
#ifdef GTASA
inline static CJson m_SpriteJson = CJson("radar sprite"); inline static CJson m_SpriteJson = CJson("radar sprite");
#endif
struct m_Teleport struct m_Teleport
{ {
inline static bool m_bEnabled; inline static bool m_bEnabled;
@ -20,11 +24,13 @@ private:
}; };
#ifdef GTASA
/* /*
Generates radar sprite coordinates on the fly. Generates radar sprite coordinates on the fly.
Shouldn't get saved in 'teleport.json', needs to be cleared at game shutdown. Shouldn't get saved in 'teleport.json', needs to be cleared at game shutdown.
*/ */
static void FetchRadarSpriteData(); static void FetchRadarSpriteData();
#endif
protected: protected:
Teleport(); Teleport();

View File

@ -426,7 +426,7 @@ void Ui::DrawJSON(CJson& json, std::vector<std::string>& combo_items, std::strin
ImGui::EndChild(); ImGui::EndChild();
} }
#ifdef GTASA
void Ui::EditStat(const char* label, const int stat_id, const int min, const int def, const int max) void Ui::EditStat(const char* label, const int stat_id, const int min, const int def, const int max)
{ {
if (ImGui::CollapsingHeader(label)) if (ImGui::CollapsingHeader(label))
@ -465,6 +465,7 @@ void Ui::EditStat(const char* label, const int stat_id, const int min, const int
ImGui::Separator(); ImGui::Separator();
} }
} }
#endif
void Ui::FilterWithHint(const char* label, ImGuiTextFilter& filter, const char* hint) void Ui::FilterWithHint(const char* label, ImGuiTextFilter& filter, const char* hint)
{ {

View File

@ -68,8 +68,11 @@ public:
static void EditReference(const char* label, T& address, int min = 0, int def = 0, int max = 100); static void EditReference(const char* label, T& address, int min = 0, int def = 0, int max = 100);
static void EditRadioButtonAddress(const char* label, std::vector<NamedMemory>& named_mem); static void EditRadioButtonAddress(const char* label, std::vector<NamedMemory>& named_mem);
static void EditRadioButtonAddressEx(const char* label, int addr, std::vector<NamedValue>& named_val); static void EditRadioButtonAddressEx(const char* label, int addr, std::vector<NamedValue>& named_val);
#ifdef GTASA
static void EditStat(const char* label, int stat_id, int min = 0, int def = 0, int max = 1000); static void EditStat(const char* label, int stat_id, int min = 0, int def = 0, int max = 1000);
#endif
static void FilterWithHint(const char* label, ImGuiTextFilter& filter, const char* hint); static void FilterWithHint(const char* label, ImGuiTextFilter& filter, const char* hint);
static ImVec2 GetSize(short count = 1, bool spacing = true); static ImVec2 GetSize(short count = 1, bool spacing = true);

View File

@ -12,7 +12,7 @@ void Updater::CheckForUpdate()
if (res == E_OUTOFMEMORY || res == INET_E_DOWNLOAD_FAILURE) if (res == E_OUTOFMEMORY || res == INET_E_DOWNLOAD_FAILURE)
{ {
CHud::SetHelpMessage("Failed to check for updates", false, false, false); SetHelpMessage("Failed to check for updates", false, false, false);
return; return;
} }
CJson verinfo = CJson("versioninfo"); CJson verinfo = CJson("versioninfo");
@ -22,12 +22,12 @@ void Updater::CheckForUpdate()
if (m_LatestVersion > MENU_VERSION_NUMBER) if (m_LatestVersion > MENU_VERSION_NUMBER)
{ {
CHud::SetHelpMessage("Update found", false, false, false); SetHelpMessage("Update found", false, false, false);
m_State = UPDATER_UPDATE_FOUND; m_State = UPDATER_UPDATE_FOUND;
} }
else else
{ {
CHud::SetHelpMessage("No update found.", false, false, false); SetHelpMessage("No update found.", false, false, false);
Updater::m_State = UPDATER_IDLE; Updater::m_State = UPDATER_IDLE;
} }
} }

View File

@ -1,6 +1,5 @@
#include "pch.h" #include "pch.h"
#include "Util.h" #include "Util.h"
#include <CCutsceneMgr.h>
#include "psapi.h" #include "psapi.h"
#include "CFileLoader.h" #include "CFileLoader.h"
@ -68,6 +67,44 @@ void* Util::GetTextureFromRaster(RwTexture *pTexture)
return (&raster->renderResource->texture); return (&raster->renderResource->texture);
} }
std::string Util::GetLocationName(CVector* pos)
{
#ifdef GTASA
int hplayer = CPools::GetPedRef(FindPlayerPed());
int interior = 0;
Command<Commands::GET_AREA_VISIBLE>(&interior);
std::string town = "San Andreas";
int city;
Command<Commands::GET_CITY_PLAYER_IS_IN>(&hplayer, &city);
switch (city)
{
case 0:
town = "CS";
break;
case 1:
town = "LS";
break;
case 2:
town = "SF";
break;
case 3:
town = "LV";
break;
}
if (interior == 0)
return CTheZones::FindSmallestZoneForPosition(*pos, true)->GetTranslatedName() + std::string(", ") + town;
return std::string("Interior ") + std::to_string(interior) + ", " + town;
#elif GTAVC
return "Vice City";
#endif
}
#ifdef GTASA
// Thanks DKPac22 // Thanks DKPac22
RwTexture* Util::LoadTextureFromMemory(char* data, unsigned int size) RwTexture* Util::LoadTextureFromMemory(char* data, unsigned int size)
{ {
@ -118,37 +155,6 @@ bool Util::IsOnCutscene()
return CCutsceneMgr::ms_running; return CCutsceneMgr::ms_running;
} }
std::string Util::GetLocationName(CVector* pos)
{
int hplayer = CPools::GetPedRef(FindPlayerPed());
int interior = 0;
Command<Commands::GET_AREA_VISIBLE>(&interior);
std::string town = "San Andreas";
int city;
Command<Commands::GET_CITY_PLAYER_IS_IN>(&hplayer, &city);
switch (city)
{
case 0:
town = "CS";
break;
case 1:
town = "LS";
break;
case 2:
town = "SF";
break;
case 3:
town = "LV";
break;
}
if (interior == 0)
return CTheZones::FindSmallestZoneForPosition(*pos, true)->GetTranslatedName() + std::string(", ") + town;
return std::string("Interior ") + std::to_string(interior) + ", " + town;
}
int Util::GetLargestGangInZone() int Util::GetLargestGangInZone()
{ {
int gang_id = 0, max_density = 0; int gang_id = 0, max_density = 0;
@ -212,6 +218,7 @@ CPed* Util::GetClosestPed()
} }
return nullptr; return nullptr;
} }
#endif
void Util::RainbowValues(int& r, int& g, int& b, float speed) void Util::RainbowValues(int& r, int& g, int& b, float speed)
{ {

View File

@ -11,17 +11,21 @@ static HANDLE self;
class Util class Util
{ {
public: public:
#ifdef GTASA
static void ClearCharTasksVehCheck(CPed* ped); static void ClearCharTasksVehCheck(CPed* ped);
static CPed* GetClosestPed(); static CPed* GetClosestPed();
static CVehicle* GetClosestVehicle(); static CVehicle* GetClosestVehicle();
static int GetLargestGangInZone(); static int GetLargestGangInZone();
static bool IsOnCutscene(); static bool IsOnCutscene();
static bool IsOnMission(); static RwTexture* LoadTextureFromMemory(char* data, unsigned int size);
#endif
static std::string GetLocationName(CVector* pos); static std::string GetLocationName(CVector* pos);
static bool IsOnMission();
static void RainbowValues(int& r, int& g, int& b, float speed); static void RainbowValues(int& r, int& g, int& b, float speed);
static void GetCPUUsageInit(); static void GetCPUUsageInit();
static double GetCurrentCPUUsage(); static double GetCurrentCPUUsage();
static void* GetTextureFromRaster(RwTexture* pTexture); static void* GetTextureFromRaster(RwTexture* pTexture);
static void LoadTextureDirectory(SSearchData& data, char* path, bool pass_full_name = false); static void LoadTextureDirectory(SSearchData& data, char* path, bool pass_full_name = false);
static RwTexture* LoadTextureFromMemory(char* data, unsigned int size);
}; };

View File

@ -39,7 +39,7 @@ Vehicle::Vehicle()
{ {
player->m_pVehicle->Fix(); player->m_pVehicle->Fix();
player->m_pVehicle->m_fHealth = 1000.0f; player->m_pVehicle->m_fHealth = 1000.0f;
CHud::SetHelpMessage("Vehicle fixed", false, false, false); SetHelpMessage("Vehicle fixed", false, false, false);
} }
if (Ui::HotKeyPressed(Menu::m_HotKeys::vehEngine)) if (Ui::HotKeyPressed(Menu::m_HotKeys::vehEngine))
@ -47,9 +47,9 @@ Vehicle::Vehicle()
bool state = !veh->m_nVehicleFlags.bEngineBroken || veh->m_nVehicleFlags.bEngineOn; bool state = !veh->m_nVehicleFlags.bEngineBroken || veh->m_nVehicleFlags.bEngineOn;
if (state) if (state)
CHud::SetHelpMessage("Vehicle engine off", false, false, false); SetHelpMessage("Vehicle engine off", false, false, false);
else else
CHud::SetHelpMessage("Vehicle engine on", false, false, false); SetHelpMessage("Vehicle engine on", false, false, false);
veh->m_nVehicleFlags.bEngineBroken = state; veh->m_nVehicleFlags.bEngineBroken = state;
veh->m_nVehicleFlags.bEngineOn = !state; veh->m_nVehicleFlags.bEngineOn = !state;
@ -168,7 +168,7 @@ void Vehicle::AddComponent(const std::string& component, const bool display_mess
CStreaming::SetModelIsDeletable(icomp); CStreaming::SetModelIsDeletable(icomp);
if (display_message) if (display_message)
CHud::SetHelpMessage("Component added", false, false, false); SetHelpMessage("Component added", false, false, false);
} }
catch (...) catch (...)
{ {
@ -188,7 +188,7 @@ void Vehicle::RemoveComponent(const std::string& component, const bool display_m
player->m_pVehicle->RemoveVehicleUpgrade(icomp); player->m_pVehicle->RemoveVehicleUpgrade(icomp);
if (display_message) if (display_message)
CHud::SetHelpMessage("Component removed", false, false, false); SetHelpMessage("Component removed", false, false, false);
} }
catch (...) catch (...)
{ {
@ -221,7 +221,7 @@ int Vehicle::GetRandomTrainIdForModel(int model)
_end = 10; _end = 10;
break; break;
default: default:
CHud::SetHelpMessage("Invalid train model", false, false, false); SetHelpMessage("Invalid train model", false, false, false);
return -1; return -1;
} }
int id = Random(_start, _end); int id = Random(_start, _end);
@ -955,7 +955,7 @@ void Vehicle::Draw()
if (ImGui::Button("Reset color", ImVec2(Ui::GetSize()))) if (ImGui::Button("Reset color", ImVec2(Ui::GetSize())))
{ {
Paint::ResetNodeColor(veh, Paint::veh_nodes::selected); Paint::ResetNodeColor(veh, Paint::veh_nodes::selected);
CHud::SetHelpMessage("Color reset", false, false, false); SetHelpMessage("Color reset", false, false, false);
} }
ImGui::Spacing(); ImGui::Spacing();
@ -1036,7 +1036,7 @@ void Vehicle::Draw()
if (ImGui::Button("Remove neon", ImVec2(Ui::GetSize()))) if (ImGui::Button("Remove neon", ImVec2(Ui::GetSize())))
{ {
RemoveNeon(veh); RemoveNeon(veh);
CHud::SetHelpMessage("Neon removed", false, false, false); SetHelpMessage("Neon removed", false, false, false);
} }
ImGui::Spacing(); ImGui::Spacing();
@ -1092,7 +1092,7 @@ void Vehicle::Draw()
if (ImGui::Button("Reset texture", ImVec2(Ui::GetSize()))) if (ImGui::Button("Reset texture", ImVec2(Ui::GetSize())))
{ {
Paint::ResetNodeTexture(veh, Paint::veh_nodes::selected); Paint::ResetNodeTexture(veh, Paint::veh_nodes::selected);
CHud::SetHelpMessage("Texture reset", false, false, false); SetHelpMessage("Texture reset", false, false, false);
} }
ImGui::Spacing(); ImGui::Spacing();
@ -1167,7 +1167,7 @@ void Vehicle::Draw()
if (ImGui::Button("Reset handling", ImVec2(Ui::GetSize(3)))) if (ImGui::Button("Reset handling", ImVec2(Ui::GetSize(3))))
{ {
gHandlingDataMgr.LoadHandlingData(); gHandlingDataMgr.LoadHandlingData();
CHud::SetHelpMessage("Handling reset", false, false, false); SetHelpMessage("Handling reset", false, false, false);
} }
ImGui::SameLine(); ImGui::SameLine();
@ -1175,7 +1175,7 @@ void Vehicle::Draw()
if (ImGui::Button("Save to file", ImVec2(Ui::GetSize(3)))) if (ImGui::Button("Save to file", ImVec2(Ui::GetSize(3))))
{ {
GenerateHandlingDataFile(pHandling); GenerateHandlingDataFile(pHandling);
CHud::SetHelpMessage("Handling saved", false, false, false); SetHelpMessage("Handling saved", false, false, false);
} }
ImGui::SameLine(); ImGui::SameLine();

View File

@ -351,13 +351,13 @@ void Visual::Draw()
if (ImGui::Button("Generate timecyc file", Ui::GetSize(2))) if (ImGui::Button("Generate timecyc file", Ui::GetSize(2)))
{ {
GenerateTimecycFile(); GenerateTimecycFile();
CHud::SetHelpMessage("File generated", false, false, false); SetHelpMessage("File generated", false, false, false);
} }
ImGui::SameLine(); ImGui::SameLine();
if (ImGui::Button("Reset timecyc", Ui::GetSize(2))) if (ImGui::Button("Reset timecyc", Ui::GetSize(2)))
{ {
CTimeCycle::Initialise(); CTimeCycle::Initialise();
CHud::SetHelpMessage("Timecyc reset", false, false, false); SetHelpMessage("Timecyc reset", false, false, false);
} }
ImGui::Spacing(); ImGui::Spacing();

View File

@ -6,6 +6,12 @@
#define DISCORD_INVITE "https://discord.gg/ZzW7kmf" #define DISCORD_INVITE "https://discord.gg/ZzW7kmf"
#define GITHUB_LINK "https://github.com/user-grinch/Cheat-Menu" #define GITHUB_LINK "https://github.com/user-grinch/Cheat-Menu"
#ifdef GTASA
#define BY_GAME(sa, vc) sa
#elif GTAVC
#define BY_GAME(sa, vc) vc
#endif
#include <d3d9.h> #include <d3d9.h>
#include <d3d11.h> #include <d3d11.h>
#include <d3d11Shader.h> #include <d3d11Shader.h>
@ -21,20 +27,14 @@
#include "plugin.h" #include "plugin.h"
#include "CBike.h" #include "CBike.h"
#include "CCamera.h" #include "CCamera.h"
#include "CCheat.h"
#include "CClothes.h"
#include "CClock.h" #include "CClock.h"
#include "CCivilianPed.h" #include "CCivilianPed.h"
#include "CCutsceneMgr.h"
#include "CGangs.h" #include "CGangs.h"
#include "CGangWars.h"
#include "cHandlingDataMgr.h" #include "cHandlingDataMgr.h"
#include "CHud.h" #include "CHud.h"
#include "CMenuManager.h" #include "CMenuManager.h"
#include "CModelInfo.h" #include "CModelInfo.h"
#include "CRadar.h"
#include "RenderWare.h" #include "RenderWare.h"
#include "CShadows.h"
#include "CStats.h" #include "CStats.h"
#include "CStreaming.h" #include "CStreaming.h"
#include "CTheScripts.h" #include "CTheScripts.h"
@ -46,9 +46,18 @@
#include "CWorld.h" #include "CWorld.h"
#include "extensions/ScriptCommands.h" #include "extensions/ScriptCommands.h"
#include "extensions/Screen.h" #include "extensions/Screen.h"
#include "eVehicleClass.h"
#include "extensions/Paths.h" #include "extensions/Paths.h"
#ifdef GTASA
#include "CCheat.h"
#include "CClothes.h"
#include "CCutsceneMgr.h"
#include "CRadar.h"
#include "CShadows.h"
#include "eVehicleClass.h"
#include "CGangWars.h"
#endif
#include "../Depend/fla/IDaccess.h" #include "../Depend/fla/IDaccess.h"
#include "../Depend/imgui/imgui.h" #include "../Depend/imgui/imgui.h"
#include "../Depend/imgui/imgui_internal.h" #include "../Depend/imgui/imgui_internal.h"
@ -133,3 +142,14 @@ struct SSearchData
std::string m_Selected = "All"; std::string m_Selected = "All";
std::vector<std::unique_ptr<STextureStructure>> m_ImagesList; std::vector<std::unique_ptr<STextureStructure>> m_ImagesList;
}; };
// Common defines
static void SetHelpMessage(const char *message, bool b1, bool b2, bool b3)
{
#if GTAVC
CHud::SetHelpMessage(message, b1, b2);
#elif GTASA
CHud::SetHelpMessage(message, b1, b2, b3);
#endif
}

View File

@ -3,5 +3,5 @@ cd tools
premake5.exe vs2019 premake5.exe vs2019
cd ../build cd ../build
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\Common7\Tools\VsDevCmd.bat" call "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\Common7\Tools\VsDevCmd.bat"
MsBuild CheatMenu.sln /property:Configuration=Debug MsBuild CheatMenu.sln /property:Configuration=Debug /t:CheatMenuSA
cd .. cd ..

View File

@ -3,5 +3,5 @@ cd tools
premake5.exe vs2019 premake5.exe vs2019
cd ../build cd ../build
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\Common7\Tools\VsDevCmd.bat" call "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\Common7\Tools\VsDevCmd.bat"
MsBuild CheatMenu.sln /property:Configuration=Release MsBuild CheatMenu.sln /property:Configuration=Debug /t:CheatMenuVC
cd .. cd ..

7
tools/ReleaseSA.bat Normal file
View File

@ -0,0 +1,7 @@
@echo off
cd tools
premake5.exe vs2019
cd ../build
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\Common7\Tools\VsDevCmd.bat"
MsBuild CheatMenu.sln /property:Configuration=Release /t:CheatMenuSA
cd ..

7
tools/ReleaseVC.bat Normal file
View File

@ -0,0 +1,7 @@
@echo off
cd tools
premake5.exe vs2019
cd ../build
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\Common7\Tools\VsDevCmd.bat"
MsBuild CheatMenu.sln /property:Configuration=Release /t:CheatMenuVC
cd ..

View File

@ -6,6 +6,7 @@
PSDK_DIR = os.getenv("PLUGIN_SDK_DIR") PSDK_DIR = os.getenv("PLUGIN_SDK_DIR")
DX9SDK_DIR = os.getenv("DIRECTX9_SDK_DIR") DX9SDK_DIR = os.getenv("DIRECTX9_SDK_DIR")
GTASA_DIR = "C:/Work/GTASanAndreas" GTASA_DIR = "C:/Work/GTASanAndreas"
GTAVC_DIR = "F:/GTA Vice City"
if (DX9SDK_DIR == nil) then if (DX9SDK_DIR == nil) then
error("DIRECTX9_SDK_DIR environment variable not set") error("DIRECTX9_SDK_DIR environment variable not set")
@ -46,7 +47,77 @@ project "Depend"
defines { "NDEBUG", "IS_PLATFORM_WIN" } defines { "NDEBUG", "IS_PLATFORM_WIN" }
optimize "On" optimize "On"
project "CheatMenu" project "CheatMenuVC"
kind "SharedLib"
targetdir (GTAVC_DIR)
targetextension ".asi"
files {
"../src/CheatMenu.h",
"../src/CheatMenu.cpp",
"../src/pch.h",
"../src/pch.cpp",
"../src/Hook.h",
"../src/Hook.cpp",
"../src/Updater.h",
"../src/Updater.cpp",
"../src/Json.h",
"../src/Json.cpp",
"../src/Teleport.h",
"../src/Teleport.cpp",
"../src/Ui.h",
"../src/Ui.cpp",
"../src/Util.h",
"../src/Util.cpp",
"../src/Menu.h",
"../src/Menu.cpp"
}
includedirs {
PSDK_DIR .. "/plugin_vc/",
PSDK_DIR .. "/plugin_vc/game_vc/",
PSDK_DIR .. "/shared/",
PSDK_DIR .. "/shared/game/"
}
libdirs (PSDK_DIR .. "/output/lib")
defines {
"NDEBUG",
"IS_PLATFORM_WIN" ,
"_CRT_SECURE_NO_WARNINGS",
"_CRT_NON_CONFORMING_SWPRINTFS",
"GTAVC",
"_DX9_SDK_INSTALLED",
"PLUGIN_SGV_10US"
}
pchheader "pch.h"
pchsource "../src/pch.cpp"
filter "configurations:Debug"
symbols "On"
links {
"Depend",
"d3d9",
"d3d11",
"XInput9_1_0",
"Pdh",
"urlmon",
"plugin_vc_d.lib"
}
filter "configurations:Release"
optimize "On"
links {
"Depend",
"d3d9",
"d3d11",
"XInput9_1_0",
"Pdh",
"urlmon",
"plugin_vc.lib"
}
project "CheatMenuSA"
kind "SharedLib" kind "SharedLib"
targetdir (GTASA_DIR) targetdir (GTASA_DIR)
targetextension ".asi" targetextension ".asi"