Improve protections and other random changes (#1803)

* feat(protections): better logging
* feat(protections): improve protections
* fix(globals): save all spoofing settings
This commit is contained in:
maybegreat48 2023-07-22 21:18:47 +00:00 committed by GitHub
parent 72ebaec8ec
commit e7562bcdff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
30 changed files with 1700 additions and 358 deletions

View File

@ -3,7 +3,7 @@ include(FetchContent)
FetchContent_Declare( FetchContent_Declare(
gtav_classes gtav_classes
GIT_REPOSITORY https://github.com/Yimura/GTAV-Classes.git GIT_REPOSITORY https://github.com/Yimura/GTAV-Classes.git
GIT_TAG 7ff656ae2b733bcf2bc621592f602654403eba67 GIT_TAG fe0893ffb589da617442015b97a62c117ac5bed4
GIT_PROGRESS TRUE GIT_PROGRESS TRUE
CONFIGURE_COMMAND "" CONFIGURE_COMMAND ""
BUILD_COMMAND "" BUILD_COMMAND ""

View File

@ -5,43 +5,31 @@
#include "pointers.hpp" #include "pointers.hpp"
#include "util/scripts.hpp" #include "util/scripts.hpp"
#include <network/snSession.hpp>
namespace big namespace big
{ {
class oom_kick : player_command class oom_kick : player_command
{ {
using player_command::player_command; using player_command::player_command;
std::chrono::system_clock::time_point last_oom_kick_time{};
virtual CommandAccessLevel get_access_level() virtual CommandAccessLevel get_access_level()
{ {
return CommandAccessLevel::TOXIC; return CommandAccessLevel::TOXIC;
} }
virtual void execute(player_ptr player, const std::vector<uint64_t>& _args, const std::shared_ptr<command_context> ctx) virtual void execute(player_ptr player, const std::vector<uint64_t>& _args, const std::shared_ptr<command_context> ctx)
{
if (std::chrono::system_clock::now() - last_oom_kick_time < 7s)
{
g_notification_service->push_error("Kick", "Don't spam this or it will backfire");
return;
}
last_oom_kick_time = std::chrono::system_clock::now();
if (auto freemode = gta_util::find_script_thread(RAGE_JOAAT("freemode")))
{ {
packet msg{}; packet msg{};
msg.write_message(rage::eNetMessage::MsgScriptMigrateHost);
freemode->m_handler->get_id()->serialize(&msg.m_buffer); msg.write_message(rage::eNetMessage::MsgRadioStationSyncRequest);
msg.write<int>(0, 16); auto msg_id = player->get_session_player()->m_msg_id;
msg.write<int>(0, 32);
auto msg_id = player->get_net_game_player()->m_msg_id; for (int j = 0; j < 2000; j++)
for (int j = 0; j < 2100; j++)
{ {
msg.send(msg_id); msg.send(msg_id);
} }
} }
}
}; };
oom_kick g_oom_kick("oomkick", "OOM_KICK_CMD", "OOM_KICK_CMD_DESC", 0, false); oom_kick g_oom_kick("oomkick", "OOM_KICK_CMD", "OOM_KICK_CMD_DESC", 0, false);

View File

@ -80,6 +80,9 @@ namespace big
// window hook: pt1 // window hook: pt1
memory::byte_patch::make(g_pointers->m_gta.m_window_hook.as<void*>(), std::to_array({0xC3, 0x90, 0x90, 0x90}))->apply(); memory::byte_patch::make(g_pointers->m_gta.m_window_hook.as<void*>(), std::to_array({0xC3, 0x90, 0x90, 0x90}))->apply();
// Prevent the game from crashing when flooded with outgoing events
memory::byte_patch::make(g_pointers->m_gta.m_free_event_error, std::vector{0x90, 0x90, 0x90, 0x90, 0x90})->apply();
} }
byte_patch_manager::byte_patch_manager() byte_patch_manager::byte_patch_manager()

View File

@ -0,0 +1,437 @@
#pragma once
const inline static std::vector<std::pair<int, const char*>> task_type_names = {
{0, "CTaskHandsUp"},
{1, "CTaskClimbLadder"},
{2, "CTaskExitVehicle"},
{3, "CTaskCombatRoll"},
{4, "CTaskAimGunOnFoot"},
{5, "CTaskMovePlayer"},
{6, "CTaskPlayerOnFoot"},
{8, "CTaskWeapon"},
{9, "CTaskPlayerWeapon"},
{10, "CTaskPlayerIdles"},
{12, "CTaskAimGun"},
{12, "CTaskComplex"},
{12, "CTaskFSMClone"},
{12, "CTaskMotionBase"},
{12, "CTaskMove"},
{12, "CTaskMoveBase"},
{12, "CTaskNMBehaviour"},
{12, "CTaskNavBase"},
{12, "CTaskScenario"},
{12, "CTaskSearchBase"},
{12, "CTaskSearchInVehicleBase"},
{12, "CTaskShockingEvent"},
{12, "CTaskTrainBase"},
{12, "CTaskVehicleFSM"},
{12, "CTaskVehicleGoTo"},
{12, "CTaskVehicleMissionBase"},
{12, "CTaskVehicleTempAction"},
{14, "CTaskPause"},
{15, "CTaskDoNothing"},
{16, "CTaskGetUp"},
{17, "CTaskGetUpAndStandStill"},
{18, "CTaskFallOver"},
{19, "CTaskFallAndGetUp"},
{20, "CTaskCrawl"},
{25, "CTaskComplexOnFire"},
{26, "CTaskDamageElectric"},
{28, "CTaskTriggerLookAt"},
{29, "CTaskClearLookAt"},
{30, "CTaskSetCharDecisionMaker"},
{31, "CTaskSetPedDefensiveArea"},
{32, "CTaskUseSequence"},
{34, "CTaskMoveStandStill"},
{35, "CTaskComplexControlMovement"},
{36, "CTaskMoveSequence"},
{38, "CTaskAmbientClips"},
{39, "CTaskMoveInAir"},
{40, "CTaskNetworkClone"},
{41, "CTaskUseClimbOnRoute"},
{42, "CTaskUseDropDownOnRoute"},
{43, "CTaskUseLadderOnRoute"},
{44, "CTaskSetBlockingOfNonTemporaryEvents"},
{45, "CTaskForceMotionState"},
{46, "CTaskSlopeScramble"},
{47, "CTaskGoToAndClimbLadder"},
{48, "CTaskClimbLadderFully"},
{49, "CTaskRappel"},
{50, "CTaskVault"},
{51, "CTaskDropDown"},
{52, "CTaskAffectSecondaryBehaviour"},
{53, "CTaskAmbientLookAtEvent"},
{54, "CTaskOpenDoor"},
{55, "CTaskShovePed"},
{56, "CTaskSwapWeapon"},
{57, "CTaskGeneralSweep"},
{58, "CTaskPolice"},
{59, "CTaskPoliceOrderResponse"},
{60, "CTaskPursueCriminal"},
{62, "CTaskArrestPed"},
{63, "CTaskArrestPed2"},
{64, "CTaskBusted"},
{65, "CTaskFirePatrol"},
{66, "CTaskHeliOrderResponse"},
{67, "CTaskHeliPassengerRappel"},
{68, "CTaskAmbulancePatrol"},
{69, "CTaskPoliceWantedResponse"},
{70, "CTaskSwat"},
{72, "CTaskSwatWantedResponse"},
{73, "CTaskSwatOrderResponse"},
{74, "CTaskSwatGoToStagingArea"},
{75, "CTaskSwatFollowInLine"},
{76, "CTaskWitness"},
{77, "CTaskGangPatrol"},
{78, "CTaskArmy"},
{80, "CTaskShockingEventWatch"},
{82, "CTaskShockingEventGoto"},
{83, "CTaskShockingEventHurryAway"},
{84, "CTaskShockingEventReactToAircraft"},
{85, "CTaskShockingEventReact"},
{86, "CTaskShockingEventBackAway"},
{87, "CTaskShockingPoliceInvestigate"},
{88, "CTaskShockingEventStopAndStare"},
{89, "CTaskShockingNiceCarPicture"},
{90, "CTaskShockingEventThreatResponse"},
{92, "CTaskTakeOffHelmet"},
{93, "CTaskCarReactToVehicleCollision"},
{95, "CTaskCarReactToVehicleCollisionGetOut"},
{97, "CTaskDyingDead"},
{100, "CTaskWanderingScenario"},
{101, "CTaskWanderingInRadiusScenario"},
{103, "CTaskMoveBetweenPointsScenario"},
{104, "CTaskChatScenario"},
{106, "CTaskCowerScenario"},
{107, "CTaskDeadBodyScenario"},
{114, "CTaskSayAudio"},
{116, "CTaskWaitForSteppingOut"},
{117, "CTaskCoupleScenario"},
{118, "CTaskUseScenario"},
{119, "CTaskUseVehicleScenario"},
{120, "CTaskUnalerted"},
{121, "CTaskStealVehicle"},
{122, "CTaskReactToPursuit"},
{125, "CTaskHitWall"},
{126, "CTaskCower"},
{127, "CTaskCrouch"},
{128, "CTaskMelee"},
{129, "CTaskMoveMeleeMovement"},
{130, "CTaskMeleeActionResult"},
{131, "CTaskMeleeUpperbodyAnims"},
{133, "CTaskMoVEScripted"},
{134, "CTaskScriptedAnimation"},
{135, "CTaskSynchronizedScene"},
{137, "CTaskComplexEvasiveStep"},
{138, "CTaskWalkRoundCarWhileWandering"},
{140, "CTaskComplexStuckInAir"},
{141, "CTaskWalkRoundEntity"},
{142, "CTaskMoveWalkRoundVehicle"},
{144, "CTaskReactToGunAimedAt"},
{146, "CTaskDuckAndCover"},
{147, "CTaskAggressiveRubberneck"},
{150, "CTaskInVehicleBasic"},
{151, "CTaskCarDriveWander"},
{152, "CTaskLeaveAnyCar"},
{153, "CTaskComplexGetOffBoat"},
{155, "CTaskCarSetTempAction"},
{156, "CTaskBringVehicleToHalt"},
{157, "CTaskCarDrive"},
{159, "CTaskPlayerDrive"},
{160, "CTaskEnterVehicle"},
{161, "CTaskEnterVehicleAlign"},
{162, "CTaskOpenVehicleDoorFromOutside"},
{163, "CTaskEnterVehicleSeat"},
{164, "CTaskCloseVehicleDoorFromInside"},
{165, "CTaskInVehicleSeatShuffle"},
{167, "CTaskExitVehicleSeat"},
{168, "CTaskCloseVehicleDoorFromOutside"},
{169, "CTaskControlVehicle"},
{170, "CTaskMotionInAutomobile"},
{171, "CTaskMotionOnBicycle"},
{172, "CTaskMotionOnBicycleController"},
{173, "CTaskMotionInVehicle"},
{174, "CTaskMotionInTurret"},
{175, "CTaskReactToBeingJacked"},
{176, "CTaskReactToBeingAskedToLeaveVehicle"},
{177, "CTaskTryToGrabVehicleDoor"},
{178, "CTaskGetOnTrain"},
{179, "CTaskGetOffTrain"},
{180, "CTaskRideTrain"},
{190, "CTaskMountThrowProjectile"},
{195, "CTaskGoToCarDoorAndStandStill"},
{196, "CTaskMoveGoToVehicleDoor"},
{197, "CTaskSetPedInVehicle"},
{198, "CTaskSetPedOutOfVehicle"},
{199, "CTaskVehicleMountedWeapon"},
{200, "CTaskVehicleGun"},
{201, "CTaskVehicleProjectile"},
{204, "CTaskSmashCarWindow"},
{205, "CTaskMoveGoToPoint"},
{206, "CTaskMoveAchieveHeading"},
{207, "CTaskMoveFaceTarget"},
{208, "CTaskComplexGoToPointAndStandStillTimed"},
{208, "CTaskMoveGoToPointAndStandStill"},
{209, "CTaskMoveFollowPointRoute"},
{210, "CTaskMoveSeekEntity_CEntitySeekPosCalculatorStandard"},
{211, "CTaskMoveSeekEntity_CEntitySeekPosCalculatorLastNavMeshIntersection"},
{212, "CTaskMoveSeekEntity_CEntitySeekPosCalculatorLastNavMeshIntersection2"},
{213, "CTaskMoveSeekEntity_CEntitySeekPosCalculatorXYOffsetFixed"},
{214, "CTaskMoveSeekEntity_CEntitySeekPosCalculatorXYOffsetFixed2"},
{215, "CTaskExhaustedFlee"},
{216, "CTaskGrowlAndFlee"},
{217, "CTaskScenarioFlee"},
{218, "CTaskSmartFlee"},
{219, "CTaskFlyAway"},
{220, "CTaskWalkAway"},
{221, "CTaskWander"},
{222, "CTaskWanderInArea"},
{223, "CTaskFollowLeaderInFormation"},
{224, "CTaskGoToPointAnyMeans"},
{225, "CTaskTurnToFaceEntityOrCoord"},
{226, "CTaskFollowLeaderAnyMeans"},
{228, "CTaskFlyToPoint"},
{229, "CTaskFlyingWander"},
{230, "CTaskGoToPointAiming"},
{231, "CTaskGoToScenario"},
{233, "CTaskSeekEntityAiming"},
{234, "CTaskSlideToCoord"},
{235, "CTaskSwimmingWander"},
{237, "CTaskMoveTrackingEntity"},
{238, "CTaskMoveFollowNavMesh"},
{239, "CTaskMoveGoToPointOnRoute"},
{240, "CTaskEscapeBlast"},
{241, "CTaskMoveWander"},
{242, "CTaskMoveBeInFormation"},
{243, "CTaskMoveCrowdAroundLocation"},
{244, "CTaskMoveCrossRoadAtTrafficLights"},
{245, "CTaskMoveWaitForTraffic"},
{246, "CTaskMoveGoToPointStandStillAchieveHeading"},
{251, "CTaskMoveGetOntoMainNavMesh"},
{252, "CTaskMoveSlideToCoord"},
{253, "CTaskMoveGoToPointRelativeToEntityAndStandStill"},
{254, "CTaskHelicopterStrafe"},
{256, "CTaskGetOutOfWater"},
{259, "CTaskMoveFollowEntityOffset"},
{261, "CTaskFollowWaypointRecording"},
{264, "CTaskMotionPed"},
{265, "CTaskMotionPedLowLod"},
{268, "CTaskHumanLocomotion"},
{269, "CTaskMotionBasicLocomotionLowLod"},
{270, "CTaskMotionStrafing"},
{271, "CTaskMotionTennis"},
{272, "CTaskMotionAiming"},
{273, "CTaskBirdLocomotion"},
{274, "CTaskFlightlessBirdLocomotion"},
{278, "CTaskFishLocomotion"},
{279, "CTaskQuadLocomotion"},
{280, "CTaskMotionDiving"},
{281, "CTaskMotionSwimming"},
{282, "CTaskMotionParachuting"},
{283, "CTaskMotionDrunk"},
{284, "CTaskRepositionMove"},
{285, "CTaskMotionAimingTransition"},
{286, "CTaskThrowProjectile"},
{287, "CTaskCover"},
{288, "CTaskMotionInCover"},
{289, "CTaskAimAndThrowProjectile"},
{290, "CTaskGun"},
{291, "CTaskAimFromGround"},
{295, "CTaskAimGunVehicleDriveBy"},
{296, "CTaskAimGunScripted"},
{298, "CTaskReloadGun"},
{299, "CTaskWeaponBlocked"},
{300, "CTaskEnterCover"},
{301, "CTaskExitCover"},
{302, "CTaskAimGunFromCoverIntro"},
{303, "CTaskAimGunFromCoverOutro"},
{304, "CTaskAimGunBlindFire"},
{307, "CTaskCombatClosestTargetInArea"},
{308, "CTaskCombatAdditionalTask"},
{309, "CTaskInCover"},
{313, "CTaskAimSweep"},
{319, "CTaskSharkCircle"},
{320, "CTaskSharkAttack"},
{321, "CTaskAgitated"},
{322, "CTaskAgitatedAction"},
{323, "CTaskConfront"},
{324, "CTaskIntimidate"},
{325, "CTaskShove"},
{326, "CTaskShoved"},
{328, "CTaskCrouchToggle"},
{329, "CTaskRevive"},
{335, "CTaskParachute"},
{336, "CTaskParachuteObject"},
{337, "CTaskTakeOffPedVariation"},
{340, "CTaskCombatSeekCover"},
{342, "CTaskCombatFlank"},
{343, "CTaskCombat"},
{344, "CTaskCombatMounted"},
{345, "CTaskMoveCircle"},
{346, "CTaskMoveCombatMounted"},
{347, "CTaskSearch"},
{348, "CTaskSearchOnFoot"},
{349, "CTaskSearchInAutomobile"},
{350, "CTaskSearchInBoat"},
{351, "CTaskSearchInHeli"},
{352, "CTaskThreatResponse"},
{353, "CTaskInvestigate"},
{354, "CTaskStandGuardFSM"},
{355, "CTaskPatrol"},
{356, "CTaskShootAtTarget"},
{357, "CTaskSetAndGuardArea"},
{358, "CTaskStandGuard"},
{359, "CTaskSeparate"},
{360, "CTaskStayInCover"},
{361, "CTaskVehicleCombat"},
{362, "CTaskVehiclePersuit"},
{363, "CTaskVehicleChase"},
{364, "CTaskDraggingToSafety"},
{365, "CTaskDraggedToSafety"},
{366, "CTaskVariedAimPose"},
{367, "CTaskMoveWithinAttackWindow"},
{368, "CTaskMoveWithinDefensiveArea"},
{369, "CTaskShootOutTire"},
{370, "CTaskShellShocked"},
{371, "CTaskBoatChase"},
{372, "CTaskBoatCombat"},
{373, "CTaskBoatStrafe"},
{374, "CTaskHeliChase"},
{375, "CTaskHeliCombat"},
{376, "CTaskSubmarineCombat"},
{377, "CTaskSubmarineChase"},
{378, "CTaskPlaneChase"},
{379, "CTaskTargetUnreachable"},
{380, "CTaskTargetUnreachableInInterior"},
{381, "CTaskTargetUnreachableInExterior"},
{382, "CTaskStealthKill"},
{383, "CTaskWrithe"},
{384, "CTaskAdvance"},
{385, "CTaskCharge"},
{386, "CTaskMoveToTacticalPoint"},
{387, "CTaskToHurtTransit"},
{388, "CTaskAnimatedHitByExplosion"},
{389, "CTaskNMRelax"},
{391, "CTaskNMPose"},
{392, "CTaskNMBrace"},
{393, "CTaskNMBuoyancy"},
{394, "CTaskNMInjuredOnGround"},
{395, "CTaskNMShot"},
{396, "CTaskNMHighFall"},
{397, "CTaskNMBalance"},
{398, "CTaskNMElectrocute"},
{399, "CTaskNMPrototype"},
{400, "CTaskNMExplosion"},
{401, "CTaskNMOnFire"},
{402, "CTaskNMScriptControl"},
{403, "CTaskNMJumpRollFromRoadVehicle"},
{404, "CTaskNMFlinch"},
{405, "CTaskNMSit"},
{406, "CTaskNMFallDown"},
{407, "CTaskBlendFromNM"},
{408, "CTaskNMControl"},
{409, "CTaskNMDangle"},
{412, "CTaskNMGenericAttach"},
{414, "CTaskNMDraggingToSafety"},
{415, "CTaskNMThroughWindscreen"},
{416, "CTaskNMRiverRapids"},
{417, "CTaskNMSimple"},
{418, "CTaskRageRagdoll"},
{421, "CTaskJumpVault"},
{422, "CTaskJump"},
{423, "CTaskFall"},
{425, "CTaskReactAimWeapon"},
{426, "CTaskChat"},
{427, "CTaskMobilePhone"},
{428, "CTaskReactToDeadPed"},
{430, "CTaskSearchForUnknownThreat"},
{432, "CTaskBomb"},
{433, "CTaskDetonator"},
{435, "CTaskAnimatedAttach"},
{441, "CTaskCutScene"},
{442, "CTaskReactToExplosion"},
{443, "CTaskReactToImminentExplosion"},
{444, "CTaskDiveToGround"},
{445, "CTaskReactAndFlee"},
{446, "CTaskSidestep"},
{447, "CTaskCallPolice"},
{448, "CTaskReactInDirection"},
{449, "CTaskReactToBuddyShot"},
{454, "CTaskVehicleGoToAutomobileNew"},
{455, "CTaskVehicleGoToPlane"},
{456, "CTaskVehicleGoToHelicopter"},
{457, "CTaskVehicleGoToSubmarine"},
{458, "CTaskVehicleGoToBoat"},
{459, "CTaskVehicleGoToPointAutomobile"},
{460, "CTaskVehicleGoToPointWithAvoidanceAutomobile"},
{461, "CTaskVehiclePursue"},
{462, "CTaskVehicleRam"},
{463, "CTaskVehicleSpinOut"},
{464, "CTaskVehicleApproach"},
{465, "CTaskVehicleThreePointTurn"},
{466, "CTaskVehicleDeadDriver"},
{467, "CTaskVehicleCruiseNew"},
{468, "CTaskVehicleCruiseBoat"},
{469, "CTaskVehicleStop"},
{470, "CTaskVehiclePullOver"},
{471, "CTaskVehiclePassengerExit"},
{472, "CTaskVehicleFlee"},
{473, "CTaskVehicleFleeAirborne"},
{474, "CTaskVehicleFleeBoat"},
{475, "CTaskVehicleFollowRecording"},
{476, "CTaskVehicleFollow"},
{477, "CTaskVehicleBlock"},
{478, "CTaskVehicleBlockCruiseInFront"},
{479, "CTaskVehicleBlockBrakeInFront"},
{478, "CTaskVehicleBlockBackAndForth"},
{481, "CTaskVehicleCrash"},
{482, "CTaskVehicleLand"},
{483, "CTaskVehicleLandPlane"},
{484, "CTaskVehicleHover"},
{485, "CTaskVehicleAttack"},
{486, "CTaskVehicleAttackTank"},
{487, "CTaskVehicleCircle"},
{488, "CTaskVehiclePoliceBehaviour"},
{489, "CTaskVehiclePoliceBehaviourHelicopter"},
{490, "CTaskVehiclePoliceBehaviourBoat"},
{491, "CTaskVehicleEscort"},
{492, "CTaskVehicleHeliProtect"},
{494, "CTaskVehiclePlayerDriveAutomobile"},
{495, "CTaskVehiclePlayerDriveBike"},
{496, "CTaskVehiclePlayerDriveBoat"},
{497, "CTaskVehiclePlayerDriveSubmarine"},
{498, "CTaskVehiclePlayerDriveSubmarineCar"},
{499, "CTaskVehiclePlayerDriveAmphibiousAutomobile"},
{500, "CTaskVehiclePlayerDrivePlane"},
{501, "CTaskVehiclePlayerDriveHeli"},
{502, "CTaskVehiclePlayerDriveAutogyro"},
{503, "CTaskVehiclePlayerDriveDiggerArm"},
{504, "CTaskVehiclePlayerDriveTrain"},
{505, "CTaskVehiclePlaneChase"},
{506, "CTaskVehicleNoDriver"},
{507, "CTaskVehicleAnimation"},
{508, "CTaskVehicleConvertibleRoof"},
{509, "CTaskVehicleParkNew"},
{510, "CTaskVehicleFollowWaypointRecording"},
{511, "CTaskVehicleGoToNavmesh"},
{512, "CTaskVehicleReactToCopSiren"},
{513, "CTaskVehicleGotoLongRange"},
{514, "CTaskVehicleWait"},
{515, "CTaskVehicleReverse"},
{516, "CTaskVehicleBrake"},
{517, "CTaskVehicleHandBrake"},
{518, "CTaskVehicleTurn"},
{519, "CTaskVehicleGoForward"},
{520, "CTaskVehicleSwerve"},
{521, "CTaskVehicleFlyDirection"},
{522, "CTaskVehicleHeadonCollision"},
{523, "CTaskVehicleBoostUseSteeringAngle"},
{524, "CTaskVehicleShotTire"},
{525, "CTaskVehicleBurnout"},
{526, "CTaskVehicleRevEngine"},
{527, "CTaskVehicleSurfaceInSubmarine"},
{528, "CTaskVehiclePullAlongside"},
{529, "CTaskVehicleTransformToSubmarine"},
{530, "CTaskAnimatedFallback"},
{531, "None"},
};

View File

@ -620,7 +620,7 @@ namespace big
bool voice_chat_audio = false; bool voice_chat_audio = false;
NLOHMANN_DEFINE_TYPE_INTRUSIVE(spoofing, hide_from_player_list, spoof_cheater, spoof_hide_god, spoof_hide_spectate, spoof_crew_data, crew_tag, rockstar_crew, square_crew_tag, spoof_session_region_type, session_region_type, spoof_session_language, session_language, spoof_session_player_count, session_player_count, voice_chat_audio, spoof_session_bad_sport_status, session_bad_sport) NLOHMANN_DEFINE_TYPE_INTRUSIVE(spoofing, hide_from_player_list, spoof_blip, blip_type, spoof_rank, rank, spoof_job_points, job_points, spoof_kd_ratio, kd_ratio, spoof_bad_sport, badsport_type, spoof_player_model, player_model, spoof_cheater, spoof_hide_god, spoof_hide_spectate, spoof_crew_data, crew_tag, rockstar_crew, square_crew_tag, spoof_session_region_type, session_region_type, spoof_session_language, session_language, spoof_session_player_count, session_player_count, spoof_session_bad_sport_status, session_bad_sport, voice_chat_audio)
} spoofing{}; } spoofing{};
struct vehicle struct vehicle
@ -968,8 +968,6 @@ namespace big
NLOHMANN_DEFINE_TYPE_INTRUSIVE(persist_weapons, enabled, weapon_loadout_file) NLOHMANN_DEFINE_TYPE_INTRUSIVE(persist_weapons, enabled, weapon_loadout_file)
} persist_weapons{}; } persist_weapons{};
NLOHMANN_DEFINE_TYPE_INTRUSIVE(menu_settings, debug, tunables, notifications, player, player_db, protections, self, session, settings, spawn_vehicle, clone_pv, spoofing, vehicle, weapons, window, context_menu, esp, session_browser, ugc, reactions, world, stat_editor, lua, persist_weapons)
struct vfx struct vfx
{ {
bool enable_custom_sky_color = false; bool enable_custom_sky_color = false;
@ -983,6 +981,8 @@ namespace big
NLOHMANN_DEFINE_TYPE_INTRUSIVE(vfx, azimuth_east, azimuth_west, azimuth_transition, zenith, stars_intensity) NLOHMANN_DEFINE_TYPE_INTRUSIVE(vfx, azimuth_east, azimuth_west, azimuth_transition, zenith, stars_intensity)
} vfx{}; } vfx{};
NLOHMANN_DEFINE_TYPE_INTRUSIVE(menu_settings, debug, tunables, notifications, player, player_db, protections, self, session, settings, spawn_vehicle, clone_pv, spoofing, vehicle, weapons, window, context_menu, esp, session_browser, ugc, reactions, world, stat_editor, lua, persist_weapons, vfx)
}; };
inline auto g = menu_settings(); inline auto g = menu_settings();

