feat(extra-natives-five): add Lua support for scripted animation data buffers - #4011
Open
Rogui20 wants to merge 10 commits into
Open
feat(extra-natives-five): add Lua support for scripted animation data buffers#4011Rogui20 wants to merge 10 commits into
Rogui20 wants to merge 10 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Goal of this PR
Allow Lua scripts to call TASK_SCRIPTED_ANIMATION and PLAY_ENTITY_SCRIPTED_ANIM using data buffers that contain animation dictionary and clip name strings.
These natives expect structures containing char* fields, which are currently difficult to populate from Lua without exposing raw pointers to scripts or implementing native-specific wrappers.
...
How is this PR achieving the goal
This PR adds support for inline string markers inside binary buffers passed to scripted animation natives.
When a buffer contains a string marker in the form:
__cfx_str:
the marker is resolved into a temporary native string and replaced with a valid char* before the native is executed.
This allows Lua scripts to build the animation initialization structure entirely from script-side data while keeping string pointer creation inside the runtime.
The implementation was designed specifically to support the structures used by:
TASK_SCRIPTED_ANIMATION
PLAY_ENTITY_SCRIPTED_ANIM
without exposing raw memory addresses to scripts.
...
This PR applies to the following area(s)
FiveM
Natives
ScRT: Lua
...
Successfully tested on
Game builds: ..
3095
Platforms: Windows, Linux
Windows 10
Testing included:
Single animation slots
Multiple animation slots
Empty animation slots
Animation dictionary and clip string resolution
TASK_SCRIPTED_ANIMATION
PLAY_ENTITY_SCRIPTED_ANIM
Checklist
Fixes issues
None.
This PR adds Lua support for passing animation initialization data containing string fields to scripted animation natives.