Bug fixes & new stuff
1. Fixed issue with radio scroll #45 2. Fixed crash with renderhook 3. Refactored code 4. Added option to control neon pulsing 5. Fixed a issue with huge crosshair when huge dmg is enabled
This commit is contained in:
parent
ff8a21eaf3
commit
2a6fdb1c72
8
.vscode/settings.json
vendored
8
.vscode/settings.json
vendored
@ -67,7 +67,13 @@
|
||||
"*.def": "cpp",
|
||||
"atomic": "cpp",
|
||||
"compare": "cpp",
|
||||
"concepts": "cpp"
|
||||
"concepts": "cpp",
|
||||
"charconv": "cpp",
|
||||
"condition_variable": "cpp",
|
||||
"mutex": "cpp",
|
||||
"optional": "cpp",
|
||||
"shared_mutex": "cpp",
|
||||
"thread": "cpp"
|
||||
},
|
||||
"C_Cpp.errorSquiggles": "Enabled",
|
||||
"C_Cpp.intelliSenseEngineFallback": "Enabled"
|
||||
|
@ -1,4 +1,4 @@
|
||||
cmake_minimum_required(VERSION 3.19 FATAL_ERROR)
|
||||
cmake_minimum_required(VERSION 3.16 FATAL_ERROR)
|
||||
set(PROJECT_NAME CheatMenu)
|
||||
project(${PROJECT_NAME} CXX)
|
||||
|
||||
@ -16,6 +16,7 @@ set(DIRECTX9_SDK_DIR $ENV{DIRECTX9_SDK_DIR})
|
||||
# Required projects
|
||||
################################################################################
|
||||
add_subdirectory(src/vendor)
|
||||
add_subdirectory(src/tests)
|
||||
|
||||
################################################################################
|
||||
# Source groups
|
||||
|
@ -58,7 +58,7 @@ void Animation::Main()
|
||||
if (ImGui::BeginChild("Anims Child"))
|
||||
{
|
||||
ImGui::Spacing();
|
||||
Ui::DrawJSON(json, search_categories, selected_item, filter, &PlayAnimation, &RemoveEntry);
|
||||
Ui::DrawJSON(json, search_categories, selected_item, filter, &PlayAnimation, &RemoveAnimation);
|
||||
ImGui::EndChild();
|
||||
}
|
||||
ImGui::EndTabItem();
|
||||
@ -132,7 +132,7 @@ void Animation::PlayAnimation(std::string& ifp, std::string& anim, std::string&
|
||||
Command<Commands::REMOVE_ANIMATION>(ifp.c_str());
|
||||
}
|
||||
|
||||
void Animation::RemoveEntry(std::string& ifp, std::string& anim, std::string& ifp_repeat)
|
||||
void Animation::RemoveAnimation(std::string& ifp, std::string& anim, std::string& ifp_repeat)
|
||||
{
|
||||
flog << ifp << std::endl;
|
||||
if (ifp == "Custom")
|
||||
|
@ -10,16 +10,16 @@ private:
|
||||
static std::vector<std::string> search_categories;
|
||||
static std::string selected_item;
|
||||
|
||||
static char ifp_buffer[INPUT_BUFFER_SIZE];
|
||||
static char anim_buffer[INPUT_BUFFER_SIZE];
|
||||
static char ifp_buffer[INPUT_BUFFER_SIZE];
|
||||
|
||||
protected:
|
||||
Animation();
|
||||
~Animation() {};
|
||||
|
||||
public:
|
||||
static void Main();
|
||||
static void PlayAnimation(std::string& rootkey, std::string& anim, std::string& ifp);
|
||||
|
||||
static void RemoveEntry(std::string& rootkey, std::string& anim, std::string& ifp);
|
||||
static void RemoveAnimation(std::string& rootkey, std::string& anim, std::string& ifp);
|
||||
};
|
||||
|
||||
|
@ -1,7 +1,9 @@
|
||||
/*
|
||||
Required:
|
||||
Visual Studio 2015.3 (v140)
|
||||
DirectX 9 SDK
|
||||
Plugin SDK
|
||||
Visual Studio 2019 (v142)
|
||||
Windows SDK
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
@ -50,7 +52,7 @@ public:
|
||||
}
|
||||
|
||||
/*
|
||||
WndProc is extremely buggy without SilentPatch
|
||||
Mouse is extremely buggy without SilentPatch
|
||||
Should have a better fix for this but everyone should have
|
||||
SilentPatch installed so mehh...
|
||||
*/
|
||||
|
27
src/Hook.cpp
27
src/Hook.cpp
@ -17,6 +17,14 @@ LRESULT Hook::InputProc(const HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam
|
||||
{
|
||||
ImGui_ImplWin32_WndProcHandler(hWnd, uMsg, wParam, lParam);
|
||||
|
||||
if (Hook::show_mouse)
|
||||
{
|
||||
patch::Nop(0x4EB9F4, 5); // disable radio scroll
|
||||
Call<0x541BD0>(); // CPad::ClearMouseHistory
|
||||
}
|
||||
else
|
||||
patch::SetRaw(0x4EB9F4, (void*)"\xE8\x67\xFC\xFF\xFF", 5); // enable radio scroll
|
||||
|
||||
if (ImGui::GetIO().WantTextInput)
|
||||
{
|
||||
Call<0x53F1E0>(); // CPad::ClearKeyboardHistory
|
||||
@ -24,7 +32,6 @@ LRESULT Hook::InputProc(const HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam
|
||||
}
|
||||
else
|
||||
return CallWindowProc(oWndProc, hWnd, uMsg, wParam, lParam);
|
||||
|
||||
}
|
||||
|
||||
HRESULT Hook::ResetDx9(IDirect3DDevice9 * pDevice, D3DPRESENT_PARAMETERS * pPresentationParameters)
|
||||
@ -97,9 +104,11 @@ HRESULT Hook::PresentDx11(IDXGISwapChain* pSwapChain, UINT SyncInterval, UINT Fl
|
||||
|
||||
if (Globals::init_done)
|
||||
{
|
||||
HRESULT hr = pSwapChain->Present(1, 0);
|
||||
if (hr == DXGI_ERROR_DEVICE_REMOVED || hr == DXGI_ERROR_DEVICE_RESET)
|
||||
ImGui_ImplDX11_InvalidateDeviceObjects();
|
||||
if (mouse_visibility != show_mouse)
|
||||
{
|
||||
Hook::ShowMouse(show_mouse);
|
||||
mouse_visibility = show_mouse;
|
||||
}
|
||||
|
||||
// Change font size if the game resolution changes
|
||||
if (Globals::font_screen_size.x != screen::GetScreenWidth()
|
||||
@ -135,13 +144,13 @@ HRESULT Hook::PresentDx11(IDXGISwapChain* pSwapChain, UINT SyncInterval, UINT Fl
|
||||
DXGI_SWAP_CHAIN_DESC desc;
|
||||
pSwapChain->GetDesc(&desc);
|
||||
|
||||
pSwapChain->GetDevice(__uuidof(ID3D11Device), (void**)&Globals::device11);
|
||||
pSwapChain->GetDevice(__uuidof(ID3D11Device), (void**)&Globals::device);
|
||||
ID3D11DeviceContext* context;
|
||||
Globals::device11->GetImmediateContext(&context);
|
||||
reinterpret_cast<ID3D11Device*>(Globals::device)->GetImmediateContext(&context);
|
||||
|
||||
ImGui::CreateContext();
|
||||
ImGui_ImplWin32_Init(desc.OutputWindow);
|
||||
ImGui_ImplDX11_Init(Globals::device11, context);
|
||||
ImGui_ImplDX11_Init(reinterpret_cast<ID3D11Device*>(Globals::device), context);
|
||||
ImGui_ImplWin32_EnableDpiAwareness();
|
||||
|
||||
io.IniFilename = NULL;
|
||||
@ -163,6 +172,7 @@ void Hook::ShowMouse(bool state)
|
||||
patch::SetUChar(0x6194A0, 0xC3);
|
||||
patch::Nop(0x53F417, 5); // don't call CPad__getMouseState
|
||||
patch::SetRaw(0x53F41F, (void*)"\x33\xC0\x0F\x84", 4); // disable camera mouse movement
|
||||
//patch::Nop(0x4EB9F4, 5); // disable radio scroll
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -171,6 +181,7 @@ void Hook::ShowMouse(bool state)
|
||||
patch::SetRaw(0x53F41F, (void*)"\x85\xC0\x0F\x8C", 4); // xor eax, eax -> test eax, eax , enable camera mouse movement
|
||||
// jz loc_53F526 -> jl loc_53F526
|
||||
patch::SetUChar(0x6194A0, 0xE9); // jmp setup
|
||||
//patch::SetRaw(0x4EB9F4, (void*)"\xE8\x67\xFC\xFF\xFF", 5); // enable radio scroll
|
||||
}
|
||||
|
||||
ImGui::GetIO().MouseDrawCursor = state;
|
||||
@ -206,8 +217,6 @@ Hook::Hook()
|
||||
Globals::renderer = Render_DirectX11;
|
||||
flog << "Successfully hooked dx11 device." << std::endl;
|
||||
}
|
||||
|
||||
flog << "Successfully hooked dx11 device." << std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
#pragma once
|
||||
#define MENU_NAME "Cheat Menu"
|
||||
#define MENU_VERSION "2.5-beta"
|
||||
#define BUILD_NUMBER "20210103"
|
||||
#define BUILD_NUMBER "20210108"
|
||||
#define MENU_TITLE MENU_NAME " v" MENU_VERSION "(" BUILD_NUMBER ")"
|
@ -30,17 +30,19 @@ NeonAPI::NeonAPI()
|
||||
{
|
||||
data->timer = CTimer::m_snTimeInMilliseconds;
|
||||
|
||||
if (data->val < 0.0f)
|
||||
if (data->pulsing)
|
||||
{
|
||||
if (data->val < 0.0f)
|
||||
data->increment = true;
|
||||
|
||||
if (data->val > 0.3f)
|
||||
data->increment = false;
|
||||
|
||||
if (data->increment)
|
||||
data->val += 0.1f;
|
||||
else
|
||||
data->val -= 0.1f;
|
||||
if (data->val > 0.3f)
|
||||
data->increment = false;
|
||||
|
||||
if (data->increment)
|
||||
data->val += 0.1f;
|
||||
else
|
||||
data->val -= 0.1f;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -56,6 +58,16 @@ bool NeonAPI::IsNeonInstalled(CVehicle *pVeh)
|
||||
return VehNeon.Get(pVeh).neon_installed;
|
||||
}
|
||||
|
||||
bool NeonAPI::IsPulsingEnabled(CVehicle *pVeh)
|
||||
{
|
||||
return VehNeon.Get(pVeh).pulsing;
|
||||
}
|
||||
|
||||
void NeonAPI::SetPulsing(CVehicle *pVeh, bool state)
|
||||
{
|
||||
VehNeon.Get(pVeh).pulsing = state;
|
||||
}
|
||||
|
||||
void NeonAPI::InstallNeon(CVehicle *pVeh, int red, int green, int blue)
|
||||
{
|
||||
CRGBA &color = VehNeon.Get(pVeh).color;
|
||||
|
@ -12,6 +12,7 @@ private:
|
||||
float val;
|
||||
uint timer;
|
||||
bool increment;
|
||||
bool pulsing;
|
||||
|
||||
NeonData(CVehicle *pVeh)
|
||||
{
|
||||
@ -29,6 +30,8 @@ public:
|
||||
~NeonAPI();
|
||||
static void InstallNeon(CVehicle *veh, int red, int green, int blue);
|
||||
static bool IsNeonInstalled(CVehicle *veh);
|
||||
static bool IsPulsingEnabled(CVehicle *veh);
|
||||
static void SetPulsing(CVehicle *veh, bool state);
|
||||
static void RemoveNeon(CVehicle *veh);
|
||||
};
|
||||
|
||||
|
@ -493,14 +493,7 @@ void Ui::DrawImages(std::vector<std::unique_ptr<TextureStructure>> &img_vec, ImV
|
||||
&& (verify_func == nullptr || verify_func(text))
|
||||
)
|
||||
{
|
||||
void *texture = nullptr;
|
||||
|
||||
if (Globals::renderer == Render_DirectX9)
|
||||
texture = img_vec[i]->texture9;
|
||||
else // consider 11
|
||||
texture = img_vec[i]->texture11;
|
||||
|
||||
if (ImGui::ImageButton(texture, image_size, ImVec2(0, 0), ImVec2(1, 1), 1, ImVec4(1, 1, 1, 1), ImVec4(1, 1, 1, 1)))
|
||||
if (ImGui::ImageButton(img_vec[i]->texture, image_size, ImVec2(0, 0), ImVec2(1, 1), 1, ImVec4(1, 1, 1, 1), ImVec4(1, 1, 1, 1)))
|
||||
on_left_click(text);
|
||||
|
||||
if (ImGui::IsItemClicked(1) && on_right_click != nullptr)
|
||||
|
@ -33,11 +33,11 @@ void Util::LoadTexturesInDirRecursive(const char *path, const char *file_ext,std
|
||||
store_vec.push_back(std::make_unique<TextureStructure>());
|
||||
HRESULT hr = -1;
|
||||
if (Globals::renderer == Render_DirectX9)
|
||||
hr = D3DXCreateTextureFromFileA(GetD3DDevice(), p.path().string().c_str(), &store_vec.back().get()->texture9);
|
||||
hr = D3DXCreateTextureFromFileA(GetD3DDevice(), p.path().string().c_str(), reinterpret_cast<PDIRECT3DTEXTURE9*>(&store_vec.back().get()->texture));
|
||||
|
||||
if (Globals::renderer == Render_DirectX11)
|
||||
{
|
||||
if (LoadTextureFromFileDx11(p.path().string().c_str(), &store_vec.back().get()->texture11))
|
||||
if (LoadTextureFromFileDx11(p.path().string().c_str(), reinterpret_cast<ID3D11ShaderResourceView**>(&store_vec.back().get()->texture)))
|
||||
hr = S_OK;
|
||||
}
|
||||
|
||||
@ -89,7 +89,7 @@ bool Util::LoadTextureFromFileDx11(const char* filename, ID3D11ShaderResourceVie
|
||||
subResource.SysMemPitch = desc.Width * 4;
|
||||
subResource.SysMemSlicePitch = 0;
|
||||
|
||||
Globals::device11->CreateTexture2D(&desc, &subResource, &pTexture);
|
||||
reinterpret_cast<ID3D11Device*>(Globals::device)->CreateTexture2D(&desc, &subResource, &pTexture);
|
||||
|
||||
// Create texture view
|
||||
D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc;
|
||||
@ -98,7 +98,7 @@ bool Util::LoadTextureFromFileDx11(const char* filename, ID3D11ShaderResourceVie
|
||||
srvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
|
||||
srvDesc.Texture2D.MipLevels = desc.MipLevels;
|
||||
srvDesc.Texture2D.MostDetailedMip = 0;
|
||||
Globals::device11->CreateShaderResourceView(pTexture, &srvDesc, out_srv);
|
||||
reinterpret_cast<ID3D11Device*>(Globals::device)->CreateShaderResourceView(pTexture, &srvDesc, out_srv);
|
||||
pTexture->Release();
|
||||
|
||||
stbi_image_free(image_data);
|
||||
|
@ -1043,6 +1043,11 @@ void Vehicle::Main()
|
||||
|
||||
ImGui::Spacing();
|
||||
ImGui::Columns(2, NULL, false);
|
||||
|
||||
bool pulsing = NeonAPI::IsPulsingEnabled(veh);
|
||||
if (Ui::CheckboxWithHint("Pulsing neons", &pulsing))
|
||||
NeonAPI::SetPulsing(veh,pulsing);
|
||||
|
||||
Ui::CheckboxWithHint("Rainbow neons", &neon::rainbow, "Rainbow effect to neon lights");
|
||||
ImGui::NextColumn();
|
||||
Ui::CheckboxWithHint("Traffic neons", &neon::traffic, "Adds neon lights to traffic vehicles.\n\
|
||||
|
@ -66,7 +66,7 @@ Weapon::Weapon()
|
||||
CWeaponInfo *pweapon_info = CWeaponInfo::GetWeaponInfo(weapon_type, player->GetWeaponSkill(weapon_type));
|
||||
|
||||
if (huge_damage)
|
||||
pweapon_info->m_nDamage = 5000;
|
||||
pweapon_info->m_nDamage = 1000;
|
||||
|
||||
if (long_range)
|
||||
{
|
||||
|
@ -7,8 +7,8 @@ ImVec2 Globals::font_screen_size = ImVec2(-1, -1);
|
||||
bool Globals::show_menu = false;
|
||||
bool Globals::init_done = false;
|
||||
Renderer Globals::renderer = Render_Unknown;
|
||||
ID3D11Device *Globals::device11 = nullptr;
|
||||
bool Globals::gsync_time = false;
|
||||
void *Globals::device = nullptr;
|
||||
|
||||
std::ofstream flog = std::ofstream("CheatMenu.log");
|
||||
CJson config = CJson("config");
|
||||
|
@ -49,7 +49,7 @@
|
||||
#include "extensions/ScriptCommands.h"
|
||||
#include "extensions/Screen.h"
|
||||
#include "eVehicleClass.h"
|
||||
#include "extensions\Paths.h"
|
||||
#include "extensions/Paths.h"
|
||||
|
||||
#include "vendor/imgui/imgui.h"
|
||||
#include "vendor/imgui/imgui_internal.h"
|
||||
@ -86,16 +86,15 @@ struct Globals
|
||||
static bool show_menu;
|
||||
static bool init_done;
|
||||
static Renderer renderer;
|
||||
static ID3D11Device* device11;
|
||||
static bool gsync_time;
|
||||
static void* device;
|
||||
};
|
||||
|
||||
struct TextureStructure
|
||||
{
|
||||
std::string file_name;
|
||||
std::string category_name;
|
||||
PDIRECT3DTEXTURE9 texture9;
|
||||
ID3D11ShaderResourceView* texture11;
|
||||
void *texture = nullptr;
|
||||
};
|
||||
|
||||
extern CJson config;
|
||||
|
129
src/tests/CMakeLists.txt
Normal file
129
src/tests/CMakeLists.txt
Normal file
@ -0,0 +1,129 @@
|
||||
################################################################################
|
||||
# Build Test.asi
|
||||
# A testing plugin for the menu, recompiling the whole menu is tedious
|
||||
################################################################################
|
||||
|
||||
cmake_minimum_required(VERSION 3.0)
|
||||
project(Test)
|
||||
|
||||
################################################################################
|
||||
# Target
|
||||
################################################################################
|
||||
add_library(${PROJECT_NAME} SHARED "Test.cpp")
|
||||
|
||||
string(CONCAT "MSVC_RUNTIME_LIBRARY_STR"
|
||||
$<$<CONFIG:Release>:
|
||||
MultiThreaded
|
||||
>
|
||||
$<$<CONFIG:Debug>:
|
||||
MultiThreadedDebug
|
||||
>
|
||||
)
|
||||
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES
|
||||
RUNTIME_OUTPUT_DIRECTORY "${GTA_SA_DIR}/$<0:>/"
|
||||
SUFFIX ".asi"
|
||||
MSVC_RUNTIME_LIBRARY ${MSVC_RUNTIME_LIBRARY_STR}
|
||||
)
|
||||
|
||||
################################################################################
|
||||
# Include directories
|
||||
################################################################################
|
||||
include_directories(
|
||||
"${PLUGIN_SDK_DIR}/plugin_sa"
|
||||
"${PLUGIN_SDK_DIR}/plugin_sa/game_sa"
|
||||
"${PLUGIN_SDK_DIR}/shared"
|
||||
"${PLUGIN_SDK_DIR}/shared/game"
|
||||
"${DIRECTX9_SDK_DIR}/include"
|
||||
)
|
||||
|
||||
################################################################################
|
||||
# Compile definitions
|
||||
################################################################################
|
||||
target_compile_definitions(${PROJECT_NAME} PRIVATE
|
||||
"$<$<CONFIG:Release>:"
|
||||
"_NDEBUG"
|
||||
">"
|
||||
"$<$<CONFIG:Debug>:"
|
||||
"_DEBUG"
|
||||
">"
|
||||
"_CRT_SECURE_NO_WARNINGS;"
|
||||
"_CRT_NON_CONFORMING_SWPRINTFS;"
|
||||
"GTASA;"
|
||||
"GTAGAME_NAME=\"San Andreas\";"
|
||||
"GTAGAME_ABBR=\"SA\";"
|
||||
"GTAGAME_ABBRLOW=\"sa\";"
|
||||
"GTAGAME_PROTAGONISTNAME=\"CJ\";"
|
||||
"GTAGAME_CITYNAME=\"San Andreas\";"
|
||||
"_LA_SUPPORT;"
|
||||
"_DX9_SDK_INSTALLED;"
|
||||
"PLUGIN_SGV_10US;"
|
||||
"_MBCS"
|
||||
)
|
||||
|
||||
################################################################################
|
||||
# Compile and link options
|
||||
################################################################################
|
||||
target_compile_options(${PROJECT_NAME} PRIVATE
|
||||
$<$<CONFIG:Release>:
|
||||
/O2;
|
||||
/Oi;
|
||||
/Gy
|
||||
>
|
||||
$<$<CONFIG:Debug>:
|
||||
/Od
|
||||
/DEBUG:FULL
|
||||
>
|
||||
/std:c++latest;
|
||||
/sdl-;
|
||||
/W3;
|
||||
${DEFAULT_CXX_DEBUG_INFORMATION_FORMAT};
|
||||
${DEFAULT_CXX_EXCEPTION_HANDLING}
|
||||
/w44005
|
||||
)
|
||||
string(CONCAT FILE_CL_OPTIONS
|
||||
"/Y-"
|
||||
)
|
||||
target_link_options(${PROJECT_NAME} PRIVATE
|
||||
$<$<CONFIG:Release>:
|
||||
/OPT:REF;
|
||||
/LTCG;
|
||||
/OPT:ICF;
|
||||
>
|
||||
$<$<CONFIG:Debug>:
|
||||
/DEBUG:FULL;
|
||||
/SAFESEH:NO;
|
||||
>
|
||||
/SUBSYSTEM:WINDOWS
|
||||
)
|
||||
|
||||
################################################################################
|
||||
# Pre build events
|
||||
################################################################################
|
||||
add_custom_command(
|
||||
TARGET ${PROJECT_NAME}
|
||||
PRE_BUILD
|
||||
COMMAND taskkill /f /fi "imagename eq gta_sa.exe"
|
||||
)
|
||||
|
||||
################################################################################
|
||||
# Dependencies
|
||||
################################################################################
|
||||
target_link_libraries(${PROJECT_NAME} PUBLIC
|
||||
optimized plugin
|
||||
debug plugin_d
|
||||
)
|
||||
|
||||
target_link_directories(${PROJECT_NAME} PUBLIC
|
||||
"$ENV{PLUGIN_SDK_DIR}/output/lib/"
|
||||
"$<$<CONFIG:Release>:"
|
||||
"vendor/Release/"
|
||||
">"
|
||||
"$<$<CONFIG:Debug>:"
|
||||
"vendor/Debug/"
|
||||
">")
|
||||
|
||||
target_link_libraries(${PROJECT_NAME} PUBLIC
|
||||
optimized plugin
|
||||
debug plugin_d
|
||||
)
|
23
src/tests/Test.cpp
Normal file
23
src/tests/Test.cpp
Normal file
@ -0,0 +1,23 @@
|
||||
#include "plugin.h"
|
||||
|
||||
using namespace plugin;
|
||||
|
||||
class Test
|
||||
{
|
||||
public:
|
||||
Test()
|
||||
{
|
||||
Events::processScriptsEvent += []
|
||||
{
|
||||
if(KeyPressed(VK_UP))
|
||||
{
|
||||
patch::Nop(0x4EB9F4, 5); // disable
|
||||
}
|
||||
if(KeyPressed(VK_DOWN))
|
||||
{
|
||||
patch::SetRaw(0x4EB9F4, (void*)"\xE8\x67\xFC\xFF\xFF", 5); // enable
|
||||
}
|
||||
};
|
||||
}
|
||||
} test;
|
||||
|
Loading…
Reference in New Issue
Block a user