BF2.US bf2-rsdeveloper wiki Parity Discord bf2.us
On this page

Reading the notes

BF22142Heroes

This wiki is the readable front of a much larger body of text: the notes. Every page here ends with a line that names the notes it was written from. The notes are where a claim meets its evidence, and where you look when a page is not enough. They were written by many hands in a hurry and have a vocabulary of their own; this page is the key to it.

From a sentence of the wiki to its evidence a wiki page a statement with an address, and at the page's end the notes it was written from the note the same address with what the function does and a status word: verified, read, unverified the original's listing the function at that address: decompiled text and instructions, on your own machine the Rust function the address again, in its doc comment: this is what makes it ported a test the address a third time, in the test's own text: this is what makes it tested (strict) one address ties the five together: rg 0x006a8730 notes crates
One address runs through all five. If a page says more than its note, the page is wrong.

Where things are#

FolderWhat is in it
notes/ (top)the index (README.md), the conventions, the workflow, what is known about the original binaries and their source tree
notes/subsystems/one file a part of the engine: the object model, physics, the renderer, the network, the AI, the HUD, sound ..
notes/formats/one file a file format: meshes, collision meshes, animation, terrain, textures, fonts, demos, navigation data
notes/tracks/goals that cut across parts: playability, multiplayer, physics a player meets, menus, the HUD, performance, input, validation
notes/bf2142/, notes/bfheroes/what differs in the other two games, and their own systems (the Titan, abilities, widgets)
notes/editor/, notes/tools/the port's own tools
re/data/, re/symbols/tables read out of the binaries, and the curated names of their functions

Start at notes/README.md: it is a table of every file with one line on its topic. The tree as a whole is described in docs/release/LAYOUT.md, and how to build it in docs/release/BUILDING.md.

How a claim cites its evidence#

The first rule of the notes: a claim about the original cites what it rests on. Three kinds of evidence count:

  • an address: BF2.exe!0x0083d498 is the function at that address of that program;
  • a string of the binary (a console command's name, an error message, a source file path left in by the compiler);
  • a test against the game's data or the original's code (an oracle case, a parser that reads every shipped file of a kind).

The forms of an address#

FormProgram
BF2.exe!0x........Battlefield 2's client, version 1.50
bf2_w32ded.exe!0x........Battlefield 2's dedicated server for Windows: the same engine with fewer client parts, often the easier one to read
RendDX9.dll!.., AIDLL.dll!.., BF2Audio.dll!..the renderer, the bots, the sound: libraries beside the game
BF2142.exe!.., bf2142ded!..Battlefield 2142's client, and its Linux server
BFHeroes.exe@bfh126!..Heroes' client of version 1.126 (the tag behind @ names the version); an address of an older version is named in words, as in "1.89's 0x00974b0c"

A bare address in a note belongs to the program the file's head names. The Linux servers matter for a reason: they shipped with their symbols, so their function names are the developers' own. Names in the notes that look like real C++ (GhostManager::setControlObject) usually come from there, carried over to the Windows programs by matching the functions.

Offsets look like +0x2b0: a field at that offset of an object. vt+0x1d4 is an entry of a virtual table: "the object is asked a question through its table at that slot", used when the function behind it was not named.

The status words#

Notes say how sure they are, and the wiki keeps their words:

In a noteMeans
verifiedcompared with the original by a check that runs: an oracle case, a differential, every shipped file
read / as read / a readingsomebody read the listing and wrote down what it does; no check holds it yet
surveyedthe functions are found and named with their addresses; the bodies were not read through
(unverified)an inference: a guess from names and context, marked so on purpose
openknown to be missing or not understood
tracedfollowed through the original's code, not implemented
filed differencethe port does something else than the original, and a row says what

When this wiki says "as the sweep read it" or "a reading", it is passing on the second row and not the first.

Sweeps and their rows#

A sweep is a pass over every thing of one kind: every HUD variable, every widget, every screen, every ability. A sweep file (notes/bfheroes/hud_sweep.md, widget_sweep.md, screen_sweep.md, ability_sweep.md) is mostly one big table. A row has:

  1. the thing (a variable's name, a widget);
  2. where the original writes or runs it (an address, and whether the function was read whole);
  3. what the original does;
  4. what the port does, with the Rust function;
  5. the verdict: SAME, DIFFERS, MENDED, NOT WIRED, NOT SETTLED;
  6. what a player sees of a difference.

Behind the table come sections by round ("Round 27", "Round 28") that say what changed: which rows were mended, which were played in a client, what was left. A row's state today is its last mention, so read the table and the last round's section. The counts at a round's end ("83 rows: 64 SAME, 8 MENDED ..") are the quick answer to "how far is this".

Task numbers and other marks#

  • H1234 is a task of the project's queue; R-0096 a request from a player or the owner. They tie a paragraph to the change that made it.
  • chain link 785 is the 785th merge of the landing chain: the notes' way of saying "as of this state of the tree".
  • bots12, render21, h19 round 27 name the worker and round that wrote a section. They are history; the content is what counts.
  • A crossed-out or "corrects render8" remark means an older section was wrong. The newer one wins; the notes keep both so the reason is not lost.

Looking a function up yourself#

With the analysis export on your machine (it is made from your own copy of the game and is not in the tree) the query helper answers by address or name:

powershell
python re\py\bfre.py fn BF2.exe 0x006a8730        # the decompiled function
python re\py\bfre.py dis BF2.exe 0x006a8730 60    # its instructions
python re\py\bfre.py callers bf2_w32ded.exe 0x00557270
python re\py\bfre.py str BF2.exe "heightmapcluster"   # strings and who uses them

Three facts about the binaries save time: they were built with a 2003 Microsoft compiler; methods take this in the ecx register; and console commands are objects built with their name and argument types as strings, so a command's name leads straight to its code.

From a wiki page to its notes#

Every page ends with Notes: .. and most have an "In the code" table. To check a statement of a page:

  1. open the note it names and search for the address the page gives;
  2. read the status word beside it;
  3. open the Rust file from "In the code" and find the same address in a doc comment;
  4. look for a test that names the address (rg 0x006a8730 crates).

If the page says more than the note does, the page is wrong: tell us. See also how a port is made, the glossary and the questions people ask.

How it is tested#

This page explains; it holds no code of its own. The notes' own checks are tools of the tree: a lint for comments that cite the original (re/py/comment_lint.py) and the parity counter's --check, which fails on a citation that names no function's start. The wiki's test checks that every link and anchor on it leads to a page of the build and that its diagrams are the ones the script draws.

In the code#

This page names no crate of its own. How the codebase is organised maps the crates by area, and docs/release/LAYOUT.md in the tree has one line for every folder and crate.

Source: docs/dev/guide/reading-the-notes.md · built from bf2-rs e3b4f05 · part of the Battlefield 2 / 2142 / Heroes reimplementation. Not affiliated with EA or DICE.