4.4 KiB
gregExtractor
gregExtractor is a dual-mode mod scaffolder for Data Center (Unity IL2CPP + MelonLoader).
It runs as:
- Desktop GUI (
gregExtractororgregExtractor --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
- Statically reads IL2CPP dummy assemblies (
Assembly-CSharp.dll) with Mono.Cecil. - Classifies discovered methods into groups using
hook_groups.json+ heuristics. - Writes extraction output:
game_hooks.jsonunknown_hooks.json
- Generates ready-to-edit mod templates for different use cases.
- 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)
- Assembly methods (
- Synchronizes framework target files via hook diff (
sync) with dry-run and optional git stat output.
Wiki
wiki/README.mdwiki/cli.mdwiki/ui.mdwiki/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:
harmonyPatchcustomServercustomUIcustomWorldcustomFurniturecustomNPC
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
--pathmanually.
Assembly-CSharp.dll not found
- Start the game once with MelonLoader installed.
- Verify
MelonLoader\\Il2CppAssembliesexists.
Empty or unexpected groups
- Verify
hook_groups.jsonis valid JSON. - Run extraction again after game updates.