Files

4.4 KiB

gregExtractor

gregExtractor is a dual-mode mod scaffolder for Data Center (Unity IL2CPP + MelonLoader).

It runs as:

  • Desktop GUI (gregExtractor or gregExtractor --gui) using Avalonia.
  • CLI tool (gregExtractor extract, gregExtractor create ...) using Spectre.Console.Cli.

Both modes use the exact same shared service layer.


What it does

  1. Statically reads IL2CPP dummy assemblies (Assembly-CSharp.dll) with Mono.Cecil.
  2. Classifies discovered methods into groups using hook_groups.json + heuristics.
  3. Writes extraction output:
    • game_hooks.json
    • unknown_hooks.json
  4. Generates ready-to-edit mod templates for different use cases.
  5. Generates coverage reports (coverage_report.json + coverage_report.md) by comparing:
    • Assembly methods (Assembly-CSharp.dll)
    • planned hooks (game_hooks.json)
    • implemented Harmony patches (framework sources)
  6. Synchronizes framework target files via hook diff (sync) with dry-run and optional git stat output.

Wiki

  • wiki/README.md
  • wiki/cli.md
  • wiki/ui.md
  • wiki/known-issues.md

Command line usage

Extract hooks

gregExtractor extract
gregExtractor extract --path "C:\Program Files (x86)\Steam\steamapps\common\Data Center\MelonLoader\Il2CppAssemblies"

Create mod scaffold

gregExtractor create MyEconomyMod --type harmonyPatch --category Economy
gregExtractor create MyServerMod --type customServer --path "D:\dcmods"

Analyze coverage

gregExtractor coverage
gregExtractor coverage --path "C:\Program Files (x86)\Steam\steamapps\common\Data Center\MelonLoader\Il2CppAssemblies"
gregExtractor coverage --sources ".\Hooks;.\framework" --out ".\coverage_report" --open

Sync framework files

gregExtractor sync --source ".\gregCore\src" --dry-run
gregExtractor sync --source ".\gregCore\src" --git --force

Supported --type values:

  • harmonyPatch
  • customServer
  • customUI
  • customWorld
  • customFurniture
  • customNPC

GUI usage

gregExtractor
gregExtractor --gui

GUI capabilities:

  • Auto-detect game + IL2CPP paths.
  • Start extraction with live progress/logging.
  • Review hooks grouped by category.
  • Generate mod scaffolds with selected template/category.
  • Open generated output folder.
  • Coverage tab for in-app report generation and review.
  • Dedicated Sync tab for diff preview + controlled framework update runs.

Project architecture

gregExtractor/
├── Program.cs
├── Models/
├── Services/
├── Commands/
├── Utils/
└── GUI/

Shared Core Services

  • Services/ExtractorService.cs: Mono.Cecil extraction pipeline.
  • Services/HookClassifier.cs: JSON-driven + heuristic classification.
  • Services/TemplateService.cs: scaffold generation.
  • Utils/SteamLocator.cs: Steam + library + game path discovery.

No service performs direct console output; services only report via IProgress<string>.


Build

dotnet restore
dotnet build

Configuration

hook_groups.json at project root is the classification source of truth.

If missing or malformed, extraction still works, but groups may fall back to heuristics and Uncategorized.


Generated mod files

Every generated C# file includes this required header:

// UNITY 6: All Unity API calls must run on the Main Thread!
// Use MelonCoroutines for asynchronous operations.
// Generated by gregExtractor v1.0 — https://dcmods.com

Generated Harmony templates default to Postfix patches and include commented Prefix examples.

gregCore integration points are intentionally generated as commented TODOs until package release is finalized.


Environment assumptions

Generated mod projects use:

  • $(MODS_GAME_DIR)\\MelonLoader\\net6\\MelonLoader.dll
  • $(MODS_GAME_DIR)\\MelonLoader\\net6\\0Harmony.dll
  • $(MODS_GAME_DIR)\\MelonLoader\\Il2CppAssemblies\\Assembly-CSharp.dll

Set MODS_GAME_DIR in your shell/CI before building generated mods.


Troubleshooting

Auto-detect fails

  • Ensure Steam is installed and readable from registry.
  • Ensure the game exists in a Steam library.
  • Use --path manually.

Assembly-CSharp.dll not found

  • Start the game once with MelonLoader installed.
  • Verify MelonLoader\\Il2CppAssemblies exists.

Empty or unexpected groups

  • Verify hook_groups.json is valid JSON.
  • Run extraction again after game updates.