View File

@ -12,7 +12,10 @@ enum eVehicleGadgetType : uint32_t;
namespace rage namespace rage
{ {
class netConnectionManager; class netConnectionManager;
class netConnectionPeer; class netPeerAddress;
class netConnection;
class netMessageQueue;
class netQueuedMessage;
class snMsgRemoveGamersFromSessionCmd; class snMsgRemoveGamersFromSessionCmd;
class snSession; class snSession;
class snPlayer; class snPlayer;
@ -117,8 +120,8 @@ namespace big::functions
using request_ragdoll = void (*)(uint16_t object_id); using request_ragdoll = void (*)(uint16_t object_id);
using request_control = void (*)(rage::netObject* net_object); using request_control = void (*)(rage::netObject* net_object);
using get_connection_peer = rage::netConnectionPeer* (*)(rage::netConnectionManager* manager, int peer_id); using get_peer_address = rage::netPeerAddress* (*)(rage::netConnectionManager* manager, int peer_id);
using send_remove_gamer_cmd = void (*)(rage::netConnectionManager* net_connection_mgr, rage::netConnectionPeer* player, int connection_id, rage::snMsgRemoveGamersFromSessionCmd* cmd, int flags); using send_remove_gamer_cmd = void (*)(rage::netConnectionManager* net_connection_mgr, rage::netPeerAddress* adde, int connection_id, rage::snMsgRemoveGamersFromSessionCmd* cmd, int flags);
using handle_remove_gamer_cmd = void* (*)(rage::snSession* session, rage::snPlayer* origin, rage::snMsgRemoveGamersFromSessionCmd* cmd); using handle_remove_gamer_cmd = void* (*)(rage::snSession* session, rage::snPlayer* origin, rage::snMsgRemoveGamersFromSessionCmd* cmd);
using script_vm = rage::eThreadState (*)(uint64_t* stack, int64_t** scr_globals, rage::scrProgram* program, rage::scrThreadContext* ctx); using script_vm = rage::eThreadState (*)(uint64_t* stack, int64_t** scr_globals, rage::scrProgram* program, rage::scrThreadContext* ctx);
@ -131,8 +134,8 @@ namespace big::functions
using set_as_active_cloud_file = void (*)(datafile_commands::SveFileObject* object, sCloudFile** file); using set_as_active_cloud_file = void (*)(datafile_commands::SveFileObject* object, sCloudFile** file);
using save_json_data = char* (*)(datafile_commands::SveFileObject* object, int* out_length, const char* reason); using save_json_data = char* (*)(datafile_commands::SveFileObject* object, int* out_length, const char* reason);
using sync_network_time = bool (*)(rage::netConnectionManager* mgr, rage::netConnectionPeer* peer, int connection_id, rage::netTimeSyncMsg* msg, int flags); using sync_network_time = bool (*)(rage::netConnectionManager* mgr, rage::netPeerAddress* addr, int connection_id, rage::netTimeSyncMsg* msg, int flags);
using send_packet = bool (*)(rage::netConnectionManager* mgr, rage::netConnectionPeer* peer, int connection_id, void* data, int size, int flags); using send_packet = bool (*)(rage::netConnectionManager* mgr, rage::netPeerAddress* adde, int connection_id, void* data, int size, int flags);
using connect_to_peer = bool (*)(rage::netConnectionManager* mgr, rage::rlGamerInfoBase* gamer_info, rage::snConnectToPeerTaskData* data, rage::snConnectToPeerTaskResult* result, rage::rlTaskStatus* status); using connect_to_peer = bool (*)(rage::netConnectionManager* mgr, rage::rlGamerInfoBase* gamer_info, rage::snConnectToPeerTaskData* data, rage::snConnectToPeerTaskResult* result, rage::rlTaskStatus* status);
using clear_ped_tasks_network = void (*)(CPed* ped, bool immediately); using clear_ped_tasks_network = void (*)(CPed* ped, bool immediately);
@ -152,4 +155,8 @@ namespace big::functions
using update_presence_attribute_int = void (*)(void* presence_data, int profile_index, char* attr, uint64_t value); using update_presence_attribute_int = void (*)(void* presence_data, int profile_index, char* attr, uint64_t value);
using update_presence_attribute_string = void (*)(void* presence_data, int profile_index, char* attr, char* value); using update_presence_attribute_string = void (*)(void* presence_data, int profile_index, char* attr, char* value);
using connection_manager_try_free_memory = void (*)(rage::netConnectionManager* mgr);
using remove_message_from_queue = void (*)(rage::netMessageQueue* queue, rage::netQueuedMessage* message);
using remove_message_from_unacked_reliables = void (*)(void* list, uint16_t* unk);
} }

