Skip to content

Commit

Permalink
Fixes and Feature Additions (#154)
Browse files Browse the repository at this point in the history
*Added disable horse sliding on steep slopes
*Added keep horse clean
*Added auto cock weapon
*Added super run
*Uniform some net sync protection logs
*Some other fixes
  • Loading branch information
tyackman authored Jun 30, 2024
1 parent d15a1de commit 8a4433f
Show file tree
Hide file tree
Showing 10 changed files with 122 additions and 24 deletions.
23 changes: 23 additions & 0 deletions src/game/features/mount/HorseClimbSteepSlopes.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#include "core/commands/LoopedCommand.hpp"
#include "game/rdr/Natives.hpp"
#include "game/features/Features.hpp"

namespace YimMenu::Features
{
class HorseClimbSteepSlopes : public LoopedCommand
{
using LoopedCommand::LoopedCommand;

virtual void OnTick() override
{
PED::SET_PED_RESET_FLAG(Self::Mount, 204, TRUE);
}

virtual void OnDisable() override
{
PED::SET_PED_RESET_FLAG(Self::Mount, 204, FALSE); // probably not neccesary. dont know, dont care.
}
};

static HorseClimbSteepSlopes _HorseClimbSteepSlopes{"horseclimbsteepslopes", "Can Climb Steep Slopes", "Your horse can climb up/down sleep slopes without sliding"};
}
23 changes: 23 additions & 0 deletions src/game/features/mount/KeepHorseClean.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#include "core/commands/LoopedCommand.hpp"
#include "game/features/Features.hpp"
#include "game/rdr/Enums.hpp"
#include "game/rdr/Natives.hpp"

namespace YimMenu::Features
{
class KeepHorseClean : public LoopedCommand
{
using LoopedCommand::LoopedCommand;

virtual void OnTick() override
{
PED::_SET_PED_DAMAGE_CLEANLINESS(Self::Mount, (int)ePedDamageCleanliness::PED_DAMAGE_CLEANLINESS_PERFECT);
PED::CLEAR_PED_WETNESS(Self::Mount);
PED::CLEAR_PED_ENV_DIRT(Self::Mount);
PED::CLEAR_PED_BLOOD_DAMAGE(Self::Mount);
PED::CLEAR_PED_DAMAGE_DECAL_BY_ZONE(Self::Mount, 10, "ALL");
}
};

static KeepHorseClean _KeepHorseClean{"keephorseclean", "Keep Horse Clean", "Keeps your horse from being dirty"};
}
18 changes: 18 additions & 0 deletions src/game/features/self/AutoCockWeapon.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#include "core/commands/LoopedCommand.hpp"
#include "game/features/Features.hpp"
#include "game/rdr/Natives.hpp"

namespace YimMenu::Features
{
class AutoCock : public LoopedCommand
{
using LoopedCommand::LoopedCommand;

virtual void OnTick() override
{
WEAPON::_SET_FORCE_CURRENT_WEAPON_INTO_COCKED_STATE(Self::PlayerPed, 0);
}
};

static AutoCock _AutoCock{"autocock", "Auto Cock", "Automatically cock your weapon"};
}
8 changes: 4 additions & 4 deletions src/game/features/self/Drunk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ namespace YimMenu::Features

virtual void OnTick() override
{
AUDIO::SET_PED_IS_DRUNK(Self::PlayerPed, true);
PED::_SET_PED_DRUNKNESS(Self::PlayerPed, true, 1.0f);
AUDIO::SET_PED_IS_DRUNK(Self::PlayerPed, TRUE);
PED::_SET_PED_DRUNKNESS(Self::PlayerPed, TRUE, 1.0f);
}

virtual void OnDisable() override
{
if (PED::_GET_PED_DRUNKNESS(Self::PlayerPed))
{
AUDIO::SET_PED_IS_DRUNK(Self::PlayerPed, false);
PED::_SET_PED_DRUNKNESS(Self::PlayerPed, false, 0.0f);
AUDIO::SET_PED_IS_DRUNK(Self::PlayerPed, TRUE);
PED::_SET_PED_DRUNKNESS(Self::PlayerPed, TRUE, 0.0f);
}
}
};
Expand Down
12 changes: 8 additions & 4 deletions src/game/features/self/NoRagdoll.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,19 @@ namespace YimMenu::Features

virtual void OnTick() override
{
if (PED::CAN_PED_RAGDOLL(Self::PlayerPed))
PED::SET_PED_CAN_RAGDOLL(Self::PlayerPed, false);
if (PED::CAN_PED_RAGDOLL(Self::PlayerPed))
{
PED::SET_PED_CAN_RAGDOLL(Self::PlayerPed, FALSE);
PED::SET_PED_CAN_RAGDOLL_FROM_PLAYER_IMPACT(Self::PlayerPed, FALSE);
}
}

virtual void OnDisable() override
{
PED::SET_PED_CAN_RAGDOLL(Self::PlayerPed, true);
PED::SET_PED_CAN_RAGDOLL(Self::PlayerPed, TRUE);
PED::SET_PED_CAN_RAGDOLL_FROM_PLAYER_IMPACT(Self::PlayerPed, TRUE);
}
};

