Repository navigation
Creator Internals
How Xenvious makes the creator do things. Read Game memory first.
-
Job data (what gets saved and published) is in globals, in three
big structs. Judging by the keys in
offsets.ini:Global_4718592holds the job header (title, description, image flags), checkpoints, play area, zones, teleports and rules;Global_4980736holds actors, vehicles, dynamic props, objects, weapons, goto locations and doors;Global_5242880holds the placed (static) props. Each list is an array with a count global, e.g.Props.number,Props.locand the strideProps.NEXT. -
Creator UI state (current menu, camera, the worker state machine) is in
the locals of the creator script, see
MainWindow.CreatorLocals.cs. - Which creator is running:
CreatorMap.CurrentCreator()/GTA.CurrentCreatorName()return the script name (fm_race_creator, ...).Functions.isRace(),isLTS(),isCapture()... check the job type global instead.
Limits differ by edition: 300 placed props on Enhanced, 200 on Legacy. Other Enhanced limits are not known yet.
Text fields (title, description) are stored in chunks of 63 bytes plus a
terminator, one chunk every 16 slots; see setDescribtion in
MainWindow.Misc.CopyJobs.cs.
The option bitsets menubs to menubs32 (Global_4718592.f_12 to f_43)
hold more bits than the creator menus offer. The creator saves each bitset
as a whole, so a bit set from outside stays in the published job, and the
mission controller acts on some bits the LTS and Capture creators never set
(both creators set the same bits). Mission > General shows the ones whose
effect was found in the decompiled fm_mission_controller, the controller LTS
and Capture jobs run on, sorted in with the related options and marked with
*; fm_mission_controller_2020 was not checked. The table that drives them
is in MainWindow.Mission.Extras.cs.
To add one, find BitTest(Global_4718592.f_N, b) in the controller and read
what the code does when it is set. menubsN is f_(11+N), and script bit b
is the same b in writebinary / checkbinary. Per-entity bitsets count the
same way; for example vbs2 bits 2 to 5 lock a vehicle for team 1 to 4.
Writing job data changes the saved job, but the creator still shows the old
entities. Creator Classes/CreatorMap.cs forces a rebuild:
- The creator's main state (
worker.f_565) is3while editing. Setting it to7runs the "back from testing" path: it deletes every placed entity without touching the job data, builds everything again from the globals, then returns to3. - That path also resets the menu and moves the camera. For the one frame the rebuild takes, those two statements are NOPed in the bytecode and restored afterwards, so the user keeps their menu and camera.
- All five fm_* creators share the state numbering. Deathmatch and Survival rebuild too, but their menu and camera are not kept (the NOP patterns only cover Race, LTS, Capture and the Mission Creator).
- Other states used:
5= save,91= publish (seeMainWindow.CopyJobModes.cs).
Anything that writes job data in bulk (map restore, copy job, moving props between lists) ends with a rebuild.
CreatorMap snapshots the raw global arrays (props, dynamic props,
checkpoints, templates) into an .xvmap file (JSON with gzip+base64 slot
data) under %AppData%\Xenvious\maps\. Raw slots keep every field, even ones
Xenvious does not know, but tie the file to the edition and build it was taken
on; restore refuses anything else. Before a restore the current state is saved
as an undo file. UI: MainWindow.MapBackup.cs.
The snapshot format has a version; bump it when the meaning of saved data
changes (version 1 files saved a wrong dynamic prop count and are handled
specially).
Creator Classes/PropMover.cs moves a prop between the static list
(Props) and the dynamic list (DProps): copy the slots field by field (the
two strides differ), shift the rest of the source array left, clear the last
element, update both counts, rebuild.
Creator Classes/PreciseTemplates.cs gives templates the "Advanced Options"
(override position/rotation) that Rockstar only offers for single props. It
switches a set of triggered script patches in while the template category is
selected and points the creator's "displayed prop" at the template's first
object while Override Position is open. The class comment explains why that
alias must be short-lived (a dead handle crashes the game later).
Creator Classes/AdvancedPlacement/ (RepeatPlanner, PropPlacementService,
dimensions) with ViewModels/AdvancedPropPlacementViewModel*.cs and
Controls/AdvancedPropPlacementView.xaml / PlacementPreview3D.xaml: repeat
a prop along a line, curve, spiral or loop, with a live 3D preview and
presets (OfflineData/placement_presets.json). This part uses MVVM
(CommunityToolkit.Mvvm source generators).
MainWindow.Misc.CopyJobs.cs: takes a Social Club job link or the bare
22-character job id, loads the job details, then the job JSON that sits next
to the job image on Rockstar's cloud (<part>_<version>_<language>.json,
trying languages and versions). The JSON maps to the classes in
JSON/job_json.cs; each field is written into the matching global, then a
rebuild, then optionally save or publish (publishing asks first).
GlobalFreezer / LocalFreezer keep writing a value to a global or local, for
values the creator keeps resetting. Used by the global/local editor
(MainWindow.GlobalLocalEditor.cs).
Generated from docs/wiki/ — edit the pages there, changes made here are overwritten.