View File

@ -1,7 +1,5 @@
#pragma once #pragma once
#include "pointers.hpp" #include "pointers.hpp"
#include "sysMemAllocator.hpp"
#include <array> #include <array>

View File

@ -424,39 +424,6 @@ namespace rage
Msg_0x86 = 0x86, Msg_0x86 = 0x86,
}; };
namespace netConnection
{
class InFrame
{
public:
enum class EventType
{
ConnectionClosed = 3,
FrameReceived = 4,
BandwidthExceeded = 6,
OutOfMemory = 7
};
virtual ~InFrame() = default;
virtual void destroy() = 0;
virtual EventType get_event_type() = 0;
virtual uint32_t _0x18() = 0;
uint32_t m_timestamp; //0x0008
char pad_0008[52]; //0x000C
uint32_t m_msg_id; //0x0040
uint32_t m_connection_identifier; //0x0044
InFrame* m_this; //0x0048
uint32_t m_peer_id; //0x0050
char pad_0050[44]; //0x0058
uint32_t m_length; //0x0080
char pad_007C[4]; //0x0084
void* m_data; //0x0088
};
static_assert(sizeof(rage::netConnection::InFrame) == 0x90);
}
enum class eEventNetworkType : int64_t enum class eEventNetworkType : int64_t
{ {
CEventNetworkPlayerJoinScript = 153, CEventNetworkPlayerJoinScript = 153,

View File

@ -1,4 +0,0 @@
#pragma once
#include "fwddec.hpp"
#include <rage/sysMemAllocator.hpp>

View File

@ -194,7 +194,7 @@ namespace big
functions::request_control m_request_control; functions::request_control m_request_control;
functions::clear_ped_tasks_network m_clear_ped_tasks_network; functions::clear_ped_tasks_network m_clear_ped_tasks_network;
functions::get_connection_peer m_get_connection_peer; functions::get_peer_address m_get_peer_address;
functions::send_remove_gamer_cmd m_send_remove_gamer_cmd; functions::send_remove_gamer_cmd m_send_remove_gamer_cmd;
functions::handle_remove_gamer_cmd m_handle_remove_gamer_cmd; functions::handle_remove_gamer_cmd m_handle_remove_gamer_cmd;
@ -286,6 +286,18 @@ namespace big
CBlipList* m_blip_list; CBlipList* m_blip_list;
PVOID m_timecycle_keyframe_override; PVOID m_timecycle_keyframe_override;
PVOID m_allocate_memory_reliable;
functions::connection_manager_try_free_memory m_connection_manager_try_free_memory;
functions::remove_message_from_queue m_remove_message_from_queue;
functions::remove_message_from_unacked_reliables m_remove_message_from_unacked_reliables;
PVOID m_free_event_error;
PVOID* m_draw_handler_mgr;
PVOID m_render_ped;
PVOID m_render_entity;
PVOID m_render_big_ped;
}; };
#pragma pack(pop) #pragma pack(pop)
static_assert(sizeof(gta_pointers) % 8 == 0, "Pointers are not properly aligned"); static_assert(sizeof(gta_pointers) % 8 == 0, "Pointers are not properly aligned");

View File

@ -116,6 +116,12 @@ namespace big
detour_hook_helper::add<hooks::update_timecycle_keyframe_data>("UTCKD", g_pointers->m_gta.m_timecycle_keyframe_override); detour_hook_helper::add<hooks::update_timecycle_keyframe_data>("UTCKD", g_pointers->m_gta.m_timecycle_keyframe_override);
detour_hook_helper::add<hooks::allocate_memory_reliable>("AMR", g_pointers->m_gta.m_allocate_memory_reliable);
detour_hook_helper::add<hooks::render_ped>("RP", g_pointers->m_gta.m_render_ped);
detour_hook_helper::add<hooks::render_entity>("RE", g_pointers->m_gta.m_render_entity);
detour_hook_helper::add<hooks::render_big_ped>("RBP", g_pointers->m_gta.m_render_big_ped);
g_hooking = this; g_hooking = this;
} }

View File

@ -7,6 +7,8 @@
#include "gta/script_thread.hpp" #include "gta/script_thread.hpp"
#include "vmt_hook.hpp" #include "vmt_hook.hpp"
#include <network/netConnection.hpp>
class CPlayerGamerDataNode; class CPlayerGamerDataNode;
class CPlayerGameStateDataNode; class CPlayerGameStateDataNode;
class CPedInventoryDataNode; class CPedInventoryDataNode;
@ -45,11 +47,6 @@ namespace rage
class datBitBuffer; class datBitBuffer;
class rlMetric; class rlMetric;
class rlTaskStatus; class rlTaskStatus;
namespace netConnection
{
class InFrame;
}
} }
namespace big namespace big
@ -76,7 +73,6 @@ namespace big
static void network_player_mgr_init(CNetworkPlayerMgr* _this, uint64_t a2, uint32_t a3, uint32_t a4[4]); static void network_player_mgr_init(CNetworkPlayerMgr* _this, uint64_t a2, uint32_t a3, uint32_t a4[4]);
static void network_player_mgr_shutdown(CNetworkPlayerMgr* _this); static void network_player_mgr_shutdown(CNetworkPlayerMgr* _this);
static bool fragment_physics_crash(uintptr_t a1, uint32_t a2, uintptr_t a3, uintptr_t a4, uintptr_t a5);
static bool fragment_physics_crash_2(float* a1, float* a2); static bool fragment_physics_crash_2(float* a1, float* a2);
static void received_event(rage::netEventMgr* event_manager, CNetGamePlayer* source_player, CNetGamePlayer* target_player, uint16_t event_id, int event_index, int event_handled_bitset, int unk, rage::datBitBuffer* bit_buffer); static void received_event(rage::netEventMgr* event_manager, CNetGamePlayer* source_player, CNetGamePlayer* target_player, uint16_t event_id, int event_index, int event_handled_bitset, int unk, rage::datBitBuffer* bit_buffer);
@ -156,6 +152,12 @@ namespace big
static void send_non_physical_player_data(CNetGamePlayer* player, __int64 message, int flags, void* a4, CNetGamePlayer* a5); static void send_non_physical_player_data(CNetGamePlayer* player, __int64 message, int flags, void* a4, CNetGamePlayer* a5);
static int64_t update_timecycle_keyframe_data(int64_t timecycleManager, TimecycleKeyframeData* timecycleKeyframeData); static int64_t update_timecycle_keyframe_data(int64_t timecycleManager, TimecycleKeyframeData* timecycleKeyframeData);
static void* allocate_memory_reliable(rage::netConnection* cxn, int required_memory);
static void* render_ped(__int64 renderer, CPed* ped, __int64 a3, __int64 a4);
static void render_entity(__int64 renderer, rage::fwEntity* entity, int unk, bool a4);
static __int64 render_big_ped(__int64 renderer, CPed* ped, __int64 a3, __int64 a4);
}; };
class minhook_keepalive class minhook_keepalive

View File

@ -1,7 +1,7 @@
#include "hooking.hpp" #include "hooking.hpp"
#include "logger/stack_trace.hpp"
#include "pointers.hpp" #include "pointers.hpp"
#include "util/string_conversions.hpp" #include "util/string_conversions.hpp"
#include "logger/stack_trace.hpp"
namespace big namespace big
{ {
@ -31,10 +31,10 @@ namespace big
void hooks::log_error_message_box(rage::joaat_t joaated_error_code, char a2) void hooks::log_error_message_box(rage::joaat_t joaated_error_code, char a2)
{ {
LOG(WARNING) << "Error Code: " << if (joaated_error_code == RAGE_JOAAT("ERR_NET_EVENT"))
string_conversions::utf_16_to_code_page( return;
CP_UTF8,
g_pointers->m_gta.m_get_title_caption_error_message_box(joaated_error_code)); LOG(WARNING) << "Error Code: " << string_conversions::utf_16_to_code_page(CP_UTF8, g_pointers->m_gta.m_get_title_caption_error_message_box(joaated_error_code));
log_stack_trace(); log_stack_trace();
} }

View File

@ -114,7 +114,7 @@ namespace big
} }
} }
if (plyr->block_join) if (plyr->block_join && *g_pointers->m_gta.m_is_session_started)
{ {
if (g_player_service->get_self()->is_host()) if (g_player_service->get_self()->is_host())
{ {
@ -126,7 +126,7 @@ namespace big
} }
} }
if (g.session.lock_session && g_player_service->get_self()->is_host()) if (g.session.lock_session && g_player_service->get_self()->is_host() && *g_pointers->m_gta.m_is_session_started)
{ {
if (plyr->is_friend() && g.session.allow_friends_into_locked_session) if (plyr->is_friend() && g.session.allow_friends_into_locked_session)
{ {

View File

@ -0,0 +1,80 @@
#include "gta/net_game_event.hpp"
#include "hooking.hpp"
#include "pointers.hpp"
#include <rage/sysMemAllocator.hpp>
namespace big
{
bool is_reliable_message(rage::netQueuedMessage* msg)
{
rage::datBitBuffer buffer(msg->m_data_buffer, INT_MAX);
buffer.m_flagBits |= 1; // read
buffer.Seek(10); // size
return buffer.ReadBits(1); // flags
}
void free_message(rage::netQueuedMessage* msg, rage::sysMemAllocator* allocator)
{
if (msg->m_data_buffer)
allocator->TryFree(msg->m_data_buffer);
allocator->TryFree(msg);
}
void* hooks::allocate_memory_reliable(rage::netConnection* cxn, int required_memory)
{
if (!cxn || !required_memory)
return nullptr;
auto memory = reinterpret_cast<rage::sysMemAllocator*>(cxn->m_allocator)->Allocate(required_memory, 0, 0);
if (memory)
return memory;
LOG(WARNING) << "Failed to allocate " << required_memory << " bytes for reliable message, free space: "
<< reinterpret_cast<rage::sysMemAllocator*>(cxn->m_allocator)->GetMemoryAvailable() << ". Trying to free some memory";
g_pointers->m_gta.m_connection_manager_try_free_memory(cxn->m_net_connection_mgr);
memory = reinterpret_cast<rage::sysMemAllocator*>(cxn->m_allocator)->Allocate(required_memory, 0, 0);
if (memory)
return memory;
LOG(WARNING) << "Failed to allocate " << required_memory << " bytes for reliable message, free space: "
<< reinterpret_cast<rage::sysMemAllocator*>(cxn->m_allocator)->GetMemoryAvailable() << ". Failed to free some memory, clearing all messages (including reliables) for connection";
while (cxn->m_normal_message_queue.m_count)
{
auto msg = cxn->m_normal_message_queue.m_first;
g_pointers->m_gta.m_remove_message_from_queue(&cxn->m_normal_message_queue, msg);
if (is_reliable_message(msg))
g_pointers->m_gta.m_remove_message_from_unacked_reliables(&cxn->m_unacked_reliable_message_list, &msg->word4C);
free_message(msg, reinterpret_cast<rage::sysMemAllocator*>(cxn->m_allocator));
}
while (cxn->m_reliables_resend_queue.m_count)
{
auto msg = cxn->m_reliables_resend_queue.m_first;
g_pointers->m_gta.m_remove_message_from_queue(&cxn->m_reliables_resend_queue, msg);
g_pointers->m_gta.m_remove_message_from_unacked_reliables(&cxn->m_unacked_reliable_message_list,
&msg->word4C); // messages in this queue are always reliables
free_message(msg, reinterpret_cast<rage::sysMemAllocator*>(cxn->m_allocator));
}
memory = reinterpret_cast<rage::sysMemAllocator*>(cxn->m_allocator)->Allocate(required_memory, 0, 0);
if (memory)
return memory;
g_notification_service->push_error("Protections", "The network message allocator is out of memory"); // this never reaches here but why not
return nullptr;
}
}

View File

@ -1,29 +1,63 @@
#include "base/CBaseModelInfo.hpp" #include "base/CBaseModelInfo.hpp"
#include "base/CObject.hpp" #include "base/CObject.hpp"
#include "core/data/task_types.hpp"
#include "entities/fwEntity.hpp" #include "entities/fwEntity.hpp"
#include "gta/net_object_mgr.hpp" #include "gta/net_object_mgr.hpp"
#include "hooking.hpp" #include "hooking.hpp"
#include "netsync/netSyncDataNode.hpp" #include "netsync/netSyncDataNode.hpp"
#include "netsync/netSyncTree.hpp" #include "netsync/netSyncTree.hpp"
#include "netsync/nodes/automobile/CAutomobileCreationNode.hpp"
#include "netsync/nodes/door/CDoorCreationDataNode.hpp" #include "netsync/nodes/door/CDoorCreationDataNode.hpp"
#include "netsync/nodes/door/CDoorMovementDataNode.hpp"
#include "netsync/nodes/door/CDoorScriptGameStateDataNode.hpp"
#include "netsync/nodes/door/CDoorScriptInfoDataNode.hpp"
#include "netsync/nodes/dynamic_entity/CDynamicEntityGameStateDataNode.hpp" #include "netsync/nodes/dynamic_entity/CDynamicEntityGameStateDataNode.hpp"
#include "netsync/nodes/entity/CEntityScriptGameStateDataNode.hpp"
#include "netsync/nodes/object/CObjectCreationDataNode.hpp" #include "netsync/nodes/object/CObjectCreationDataNode.hpp"
#include "netsync/nodes/ped/CPedAIDataNode.hpp"
#include "netsync/nodes/ped/CPedAttachDataNode.hpp" #include "netsync/nodes/ped/CPedAttachDataNode.hpp"
#include "netsync/nodes/ped/CPedComponentReservationDataNode.hpp"
#include "netsync/nodes/ped/CPedCreationDataNode.hpp" #include "netsync/nodes/ped/CPedCreationDataNode.hpp"
#include "netsync/nodes/ped/CPedGameStateDataNode.hpp"
#include "netsync/nodes/ped/CPedHealthDataNode.hpp"
#include "netsync/nodes/ped/CPedInventoryDataNode.hpp" #include "netsync/nodes/ped/CPedInventoryDataNode.hpp"
#include "netsync/nodes/ped/CPedMovementDataNode.hpp"
#include "netsync/nodes/ped/CPedOrientationDataNode.hpp"
#include "netsync/nodes/ped/CPedScriptCreationDataNode.hpp"
#include "netsync/nodes/ped/CPedTaskSequenceDataNode.hpp"
#include "netsync/nodes/ped/CPedTaskSpecificDataNode.hpp"
#include "netsync/nodes/ped/CPedTaskTreeDataNode.hpp"
#include "netsync/nodes/physical/CPhysicalAngVelocityDataNode.hpp"
#include "netsync/nodes/physical/CPhysicalAttachDataNode.hpp" #include "netsync/nodes/physical/CPhysicalAttachDataNode.hpp"
#include "netsync/nodes/physical/CPhysicalGameStateDataNode.hpp"
#include "netsync/nodes/physical/CPhysicalHealthDataNode.hpp"
#include "netsync/nodes/physical/CPhysicalMigrationDataNode.hpp"
#include "netsync/nodes/physical/CPhysicalScriptGameStateDataNode.hpp"
#include "netsync/nodes/physical/CPhysicalScriptMigrationDataNode.hpp"
#include "netsync/nodes/physical/CPhysicalVelocityDataNode.hpp"
#include "netsync/nodes/pickup/CPickupCreationDataNode.hpp" #include "netsync/nodes/pickup/CPickupCreationDataNode.hpp"
#include "netsync/nodes/pickup_placement/CPickupPlacementCreationDataNode.hpp"
#include "netsync/nodes/player/CPlayerAppearanceDataNode.hpp" #include "netsync/nodes/player/CPlayerAppearanceDataNode.hpp"
#include "netsync/nodes/player/CPlayerCameraDataNode.hpp"
#include "netsync/nodes/player/CPlayerCreationDataNode.hpp" #include "netsync/nodes/player/CPlayerCreationDataNode.hpp"
#include "netsync/nodes/player/CPlayerExtendedGameStateNode.hpp"
#include "netsync/nodes/player/CPlayerGameStateDataNode.hpp" #include "netsync/nodes/player/CPlayerGameStateDataNode.hpp"
#include "netsync/nodes/player/CPlayerGamerDataNode.hpp" #include "netsync/nodes/player/CPlayerGamerDataNode.hpp"
#include "netsync/nodes/player/CPlayerSectorPosNode.hpp"
#include "netsync/nodes/player/CPlayerWantedAndLOSDataNode.hpp"
#include "netsync/nodes/proximity_migrateable/CGlobalFlagsDataNode.hpp"
#include "netsync/nodes/proximity_migrateable/CMigrationDataNode.hpp"
#include "netsync/nodes/proximity_migrateable/CSectorDataNode.hpp" #include "netsync/nodes/proximity_migrateable/CSectorDataNode.hpp"
#include "netsync/nodes/proximity_migrateable/CSectorPositionDataNode.hpp"
#include "netsync/nodes/train/CTrainGameStateDataNode.hpp" #include "netsync/nodes/train/CTrainGameStateDataNode.hpp"
#include "netsync/nodes/vehicle/CVehicleControlDataNode.hpp"
#include "netsync/nodes/vehicle/CVehicleCreationDataNode.hpp" #include "netsync/nodes/vehicle/CVehicleCreationDataNode.hpp"
#include "netsync/nodes/vehicle/CVehicleGadgetDataNode.hpp" #include "netsync/nodes/vehicle/CVehicleGadgetDataNode.hpp"
#include "netsync/nodes/vehicle/CVehicleProximityMigrationDataNode.hpp" #include "netsync/nodes/vehicle/CVehicleProximityMigrationDataNode.hpp"
#include "netsync/nodes/vehicle/CVehicleTaskDataNode.hpp"
#include "network/CNetGamePlayer.hpp" #include "network/CNetGamePlayer.hpp"
#include "network/netObject.hpp" #include "network/netObject.hpp"
#include "ped/CPed.hpp"
#include "util/model_info.hpp" #include "util/model_info.hpp"
#include "util/notify.hpp" #include "util/notify.hpp"
#include "util/session.hpp" #include "util/session.hpp"
@ -55,10 +89,8 @@ namespace big
} }
}; };
using sync_node_vft = uintptr_t;
// Sync Node Virtual Function Table address to all sync node identifiers that also have that vft address. // Sync Node Virtual Function Table address to all sync node identifiers that also have that vft address.
using sync_node_vft_to_ids = std::unordered_map<sync_node_vft, std::vector<sync_node_id>>; using sync_node_vft_to_ids = std::unordered_map<uint64_t, sync_node_id>;
// Sync Tree node array index to node identifier. // Sync Tree node array index to node identifier.
using sync_tree_node_array_index_to_node_id_t = std::vector<sync_node_id>; using sync_tree_node_array_index_to_node_id_t = std::vector<sync_node_id>;
@ -67,7 +99,7 @@ namespace big
{ {
static constexpr size_t sync_tree_count = size_t(eNetObjType::NET_OBJ_TYPE_TRAIN) + 1; static constexpr size_t sync_tree_count = size_t(eNetObjType::NET_OBJ_TYPE_TRAIN) + 1;
std::array<sync_node_vft_to_ids, sync_tree_count> sync_trees_sync_node_vft_to_ids; std::array<sync_node_vft_to_ids, sync_tree_count> sync_trees_sync_node_addr_to_ids;
std::array<sync_tree_node_array_index_to_node_id_t, sync_tree_count> sync_trees_node_array_index_to_node_id = { std::array<sync_tree_node_array_index_to_node_id_t, sync_tree_count> sync_trees_node_array_index_to_node_id = {
{ {
@ -511,9 +543,9 @@ namespace big
static inline sync_node_finder_t finder; static inline sync_node_finder_t finder;
public: public:
static const std::vector<sync_node_id>& find(eNetObjType obj_type, uintptr_t vft) static const sync_node_id& find(eNetObjType obj_type, uintptr_t addr)
{ {
return finder.sync_trees_sync_node_vft_to_ids[(int)obj_type][vft]; return finder.sync_trees_sync_node_addr_to_ids[(int)obj_type][addr];
} }
static void init() static void init()
@ -535,16 +567,17 @@ namespace big
for (int j = 0; j < tree->m_child_node_count; j++) for (int j = 0; j < tree->m_child_node_count; j++)
{ {
const uintptr_t vft = *(uintptr_t*)tree->m_child_nodes[j]; const uintptr_t addr = (uintptr_t)tree->m_child_nodes[j];
const sync_node_id node_id = finder.sync_trees_node_array_index_to_node_id[i][j]; const sync_node_id node_id = finder.sync_trees_node_array_index_to_node_id[i][j];
finder.sync_trees_sync_node_vft_to_ids[i][vft].push_back(node_id); finder.sync_trees_sync_node_addr_to_ids[i][addr] = node_id;
} }
} }
} }
}; };
constexpr uint32_t crash_peds[] = {RAGE_JOAAT("slod_human"), RAGE_JOAAT("slod_small_quadped"), RAGE_JOAAT("slod_large_quadped")}; constexpr uint32_t crash_peds[] = {RAGE_JOAAT("slod_human"), RAGE_JOAAT("slod_small_quadped"), RAGE_JOAAT("slod_large_quadped")};
constexpr uint32_t crash_vehicles[] = {RAGE_JOAAT("arbitergt"), RAGE_JOAAT("astron2"), RAGE_JOAAT("cyclone2"), RAGE_JOAAT("ignus2"), RAGE_JOAAT("s95")}; constexpr uint32_t crash_vehicles[] = {RAGE_JOAAT("arbitergt"), RAGE_JOAAT("astron2"), RAGE_JOAAT("cyclone2"), RAGE_JOAAT("ignus2"), RAGE_JOAAT("s95")};
@ -730,6 +763,56 @@ namespace big
return !crash; return !crash;
} }
inline std::string get_task_type_string(int type)
{
std::string buffer = "";
for (auto& value : task_type_names)
{
if (value.first == type)
{
buffer += value.second;
buffer += '|';
}
if (value.first > type)
break; // a minor optimization
}
if (buffer.length() > 1)
buffer.pop_back();
else
buffer = "Unknown";
buffer += " (" + std::to_string(type) + ")";
return buffer;
}
inline bool is_valid_clan_tag(char* data, bool system_clan)
{
int length = strlen(data);
if (length <= (system_clan ? 2 : 3))
return false;
for (int i = 0; i < length; i++)
{
if (data[i] >= '0' && data[i] <= '9')
continue;
if (data[i] >= 'A' && data[i] <= 'Z')
continue;
if (data[i] >= 'a' && data[i] <= 'z')
continue;
return false;
}
return true;
}
#define LOG_FIELD_H(type, field) LOG(INFO) << "\t" << #field << ": " << HEX_TO_UPPER((((type*)(node))->field)); #define LOG_FIELD_H(type, field) LOG(INFO) << "\t" << #field << ": " << HEX_TO_UPPER((((type*)(node))->field));
#define LOG_FIELD(type, field) LOG(INFO) << "\t" << #field << ": " << ((((type*)(node))->field)); #define LOG_FIELD(type, field) LOG(INFO) << "\t" << #field << ": " << ((((type*)(node))->field));
#define LOG_FIELD_C(type, field) LOG(INFO) << "\t" << #field << ": " << (int)((((type*)(node))->field)); #define LOG_FIELD_C(type, field) LOG(INFO) << "\t" << #field << ": " << (int)((((type*)(node))->field));
@ -740,9 +823,13 @@ namespace big
#define LOG_FIELD_V4(type, field) \ #define LOG_FIELD_V4(type, field) \
LOG(INFO) << "\t" << #field << ": X: " << ((((type*)(node))->field)).x << " Y: " << ((((type*)(node))->field)).y \ LOG(INFO) << "\t" << #field << ": X: " << ((((type*)(node))->field)).x << " Y: " << ((((type*)(node))->field)).y \
<< " Z: " << ((((type*)(node))->field)).z << " W: " << ((((type*)(node))->field)).w; << " Z: " << ((((type*)(node))->field)).z << " W: " << ((((type*)(node))->field)).w;
#define LOG_FIELD_APPLY(type, field, func) LOG(INFO) << "\t" << #field << ": " << func((((type*)(node))->field));
void log_node(sync_node_id node_id, player_ptr sender, CProjectBaseSyncDataNode* node) void log_node(const sync_node_id& node_id, player_ptr sender, CProjectBaseSyncDataNode* node, rage::netObject* object)
{ {
if (object)
LOG(INFO) << sender->get_name() << ": " << node_id.name << ", " << object->m_object_id;
else
LOG(INFO) << sender->get_name() << ": " << node_id.name; LOG(INFO) << sender->get_name() << ": " << node_id.name;
switch (node_id) switch (node_id)
@ -834,6 +921,579 @@ namespace big
LOG_FIELD(CDynamicEntityGameStateDataNode, m_decors[i].m_value); LOG_FIELD(CDynamicEntityGameStateDataNode, m_decors[i].m_value);
} }
break; break;
case sync_node_id("CAutomobileCreationDataNode"):
LOG_FIELD_B(CAutomobileCreationDataNode, m_all_doors_closed);
break;
case sync_node_id("CDoorCreationDataNode"):
LOG_FIELD_H(CDoorCreationDataNode, m_model);
LOG_FIELD_V3(CDoorCreationDataNode, m_pos);
LOG_FIELD_B(CDoorCreationDataNode, m_is_script_door);
LOG_FIELD_B(CDoorCreationDataNode, m_player_wants_control);
break;
case sync_node_id("CDoorMovementDataNode"):
LOG_FIELD_B(CDoorMovementDataNode, m_is_manual_door);
LOG_FIELD(CDoorMovementDataNode, m_open_ratio);
LOG_FIELD_B(CDoorMovementDataNode, m_opening);
LOG_FIELD_B(CDoorMovementDataNode, m_fully_open);
LOG_FIELD_B(CDoorMovementDataNode, m_closed);
break;
case sync_node_id("CDoorScriptGameStateDataNode"):
LOG_FIELD(CDoorScriptGameStateDataNode, m_door_system_state);
LOG_FIELD(CDoorScriptGameStateDataNode, m_automatic_distance);
LOG_FIELD(CDoorScriptGameStateDataNode, m_slide_rate);
LOG_FIELD_B(CDoorScriptGameStateDataNode, m_has_broken_flags);
LOG_FIELD(CDoorScriptGameStateDataNode, m_broken_flags);
LOG_FIELD_B(CDoorScriptGameStateDataNode, m_has_damaged_flags);
LOG_FIELD(CDoorScriptGameStateDataNode, m_damaged_flags);
LOG_FIELD_B(CDoorScriptGameStateDataNode, m_hold_open);
break;
case sync_node_id("CDoorScriptInfoDataNode"):
LOG_FIELD_B(CDoorScriptInfoDataNode, m_has_script_info);
LOG_FIELD(CDoorScriptInfoDataNode, m_door_system_hash);
LOG_FIELD_B(CDoorScriptInfoDataNode, m_existing_door_system_entry);
break;
case sync_node_id("CEntityScriptGameStateDataNode"):
LOG_FIELD_B(CEntityScriptGameStateDataNode, m_fixed);
LOG_FIELD_B(CEntityScriptGameStateDataNode, m_uses_collision);
LOG_FIELD_B(CEntityScriptGameStateDataNode, m_completely_disabled_collision);
break;
case sync_node_id("CPedAIDataNode"):
LOG_FIELD_H(CPedAIDataNode, m_relationship_group);
LOG_FIELD_H(CPedAIDataNode, m_decision_maker_type);
break;
case sync_node_id("CPedAttachDataNode"):
LOG_FIELD_V3(CPedAttachDataNode, m_offset);
LOG_FIELD_V4(CPedAttachDataNode, m_orientation);
LOG_FIELD(CPedAttachDataNode, m_attached_to);
LOG_FIELD(CPedAttachDataNode, m_attachment_bone);
LOG_FIELD(CPedAttachDataNode, m_attachment_flags);
LOG_FIELD(CPedAttachDataNode, m_heading_1);
LOG_FIELD(CPedAttachDataNode, m_heading_2);
LOG_FIELD_B(CPedAttachDataNode, m_attached);
LOG_FIELD_B(CPedAttachDataNode, unk_00F1);
break;
case sync_node_id("CPedComponentReservationDataNode"):
LOG_FIELD(CPedComponentReservationDataNode, m_num_peds_using_component);
break;
case sync_node_id("CPedGameStateDataNode"):
LOG_FIELD(CPedGameStateDataNode, unk_0104);
LOG_FIELD(CPedGameStateDataNode, unk_0108);
LOG_FIELD(CPedGameStateDataNode, unk_010C);
LOG_FIELD(CPedGameStateDataNode, unk_0110);
LOG_FIELD(CPedGameStateDataNode, unk_0114);
LOG_FIELD(CPedGameStateDataNode, unk_0118);
LOG_FIELD_B(CPedGameStateDataNode, unk_011C);
LOG_FIELD(CPedGameStateDataNode, m_arrest_state);
LOG_FIELD(CPedGameStateDataNode, m_death_state);
LOG_FIELD_H(CPedGameStateDataNode, m_weapon_hash);
LOG_FIELD(CPedGameStateDataNode, m_num_weapon_components);
if (((CPedGameStateDataNode*)node)->m_num_weapon_components <= 12)
{
for (int i = 0; i < ((CPedGameStateDataNode*)node)->m_num_weapon_components; i++)
{
LOG_FIELD_B(CPedGameStateDataNode, m_weapon_component_something[i]);
LOG_FIELD_H(CPedGameStateDataNode, m_weapon_component_hash[i]);
}
}
LOG_FIELD(CPedGameStateDataNode, m_num_equiped_gadgets);
if (((CPedGameStateDataNode*)node)->m_num_equiped_gadgets <= 3)
{
for (int i = 0; i < ((CPedGameStateDataNode*)node)->m_num_equiped_gadgets; i++)
{
LOG_FIELD_B(CPedGameStateDataNode, m_gadget_hash[i]);
}
}
LOG_FIELD(CPedGameStateDataNode, m_seat);
LOG_FIELD(CPedGameStateDataNode, m_action_mode_override);
LOG_FIELD(CPedGameStateDataNode, unk_013C);
LOG_FIELD(CPedGameStateDataNode, m_vehicle);
LOG_FIELD(CPedGameStateDataNode, m_mount_id);
LOG_FIELD(CPedGameStateDataNode, m_custodian_id);
LOG_FIELD(CPedGameStateDataNode, unk_0146);
LOG_FIELD_B(CPedGameStateDataNode, m_tint_index);
LOG_FIELD_C(CPedGameStateDataNode, pad_0149);
LOG_FIELD_C(CPedGameStateDataNode, unk_014A);
LOG_FIELD_B(CPedGameStateDataNode, m_is_handcuffed);
LOG_FIELD_B(CPedGameStateDataNode, m_can_preform_arrest);
LOG_FIELD_B(CPedGameStateDataNode, m_can_preform_uncuff);
LOG_FIELD_B(CPedGameStateDataNode, m_can_be_arrested);
LOG_FIELD_B(CPedGameStateDataNode, m_is_in_custody);
LOG_FIELD_C(CPedGameStateDataNode, pad_0150);
LOG_FIELD_B(CPedGameStateDataNode, m_weapon_exists);
LOG_FIELD_B(CPedGameStateDataNode, m_weapon_visible);
LOG_FIELD_B(CPedGameStateDataNode, m_weapon_has_ammo);
LOG_FIELD_B(CPedGameStateDataNode, m_weapon_attach_left);
LOG_FIELD_C(CPedGameStateDataNode, pad_0155);
LOG_FIELD_B(CPedGameStateDataNode, m_in_seat);
LOG_FIELD_B(CPedGameStateDataNode, m_in_vehicle);
LOG_FIELD_B(CPedGameStateDataNode, m_on_mount);
LOG_FIELD_B(CPedGameStateDataNode, m_has_custodian_or_arrest_flags);
LOG_FIELD_C(CPedGameStateDataNode, pad_015A);
LOG_FIELD_B(CPedGameStateDataNode, m_action_mode_enabled);
LOG_FIELD_B(CPedGameStateDataNode, m_stealth_mode_enabled);
LOG_FIELD_B(CPedGameStateDataNode, unk_015D);
LOG_FIELD_B(CPedGameStateDataNode, unk_015E);
LOG_FIELD_B(CPedGameStateDataNode, unk_015F);
LOG_FIELD_B(CPedGameStateDataNode, unk_0160);
LOG_FIELD_B(CPedGameStateDataNode, unk_0161);
LOG_FIELD_B(CPedGameStateDataNode, unk_0162);
LOG_FIELD_B(CPedGameStateDataNode, unk_0163);
LOG_FIELD_B(CPedGameStateDataNode, unk_0164);
LOG_FIELD_B(CPedGameStateDataNode, unk_0165);
LOG_FIELD_B(CPedGameStateDataNode, unk_0166);
LOG_FIELD_B(CPedGameStateDataNode, unk_0167);
LOG_FIELD_B(CPedGameStateDataNode, unk_0168);
LOG_FIELD_B(CPedGameStateDataNode, unk_0169);
LOG_FIELD_B(CPedGameStateDataNode, unk_016A);
LOG_FIELD_B(CPedGameStateDataNode, unk_016B);
LOG_FIELD_B(CPedGameStateDataNode, unk_016C);
LOG_FIELD_B(CPedGameStateDataNode, unk_016D);
LOG_FIELD_B(CPedGameStateDataNode, unk_016E);
LOG_FIELD_B(CPedGameStateDataNode, unk_016F);
LOG_FIELD_B(CPedGameStateDataNode, unk_0170);
LOG_FIELD_B(CPedGameStateDataNode, unk_0171);
LOG_FIELD_B(CPedGameStateDataNode, unk_0172);
break;
case sync_node_id("CPedHealthDataNode"):
LOG_FIELD(CPedHealthDataNode, unk_00C0);
LOG_FIELD(CPedHealthDataNode, m_health);
LOG_FIELD(CPedHealthDataNode, m_armor);
LOG_FIELD(CPedHealthDataNode, unk_00CC);
LOG_FIELD(CPedHealthDataNode, unk_00D0);
LOG_FIELD_H(CPedHealthDataNode, m_weapon_damage_hash);
LOG_FIELD(CPedHealthDataNode, m_hurt_end_time);
LOG_FIELD_H(CPedHealthDataNode, m_weapon_damage_component);
LOG_FIELD(CPedHealthDataNode, m_weapon_damage_entity);
LOG_FIELD_B(CPedHealthDataNode, m_has_max_health);
LOG_FIELD_B(CPedHealthDataNode, m_has_default_armor);
LOG_FIELD_B(CPedHealthDataNode, unk_00E4);
LOG_FIELD_B(CPedHealthDataNode, m_killed_with_headshot);
LOG_FIELD_B(CPedHealthDataNode, m_killed_with_melee);
LOG_FIELD_B(CPedHealthDataNode, m_hurt_started);
LOG_FIELD_B(CPedHealthDataNode, unk_00E8);
LOG_FIELD_B(CPedHealthDataNode, unk_00E9);
break;
case sync_node_id("CPedMovementDataNode"):
LOG_FIELD_B(CPedMovementDataNode, m_has_desired_move_blend_ratio_x);
LOG_FIELD_B(CPedMovementDataNode, m_has_desired_move_blend_ratio_y);
LOG_FIELD_B(CPedMovementDataNode, unk_00C2);
LOG_FIELD(CPedMovementDataNode, m_desired_move_blend_ratio_x);
LOG_FIELD(CPedMovementDataNode, m_desired_move_blend_ratio_y);
LOG_FIELD(CPedMovementDataNode, unk_00CC);
LOG_FIELD(CPedMovementDataNode, m_desired_pitch);
break;
case sync_node_id("CPedOrientationDataNode"):
LOG_FIELD_B(CPedOrientationDataNode, m_has_desired_heading_x);
LOG_FIELD_B(CPedOrientationDataNode, m_has_desired_heading_y);
LOG_FIELD(CPedOrientationDataNode, m_desired_heading_x);
LOG_FIELD(CPedOrientationDataNode, m_desired_heading_y);
break;
case sync_node_id("CPedScriptCreationDataNode"):
LOG_FIELD_B(CPedScriptCreationDataNode, m_stay_in_car_when_jacked);
break;
case sync_node_id("CPedTaskSpecificDataNode"):
LOG_FIELD(CPedTaskSpecificDataNode, m_task_index);
LOG_FIELD_APPLY(CPedTaskSpecificDataNode, m_task_type, get_task_type_string);
LOG_FIELD(CPedTaskSpecificDataNode, m_buffer_size);
break;
case sync_node_id("CPhysicalAngVelocityDataNode"):
LOG_FIELD(CPhysicalAngVelocityDataNode, m_ang_velocity_x);
LOG_FIELD(CPhysicalAngVelocityDataNode, m_ang_velocity_y);
LOG_FIELD(CPhysicalAngVelocityDataNode, m_ang_velocity_z);
break;
case sync_node_id("CPhysicalAttachDataNode"):
LOG_FIELD_B(CPhysicalAttachDataNode, m_attached);
LOG_FIELD_B(CPhysicalAttachDataNode, unk_00C1);
LOG_FIELD(CPhysicalAttachDataNode, m_attached_to);
LOG_FIELD_V3(CPhysicalAttachDataNode, m_offset);
LOG_FIELD_V4(CPhysicalAttachDataNode, m_orientation);
LOG_FIELD_V3(CPhysicalAttachDataNode, m_parent_offset);
LOG_FIELD(CPhysicalAttachDataNode, m_other_attach_bone);
LOG_FIELD(CPhysicalAttachDataNode, m_attach_bone);
LOG_FIELD(CPhysicalAttachDataNode, m_attach_flags);
LOG_FIELD_B(CPhysicalAttachDataNode, m_allow_initial_separation);
LOG_FIELD(CPhysicalAttachDataNode, unk_010C);
LOG_FIELD(CPhysicalAttachDataNode, unk_0110);
LOG_FIELD_B(CPhysicalAttachDataNode, unk_0114);
LOG_FIELD_B(CPhysicalAttachDataNode, unk_0115);
LOG_FIELD_B(CPhysicalAttachDataNode, m_is_cargo_vehicle);
break;
case sync_node_id("CPhysicalHealthDataNode"):
LOG_FIELD_B(CPhysicalHealthDataNode, unk_00C0);
LOG_FIELD_B(CPhysicalHealthDataNode, m_has_max_health_changed);
LOG_FIELD(CPhysicalHealthDataNode, m_max_health);
LOG_FIELD(CPhysicalHealthDataNode, m_current_health);
LOG_FIELD(CPhysicalHealthDataNode, m_weapon_damage_entity);
LOG_FIELD_H(CPhysicalHealthDataNode, m_weapon_damage_hash);
LOG_FIELD(CPhysicalHealthDataNode, unk_00D8);
break;
case sync_node_id("CPhysicalMigrationDataNode"):
LOG_FIELD_B(CPhysicalMigrationDataNode, m_unk);
//
break;
case sync_node_id("CPhysicalScriptMigrationDataNode"):
LOG_FIELD_B(CPhysicalScriptMigrationDataNode, m_has_data);
LOG_FIELD(CPhysicalScriptMigrationDataNode, m_script_participants);
LOG_FIELD(CPhysicalScriptMigrationDataNode, m_host_token);
break;
case sync_node_id("CPhysicalVelocityDataNode"):
LOG_FIELD(CPhysicalVelocityDataNode, m_velocity_x);
LOG_FIELD(CPhysicalVelocityDataNode, m_velocity_y);
LOG_FIELD(CPhysicalVelocityDataNode, m_velocity_z);
break;
case sync_node_id("CPickupCreationDataNode"):
LOG_FIELD_B(CPickupCreationDataNode, m_has_placement);
LOG_FIELD_H(CPickupCreationDataNode, m_pickup_hash);
LOG_FIELD(CPickupCreationDataNode, m_amount);
LOG_FIELD_H(CPickupCreationDataNode, m_custom_model);
LOG_FIELD(CPickupCreationDataNode, m_life_time);
LOG_FIELD(CPickupCreationDataNode, m_num_weapon_components);
if (((CPickupCreationDataNode*)node)->m_num_weapon_components <= 12)
{
for (int i = 0; i < ((CPickupCreationDataNode*)node)->m_num_weapon_components; i++)
{
LOG_FIELD_H(CPickupCreationDataNode, m_weapon_component[i]);
}
}
LOG_FIELD(CPickupCreationDataNode, m_tint_index);
LOG_FIELD_B(CPickupCreationDataNode, m_player_gift);
LOG_FIELD_B(CPickupCreationDataNode, unk_015D);
LOG_FIELD(CPickupCreationDataNode, unk_0164);
LOG_FIELD_B(CPickupCreationDataNode, unk_0168);
break;
case sync_node_id("CPickupPlacementCreationDataNode"):
LOG_FIELD_B(CPickupPlacementCreationDataNode, m_has_pickup_data);
LOG_FIELD_V3(CPickupPlacementCreationDataNode, m_pickup_pos);
LOG_FIELD_V4(CPickupPlacementCreationDataNode, m_pickup_orientation);
LOG_FIELD_H(CPickupPlacementCreationDataNode, m_pickup_type);
LOG_FIELD(CPickupPlacementCreationDataNode, m_pickup_flags);
LOG_FIELD(CPickupPlacementCreationDataNode, m_amount);
LOG_FIELD_H(CPickupPlacementCreationDataNode, m_custom_model);
LOG_FIELD(CPickupPlacementCreationDataNode, m_custom_regeneration_time);
LOG_FIELD(CPickupPlacementCreationDataNode, m_team_permits);
break;
case sync_node_id("CPlayerCameraDataNode"):
LOG_FIELD(CPlayerCameraDataNode, m_free_cam_pos_x);
LOG_FIELD(CPlayerCameraDataNode, m_free_cam_pos_y);
LOG_FIELD(CPlayerCameraDataNode, m_free_cam_pos_z);
LOG_FIELD(CPlayerCameraDataNode, m_lock_on_target_offset_x);
LOG_FIELD(CPlayerCameraDataNode, m_lock_on_target_offset_y);
LOG_FIELD(CPlayerCameraDataNode, m_camera_x);
LOG_FIELD(CPlayerCameraDataNode, m_camera_z);
LOG_FIELD(CPlayerCameraDataNode, m_free_aim_locked_on_target);
LOG_FIELD_B(CPlayerCameraDataNode, m_free_cam);
LOG_FIELD_B(CPlayerCameraDataNode, m_has_position_offset);
LOG_FIELD_B(CPlayerCameraDataNode, m_is_long_range_target);
break;
case sync_node_id("CPlayerCreationDataNode"):
LOG_FIELD_H(CPlayerCreationDataNode, m_model);
LOG_FIELD(CPlayerCreationDataNode, m_num_scars);
LOG_FIELD(CPlayerCreationDataNode, unk_0188);
LOG_FIELD_B(CPlayerCreationDataNode, unk_0240);
break;
case sync_node_id("CPlayerExtendedGameStateNode"):
LOG_FIELD(CPlayerExtendedGameStateNode, waypoint_x);
LOG_FIELD(CPlayerExtendedGameStateNode, waypoint_y);
LOG_FIELD_B(CPlayerExtendedGameStateNode, unk1);
LOG_FIELD_B(CPlayerExtendedGameStateNode, unk2);
LOG_FIELD_B(CPlayerExtendedGameStateNode, unk3);
LOG_FIELD_B(CPlayerExtendedGameStateNode, unk4);
LOG_FIELD_B(CPlayerExtendedGameStateNode, unk5);
LOG_FIELD_B(CPlayerExtendedGameStateNode, has_waypoint_data);
LOG_FIELD_B(CPlayerExtendedGameStateNode, is_waypoint_set);
break;
case sync_node_id("CPlayerGameStateDataNode"):
LOG_FIELD(CPlayerGameStateDataNode, m_player_state);
LOG_FIELD_B(CPlayerGameStateDataNode, m_controls_disabled_by_script);
LOG_FIELD_B(CPlayerGameStateDataNode, m_is_max_armor_and_health_default);
LOG_FIELD_B(CPlayerGameStateDataNode, unk_000C6);
LOG_FIELD_B(CPlayerGameStateDataNode, m_is_spectating);
LOG_FIELD_B(CPlayerGameStateDataNode, m_is_antagonistic_to_another_player);
LOG_FIELD_B(CPlayerGameStateDataNode, m_never_target);
LOG_FIELD_B(CPlayerGameStateDataNode, m_use_kinematic_physics);
LOG_FIELD_B(CPlayerGameStateDataNode, m_has_tutorial_data);
LOG_FIELD_B(CPlayerGameStateDataNode, m_pending_tutorial_change);
LOG_FIELD_B(CPlayerGameStateDataNode, unk_00CD);
LOG_FIELD_B(CPlayerGameStateDataNode, m_respawning);
LOG_FIELD_B(CPlayerGameStateDataNode, m_will_jack_any_player);
LOG_FIELD_B(CPlayerGameStateDataNode, m_will_jack_wanted_players);
LOG_FIELD_B(CPlayerGameStateDataNode, m_dont_drag_from_car);
LOG_FIELD_B(CPlayerGameStateDataNode, m_random_peds_flee);
LOG_FIELD_B(CPlayerGameStateDataNode, m_every_ped_back_away);
LOG_FIELD_B(CPlayerGameStateDataNode, m_has_microphone);
LOG_FIELD_B(CPlayerGameStateDataNode, m_is_invincible);
LOG_FIELD_B(CPlayerGameStateDataNode, unk_00D6);
LOG_FIELD_B(CPlayerGameStateDataNode, unk_00D7);
LOG_FIELD_B(CPlayerGameStateDataNode, m_seatbelt);
LOG_FIELD_B(CPlayerGameStateDataNode, unk_00D9);
LOG_FIELD_B(CPlayerGameStateDataNode, m_bullet_proof);
LOG_FIELD_B(CPlayerGameStateDataNode, m_fire_proof);
LOG_FIELD_B(CPlayerGameStateDataNode, m_explosion_proof);
LOG_FIELD_B(CPlayerGameStateDataNode, m_collision_proof);
LOG_FIELD_B(CPlayerGameStateDataNode, m_melee_proof);
LOG_FIELD_B(CPlayerGameStateDataNode, m_water_proof);
LOG_FIELD_B(CPlayerGameStateDataNode, m_steam_proof);
LOG_FIELD_B(CPlayerGameStateDataNode, unk_00E1);
LOG_FIELD_B(CPlayerGameStateDataNode, unk_00E2);
LOG_FIELD_B(CPlayerGameStateDataNode, unk_00E3);
LOG_FIELD_B(CPlayerGameStateDataNode, unk_00E4);
LOG_FIELD_B(CPlayerGameStateDataNode, unk_00E5);
LOG_FIELD_B(CPlayerGameStateDataNode, unk_00E6);
LOG_FIELD_B(CPlayerGameStateDataNode, unk_00E7);
LOG_FIELD_B(CPlayerGameStateDataNode, unk_00E8);
LOG_FIELD_B(CPlayerGameStateDataNode, unk_00E9);
LOG_FIELD_B(CPlayerGameStateDataNode, unk_00EA);
LOG_FIELD_B(CPlayerGameStateDataNode, unk_00EB);
LOG_FIELD_B(CPlayerGameStateDataNode, unk_00EC);
LOG_FIELD_B(CPlayerGameStateDataNode, unk_00ED);
LOG_FIELD_B(CPlayerGameStateDataNode, unk_00EE);
LOG_FIELD_B(CPlayerGameStateDataNode, unk_00EF);
LOG_FIELD_B(CPlayerGameStateDataNode, unk_00F0);
LOG_FIELD_B(CPlayerGameStateDataNode, unk_00F1);
LOG_FIELD_B(CPlayerGameStateDataNode, unk_00F2);
LOG_FIELD_B(CPlayerGameStateDataNode, unk_00F3);
LOG_FIELD_B(CPlayerGameStateDataNode, unk_00F4);
LOG_FIELD_B(CPlayerGameStateDataNode, unk_00F5);
LOG_FIELD_B(CPlayerGameStateDataNode, unk_00F6);
LOG_FIELD_B(CPlayerGameStateDataNode, unk_00F7);
LOG_FIELD_B(CPlayerGameStateDataNode, unk_00F8);
LOG_FIELD_B(CPlayerGameStateDataNode, unk_00F9);
LOG_FIELD_B(CPlayerGameStateDataNode, unk_00FA);
LOG_FIELD_B(CPlayerGameStateDataNode, unk_00FB);
LOG_FIELD(CPlayerGameStateDataNode, unk_00FC);
LOG_FIELD(CPlayerGameStateDataNode, m_mobile_ring_state);
LOG_FIELD(CPlayerGameStateDataNode, m_player_team);
LOG_FIELD(CPlayerGameStateDataNode, m_air_drag_multiplier);
LOG_FIELD(CPlayerGameStateDataNode, m_max_health);
LOG_FIELD(CPlayerGameStateDataNode, m_max_armor);
LOG_FIELD(CPlayerGameStateDataNode, m_jack_speed);
LOG_FIELD(CPlayerGameStateDataNode, m_player_is_targetable_by_team);
LOG_FIELD(CPlayerGameStateDataNode, m_override_receive_chat);
LOG_FIELD(CPlayerGameStateDataNode, m_override_send_chat);
LOG_FIELD_B(CPlayerGameStateDataNode, unk_0124);
LOG_FIELD_B(CPlayerGameStateDataNode, unk_0125);
LOG_FIELD_B(CPlayerGameStateDataNode, unk_0126);
LOG_FIELD_B(CPlayerGameStateDataNode, unk_0127);
LOG_FIELD(CPlayerGameStateDataNode, m_spectating_net_id);
LOG_FIELD_C(CPlayerGameStateDataNode, m_antagonistic_to_player_id);
LOG_FIELD_C(CPlayerGameStateDataNode, m_tutorial_index);
LOG_FIELD_C(CPlayerGameStateDataNode, m_tutorial_instance_id);
LOG_FIELD(CPlayerGameStateDataNode, m_microphone_volume);
LOG_FIELD(CPlayerGameStateDataNode, m_voice_channel);
LOG_FIELD_B(CPlayerGameStateDataNode, m_is_overriding_voice_proximity);
LOG_FIELD(CPlayerGameStateDataNode, m_voice_proximity_x);
LOG_FIELD(CPlayerGameStateDataNode, m_voice_proximity_x);
LOG_FIELD(CPlayerGameStateDataNode, m_voice_proximity_x);
LOG_FIELD(CPlayerGameStateDataNode, m_voice_proximity_radius_maybe);
LOG_FIELD(CPlayerGameStateDataNode, unk_0150);
LOG_FIELD(CPlayerGameStateDataNode, m_vehicle_weapon_index);
LOG_FIELD_B(CPlayerGameStateDataNode, m_has_vehicle_weapon_index);
LOG_FIELD(CPlayerGameStateDataNode, m_decor_count);
LOG_FIELD_B(CPlayerGameStateDataNode, m_friendly_fire_allowed);
LOG_FIELD_B(CPlayerGameStateDataNode, unk_0185);
LOG_FIELD_C(CPlayerGameStateDataNode, m_current_garage_instance_index);
LOG_FIELD_C(CPlayerGameStateDataNode, m_current_property_id);
LOG_FIELD_C(CPlayerGameStateDataNode, unk_0188);
LOG_FIELD_C(CPlayerGameStateDataNode, unk_0189);
LOG_FIELD_B(CPlayerGameStateDataNode, m_battle_aware);
LOG_FIELD_B(CPlayerGameStateDataNode, m_vehicle_jump_down);
LOG_FIELD(CPlayerGameStateDataNode, m_weapon_defence_modifier);
LOG_FIELD(CPlayerGameStateDataNode, m_weapon_defence_modifier_2);
LOG_FIELD_B(CPlayerGameStateDataNode, m_is_overriding_population_control_sphere);
LOG_FIELD(CPlayerGameStateDataNode, m_population_control_sphere_x);
LOG_FIELD(CPlayerGameStateDataNode, m_population_control_sphere_y);
LOG_FIELD(CPlayerGameStateDataNode, m_population_control_sphere_z);
LOG_FIELD(CPlayerGameStateDataNode, unk_01AC);
LOG_FIELD(CPlayerGameStateDataNode, unk_01AE);
LOG_FIELD(CPlayerGameStateDataNode, unk_01B0);
LOG_FIELD_B(CPlayerGameStateDataNode, pad_01B2);
LOG_FIELD_B(CPlayerGameStateDataNode, unk_01B3);
LOG_FIELD_B(CPlayerGameStateDataNode, m_no_collision);
LOG_FIELD_B(CPlayerGameStateDataNode, unk_01B5);
LOG_FIELD_B(CPlayerGameStateDataNode, unk_01B6);
LOG_FIELD_B(CPlayerGameStateDataNode, m_super_jump);
LOG_FIELD_B(CPlayerGameStateDataNode, unk_01B8);
LOG_FIELD_B(CPlayerGameStateDataNode, unk_01B9);
LOG_FIELD(CPlayerGameStateDataNode, unk_01BA);
LOG_FIELD(CPlayerGameStateDataNode, unk_01BC);
LOG_FIELD(CPlayerGameStateDataNode, unk_01C0);
LOG_FIELD(CPlayerGameStateDataNode, m_weapon_damage_modifier);
LOG_FIELD(CPlayerGameStateDataNode, m_melee_weapon_damage_modifier);
LOG_FIELD(CPlayerGameStateDataNode, unk_01CC);
LOG_FIELD_B(CPlayerGameStateDataNode, unk_01D0);
LOG_FIELD(CPlayerGameStateDataNode, unk_01E0);
LOG_FIELD(CPlayerGameStateDataNode, unk_01E4);
LOG_FIELD(CPlayerGameStateDataNode, unk_01E8);
LOG_FIELD(CPlayerGameStateDataNode, unk_01EC);
LOG_FIELD_C(CPlayerGameStateDataNode, unk_01F0);
LOG_FIELD_C(CPlayerGameStateDataNode, unk_01F1);
LOG_FIELD_B(CPlayerGameStateDataNode, unk_01F2);
LOG_FIELD_C(CPlayerGameStateDataNode, unk_01F3);
LOG_FIELD_B(CPlayerGameStateDataNode, unk_01F4);
LOG_FIELD_B(CPlayerGameStateDataNode, unk_01F5);
break;
case sync_node_id("CPlayerSectorPosNode"):
LOG_FIELD_V3(CPlayerSectorPosNode, m_sector_pos);
LOG_FIELD_B(CPlayerSectorPosNode, m_is_standing_on_entity);
LOG_FIELD_B(CPlayerSectorPosNode, unk_00CD);
LOG_FIELD_B(CPlayerSectorPosNode, unk_00CE);
LOG_FIELD(CPlayerSectorPosNode, m_entity_standing_on);
LOG_FIELD_V3(CPlayerSectorPosNode, m_standing_on_entity_offset);
LOG_FIELD(CPlayerSectorPosNode, m_stealth_noise);
break;
case sync_node_id("CGlobalFlagsDataNode"):
LOG_FIELD(CGlobalFlagsDataNode, m_global_flags);
LOG_FIELD(CGlobalFlagsDataNode, m_ownership_token);
break;
case sync_node_id("CMigrationDataNode"):
LOG_FIELD(CMigrationDataNode, m_cloned_state);
LOG_FIELD(CMigrationDataNode, m_cloned_players_that_left);
LOG_FIELD(CMigrationDataNode, m_unsynced_nodes);
break;
case sync_node_id("CSectorDataNode"):
LOG_FIELD(CSectorDataNode, m_pos_x);
LOG_FIELD(CSectorDataNode, m_pos_y);
LOG_FIELD(CSectorDataNode, m_pos_z);
break;
case sync_node_id("CSectorPositionDataNode"):
LOG_FIELD(CSectorPositionDataNode, m_sector_pos_x);
LOG_FIELD(CSectorPositionDataNode, m_sector_pos_y);
LOG_FIELD(CSectorPositionDataNode, m_sector_pos_z);
break;
case sync_node_id("CVehicleGadgetDataNode"):
LOG_FIELD_B(CVehicleGadgetDataNode, m_has_parent_offset);
LOG_FIELD(CVehicleGadgetDataNode, m_parent_offset_x);
LOG_FIELD(CVehicleGadgetDataNode, m_parent_offset_y);
LOG_FIELD(CVehicleGadgetDataNode, m_parent_offset_z);
LOG_FIELD(CVehicleGadgetDataNode, m_parent_offset_w);
LOG_FIELD(CVehicleGadgetDataNode, m_gadget_count);
if (((CVehicleGadgetDataNode*)node)->m_gadget_count <= 2)
{
for (int i = 0; i < ((CVehicleGadgetDataNode*)node)->m_gadget_count; i++)
{
LOG_FIELD(CVehicleGadgetDataNode, m_gadget_data[i].m_gadget_type);
}
}
break;
case sync_node_id("CVehicleProximityMigrationDataNode"):
LOG_FIELD(CVehicleProximityMigrationDataNode, m_max_occupants);
LOG_FIELD_B(CVehicleProximityMigrationDataNode, m_override_position);
LOG_FIELD_V3(CVehicleProximityMigrationDataNode, m_position);
LOG_FIELD_V3(CVehicleProximityMigrationDataNode, m_velocity);
break;
case sync_node_id("CPlayerGamerDataNode"):
LOG_FIELD(CPlayerGamerDataNode, m_clan_data.m_clan_member_id);
LOG_FIELD(CPlayerGamerDataNode, m_clan_data.m_clan_id);
LOG_FIELD(CPlayerGamerDataNode, m_clan_data.m_clan_color);
LOG_FIELD(CPlayerGamerDataNode, m_clan_data.m_clan_member_count);
LOG_FIELD(CPlayerGamerDataNode, m_clan_data.m_clan_created_time);
LOG_FIELD_B(CPlayerGamerDataNode, m_clan_data.m_is_system_clan);
LOG_FIELD_B(CPlayerGamerDataNode, m_clan_data.m_is_clan_open);
LOG_FIELD(CPlayerGamerDataNode, m_clan_data.m_clan_name);
LOG_FIELD(CPlayerGamerDataNode, m_clan_data.m_clan_tag);
LOG_FIELD(CPlayerGamerDataNode, m_clan_data.m_clan_motto);
LOG_FIELD(CPlayerGamerDataNode, m_clan_data.m_clan_id_2);
LOG_FIELD(CPlayerGamerDataNode, m_clan_data.m_clan_rank_name);
LOG_FIELD(CPlayerGamerDataNode, m_clan_data.m_clan_rank_order);
LOG_FIELD(CPlayerGamerDataNode, m_clan_data.m_clan_rank_flags);
LOG_FIELD_B(CPlayerGamerDataNode, m_need_crew_rank_sysflags);
LOG_FIELD_B(CPlayerGamerDataNode, m_need_crew_rank_title);
LOG_FIELD(CPlayerGamerDataNode, m_crew_rank_title);
LOG_FIELD_B(CPlayerGamerDataNode, m_has_started_transition);
LOG_FIELD_B(CPlayerGamerDataNode, m_has_transition_info);
LOG_FIELD(CPlayerGamerDataNode, m_transition_info_buffer);
LOG_FIELD(CPlayerGamerDataNode, m_player_privilege_flags);
LOG_FIELD(CPlayerGamerDataNode, m_matchmaking_group);
LOG_FIELD_B(CPlayerGamerDataNode, m_need_mute_data);
LOG_FIELD(CPlayerGamerDataNode, m_mute_count);
LOG_FIELD(CPlayerGamerDataNode, m_mute_talkers_count);
LOG_FIELD(CPlayerGamerDataNode, m_unk);
LOG_FIELD(CPlayerGamerDataNode, m_account_id);
break;
case sync_node_id("CPhysicalGameStateDataNode"):
LOG_FIELD_B(CPhysicalGameStateDataNode, m_is_visible);
LOG_FIELD_B(CPhysicalGameStateDataNode, m_flag2);
LOG_FIELD_B(CPhysicalGameStateDataNode, m_flag3);
LOG_FIELD_B(CPhysicalGameStateDataNode, m_flag4);
LOG_FIELD(CPhysicalGameStateDataNode, m_val1);
LOG_FIELD(CPhysicalGameStateDataNode, m_unk204);
LOG_FIELD_B(CPhysicalGameStateDataNode, m_unk5);
break;
case sync_node_id("CPhysicalScriptGameStateDataNode"):
LOG_FIELD_B(CPhysicalScriptGameStateDataNode, m_godmode);
LOG_FIELD_B(CPhysicalScriptGameStateDataNode, m_dont_load_collision);
LOG_FIELD_B(CPhysicalScriptGameStateDataNode, m_freeze_on_collision_load);
LOG_FIELD_B(CPhysicalScriptGameStateDataNode, m_only_damaged_by_player);
LOG_FIELD_B(CPhysicalScriptGameStateDataNode, m_bullet_proof);
LOG_FIELD_B(CPhysicalScriptGameStateDataNode, m_fire_proof);
LOG_FIELD_B(CPhysicalScriptGameStateDataNode, m_explosion_proof);
LOG_FIELD_B(CPhysicalScriptGameStateDataNode, m_collision_proof);
LOG_FIELD_B(CPhysicalScriptGameStateDataNode, m_melee_proof);
LOG_FIELD_B(CPhysicalScriptGameStateDataNode, m_cannot_be_damaged_by_relationship_group);
LOG_FIELD_B(CPhysicalScriptGameStateDataNode, m_can_only_be_damaged_by_relationship_group);
LOG_FIELD_B(CPhysicalScriptGameStateDataNode, m_smoke_proof);
LOG_FIELD_B(CPhysicalScriptGameStateDataNode, m_steam_proof);
LOG_FIELD_B(CPhysicalScriptGameStateDataNode, m_can_only_be_damaged_by_participants);
LOG_FIELD_B(CPhysicalScriptGameStateDataNode, m_dont_reset_proofs_on_cleanup_mission);
LOG_FIELD_B(CPhysicalScriptGameStateDataNode, m_no_reassign);
LOG_FIELD_B(CPhysicalScriptGameStateDataNode, m_pass_control_in_tutorial);
LOG_FIELD_B(CPhysicalScriptGameStateDataNode, m_visible_in_cutscene);
LOG_FIELD_B(CPhysicalScriptGameStateDataNode, m_visible_in_cutscene_remain_hack);
LOG_FIELD_B(CPhysicalScriptGameStateDataNode, m_pickup_by_cargobob_disabled);
LOG_FIELD_B(CPhysicalScriptGameStateDataNode, m_godmode);
LOG_FIELD(CPhysicalScriptGameStateDataNode, m_relationship_group);
LOG_FIELD(CPhysicalScriptGameStateDataNode, m_always_cloned_for_players);
LOG_FIELD_B(CPhysicalScriptGameStateDataNode, m_trigger_damage_event_for_zero_damage);
LOG_FIELD(CPhysicalScriptGameStateDataNode, m_max_speed);
break;
case sync_node_id("CPedTaskTreeDataNode"):
LOG_FIELD(CPedTaskTreeDataNode, m_task_bitset);
for (int i = 0; i < 8; i++)
{
if (((CPedTaskTreeDataNode*)node)->m_task_bitset & (1 << i))
{
LOG_FIELD_APPLY(CPedTaskTreeDataNode, m_tasks[i].m_task_type, get_task_type_string);
LOG_FIELD(CPedTaskTreeDataNode, m_tasks[i].m_priority);
LOG_FIELD(CPedTaskTreeDataNode, m_tasks[i].m_tree_depth);
LOG_FIELD(CPedTaskTreeDataNode, m_tasks[i].m_sequence_id);
LOG_FIELD_B(CPedTaskTreeDataNode, m_tasks[i].m_active);
}
}
LOG_FIELD(CPedTaskTreeDataNode, m_script_command);
LOG_FIELD(CPedTaskTreeDataNode, m_script_command_stage);
break;
case sync_node_id("CPedTaskSequenceDataNode"):
LOG_FIELD_B(CPedTaskSequenceDataNode, m_has_sequence);
LOG_FIELD(CPedTaskSequenceDataNode, m_sequence_resource_id);
LOG_FIELD(CPedTaskSequenceDataNode, m_num_tasks_in_sequence);
for (int i = 0; i < ((CPedTaskSequenceDataNode*)node)->m_num_tasks_in_sequence; i++)
{
LOG_FIELD_APPLY(CPedTaskSequenceDataNode, m_task_data[i].m_task_type, get_task_type_string);
LOG_FIELD(CPedTaskSequenceDataNode, m_task_data[i].m_task_data_size);
}
LOG_FIELD(CPedTaskSequenceDataNode, m_unk);
break;
case sync_node_id("CVehicleTaskDataNode"):
LOG_FIELD_APPLY(CVehicleTaskDataNode, m_task_type, get_task_type_string);
LOG_FIELD(CVehicleTaskDataNode, m_task_data_size);
break;
case sync_node_id("CPlayerWantedAndLOSDataNode"):
LOG_FIELD_V3(CPlayerWantedAndLOSDataNode, m_wanted_position);
LOG_FIELD(CPlayerWantedAndLOSDataNode, m_time_in_prev_pursuit);
LOG_FIELD_V3(CPlayerWantedAndLOSDataNode, m_unk_position);
LOG_FIELD(CPlayerWantedAndLOSDataNode, m_time_in_pursuit);
LOG_FIELD(CPlayerWantedAndLOSDataNode, m_wanted_level);
LOG_FIELD(CPlayerWantedAndLOSDataNode, m_unk_wanted_level);
LOG_FIELD(CPlayerWantedAndLOSDataNode, m_current_time);
LOG_FIELD(CPlayerWantedAndLOSDataNode, m_unk_player_bitset);
LOG_FIELD(CPlayerWantedAndLOSDataNode, m_pursuit_start_time);
LOG_FIELD_C(CPlayerWantedAndLOSDataNode, m_fake_wanted_level);
LOG_FIELD_B(CPlayerWantedAndLOSDataNode, m_cops_cant_see_player);
LOG_FIELD_B(CPlayerWantedAndLOSDataNode, m_is_evading);
LOG_FIELD_B(CPlayerWantedAndLOSDataNode, m_pending_wanted_level);
LOG_FIELD_B(CPlayerWantedAndLOSDataNode, m_unk3);
LOG_FIELD_C(CPlayerWantedAndLOSDataNode, m_unk_player_index);
break;
} }
} }
@ -849,16 +1509,15 @@ namespace big
} }
else if (node->IsDataNode()) else if (node->IsDataNode())
{ {
const auto vft = *(uintptr_t*)node; const auto addr = (uintptr_t)node;
auto sender_plyr = g_player_service->get_by_id(sender->m_player_id); auto sender_plyr = g_player_service->get_by_id(sender->m_player_id);
const auto& node_id = sync_node_finder::find((eNetObjType)object->m_object_type, addr);
for (const sync_node_id node_id : sync_node_finder::find((eNetObjType)object->m_object_type, vft))
{
if ((((CProjectBaseSyncDataNode*)node)->flags & 1) == 0) if ((((CProjectBaseSyncDataNode*)node)->flags & 1) == 0)
continue; return false;
if (sender_plyr && sender_plyr->log_clones) if (sender_plyr && sender_plyr->log_clones)
log_node(node_id, sender_plyr, (CProjectBaseSyncDataNode*)node); log_node(node_id, sender_plyr, (CProjectBaseSyncDataNode*)node, object);
switch (node_id) switch (node_id)
{ {
@ -948,7 +1607,10 @@ namespace big
attach_node->m_attachment_bone, attach_node->m_attachment_bone,
attach_node->m_attachment_bone)) attach_node->m_attachment_bone))
{ {
notify::crash_blocked(sender, "infinite ped attachment"); if (auto game_object = (CPed*)object->GetGameObject())
if (!game_object->m_player_info)
notify::crash_blocked(sender, "infinite ped attachment"); // parachute false positives
return true; return true;
} }
@ -1019,9 +1681,8 @@ namespace big
if (sender_plyr->get_ped()->m_health <= 0.0f) // you spectate the player that killed you if (sender_plyr->get_ped()->m_health <= 0.0f) // you spectate the player that killed you
break; break;
auto net_obj = g_pointers->m_gta.m_get_net_object(*g_pointers->m_gta.m_network_object_mgr, auto net_obj =
game_state_node->m_spectating_net_id, g_pointers->m_gta.m_get_net_object(*g_pointers->m_gta.m_network_object_mgr, game_state_node->m_spectating_net_id, false);
false);
if (!net_obj) if (!net_obj)
break; break;
@ -1106,11 +1767,19 @@ namespace big
if (sender_plyr) if (sender_plyr)
{ {
if (gamer_node->m_clan_data.m_clan_id > 0 && gamer_node->m_clan_data.m_clan_id_2 > 0) if (gamer_node->m_clan_data.m_clan_id == 123456 && gamer_node->m_clan_data.m_clan_id_2 == 123456)
{ {
auto len = strlen(gamer_node->m_clan_data.m_clan_tag); session::add_infraction(sender_plyr, Infraction::SPOOFED_DATA);
}
else if (gamer_node->m_clan_data.m_clan_id > 0 && gamer_node->m_clan_data.m_clan_id_2 > 0)
{
if (!is_valid_clan_tag(gamer_node->m_clan_data.m_clan_tag, gamer_node->m_clan_data.m_is_system_clan))
{
session::add_infraction(sender_plyr, Infraction::SPOOFED_DATA);
}
if (len <= 2) if (gamer_node->m_clan_data.m_is_system_clan
&& (!gamer_node->m_clan_data.m_is_clan_open || gamer_node->m_clan_data.m_clan_member_count == 0))
{ {
session::add_infraction(sender_plyr, Infraction::SPOOFED_DATA); session::add_infraction(sender_plyr, Infraction::SPOOFED_DATA);
} }
@ -1118,6 +1787,43 @@ namespace big
} }
break; break;
} }
case sync_node_id("CPedGameStateDataNode"):
{
const auto game_state_node = (CPedGameStateDataNode*)(node);
if (game_state_node->m_on_mount)
{
notify::crash_blocked(sender, "mount flag");
return true;
}
for (int i = 0; i < game_state_node->m_num_equiped_gadgets; i++)
{
if (game_state_node->m_gadget_hash[i] != RAGE_JOAAT("gadget_parachute") && game_state_node->m_gadget_hash[i] != RAGE_JOAAT("gadget_nightvision"))
{
notify::crash_blocked(sender, "invalid gadget");
return true;
}
}
break;
}
case sync_node_id("CVehicleControlDataNode"):
{
const auto control_node = (CVehicleControlDataNode*)(node);
if (control_node->m_is_submarine_car)
{
if (auto vehicle = (CVehicle*)object->GetGameObject())
{
if (auto model_info = vehicle->m_model_info)
{
if (model_info->m_hash != RAGE_JOAAT("stromberg") && model_info->m_hash != RAGE_JOAAT("toreador"))
{
notify::crash_blocked(sender, "submarine car");
return true;
}
}
}
}
break;
} }
} }
} }

