Skip to content

fix(net/rdr3): verify net object model archetype#3550

Merged
prikolium-cfx merged 1 commit into
citizenfx:masterfrom
Ehbw:fix/rdr3-net-tree-model-validation
Aug 6, 2025
Merged

fix(net/rdr3): verify net object model archetype#3550
prikolium-cfx merged 1 commit into
citizenfx:masterfrom
Ehbw:fix/rdr3-net-tree-model-validation

Conversation

@Ehbw

@Ehbw Ehbw commented Jul 22, 2025

Copy link
Copy Markdown
Contributor

Goal of this PR

Backport 9cb9d15 and c0b8ca5 From FiveM in order to fix the same crashes/unintended behaviour in RedM.

How is this PR achieving the goal

Patching CanApply functions for Vehicle, Ped, Player and Animal Creation nodes in order to properly verify the models used. The game currently only checks if the model is valid but does not check if that model should be used for that entity type (e.g. ped model for a vehicle) leading to unintended behaviour and crashes.

This PR applies to the following area(s)

RedM

Successfully tested on

Game builds: 1491

Platforms: Windows, Linux

Checklist

  • Code compiles and has been tested successfully.
  • Code explains itself well and/or is documented.
  • My commit message explains what the changes do and what they are for.
  • No extra compilation warnings are added by these changes.

Fixes issues

@github-actions github-actions Bot added RedM Issues/PRs related to RedM triage Needs a preliminary assessment to determine the urgency and required action labels Jul 22, 2025
{
auto location = hook::get_pattern<char>("48 89 5C 24 ? 55 48 8B EC 48 83 EC ? E8 ? ? ? ? C7 45 ? ? ? ? ? 48 8D 55 ? C7 45 ? ? ? ? ? 8B 88");
hook::set_call(&g_getPlayerSyncNodeData, location + 13);
MH_CreateHook(location, CPlayerCreationDataNode__CanApply, (void**)&g_origCPlayerCreationDataNode__CanApply);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use trampoline please

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@Ehbw Ehbw force-pushed the fix/rdr3-net-tree-model-validation branch from 8b50445 to 84b6ec3 Compare August 6, 2025 12:18

@prikolium-cfx prikolium-cfx left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I appreciate your job

@prikolium-cfx prikolium-cfx added the ready-to-merge This PR is enqueued for merging label Aug 6, 2025
@prikolium-cfx prikolium-cfx merged commit 116c928 into citizenfx:master Aug 6, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-to-merge This PR is enqueued for merging RedM Issues/PRs related to RedM triage Needs a preliminary assessment to determine the urgency and required action

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants