diff --git a/scripts/gtav-classes.cmake b/scripts/gtav-classes.cmake index e5436c88..0f7c611f 100644 --- a/scripts/gtav-classes.cmake +++ b/scripts/gtav-classes.cmake @@ -3,7 +3,7 @@ include(FetchContent) FetchContent_Declare( gtav_classes GIT_REPOSITORY https://github.com/Yimura/GTAV-Classes.git - GIT_TAG c5c72f78ffef24ea7faf8791b37fb6d61c1b5fc4 + GIT_TAG 9bf112e0431e3618978a8dd2fec12ffeeb7dd7ce GIT_PROGRESS TRUE CONFIGURE_COMMAND "" BUILD_COMMAND "" diff --git a/src/hooks/protections/can_apply_data.cpp b/src/hooks/protections/can_apply_data.cpp index 47db27e8..0d144e27 100644 --- a/src/hooks/protections/can_apply_data.cpp +++ b/src/hooks/protections/can_apply_data.cpp @@ -28,88 +28,506 @@ namespace big { - constexpr auto nodes = std::to_array>({ - {RAGE_JOAAT("CAutomobileCreationDataNode"), 0x1b088e0 + 64}, - {RAGE_JOAAT("CBikeGameStateDataNode"), 0x1b08a40 + 64}, - {RAGE_JOAAT("CBoatGameStateDataNode"), 0x1b08a80 + 64}, - {RAGE_JOAAT("CDoorCreationDataNode"), 0x1b08be0 + 64}, - {RAGE_JOAAT("CDoorMovementDataNode"), 0x1b09000 + 64}, - {RAGE_JOAAT("CDoorScriptGameStateDataNode"), 0x1b08ea0 + 64}, - {RAGE_JOAAT("CDoorScriptInfoDataNode"), 0x1b08d40 + 64}, - {RAGE_JOAAT("CDynamicEntityGameStateDataNode"), 0x1b06450 + 64}, - {RAGE_JOAAT("CEntityOrientationDataNode"), 0x1b05df0 + 64}, - {RAGE_JOAAT("CEntityScriptGameStateDataNode"), 0x1b05c90 + 64}, - {RAGE_JOAAT("CEntityScriptInfoDataNode"), 0x1b05b30 + 64}, - {RAGE_JOAAT("CGlobalFlagsDataNode"), 0x1b057f0 + 64}, - {RAGE_JOAAT("CHeliControlDataNode"), 0x1b08180 + 64}, - {RAGE_JOAAT("CHeliHealthDataNode"), 0x1b06f60 + 64}, - {RAGE_JOAAT("CMigrationDataNode"), 0x1b05af0 + 64}, - {RAGE_JOAAT("CObjectCreationDataNode"), 0x1b096e0 + 64}, - {RAGE_JOAAT("CObjectGameStateDataNode"), 0x1b09840 + 64}, - {RAGE_JOAAT("CObjectOrientationNode"), 0x1b09c60 + 64}, - {RAGE_JOAAT("CObjectScriptGameStateDataNode"), 0x1b099a0 + 64}, - {RAGE_JOAAT("CObjectSectorPosNode"), 0x1b09b00 + 64}, - {RAGE_JOAAT("CPedAIDataNode"), 0x1b0ae80 + 64}, - {RAGE_JOAAT("CPedAppearanceDataNode"), 0x1b0ad20 + 64}, - {RAGE_JOAAT("CPedAttachDataNode"), 0x1b0a900 + 64}, - {RAGE_JOAAT("CPedComponentReservationDataNode"), 0x1b0a380 + 64}, - {RAGE_JOAAT("CPedCreationDataNode"), 0x1b09ca0 + 64}, - {RAGE_JOAAT("CPedGameStateDataNode"), 0x1b09f60 + 64}, - {RAGE_JOAAT("CPedHealthDataNode"), 0x1b0a7a0 + 64}, - {RAGE_JOAAT("CPedInventoryDataNode"), 0x1b0b2a0 + 64}, - {RAGE_JOAAT("CPedMovementDataNode"), 0x1b0abc0 + 64}, - {RAGE_JOAAT("CPedMovementGroupDataNode"), 0x1b0aa60 + 64}, - {RAGE_JOAAT("CPedOrientationDataNode"), 0x1b0a640 + 64}, - {RAGE_JOAAT("CPedScriptCreationDataNode"), 0x1b09e00 + 64}, - {RAGE_JOAAT("CPedScriptGameStateDataNode"), 0x1b0a4e0 + 64}, - {RAGE_JOAAT("CPedSectorPosMapNode"), 0x1b05ab0 + 64}, - {RAGE_JOAAT("CPedSectorPosNavMeshNode"), 0x1b0a220 + 64}, - {RAGE_JOAAT("CPedTaskSequenceDataNode"), 0x1b0b400 + 64}, - {RAGE_JOAAT("CPedTaskSpecificDataNode"), 0x1b0b140 + 64}, - {RAGE_JOAAT("CPedTaskTreeDataNode"), 0x1b0afe0 + 64}, - {RAGE_JOAAT("CPhysicalAngVelocityDataNode"), 0x1b06f20 + 64}, - {RAGE_JOAAT("CPhysicalAttachDataNode"), 0x1b06fa0 + 64}, - {RAGE_JOAAT("CPhysicalGameStateDataNode"), 0x1b06b00 + 64}, - {RAGE_JOAAT("CPhysicalHealthDataNode"), 0x1b06f60 + 64}, - {RAGE_JOAAT("CPhysicalMigrationDataNode"), 0x1b07100 + 64}, - {RAGE_JOAAT("CPhysicalScriptGameStateDataNode"), 0x1b06c60 + 64}, - {RAGE_JOAAT("CPhysicalScriptMigrationDataNode"), 0x1b07140 + 64}, - {RAGE_JOAAT("CPhysicalVelocityDataNode"), 0x1b06dc0 + 64}, - {RAGE_JOAAT("CPickupCreationDataNode"), 0x1b0b560 + 64}, - {RAGE_JOAAT("CPickupPlacementCreationDataNode"), 0x1b0b860 + 64}, - {RAGE_JOAAT("CPickupPlacementStateDataNode"), 0x1b0b9c0 + 64}, - {RAGE_JOAAT("CPickupScriptGameStateNode"), 0x1b0b820 + 64}, - {RAGE_JOAAT("CPickupSectorPosNode"), 0x1b0b6c0 + 64}, - {RAGE_JOAAT("CPlaneControlDataNode"), 0x1b08180 + 64}, - {RAGE_JOAAT("CPlaneGameStateDataNode"), 0x1b0c380 + 64}, - {RAGE_JOAAT("CPlayerAmbientModelStreamingNode"), 0x1b0c040 + 64}, - {RAGE_JOAAT("CPlayerAppearanceDataNode"), 0x1b0bc20 + 64}, - {RAGE_JOAAT("CPlayerCameraDataNode"), 0x1b0bba0 + 64}, - {RAGE_JOAAT("CPlayerCreationDataNode"), 0x1b0ba00 + 64}, - {RAGE_JOAAT("CPlayerExtendedGameStateNode"), 0x1b0c300 + 64}, - {RAGE_JOAAT("CPlayerGameStateDataNode"), 0x1b0bbe0 + 64}, - {RAGE_JOAAT("CPlayerGamerDataNode"), 0x1b0c1a0 + 64}, - {RAGE_JOAAT("CPlayerPedGroupDataNode"), 0x1b0bd80 + 64}, - {RAGE_JOAAT("CPlayerSectorPosNode"), 0x1b0bb60 + 64}, - {RAGE_JOAAT("CPlayerWantedAndLOSDataNode"), 0x1b0bee0 + 64}, - {RAGE_JOAAT("CSectorDataNode"), 0x1b05950 + 64}, - {RAGE_JOAAT("CSectorPositionDataNode"), 0x1b05ab0 + 64}, - {RAGE_JOAAT("CSubmarineControlDataNode"), 0x1b08180 + 64}, - {RAGE_JOAAT("CSubmarineGameStateDataNode"), 0x1b092c0 + 64}, - {RAGE_JOAAT("CTrainGameStateDataNode"), 0x1b0c340 + 64}, - {RAGE_JOAAT("CVehicleAngVelocityDataNode"), 0x1b06f20 + 64}, - {RAGE_JOAAT("CVehicleAppearanceDataNode"), 0x1b082e0 + 64}, - {RAGE_JOAAT("CVehicleComponentReservationDataNode"), 0x1b085e0 + 64}, - {RAGE_JOAAT("CVehicleControlDataNode"), 0x1b08180 + 64}, - {RAGE_JOAAT("CVehicleCreationDataNode"), 0x1b07940 + 64}, - {RAGE_JOAAT("CVehicleDamageStatusDataNode"), 0x1b08440 + 64}, - {RAGE_JOAAT("CVehicleGadgetDataNode"), 0x1b08780 + 64}, - {RAGE_JOAAT("CVehicleGameStateDataNode"), 0x1b07c00 + 64}, - {RAGE_JOAAT("CVehicleHealthDataNode"), 0x1b07ec0 + 64}, - {RAGE_JOAAT("CVehicleProximityMigrationDataNode"), 0x1b08740 + 64}, - {RAGE_JOAAT("CVehicleScriptGameStateDataNode"), 0x1b07d60 + 64}, - {RAGE_JOAAT("CVehicleSteeringDataNode"), 0x1b08020 + 64}, - {RAGE_JOAAT("CVehicleTaskDataNode"), 0x1b085a0 + 64} }); + static std::vector>> trees = { + { RAGE_JOAAT("CAutomobileSyncTree"), { + RAGE_JOAAT("CVehicleCreationDataNode"), + RAGE_JOAAT("CAutomobileCreationDataNode"), + RAGE_JOAAT("CGlobalFlagsDataNode"), + RAGE_JOAAT("CDynamicEntityGameStateDataNode"), + RAGE_JOAAT("CPhysicalGameStateDataNode"), + RAGE_JOAAT("CVehicleGameStateDataNode"), + RAGE_JOAAT("CEntityScriptGameStateDataNode"), + RAGE_JOAAT("CPhysicalScriptGameStateDataNode"), + RAGE_JOAAT("CVehicleScriptGameStateDataNode"), + RAGE_JOAAT("CEntityScriptInfoDataNode"), + RAGE_JOAAT("CPhysicalAttachDataNode"), + RAGE_JOAAT("CVehicleAppearanceDataNode"), + RAGE_JOAAT("CVehicleDamageStatusDataNode"), + RAGE_JOAAT("CVehicleComponentReservationDataNode"), + RAGE_JOAAT("CVehicleHealthDataNode"), + RAGE_JOAAT("CVehicleTaskDataNode"), + RAGE_JOAAT("CSectorDataNode"), + RAGE_JOAAT("CSectorPositionDataNode"), + RAGE_JOAAT("CEntityOrientationDataNode"), + RAGE_JOAAT("CPhysicalVelocityDataNode"), + RAGE_JOAAT("CVehicleAngVelocityDataNode"), + RAGE_JOAAT("CVehicleSteeringDataNode"), + RAGE_JOAAT("CVehicleControlDataNode"), + RAGE_JOAAT("CVehicleGadgetDataNode"), + RAGE_JOAAT("CMigrationDataNode"), + RAGE_JOAAT("CPhysicalMigrationDataNode"), + RAGE_JOAAT("CPhysicalScriptMigrationDataNode"), + RAGE_JOAAT("CVehicleProximityMigrationDataNode"), + } + }, + { RAGE_JOAAT("CBikeSyncTree"), { + RAGE_JOAAT("CVehicleCreationDataNode"), + RAGE_JOAAT("CGlobalFlagsDataNode"), + RAGE_JOAAT("CDynamicEntityGameStateDataNode"), + RAGE_JOAAT("CPhysicalGameStateDataNode"), + RAGE_JOAAT("CVehicleGameStateDataNode"), + RAGE_JOAAT("CBikeGameStateDataNode"), + RAGE_JOAAT("CEntityScriptGameStateDataNode"), + RAGE_JOAAT("CPhysicalScriptGameStateDataNode"), + RAGE_JOAAT("CVehicleScriptGameStateDataNode"), + RAGE_JOAAT("CEntityScriptInfoDataNode"), + RAGE_JOAAT("CPhysicalAttachDataNode"), + RAGE_JOAAT("CVehicleAppearanceDataNode"), + RAGE_JOAAT("CVehicleDamageStatusDataNode"), + RAGE_JOAAT("CVehicleComponentReservationDataNode"), + RAGE_JOAAT("CVehicleHealthDataNode"), + RAGE_JOAAT("CVehicleTaskDataNode"), + RAGE_JOAAT("CSectorDataNode"), + RAGE_JOAAT("CSectorPositionDataNode"), + RAGE_JOAAT("CEntityOrientationDataNode"), + RAGE_JOAAT("CPhysicalVelocityDataNode"), + RAGE_JOAAT("CVehicleAngVelocityDataNode"), + RAGE_JOAAT("CVehicleSteeringDataNode"), + RAGE_JOAAT("CVehicleControlDataNode"), + RAGE_JOAAT("CVehicleGadgetDataNode"), + RAGE_JOAAT("CMigrationDataNode"), + RAGE_JOAAT("CPhysicalMigrationDataNode"), + RAGE_JOAAT("CPhysicalScriptMigrationDataNode"), + RAGE_JOAAT("CVehicleProximityMigrationDataNode"), + } + }, + { RAGE_JOAAT("CBoatSyncTree"), { + RAGE_JOAAT("CVehicleCreationDataNode"), + RAGE_JOAAT("CGlobalFlagsDataNode"), + RAGE_JOAAT("CDynamicEntityGameStateDataNode"), + RAGE_JOAAT("CPhysicalGameStateDataNode"), + RAGE_JOAAT("CVehicleGameStateDataNode"), + RAGE_JOAAT("CBoatGameStateDataNode"), + RAGE_JOAAT("CEntityScriptGameStateDataNode"), + RAGE_JOAAT("CPhysicalScriptGameStateDataNode"), + RAGE_JOAAT("CVehicleScriptGameStateDataNode"), + RAGE_JOAAT("CEntityScriptInfoDataNode"), + RAGE_JOAAT("CPhysicalAttachDataNode"), + RAGE_JOAAT("CVehicleAppearanceDataNode"), + RAGE_JOAAT("CVehicleDamageStatusDataNode"), + RAGE_JOAAT("CVehicleComponentReservationDataNode"), + RAGE_JOAAT("CVehicleHealthDataNode"), + RAGE_JOAAT("CVehicleTaskDataNode"), + RAGE_JOAAT("CSectorDataNode"), + RAGE_JOAAT("CSectorPositionDataNode"), + RAGE_JOAAT("CEntityOrientationDataNode"), + RAGE_JOAAT("CPhysicalVelocityDataNode"), + RAGE_JOAAT("CVehicleAngVelocityDataNode"), + RAGE_JOAAT("CVehicleSteeringDataNode"), + RAGE_JOAAT("CVehicleControlDataNode"), + RAGE_JOAAT("CVehicleGadgetDataNode"), + RAGE_JOAAT("CMigrationDataNode"), + RAGE_JOAAT("CPhysicalMigrationDataNode"), + RAGE_JOAAT("CPhysicalScriptMigrationDataNode"), + RAGE_JOAAT("CVehicleProximityMigrationDataNode"), + } + }, + { RAGE_JOAAT("CDoorSyncTree"), { + RAGE_JOAAT("CDoorCreationDataNode"), + RAGE_JOAAT("CGlobalFlagsDataNode"), + RAGE_JOAAT("CDoorScriptInfoDataNode"), + RAGE_JOAAT("CDoorScriptGameStateDataNode"), + RAGE_JOAAT("CDoorMovementDataNode"), + RAGE_JOAAT("CMigrationDataNode"), + RAGE_JOAAT("CPhysicalScriptMigrationDataNode"), + } + }, + { RAGE_JOAAT("CHeliSyncTree"), { + RAGE_JOAAT("CVehicleCreationDataNode"), + RAGE_JOAAT("CAutomobileCreationDataNode"), + RAGE_JOAAT("CGlobalFlagsDataNode"), + RAGE_JOAAT("CDynamicEntityGameStateDataNode"), + RAGE_JOAAT("CPhysicalGameStateDataNode"), + RAGE_JOAAT("CVehicleGameStateDataNode"), + RAGE_JOAAT("CEntityScriptGameStateDataNode"), + RAGE_JOAAT("CPhysicalScriptGameStateDataNode"), + RAGE_JOAAT("CVehicleScriptGameStateDataNode"), + RAGE_JOAAT("CEntityScriptInfoDataNode"), + RAGE_JOAAT("CPhysicalAttachDataNode"), + RAGE_JOAAT("CVehicleAppearanceDataNode"), + RAGE_JOAAT("CVehicleDamageStatusDataNode"), + RAGE_JOAAT("CVehicleComponentReservationDataNode"), + RAGE_JOAAT("CVehicleHealthDataNode"), + RAGE_JOAAT("CVehicleTaskDataNode"), + RAGE_JOAAT("CHeliHealthDataNode"), + RAGE_JOAAT("CSectorDataNode"), + RAGE_JOAAT("CSectorPositionDataNode"), + RAGE_JOAAT("CEntityOrientationDataNode"), + RAGE_JOAAT("CPhysicalVelocityDataNode"), + RAGE_JOAAT("CVehicleAngVelocityDataNode"), + RAGE_JOAAT("CVehicleSteeringDataNode"), + RAGE_JOAAT("CVehicleControlDataNode"), + RAGE_JOAAT("CVehicleGadgetDataNode"), + RAGE_JOAAT("CHeliControlDataNode"), + RAGE_JOAAT("CMigrationDataNode"), + RAGE_JOAAT("CPhysicalMigrationDataNode"), + RAGE_JOAAT("CPhysicalScriptMigrationDataNode"), + RAGE_JOAAT("CVehicleProximityMigrationDataNode"), + } + }, + { RAGE_JOAAT("CObjectSyncTree"), { + RAGE_JOAAT("CObjectCreationDataNode"), + RAGE_JOAAT("CGlobalFlagsDataNode"), + RAGE_JOAAT("CDynamicEntityGameStateDataNode"), + RAGE_JOAAT("CPhysicalGameStateDataNode"), + RAGE_JOAAT("CObjectGameStateDataNode"), + RAGE_JOAAT("CEntityScriptGameStateDataNode"), + RAGE_JOAAT("CPhysicalScriptGameStateDataNode"), + RAGE_JOAAT("CObjectScriptGameStateDataNode"), + RAGE_JOAAT("CEntityScriptInfoDataNode"), + RAGE_JOAAT("CPhysicalAttachDataNode"), + RAGE_JOAAT("CPhysicalHealthDataNode"), + RAGE_JOAAT("CSectorDataNode"), + RAGE_JOAAT("CObjectSectorPosNode"), + RAGE_JOAAT("CObjectOrientationNode"), + RAGE_JOAAT("CPhysicalVelocityDataNode"), + RAGE_JOAAT("CPhysicalAngVelocityDataNode"), + RAGE_JOAAT("CMigrationDataNode"), + RAGE_JOAAT("CPhysicalMigrationDataNode"), + RAGE_JOAAT("CPhysicalScriptMigrationDataNode"), + } + }, + { RAGE_JOAAT("CPedSyncTree"), { + RAGE_JOAAT("CPedCreationDataNode"), + RAGE_JOAAT("CPedScriptCreationDataNode"), + RAGE_JOAAT("CGlobalFlagsDataNode"), + RAGE_JOAAT("CDynamicEntityGameStateDataNode"), + RAGE_JOAAT("CPhysicalGameStateDataNode"), + RAGE_JOAAT("CPedGameStateDataNode"), + RAGE_JOAAT("CPedComponentReservationDataNode"), + RAGE_JOAAT("CEntityScriptGameStateDataNode"), + RAGE_JOAAT("CPhysicalScriptGameStateDataNode"), + RAGE_JOAAT("CPedScriptGameStateDataNode"), + RAGE_JOAAT("CEntityScriptInfoDataNode"), + RAGE_JOAAT("CPedAttachDataNode"), + RAGE_JOAAT("CPedHealthDataNode"), + RAGE_JOAAT("CPedMovementGroupDataNode"), + RAGE_JOAAT("CPedAIDataNode"), + RAGE_JOAAT("CPedAppearanceDataNode"), + RAGE_JOAAT("CPedOrientationDataNode"), + RAGE_JOAAT("CPedMovementDataNode"), + RAGE_JOAAT("CPedTaskTreeDataNode"), + RAGE_JOAAT("CPedTaskSpecificDataNode"), + RAGE_JOAAT("CPedTaskSpecificDataNode"), + RAGE_JOAAT("CPedTaskSpecificDataNode"), + RAGE_JOAAT("CPedTaskSpecificDataNode"), + RAGE_JOAAT("CPedTaskSpecificDataNode"), + RAGE_JOAAT("CPedTaskSpecificDataNode"), + RAGE_JOAAT("CPedTaskSpecificDataNode"), + RAGE_JOAAT("CPedTaskSpecificDataNode"), + RAGE_JOAAT("CSectorDataNode"), + RAGE_JOAAT("CPedSectorPosMapNode"), + RAGE_JOAAT("CPedSectorPosNavMeshNode"), + RAGE_JOAAT("CMigrationDataNode"), + RAGE_JOAAT("CPhysicalMigrationDataNode"), + RAGE_JOAAT("CPhysicalScriptMigrationDataNode"), + RAGE_JOAAT("CPedInventoryDataNode"), + RAGE_JOAAT("CPedTaskSequenceDataNode"), + } + }, + { RAGE_JOAAT("CPickupSyncTree"), { + RAGE_JOAAT("CPickupCreationDataNode"), + RAGE_JOAAT("CGlobalFlagsDataNode"), + RAGE_JOAAT("CDynamicEntityGameStateDataNode"), + RAGE_JOAAT("CPickupScriptGameStateNode"), + RAGE_JOAAT("CPhysicalGameStateDataNode"), + RAGE_JOAAT("CEntityScriptGameStateDataNode"), + RAGE_JOAAT("CPhysicalScriptGameStateDataNode"), + RAGE_JOAAT("CEntityScriptInfoDataNode"), + RAGE_JOAAT("CPhysicalHealthDataNode"), + RAGE_JOAAT("CPhysicalAttachDataNode"), + RAGE_JOAAT("CSectorDataNode"), + RAGE_JOAAT("CPickupSectorPosNode"), + RAGE_JOAAT("CEntityOrientationDataNode"), + RAGE_JOAAT("CPhysicalVelocityDataNode"), + RAGE_JOAAT("CPhysicalAngVelocityDataNode"), + RAGE_JOAAT("CMigrationDataNode"), + RAGE_JOAAT("CPhysicalMigrationDataNode"), + RAGE_JOAAT("CPhysicalScriptMigrationDataNode"), + } + }, + { RAGE_JOAAT("CPickupPlacementSyncTree"), { + RAGE_JOAAT("CPickupPlacementCreationDataNode"), + RAGE_JOAAT("CMigrationDataNode"), + RAGE_JOAAT("CGlobalFlagsDataNode"), + RAGE_JOAAT("CPickupPlacementStateDataNode"), + } + }, + { RAGE_JOAAT("CPlaneSyncTree"), { + RAGE_JOAAT("CVehicleCreationDataNode"), + RAGE_JOAAT("CGlobalFlagsDataNode"), + RAGE_JOAAT("CDynamicEntityGameStateDataNode"), + RAGE_JOAAT("CPhysicalGameStateDataNode"), + RAGE_JOAAT("CVehicleGameStateDataNode"), + RAGE_JOAAT("CEntityScriptGameStateDataNode"), + RAGE_JOAAT("CPhysicalScriptGameStateDataNode"), + RAGE_JOAAT("CVehicleScriptGameStateDataNode"), + RAGE_JOAAT("CEntityScriptInfoDataNode"), + RAGE_JOAAT("CPhysicalAttachDataNode"), + RAGE_JOAAT("CVehicleAppearanceDataNode"), + RAGE_JOAAT("CVehicleDamageStatusDataNode"), + RAGE_JOAAT("CVehicleComponentReservationDataNode"), + RAGE_JOAAT("CVehicleHealthDataNode"), + RAGE_JOAAT("CVehicleTaskDataNode"), + RAGE_JOAAT("CPlaneGameStateDataNode"), + RAGE_JOAAT("CSectorDataNode"), + RAGE_JOAAT("CSectorPositionDataNode"), + RAGE_JOAAT("CEntityOrientationDataNode"), + RAGE_JOAAT("CPhysicalVelocityDataNode"), + RAGE_JOAAT("CVehicleAngVelocityDataNode"), + RAGE_JOAAT("CVehicleSteeringDataNode"), + RAGE_JOAAT("CVehicleControlDataNode"), + RAGE_JOAAT("CVehicleGadgetDataNode"), + RAGE_JOAAT("CPlaneControlDataNode"), + RAGE_JOAAT("CMigrationDataNode"), + RAGE_JOAAT("CPhysicalMigrationDataNode"), + RAGE_JOAAT("CPhysicalScriptMigrationDataNode"), + RAGE_JOAAT("CVehicleProximityMigrationDataNode"), + } + }, + { RAGE_JOAAT("CSubmarineSyncTree"), { + RAGE_JOAAT("CVehicleCreationDataNode"), + RAGE_JOAAT("CGlobalFlagsDataNode"), + RAGE_JOAAT("CDynamicEntityGameStateDataNode"), + RAGE_JOAAT("CPhysicalGameStateDataNode"), + RAGE_JOAAT("CVehicleGameStateDataNode"), + RAGE_JOAAT("CSubmarineGameStateDataNode"), + RAGE_JOAAT("CEntityScriptGameStateDataNode"), + RAGE_JOAAT("CPhysicalScriptGameStateDataNode"), + RAGE_JOAAT("CVehicleScriptGameStateDataNode"), + RAGE_JOAAT("CEntityScriptInfoDataNode"), + RAGE_JOAAT("CPhysicalAttachDataNode"), + RAGE_JOAAT("CVehicleAppearanceDataNode"), + RAGE_JOAAT("CVehicleDamageStatusDataNode"), + RAGE_JOAAT("CVehicleComponentReservationDataNode"), + RAGE_JOAAT("CVehicleHealthDataNode"), + RAGE_JOAAT("CVehicleTaskDataNode"), + RAGE_JOAAT("CSectorDataNode"), + RAGE_JOAAT("CSectorPositionDataNode"), + RAGE_JOAAT("CEntityOrientationDataNode"), + RAGE_JOAAT("CPhysicalVelocityDataNode"), + RAGE_JOAAT("CVehicleAngVelocityDataNode"), + RAGE_JOAAT("CVehicleSteeringDataNode"), + RAGE_JOAAT("CVehicleControlDataNode"), + RAGE_JOAAT("CVehicleGadgetDataNode"), + RAGE_JOAAT("CSubmarineControlDataNode"), + RAGE_JOAAT("CMigrationDataNode"), + RAGE_JOAAT("CPhysicalMigrationDataNode"), + RAGE_JOAAT("CPhysicalScriptMigrationDataNode"), + RAGE_JOAAT("CVehicleProximityMigrationDataNode"), + } + }, + { RAGE_JOAAT("CPlayerSyncTree"), { + RAGE_JOAAT("CPlayerCreationDataNode"), + RAGE_JOAAT("CGlobalFlagsDataNode"), + RAGE_JOAAT("CDynamicEntityGameStateDataNode"), + RAGE_JOAAT("CPhysicalGameStateDataNode"), + RAGE_JOAAT("CPedGameStateDataNode"), + RAGE_JOAAT("CPedComponentReservationDataNode"), + RAGE_JOAAT("CEntityScriptGameStateDataNode"), + RAGE_JOAAT("CPlayerGameStateDataNode"), + RAGE_JOAAT("CPedAttachDataNode"), + RAGE_JOAAT("CPedHealthDataNode"), + RAGE_JOAAT("CPedMovementGroupDataNode"), + RAGE_JOAAT("CPedAIDataNode"), + RAGE_JOAAT("CPlayerAppearanceDataNode"), + RAGE_JOAAT("CPlayerPedGroupDataNode"), + RAGE_JOAAT("CPlayerAmbientModelStreamingNode"), + RAGE_JOAAT("CPlayerGamerDataNode"), + RAGE_JOAAT("CPlayerExtendedGameStateNode"), + RAGE_JOAAT("CPedOrientationDataNode"), + RAGE_JOAAT("CPedMovementDataNode"), + RAGE_JOAAT("CPedTaskTreeDataNode"), + RAGE_JOAAT("CPedTaskSpecificDataNode"), + RAGE_JOAAT("CPedTaskSpecificDataNode"), + RAGE_JOAAT("CPedTaskSpecificDataNode"), + RAGE_JOAAT("CPedTaskSpecificDataNode"), + RAGE_JOAAT("CPedTaskSpecificDataNode"), + RAGE_JOAAT("CPedTaskSpecificDataNode"), + RAGE_JOAAT("CPedTaskSpecificDataNode"), + RAGE_JOAAT("CPedTaskSpecificDataNode"), + RAGE_JOAAT("CSectorDataNode"), + RAGE_JOAAT("CPlayerSectorPosNode"), + RAGE_JOAAT("CPlayerCameraDataNode"), + RAGE_JOAAT("CPlayerWantedAndLOSDataNode"), + RAGE_JOAAT("CMigrationDataNode"), + RAGE_JOAAT("CPhysicalMigrationDataNode"), + RAGE_JOAAT("CPhysicalScriptMigrationDataNode"), + } + }, + { RAGE_JOAAT("CAutomobileSyncTree"), { + RAGE_JOAAT("CVehicleCreationDataNode"), + RAGE_JOAAT("CAutomobileCreationDataNode"), + RAGE_JOAAT("CGlobalFlagsDataNode"), + RAGE_JOAAT("CDynamicEntityGameStateDataNode"), + RAGE_JOAAT("CPhysicalGameStateDataNode"), + RAGE_JOAAT("CVehicleGameStateDataNode"), + RAGE_JOAAT("CEntityScriptGameStateDataNode"), + RAGE_JOAAT("CPhysicalScriptGameStateDataNode"), + RAGE_JOAAT("CVehicleScriptGameStateDataNode"), + RAGE_JOAAT("CEntityScriptInfoDataNode"), + RAGE_JOAAT("CPhysicalAttachDataNode"), + RAGE_JOAAT("CVehicleAppearanceDataNode"), + RAGE_JOAAT("CVehicleDamageStatusDataNode"), + RAGE_JOAAT("CVehicleComponentReservationDataNode"), + RAGE_JOAAT("CVehicleHealthDataNode"), + RAGE_JOAAT("CVehicleTaskDataNode"), + RAGE_JOAAT("CSectorDataNode"), + RAGE_JOAAT("CSectorPositionDataNode"), + RAGE_JOAAT("CEntityOrientationDataNode"), + RAGE_JOAAT("CPhysicalVelocityDataNode"), + RAGE_JOAAT("CVehicleAngVelocityDataNode"), + RAGE_JOAAT("CVehicleSteeringDataNode"), + RAGE_JOAAT("CVehicleControlDataNode"), + RAGE_JOAAT("CVehicleGadgetDataNode"), + RAGE_JOAAT("CMigrationDataNode"), + RAGE_JOAAT("CPhysicalMigrationDataNode"), + RAGE_JOAAT("CPhysicalScriptMigrationDataNode"), + RAGE_JOAAT("CVehicleProximityMigrationDataNode"), + } + }, + { RAGE_JOAAT("CTrainSyncTree"), { + RAGE_JOAAT("CVehicleCreationDataNode"), + RAGE_JOAAT("CGlobalFlagsDataNode"), + RAGE_JOAAT("CDynamicEntityGameStateDataNode"), + RAGE_JOAAT("CPhysicalGameStateDataNode"), + RAGE_JOAAT("CVehicleGameStateDataNode"), + RAGE_JOAAT("CTrainGameStateDataNode"), + RAGE_JOAAT("CEntityScriptGameStateDataNode"), + RAGE_JOAAT("CPhysicalScriptGameStateDataNode"), + RAGE_JOAAT("CVehicleScriptGameStateDataNode"), + RAGE_JOAAT("CEntityScriptInfoDataNode"), + RAGE_JOAAT("CPhysicalAttachDataNode"), + RAGE_JOAAT("CVehicleAppearanceDataNode"), + RAGE_JOAAT("CVehicleDamageStatusDataNode"), + RAGE_JOAAT("CVehicleComponentReservationDataNode"), + RAGE_JOAAT("CVehicleHealthDataNode"), + RAGE_JOAAT("CVehicleTaskDataNode"), + RAGE_JOAAT("CSectorDataNode"), + RAGE_JOAAT("CSectorPositionDataNode"), + RAGE_JOAAT("CEntityOrientationDataNode"), + RAGE_JOAAT("CPhysicalVelocityDataNode"), + RAGE_JOAAT("CVehicleAngVelocityDataNode"), + RAGE_JOAAT("CVehicleSteeringDataNode"), + RAGE_JOAAT("CVehicleControlDataNode"), + RAGE_JOAAT("CVehicleGadgetDataNode"), + RAGE_JOAAT("CMigrationDataNode"), + RAGE_JOAAT("CPhysicalMigrationDataNode"), + RAGE_JOAAT("CPhysicalScriptMigrationDataNode"), + RAGE_JOAAT("CVehicleProximityMigrationDataNode"), + } + }, + }; + + static auto nodes = std::to_array>({ + {RAGE_JOAAT("CAutomobileCreationDataNode"), 0}, + {RAGE_JOAAT("CBikeGameStateDataNode"), 0}, + {RAGE_JOAAT("CBoatGameStateDataNode"), 0}, + {RAGE_JOAAT("CDoorCreationDataNode"), 0}, + {RAGE_JOAAT("CDoorMovementDataNode"), 0}, + {RAGE_JOAAT("CDoorScriptGameStateDataNode"), 0}, + {RAGE_JOAAT("CDoorScriptInfoDataNode"), 0}, + {RAGE_JOAAT("CDynamicEntityGameStateDataNode"), 0}, + {RAGE_JOAAT("CEntityOrientationDataNode"), 0}, + {RAGE_JOAAT("CEntityScriptGameStateDataNode"), 0}, + {RAGE_JOAAT("CEntityScriptInfoDataNode"), 0}, + {RAGE_JOAAT("CGlobalFlagsDataNode"), 0}, + {RAGE_JOAAT("CHeliControlDataNode"), 0}, + {RAGE_JOAAT("CHeliHealthDataNode"), 0}, + {RAGE_JOAAT("CMigrationDataNode"), 0}, + {RAGE_JOAAT("CObjectCreationDataNode"), 0}, + {RAGE_JOAAT("CObjectGameStateDataNode"), 0}, + {RAGE_JOAAT("CObjectOrientationNode"), 0}, + {RAGE_JOAAT("CObjectScriptGameStateDataNode"), 0}, + {RAGE_JOAAT("CObjectSectorPosNode"), 0}, + {RAGE_JOAAT("CPedAIDataNode"), 0}, + {RAGE_JOAAT("CPedAppearanceDataNode"), 0}, + {RAGE_JOAAT("CPedAttachDataNode"), 0}, + {RAGE_JOAAT("CPedComponentReservationDataNode"), 0}, + {RAGE_JOAAT("CPedCreationDataNode"), 0}, + {RAGE_JOAAT("CPedGameStateDataNode"), 0}, + {RAGE_JOAAT("CPedHealthDataNode"), 0}, + {RAGE_JOAAT("CPedInventoryDataNode"), 0}, + {RAGE_JOAAT("CPedMovementDataNode"), 0}, + {RAGE_JOAAT("CPedMovementGroupDataNode"), 0}, + {RAGE_JOAAT("CPedOrientationDataNode"), 0}, + {RAGE_JOAAT("CPedScriptCreationDataNode"), 0}, + {RAGE_JOAAT("CPedScriptGameStateDataNode"), 0}, + {RAGE_JOAAT("CPedSectorPosMapNode"), 0}, + {RAGE_JOAAT("CPedSectorPosNavMeshNode"), 0}, + {RAGE_JOAAT("CPedTaskSequenceDataNode"), 0}, + {RAGE_JOAAT("CPedTaskSpecificDataNode"), 0}, + {RAGE_JOAAT("CPedTaskTreeDataNode"), 0}, + {RAGE_JOAAT("CPhysicalAngVelocityDataNode"), 0}, + {RAGE_JOAAT("CPhysicalAttachDataNode"), 0}, + {RAGE_JOAAT("CPhysicalGameStateDataNode"), 0}, + {RAGE_JOAAT("CPhysicalHealthDataNode"), 0}, + {RAGE_JOAAT("CPhysicalMigrationDataNode"), 0}, + {RAGE_JOAAT("CPhysicalScriptGameStateDataNode"), 0}, + {RAGE_JOAAT("CPhysicalScriptMigrationDataNode"), 0}, + {RAGE_JOAAT("CPhysicalVelocityDataNode"), 0}, + {RAGE_JOAAT("CPickupCreationDataNode"), 0}, + {RAGE_JOAAT("CPickupPlacementCreationDataNode"), 0}, + {RAGE_JOAAT("CPickupPlacementStateDataNode"), 0}, + {RAGE_JOAAT("CPickupScriptGameStateNode"), 0}, + {RAGE_JOAAT("CPickupSectorPosNode"), 0}, + {RAGE_JOAAT("CPlaneControlDataNode"), 0}, + {RAGE_JOAAT("CPlaneGameStateDataNode"), 0}, + {RAGE_JOAAT("CPlayerAmbientModelStreamingNode"), 0}, + {RAGE_JOAAT("CPlayerAppearanceDataNode"), 0}, + {RAGE_JOAAT("CPlayerCameraDataNode"), 0}, + {RAGE_JOAAT("CPlayerCreationDataNode"), 0}, + {RAGE_JOAAT("CPlayerExtendedGameStateNode"), 0}, + {RAGE_JOAAT("CPlayerGameStateDataNode"), 0}, + {RAGE_JOAAT("CPlayerGamerDataNode"), 0}, + {RAGE_JOAAT("CPlayerPedGroupDataNode"), 0}, + {RAGE_JOAAT("CPlayerSectorPosNode"), 0}, + {RAGE_JOAAT("CPlayerWantedAndLOSDataNode"), 0}, + {RAGE_JOAAT("CSectorDataNode"), 0}, + {RAGE_JOAAT("CSectorPositionDataNode"), 0}, + {RAGE_JOAAT("CSubmarineControlDataNode"), 0}, + {RAGE_JOAAT("CSubmarineGameStateDataNode"), 0}, + {RAGE_JOAAT("CTrainGameStateDataNode"), 0}, + {RAGE_JOAAT("CVehicleAngVelocityDataNode"), 0}, + {RAGE_JOAAT("CVehicleAppearanceDataNode"), 0}, + {RAGE_JOAAT("CVehicleComponentReservationDataNode"), 0}, + {RAGE_JOAAT("CVehicleControlDataNode"), 0}, + {RAGE_JOAAT("CVehicleCreationDataNode"), 0}, + {RAGE_JOAAT("CVehicleDamageStatusDataNode"), 0}, + {RAGE_JOAAT("CVehicleGadgetDataNode"), 0}, + {RAGE_JOAAT("CVehicleGameStateDataNode"), 0}, + {RAGE_JOAAT("CVehicleHealthDataNode"), 0}, + {RAGE_JOAAT("CVehicleProximityMigrationDataNode"), 0}, + {RAGE_JOAAT("CVehicleScriptGameStateDataNode"), 0}, + {RAGE_JOAAT("CVehicleSteeringDataNode"), 0}, + {RAGE_JOAAT("CVehicleTaskDataNode"), 0} }); + + static void cache_nodes() + { + for (int i = (int)eNetObjType::NET_OBJ_TYPE_AUTOMOBILE; i <= (int)eNetObjType::NET_OBJ_TYPE_TRAIN; i++) + { + if (i == (int)eNetObjType::NET_OBJ_TYPE_TRAILER) + continue; + rage::netSyncTree* tree = g_pointers->m_get_sync_tree_for_type(*g_pointers->m_network_object_mgr, i); + if (tree->m_child_node_count > trees[i].second.size()) + { + LOG(FATAL) << "Cache nodes failed " << i << tree->m_child_node_count << " " << trees[i].second.size(); + throw std::runtime_error("Failed to cache nodes"); + } + for (int j = 0; j < tree->m_child_node_count; j++) + { + PVOID vft = *(PVOID*)tree->m_child_nodes[j]; + for (auto& n : nodes) + { + if (n.first == trees[i].second[j]) + { + n.second = (uint64_t)vft; + break; + } + } + } + } + } constexpr uint32_t crash_peds[] = { RAGE_JOAAT("slod_human"), RAGE_JOAAT("slod_small_quadped"), RAGE_JOAAT("slod_large_quadped") }; @@ -182,18 +600,12 @@ namespace big } else if (node->IsDataNode()) { - auto offset_to_address = [](uint64_t off) - { - static auto base_addr = reinterpret_cast(GetModuleHandle(nullptr)); - return base_addr + off; - }; - auto vtable = *(void**)node; Hash node_hash = 0; for (const auto& n : nodes) { - if ((void*)offset_to_address(n.second) == vtable) + if ((void*)n.second == vtable) { node_hash = n.first; break; @@ -319,12 +731,12 @@ namespace big bool hooks::can_apply_data(rage::netSyncTree* tree, rage::netObject* object) { -#if 0 - if (tree->m_child_node_count && check_node(tree->m_sync_node, g.m_syncing_player, object)) + static bool init = ([] { cache_nodes(); }(), true); + + if (tree->m_child_node_count && check_node(tree->m_next_sync_node, g.m_syncing_player, object)) { return false; } -#endif return g_hooking->get_original()(tree, object); }