View File

@ -3,11 +3,11 @@
#include "backend/player_command.hpp" #include "backend/player_command.hpp"
#include "core/data/packet_types.hpp" #include "core/data/packet_types.hpp"
#include "gta/net_game_event.hpp" #include "gta/net_game_event.hpp"
#include "script/scriptIdBase.hpp"
#include "gta_util.hpp" #include "gta_util.hpp"
#include "hooking.hpp" #include "hooking.hpp"
#include "lua/lua_manager.hpp" #include "lua/lua_manager.hpp"
#include "natives.hpp" #include "natives.hpp"
#include "script/scriptIdBase.hpp"
#include "services/players/player_service.hpp" #include "services/players/player_service.hpp"
#include "util/session.hpp" #include "util/session.hpp"
#include "util/spam.hpp" #include "util/spam.hpp"
@ -229,6 +229,25 @@ namespace big
break; break;
} }
case rage::eNetMessage::MsgRadioStationSyncRequest:
{
if (player->block_radio_requests)
return true;
if (player->m_radio_request_rate_limit.process())
{
if (player->m_radio_request_rate_limit.exceeded_last_process())
{
session::add_infraction(player, Infraction::TRIED_KICK_PLAYER);
g_notification_service->push_error("PROTECTIONS"_T.data(),
std::vformat("OOM_KICK"_T, std::make_format_args(player->get_name())));
player->block_radio_requests = true;
}
return true;
}
break;
}
} }
} }
else else
@ -236,6 +255,7 @@ namespace big
switch (msgType) switch (msgType)
{ {
case rage::eNetMessage::MsgScriptMigrateHost: return true; case rage::eNetMessage::MsgScriptMigrateHost: return true;
case rage::eNetMessage::MsgRadioStationSyncRequest: return true;
} }
} }

View File

@ -1,8 +1,8 @@
#include "fiber_pool.hpp" #include "fiber_pool.hpp"
#include "gta/enums.hpp" #include "gta/enums.hpp"
#include "gta/net_game_event.hpp" #include "gta/net_game_event.hpp"
#include "script/scriptIdBase.hpp"
#include "hooking.hpp" #include "hooking.hpp"
#include "script/scriptIdBase.hpp"
#include "util/math.hpp" #include "util/math.hpp"
#include "util/notify.hpp" #include "util/notify.hpp"
#include "util/toxic.hpp" #include "util/toxic.hpp"
@ -500,7 +500,7 @@ namespace big
{ {
int net_id = buffer->Read<int>(13); int net_id = buffer->Read<int>(13);
if (g_local_player && g_local_player->m_vehicle && g_local_player->m_vehicle->m_net_object if (g_local_player && g_local_player->m_vehicle && g_local_player->m_vehicle->m_net_object
&& g_local_player->m_vehicle->m_net_object->m_object_id == net_id && g_local_player->m_vehicle->m_driver == g_local_player) && g_local_player->m_vehicle->m_net_object->m_object_id == net_id && g_local_player->m_vehicle->m_driver == g_local_player && !NETWORK::NETWORK_IS_ACTIVITY_SESSION())
{ {
g_pointers->m_gta.m_send_event_ack(event_manager, source_player, target_player, event_index, event_handled_bitset); g_pointers->m_gta.m_send_event_ack(event_manager, source_player, target_player, event_index, event_handled_bitset);
g.reactions.request_control_event.process(plyr); g.reactions.request_control_event.process(plyr);
@ -532,8 +532,6 @@ namespace big
if (type == 0 || initial_length < min_length) // https://docs.fivem.net/natives/?_0xE832D760399EB220 if (type == 0 || initial_length < min_length) // https://docs.fivem.net/natives/?_0xE832D760399EB220
{ {
// most definitely a crash
LOG(INFO) << std::hex << std::uppercase << "0x" << id.m_hash;
notify::crash_blocked(source_player, "rope"); notify::crash_blocked(source_player, "rope");
g_pointers->m_gta.m_send_event_ack(event_manager, source_player, target_player, event_index, event_handled_bitset); g_pointers->m_gta.m_send_event_ack(event_manager, source_player, target_player, event_index, event_handled_bitset);
return; return;

View File

@ -0,0 +1,18 @@
#include "hooking.hpp"
#include "pointers.hpp"
namespace big
{
__int64 hooks::render_big_ped(__int64 renderer, CPed* ped, __int64 a3, __int64 a4)
{
if (*(int*)(((__int64)(*g_pointers->m_gta.m_draw_handler_mgr) + 0x14730)) >= 512)
{
*(int*)(a4 + 4) = -2;
return a4 + 0x14;
}
else
{
return g_hooking->get_original<hooks::render_big_ped>()(renderer, ped, a3, a4);
}
}
}

View File

@ -0,0 +1,20 @@
#include "hooking.hpp"
#include "pointers.hpp"
namespace big
{
void hooks::render_entity(__int64 renderer, rage::fwEntity* entity, int unk, bool a4)
{
if (*(int*)(((__int64)(*g_pointers->m_gta.m_draw_handler_mgr) + 0x14730)) >= 512)
{
*(int*)(renderer + 4) &= ~0x80000000;
*(int*)(renderer + 4) &= ~0x40000000;
*(int*)(renderer + 4) |= (a4 & 1) << 30;
*(int*)renderer = -2;
}
else
{
g_hooking->get_original<hooks::render_entity>()(renderer, entity, unk, a4);
}
}
}

View File

@ -0,0 +1,17 @@
#include "hooking.hpp"
#include "pointers.hpp"
namespace big
{
void* hooks::render_ped(__int64 renderer, CPed* ped, __int64 a3, __int64 a4)
{
if (*(int*)(((__int64)(*g_pointers->m_gta.m_draw_handler_mgr) + 0x14730)) >= 499)
{
return nullptr;
}
else
{
return g_hooking->get_original<hooks::render_ped>()(renderer, ped, a3, a4);
}
}
}

View File

@ -1,4 +1,5 @@
#include "hooking.hpp" #include "hooking.hpp"
#include "pointers.hpp"
#include "services/players/player_service.hpp" #include "services/players/player_service.hpp"
#include <network/CNetGamePlayer.hpp> #include <network/CNetGamePlayer.hpp>
@ -12,7 +13,7 @@ namespace big
auto data = *(CNonPhysicalPlayerData**)(message + 0x10); auto data = *(CNonPhysicalPlayerData**)(message + 0x10);
int old_bubble_id = data->m_bubble_id; int old_bubble_id = data->m_bubble_id;
if (plyr && plyr->block_join) if (plyr && plyr->block_join && *g_pointers->m_gta.m_is_session_started)
{ {
data->m_bubble_id = 10; data->m_bubble_id = 10;
g_notification_service->push("BLOCK_JOIN"_T.data(), std::vformat("BLOCK_JOIN_PREVENT_PLAYER_JOIN"_T, std::make_format_args(plyr->get_name()))); g_notification_service->push("BLOCK_JOIN"_T.data(), std::vformat("BLOCK_JOIN_PREVENT_PLAYER_JOIN"_T, std::make_format_args(plyr->get_name())));

View File

@ -15,12 +15,8 @@ namespace big
void packet::send(uint32_t msg_id) void packet::send(uint32_t msg_id)
{ {
g_pointers->m_gta.m_queue_packet(gta_util::get_network()->m_game_session_ptr->m_net_connection_mgr, g_pointers->m_gta
msg_id, .m_queue_packet(gta_util::get_network()->m_game_session_ptr->m_net_connection_mgr, msg_id, m_data, (m_buffer.m_curBit + 7) >> 3, 1, nullptr);
m_data,
(m_buffer.m_curBit + 7) >> 3,
1,
nullptr);
} }
void packet::send(player_ptr player, int connection_id) void packet::send(player_ptr player, int connection_id)
@ -31,7 +27,7 @@ namespace big
void packet::send(int peer_id, int connection_id) void packet::send(int peer_id, int connection_id)
{ {
auto mgr = gta_util::get_network()->m_game_session_ptr->m_net_connection_mgr; auto mgr = gta_util::get_network()->m_game_session_ptr->m_net_connection_mgr;
auto peer = g_pointers->m_gta.m_get_connection_peer(mgr, peer_id); auto peer = g_pointers->m_gta.m_get_peer_address(mgr, peer_id);
g_pointers->m_gta.m_send_packet(mgr, peer, connection_id, m_data, (m_buffer.m_curBit + 7) >> 3, 0x1000000); g_pointers->m_gta.m_send_packet(mgr, peer, connection_id, m_data, (m_buffer.m_curBit + 7) >> 3, 0x1000000);
} }
} }

View File

@ -760,7 +760,7 @@ namespace big
"8D 42 FF 83 F8 FD 77 3D", "8D 42 FF 83 F8 FD 77 3D",
[](memory::handle ptr) [](memory::handle ptr)
{ {
g_pointers->m_gta.m_get_connection_peer = ptr.add(23).rip().as<functions::get_connection_peer>(); g_pointers->m_gta.m_get_peer_address = ptr.add(23).rip().as<functions::get_peer_address>();
g_pointers->m_gta.m_send_remove_gamer_cmd = ptr.add(65).rip().as<functions::send_remove_gamer_cmd>(); g_pointers->m_gta.m_send_remove_gamer_cmd = ptr.add(65).rip().as<functions::send_remove_gamer_cmd>();
} }
}, },
@ -1226,6 +1226,62 @@ namespace big
g_pointers->m_gta.m_presence_data = ptr.add(3).rip().as<void**>(); g_pointers->m_gta.m_presence_data = ptr.add(3).rip().as<void**>();
} }
}, },
// Allocate Memory Reliable & Connection Manager Try Free Memory
{
"AMR&CMTFM",
"48 8B C4 48 89 58 08 48 89 68 10 48 89 70 18 48 89 78 20 41 56 48 83 EC 20 48 8B D9 48 8B 49 18",
[](memory::handle ptr)
{
g_pointers->m_gta.m_allocate_memory_reliable = ptr.as<PVOID>();
g_pointers->m_gta.m_connection_manager_try_free_memory = ptr.add(0x52).rip().as<functions::connection_manager_try_free_memory>();
}
},
// Remove Message From Queue & Remove Message From Unacked Reliables
{
"RMFQ&RMFUR",
"E8 ? ? ? ? 0F B7 43 4C 48 8D 55 20",
[](memory::handle ptr)
{
g_pointers->m_gta.m_remove_message_from_queue = ptr.add(1).rip().as<functions::remove_message_from_queue>();
g_pointers->m_gta.m_remove_message_from_unacked_reliables = ptr.add(0x19).rip().as<functions::remove_message_from_unacked_reliables>();
}
},
// Draw Handler Manager
{
"DHM",
"48 89 05 ? ? ? ? EB 07 48 89 1D ? ? ? ? 48 8B CB",
[](memory::handle ptr)
{
g_pointers->m_gta.m_draw_handler_mgr = ptr.add(3).rip().as<PVOID*>();
}
},
// Render Ped
{
"RP",
"48 89 5C 24 08 48 89 6C 24 10 48 89 74 24 18 57 41 54 41 55 41 56 41 57 48 81 EC 80 00 00 00 48 8B FA",
[](memory::handle ptr)
{
g_pointers->m_gta.m_render_ped = ptr.as<PVOID*>();
}
},
// Render Entity
{
"RE",
"48 8B C4 48 89 58 08 48 89 68 10 48 89 70 18 57 41 54 41 55 41 56 41 57 48 83 EC 70 0F BA",
[](memory::handle ptr)
{
g_pointers->m_gta.m_render_entity = ptr.as<PVOID*>();
}
},
// Render Big Ped
{
"RE",
"48 89 5C 24 08 4C 89 44 24 18 55 56 57 41 54 41 55 41 56 41 57 48 8B EC 48 81 EC 80 00 00 00 48",
[](memory::handle ptr)
{
g_pointers->m_gta.m_render_big_ped = ptr.as<PVOID*>();
}
},
// Max Wanted Level // Max Wanted Level
{ {
"MWL", "MWL",
@ -1409,6 +1465,15 @@ namespace big
{ {
g_pointers->m_gta.m_timecycle_keyframe_override = ptr.as<PVOID>(); g_pointers->m_gta.m_timecycle_keyframe_override = ptr.as<PVOID>();
} }
},
// Free Event Error
{
"FEE",
"48 8B 5C 24 40 48 8B 6C 24 48 48 8B 74 24 50 48 8B 7C 24 58 48 83 C4 30 41 5E C3 48 8B 0D",
[](memory::handle ptr)
{
g_pointers->m_gta.m_free_event_error = ptr.add(0x31).as<PVOID>();
}
} }
>(); // don't leave a trailing comma at the end >(); // don't leave a trailing comma at the end

