Dunia.dll — Command-Line Parsing and Full Flag List
See the overview for binary identification.
Every entry in the live-test results below was checked against the retail
FarCry2.exe, not inferred from the disassembly alone.
Traced from RunGame (0x10006510) down through InitDuniaEngine (0x10004900) and its callees,
fully decompiled and read. FarCry2.exe itself is a ~28 KB shim: it imports
?RunGame@@YA_NPAUHINSTANCE__@@PBD@Z from Dunia.dll and hands the command line straight through,
so every flag on this page applies to FarCry2.exe.
Three independent parsing mechanisms exist:
- Ad-hoc
strstr(cmdline, "-flagname")checks scattered across several functions — presence-only flags, or (via the helpersFUN_1003f7f0(cmdline, "-flagname", &outBuf)andFUN_104d0420(cmdline, "-flagname", ...)) flags that also capture the following token as a value. - A generic
-key valuetokenizer,ParseGamerProfileArgs(0x10661950) — walks the whole command line splitting on-/space and stuffing every pair into a"GamerProfile"XML node viaFUN_106616e0(profile, key, value). The dash is stripped, so consumers look up bare names. Only pairs where an actual value follows are stored; presence-only flags never enter this bag. CCryEngine::Initialize(0x104d0510) reads its own cluster of engine flags directly off the command line, separately from the two above.
Matching is strstr against the raw command line
Every check is a substring match on the whole command line, not tokenised argument parsing. So
-loadx takes the -load branch, -benchmarkloop alone is enough to enter the -benchmark branch,
and -spawn matches inside -spawnpos and -spawnangle. Confirmed live: -loadx enters the
-load branch and dies there exactly as a -load naming a missing save does.
Dispatch is a first-match-wins chain
CFCXGameCmdLineParser::Process (0x10663d40) is a strict if/else-if ladder. The first match wins
and every branch below it is dead for that launch:
Process(cmdline)
always: -exec, -notracking
-editorpc -> FUN_10661b40 (editor-PC node) RETURN
-benchmark -> CreateBenchmarkNode [0x10662f90] RETURN
-host -> DispatchNetworkMode [0x10663af0] -> CreateHostNode
-join -> DispatchNetworkMode -> CreateClientNode
-load -> FUN_10661f50 (see below)
-wait -> DispatchNetworkMode -> CreateHostNode
(else) -> CreateMainMenuNode [0x106622f0] (-ubidays read here)
Note that -client is not a branch in this chain. It is only read inside
DispatchNetworkMode, which you can only reach via -host, -join or -wait, and in
InitDuniaEngine to build a window-title suffix.
Which flags are required together
| Goal | Required combination |
|---|---|
| Load a world | -benchmark <mode> and (-world <name> or -map <name>) — neither works alone |
-benchmark | must be accompanied by -world or -map, else a hard usage error |
-spawn / -spawnpos / -spawnangle | only parsed inside the -benchmark branch |
-host | requires -login, else a hard usage error |
-join | requires nothing else — there is no -login gate on the client path |
| Headless | -norender only takes the headless path together with -dedicated |
-online | incompatible with -noagora — the combination is a hard error |
-world/-map are parsed only inside CreateBenchmarkNode, which Process only reaches when
-benchmark is present, so on their own they do not load a level: FarCry2.exe -world world1 boots
to the ordinary main menu with a 246 MB working set, identical to a no-argument launch (248 MB).
The -login gate lives in CreateHostNode; -join routes to CreateClientNode, which has no such
gate, and -join 127.0.0.1 boots normally with and without -login.
The -benchmark usage error is triggered by the absence of -world/-map — the sub-mode string
is only compared against "playback" to decide whether -benchmarkinputname may substitute for it.
Window / bootstrap flags (checked directly in InitDuniaEngine, before engine subsystems init)
| Flag | Effect |
|---|---|
-borderless | Borderless window — strips WS_CAPTION, leaving WS_POPUP |
-dedicated | Dedicated-server mode; combined with -norender skips window/render init entirely |
-norender | No rendering (only takes the headless branch together with -dedicated) |
-editorpc | Remote-editor/PC connection mode — routes into Process's editorpc branch (FUN_10661b40, not further explored) |
-xpos <n> / -ypos <n> | Window position (only read when not -host/-client) |
-host / -client | Presence checked here to build a window-title suffix; real network handling happens later in DispatchNetworkMode |
-d3dmts | Creates the D3D9 device with D3DCREATE_MULTITHREADED. It reads the token after it as a value, so as the last token it does nothing — use -d3dmts 1 |
-3dplatform <d3d10a|d3d10|d3d9> | Forces the render backend. The three accepted value strings sit next to the flag at 0x10e09d1c–0x10e09d3c. Without it the RenderProfile Platform setting decides (default d3d9); either way D3D10 is used only when the hardware probe passes — see presentation and input |
Engine flags (CCryEngine::Initialize, 0x104d0510)
The strings live together at 0x10e6a334–0x10e6a3d0 and are read via FUN_104d0420.
| Flag | Effect |
|---|---|
-nosound | Disables the sound system (GetSoundSystem()->vtbl+0x14(0)) |
-nosndocc | Disables sound occlusion (GetSoundSystem()->vtbl+0x2c(1)) |
-novoicechat | Skips voice-chat init |
-16bitbroadphase | Physics: 16-bit broadphase |
-nospuheightfield | Physics: disables the SPU heightfield path (PS3-era naming, still parsed on PC) |
-norigidchars | Physics: disables rigid-body characters |
-nomovecache | No effect: it calls an empty function |
Config toggles (ParseGameConfigFlags, 0x10662c70 — runs first, at InitDuniaEngine+0x74)
| Flag | Effect |
|---|---|
-cmdfile <name> | Appends a file's contents to the command line (FUN_10661cf0) — the file must sit in Documents\My Games\Far Cry 2\, see below |
-logFile <path> | Parsed but non-functional in retail — see below |
-nomouse | Disable mouse |
-noexmouse | Acquires the DirectInput mouse non-exclusively (NONEXCLUSIVE | FOREGROUND) instead of exclusively |
-nopad | Disable gamepad |
-nobf | Mounts no archives: every resource is then opened as a loose file named Data_Win32\<decimal path key> |
-nocompile | Disable shader (or script) compilation |
-norender | Also read here (duplicate of the bootstrap check above) |
-runscriptindebug | Run Lua scripts in debug mode |
-zombieai | Agents running MercBrain.ai.xml or AnimalBrain.ai.xml never start their brain; buddies, vehicles and scripted brains still run |
-usearchivecache / -noarchivecache | No effect: the value is stored and never read |
World / spawn (CreateBenchmarkNode, 0x10662f90 — reachable only via -benchmark)
| Flag | Effect |
|---|---|
-world <name> / -map <name> | Selects the level to load. world1 is the campaign world |
-spawn <name> | Spawn at a named spawn point |
-spawnpos <x,y,z> | Spawn at an explicit position |
-spawnangle <yaw,pitch,roll> | Spawn orientation, degrees (multiplied by 0.017453292) |
-bfname <name> | Session/"battlefield" display name (also read in the online-session parser) |
FC2BenchmarkTool.exe embeds its demo definitions as benchmarkdemos.xml, e.g.
world="world1" spawnPos="1876.16,3523.59,34.81" spawnAngles="-13.0094,0.0,-172.572". Used with
-benchmark record, that exact Z spawns you inside the terrain. Raising Z by 2 clears it. So Z
is a usable world altitude, just not a safe one at the shipped values.
Save loading — -load
| Flag | Effect |
|---|---|
-load <savename>.sav | Loads a save directly, skipping the menus. Crashes as shipped, for the reason below; DevTools (mods/DevTools) fixes it, after which this is the one working way to boot straight into playable gameplay |
Every -load failure exits in about 0.3 s with exit code 0, so exit timing cannot tell them
apart. Running under FCSE, whose crash handler names the faulting address, separates them:
| Command | Fault | Meaning |
|---|---|---|
-load <name> | 0x106621B8 | file not found |
-load <name>.sav | 0x104DBB80 | file found, opened and parsed — dies afterwards |
The extension is required and is not a bug: FUN_102a18f0 is a plain basename, and the parser
appends nothing, so a name without .sav matches no file.
GameFileUtils::GenerateRelativeFileName(name, mode) (0x101e9b20) builds the path. The mode
switch is 0 → "Saved Games\", 1 → "Benchmarks\Playbacks\", 2 → "user_maps\",
3 → "user_maps\downloads\"; -load passes mode 0, so the target is
My Games\Far Cry 2\Saved Games\<name>.
Unlike every other branch in Process — which merely record intent into a node object — the
-load branch calls FUN_101cc960, which spins up a GameFileBlockingLoadThread. That thread
(FUN_101cd100) opens and parses the save successfully. It then runs a post-load pass through its
context vtable slot +0x14 (0x1072EE60) that binds the save's records to engine registries by
name, and that is what faults — on registries which do not exist yet:
1072ee8a call 104DBB80h ; ecx = [11644D74h], the settings manager - null
1072eeb3 call 10172820h ; walks a registry at this+50h - null
Inside InitDuniaEngine the call order is:
| Offset | Call |
|---|---|
+0x074 | ParseGameConfigFlags |
+0x52C | Process — the -load branch, including the blocking load, runs here |
+0x10CF | CCryEngine::Initialize — builds 0x11644D74 and the rest of the engine |
So the save is read correctly and then bound against an engine that has not been constructed.
RunGame turns the resulting fault into return false, which is the clean exit-code-0 observed.
DevTools skips that pass while the engine is absent, returning the pass's own "resolved cleanly" result
(1; 5 is its failure code). Live-confirmed: with the fix, -load <name>.sav boots directly into
the save, playable, at ~840 MB working set.
A name that matches no file still faults, at 0x106621B8, and the fix above does not change
that: on a failed load the thread returns its error code 10 and FUN_10661f50 reads the resulting
document pointer without checking it. That path is a separate bug from the one DevTools patches, and it
is only reachable by naming a save that is not there.
Benchmark harness (CreateBenchmarkNode, entered whenever -benchmark is present)
| Flag | Effect |
|---|---|
-benchmark <playback|record|sectors|spawnpoints|path> | Selects benchmark sub-mode. Requires -world/-map; without it: "Invalid parameters for -benchmark. Ex; -benchmark {playback|record|sectors|spawnpoints|path} -world worldname -map mapname" |
-benchmarkinputname <name> | Names a playback file under Benchmarks\Playbacks\; accepted instead of -benchmark playback |
-benchmarkloop <n> | Loop count for the benchmark (default 1) |
-benchmarkfixedframerate | Force a fixed frame rate during the benchmark |
-benchmarkdisableai | Disable AI during the benchmark (also pokes an engine flags int, +0x20 = 0xfff7) |
-benchmarkid <id> | Numeric benchmark ID |
The shipped FC2BenchmarkTool.exe composes exactly these, e.g.
-benchmark playback -world <w> -benchmarkinputname "<name>" -benchmarkloop <n> -benchmarkdisableai.
A playback file is a demo recorded in ordinary gameplay with Numpad 8; see demo recording and playback.
Observed sub-mode behaviour:
sectors— loads the world and sweeps a moving camera through it. Working set ~851 MB versus ~250 MB at the main menu.record— loads the world at the requested spawn and holds a static view. No player control: WASD and mouse-look are both dead, though Esc still quits. No player character is possessed; this is a camera harness, not gameplay.path— needs a playback file underBenchmarks\Playbacks\. With none present, it reaches a loading screen and then exits.
How a run is measured
Traced statically in the Steam Dunia.dll, with names from the dedicated server. Not yet watched in
a running benchmark.
A run plays in the game-rules state CFCXGRStateBenchmark, after CFCXGRStateBenchmarkWaitForLoad
has seen the world load.
- Each frame: the state advances the benchmark mode, and shows
(Loop i/n)-(ESC to Cancel). - When the mode says a loop is over: the state has the mode write its report. If loops remain
(
-benchmarkloop), it resets the mode and counts the loop. After the last loop it asksCXGameto quit. -benchmarkfixedframerate: the state locks the timer to 30 fps on entry.
Every mode counts frames with CFCXBenchmarkFrameBasedCollector. Its Steam vtable is 0x10E8F924.
| Slot | Function | What it does |
|---|---|---|
| 0 | Initialize (0x10741790) | Empties both sample arrays, sized for 20,000 frames. Sets a warm-up of 10 frames at +0x20 |
| 1 | Update (0x107417E0) | Counts nothing until the warm-up runs out, and resets CRenderStats when it does. After that it records each frame's time from CRenderStats, and a rolling one-second frame rate. Draws FPS, Frame and Time(s) as debug text |
| 2 | SaveToFile (0x10741A10) | Writes frame(id), fps(last_second), end_time(s), one row per counted frame |
The file is BenchmarkReport<loop>.csv, in a Results\ folder under the benchmark output path.
Each mode has its own report function that names it: 0x1067B100, and 0x108A5210 for the camera
path. Update is reached only through the vtable, so the address library has no entry for it.
DevTools' Diagnostics tab finds it by pattern instead, and measures over this same window.
Networking (DispatchNetworkMode 0x10663af0 → CreateHostNode 0x10662440 / CreateClientNode 0x10662b40)
CreateHostNode aborts if -login is absent ("Invalid parameters for -host, missing (-login)").
CreateClientNode, which is what -join reaches, does not.
| Flag | Effect |
|---|---|
-host | Launch as server (requires -login) |
-client | Read only inside DispatchNetworkMode; unreachable unless -host/-join/-wait is also present |
-join <ip> | Connect to a server IP; validated with inet_addr. Usage strings: "Trying to launch an online client with an invalid ip (-join xxx.xx.xx.xx)" / "...but ip is missing..." |
-wait | Wait-for-connection mode; routes to CreateHostNode, so it inherits the -login requirement |
-login <name> | Ubi.com/Agora login name |
-password <pw> | Login password |
-keyonline <key> | CD-key/license token for online auth |
-sessionuid <uid> | Numeric session ID (parsed with _strtoui64) |
-team / -ctf / -vip | Selects game mode constant |
-online | Agora-backed online, network scope code 2 |
-lan | Sets scope code 3 — which is already the default, so this flag is a no-op |
-noagora | Forces non-Agora networking; with -online it is a hard error |
-ranked | Marks the session ranked |
-dedicated | Also read here, marking the session dedicated for the online layer specifically |
Misc
| Flag | Effect |
|---|---|
-exec <file> | Execute a console/Lua command file at boot (read in Process before branching). The file is found as given if absolute, else in Documents\My Games\Far Cry 2\, else in Data\scripts\Console\, and each line is run as a console line. The console it feeds is real and reachable — see the developer console — but this flag itself is untested |
-notracking | Disables the telemetry/tracking client (read in Process before branching) |
-ubidays | Requests a "ubidays" UI mode in CreateMainMenuNode (0x106622f0) — a trade-show/kiosk build hook. No visible effect in retail |
-openautomate | NVIDIA OpenAutomate benchmarking, below |
OpenAutomate (-openautomate, handled entirely separately by FUN_10005fa0)
If -openautomate is present, RunGame skips the normal game loop entirely and enters a
numeric-command dispatch loop (FUN_10299a00 returns a case 0–6, dispatching to
FUN_10006710/FUN_10008620/FUN_10007050/FUN_100075a0/FUN_100065b0/FUN_10006600). It is
NVIDIA's OpenAutomate SDK, which lets a benchmarking tool drive the game: the SDK's own messages
("oaInit() called more than once.", "OpenAutomate PluginPath was undefined") are in the binary.
None of the 6 handlers have been examined.
-cmdfile needs a file in My Games\Far Cry 2\
CFCXGameCmdLineParser::AppendCmdFile (0x10653fd0 in the GOG build, RE-verified) reads the file
and appends its contents to the command line before any other switch is read, so every switch works
from it — the window switches -borderless and -xpos too. Four details decide whether it works:
- Location. The name is glued onto
Documents\My Games\Far Cry 2\with no check for an absolute path, so give a bare file name (or a path relative to that folder). An absolute path fails silently. - Last byte. The engine overwrites the file's last byte with a terminator, so end the file with a newline or a space. Without one the last switch loses its last letter.
- Encoding. ANSI or UTF-8. A UTF-16 file — what Windows PowerShell 5.1's
>andOut-Filewrite — stops at its first zero byte. - Precedence. A switch on both the real command line and in the file takes the command line's value.
A test that meets these conditions:
Set-Content -Encoding ASCII -Path "$([Environment]::GetFolderPath('MyDocuments'))\My Games\Far Cry 2\fc2args.txt" -Value '-nomouse -borderless '
.\FarCry2.exe -cmdfile fc2args.txt
The mouse should be dead in the menu and the window style 0x94000000; the same file written with
-NoNewline -Value '-nomouse' should leave the mouse working.
-logFile appears dead in the retail build
Live-tested (.\FarCry2.exe -logFile C:\path\engine.log): no file is created. The reason, in
ParseGameConfigFlags and its caller InitDuniaEngine:
- The flag is genuinely parsed —
FUN_1003f7f0(cmdline, "-logFile", param_1 + 0x13)captures the path into a dedicatedstd::stringfield of the config objectParseGameConfigFlagsconstructs (called twice, redundantly — a harmless duplicate). That config object is constructed directly onInitDuniaEngine's own stack frame (confirmed via disassembly — the three boolean fields immediately after it,nomouse/noexmouse/nopad, are read back at fixed stack offsets and driveDAT_10fd42c0..c2, so the frame layout is confirmed, not guessed). The logfile string sits atthis+0x4cin that frame. - Nothing in
InitDuniaEngine's full disassembly reads thatthis+0x4cstack slot after the parse. NoCreateFileA/fopen/log-write call anywhere in the function takes that buffer as an argument. - The RTTI-derived class list does contain a
CLog, but its mangled RTTI name is.?AVCLog@MassiveAdClient3@@— it belongs to the third-party MassiveAdClient3 in-game-advertising SDK linked into this DLL, not an engine logging facility. No otherLog-named class or function exists in the binary.
Conclusion: -logFile's value is captured and then goes nowhere within the boot path — vestigial
parsing left over from a development build whose actual log sink was stripped for retail, not a flag
the user is invoking wrong. Not proven for the entire 20MB DLL (one function's disassembly is traced
exhaustively, not every one of the ~90k functions in the binary), but no plausible consumer is known
anywhere reachable from boot. The developer console, a separate subsystem,
does survive.
Live-test results
Method: launch retail FarCry2.exe, sample process liveness/exit code, main-window title, window
style and rect, and working-set size; kill and repeat. Visual and audible outcomes were confirmed by
a human watching each run.
Useful discriminators: main menu sits at ~170–250 MB working set, a loaded world at ~750–850 MB;
usage errors surface as a real window titled Error; -borderless shows up as window style
0x94000000 instead of the default 0x14CA0000.
| Flag / combination | Result |
|---|---|
| (no arguments) | Baseline: title Far Cry 2, style 0x14CA0000, rect 0,0 1286x749, 248 MB |
-borderless | Works. Style → 0x94000000 (WS_POPUP), client size stays 1280x720 |
-xpos 100 -ypos 200 | Works. Origin → 100,200. Composes with -borderless |
-nosound | Works. Completely silent |
-nomouse | Works. Mouse dead in the menu |
-spawnpos / -spawnangle | Work. Two different shipped spawn values start in visibly different places |
-benchmark sectors -world world1 | Works. 851 MB, world loaded, camera sweeping |
-benchmark record -world world1 -spawnpos … | Loads the world, but no player control (camera harness only) |
-dedicated -norender | Works. No window, clean exit after 4.3 s |
-benchmark playback (no -world) | Usage error — Error window, 401x156 |
-host (no -login) | Usage error — Error window, 275x130 |
-join 127.0.0.1 | Boots to the normal main menu. Same with -login added — no gate |
-editorpc | Boots to the normal main menu; no observable effect |
-3dplatform d3d10 | Boots normally; which backend actually loaded was not confirmed |
-world world1 (alone) | Ignored. Normal main menu, 246 MB |
-ubidays | No visible effect |
-load <name>.sav | Works with DevTools. Boots into the save at ~840 MB. Unpatched it faults at 0x104DBB80 |
-load <name> (no extension) | File not found — faults at 0x106621B8 |
-cmdfile <file> | File contents not applied — but the test file did not meet the conditions above |
-zzznotaflag | Unknown flags are harmless — boots normally |
-3dplatform is unverified: a 64-bit host cannot enumerate a WOW64 process's loaded modules
(tasklist /m returns only the WOW64 shim), so which D3D DLL loads cannot be observed that way.
Flags this page does not cover behaviourally
These are parsed for certain but have no signal observable from outside the process, and are not
live-tested — the tables above give what the code does where it was traced: -noexmouse, -nopad,
-nobf, -nocompile, -runscriptindebug, -zombieai, -usearchivecache, -noarchivecache,
-d3dmts, -nosndocc, -novoicechat, -nomovecache, -norigidchars, -nospuheightfield,
-16bitbroadphase, the -benchmark* sub-flags, and the multiplayer flags beyond the -login gate.
Flags that exist only in FC2ServerLauncher.exe
Not present in Dunia.dll:
| Flag | Effect |
|---|---|
-noredirectstdin | Documented in FC2ServerLauncher_ReadMe.txt (added in Dedicated Server 1.03 R2): lets an external app feed the server console via standard input |
-help | Present as a string; behaviour not examined |
Enumerating the flags yourself
The complete set is 58 dash-prefixed strings in Dunia.dll, in three clusters:
0x10e09ac8–0x10e09d94 (bootstrap/window), 0x10e6a334–0x10e6a3d0 (engine), and
0x10e8d190–0x10e8d524 (CFCXGameCmdLineParser), plus -noagora at 0x10e41334.
Ghidra's string index misses six real flags — -map, -lan, -vip, -ctf, -3dplatform and
-16bitbroadphase — because they sit in padding gaps between indexed strings or begin with a digit.
They are only visible by dumping those three address ranges as raw bytes and reading the
null-terminated runs directly, not by searching the string table.
Unknowns
- The
-editorpchandlerFUN_10661b40itself, which shows no observable effect in retail. - Whether
-3dplatformactually switches backend on a retail install. - The six
-openautomatesub-handlers.