mirror of
https://github.com/mleem97/gregWiki.git
synced 2026-04-11 03:29:19 +02:00
update: docs to new architecture
This commit is contained in:
@@ -4,9 +4,21 @@ sidebar_label: Repository architecture
|
||||
description: Current multi-repo layout with `gregFramework` as a local wrapper and clear repository boundaries.
|
||||
---
|
||||
|
||||
## Modding language
|
||||
## Modding languages
|
||||
|
||||
Mods, MelonLoader plugins, and extensions ship their **logic in C# only** (MelonLoader / .NET). Scope vs framework core (e.g. Rust bridge): [Modding language (C# only)](/wiki/reference/modding-language-requirement).
|
||||
gregCore supports **three modding languages** through its Language Bridge system:
|
||||
|
||||
| Language | Bridge | Runtime | Mod format |
|
||||
|----------|--------|---------|------------|
|
||||
| **C#** | MelonLoader / .NET | Direct IL2CPP interop | `.dll` assemblies in `Mods/` |
|
||||
| **Lua** | `LuaLanguageBridge` (MoonSharp VM) | `greg.*` API with handle-based Unity access | `.lua` scripts in `Mods/ScriptMods/lua/` |
|
||||
| **Rust / native** | `RustLanguageBridgeAdapter` → `FFIBridge` | C ABI exports (`mod_init`, `mod_update`, `mod_on_event`) | `.dll`/`.greg` in `Mods/RustMods/` |
|
||||
|
||||
**Lua scripts** interact with the game exclusively through the `greg.*` API surface — a set of C#-backed modules that expose Unity/IL2CPP operations via integer handles. This includes `greg.unity.*` (object manipulation), `greg.on()`/`greg.hook.*` (event and Harmony patch subscriptions), `greg.gui.*` (IMGUI), `greg.io.*` (file system), and `greg.input.*` (keyboard). See [Greg hooks & events](/wiki/framework/greg-hooks-and-events) for the event API and the [Language Bridges README](https://github.com/mleem97/gregFramework/blob/main/gregCore/framework/ModLoader/LanguageBridges/README.md) for the full Lua API reference.
|
||||
|
||||
**Rust/native mods** receive a `GameAPITable` function-pointer table on `mod_init` and numeric `EventIds` via `mod_on_event`. The `FFIBridge` handles shadow-copying, lifecycle dispatch, and hot-reload.
|
||||
|
||||
Policy details: [Modding language support](/wiki/reference/modding-language-requirement).
|
||||
|
||||
## Target runtime layers
|
||||
|
||||
@@ -25,7 +37,8 @@ Above the raw repositories, the **logical** model is **ModManager → Framework
|
||||
| ------ | ------ |
|
||||
| **Wrapper** | `gregFramework/` holds local checkouts of individual repositories. |
|
||||
| **Core** | `gregCore/` — **framework core**: translation, hooks, Harmony/event runtime, MCP, templates, and related core features. |
|
||||
| **Rust / native FFI** | Loads native mod exports inside the **framework** assembly: `gregCore/framework/src/ModLoader/FfiBridge.cs`; Melon host remains **`DataCenterModLoader.Core`** in `Core.cs` (Melon display name **RustBridge**). |
|
||||
| **Language Bridges** | `gregCore/framework/ModLoader/LanguageBridges/` — Lua (MoonSharp), TypeScript/JS (planned), Rust/native (`FFIBridge`). Lua modules under `LuaModules/` provide the `greg.*` API. |
|
||||
| **Rust / native FFI** | Loads native mod exports: `gregCore/framework/ModLoader/FfiBridge.cs`; adapter: `RustLanguageBridgeAdapter.cs`. Full lifecycle: init, update, scene load, event dispatch, shutdown. |
|
||||
| **Mods** | `gregMod.<Name>/` — one repo each, directly under `gregFramework/`. |
|
||||
| **Extensions** | `gregExt.<Name>/` — one repo each, directly under `gregFramework/`. |
|
||||
| **Docs** | `gregWiki/` — documentation site repository. |
|
||||
@@ -43,3 +56,7 @@ Hook naming and the registry are owned by core; when repos split, **core** remai
|
||||
## Steam & Workshop
|
||||
|
||||
Workshop templates and deployment scripts live in the core repo under `gregCore/Templates/` and `gregCore/scripts/`.
|
||||
|
||||
## Lua handle system
|
||||
|
||||
Lua cannot hold direct references to Il2Cpp objects. gregCore uses an **integer handle registry** (`LuaObjectHandleRegistry`) that maps `int` handles to live .NET objects via weak references. Lua scripts receive handles from `greg.unity.find()`, `greg.unity.get_component()`, etc. and pass them back to `greg.unity.*` functions. Handles are automatically pruned when the underlying Unity objects are destroyed.
|
||||
|
||||
Reference in New Issue
Block a user