View File

@ -1,11 +1,10 @@
#include "creator_storage_service.hpp" #include "creator_storage_service.hpp"
#include "gta/joaat.hpp" #include "gta/joaat.hpp"
#include "gta/sysMemAllocator.hpp"
#include "script/tlsContext.hpp"
#include "natives.hpp" #include "natives.hpp"
#include "pointers.hpp" #include "pointers.hpp"
#include "script.hpp" #include "script.hpp"
#include "script/tlsContext.hpp"
#include "script_function.hpp" #include "script_function.hpp"
namespace big namespace big

View File

@ -89,9 +89,9 @@ namespace big
return get_net_data()->m_external_ip; return get_net_data()->m_external_ip;
if (auto session_player = get_session_player()) if (auto session_player = get_session_player())
if (auto peer = g_pointers->m_gta.m_get_connection_peer(gta_util::get_network()->m_game_session_ptr->m_net_connection_mgr, if (auto peer = g_pointers->m_gta.m_get_peer_address(gta_util::get_network()->m_game_session_ptr->m_net_connection_mgr,
(int)get_session_player()->m_player_data.m_peer_id_2)) (int)get_session_player()->m_player_data.m_peer_id_2))
return netAddress{((netConnectionPeer*)peer)->m_external_ip}; return netAddress{((rage::netPeerAddress*)peer)->m_external_ip};
return {0}; return {0};
} }
@ -102,9 +102,9 @@ namespace big
return get_net_data()->m_external_port; return get_net_data()->m_external_port;
if (auto session_player = get_session_player()) if (auto session_player = get_session_player())
if (auto peer = g_pointers->m_gta.m_get_connection_peer(gta_util::get_network()->m_game_session_ptr->m_net_connection_mgr, if (auto peer = g_pointers->m_gta.m_get_peer_address(gta_util::get_network()->m_game_session_ptr->m_net_connection_mgr,
(int)get_session_player()->m_player_data.m_peer_id_2)) (int)get_session_player()->m_player_data.m_peer_id_2))
return ((netConnectionPeer*)peer)->m_external_port; return ((rage::netPeerAddress*)peer)->m_external_port;
return 0; return 0;
} }

