How goatcorp/dalamud works
Main components
• Injector and Bootstrapping Modules:
• Dalamud.Injector.Boot (C++): This module is responsible for loading the .NET Core runtime into the target process via hostfxr. It serves as the initial entry point.
• Dalamud.Injector (C#): This component then performs the DLL injection into the target process.
• Dalamud.Boot (C++): Alternatively, when not doing a full DLL injection, this component can rewrite a process’ entrypoint to start the Dalamud runtime.
• Core Framework (Managed Side):
• Dalamud (C#): The core API, game bindings, and plugin framework functionalities reside here. It is responsible for managing internal services, hooking into the game’s native data, and providing the API layer.
• Dalamud.CorePlugin (C#): A plugin used as a testbed and prototype for developing new features, demonstrating how plugins can interact with Dalamud internals.
Out external dependencies and libraries
• External libraries like cimgui, cimguizmo, cimplot, nlohmann-json, and others are present under the “external” and “lib” directories. Represent these as supporting libraries that the injector and core framework rely on.
• Build scripts and CI configurations (e.g., .github/workflows, build scripts, and NUKE build configuration) should also be depicted as part of the development and deployment pipeline.
Relationships and flow
– DLL Injection: Dalamud.Injector.Boot initiates runtime loading and hands off execution to Dalamud.Injector.
– Entry Point Rewriting: Dalamud.Boot rewrites the target process’s entrypoint to start the managed runtime.
• Once the injection is complete, the .NET Core runtime is loaded and launches the managed Dalamud component.
• The Dalamud component then initializes its services – game hooking, memory manipulation, plugin management, and API exposure – allowing plugins (including CorePlugin and any third‐party plugins) to connect.
Architectural patterns and technologies
• Hybrid architecture: A clear separation is visible between the native (C/C++) bootstrapping/injection components and the managed (.NET Core/C#) logic.
• Plugin extensibility: Emphasize the API layer and service interface provided by the core Dalamud framework. Mark how it interacts with game state and external game data.
• Build and deployment: Briefly note the presence of CI/CD pipelines and build scripts that automate building, signing, and testing components.