Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(five/streaming): expand train track array #3191

Merged
merged 1 commit into from
Feb 25, 2025

Conversation

Ehbw
Copy link
Contributor

@Ehbw Ehbw commented Feb 24, 2025

Goal of this PR

Expands the hardcoded track limit of 27 tracks to 127 (though can be easily expanded in the future by modifying kMaxTracks in extra-natives-five/TrackNatives.cpp and gta-streaming-five/PatchTrackLimits.cpp.

With the introduction of track switching with #3044 There is a bigger need for having more available tracks (Base GTA takes up 12, Leaving 15 for custom tracks that may be taken up by different map resources and track switching)

How is this PR achieving the goal

By replacing all instances of the original array holding track data and replacing it with a larger allocated array. All checks for trackIndex being less then 27 have also been replaced with kMaxTracks or kMaxTracks - 1.

Two other track related functions were also rewritten and placed into TrackNatives.cpp because of missing checks. This change only applies to newer game builds (>2545) due to differences with the older game builds that aren't likely to be supported for much longer.

This PR applies to the following area(s)

FiveM

Successfully tested on

Tests were done with the original tracks + custom tracks that exceeded the original 27 limit. Tested on older builds that don't have this patch to ensure the functionality is the same.

For testing. I've provided a resource that contains enough tracks to exceed the original 27 limit. With a client debugging script and commands for testing
Extended-Track-Repro.zip

Game builds: 2189, 2372, 2545, 2699, 2802, 2944, 3095, 3258, 3407

Platforms: Windows

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 the invalid Requires changes before it's considered valid and can be (re)triaged label Feb 24, 2025
@dalekenium-cfx dalekenium-cfx self-requested a review February 25, 2025 11:49
@dalekenium-cfx dalekenium-cfx self-assigned this Feb 25, 2025
Copy link
Contributor

@dalekenium-cfx dalekenium-cfx left a comment

Choose a reason for hiding this comment

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

No complaints from me. Approved - thanks for the contribution. :)

@dalekenium-cfx dalekenium-cfx added the ready-to-merge This PR is enqueued for merging label Feb 25, 2025
@prikolium-cfx prikolium-cfx merged commit 67742ee into citizenfx:master Feb 25, 2025
4 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid Requires changes before it's considered valid and can be (re)triaged ready-to-merge This PR is enqueued for merging
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants