Skip to content

Latest commit

 

History

History
115 lines (84 loc) · 11.4 KB

ENROLLMENT.md

File metadata and controls

115 lines (84 loc) · 11.4 KB

The enrollment file

Reference for db/mods/<key>.json, the file that enrolls a mod. Most authors never open it: CDAL Studio writes it (ENROLL.md). This page is for writing it with Python, editing it by hand, enrolling a BSX Lua script, and what each status report shows.

Where an enrolled mod shows up

  • CDAL & BSX Hub (Enrolled Mods tab) shows opt-in enrolled mods with their declared feature counts, ID counts, and build status.
  • mods.md shows the mod's status on every game build CDAL knows, and a coverage table: how many of the mod's addresses are CDAL IDs, how many are in its own site pack, and the share that keeps working after a game update.
  • The CDAL Discord server's mod status board in #mod-status shows every enrolled mod with ✅, ⚠️ or ❌ for the current game build, or ❔ while CDAL has no result for that build. On patch day it updates when the new build's data is merged into CDAL, the same moment the data is published for players.
  • With your Discord user ID in the file, the bot mentions you when your own mod's status changes. Nobody else is pinged, and nothing else mentions you.
  • The pull request that adds a new game build lists every enrolled mod that loses a feature, so the maintainer knows which broken IDs matter most.
  • With a Nexus Mods page (nexus), the mod's row in mods.md links its page in Mods on Nexus, checked against CDAL, with the date and build of its last run in the maintainer's in-game lab. If the scan or a run sees your mod use a CDAL ID your enrollment doesn't list, mods.md names it under IDs an enrollment doesn't list, so you know to enroll again.

How the status is worked out

The board marks a feature off when the build file has no value for one of its IDs. At run time CDAL may still find that ID by scanning, so the board can be more conservative than the running mod. The mod switches the feature off and logs the reason when its actual cdal::require() call fails. The statuses are in ENROLL.md.

The status comes from CDAL's own check of the game's executable, the same one that builds CDAL's data for that build. It counts only CDAL IDs:

  • A mod that also uses its own site pack has its pack addresses checked by its author, not here ("site_pack": true puts a note next to it). After a patch, follow PACKS.md, step 6.
  • A mod that embeds its own copy of CDAL's database (see What to ship) uses the newer CDAL/ folder when the player has one, so the status is right for players who install the data update.
  • Things that aren't addresses, such as a changed game data file or a struct whose layout changed, can still break a mod that shows ✅.

Writing the file with Python

You need the mod's source (or the list of IDs each feature uses), Python 3.10 or later, and this repository or the CDAL SDK.

  1. Open a terminal in the repository (or in the SDK's root folder) and run set PYTHONPATH=python (in PowerShell: $env:PYTHONPATH = "python").

  2. Write the file from your source:

    python -m cdal_tools enroll --name "My Mod" --author myname --nexus https://www.nexusmods.com/crimsondesert/mods/1234 --source C:\path\to\my-mod\src
    

    Each distinct set of recognized CDAL IDs in a require({...}) call, in a cdal_port::require("Feature", {...}) call that CDAL Studio's "Set it up for me" adds (the string becomes the feature's name), or in a C array of CDAL_ID_... constants becomes one feature. It reads the mod's C and C++ files (.c, .cpp, .h, .hpp, .inc, .inl, .ixx, .tpp and similar). Files CDAL Studio writes next to a mod, whose names start with cdal-port- or cdal-agent-, are skipped. Calls and arrays with the same ID set are merged, keeping the first feature's name. A require() called on a cdal::Feature (g_travel.require({...}) after cdal::Feature g_travel{"My Mod", "Fast travel"}, declared in any file of the mod) takes the declaration's name. Otherwise a comment on the line just above the call becomes the feature's name (// Fast travel), or else the feature is named after its file and line.

    It writes db/mods/my-mod.json, updates mods.md, and prints the mod's status on each game build. Add --print to print the file instead of writing it.

    Without source, or to add a feature by hand, name the feature and its IDs (names as in ids.md); --feature also lists separately features that use the same IDs:

    python -m cdal_tools enroll --name "My Mod" --author myname --feature "Fast travel=Travel::QueueCall1,SaveGame::LoadSlot" --feature "Stamina=StatusComponent::ApplyStatDelta"
    
  3. Check it with python -m cdal_tools validate --check-generated. It names any ID that doesn't exist or is retired.

  4. Send it: add --code and paste the code into Enroll my mod in #mod-status on Discord, paste the file into the Enroll a mod issue form, or commit db/mods/<name>.json, docs/reference/mods.md and docs/reference/mods.json in your fork and open a pull request (CONTRIBUTING.md).

Running enroll again with --source updates the features from your source and keeps the names and core flags you gave features whose IDs didn't change.

The enrollment code

The code is the file on one line, for the Discord Enroll my mod form: CDAL-ENROLL-1: and then the file as minified JSON, with key (the file name) first and each ID as its number, so it fits the form's 4,000 characters:

CDAL-ENROLL-1:{"key":"my-mod","name":"My Mod","author":"myname","features":[{"name":"Fast travel","core":true,"ids":[173,41]}]}
  • CDAL Studio's Copy the enrollment code and open Discord puts it on your clipboard. Without Studio: tools\cdal-studio.exe enroll <source> --name "My Mod" --author myname --code, or python -m cdal_tools enroll ... --code. Both print the same bytes.
  • A mod whose code is longer than 4,000 characters gets an error instead; save the file and use the GitHub form.
  • python -m cdal_tools enroll --from-code <code> reads a code back and writes db/mods/<key>.json; --from-issue <file> reads an Enroll a mod issue body, with a code or the file as JSON, and takes the Nexus page and Discord user ID from the form's answers. Both check everything validate checks and say what is wrong in plain words, and --report <file> also writes the result as JSON. The maintainer's intake workflow uses --from-issue (Handling an enrollment).

Fields

{
  "name": "My Mod",
  "author": "myname",
  "nexus": "https://www.nexusmods.com/crimsondesert/mods/1234",
  "discord": "123456789012345678",
  "features": [
    {"name": "Fast travel", "core": true, "ids": ["Travel::QueueCall1", "SaveGame::LoadSlot"]},
    {"name": "Stamina", "ids": ["StatusComponent::ApplyStatDelta"]}
  ]
}
  • name: as players know the mod. author: your name or handle, as on Nexus Mods. Neither may contain a backtick or any of * _ ~ | [ ] < > @ # \, because they are shown in Discord.
  • nexus (optional): the mod's page, linked from the board.
  • discord (optional): your Discord user ID, only if you want to be mentioned when your mod's status changes. To get it: Discord, User Settings, Advanced, turn on Developer Mode; then right-click your name and Copy User ID. It is 17 to 20 digits, not your user name.
  • features: what players would notice is missing. name is shown on the board, so use words players know ("Fast travel", not hook_travel). List every CDAL ID the feature passes to require(). Add "core": true to a feature without which the mod is pointless; --core "Fast travel" does the same from the command line.
  • site_pack (optional): true when the mod also uses its own site pack. --source sets it when it sees cdal::Pack or cdal_pack_open.
  • public_ids (optional): true when the author opts in to show this mod's name next to its declared CDAL IDs on the Hub's Game Builds & IDs explorer (game-builds.html, visible to visitors who enable Show public mod tags). Pass --public-ids / --no-public-ids to cdal enroll (or --public-ids to cdal-studio enroll), or tick the optional checkbox on the GitHub enrollment form. Defaults to off (false, omitted from the JSON).
  • pack (optional): the numbers for the coverage table, {"sites": 120, "signed": 117}: how many addresses your site pack has, and how many of them pack sign gave a pattern. Don't type it: add --pack <your pack folder> to the command above, after signing the pack (PACKS.md, step 3). Run it again after you sign the pack again.
  • script (optional): BSX Lua metadata, {"version": "1.0.0", "needs_plugins": [], "packs": []}. enroll --source <script folder> writes it from script.json; the required CDAL IDs still live in features, so existing status-board fields stay the same.

The key, the file name without .json, is lowercase letters, digits and -.

Enroll a BSX Lua script

Use the folder containing script.json, normally BSX/scripts/<name>/. Enrollment reads the manifest without running Lua or loading any plugins or packs:

python -m cdal_tools enroll --source C:\path\to\BSX\scripts\hello

For example, script.json can contain:

{
  "name": "Hello",
  "version": "1.0.0",
  "author": "Ratty123",
  "lua_api": 1,
  "needs_ids": ["Game::Update", "ClientEquipment::Equip"],
  "needs_plugins": [],
  "packs": [],
  "native": false
}
  1. Give name, version and needs_ids in the manifest. IDs use their names from ids.md; unknown or retired IDs are rejected. Use "needs_ids": [] when the script needs no IDs. needs_plugins and packs are lists of names and default to empty lists. The Lua loader owns runtime settings such as lua_api and native; enrollment does not validate or execute those settings.
  2. The manifest supplies the name and author; --name and --author can override them. If the manifest omits author, supply --author or keep the author from an existing enrollment. You can pass the script.json file itself instead of its folder, and use --key, --nexus, --discord and --print as for an ASI mod.
  3. All needs_ids become one core feature called Script, with duplicates removed. Any missing ID marks the script broken. Edit the manifest to change its required IDs; --feature cannot override them in the same command. Re-enrollment preserves a feature's custom name when its ID set is unchanged, and keeps it core.
  4. The enrollment retains version, required plugin names and pack names in the optional script object. A non-empty packs list also sets site_pack; use the existing --pack option for a signed pack's coverage counts. Changing the pack list clears old coverage counts, so pass --pack again if needed. Re-enrollment refreshes the version, IDs and dependencies, including removed dependencies.
  5. Check and send the enrollment and docs/reference/mods.* as in Writing the file with Python, steps 3 and 4. The script appears alongside ASI mods on the existing status board. docs/reference/mods.md also lists its version and dependencies. Plugin installation, plugin versions, pack addresses and Lua behavior are not checked by this board. A script with no required IDs has no missing-ID failures; that is not proof it runs in game.