feat(five/streaming): expand train track array #3191
Merged
+214
−8
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
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
Fixes issues