static NoRagdoll _NoRagdoll{"noragdoll", "No Ragdoll", "You will never ragdoll"};
}
}
22 changes: 22 additions & 0 deletions src/game/features/self/SuperRun.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#include "core/commands/LoopedCommand.hpp"
#include "game/features/Features.hpp"
#include "game/rdr/Natives.hpp"

namespace YimMenu::Features
{
class SuperRun : public LoopedCommand
{
using LoopedCommand::LoopedCommand;

virtual void OnTick() override
{
if (PED::IS_PED_RAGDOLL(Self::PlayerPed))
return;

if (TASK::IS_PED_RUNNING(Self::PlayerPed) || TASK::IS_PED_SPRINTING(Self::PlayerPed))
ENTITY::APPLY_FORCE_TO_ENTITY(Self::PlayerPed, 1, 0.0f, 20.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1, true, true, true, false, true);
}
};

static SuperRun _Superrun{"superrun", "Super Run", "Run faster than normal"};
}
6 changes: 5 additions & 1 deletion src/game/frontend/submenus/Self.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ namespace YimMenu::Submenus


globalsGroup->AddItem(std::make_shared<BoolCommandItem>("godmode"_J));
globalsGroup->AddItem(std::make_shared<BoolCommandItem>("neverwanted"_J));
globalsGroup->AddItem(std::make_shared<BoolCommandItem>("neverwanted"_J));
globalsGroup->AddItem(std::make_shared<BoolCommandItem>("invis"_J));
globalsGroup->AddItem(std::make_shared<BoolCommandItem>("offtheradar"_J));
globalsGroup->AddItem(std::make_shared<BoolCommandItem>("noragdoll"_J));
Expand All @@ -75,6 +75,7 @@ namespace YimMenu::Submenus
globalsGroup->AddItem(std::make_shared<BoolCommandItem>("keepcoresfilled"_J));
globalsGroup->AddItem(std::make_shared<BoolCommandItem>("infiniteammo"_J));
globalsGroup->AddItem(std::make_shared<BoolCommandItem>("infiniteclip"_J));
globalsGroup->AddItem(std::make_shared<BoolCommandItem>("autocock"_J));
globalsGroup->AddItem(std::make_shared<BoolCommandItem>("keepclean"_J));
globalsGroup->AddItem(std::make_shared<BoolCommandItem>("antilasso"_J));
globalsGroup->AddItem(std::make_shared<BoolCommandItem>("antihogtie"_J));
Expand All @@ -99,6 +100,7 @@ namespace YimMenu::Submenus

movementGroup->AddItem(std::make_shared<BoolCommandItem>("noclip"_J));
movementGroup->AddItem(std::make_shared<BoolCommandItem>("superjump"_J));
movementGroup->AddItem(std::make_shared<BoolCommandItem>("superrun"_J));

columns->AddItem(globalsGroup);
columns->AddItem(toolsGroup);
Expand All @@ -112,6 +114,8 @@ namespace YimMenu::Submenus
auto horseGlobalsGroup = std::make_shared<Group>("Globals", GetListBoxDimensions());
horseGlobalsGroup->AddItem(std::make_shared<BoolCommandItem>("horsegodmode"_J));
horseGlobalsGroup->AddItem(std::make_shared<BoolCommandItem>("horsenoragdoll"_J));
horseGlobalsGroup->AddItem(std::make_shared<BoolCommandItem>("keephorseclean"_J));
horseGlobalsGroup->AddItem(std::make_shared<BoolCommandItem>("horseclimbsteepslopes"_J));
horseGlobalsGroup->AddItem(std::make_shared<BoolCommandItem>("keephorsebarsfilled"_J));
horseGlobalsGroup->AddItem(std::make_shared<BoolCommandItem>("keephorsecoresfilled"_J));
horseGlobalsGroup->AddItem(std::make_shared<BoolCommandItem>("keephorseagitationlow"_J));
Expand Down
24 changes: 14 additions & 10 deletions src/game/hooks/Protections/ShouldBlockSync.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,20 +122,17 @@ namespace
break;
case "CVehicleGadgetDataNode"_J:
LOG_FIELD_B(CVehicleGadgetNodeData, m_has_position);
const auto& position = node->GetData<CVehicleGadgetNodeData>().m_position;
LOG(INFO) << "\tm_position: X: " << position[0] << " Y: " << position[1] << " Z: " << position[2] << " W: " << position[3];
LOG_FIELD(CVehicleGadgetNodeData, m_position[0]);
LOG_FIELD(CVehicleGadgetNodeData, m_position[1]);
LOG_FIELD(CVehicleGadgetNodeData, m_position[2]);
LOG_FIELD(CVehicleGadgetNodeData, m_position[3]);
LOG_FIELD(CVehicleGadgetNodeData, m_num_gadgets);