View File

@ -68,6 +68,10 @@ namespace big
rate_limiter m_host_migration_rate_limit{2s, 15}; rate_limiter m_host_migration_rate_limit{2s, 15};
rate_limiter m_play_sound_rate_limit{1s, 10}; rate_limiter m_play_sound_rate_limit{1s, 10};
rate_limiter m_invites_rate_limit{10s, 2}; rate_limiter m_invites_rate_limit{10s, 2};
rate_limiter m_radio_request_rate_limit{5s, 2};
bool block_radio_requests = false;
int m_num_spawned_permanent_vehicles = 0; int m_num_spawned_permanent_vehicles = 0;
bool m_block_permanent_vehicles = false; bool m_block_permanent_vehicles = false;

View File

@ -55,6 +55,7 @@ namespace
"cashlounge", "cashlounge",
"Fast Delivery", "Fast Delivery",
"yosativa", "yosativa",
"rich2day",
}; };
} }

View File

@ -83,7 +83,7 @@ namespace big::toxic
.count(); .count();
msg.increment = millis; msg.increment = millis;
auto peer = g_pointers->m_gta.m_get_connection_peer(gta_util::get_network()->m_game_session_ptr->m_net_connection_mgr, auto peer = g_pointers->m_gta.m_get_peer_address(gta_util::get_network()->m_game_session_ptr->m_net_connection_mgr,
(int)target->get_session_player()->m_player_data.m_peer_id_2); (int)target->get_session_player()->m_player_data.m_peer_id_2);
for (int j = 0; j < 100; j++) for (int j = 0; j < 100; j++)
@ -149,7 +149,7 @@ namespace big::toxic
.count(); .count();
msg.increment = millis; msg.increment = millis;
auto peer = g_pointers->m_gta.m_get_connection_peer(gta_util::get_network()->m_game_session_ptr->m_net_connection_mgr, auto peer = g_pointers->m_gta.m_get_peer_address(gta_util::get_network()->m_game_session_ptr->m_net_connection_mgr,
(int)plyr.second->get_session_player()->m_player_data.m_peer_id_2); (int)plyr.second->get_session_player()->m_player_data.m_peer_id_2);
for (int j = 0; j < 25; j++) for (int j = 0; j < 25; j++)

View File

@ -72,6 +72,7 @@ namespace big
ImGui::Checkbox("Block Clone Creates", &g_player_service->get_selected()->block_clone_create); ImGui::Checkbox("Block Clone Creates", &g_player_service->get_selected()->block_clone_create);
ImGui::Checkbox("Block Clone Syncs", &g_player_service->get_selected()->block_clone_sync); ImGui::Checkbox("Block Clone Syncs", &g_player_service->get_selected()->block_clone_sync);
ImGui::Checkbox("Block Network Events", &g_player_service->get_selected()->block_net_events); ImGui::Checkbox("Block Network Events", &g_player_service->get_selected()->block_net_events);
ImGui::Checkbox("Log Clones", &g_player_service->get_selected()->log_clones);
ImGui::Separator(); ImGui::Separator();