[Feature Request] Authoritative replacement of the base default.ymt data manifest and selective remapping of its data-file entries #4128
RED-ITA
started this conversation in
Engineering Discussion
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Summary
FiveM currently exposes mechanisms for:
data_file);init_meta);before_level_meta/after_level_meta);replace_level_meta).It does not expose a mechanism that authoritatively replaces the base
default.ymtmanifest before the game consumes it throughdataFileMgr__loadDefDat, nor a mechanism that remaps individual base data-file registrations contained in that manifest before their respective managers are initialized.I am requesting one or both of the following:
Minimum viable API
This would make the specified resource file replace the base default manifest for the current game session, analogously to how
replace_level_metareplaces the primary level meta.Preferred safer API
This would preserve the Rockstar
default.ymtitself, but replace thefilenameof one matching baseCDataFileMgr__DataFileentry before that entry is registered and loaded. Its originalfileType, flags,registerAs,contents, andinstallPartitionwould remain unchanged.The selective API would be safer and more build-resilient for ordinary resources. A full
replace_default_metawould remain useful for total conversions and advanced engine-level modifications.Motivation
A number of base data files are registered by
default.ymt, before the primarygta5.metaand outside the normal resourcedata_fileextra-content path.In the extracted
default.ymtused for this reproduction, the root is:<CDataFileMgr__ContentsOfDataFileXml>and the manifest directly registers, among many other files:
The same manifest also registers base handling, dispatch, ambient ped/prop model sets, weapon metadata, ped/task data, action tables, UI/controller metadata, RPFs, and other engine data.
The attached extracted manifest contains:
CDataFileMgr__DataFileentries;fileTypevalues.This request is therefore not specific to one file.
vehiclemodelsets.metais only a concrete, reproducible example of a broader missing capability: authoritative per-session replacement of base data registrations that are currently loaded fromdefault.ymt.Concrete reproduction:
vehiclemodelsets.metaGoal
Override the vanilla ambient vehicle model set:
which is referenced by verified Ballas vehicle scenario points.
Test modification
The custom
vehiclemodelsets.metawas changed so thatLOWRIDERS_MODDED_BALLAScontained only one vehicle model:The entry was also given the Vagos/yellow body-colour configuration, making both model selection and variation visually unambiguous.
The test intentionally removed all other models from the Ballas set. Therefore, a
TORNADOcannot be selected from the custom definition under any interpretation.Test A: normal
data_fileStandalone resource:
Conditions:
AMBIENT_VEHICLE_MODEL_SET_FILE;LOWRIDERS_MODDED_BALLAS.Expected:
Actual:
This is stronger than a colour-only test: the spawned model does not exist anywhere in the custom set.
Test B: primary level meta
The normal
data_filedeclaration was removed. A customgta5.meta, already loaded through:was given this entry:
After another full cold start, the result was unchanged: the scenario still resolved the vanilla Ballas set and spawned a purple Tornado.
Conclusion from the reproduction
The custom file can be exposed to FiveM, but neither the normal extra-content route nor an additional registration in the primary level meta makes it the authoritative base definition used by the scenario.
The original registration is made earlier by
default.ymt:Later additive registrations do not reliably replace the already-established base data.
Why the current APIs do not solve this
Current resource processing in
ResourcesTest.cppmaps the relevant manifest entries as follows:init_meta -> streaming::AddDefMetaToLoadList(...) before_level_meta / after_level_meta -> streaming::AddMetaToLoadList(...) replace_level_meta -> streaming::SetNextLevelPath(...) data_file -> streaming::AddDataFileToLoadList(...)These are distinct paths with distinct semantics.
replace_level_metahas a true replacement path becauseSetNextLevelPathchanges which primary level meta is loaded.By contrast, the current default-data hook in
LoadStreamingFile.cppeffectively does:The incoming default manifest path is always forwarded unchanged to the original
dataFileMgr__loadDefDat.There is currently no equivalent of:
SetNextDefaultMetaPath(...)and no pre-registration map capable of replacing a matching
CDataFileMgr__DataFile::filenameinside the base default manifest.init_metais additive. It queues another manifest throughAddDefMetaToLoadList; it does not replace the path passed to the original default loader.data_fileis also additive and routes the file through the game’s extra-content/DLC mounter system. Existing Cfx issue discussion already notes that some Rockstar DLC loaders do not support overwriting existing data, even where they support adding new data. This is particularly relevant to base-game definitions and ambient model sets.Related existing reports:
citizenfx/fivem#1245— base vehicle metadata replacement limitations; the discussion also explicitly mentions partial/incorrectvehiclemodelsets.metabehavior.citizenfx/fivem#3473—vehiclemodelsets.metanot being read correctly and causing client crashes in custom scenario use cases.Requested behaviour
Option 1: full default-manifest replacement
Proposed resource manifest syntax:
Required semantics:
.metasuffix should be added because the original asset is a.ymt/PSO manifest.dataFileMgr__loadDefDatcall.restart <resource>after initialization must not attempt unsafe live replacement. It should either:Option 2: selective base data-file replacement
Preferred resource manifest syntax:
Required semantics:
filename.fileType;registerAs;locked;loadCompletely;overlay;patchFile;disabled;persistent;enforceLsnSorting;contents;installPartition.This selective API would avoid requiring server developers to redistribute and maintain a full build-specific
default.ymt, while still using the authoritative base-loader phase.Suggested implementation direction
The exact integration point depends on when resource metadata is available relative to the first default-manifest load, but the required invariant is simple:
Full replacement: illustrative implementation
In the resource bridge:
Resource manifest handling:
State:
Default loader hook:
This code is only illustrative. The important part is that the original call receives the replacement path instead of the Rockstar path.
Timing caveat
If resource
OnStartmetadata is not available before the currentLoadDefDatscall, simply addingSetNextDefaultMetaPathto the existingOnStartloop would be insufficient.In that case, FiveM would need one of the following:
A late additive call must not be presented as a replacement.
Selective replacement: implementation alternatives
A selective API could be implemented in at least two ways.
A. Rewrite entries before registration
Maintain a session-scoped map:
During parsing/insertion of each
CDataFileMgr__DataFilefrom the base default manifest:The actual structure owns fixed-size buffers and engine-managed strings, so the production implementation would need to respect the correct ownership and lifetime rules rather than assigning a temporary
std::string.B. Exact-path VFS redirection
Install a session-scoped exact-path redirect before the default manifest is consumed:
This approach must:
OpenandGetAttributes;The entry-rewrite approach is semantically cleaner because it preserves the original
CDataFileMgrflags while changing only the source file.Lifecycle and safety requirements
This feature touches managers that may retain pointers to parsed data for the lifetime of the game session. It should therefore be initialization-only.
No live unload/reload
FiveM should not attempt to unload and reinsert arbitrary base metadata when the owning resource stops. Doing so could create:
After the default manifest is consumed:
Server switching
A client connecting to server A and then server B must not retain A’s base-data override.
The replacement state should be cleared as part of the same full game/session reset boundary used for other initialization-sensitive data. If the engine cannot safely reconstruct the relevant managers in place, joining a server with a different default-meta fingerprint should trigger a full game reload.
Conflict handling
Full replacement:
Selective replacements:
Any conflict should be a hard, deterministic error rather than load-order-dependent “last resource wins” behaviour.
Build compatibility
A full
default.ymtis inherently game-build-sensitive. Recommended protections:/gameBuild:dependency;Invalid replacement data
Malformed base data can crash the game before normal script diagnostics are available. The loader should report, where technically possible:
fileType;A declared replacement that cannot be opened should fail explicitly rather than fall back to vanilla and create a false-positive test result.
Pure mode and policy
The feature’s interaction with pure mode should be explicitly defined.
Possible policies:
replace_level_meta;fileTypevalues while allowing others;The important point is deterministic, documented behaviour.
Diagnostics requested
Useful client log output:
or, for selective replacement:
On application:
On conflict:
On late registration:
Acceptance criteria
dataFileMgr__loadDefDatto receive the resource path instead of the Rockstar default-manifest path.BUCCANEER; a vanillaTORNADOcan no longer be selected from the replaced set.vehiclemodelsets.metaare parsed through the same base-loader path used by Rockstar, rather than through the later DLC mounter path.Scope and broader benefit
The attached extracted
default.ymtregisters 80 base data entries across 67 distinctfileTypevalues. Examples include:Authoritative replacement would not guarantee that arbitrary malformed content is safe, nor that every manager accepts every theoretical modification. Each data-file loader would still enforce its own format and engine assumptions.
What it would provide is the missing foundational capability:
This would solve a class of limitations rather than adding a one-off workaround for
vehiclemodelsets.meta.Why both APIs are worth considering
replace_default_metaAdvantages:
replace_level_meta;Disadvantages:
replace_default_data_fileAdvantages:
Disadvantages:
My preferred outcome would be the selective API, with full replacement available as an advanced escape hatch. Implementing either one authoritatively before
loadDefDatwould resolve the current limitation.Attachments / reproducible material
I can provide:
default.ymt.pso.xml;vehiclemodelsets.meta;data_file;gta5.metatest;LOWRIDERS_MODDED_BALLAS;Thank you for considering this. The request is intentionally broader than a special-case fix for one ambient model-set file, but it can be implemented with strict initialization-only semantics and deterministic conflict handling to avoid unsafe runtime mutation.
All reactions