Setup gta 3 build sys

This commit is contained in:
Grinch_ 2021-10-22 04:23:02 +06:00
parent cb0e77b696
commit c9b430eca7
18 changed files with 233 additions and 51 deletions

View File

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

11
.vscode/launch.json vendored
View File

@ -26,6 +26,17 @@
"environment": [],
"console": "internalConsole"
},
{
"name": "Launch III",
"type": "cppvsdbg",
"request": "launch",
"program": "E:/GTA3/Gta3.exe",
"args": [],
"stopAtEntry": false,
"cwd": "F:/GTASanAndreas/",
"environment": [],
"console": "internalConsole"
},
{
"name": "Attach",
"type": "cppvsdbg",

56
.vscode/tasks.json vendored
View File

@ -110,6 +110,60 @@
}
}
},
}
},
{
"label": "Build DebugIII",
"type": "shell",
"command": "${workspaceFolder}/tools/DebugIII.bat",
"presentation": {
"echo": true,
"reveal": "always",
"focus": false,
"panel": "shared",
"showReuseMessage": false,
"clear": true
},
"group": {
"kind": "build",
"isDefault": true
},
"windows": {
"options": {
"shell": {
"executable": "cmd.exe",
"args": [
"/d", "/c"
]
}
}
},
},
{
"label": "Build ReleaseIII",
"type": "shell",
"command": "${workspaceFolder}/tools/ReleaseIII.bat",
"presentation": {
"echo": true,
"reveal": "always",
"focus": false,
"panel": "shared",
"showReuseMessage": false,
"clear": true
},
"group": {
"kind": "build",
"isDefault": true
},
"windows": {
"options": {
"shell": {
"executable": "cmd.exe",
"args": [
"/d", "/c"
]
}
}
},
},
]
}

View File

@ -3,9 +3,6 @@
"Washington Ammunation": "0, -65, -1479, 10",
"Washington Beach Ammunation": "0, 200, -474, 11"
},
"Custom": {
"Test": "0, -825, 1168, 10"
},
"Misc": {
"1102 Safe House": "0, 95, -808, 10",
"Air Reserve Fort": "0, -1731, -307, 14",

View File

@ -44,6 +44,6 @@ public:
};
#else
// Dummy Class for GTAVC
// Dummy Class for VC & III
class Animation{};
#endif

View File

@ -9,7 +9,7 @@ void CheatMenu::DrawWindow()
ImGuiIO& io = ImGui::GetIO();
static bool bRunning = true;
if (BY_GAME(FrontEndMenuManager.m_bMenuActive, FrontendMenuManager.m_bMenuVisible))
if (BY_GAME(FrontEndMenuManager.m_bMenuActive, FrontendMenuManager.m_bMenuVisible, FrontEndMenuManager.m_bMenuActive))
{
if (bRunning)
{
@ -21,7 +21,7 @@ void CheatMenu::DrawWindow()
else
{
bRunning = true;
if (m_bShowMenu || BY_GAME(m_Commands::m_bShowMenu, true))
if (m_bShowMenu || BY_GAME(m_Commands::m_bShowMenu, true, true))
{
if (m_bShowMenu)
{
@ -78,7 +78,7 @@ CheatMenu::CheatMenu()
Events::processScriptsEvent += []()
{
if (!BY_GAME(FrontEndMenuManager.m_bMenuActive, FrontendMenuManager.m_bMenuVisible))
if (!BY_GAME(FrontEndMenuManager.m_bMenuActive, FrontendMenuManager.m_bMenuVisible, FrontEndMenuManager.m_bMenuActive))
{
if (menuOpen.Pressed())
{

View File

@ -9,9 +9,8 @@
*/
#pragma once
#ifndef GTA3
#include "animation.h"
#include "hook.h"
#include "menu.h"
#include "teleport.h"
#include "player.h"
#include "ped.h"
@ -19,24 +18,35 @@
#include "weapon.h"
#include "game.h"
#include "visual.h"
#endif
#include "menu.h"
#include "hook.h"
#ifndef GTA3
class CheatMenu : Hook, Animation, Game, Menu, Ped, Player, Teleport, Vehicle, Visual, Weapon
#else
class CheatMenu : Hook, Menu
#endif
{
private:
static inline bool m_bShowMenu = false;
static inline ImVec2 m_fMenuSize = ImVec2(screen::GetScreenWidth() / 4, screen::GetScreenHeight() / 1.2);
#ifdef GTA3
static inline CallbackTable header
{
{"Menu", &Menu::Draw}
};
#else
static inline CallbackTable header
{
{"Teleport", &Teleport::Draw}, {"Player", &Player::Draw}, {"Ped", &Ped::Draw},
#ifdef GTASA
{"Animation", &Animation::Draw},
#elif GTAVC
{"Dummy", nullptr},
#endif
{"Vehicle", &Vehicle::Draw}, {"Weapon", &Weapon::Draw},
{"Game", &Game::Draw}, {"Visual", &Visual::Draw}, {"Menu", &Menu::Draw}
};
#endif
static void ApplyStyle();
static void DrawWindow();

View File

@ -35,6 +35,7 @@ void MenuThread(void* param)
Sleep(1000);
}
#ifdef GTASA
/*
TODO: Find a better way
Since you could still name it something else
@ -44,10 +45,11 @@ void MenuThread(void* param)
MessageBox(RsGlobal.ps->window, "SAMP detected. Exiting CheatMenu.", "CheatMenu", MB_ICONERROR);
return;
}
CFastman92limitAdjuster::Init();
#endif
gLog << "Starting...\nVersion: " MENU_TITLE "\nAuthor: Grinch_\nDiscord: " DISCORD_INVITE "\nMore Info: "
GITHUB_LINK "\n" << std::endl;
CFastman92limitAdjuster::Init();
CheatMenu menu;
@ -79,7 +81,7 @@ BOOL WINAPI DllMain(HINSTANCE hDllHandle, DWORD nReason, LPVOID Reserved)
{
uint gameVersion = GetGameVersion();
if (gameVersion == BY_GAME(GAME_10US_HOODLUM, GAME_10EN))
if (gameVersion == BY_GAME(GAME_10US_HOODLUM, GAME_10EN, GAME_10EN))
{
CreateThread(nullptr, NULL, (LPTHREAD_START_ROUTINE)&MenuThread, nullptr, NULL, nullptr);
}
@ -89,6 +91,8 @@ BOOL WINAPI DllMain(HINSTANCE hDllHandle, DWORD nReason, LPVOID Reserved)
MessageBox(HWND_DESKTOP, "Unknown game version. GTA SA v1.0 US is required.", "CheatMenu", MB_ICONERROR);
#elif GTAVC
MessageBox(HWND_DESKTOP, "Unknown game version. GTA VC v1.0 EN is required.", "CheatMenu", MB_ICONERROR);
#else // GTA3
MessageBox(HWND_DESKTOP, "Unknown game version. GTA III v1.0 EN is required.", "CheatMenu", MB_ICONERROR);
#endif
}
}

View File

@ -109,10 +109,7 @@ void Hook::RenderFrame(void* ptr)
else
{
bInit = true;
ImGui::CreateContext();
ImGuiStyle& style = ImGui::GetStyle();
ImGui_ImplWin32_Init(RsGlobal.ps->window);
#ifdef GTASA
@ -159,16 +156,15 @@ HRESULT Hook::Dx11Handler(IDXGISwapChain* pSwapChain, UINT SyncInterval, UINT Fl
void Hook::ShowMouse(bool state)
{
// Disable player controls for controllers
bool bMouseDisabled = false;
if (patch::Get<BYTE>(BY_GAME(0xBA6818, 0x86968B)) && (m_bShowMouse || bMouseDisabled))
if (patch::Get<BYTE>(BY_GAME(0xBA6818, 0x86968B, 0x5F03D8)) && (m_bShowMouse || bMouseDisabled))
{
#ifdef GTASA
CPlayerPed *player = FindPlayerPed();
CPad *pad = player ? player->GetPadFromPlayer() : NULL;
#elif GTAVC
#else
CPad *pad = CPad::GetPad(0);
#endif
@ -177,12 +173,20 @@ void Hook::ShowMouse(bool state)
if (m_bShowMouse)
{
bMouseDisabled = true;
#ifdef GTA3
pad->m_bDisablePlayerControls = true;
#else //GTAVC & GTASA
pad->DisablePlayerControls = true;
#endif
}
else
{
bMouseDisabled = false;
#ifdef GTA3
pad->m_bDisablePlayerControls = false;
#else //GTAVC & GTASA
pad->DisablePlayerControls = false;
#endif
}
}
}
@ -193,22 +197,32 @@ void Hook::ShowMouse(bool state)
#ifdef GTASA
Hook::ApplyMouseFix(); // Reapply the patches
#elif GTAVC
#else
if (m_bShowMouse)
{
patch::SetUChar(0x6020A0, 0xC3); // psSetMousePos
patch::Nop(0x4AB6CA, 5); // don't call CPad::UpdateMouse()
patch::SetUChar(BY_GAME(0, 0x6020A0, 0x580D20), 0xC3); // psSetMousePos
patch::Nop(BY_GAME(0, 0x4AB6CA, 0x49272F), 5); // don't call CPad::UpdateMouse()
}
else
{
patch::SetUChar(0x6020A0, 0x53);
patch::SetUChar(BY_GAME(0, 0x6020A0, 0x580D20), 0x53);
#ifdef GTAVC
patch::SetRaw(0x4AB6CA, (char*)"\xE8\x51\x21\x00\x00", 5);
#else // GTA3
patch::SetRaw(0x49272F, (char*)"\xE8\x6C\xF5\xFF\xFF", 5);
#endif
}
#endif
CPad::NewMouseControllerState.X = 0;
CPad::NewMouseControllerState.Y = 0;
#ifdef GTA3
CPad::GetPad(0)->ClearMouseHistory();
#else // GTAVC & GTASA
CPad::ClearMouseHistory();
#endif
CPad::UpdatePads();
m_bMouseVisibility = m_bShowMouse;
}
@ -322,5 +336,4 @@ void Hook::ApplyMouseFix()
patch::SetChar(0x746A08, 32); // diMouseOffset
patch::SetChar(0x746A58, 32); // diDeviceoffset
}
#endif

View File

@ -78,7 +78,7 @@ void Menu::DrawOverlay()
if (pPlayer)
{
bool m_bShowMenu = m_Overlay::bCoord || m_Overlay::bFPS || m_Overlay::bLocName || m_Overlay::bCpuUsage || m_Overlay::bMemUsage ||
((m_Overlay::bVehHealth || m_Overlay::bVehSpeed) && pPlayer && pPlayer->m_pVehicle && pPlayer->m_pVehicle->IsDriver(pPlayer));
((m_Overlay::bVehHealth || m_Overlay::bVehSpeed) && pPlayer && pPlayer->m_pVehicle && pPlayer->m_pVehicle->m_pDriver == pPlayer);
const float offset = 10.0f;
ImGuiIO& io = ImGui::GetIO();
@ -145,7 +145,7 @@ void Menu::DrawOverlay()
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::mFPS = static_cast<size_t>(BY_GAME(CTimer::game_FPS, io.Framerate));
m_Overlay::mFPS = static_cast<size_t>(BY_GAME(CTimer::game_FPS, io.Framerate, io.Framerate));
m_Overlay::mLastInterval = game_ms;
}
@ -174,7 +174,7 @@ void Menu::DrawOverlay()
ImGui::Text("RAM usage: %.2f%%", m_Overlay::fMemUsage);
}
if (pPlayer->m_pVehicle && pPlayer->m_pVehicle->IsDriver(pPlayer))
if (pPlayer->m_pVehicle && pPlayer->m_pVehicle->m_pDriver == pPlayer)
{
if (m_Overlay::bVehHealth)
{

View File

@ -2,5 +2,5 @@
#define MENU_NAME "Cheat Menu"
#define MENU_VERSION_NUMBER "3.0"
#define MENU_VERSION MENU_VERSION_NUMBER"-beta"
#define BUILD_NUMBER "20211017"
#define BUILD_NUMBER "20211020"
#define MENU_TITLE MENU_NAME " v" MENU_VERSION "(" BUILD_NUMBER ")"

View File

@ -7,9 +7,11 @@
#define GITHUB_LINK "https://github.com/user-grinch/Cheat-Menu"
#ifdef GTASA
#define BY_GAME(sa, vc) sa
#define BY_GAME(sa, vc, iii) sa
#elif GTAVC
#define BY_GAME(sa, vc) vc
#define BY_GAME(sa, vc, iii) vc
#elif GTA3
#define BY_GAME(sa, vc, iii) iii
#endif
#include <d3d9.h>
@ -25,12 +27,10 @@
#include <windows.h>
#include "plugin.h"
#include "CBike.h"
#include "CCamera.h"
#include "CClock.h"
#include "CCivilianPed.h"
#include "CGangs.h"
#include "cHandlingDataMgr.h"
#include "CHud.h"
#include "CMenuManager.h"
#include "CModelInfo.h"
@ -38,7 +38,6 @@
#include "CStats.h"
#include "CStreaming.h"
#include "CTheScripts.h"
#include "CTheZones.h"
#include "CTimer.h"
#include "CTimeCycle.h"
#include "CTrain.h"
@ -48,6 +47,12 @@
#include "extensions/Screen.h"
#include "extensions/Paths.h"
#ifndef GTA3
#include "CBike.h"
#include "cHandlingDataMgr.h"
#include "CTheZones.h"
#endif
#ifdef GTASA
#include "CCheat.h"
#include "CClothes.h"
@ -85,9 +90,11 @@ extern CJson gConfig;
// Fix function clashes
static void SetHelpMessage(const char *message, bool b1, bool b2, bool b3)
{
#if GTAVC
CHud::SetHelpMessage(message, b1, b2);
#elif GTASA
#if GTASA
CHud::SetHelpMessage(message, b1, b2, b3);
#elif GTAVC
CHud::SetHelpMessage(message, b1, b2);
#else // GTA3
CHud::SetHelpMessage((wchar_t*)message, b1);
#endif
}

View File

@ -45,6 +45,8 @@ std::string Util::GetLocationName(CVector* pos)
{
return "Vice City";
}
#else
return "Liberty City";
#endif
}
@ -141,7 +143,7 @@ CPlayerPed* player = FindPlayerPed();
return veh;
}
return nullptr;
#elif GTAVC
#else // GTAVC & GTA3
CVehicle *pClosestVeh = nullptr;
float distance = 999.0f;
@ -183,18 +185,14 @@ CPlayerPed* player = FindPlayerPed();
return ped;
}
return nullptr;
#elif GTAVC
#else // GTA3 & GTAVC
return player->m_apNearPeds[0];
#endif
}
bool Util::IsOnCutscene()
{
#ifdef GTASA
return CCutsceneMgr::ms_running;
#elif GTAVC
return *(bool*)0xA10AB2; // CCutsceneMgr::ms_running
#endif
return BY_GAME(CCutsceneMgr::ms_running, *(bool*)0xA10AB2, *(bool*)0x95CCF5);
}
void Util::RainbowValues(int& r, int& g, int& b, float speed)

View File

@ -7,7 +7,7 @@
#ifdef GTASA
class Vehicle : public Paint, public Neon
#elif GTAVC
#else // GTA3 & GTAVC
class Vehicle
#endif
{

View File

@ -41,7 +41,7 @@ void Visual::TimecycSlider(const char* label, T* ptr, int min, int max)
#ifdef GTASA
// Compatable with 24h TimeCyc
T* arr = static_cast<T*>(patch::GetPointer(int(ptr)));
#elif GTAVC
#else // GTA3 & GTAVC
T* arr = static_cast<T*>(ptr);
#endif
int a = arr[val];

7
tools/DebugIII.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=Debug /t:CheatMenuIII
cd ..

7
tools/ReleaseIII.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:CheatMenuIII
cd ..

View File

@ -7,6 +7,7 @@ PSDK_DIR = os.getenv("PLUGIN_SDK_DIR")
DX9SDK_DIR = os.getenv("DIRECTX9_SDK_DIR")
GTASA_DIR = "F:/GTASanAndreas"
GTAVC_DIR = "E:/GTA Vice City"
GTA3_DIR = "E:/GTA3"
if (DX9SDK_DIR == nil) then
error("DIRECTX9_SDK_DIR environment variable not set")
@ -47,6 +48,77 @@ project "Depend"
defines { "NDEBUG", "IS_PLATFORM_WIN" }
optimize "On"
project "CheatMenuIII"
kind "SharedLib"
targetdir (GTA3_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/ui.h",
"../src/ui.cpp",
"../src/util.h",
"../src/util.cpp",
"../src/menu.h",
"../src/menu.cpp",
"../src/hotkeys.h",
"../src/hotkeys.cpp",
"../src/dllmain.cpp"
}
includedirs {
PSDK_DIR .. "/plugin_III/",
PSDK_DIR .. "/plugin_III/game_III/",
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",
"GTA3",
"_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_III_d.lib"
}
filter "configurations:Release"
optimize "On"
links {
"Depend",
"d3d9",
"d3d11",
"XInput9_1_0",
"Pdh",
"urlmon",
"plugin_III.lib"
}
project "CheatMenuVC"
kind "SharedLib"
targetdir (GTAVC_DIR)