CFDiag
Dev tool by TeamVanilla
Diagnostics for CrossFire: Python tools that analyze its files on disk, and a library that observes the game while it runs.
CFDiag has two parts. The offline tools only read files. The live library is loaded into the running game as a replacement for its DirectInput library, hooks the game's own calls and reads its memory, and also carries its own code to keep the game's anti-cheat from flagging it. We do not describe or publish that part here. Run it only on your own machine and a setup you control. There is no download on this page.
Offline analysis
Point the tools at a CrossFire install and one command runs the analysis, writing a report per program plus a summary.
cf_staticTriage. Reads each program or library: its headers, sections (with an entropy reading, which gives away packing), imports, exports, and every readable string sorted into file paths and format strings.cf_rttiClass model. Recovers the engine's class list from its compiler metadata, with each class's base classes, for 32-bit and 64-bit builds.cf_offsetsField offsets. Works out where each class keeps its data by reading the small accessor functions in its tables.cf_classdbClass database. Merges the two into one catalogue of classes and fields that the SDK and the Encyclopedia draw from.cf_functionsFunction names. Names functions from class tables and exports, then from the text strings they load.cf_callgraphCall graph. Labels a function by what it calls, so a caller of a table reader is known to be setting that table up.cf_cft_mapTable map. Ties each content table (.CFT) to the function that loads it.cf_encTable and script decoder. Decodes the game's content tables (.CFT) and its Squirrel game-data scripts (.ENC and .nut) into readable text. Both ciphers were worked out from files we own.analyze_payloadArchive payloads. Decrypts a REZ archive's contents with the cipher recovered from the server library, and checks how they are compressed.cf_verifyVerification. Re-derives the facts above and cross-checks everything, reporting what reproduces and what conflicts.
Live diagnostics
The live part is a C++ library built on the VanHooks hooking library. It loads into the running game, stands in for one of the game's own system libraries, and runs its observers from inside the game's process. Each hook calls through to the original, so what it watches is passed on unchanged.
It also runs its own checks against the game's anti-cheat (XIGNCODE3, Themida, HGWC) so those systems don't flag it. We don't describe how that works here.
- NetworkObserves the game's Winsock calls (send, receive, connect, close) and logs each packet with its direction, size, time and a hex dump of the start of it, plus per-connection counts.
- Objects and classesScans the running game for live objects, matches them to the recovered class database and counts instances per class, then logs spawns and despawns over time. It also dumps virtual-method tables and traces calls and object destruction.
- RenderingCounts Direct3D 9 draw calls, primitives, texture and state changes, and resource creation each frame.
- System callsLogs module loads, file reads and writes, thread creation and memory allocation made by the game.
- OverlayAn in-game panel showing the live class table and the network, rendering and system counters.
What it found
- The real client is the 64-bit one. The shipping
crossfire.exe,CShell_x64.dllandObject_x64.dllsit underx64/. The same-named files at the install root are empty stubs. - Those three are protected with Themida. Their section names show it, so reading their code and strings from disk does not work. The class model therefore comes from the unprotected
server.dlland the.ltoobject files; the live library is what checks it against the running client. - What still shows through the protection: the import table. It says the client uses DirectX 9, DirectInput, a web view for its interface, FMOD for audio and crash reporting.
- The content schema and its data. The engine refers to a long list of content tables, and CFDiag maps each to its loader. The decoder reads the tables and scripts themselves, and the game-data scripts hold weapon parameters, skills, AI and mode rules.
Where it is used
CFDiag's class catalogue feeds CFireSDK and the research behind the Encyclopedia. File layouts are described in the REZ guide, and you can browse the files themselves in OpenedCF.