mirror of
https://github.com/YimMenu/YimMenuV2.git
synced 2025-05-30 23:19:17 +08:00
fix(Clang&MinGW): Fix Clang and MinGW builds on linux. (#303)
* fix(Clang&MinGW): Fix Clang and MinGW builds on linux. This may break building with clang for windows-gnu target, but it probably doesn't work anyway. * chore(FormatMoney): Cast like the other hooks. --------- Co-authored-by: tupoy-ya <tupoy-ya@users.noreply.github.com>
This commit is contained in:
parent
ff5d776c47
commit
61c2eab432
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,2 +1,3 @@
|
||||
build/
|
||||
.cache
|
||||
.vs
|
@ -33,9 +33,8 @@ message(STATUS "Setting up include directories.")
|
||||
target_include_directories(${PROJECT_NAME} PRIVATE
|
||||
"${SRC_DIR}"
|
||||
"${imgui_SOURCE_DIR}"
|
||||
"${minhook_SOURCE_DIR}/include"
|
||||
"${minhook_SOURCE_DIR}/src/hde"
|
||||
"${gtav_classes_SOURCE_DIR}"
|
||||
"${minhook_SOURCE_DIR}/include"
|
||||
"${minhook_SOURCE_DIR}/src/hde"
|
||||
)
|
||||
|
||||
message(STATUS "Setting up linked libraries")
|
||||
|
@ -8,11 +8,8 @@ if(USE_GCC OR USE_CLANG)
|
||||
set(TOOLCHAIN_PREFIX "x86_64-w64-mingw32" CACHE STRING "Set toolchain. Default: x86_64-w64-mingw32")
|
||||
message(STATUS "Using ${TOOLCHAIN_PREFIX} toolchain")
|
||||
set(CMAKE_FIND_ROOT_PATH /usr/x86_64-w64-mingw32)
|
||||
set(CMAKE_SYSTEM_NAME "Windows")
|
||||
set(CMAKE_ASM_MASM_COMPILER "uasm")
|
||||
|
||||
set(CMAKE_C_COMPILER_TARGET x86_64-windows-gnu)
|
||||
set(CMAKE_CXX_COMPILER_TARGET x86_64-windows-gnu)
|
||||
set(CMAKE_Fortran_COMPILER ${TOOLCHAIN_PREFIX}-gfortran)
|
||||
set(CMAKE_RC_COMPILER ${TOOLCHAIN_PREFIX}-windres)
|
||||
|
||||
@ -30,16 +27,20 @@ if(USE_GCC OR USE_CLANG)
|
||||
add_compile_options("$<$<COMPILE_LANGUAGE:CXX>:-fpermissive;-fno-rtti${CXX_FLAGS}>")
|
||||
set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}-gcc)
|
||||
set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}-g++)
|
||||
set(CMAKE_C_COMPILER_TARGET x86_64-windows-gnu)
|
||||
set(CMAKE_CXX_COMPILER_TARGET x86_64-windows-gnu)
|
||||
endif()
|
||||
|
||||
if(USE_CLANG)
|
||||
message(STATUS "Using clang compiler.")
|
||||
set(CMAKE_C_COMPILER clang)
|
||||
set(CMAKE_CXX_COMPILER clang++)
|
||||
set(CMAKE_C_COMPILER_TARGET x86_64-windows-msvc)
|
||||
set(CMAKE_CXX_COMPILER_TARGET x86_64-windows-msvc)
|
||||
|
||||
# Disable RTTI to work around libstdc++ issue https://stackoverflow.com/a/77025827
|
||||
add_compile_options("$<$<COMPILE_LANGUAGE:CXX>:-fuse-ld=lld;-femulated-tls;-fno-rtti${CXX_FLAGS}>")
|
||||
add_link_options(-fuse-ld=lld -femulated-tls -fno-rtti)
|
||||
add_compile_options("$<$<COMPILE_LANGUAGE:CXX>:-fuse-ld=lld;-fno-rtti${CXX_FLAGS}>")
|
||||
add_link_options(-fuse-ld=lld -fno-rtti)
|
||||
endif()
|
||||
|
||||
endif()
|
@ -1,6 +1,6 @@
|
||||
include(FetchContent)
|
||||
|
||||
message(STATUS "Setting up nlohmann::json")
|
||||
FetchContent_Declare(json GIT_REPOSITORY "https://github.com/nlohmann/json/" GIT_TAG v3.11.2 GIT_SHALLOW TRUE)
|
||||
FetchContent_Declare(json GIT_REPOSITORY "https://github.com/nlohmann/json/" GIT_TAG v3.12.0 GIT_SHALLOW TRUE)
|
||||
option(JSON_MultipleHeaders "Disable nlohmann JSON multi header default." OFF)
|
||||
FetchContent_MakeAvailable(json)
|
@ -6,7 +6,7 @@ message(STATUS "Setting up ${LIB_NAME}")
|
||||
FetchContent_Declare(
|
||||
${LIB_NAME}
|
||||
GIT_REPOSITORY https://github.com/TsudaKageyu/minhook.git
|
||||
GIT_TAG 98b74f1fc12d00313d91f10450e5b3e0036175e3
|
||||
GIT_TAG 2b003bb063d66f016cc1aef7d63951350ce60f35
|
||||
GIT_PROGRESS TRUE
|
||||
)
|
||||
FetchContent_MakeAvailable(${LIB_NAME})
|
@ -60,7 +60,7 @@ namespace ImGui
|
||||
}
|
||||
if (i % 4 == 0)
|
||||
{
|
||||
ImGui::Text("%i", i);
|
||||
ImGui::Text("%zu", i);
|
||||
ImGui::EndGroup();
|
||||
}
|
||||
if (i % 16 != 0)
|
||||
|
@ -57,7 +57,7 @@ namespace YimMenu
|
||||
template<typename T>
|
||||
T GetOriginal()
|
||||
{
|
||||
return static_cast<T>(m_OriginalFunction);
|
||||
return reinterpret_cast<T>(m_OriginalFunction);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -19,12 +19,12 @@ namespace YimMenu::Features
|
||||
{
|
||||
if (!formatIntCaller1Hook)
|
||||
{
|
||||
formatIntCaller1Hook = CallSiteHook::AddHook(Pointers.FormatIntCaller1, FormatIntHook);
|
||||
formatIntCaller1Hook = CallSiteHook::AddHook(Pointers.FormatIntCaller1, reinterpret_cast<void*>(FormatIntHook));
|
||||
}
|
||||
formatIntCaller1Hook->Enable();
|
||||
if (!formatIntCaller2Hook)
|
||||
{
|
||||
formatIntCaller2Hook = CallSiteHook::AddHook(Pointers.FormatIntCaller2, FormatIntHook);
|
||||
formatIntCaller2Hook = CallSiteHook::AddHook(Pointers.FormatIntCaller2, reinterpret_cast<void*>(FormatIntHook));
|
||||
}
|
||||
formatIntCaller2Hook->Enable();
|
||||
NativeHooks::AddHook("shop_controller"_J, NativeIndex::SCALEFORM_MOVIE_METHOD_ADD_PARAM_INT, &ScaleformAddIntHook);
|
||||
|
@ -85,8 +85,8 @@ namespace YimMenu::Submenus
|
||||
|
||||
ImGui::Text("Thread ID: %d", curThread->m_Context.m_ThreadId);
|
||||
ImGui::Text("Stack Size: %d", curThread->m_Context.m_StackSize);
|
||||
ImGui::Text("Stack Pointer: 0x%X", &curThread->m_Context.m_StackPointer);
|
||||
ImGui::Text("Program Counter: 0x%X", &curThread->m_Context.m_ProgramCounter); // This is not really accurate (always points to the WAIT)
|
||||
ImGui::Text("Stack Pointer: 0x%X", curThread->m_Context.m_StackPointer);
|
||||
ImGui::Text("Program Counter: 0x%X", curThread->m_Context.m_ProgramCounter); // This is not really accurate (always points to the WAIT)
|
||||
if (curThread->m_Context.m_State == rage::scrThread::State::KILLED)
|
||||
ImGui::Text("Exit Reason: %s", curThread->m_ErrorMessage);
|
||||
}));
|
||||
|
@ -4,7 +4,7 @@
|
||||
#include "game/frontend/items/Items.hpp"
|
||||
#include "game/frontend/submenus/Network/SavedPlayers.hpp"
|
||||
#include "game/gta/Network.hpp"
|
||||
#include "game/frontend/submenus/Network/RandomEvents.hpp"
|
||||
#include "game/frontend/submenus/network/RandomEvents.hpp"
|
||||
|
||||
namespace YimMenu::Submenus
|
||||
{
|
||||
|
@ -159,7 +159,7 @@ namespace YimMenu
|
||||
ENTITY_ASSERT_VALID();
|
||||
ENTITY_ASSERT_CONTROL();
|
||||
|
||||
WEAPON::SET_PED_INFINITE_AMMO(GetHandle(), infinite, NULL);
|
||||
WEAPON::SET_PED_INFINITE_AMMO(GetHandle(), infinite, 0);
|
||||
}
|
||||
|
||||
void Ped::SetInfiniteClip(bool infinite)
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include <type_traits>
|
||||
#include <types/script/scrThread.hpp>
|
||||
#include <core/util/Joaat.hpp>
|
||||
#include <src/game/gta/Scripts.hpp>
|
||||
#include <game/gta/Scripts.hpp>
|
||||
|
||||
namespace YimMenu
|
||||
{
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
namespace YimMenu
|
||||
{
|
||||
static constexpr std::array scriptNames = {
|
||||
static constexpr const char* scriptNames[] = {
|
||||
"abigail1",
|
||||
"abigail2",
|
||||
"achievement_controller",
|
||||
|
@ -54,7 +54,6 @@ namespace YimMenu::Hooks
|
||||
|
||||
if (arx_score >= 2)
|
||||
{
|
||||
auto from_offset = *reinterpret_cast<std::uint64_t*>(_AddressOfReturnAddress()) - ModuleMgr.Get("GTA5_Enhanced.exe"_J)->Base();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -28,6 +28,7 @@ namespace rage
|
||||
std::uint32_t m_CxnId; // 0x0044
|
||||
rage::netEvent* m_This; // 0x0048
|
||||
uint32_t m_PeerId; // 0x0050
|
||||
char pad_0084[4]; // 0x0054
|
||||
};
|
||||
static_assert(sizeof(rage::netEvent) == 0x58);
|
||||
|
||||
|
@ -248,8 +248,10 @@ class CExplosionEvent : public rage::netGameEvent
|
||||
public:
|
||||
void Deserialize(rage::datBitBuffer& buffer);
|
||||
|
||||
#if !__GNUC__
|
||||
struct
|
||||
{
|
||||
#endif
|
||||
ExplosionType m_ExplosionType; // 0x30
|
||||
rage::fvector3 m_Position; // 0x40
|
||||
uint64_t m_0x50; // 0x50
|
||||
@ -282,7 +284,9 @@ public:
|
||||
bool m_Expected; // 0xC2 -- for telemetry
|
||||
uint32_t m_ScriptHash; // 0xC4 -- for telemetry
|
||||
uint32_t m_ProgramCounter; // 0xC8 -- for telemetry
|
||||
#if !__GNUC__
|
||||
};
|
||||
#endif
|
||||
uint16_t m_TargetEntity; // 0xD0
|
||||
uint16_t m_TargetEnt2; // 0xD2
|
||||
uint16_t m_OwnerNetId; // 0xD4
|
||||
|
@ -10,4 +10,4 @@ private: \
|
||||
virtual bool _0x28(void**) = 0; \
|
||||
virtual void destructor() = 0; \
|
||||
\
|
||||
public:
|
||||
public:
|
||||
|
@ -42,7 +42,7 @@ namespace rage
|
||||
v11 = 8;
|
||||
if (size > 8)
|
||||
{
|
||||
v12 = 1i64;
|
||||
v12 = 1;
|
||||
do
|
||||
{
|
||||
if (v12 > v9)
|
||||
|
Loading…
x
Reference in New Issue
Block a user