Files
gregWiki/i18n/de/docusaurus-plugin-content-docs/current/legacy/wiki-import/ModDevs/Mod-Developer-Debug.md
Marvin ea92a0baf8 refactor: update project branding and structure for gregFramework
- Changed project title and tagline in docusaurus.config.js to reflect the new branding.
- Updated package.json and package-lock.json to rename the project to gregwiki-docs-site.
- Adjusted sidebar and documentation files to align with the new project structure and naming conventions.
- Enhanced documentation content for clarity and consistency across various sections.
- Added Prettier as a development dependency for code formatting.

This commit aligns the project with the new branding and improves overall documentation quality.
2026-04-10 01:20:22 +02:00

3.4 KiB

title, description, sidebar_position, tags
title description sidebar_position tags
Mod-Developer (Debug) EN Rust vs C# decision guide, getting started for both tracks, hook discovery, architecture, and API orientation. 130
audience:moddev

Mod-Developer (Debug)

You only need one track: Rust or C#. FrikaMF bridges runtime communication.

Full framework capability catalog with setup guides: Framework Features & Use Cases.

Rust vs C# decision guide

Criteria 🔷 C# Track 🦀 Rust Track
Onboarding speed Fast Medium
Direct Unity/Il2Cpp access Strong Indirect
Native-level control Medium High
Safety model Medium High
Recommended for Most gameplay mods Performance/ABI-heavy systems

Lua/Python/Web FFI status

  • Rust FFI in framework core: implemented.
  • Built-in Lua runtime host: not implemented.
  • Built-in Python runtime host: not implemented.
  • Built-in generic HTTP/WebSocket FFI transport: not implemented.

Recommended approach:

  • Run Lua/Python as a sidecar process and connect through your C# or Rust mod boundary.
  • Use framework events as stable inputs and framework APIs as safe outputs.
  • Keep Unity/IL2CPP object access in C# or Rust layers.

For full DE/EN step-by-step tutorials per FFI entrypoint, see:

Architecture

Data Center (IL2CPP)
  ↓ HarmonyX Patch
FrikaMF C# Bridge (Il2Cpp objects -> C-ABI structs)
  ↓ P/Invoke / C-ABI                    ↓ MelonLoader API
Rust Mod (.dll)                         C# Mod (.dll)

Source of truth for hooks

C# track quick start

dotnet build .\framework\framework/FrikaMF.csproj /p:GameDir="C:\Path\To\Data Center"
using HarmonyLib;
using MelonLoader;
using Il2Cpp;

[HarmonyPatch(typeof(Server), nameof(Server.PowerButton))]
public static class Patch_Server_PowerButton
{
    public static void Prefix(Server __instance)
    {
        MelonLogger.Msg($"Server power toggle: {__instance.name}");
    }
}

Rust track quick start

cargo build --release
#[no_mangle]
pub extern "C" fn mod_init(_api_table: *mut core::ffi::c_void) -> bool {
    true
}

dnSpy / dotPeek guidance

  • Open generated Assembly-CSharp.dll interop output.
  • Validate signatures and call context.
  • Document candidates in HOOKS.md.
  • Implement Harmony patch and event dispatch.

Why many IL2CPP interop methods look empty

Interop assemblies often contain metadata-facing stubs; real implementation lives in native IL2CPP binaries.

Web FFI vs Web UI (important)

  • DC2WebBridge provides Unity-side UI adaptation/styling.
  • It is not a generic network FFI transport bus.
  • For Web FFI, implement your own HTTP/WebSocket gateway with validation and rate limits.

Config API reference: Mod Config System

Cross-track example

🦀 Rust

#[no_mangle]
pub extern "C" fn mod_on_event(event_id: u32, _ptr: *const u8, _len: u32) {
    if event_id == 1001 {
    }
}

🔷 C#

[HarmonyPatch(typeof(CustomerBase), nameof(CustomerBase.AreAllAppRequirementsMet))]
public static class Patch_Requirements
{
    public static void Postfix(bool __result)
    {
        MelonLogger.Msg($"Requirements met: {__result}");
    }
}