for (int i = 0; i < node->GetData<CVehicleGadgetNodeData>().m_num_gadgets; i++)
if (node->GetData<CVehicleGadgetNodeData>().m_num_gadgets <= 2)
{
LOG(INFO) << "m_gadgets[" << i << "].m_type: " << node->GetData<CVehicleGadgetNodeData>().m_gadgets[i].m_type;
uint32_t sum = 0;
for (int j = 0; j < sizeof(node->GetData<CVehicleGadgetNodeData>().m_gadgets[i].m_data); j++)
for (int i = 0; i < node->GetData<CVehicleGadgetNodeData>().m_num_gadgets; i++)
{
sum += node->GetData<CVehicleGadgetNodeData>().m_gadgets[i].m_data[j];
LOG_FIELD(CVehicleGadgetNodeData, m_gadgets[i].m_type);
}

LOG(INFO) << "\tm_data: " << HEX(sum);
}
break;
}
Expand Down Expand Up @@ -325,6 +322,9 @@ namespace
if (data.m_ModelHash && !STREAMING::IS_MODEL_A_VEHICLE(data.m_ModelHash))
{
LOG(WARNING) << "Blocked mismatched vehicle model crash from " << Protections::GetSyncingPlayer().GetName();
Notifications::Show("Protections",
std::string("Blocked mismatched vehicle model crash from ").append(Protections::GetSyncingPlayer().GetName()),
NotificationType::Warning);
g_PlayerDatabase->AddInfraction(
g_PlayerDatabase->GetOrCreatePlayer(Protections::GetSyncingPlayer().GetGamerInfo()->m_GamerHandle.m_rockstar_id,
Protections::GetSyncingPlayer().GetName()),
Expand Down Expand Up @@ -382,6 +382,10 @@ namespace
{
// TODO: add more checks
LOG(WARNING) << "Blocked remote teleport from " << Protections::GetSyncingPlayer().GetName();
Notifications::Show("Protections",
std::string("Blocked remote teleport from ")
.append(Protections::GetSyncingPlayer().GetName()),
NotificationType::Warning);
g_PlayerDatabase->AddInfraction(
g_PlayerDatabase->GetOrCreatePlayer(
Protections::GetSyncingPlayer().GetGamerInfo()->m_GamerHandle.m_rockstar_id,
Expand Down
2 changes: 1 addition & 1 deletion src/game/pointers/Pointers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ namespace YimMenu

constexpr auto sendPacketPtrn = Pattern<"8B 44 24 60 48 8B D6 48 8B CD">("SendPacket");
scanner.Add(sendPacketPtrn, [this](PointerCalculator ptr) {
SendPacket = ptr.Add(10).Rip().As<Functions::SendPacket>();
SendPacket = ptr.Add(15).Rip().As<Functions::SendPacket>();
});

constexpr auto queuePacketPtrn = Pattern<"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 83 EC 30 4C 8B F1 4D">("QueuePacket");
Expand Down
8 changes: 4 additions & 4 deletions src/game/pointers/Pointers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,18 @@ namespace YimMenu
{
using GetRendererInfo = RenderingInfo* (*)();
using GetNativeHandler = rage::scrNativeHandler (*)(rage::scrNativeHash hash);
using FixVectors = void (*)(rage::scrNativeCallContext* call_ctx);
using FixVectors = void (*)(rage::scrNativeCallContext* callCtx);
using SendEventAck = void (*)(rage::netEventMgr* eventMgr, void* event, CNetGamePlayer* sourcePlayer, CNetGamePlayer* targetPlayer, int eventIndex, int handledBitset);
using HandleToPtr = void* (*)(int handle);
using PtrToHandle = int (*)(void* pointer);
using GetLocalPed = CPed* (*)();
using GetSyncTreeForType = rage::netSyncTree* (*)(void* netObjMgr, uint16_t type);
using GetNetworkPlayerFromPid = CNetGamePlayer* (*)(uint8_t player);
using WorldToScreen = bool (*)(float* world_coords, float* out_x, float* out_y);
using WorldToScreen = bool (*)(float* worldCoords, float* outX, float* outY);
using GetNetObjectById = rage::netObject* (*)(uint16_t id);
using RequestControlOfNetObject = bool (*)(rage::netObject** netId, bool unk);
using SendPacket = bool (*)(rage::netConnectionManager* mgr, rage::netPeerAddress* adde, int connection_id, void* data, int size, int flags);
using QueuePacket = bool (*)(rage::netConnectionManager* mgr, int msg_id, void* data, int size, int flags, void* unk);
using SendPacket = bool (*)(rage::netConnectionManager* mgr, rage::netPeerAddress* addr, int connectionId, void* data, int size, int flags);
using QueuePacket = bool (*)(rage::netConnectionManager* mgr, int msgId, void* data, int size, int flags, void* unk);
using PostPresenceMessage = bool (*)(int localGamerIndex, rage::rlGamerInfo* recipients, int numRecipients, const char* msg, unsigned int ttlSeconds);
using SendNetInfoToLobby = bool (*)(rage::rlGamerInfo* player, int64_t a2, int64_t a3, DWORD* a4);
};
Expand Down

0 comments on commit 8a4433f

Please sign in to comment.