Optimizations (#2649)
* fix(Respawn): fix respawn in SP * fix: re-enable bigobj * fix: update creator's stack size * fix: use BOOLs instead of bools * fix(gitignore): hide .pyc files
This commit is contained in:
parent
a9c90b953a
commit
1127e51a52
1
.gitignore
vendored
1
.gitignore
vendored
@ -13,6 +13,7 @@ __pycache__/
|
||||
*.ipch
|
||||
*.gch
|
||||
*.pch
|
||||
*.pyc
|
||||
|
||||
# generated by CMAKE
|
||||
version.cpp
|
@ -14,7 +14,6 @@ include(scripts/async-logger.cmake)
|
||||
include(scripts/pugixml.cmake)
|
||||
include(scripts/json.cmake)
|
||||
include(scripts/cpr.cmake)
|
||||
include(scripts/zydis.cmake)
|
||||
include(scripts/lua.cmake)
|
||||
include(scripts/imgui.cmake)
|
||||
message("\nFetching custom modules")
|
||||
@ -52,10 +51,11 @@ target_include_directories(YimMenu PRIVATE
|
||||
"${json_SOURCE_DIR}/single_include"
|
||||
"${gtav_classes_SOURCE_DIR}"
|
||||
"${imgui_SOURCE_DIR}"
|
||||
"${minhook_SOURCE_DIR}/src/hde"
|
||||
)
|
||||
|
||||
target_precompile_headers(YimMenu PRIVATE "${SRC_DIR}/common.hpp")
|
||||
target_link_libraries(YimMenu PRIVATE pugixml minhook AsyncLogger dbghelp imgui cpr Zydis lua_static)
|
||||
target_link_libraries(YimMenu PRIVATE pugixml minhook AsyncLogger dbghelp imgui cpr lua_static)
|
||||
|
||||
# Warnings as errors
|
||||
set_property(TARGET YimMenu PROPERTY COMPILE_WARNING_AS_ERROR ON)
|
||||
@ -65,3 +65,13 @@ add_compile_definitions(YimMenu
|
||||
"NOMINMAX"
|
||||
"WIN32_LEAN_AND_MEAN"
|
||||
)
|
||||
|
||||
# Optimizations
|
||||
if(MSVC)
|
||||
set(CMAKE_MODULE_LINKER_FLAGS
|
||||
"${CMAKE_MODULE_LINKER_FLAGS} /LTCG /OPT:REF,ICF /GUARD:NO")
|
||||
|
||||
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO
|
||||
"${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /O2 /Ox /Oi /Ot /Oy /Ob3 /sdl- /GL /GF /GS- /Gw")
|
||||
string(REPLACE "/Ob1" "/Ob3" CMAKE_CXX_FLAGS_RELWITHDEBINFO ${CMAKE_CXX_FLAGS_RELWITHDEBINFO})
|
||||
endif()
|
||||
|
@ -1,26 +1,27 @@
|
||||
{
|
||||
"configurations": [
|
||||
{
|
||||
"name": "x64-Debug",
|
||||
"generator": "Ninja",
|
||||
"configurationType": "Debug",
|
||||
"inheritEnvironments": [ "msvc_x64_x64" ],
|
||||
"buildRoot": "${projectDir}\\out\\build\\${name}",
|
||||
"installRoot": "${projectDir}\\out\\install\\${name}",
|
||||
"cmakeCommandArgs": "",
|
||||
"buildCommandArgs": "",
|
||||
"ctestCommandArgs": ""
|
||||
},
|
||||
{
|
||||
"name": "x64-Release",
|
||||
"generator": "Ninja",
|
||||
"configurationType": "RelWithDebInfo",
|
||||
"inheritEnvironments": [ "msvc_x64_x64" ],
|
||||
"buildRoot": "${projectDir}\\out\\build\\${name}",
|
||||
"installRoot": "${projectDir}\\out\\install\\${name}",
|
||||
"cmakeCommandArgs": "",
|
||||
"buildCommandArgs": "",
|
||||
"ctestCommandArgs": ""
|
||||
}
|
||||
]
|
||||
{
|
||||
"configurations": [
|
||||
{
|
||||
"name": "x64-Release",
|
||||
"generator": "Ninja",
|
||||
"configurationType": "RelWithDebInfo",
|
||||
"inheritEnvironments": [ "msvc_x64_x64" ],
|
||||
"buildRoot": "${projectDir}\\out\\build\\${name}",
|
||||
"installRoot": "${projectDir}\\out\\install\\${name}",
|
||||
"cmakeCommandArgs": "",
|
||||
"buildCommandArgs": "",
|
||||
"ctestCommandArgs": ""
|
||||
},
|
||||
{
|
||||
"name": "x64-Debug",
|
||||
"generator": "Ninja",
|
||||
"configurationType": "Debug",
|
||||
"buildRoot": "${projectDir}\\out\\build\\${name}",
|
||||
"installRoot": "${projectDir}\\out\\install\\${name}",
|
||||
"cmakeCommandArgs": "",
|
||||
"buildCommandArgs": "",
|
||||
"ctestCommandArgs": "",
|
||||
"inheritEnvironments": [ "msvc_x64_x64" ],
|
||||
"variables": []
|
||||
}
|
||||
]
|
||||
}
|
@ -3,7 +3,7 @@ include(FetchContent)
|
||||
FetchContent_Declare(
|
||||
gtav_classes
|
||||
GIT_REPOSITORY https://github.com/Yimura/GTAV-Classes.git
|
||||
GIT_TAG eab95fba6d19ceeee0442158b6f5de6824ff7349
|
||||
GIT_TAG e8d8bdd2b3152253f6e1fde48720e4caeab19f83
|
||||
GIT_PROGRESS TRUE
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND ""
|
||||
|
@ -1,15 +0,0 @@
|
||||
include(FetchContent)
|
||||
|
||||
message("zydis")
|
||||
|
||||
set(ZYDIS_BUILD_DOXYGEN OFF CACHE BOOL "Zydis Build Doxygen")
|
||||
set(ZYDIS_FEATURE_ENCODER OFF CACHE BOOL "Zydis Feature Encoder")
|
||||
|
||||
FetchContent_Declare(
|
||||
zydis
|
||||
GIT_REPOSITORY https://github.com/zyantific/zydis.git
|
||||
GIT_TAG 8948d9a8f493330d27a0e7bbebf40f0391e45f1b
|
||||
GIT_PROGRESS TRUE
|
||||
)
|
||||
FetchContent_MakeAvailable(zydis)
|
||||
set_property(TARGET Zydis PROPERTY CXX_STANDARD 23)
|
@ -1,13 +1,8 @@
|
||||
#include "backend/player_command.hpp"
|
||||
#include "core/scr_globals.hpp"
|
||||
#include "fiber_pool.hpp"
|
||||
#include "gta/net_object_mgr.hpp"
|
||||
#include "gta/script_handler.hpp"
|
||||
#include "hooking.hpp"
|
||||
#include "natives.hpp"
|
||||
#include "pointers.hpp"
|
||||
#include "services/script_connection/script_connection_service.hpp"
|
||||
#include "util/scripts.hpp"
|
||||
|
||||
#include <script/globals/GPBD_FM.hpp>
|
||||
#include <script/globals/GlobalPlayerBD.hpp>
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include "chat_command_context.hpp"
|
||||
|
||||
#include "fiber_pool.hpp"
|
||||
#include "hooking.hpp"
|
||||
#include "hooking/hooking.hpp"
|
||||
#include "util/notify.hpp"
|
||||
|
||||
namespace big
|
||||
|
@ -1,5 +1,4 @@
|
||||
#include "backend/looped/looped.hpp"
|
||||
#include "hooking.hpp"
|
||||
#include "natives.hpp"
|
||||
#include "script_function.hpp"
|
||||
#include "services/script_patcher/script_patcher_service.hpp"
|
||||
|
@ -43,7 +43,7 @@ namespace big
|
||||
-1,
|
||||
0,
|
||||
7);
|
||||
int did_raycast_hit = 0;
|
||||
BOOL did_raycast_hit{FALSE};
|
||||
Vector3 raycast_hit_position{};
|
||||
Vector3 raycast_surface_normal_hit_position{};
|
||||
Entity raycast_hit_entity{};
|
||||
|
@ -30,7 +30,7 @@ namespace big
|
||||
}
|
||||
|
||||
Hash current_weapon, current_vehicle_weapon;
|
||||
WEAPON::GET_CURRENT_PED_WEAPON(player_ped, ¤t_weapon, -1);
|
||||
WEAPON::GET_CURRENT_PED_WEAPON(player_ped, ¤t_weapon, false);
|
||||
WEAPON::GET_CURRENT_PED_VEHICLE_WEAPON(player_ped, ¤t_vehicle_weapon);
|
||||
for (int iterator_keys = 0; iterator_keys < 6; iterator_keys++)
|
||||
{
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
#include "backend/player_command.hpp"
|
||||
#include "fiber_pool.hpp"
|
||||
#include "hooking.hpp"
|
||||
#include "hooking/hooking.hpp"
|
||||
#include "pointers.hpp"
|
||||
#include "script.hpp"
|
||||
#include "util/notify.hpp"
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
#include "backend/player_command.hpp"
|
||||
#include "fiber_pool.hpp"
|
||||
#include "hooking.hpp"
|
||||
#include "hooking/hooking.hpp"
|
||||
#include "pointers.hpp"
|
||||
#include "script.hpp"
|
||||
#include "services/player_database/player_database_service.hpp"
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include "byte_patch_manager.hpp"
|
||||
|
||||
#include "gta/net_array.hpp"
|
||||
#include "hooking.hpp"
|
||||
#include "hooking/hooking.hpp"
|
||||
#include "memory/byte_patch.hpp"
|
||||
#include "pointers.hpp"
|
||||
#include "util/explosion_anti_cheat_bypass.hpp"
|
||||
|
@ -56,7 +56,6 @@
|
||||
#include "logger/logger.hpp"
|
||||
|
||||
#include "core/settings.hpp"
|
||||
#include "gta/natives.hpp"
|
||||
#include "ped/CPed.hpp"
|
||||
|
||||
#include "services/notifications/notification_service.hpp"
|
||||
@ -65,6 +64,8 @@
|
||||
#define SOL_ALL_SAFETIES_ON 1
|
||||
#include "lua/sol.hpp"
|
||||
|
||||
#include <script/types.hpp>
|
||||
|
||||
// clang-format on
|
||||
|
||||
namespace big
|
||||
|
@ -1,35 +1,36 @@
|
||||
#pragma once
|
||||
|
||||
namespace big
|
||||
{
|
||||
constexpr inline static const std::pair<const char*, int> stack_sizes[] = {
|
||||
{"MICRO", 128},
|
||||
{"MINI", 512},
|
||||
{"DEFAULT", 1424},
|
||||
{"SPECIAL_ABILITY", 1828},
|
||||
{"FRIEND", 2050},
|
||||
{"SHOP", 2324},
|
||||
{"CELLPHONE", 2552},
|
||||
{"VEHICLE_SPAWN", 3568},
|
||||
{"CAR_MOD_SHOP", 3650},
|
||||
{"PAUSE_MENU_SCRIPT", 3076},
|
||||
{"APP_INTERNET", 4592},
|
||||
{"MULTIPLAYER_MISSION", 5050},
|
||||
{"CONTACTS_APP", 4000},
|
||||
{"INTERACTION_MENU", 9800},
|
||||
{"SCRIPT_XML", 8344},
|
||||
{"PROPERTY_INT", 19400},
|
||||
{"ACTIVITY_CREATOR_INT", 15900},
|
||||
{"SMPL_INTERIOR", 2512},
|
||||
{"WAREHOUSE", 14100},
|
||||
{"IE_DELIVERY", 2324},
|
||||
{"SHOP_CONTROLLER", 3800},
|
||||
{"AM_MP_YACHT", 5000},
|
||||
{"INGAMEHUD", 4600},
|
||||
{"TRANSITION", 8032},
|
||||
{"FMMC_LAUNCHER", 24000},
|
||||
{"MULTIPLAYER_FREEMODE", 72500},
|
||||
{"MISSION", 54000},
|
||||
{"MP_LAUNCH_SCRIPT", 33750},
|
||||
};
|
||||
#pragma once
|
||||
|
||||
namespace big
|
||||
{
|
||||
// Get new values from gameconfig.xml
|
||||
constexpr inline static const std::pair<const char*, int> stack_sizes[] = {
|
||||
{"MICRO", 128},
|
||||
{"MINI", 512},
|
||||
{"DEFAULT", 1424},
|
||||
{"SPECIAL_ABILITY", 1828},
|
||||
{"FRIEND", 2050},
|
||||
{"SHOP", 2324},
|
||||
{"CELLPHONE", 2552},
|
||||
{"VEHICLE_SPAWN", 3868},
|
||||
{"CAR_MOD_SHOP", 3750},
|
||||
{"PAUSE_MENU_SCRIPT", 3076},
|
||||
{"APP_INTERNET", 4592},
|
||||
{"MULTIPLAYER_MISSION", 5050},
|
||||
{"CONTACTS_APP", 4000},
|
||||
{"INTERACTION_MENU", 9800},
|
||||
{"SCRIPT_XML", 8500},
|
||||
{"PROPERTY_INT", 19400},
|
||||
{"ACTIVITY_CREATOR_INT", 15900},
|
||||
{"SMPL_INTERIOR", 6500},
|
||||
{"WAREHOUSE", 14100},
|
||||
{"IE_DELIVERY", 2324},
|
||||
{"SHOP_CONTROLLER", 3800},
|
||||
{"AM_MP_YACHT", 5000},
|
||||
{"INGAMEHUD", 4600},
|
||||
{"TRANSITION", 8032},
|
||||
{"FMMC_LAUNCHER", 26000},
|
||||
{"MULTIPLAYER_FREEMODE", 82500},
|
||||
{"MISSION", 60500},
|
||||
{"MP_LAUNCH_SCRIPT", 37500},
|
||||
};
|
||||
}
|
6575
src/crossmap.cpp
6575
src/crossmap.cpp
File diff suppressed because it is too large
Load Diff
@ -1,9 +0,0 @@
|
||||
#pragma once
|
||||
#include "gta/natives.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
constexpr auto NATIVE_COUNT = 6568;
|
||||
using crossmap = std::array<std::pair<rage::scrNativeHash, rage::scrNativeHash>, NATIVE_COUNT>;
|
||||
extern const crossmap g_crossmap;
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
#include <rage/rlTaskStatus.hpp>
|
||||
#include <script/scrNativeHandler.hpp>
|
||||
|
||||
class CMsgJoinResponse;
|
||||
class NetworkGameFilterMatchmakingComponent;
|
||||
@ -12,6 +13,9 @@ class GenericPool;
|
||||
class CGetPedSeatReturnClass;
|
||||
enum eVehicleGadgetType : uint32_t;
|
||||
enum class PedBones : uint16_t;
|
||||
class CNetComplaintMgr;
|
||||
class Network;
|
||||
class CNetworkObjectMgr;
|
||||
|
||||
namespace rage
|
||||
{
|
||||
@ -36,6 +40,10 @@ namespace rage
|
||||
class fwEntity;
|
||||
class netGameEvent;
|
||||
class netEventMgr;
|
||||
class fiDevice;
|
||||
class fiPackfile;
|
||||
class scrNativeRegistrationTable;
|
||||
class rlSessionByGamerTaskResult;
|
||||
struct rlScTaskStatus
|
||||
{
|
||||
void* pad = 0;
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "fidevice.hpp"
|
||||
|
||||
#include "hooking.hpp"
|
||||
#include "hooking/hooking.hpp"
|
||||
#include "pointers.hpp"
|
||||
|
||||
namespace rage
|
||||
|
@ -1,119 +0,0 @@
|
||||
#pragma once
|
||||
#include "fwddec.hpp"
|
||||
|
||||
#include <cstdint>
|
||||
#include <script/types.hpp>
|
||||
#include <utility>
|
||||
|
||||
namespace rage
|
||||
{
|
||||
class scrNativeCallContext
|
||||
{
|
||||
public:
|
||||
constexpr void reset()
|
||||
{
|
||||
m_arg_count = 0;
|
||||
m_data_count = 0;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
constexpr void push_arg(T&& value)
|
||||
{
|
||||
static_assert(sizeof(T) <= sizeof(uint64_t));
|
||||
*reinterpret_cast<std::remove_cv_t<std::remove_reference_t<T>>*>(reinterpret_cast<uint64_t*>(m_args) + (m_arg_count++)) = std::forward<T>(value);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
constexpr T& get_arg(std::size_t index)
|
||||
{
|
||||
static_assert(sizeof(T) <= sizeof(uint64_t));
|
||||
return *reinterpret_cast<T*>(reinterpret_cast<uint64_t*>(m_args) + index);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
constexpr void set_arg(std::size_t index, T&& value)
|
||||
{
|
||||
static_assert(sizeof(T) <= sizeof(uint64_t));
|
||||
*reinterpret_cast<std::remove_cv_t<std::remove_reference_t<T>>*>(reinterpret_cast<uint64_t*>(m_args) + index) = std::forward<T>(value);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
constexpr T* get_return_value()
|
||||
{
|
||||
return reinterpret_cast<T*>(m_return_value);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
constexpr void set_return_value(T&& value)
|
||||
{
|
||||
*reinterpret_cast<std::remove_cv_t<std::remove_reference_t<T>>*>(m_return_value) = std::forward<T>(value);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
constexpr void set_return_value(T& value)
|
||||
{
|
||||
*reinterpret_cast<std::remove_cv_t<std::remove_reference_t<T>>*>(m_return_value) = std::forward<T>(value);
|
||||
}
|
||||
|
||||
protected:
|
||||
void* m_return_value;
|
||||
uint32_t m_arg_count;
|
||||
void* m_args;
|
||||
std::int32_t m_data_count;
|
||||
uint32_t m_data[48];
|
||||
};
|
||||
static_assert(sizeof(scrNativeCallContext) == 0xE0);
|
||||
using scrNativeHash = uint64_t;
|
||||
using scrNativeMapping = std::pair<scrNativeHash, scrNativeHash>;
|
||||
using scrNativeHandler = void (*)(scrNativeCallContext*);
|
||||
|
||||
class scrNativeRegistration
|
||||
{
|
||||
public:
|
||||
uint64_t m_nextRegistration1;
|
||||
uint64_t m_nextRegistration2;
|
||||
void* m_handlers[7];
|
||||
uint32_t m_numEntries1;
|
||||
uint32_t m_numEntries2;
|
||||
uint64_t m_hashes;
|
||||
scrNativeRegistration* get_next_registration()
|
||||
{
|
||||
std::uintptr_t result;
|
||||
auto nextReg = uintptr_t(&m_nextRegistration1);
|
||||
auto newReg = nextReg ^ m_nextRegistration2;
|
||||
auto charTableOfRegs = (char*)&result - nextReg;
|
||||
for (auto i = 0; i < 3; i++)
|
||||
{
|
||||
*(DWORD*)&charTableOfRegs[nextReg] = static_cast<DWORD>(newReg) ^ *(DWORD*)nextReg;
|
||||
nextReg += 4;
|
||||
}
|
||||
return reinterpret_cast<scrNativeRegistration*>(result);
|
||||
}
|
||||
uint32_t get_num_entries()
|
||||
{
|
||||
return static_cast<uint32_t>(((std::uintptr_t)&m_numEntries1) ^ m_numEntries1 ^ m_numEntries2);
|
||||
}
|
||||
uint64_t get_hash(uint32_t index)
|
||||
{
|
||||
auto nativeAddress = 16 * index + std::uintptr_t(&m_nextRegistration1) + 0x54;
|
||||
uint64_t result;
|
||||
auto charTableOfRegs = (char*)&result - nativeAddress;
|
||||
auto addressIndex = nativeAddress ^ *(DWORD*)(nativeAddress + 8);
|
||||
for (auto i = 0; i < 3; i++)
|
||||
{
|
||||
*(DWORD*)&charTableOfRegs[nativeAddress] = static_cast<DWORD>(addressIndex ^ *(DWORD*)(nativeAddress));
|
||||
nativeAddress += 4;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
#pragma pack(push, 1)
|
||||
class scrNativeRegistrationTable
|
||||
{
|
||||
scrNativeRegistration* m_entries[0xFF];
|
||||
uint32_t m_unk;
|
||||
bool m_initialized;
|
||||
};
|
||||
#pragma pack(pop)
|
||||
}
|
@ -14,6 +14,7 @@ class CNetGamePlayer;
|
||||
namespace rage
|
||||
{
|
||||
class netArrayHandlerBase;
|
||||
class netPlayer;
|
||||
}
|
||||
|
||||
class CGameArrayMgr
|
||||
|
@ -1,6 +1,5 @@
|
||||
#include "detour_hook.hpp"
|
||||
|
||||
#include "common.hpp"
|
||||
#include "memory/handle.hpp"
|
||||
|
||||
#include <MinHook.h>
|
@ -1,17 +1,6 @@
|
||||
#include "hooking.hpp"
|
||||
#include "hooking/hooking.hpp"
|
||||
|
||||
#include "common.hpp"
|
||||
#include "function_types.hpp"
|
||||
#include "gta/script_thread.hpp"
|
||||
#include "gui.hpp"
|
||||
#include "memory/module.hpp"
|
||||
#include "natives.hpp"
|
||||
#include "pointers.hpp"
|
||||
#include "renderer.hpp"
|
||||
#include "script_mgr.hpp"
|
||||
|
||||
#include <MinHook.h>
|
||||
#include <vehicle/CVehicle.hpp>
|
||||
|
||||
namespace big
|
||||
{
|
||||
@ -211,14 +200,4 @@ namespace big
|
||||
MH_ApplyQueued();
|
||||
}
|
||||
}
|
||||
|
||||
bool hooks::run_script_threads(uint32_t ops_to_execute)
|
||||
{
|
||||
if (g_running)
|
||||
{
|
||||
g_script_mgr.tick();
|
||||
}
|
||||
|
||||
return g_hooking->get_original<run_script_threads>()(ops_to_execute);
|
||||
}
|
||||
}
|
@ -1,16 +1,11 @@
|
||||
#pragma once
|
||||
#include "MinHook.h"
|
||||
#include "call_hook.hpp"
|
||||
#include "common.hpp"
|
||||
|
||||
#include "detour_hook.hpp"
|
||||
#include "gta/enums.hpp"
|
||||
#include "gta/fwddec.hpp"
|
||||
#include "gta/json_serializer.hpp"
|
||||
#include "gta/script_thread.hpp"
|
||||
#include "vmt_hook.hpp"
|
||||
#include "vtable_hook.hpp"
|
||||
|
||||
#include <network/netConnection.hpp>
|
||||
#include <network/netConnection.hpp> // cannot stub this
|
||||
|
||||
class CPlayerGamerDataNode;
|
||||
class CPlayerGameStateDataNode;
|
||||
@ -39,6 +34,12 @@ class CNonPhysicalPlayerData;
|
||||
class TimecycleKeyframeData;
|
||||
class CPedTaskSpecificDataNode;
|
||||
class CPedTaskSequenceDataNode;
|
||||
class Network;
|
||||
class GtaThread;
|
||||
class CNetworkPlayerMgr;
|
||||
class CNetworkObjectMgr;
|
||||
|
||||
enum class eAckCode : uint32_t;
|
||||
|
||||
namespace rage
|
||||
{
|
||||
@ -52,6 +53,9 @@ namespace rage
|
||||
class datBitBuffer;
|
||||
class rlMetric;
|
||||
class rlTaskStatus;
|
||||
class netEventMgr;
|
||||
class json_serializer;
|
||||
class netGameEvent;
|
||||
}
|
||||
|
||||
namespace big
|
||||
@ -183,8 +187,6 @@ namespace big
|
||||
static bool sync_reader_serialize_vec3(void* _this, rage::fvector3* vec, float divisor, int size);
|
||||
static bool sync_reader_serialize_vec3_signed(void* _this, rage::fvector3* vec, float divisor, int size);
|
||||
static bool sync_reader_serialize_array(void* _this, void* array, int size);
|
||||
|
||||
static bool remove_player_from_sender_list(void* list, uint64_t rockstar_id);
|
||||
};
|
||||
|
||||
class minhook_keepalive
|
@ -1,40 +1,40 @@
|
||||
#include "vmt_hook.hpp"
|
||||
|
||||
#include "common.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
vmt_hook::vmt_hook(void* obj, std::size_t num_funcs) :
|
||||
m_object(static_cast<void***>(obj)),
|
||||
m_num_funcs(num_funcs),
|
||||
m_original_table(*m_object),
|
||||
m_new_table(std::make_unique<void*[]>(m_num_funcs))
|
||||
{
|
||||
std::copy_n(m_original_table, m_num_funcs, m_new_table.get());
|
||||
}
|
||||
|
||||
vmt_hook::~vmt_hook()
|
||||
{
|
||||
disable();
|
||||
}
|
||||
|
||||
void vmt_hook::hook(std::size_t index, void* func)
|
||||
{
|
||||
m_new_table[index] = func;
|
||||
}
|
||||
|
||||
void vmt_hook::unhook(std::size_t index)
|
||||
{
|
||||
m_new_table[index] = m_original_table[index];
|
||||
}
|
||||
|
||||
void vmt_hook::enable()
|
||||
{
|
||||
*m_object = m_new_table.get();
|
||||
}
|
||||
|
||||
void vmt_hook::disable()
|
||||
{
|
||||
*m_object = m_original_table;
|
||||
}
|
||||
}
|
||||
#include "vmt_hook.hpp"
|
||||
|
||||
#include "common.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
vmt_hook::vmt_hook(void* obj, std::size_t num_funcs) :
|
||||
m_object(static_cast<void***>(obj)),
|
||||
m_num_funcs(num_funcs),
|
||||
m_original_table(*m_object),
|
||||
m_new_table(std::make_unique<void*[]>(m_num_funcs))
|
||||
{
|
||||
std::copy_n(m_original_table, m_num_funcs, m_new_table.get());
|
||||
}
|
||||
|
||||
vmt_hook::~vmt_hook()
|
||||
{
|
||||
disable();
|
||||
}
|
||||
|
||||
void vmt_hook::hook(std::size_t index, void* func)
|
||||
{
|
||||
m_new_table[index] = func;
|
||||
}
|
||||
|
||||
void vmt_hook::unhook(std::size_t index)
|
||||
{
|
||||
m_new_table[index] = m_original_table[index];
|
||||
}
|
||||
|
||||
void vmt_hook::enable()
|
||||
{
|
||||
*m_object = m_new_table.get();
|
||||
}
|
||||
|
||||
void vmt_hook::disable()
|
||||
{
|
||||
*m_object = m_original_table;
|
||||
}
|
||||
}
|
@ -1,39 +1,38 @@
|
||||
#pragma once
|
||||
#include "common.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
class vmt_hook
|
||||
{
|
||||
public:
|
||||
explicit vmt_hook(void* obj, std::size_t num_funcs);
|
||||
~vmt_hook();
|
||||
|
||||
vmt_hook(vmt_hook&& that) = delete;
|
||||
vmt_hook& operator=(vmt_hook&& that) = delete;
|
||||
vmt_hook(vmt_hook const&) = delete;
|
||||
vmt_hook& operator=(vmt_hook const&) = delete;
|
||||
|
||||
void hook(std::size_t index, void* func);
|
||||
void unhook(std::size_t index);
|
||||
|
||||
template<typename T>
|
||||
T get_original(std::size_t index);
|
||||
|
||||
void enable();
|
||||
void disable();
|
||||
|
||||
private:
|
||||
void*** m_object;
|
||||
std::size_t m_num_funcs;
|
||||
|
||||
void** m_original_table;
|
||||
std::unique_ptr<void*[]> m_new_table;
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
inline T vmt_hook::get_original(std::size_t index)
|
||||
{
|
||||
return static_cast<T>(m_original_table[index]);
|
||||
}
|
||||
}
|
||||
#pragma once
|
||||
|
||||
namespace big
|
||||
{
|
||||
class vmt_hook
|
||||
{
|
||||
public:
|
||||
explicit vmt_hook(void* obj, std::size_t num_funcs);
|
||||
~vmt_hook();
|
||||
|
||||
vmt_hook(vmt_hook&& that) = delete;
|
||||
vmt_hook& operator=(vmt_hook&& that) = delete;
|
||||
vmt_hook(vmt_hook const&) = delete;
|
||||
vmt_hook& operator=(vmt_hook const&) = delete;
|
||||
|
||||
void hook(std::size_t index, void* func);
|
||||
void unhook(std::size_t index);
|
||||
|
||||
template<typename T>
|
||||
T get_original(std::size_t index);
|
||||
|
||||
void enable();
|
||||
void disable();
|
||||
|
||||
private:
|
||||
void*** m_object;
|
||||
std::size_t m_num_funcs;
|
||||
|
||||
void** m_original_table;
|
||||
std::unique_ptr<void*[]> m_new_table;
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
inline T vmt_hook::get_original(std::size_t index)
|
||||
{
|
||||
return static_cast<T>(m_original_table[index]);
|
||||
}
|
||||
}
|
@ -1,5 +1,4 @@
|
||||
#pragma once
|
||||
#include "common.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
@ -1,4 +1,4 @@
|
||||
#include "hooking.hpp"
|
||||
#include "hooking/hooking.hpp"
|
||||
#include "natives.hpp"
|
||||
#include "util/fuzzer.hpp"
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "hooking.hpp"
|
||||
#include "hooking/hooking.hpp"
|
||||
#include "util/fuzzer.hpp"
|
||||
|
||||
namespace big
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "hooking.hpp"
|
||||
#include "hooking/hooking.hpp"
|
||||
#include "renderer.hpp"
|
||||
#include "script.hpp"
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "hooking.hpp"
|
||||
#include "hooking/hooking.hpp"
|
||||
#include "renderer.hpp"
|
||||
#include "script.hpp"
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "hooking.hpp"
|
||||
#include "hooking/hooking.hpp"
|
||||
#include "renderer.hpp"
|
||||
#include "script.hpp"
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
#include "gta/net_game_event.hpp"
|
||||
#include "hooking.hpp"
|
||||
#include "hooking/hooking.hpp"
|
||||
#include "services/players/player_service.hpp"
|
||||
#include "util/globals.hpp"
|
||||
#include "util/misc.hpp"
|
||||
|
@ -1,5 +1,6 @@
|
||||
#include "hooking.hpp"
|
||||
#include "hooking/hooking.hpp"
|
||||
#include "rage/rlMetric.hpp"
|
||||
#include "gta/json_serializer.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
|
@ -1,13 +1,13 @@
|
||||
#include "hooking.hpp"
|
||||
#include "services/custom_text/custom_text_service.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
const char* hooks::get_label_text(void* unk, const char* label)
|
||||
{
|
||||
if (const auto text = g_custom_text_service->get_text(label); text)
|
||||
return text;
|
||||
|
||||
return g_hooking->get_original<get_label_text>()(unk, label);
|
||||
}
|
||||
}
|
||||
#include "hooking/hooking.hpp"
|
||||
#include "services/custom_text/custom_text_service.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
const char* hooks::get_label_text(void* unk, const char* label)
|
||||
{
|
||||
if (const auto text = g_custom_text_service->get_text(label); text)
|
||||
return text;
|
||||
|
||||
return g_hooking->get_original<get_label_text>()(unk, label);
|
||||
}
|
||||
}
|
||||
|
@ -1,38 +1,38 @@
|
||||
#include "hooking.hpp"
|
||||
#include "util/model_info.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
static auto get_hash(const std::string& str)
|
||||
{
|
||||
rage::joaat_t hash = 0;
|
||||
if (str.substr(0, 2) == "0x")
|
||||
std::stringstream(str.substr(2)) >> std::hex >> hash;
|
||||
else
|
||||
hash = rage::joaat(str.c_str());
|
||||
return hash;
|
||||
}
|
||||
|
||||
static std::vector<std::pair<rage::joaat_t, rage::joaat_t>> cache_models;
|
||||
|
||||
static void update()
|
||||
{
|
||||
std::lock_guard lock(g.world.model_swapper.m);
|
||||
cache_models.clear();
|
||||
for (size_t i = 0; i < g.world.model_swapper.models.size(); i++)
|
||||
cache_models.push_back(
|
||||
std::make_pair(get_hash(g.world.model_swapper.models[i].first), get_hash(g.world.model_swapper.models[i].second)));
|
||||
g.world.model_swapper.update = false;
|
||||
}
|
||||
|
||||
CBaseModelInfo* hooks::get_model_info(rage::joaat_t hash, uint32_t* a2)
|
||||
{
|
||||
static bool init = ([] { update(); }(), true);
|
||||
if (g.world.model_swapper.update)
|
||||
update();
|
||||
for (size_t i = 0; i < cache_models.size(); i++)
|
||||
if (cache_models[i].first == hash)
|
||||
return g_hooking->get_original<get_model_info>()(cache_models[i].second, a2);
|
||||
return g_hooking->get_original<get_model_info>()(hash, a2);
|
||||
}
|
||||
}
|
||||
#include "hooking/hooking.hpp"
|
||||
#include "util/model_info.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
static auto get_hash(const std::string& str)
|
||||
{
|
||||
rage::joaat_t hash = 0;
|
||||
if (str.substr(0, 2) == "0x")
|
||||
std::stringstream(str.substr(2)) >> std::hex >> hash;
|
||||
else
|
||||
hash = rage::joaat(str.c_str());
|
||||
return hash;
|
||||
}
|
||||
|
||||
static std::vector<std::pair<rage::joaat_t, rage::joaat_t>> cache_models;
|
||||
|
||||
static void update()
|
||||
{
|
||||
std::lock_guard lock(g.world.model_swapper.m);
|
||||
cache_models.clear();
|
||||
for (size_t i = 0; i < g.world.model_swapper.models.size(); i++)
|
||||
cache_models.push_back(
|
||||
std::make_pair(get_hash(g.world.model_swapper.models[i].first), get_hash(g.world.model_swapper.models[i].second)));
|
||||
g.world.model_swapper.update = false;
|
||||
}
|
||||
|
||||
CBaseModelInfo* hooks::get_model_info(rage::joaat_t hash, uint32_t* a2)
|
||||
{
|
||||
static bool init = ([] { update(); }(), true);
|
||||
if (g.world.model_swapper.update)
|
||||
update();
|
||||
for (size_t i = 0; i < cache_models.size(); i++)
|
||||
if (cache_models[i].first == hash)
|
||||
return g_hooking->get_original<get_model_info>()(cache_models[i].second, a2);
|
||||
return g_hooking->get_original<get_model_info>()(hash, a2);
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "hooking.hpp"
|
||||
#include "hooking/hooking.hpp"
|
||||
#include "logger/stack_trace.hpp"
|
||||
#include "pointers.hpp"
|
||||
#include "util/string_conversions.hpp"
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "hooking.hpp"
|
||||
#include "hooking/hooking.hpp"
|
||||
#include "logger/stack_trace.hpp"
|
||||
#include "pointers.hpp"
|
||||
#include "util/string_conversions.hpp"
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "hooking.hpp"
|
||||
#include "hooking/hooking.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
|
@ -1,10 +1,10 @@
|
||||
#include "hooking.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
int hooks::nt_query_virtual_memory(void* _this, HANDLE handle, PVOID base_addr, int info_class, MEMORY_BASIC_INFORMATION* info, int size, size_t* return_len)
|
||||
{
|
||||
// LOG(INFO) << "Reached here, base addr: " << base_addr;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
#include "hooking/hooking.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
int hooks::nt_query_virtual_memory(void* _this, HANDLE handle, PVOID base_addr, int info_class, MEMORY_BASIC_INFORMATION* info, int size, size_t* return_len)
|
||||
{
|
||||
// LOG(INFO) << "Reached here, base addr: " << base_addr;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -1,76 +1,76 @@
|
||||
#include "hooking.hpp"
|
||||
#include "services/matchmaking/matchmaking_service.hpp"
|
||||
|
||||
namespace rage
|
||||
{
|
||||
class JSONNode
|
||||
{
|
||||
public:
|
||||
char* m_key; //0x0000
|
||||
char pad_0008[32]; //0x0008
|
||||
class rage::JSONNode* m_sibling;//0x0028
|
||||
class rage::JSONNode* m_child; //0x0030
|
||||
char* m_value; //0x0038
|
||||
char pad_0040[8]; //0x0040
|
||||
|
||||
inline JSONNode* get_child_node(const char* name)
|
||||
{
|
||||
for (auto node = m_child; node; node = node->m_sibling)
|
||||
{
|
||||
if (strcmp(name, node->m_key) == 0)
|
||||
return node;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
};//Size: 0x0048
|
||||
static_assert(sizeof(rage::JSONNode) == 0x48);
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
// https://stackoverflow.com/a/5167641
|
||||
static std::vector<std::string> split(const std::string& s, char seperator)
|
||||
{
|
||||
std::vector<std::string> output;
|
||||
|
||||
std::string::size_type prev_pos = 0, pos = 0;
|
||||
|
||||
while ((pos = s.find(seperator, pos)) != std::string::npos)
|
||||
{
|
||||
std::string substring(s.substr(prev_pos, pos - prev_pos));
|
||||
|
||||
output.push_back(substring);
|
||||
|
||||
prev_pos = ++pos;
|
||||
}
|
||||
|
||||
output.push_back(s.substr(prev_pos, pos - prev_pos));// Last word
|
||||
|
||||
return output;
|
||||
}
|
||||
}
|
||||
|
||||
namespace big
|
||||
{
|
||||
bool hooks::process_matchmaking_find_response(void* _this, void* unused, rage::JSONNode* node, int* unk)
|
||||
{
|
||||
bool ret = g_hooking->get_original<hooks::process_matchmaking_find_response>()(_this, unused, node, unk);
|
||||
|
||||
if (g_matchmaking_service->is_active())
|
||||
{
|
||||
int i = 0;
|
||||
for (auto result = node->get_child_node("Results")->m_child; result; result = result->m_sibling)
|
||||
{
|
||||
const auto& values = split(result->get_child_node("Attributes")->m_value, ',');
|
||||
g_matchmaking_service->get_found_sessions()[i].attributes.discriminator = std::stoi(values[2]);
|
||||
g_matchmaking_service->get_found_sessions()[i].attributes.player_count = std::stoi(values[4]);
|
||||
g_matchmaking_service->get_found_sessions()[i].attributes.language = std::stoi(values[5]);
|
||||
g_matchmaking_service->get_found_sessions()[i].attributes.region = std::stoi(values[6]);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
#include "hooking/hooking.hpp"
|
||||
#include "services/matchmaking/matchmaking_service.hpp"
|
||||
|
||||
namespace rage
|
||||
{
|
||||
class JSONNode
|
||||
{
|
||||
public:
|
||||
char* m_key; //0x0000
|
||||
char pad_0008[32]; //0x0008
|
||||
class rage::JSONNode* m_sibling;//0x0028
|
||||
class rage::JSONNode* m_child; //0x0030
|
||||
char* m_value; //0x0038
|
||||
char pad_0040[8]; //0x0040
|
||||
|
||||
inline JSONNode* get_child_node(const char* name)
|
||||
{
|
||||
for (auto node = m_child; node; node = node->m_sibling)
|
||||
{
|
||||
if (strcmp(name, node->m_key) == 0)
|
||||
return node;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
};//Size: 0x0048
|
||||
static_assert(sizeof(rage::JSONNode) == 0x48);
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
// https://stackoverflow.com/a/5167641
|
||||
static std::vector<std::string> split(const std::string& s, char seperator)
|
||||
{
|
||||
std::vector<std::string> output;
|
||||
|
||||
std::string::size_type prev_pos = 0, pos = 0;
|
||||
|
||||
while ((pos = s.find(seperator, pos)) != std::string::npos)
|
||||
{
|
||||
std::string substring(s.substr(prev_pos, pos - prev_pos));
|
||||
|
||||
output.push_back(substring);
|
||||
|
||||
prev_pos = ++pos;
|
||||
}
|
||||
|
||||
output.push_back(s.substr(prev_pos, pos - prev_pos));// Last word
|
||||
|
||||
return output;
|
||||
}
|
||||
}
|
||||
|
||||
namespace big
|
||||
{
|
||||
bool hooks::process_matchmaking_find_response(void* _this, void* unused, rage::JSONNode* node, int* unk)
|
||||
{
|
||||
bool ret = g_hooking->get_original<hooks::process_matchmaking_find_response>()(_this, unused, node, unk);
|
||||
|
||||
if (g_matchmaking_service->is_active())
|
||||
{
|
||||
int i = 0;
|
||||
for (auto result = node->get_child_node("Results")->m_child; result; result = result->m_sibling)
|
||||
{
|
||||
const auto& values = split(result->get_child_node("Attributes")->m_value, ',');
|
||||
g_matchmaking_service->get_found_sessions()[i].attributes.discriminator = std::stoi(values[2]);
|
||||
g_matchmaking_service->get_found_sessions()[i].attributes.player_count = std::stoi(values[4]);
|
||||
g_matchmaking_service->get_found_sessions()[i].attributes.language = std::stoi(values[5]);
|
||||
g_matchmaking_service->get_found_sessions()[i].attributes.region = std::stoi(values[6]);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
#include "hooking.hpp"
|
||||
#include "hooking/hooking.hpp"
|
||||
#include "pointers.hpp"
|
||||
#include "security/ObfVar.hpp"
|
||||
#include <Psapi.h>
|
||||
|
@ -2,7 +2,7 @@
|
||||
#include "backend/context/chat_command_context.hpp"
|
||||
#include "gta/net_game_event.hpp"
|
||||
#include "gta_util.hpp"
|
||||
#include "hooking.hpp"
|
||||
#include "hooking/hooking.hpp"
|
||||
#include "packet.hpp"
|
||||
#include "services/players/player_service.hpp"
|
||||
#include "util/spam.hpp"
|
||||
|
@ -1,17 +1,17 @@
|
||||
#include "gta_util.hpp"
|
||||
#include "hooking.hpp"
|
||||
|
||||
#include <network/Network.hpp>
|
||||
#include <network/RemoteGamerInfoMsg.hpp>
|
||||
|
||||
namespace big
|
||||
{
|
||||
bool hooks::serialize_join_request_message(RemoteGamerInfoMsg* info, void* data, int size, int* bits_serialized)
|
||||
{
|
||||
if (info->unk_0xC0 == 0)
|
||||
info->unk_0xC0 = 1;
|
||||
|
||||
info->m_num_handles = 0;
|
||||
return g_hooking->get_original<hooks::serialize_join_request_message>()(info, data, size, bits_serialized);
|
||||
}
|
||||
#include "gta_util.hpp"
|
||||
#include "hooking/hooking.hpp"
|
||||
|
||||
#include <network/Network.hpp>
|
||||
#include <network/RemoteGamerInfoMsg.hpp>
|
||||
|
||||
namespace big
|
||||
{
|
||||
bool hooks::serialize_join_request_message(RemoteGamerInfoMsg* info, void* data, int size, int* bits_serialized)
|
||||
{
|
||||
if (info->unk_0xC0 == 0)
|
||||
info->unk_0xC0 = 1;
|
||||
|
||||
info->m_num_handles = 0;
|
||||
return g_hooking->get_original<hooks::serialize_join_request_message>()(info, data, size, bits_serialized);
|
||||
}
|
||||
}
|
@ -1,20 +1,20 @@
|
||||
#include "gta_util.hpp"
|
||||
#include "hooking.hpp"
|
||||
|
||||
#include <network/CNetGamePlayerDataMsg.hpp>
|
||||
#include <network/Network.hpp>
|
||||
|
||||
namespace big
|
||||
{
|
||||
bool hooks::serialize_player_data_msg(CNetGamePlayerDataMsg* msg, rage::datBitBuffer* buffer)
|
||||
{
|
||||
int old_group = msg->m_matchmaking_group;
|
||||
|
||||
if (g.session.join_in_sctv_slots)
|
||||
msg->m_matchmaking_group = 4;
|
||||
|
||||
bool ret = g_hooking->get_original<hooks::serialize_player_data_msg>()(msg, buffer);
|
||||
msg->m_matchmaking_group = old_group;
|
||||
return ret;
|
||||
}
|
||||
#include "gta_util.hpp"
|
||||
#include "hooking/hooking.hpp"
|
||||
|
||||
#include <network/CNetGamePlayerDataMsg.hpp>
|
||||
#include <network/Network.hpp>
|
||||
|
||||
namespace big
|
||||
{
|
||||
bool hooks::serialize_player_data_msg(CNetGamePlayerDataMsg* msg, rage::datBitBuffer* buffer)
|
||||
{
|
||||
int old_group = msg->m_matchmaking_group;
|
||||
|
||||
if (g.session.join_in_sctv_slots)
|
||||
msg->m_matchmaking_group = 4;
|
||||
|
||||
bool ret = g_hooking->get_original<hooks::serialize_player_data_msg>()(msg, buffer);
|
||||
msg->m_matchmaking_group = old_group;
|
||||
return ret;
|
||||
}
|
||||
}
|
@ -1,21 +1,21 @@
|
||||
#include "hooking.hpp"
|
||||
|
||||
#include <network/Network.hpp>
|
||||
|
||||
namespace big
|
||||
{
|
||||
// true => e1 > e2
|
||||
// false => e1 < e2
|
||||
bool hooks::sort_session_details(SessionSortEntry* e1, SessionSortEntry* e2)
|
||||
{
|
||||
if (g.session.player_magnet_enabled)
|
||||
{
|
||||
return std::abs((int)e1->m_session_detail->m_player_count - g.session.player_magnet_count)
|
||||
< std::abs((int)e2->m_session_detail->m_player_count - g.session.player_magnet_count);
|
||||
}
|
||||
else
|
||||
{
|
||||
return g_hooking->get_original<hooks::sort_session_details>()(e1, e2);
|
||||
}
|
||||
}
|
||||
#include "hooking/hooking.hpp"
|
||||
|
||||
#include <network/Network.hpp>
|
||||
|
||||
namespace big
|
||||
{
|
||||
// true => e1 > e2
|
||||
// false => e1 < e2
|
||||
bool hooks::sort_session_details(SessionSortEntry* e1, SessionSortEntry* e2)
|
||||
{
|
||||
if (g.session.player_magnet_enabled)
|
||||
{
|
||||
return std::abs((int)e1->m_session_detail->m_player_count - g.session.player_magnet_count)
|
||||
< std::abs((int)e2->m_session_detail->m_player_count - g.session.player_magnet_count);
|
||||
}
|
||||
else
|
||||
{
|
||||
return g_hooking->get_original<hooks::sort_session_details>()(e1, e2);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,53 +1,53 @@
|
||||
#include "fiber_pool.hpp"
|
||||
#include "function_types.hpp"
|
||||
#include "hooking.hpp"
|
||||
#include "services/matchmaking/matchmaking_service.hpp"
|
||||
|
||||
#include <network/Network.hpp>
|
||||
|
||||
namespace big
|
||||
{
|
||||
bool hooks::start_matchmaking_find_sessions(int profile_index, int available_slots, NetworkGameFilterMatchmakingComponent* filter, unsigned int max_sessions, rage::rlSessionInfo* results, int* num_sessions_found, rage::rlTaskStatus* status)
|
||||
{
|
||||
int discriminator = filter->m_param_values[0];// this is guaranteed to work
|
||||
|
||||
if (g.session_browser.replace_game_matchmaking && filter->m_filter_type == 1)
|
||||
{
|
||||
status->status = 1;
|
||||
g_fiber_pool->queue_job([max_sessions, results, num_sessions_found, status, discriminator] {
|
||||
bool result = false;
|
||||
|
||||
if (g.session.join_in_sctv_slots)
|
||||
result = g_matchmaking_service->matchmake();
|
||||
else
|
||||
result = g_matchmaking_service->matchmake(discriminator);
|
||||
|
||||
if (result)
|
||||
{
|
||||
for (int i = 0; i < g_matchmaking_service->get_num_found_sessions(); i++)
|
||||
{
|
||||
if (g_matchmaking_service->get_found_sessions()[i].is_valid)
|
||||
{
|
||||
results[*num_sessions_found] = g_matchmaking_service->get_found_sessions()[i].info;
|
||||
(*num_sessions_found)++;
|
||||
|
||||
if (max_sessions <= *num_sessions_found)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
status->status = 3;
|
||||
}
|
||||
else
|
||||
{
|
||||
status->status = 2;
|
||||
}
|
||||
});
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return g_hooking->get_original<hooks::start_matchmaking_find_sessions>()(profile_index, available_slots, filter, max_sessions, results, num_sessions_found, status);
|
||||
}
|
||||
}
|
||||
#include "fiber_pool.hpp"
|
||||
#include "function_types.hpp"
|
||||
#include "hooking/hooking.hpp"
|
||||
#include "services/matchmaking/matchmaking_service.hpp"
|
||||
|
||||
#include <network/Network.hpp>
|
||||
|
||||
namespace big
|
||||
{
|
||||
bool hooks::start_matchmaking_find_sessions(int profile_index, int available_slots, NetworkGameFilterMatchmakingComponent* filter, unsigned int max_sessions, rage::rlSessionInfo* results, int* num_sessions_found, rage::rlTaskStatus* status)
|
||||
{
|
||||
int discriminator = filter->m_param_values[0];// this is guaranteed to work
|
||||
|
||||
if (g.session_browser.replace_game_matchmaking && filter->m_filter_type == 1)
|
||||
{
|
||||
status->status = 1;
|
||||
g_fiber_pool->queue_job([max_sessions, results, num_sessions_found, status, discriminator] {
|
||||
bool result = false;
|
||||
|
||||
if (g.session.join_in_sctv_slots)
|
||||
result = g_matchmaking_service->matchmake();
|
||||
else
|
||||
result = g_matchmaking_service->matchmake(discriminator);
|
||||
|
||||
if (result)
|
||||
{
|
||||
for (int i = 0; i < g_matchmaking_service->get_num_found_sessions(); i++)
|
||||
{
|
||||
if (g_matchmaking_service->get_found_sessions()[i].is_valid)
|
||||
{
|
||||
results[*num_sessions_found] = g_matchmaking_service->get_found_sessions()[i].info;
|
||||
(*num_sessions_found)++;
|
||||
|
||||
if (max_sessions <= *num_sessions_found)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
status->status = 3;
|
||||
}
|
||||
else
|
||||
{
|
||||
status->status = 2;
|
||||
}
|
||||
});
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return g_hooking->get_original<hooks::start_matchmaking_find_sessions>()(profile_index, available_slots, filter, max_sessions, results, num_sessions_found, status);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
#include "hooking.hpp"
|
||||
#include "hooking/hooking.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "hooking.hpp"
|
||||
#include "hooking/hooking.hpp"
|
||||
|
||||
#include <misc/vfx/TimecycleKeyframeData.hpp>
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
#include "core/data/admin_rids.hpp"
|
||||
#include "fiber_pool.hpp"
|
||||
#include "gta_util.hpp"
|
||||
#include "hooking.hpp"
|
||||
#include "hooking/hooking.hpp"
|
||||
#include "lua/lua_manager.hpp"
|
||||
#include "packet.hpp"
|
||||
#include "services/player_database/player_database_service.hpp"
|
||||
|
@ -1,5 +1,5 @@
|
||||
#include "core/data/menu_event.hpp"
|
||||
#include "hooking.hpp"
|
||||
#include "hooking/hooking.hpp"
|
||||
#include "lua/lua_manager.hpp"
|
||||
#include "pointers.hpp"
|
||||
#include "services/players/player_service.hpp"
|
||||
|
@ -1,5 +1,5 @@
|
||||
#include "gta/net_game_event.hpp"
|
||||
#include "hooking.hpp"
|
||||
#include "hooking/hooking.hpp"
|
||||
#include "pointers.hpp"
|
||||
|
||||
#include <rage/sysMemAllocator.hpp>
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include "core/data/task_types.hpp"
|
||||
#include "entities/fwEntity.hpp"
|
||||
#include "gta/net_object_mgr.hpp"
|
||||
#include "hooking.hpp"
|
||||
#include "hooking/hooking.hpp"
|
||||
#include "netsync/netSyncDataNode.hpp"
|
||||
#include "netsync/netSyncTree.hpp"
|
||||
#include "netsync/nodes/automobile/CAutomobileCreationNode.hpp"
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "hooking.hpp"
|
||||
#include "hooking/hooking.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "hooking.hpp"
|
||||
#include "hooking/hooking.hpp"
|
||||
#include "pointers.hpp"
|
||||
#include "services/player_database/player_database_service.hpp"
|
||||
|
||||
|
@ -1,29 +1,29 @@
|
||||
#include "gta/net_game_event.hpp"
|
||||
#include "hooking.hpp"
|
||||
#include "services/players/player_service.hpp"
|
||||
|
||||
#include <network/CNetGamePlayer.hpp>
|
||||
|
||||
namespace big
|
||||
{
|
||||
bool hooks::increment_stat_event(CNetworkIncrementStatEvent* net_event, CNetGamePlayer* sender)
|
||||
{
|
||||
switch (net_event->m_stat)
|
||||
{
|
||||
case RAGE_JOAAT("MPPLY_BAD_CREW_STATUS"):
|
||||
case RAGE_JOAAT("MPPLY_BAD_CREW_MOTTO"):
|
||||
case RAGE_JOAAT("MPPLY_BAD_CREW_NAME"):
|
||||
case RAGE_JOAAT("MPPLY_BAD_CREW_EMBLEM"):
|
||||
case RAGE_JOAAT("MPPLY_EXPLOITS"):
|
||||
case RAGE_JOAAT("MPPLY_GAME_EXPLOITS"):
|
||||
case RAGE_JOAAT("MPPLY_TC_ANNOYINGME"):
|
||||
case RAGE_JOAAT("MPPLY_TC_HATE"):
|
||||
case RAGE_JOAAT("MPPLY_VC_ANNOYINGME"):
|
||||
case RAGE_JOAAT("MPPLY_VC_HATE"):
|
||||
g.reactions.report.process(g_player_service->get_by_id(sender->m_player_id));
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
#include "gta/net_game_event.hpp"
|
||||
#include "hooking/hooking.hpp"
|
||||
#include "services/players/player_service.hpp"
|
||||
|
||||
#include <network/CNetGamePlayer.hpp>
|
||||
|
||||
namespace big
|
||||
{
|
||||
bool hooks::increment_stat_event(CNetworkIncrementStatEvent* net_event, CNetGamePlayer* sender)
|
||||
{
|
||||
switch (net_event->m_stat)
|
||||
{
|
||||
case RAGE_JOAAT("MPPLY_BAD_CREW_STATUS"):
|
||||
case RAGE_JOAAT("MPPLY_BAD_CREW_MOTTO"):
|
||||
case RAGE_JOAAT("MPPLY_BAD_CREW_NAME"):
|
||||
case RAGE_JOAAT("MPPLY_BAD_CREW_EMBLEM"):
|
||||
case RAGE_JOAAT("MPPLY_EXPLOITS"):
|
||||
case RAGE_JOAAT("MPPLY_GAME_EXPLOITS"):
|
||||
case RAGE_JOAAT("MPPLY_TC_ANNOYINGME"):
|
||||
case RAGE_JOAAT("MPPLY_TC_HATE"):
|
||||
case RAGE_JOAAT("MPPLY_VC_ANNOYINGME"):
|
||||
case RAGE_JOAAT("MPPLY_VC_HATE"):
|
||||
g.reactions.report.process(g_player_service->get_by_id(sender->m_player_id));
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
#include "hooking.hpp"
|
||||
#include "hooking/hooking.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
|
@ -1,11 +1,11 @@
|
||||
#include "hooking.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
void hooks::invalid_mods_crash_detour(int64_t a1, int64_t a2, int a3, char a4)
|
||||
{
|
||||
if (!*(int64_t*)(a1 + 0xD8))
|
||||
return;
|
||||
g_hooking->get_original<hooks::invalid_mods_crash_detour>()(a1, a2, a3, a4);
|
||||
}
|
||||
#include "hooking/hooking.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
void hooks::invalid_mods_crash_detour(int64_t a1, int64_t a2, int a3, char a4)
|
||||
{
|
||||
if (!*(int64_t*)(a1 + 0xD8))
|
||||
return;
|
||||
g_hooking->get_original<hooks::invalid_mods_crash_detour>()(a1, a2, a3, a4);
|
||||
}
|
||||
}
|
@ -4,13 +4,14 @@
|
||||
#include "core/data/packet_types.hpp"
|
||||
#include "gta/net_game_event.hpp"
|
||||
#include "gta_util.hpp"
|
||||
#include "hooking.hpp"
|
||||
#include "hooking/hooking.hpp"
|
||||
#include "lua/lua_manager.hpp"
|
||||
#include "natives.hpp"
|
||||
#include "script/scriptIdBase.hpp"
|
||||
#include "services/players/player_service.hpp"
|
||||
#include "util/session.hpp"
|
||||
#include "util/spam.hpp"
|
||||
#include "gta/enums.hpp"
|
||||
|
||||
#include <network/Network.hpp>
|
||||
#include <network/netTime.hpp>
|
||||
|
@ -1,15 +1,15 @@
|
||||
#include "hooking.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
bool hooks::receive_pickup(rage::netObject* object, void* unk, CPed* ped)
|
||||
{
|
||||
if (g.protections.receive_pickup)
|
||||
{
|
||||
g_notification_service->push_error("PROTECTIONS"_T.data(), "Blocked pickup");
|
||||
return false;
|
||||
}
|
||||
|
||||
return g_hooking->get_original<hooks::receive_pickup>()(object, unk, ped);
|
||||
}
|
||||
#include "hooking/hooking.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
bool hooks::receive_pickup(rage::netObject* object, void* unk, CPed* ped)
|
||||
{
|
||||
if (g.protections.receive_pickup)
|
||||
{
|
||||
g_notification_service->push_error("PROTECTIONS"_T.data(), "Blocked pickup");
|
||||
return false;
|
||||
}
|
||||
|
||||
return g_hooking->get_original<hooks::receive_pickup>()(object, unk, ped);
|
||||
}
|
||||
}
|
@ -2,7 +2,7 @@
|
||||
#include "gta/net_array.hpp"
|
||||
#include "gta/script_handler.hpp"
|
||||
#include "gta_util.hpp"
|
||||
#include "hooking.hpp"
|
||||
#include "hooking/hooking.hpp"
|
||||
#include "script_local.hpp"
|
||||
#include "services/players/player_service.hpp"
|
||||
#include "util/misc.hpp"
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "hooking.hpp"
|
||||
#include "hooking/hooking.hpp"
|
||||
#include "services/players/player_service.hpp"
|
||||
#include "util/notify.hpp"
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "hooking.hpp"
|
||||
#include "hooking/hooking.hpp"
|
||||
#include "services/players/player_service.hpp"
|
||||
#include "util/notify.hpp"
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include "fiber_pool.hpp"
|
||||
#include "gta/enums.hpp"
|
||||
#include "gta/net_game_event.hpp"
|
||||
#include "hooking.hpp"
|
||||
#include "hooking/hooking.hpp"
|
||||
#include "script/scriptIdBase.hpp"
|
||||
#include "util/math.hpp"
|
||||
#include "util/mobile.hpp"
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "hooking.hpp"
|
||||
#include "hooking/hooking.hpp"
|
||||
#include "pointers.hpp"
|
||||
|
||||
namespace big
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "hooking.hpp"
|
||||
#include "hooking/hooking.hpp"
|
||||
#include "pointers.hpp"
|
||||
|
||||
namespace big
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "hooking.hpp"
|
||||
#include "hooking/hooking.hpp"
|
||||
#include "pointers.hpp"
|
||||
|
||||
namespace big
|
||||
|
@ -2,7 +2,7 @@
|
||||
#include "gta/net_game_event.hpp"
|
||||
#include "gta/script_handler.hpp"
|
||||
#include "gta_util.hpp"
|
||||
#include "hooking.hpp"
|
||||
#include "hooking/hooking.hpp"
|
||||
#include "lua/lua_manager.hpp"
|
||||
#include "util/math.hpp"
|
||||
#include "util/session.hpp"
|
||||
@ -70,6 +70,7 @@ namespace big
|
||||
{
|
||||
std::vector<int32_t> script_event_args;
|
||||
|
||||
script_event_args.reserve(scripted_game_event->m_args_size);
|
||||
for (int i = 0; i < scripted_game_event->m_args_size; i++)
|
||||
script_event_args.push_back(args[i]);
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "hooking.hpp"
|
||||
#include "hooking/hooking.hpp"
|
||||
#include "pointers.hpp"
|
||||
#include "services/players/player_service.hpp"
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "hooking.hpp"
|
||||
#include "hooking/hooking.hpp"
|
||||
#include "util/notify.hpp"
|
||||
|
||||
#include <entities/CDynamicEntity.hpp>
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "hooking.hpp"
|
||||
#include "hooking/hooking.hpp"
|
||||
#include "util/notify.hpp"
|
||||
|
||||
#include <netsync/nodes/task/ClonedTakeOffPedVariationInfo.hpp>
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "hooking.hpp"
|
||||
#include "hooking/hooking.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "hooking.hpp"
|
||||
#include "hooking/hooking.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "hooking.hpp"
|
||||
#include "hooking/hooking.hpp"
|
||||
#include "services/player_database/player_database_service.hpp"
|
||||
|
||||
namespace big
|
||||
|
@ -1,31 +1,31 @@
|
||||
#include "hooking.hpp"
|
||||
#include "native_hooks/native_hooks.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
rage::eThreadState hooks::gta_thread_kill(GtaThread* thread)
|
||||
{
|
||||
const auto result = g_hooking->get_original<gta_thread_kill>()(thread);
|
||||
|
||||
if (g.notifications.gta_thread_kill.log)
|
||||
LOG(INFO) << "Script Thread '" << thread->m_name << "' terminated (" << thread->m_exit_message << ").";
|
||||
|
||||
if (g.notifications.gta_thread_kill.notify)
|
||||
g_notification_service->push("Script Thread Termination",
|
||||
std::format("Script Thread '{}' terminated.", thread->m_name));
|
||||
|
||||
if (thread == g.m_hunt_the_beast_thread)
|
||||
g.m_hunt_the_beast_thread = nullptr;
|
||||
|
||||
if (thread == g.m_dance_thread)
|
||||
g.m_dance_thread = nullptr;
|
||||
|
||||
if (thread == g.m_mission_creator_thread)
|
||||
g.m_mission_creator_thread = nullptr;
|
||||
|
||||
if (thread == g.m_modshop_thread)
|
||||
g.m_modshop_thread = nullptr;
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
#include "hooking/hooking.hpp"
|
||||
#include "native_hooks/native_hooks.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
rage::eThreadState hooks::gta_thread_kill(GtaThread* thread)
|
||||
{
|
||||
const auto result = g_hooking->get_original<gta_thread_kill>()(thread);
|
||||
|
||||
if (g.notifications.gta_thread_kill.log)
|
||||
LOG(INFO) << "Script Thread '" << thread->m_name << "' terminated (" << thread->m_exit_message << ").";
|
||||
|
||||
if (g.notifications.gta_thread_kill.notify)
|
||||
g_notification_service->push("Script Thread Termination",
|
||||
std::format("Script Thread '{}' terminated.", thread->m_name));
|
||||
|
||||
if (thread == g.m_hunt_the_beast_thread)
|
||||
g.m_hunt_the_beast_thread = nullptr;
|
||||
|
||||
if (thread == g.m_dance_thread)
|
||||
g.m_dance_thread = nullptr;
|
||||
|
||||
if (thread == g.m_mission_creator_thread)
|
||||
g.m_mission_creator_thread = nullptr;
|
||||
|
||||
if (thread == g.m_modshop_thread)
|
||||
g.m_modshop_thread = nullptr;
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
@ -1,20 +1,20 @@
|
||||
#include "hooking.hpp"
|
||||
#include "native_hooks/native_hooks.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
GtaThread* hooks::gta_thread_start(unsigned int** a1, unsigned int a2)
|
||||
{
|
||||
GtaThread* new_thread = g_hooking->get_original<hooks::gta_thread_start>()(a1, a2);
|
||||
|
||||
if (const char* name = new_thread->m_name; strlen(name) > 0)
|
||||
{
|
||||
if (g.notifications.gta_thread_kill.log)
|
||||
LOG(INFO) << "Script Thread '" << name << "' started.";
|
||||
if (g.notifications.gta_thread_kill.notify)
|
||||
g_notification_service->push("Script Thread Startup", std::format("Script Thread '{}' started.", name));
|
||||
}
|
||||
|
||||
return new_thread;
|
||||
}
|
||||
}
|
||||
#include "hooking/hooking.hpp"
|
||||
#include "native_hooks/native_hooks.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
GtaThread* hooks::gta_thread_start(unsigned int** a1, unsigned int a2)
|
||||
{
|
||||
GtaThread* new_thread = g_hooking->get_original<hooks::gta_thread_start>()(a1, a2);
|
||||
|
||||
if (const char* name = new_thread->m_name; strlen(name) > 0)
|
||||
{
|
||||
if (g.notifications.gta_thread_kill.log)
|
||||
LOG(INFO) << "Script Thread '" << name << "' started.";
|
||||
if (g.notifications.gta_thread_kill.notify)
|
||||
g_notification_service->push("Script Thread Startup", std::format("Script Thread '{}' started.", name));
|
||||
}
|
||||
|
||||
return new_thread;
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "hooking.hpp"
|
||||
#include "hooking/hooking.hpp"
|
||||
#include "native_hooks/native_hooks.hpp"
|
||||
#include "services/script_patcher/script_patcher_service.hpp"
|
||||
|
||||
|
15
src/hooks/script/run_script_threads.cpp
Normal file
15
src/hooks/script/run_script_threads.cpp
Normal file
@ -0,0 +1,15 @@
|
||||
#include "hooking/hooking.hpp"
|
||||
#include "script_mgr.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
bool hooks::run_script_threads(uint32_t ops_to_execute)
|
||||
{
|
||||
if (g_running)
|
||||
{
|
||||
g_script_mgr.tick();
|
||||
}
|
||||
|
||||
return g_hooking->get_original<run_script_threads>()(ops_to_execute);
|
||||
}
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
#include "core/scr_globals.hpp"
|
||||
#include "hooking.hpp"
|
||||
#include "hooking/hooking.hpp"
|
||||
#include "pointers.hpp"
|
||||
#include "services/script_patcher/script_patcher_service.hpp"
|
||||
|
||||
|
@ -1,28 +1,28 @@
|
||||
#include "hooking.hpp"
|
||||
#include "network/Network.hpp"
|
||||
|
||||
#include <stats/CPlayerCardStats.hpp>
|
||||
|
||||
namespace big
|
||||
{
|
||||
rage::netGameEvent* hooks::send_player_card_stats(rage::netGameEvent* a1, CPlayerCardStats* stats)
|
||||
{
|
||||
if (g.spoofing.spoof_rank)
|
||||
stats->m_rank = g.spoofing.rank;
|
||||
|
||||
if (g.spoofing.spoof_kd_ratio)
|
||||
stats->m_kd_ratio = g.spoofing.kd_ratio;
|
||||
|
||||
if (g.spoofing.spoof_bad_sport)
|
||||
{
|
||||
switch (g.spoofing.badsport_type)
|
||||
{
|
||||
case 0: stats->m_overall_badsport = 0.0f; break;
|
||||
case 1: stats->m_overall_badsport = 46.0f; break;
|
||||
case 2: stats->m_overall_badsport = 1000.0f; break;
|
||||
}
|
||||
}
|
||||
|
||||
return g_hooking->get_original<hooks::send_player_card_stats>()(a1, stats);
|
||||
}
|
||||
#include "hooking/hooking.hpp"
|
||||
#include "network/Network.hpp"
|
||||
|
||||
#include <stats/CPlayerCardStats.hpp>
|
||||
|
||||
namespace big
|
||||
{
|
||||
rage::netGameEvent* hooks::send_player_card_stats(rage::netGameEvent* a1, CPlayerCardStats* stats)
|
||||
{
|
||||
if (g.spoofing.spoof_rank)
|
||||
stats->m_rank = g.spoofing.rank;
|
||||
|
||||
if (g.spoofing.spoof_kd_ratio)
|
||||
stats->m_kd_ratio = g.spoofing.kd_ratio;
|
||||
|
||||
if (g.spoofing.spoof_bad_sport)
|
||||
{
|
||||
switch (g.spoofing.badsport_type)
|
||||
{
|
||||
case 0: stats->m_overall_badsport = 0.0f; break;
|
||||
case 1: stats->m_overall_badsport = 46.0f; break;
|
||||
case 2: stats->m_overall_badsport = 1000.0f; break;
|
||||
}
|
||||
}
|
||||
|
||||
return g_hooking->get_original<hooks::send_player_card_stats>()(a1, stats);
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
#include "hooking.hpp"
|
||||
#include "hooking/hooking.hpp"
|
||||
#include "network/Network.hpp"
|
||||
|
||||
namespace big
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "hooking.hpp"
|
||||
#include "hooking/hooking.hpp"
|
||||
#include "network/Network.hpp"
|
||||
|
||||
#include <stats/CStatsSerializationContext.hpp>
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "hooking.hpp"
|
||||
#include "hooking/hooking.hpp"
|
||||
#include "util/model_info.hpp"
|
||||
|
||||
#include <netsync/nodes/player/CPlayerAppearanceDataNode.hpp>
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "hooking.hpp"
|
||||
#include "hooking/hooking.hpp"
|
||||
#include "services/players/player_service.hpp"
|
||||
#include "util/globals.hpp"
|
||||
|
||||
|
@ -1,14 +1,14 @@
|
||||
#include "hooking.hpp"
|
||||
|
||||
#include <netsync/nodes/player/CPlayerCreationDataNode.hpp>
|
||||
|
||||
namespace big
|
||||
{
|
||||
void hooks::write_player_creation_data_node(rage::netObject* player, CPlayerCreationDataNode* node)
|
||||
{
|
||||
g_hooking->get_original<hooks::write_player_creation_data_node>()(player, node);
|
||||
|
||||
if (g.spoofing.spoof_player_model)
|
||||
node->m_model = rage::joaat(g.spoofing.player_model);
|
||||
}
|
||||
}
|
||||
#include "hooking/hooking.hpp"
|
||||
|
||||
#include <netsync/nodes/player/CPlayerCreationDataNode.hpp>
|
||||
|
||||
namespace big
|
||||
{
|
||||
void hooks::write_player_creation_data_node(rage::netObject* player, CPlayerCreationDataNode* node)
|
||||
{
|
||||
g_hooking->get_original<hooks::write_player_creation_data_node>()(player, node);
|
||||
|
||||
if (g.spoofing.spoof_player_model)
|
||||
node->m_model = rage::joaat(g.spoofing.player_model);
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "hooking.hpp"
|
||||
#include "hooking/hooking.hpp"
|
||||
#include "services/players/player_service.hpp"
|
||||
#include "util/globals.hpp"
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "hooking.hpp"
|
||||
#include "hooking/hooking.hpp"
|
||||
|
||||
#include <netsync/nodes/player/CPlayerGamerDataNode.hpp>
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
#include "gta/net_array.hpp"
|
||||
#include "hooking.hpp"
|
||||
#include "hooking/hooking.hpp"
|
||||
#include "script_global.hpp"
|
||||
#include "script_local.hpp"
|
||||
#include "services/players/player_service.hpp"
|
||||
|
@ -1,5 +1,5 @@
|
||||
#include "gta/net_array.hpp"
|
||||
#include "hooking.hpp"
|
||||
#include "hooking/hooking.hpp"
|
||||
#include "script_global.hpp"
|
||||
#include "script_local.hpp"
|
||||
|
||||
|
@ -1,18 +1,18 @@
|
||||
#include "gta/sound.hpp"
|
||||
#include "hooking.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
HRESULT hooks::direct_sound_capture_create(GUID* guid, IDirectSoundCapture** sound, void* unknown)
|
||||
{
|
||||
if ((*guid) == g_yim_device && g.spoofing.voice_chat_audio)
|
||||
{
|
||||
*sound = &g_direct_sound_capture;
|
||||
return (HRESULT)0L;// DS_OK
|
||||
}
|
||||
else
|
||||
{
|
||||
return g_hooking->get_original<hooks::direct_sound_capture_create>()(guid, sound, unknown);
|
||||
}
|
||||
}
|
||||
}
|
||||
#include "gta/sound.hpp"
|
||||
#include "hooking/hooking.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
HRESULT hooks::direct_sound_capture_create(GUID* guid, IDirectSoundCapture** sound, void* unknown)
|
||||
{
|
||||
if ((*guid) == g_yim_device && g.spoofing.voice_chat_audio)
|
||||
{
|
||||
*sound = &g_direct_sound_capture;
|
||||
return (HRESULT)0L;// DS_OK
|
||||
}
|
||||
else
|
||||
{
|
||||
return g_hooking->get_original<hooks::direct_sound_capture_create>()(guid, sound, unknown);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,42 +1,42 @@
|
||||
#include "gta/sound.hpp"
|
||||
#include "hooking.hpp"
|
||||
|
||||
class CFoundDevice
|
||||
{
|
||||
public:
|
||||
GUID m_guid;
|
||||
char16_t m_name[64];
|
||||
int m_device_type;
|
||||
int m_default_type;
|
||||
int m_pad2;
|
||||
};
|
||||
static_assert(sizeof(CFoundDevice) == 0x9C);
|
||||
|
||||
namespace big
|
||||
{
|
||||
int hooks::enumerate_audio_devices(CFoundDevice* found_devices, int count, int flags)
|
||||
{
|
||||
auto res = g_hooking->get_original<hooks::enumerate_audio_devices>()(found_devices, count, flags);
|
||||
|
||||
if ((flags & 1) && g.spoofing.voice_chat_audio)
|
||||
{
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
if (found_devices[i].m_device_type != 2 || found_devices[i].m_default_type != 2)
|
||||
{
|
||||
lstrcpyW((LPWSTR)found_devices[i].m_name, L"YimMenu Virtual Input Device");
|
||||
found_devices[i].m_guid = g_yim_device;
|
||||
found_devices[i].m_device_type = 1;
|
||||
found_devices[i].m_default_type = 1;
|
||||
|
||||
if (i >= res)
|
||||
res++;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
}
|
||||
#include "gta/sound.hpp"
|
||||
#include "hooking/hooking.hpp"
|
||||
|
||||
class CFoundDevice
|
||||
{
|
||||
public:
|
||||
GUID m_guid;
|
||||
char16_t m_name[64];
|
||||
int m_device_type;
|
||||
int m_default_type;
|
||||
int m_pad2;
|
||||
};
|
||||
static_assert(sizeof(CFoundDevice) == 0x9C);
|
||||
|
||||
namespace big
|
||||
{
|
||||
int hooks::enumerate_audio_devices(CFoundDevice* found_devices, int count, int flags)
|
||||
{
|
||||
auto res = g_hooking->get_original<hooks::enumerate_audio_devices>()(found_devices, count, flags);
|
||||
|
||||
if ((flags & 1) && g.spoofing.voice_chat_audio)
|
||||
{
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
if (found_devices[i].m_device_type != 2 || found_devices[i].m_default_type != 2)
|
||||
{
|
||||
lstrcpyW((LPWSTR)found_devices[i].m_name, L"YimMenu Virtual Input Device");
|
||||
found_devices[i].m_guid = g_yim_device;
|
||||
found_devices[i].m_device_type = 1;
|
||||
found_devices[i].m_default_type = 1;
|
||||
|
||||
if (i >= res)
|
||||
res++;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
@ -1,68 +0,0 @@
|
||||
#include "invoker.hpp"
|
||||
|
||||
#include "common.hpp"
|
||||
#include "crossmap.hpp"
|
||||
#include "pointers.hpp"
|
||||
|
||||
extern "C" void _call_asm(void* context, void* function, void* ret);
|
||||
|
||||
namespace big
|
||||
{
|
||||
native_call_context::native_call_context()
|
||||
{
|
||||
m_return_value = &m_return_stack[0];
|
||||
m_args = &m_arg_stack[0];
|
||||
}
|
||||
|
||||
void native_invoker::cache_handlers()
|
||||
{
|
||||
if (m_handlers_cached)
|
||||
return;
|
||||
|
||||
for (const rage::scrNativeMapping& mapping : g_crossmap)
|
||||
{
|
||||
rage::scrNativeHandler handler =
|
||||
g_pointers->m_gta.m_get_native_handler(g_pointers->m_gta.m_native_registration_table, mapping.second);
|
||||
m_handler_cache.emplace(mapping.first, handler);
|
||||
}
|
||||
|
||||
m_handlers_cached = true;
|
||||
}
|
||||
|
||||
void native_invoker::begin_call()
|
||||
{
|
||||
m_call_context.reset();
|
||||
}
|
||||
|
||||
void native_invoker::end_call(rage::scrNativeHash hash)
|
||||
{
|
||||
if (!m_handlers_cached)
|
||||
cache_handlers();
|
||||
|
||||
if (auto it = m_handler_cache.find(hash); it != m_handler_cache.end())
|
||||
{
|
||||
rage::scrNativeHandler handler = it->second;
|
||||
|
||||
[this, hash, handler] {
|
||||
__try
|
||||
{
|
||||
// return address checks are no longer a thing
|
||||
handler(&m_call_context);
|
||||
g_pointers->m_gta.m_fix_vectors(&m_call_context);
|
||||
}
|
||||
__except (EXCEPTION_EXECUTE_HANDLER)
|
||||
{
|
||||
[hash]() {
|
||||
LOG(WARNING) << "Exception caught while trying to call " << HEX_TO_UPPER(hash) << " native.";
|
||||
}();
|
||||
}
|
||||
}();
|
||||
}
|
||||
else
|
||||
{
|
||||
[hash]() {
|
||||
LOG(WARNING) << "Failed to find " << HEX_TO_UPPER(hash) << " native's handler.";
|
||||
}();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,47 +0,0 @@
|
||||
#pragma once
|
||||
#include "common.hpp"
|
||||
#include "gta/natives.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
class native_call_context : public rage::scrNativeCallContext
|
||||
{
|
||||
public:
|
||||
native_call_context();
|
||||
|
||||
private:
|
||||
uint64_t m_return_stack[10];
|
||||
uint64_t m_arg_stack[100];
|
||||
};
|
||||
|
||||
class native_invoker
|
||||
{
|
||||
public:
|
||||
explicit native_invoker() = default;
|
||||
~native_invoker() = default;
|
||||
|
||||
void cache_handlers();
|
||||
|
||||
void begin_call();
|
||||
void end_call(rage::scrNativeHash hash);
|
||||
|
||||
template<typename T>
|
||||
void push_arg(T&& value)
|
||||
{
|
||||
m_call_context.push_arg(std::forward<T>(value));
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
T& get_return_value()
|
||||
{
|
||||
return *m_call_context.get_return_value<T>();
|
||||
}
|
||||
|
||||
public:
|
||||
native_call_context m_call_context;
|
||||
std::unordered_map<rage::scrNativeHash, rage::scrNativeHandler> m_handler_cache;
|
||||
bool m_handlers_cached = false;
|
||||
};
|
||||
|
||||
inline native_invoker g_native_invoker;
|
||||
}
|
7
src/invoker/crossmap.hpp
Normal file
7
src/invoker/crossmap.hpp
Normal file
File diff suppressed because one or more lines are too long
6568
src/invoker/crossmap.txt
Normal file
6568
src/invoker/crossmap.txt
Normal file
File diff suppressed because it is too large
Load Diff
123
src/invoker/generate_natives.py
Normal file
123
src/invoker/generate_natives.py
Normal file
@ -0,0 +1,123 @@
|
||||
import json
|
||||
|
||||
crossmap = {}
|
||||
natives = {}
|
||||
current_idx = 0
|
||||
crossmap_hash_list = []
|
||||
|
||||
class Arg:
|
||||
def __init__(self, name: str, type: str):
|
||||
self.name = name
|
||||
self.type = type#.replace("BOOL", "bool")# .replace("Any*", "void*")
|
||||
|
||||
def __str__(self) -> str:
|
||||
return str(self.type) + " " + str(self.name)
|
||||
|
||||
class NativeFunc:
|
||||
def __init__(self, namespace: str, name: str, hash: int, args: list[dict], return_type: str):
|
||||
self.namespace = namespace
|
||||
self.name = name
|
||||
self.hash = hash
|
||||
self.args: list[Arg] = []
|
||||
self.return_type = return_type#.replace("BOOL", "bool")# .replace("Any*", "void*")
|
||||
self.native_index = -1
|
||||
self.fix_vectors = "false"
|
||||
|
||||
for arg in args:
|
||||
self.args.append(Arg(arg["name"], arg["type"]))
|
||||
if arg["type"] == "Vector3*":
|
||||
self.fix_vectors = "true"
|
||||
|
||||
def get_native_def_str(self) -> str:
|
||||
assert self.native_index != -1
|
||||
|
||||
param_decl = ""
|
||||
param_pass = ""
|
||||
if len(self.args) > 0:
|
||||
for arg in self.args:
|
||||
param_decl += str(arg) + ", "
|
||||
param_pass += arg.name + ", "
|
||||
param_decl = param_decl[:-2]
|
||||
param_pass = param_pass[:-2]
|
||||
|
||||
return f"FORCEINLINE constexpr {self.return_type} {self.name}({param_decl}) {{ return big::native_invoker::invoke<{self.native_index}, {self.fix_vectors}, {self.return_type}>({param_pass}); }}"
|
||||
|
||||
class CrossmapEntry:
|
||||
def __init__(self, translated_hash: int):
|
||||
self.hash = translated_hash
|
||||
self.native_index = -1
|
||||
|
||||
def load_crossmap_data():
|
||||
global crossmap
|
||||
|
||||
data = open("crossmap.txt").readlines()
|
||||
for item in data:
|
||||
translation = item.split(",")
|
||||
crossmap[int(translation[0], 16)] = CrossmapEntry(int(translation[1], 16))
|
||||
|
||||
def load_natives_data():
|
||||
global natives
|
||||
|
||||
data = json.load(open("natives.json"))
|
||||
for ns, natives_list in data.items():
|
||||
natives[ns] = []
|
||||
for hash_str, native_data in natives_list.items():
|
||||
natives[ns].append(NativeFunc(ns, native_data["name"], int(hash_str, 16), native_data["params"], native_data["return_type"]))
|
||||
|
||||
def allocate_indices():
|
||||
global current_idx, crossmap_hash_list
|
||||
|
||||
for _, n in natives.items():
|
||||
for native in n:
|
||||
hash = native.hash
|
||||
if hash in crossmap:
|
||||
crossmap[hash].native_index = current_idx
|
||||
native.native_index = current_idx
|
||||
crossmap_hash_list.append(crossmap[hash].hash)
|
||||
current_idx += 1
|
||||
|
||||
|
||||
def write_crossmap_header():
|
||||
open("crossmap.hpp", "w+").write(f"""#pragma once
|
||||
#include <script/scrNativeHandler.hpp>
|
||||
|
||||
namespace big
|
||||
{{
|
||||
constexpr std::array<rage::scrNativeHash, {len(crossmap_hash_list)}> g_crossmap = {{{",".join([f"0x{x:X}" for x in crossmap_hash_list])}}};
|
||||
}}
|
||||
""")
|
||||
|
||||
def write_natives_header():
|
||||
natives_buf = ""
|
||||
natives_index_buf = ""
|
||||
|
||||
for ns, nvs in natives.items():
|
||||
natives_buf += f"namespace {ns}\n{{\n"
|
||||
for nat_data in nvs:
|
||||
if nat_data.native_index == -1:
|
||||
continue
|
||||
|
||||
natives_buf += f"\t{nat_data.get_native_def_str()}\n"
|
||||
natives_index_buf += f"\t{nat_data.name} = {nat_data.native_index},\n"
|
||||
natives_buf += "}\n\n"
|
||||
|
||||
natives_buf = natives_buf[:-2]
|
||||
|
||||
open("../natives.hpp", "w+").write(f"""#pragma once
|
||||
#include "invoker/invoker.hpp"
|
||||
|
||||
// clang-format off
|
||||
enum class NativeIndex
|
||||
{{
|
||||
{natives_index_buf}}};
|
||||
|
||||
{natives_buf}
|
||||
// clang-format on
|
||||
""")
|
||||
|
||||
if __name__ == "__main__":
|
||||
load_crossmap_data()
|
||||
load_natives_data()
|
||||
allocate_indices()
|
||||
write_crossmap_header()
|
||||
write_natives_header()
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user