server-re/docs/ARCHITECTURE.md
2026-10-14 17:49:46 -04:00

56 lines
2.8 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Architecture — Rusty Hearts server binaries
What is known about how the shipped server binaries are built and structured.
Each claim is marked **observed**, **inference**, or **unknown** (see AGENTS.md).
Shared framework (config files, server kinds, DB access path): see
[`SHARED_FRAMEWORK.md`](SHARED_FRAMEWORK.md).
## Implementation language: C++
All 16 server executables in `binaries/` are written in **C++**, compiled with
**MSVC 2010** (Visual C++ 10) for Windows x64.
| Marker | Why it implies C++ | Where seen |
|---|---|---|
| MSVC RTTI type descriptors (`.?AV…@@`), including templates | Emitted only for C++ polymorphic classes | All 16 EXEs (161–1,035 each) |
| `__CxxFrameHandler3` import | C++ exception-handling runtime | All 16 EXEs |
| `MSVCP100.dll` import (`std::` streams/containers) | C++ standard library, VS2010 | All 16 EXEs |
| Linker version 10, `MSVCR100.dll` | VS2010 toolchain (matches `vcrun2010` dependency) | Agent (checked) |
| vftables, `operator new/delete`, multiple vftables per class | Virtual dispatch, multiple inheritance | Agent (decompiled) |
Status:
- **Observed (decompiled):** `Agent_Release_x64.exe`. See
`decomp/Agent_Release_x64/evidence.md` and `cpp/classes.hpp`.
- **Observed (markers only):** the other 15 EXEs. The RTTI, C++ EH and MSVCP100
checks were run with `strings` and `objdump` on 2026-10-14; they have not been
decompiled yet.
- **Unknown:** the support DLLs are a mix. OpenSSL and curl are C, BugTrap is
C++, and the proprietary DLLs are unchecked (see `third-party/README.md`).
Implications for decompilation:
- Ghidra produces C-like pseudocode. C++ structure is not recovered
automatically. Recover it from RTTI and vftables (`decomp/scripts/VTableMap.java`).
- No PDBs are shipped, so method names, signatures and data members are
unknown unless reconstructed.
## Statically linked libraries (observed in Agent; others unchecked)
- **ProudNet** (Nettention, proprietary): networking and RMI. Headers are local-only; see `third-party/README.md`.
- **TinyXML** 2.5.x (inference: 2.5.1–2.5.3, from its error table). XML
config parsing (`TiXml*` classes); present in 14 of 16 EXEs. Source is in
`third-party/tinyxml-2.5.3/`.
- **ATL**: `CAtlException` and related classes.
## Application code conventions (observed in Agent)
- Class prefixes are `Magi*` / `MG*` / `MB*`, for example `MagiAgentServer`,
`MGAgentManagerSession` and `MBCLog`.
- The singletons use the `MBISingleton<T>` template.
- The timer class is `Magi::Timer`.
- Inter-server RMI interfaces live in namespaces named
`<FROM>2<TO>_PROTOCOL`, for example `AGENT2AGENTMANAGER_PROTOCOL`. Each
generated `Proxy` / `Stub` class is wrapped in the `RNP` namespace.
- Config is XML under `option\*.xml`.
- Whether the other servers share this framework is an **inference**, based on
their names and similar RTTI counts. It is unverified.