Skip to content

Commit 4ade389

Browse files
author
StArray
committed
feat(runtime): introduce metadata provider layer with full type/member collection
Refactor runtime abstraction and harden stub generation: - Add IRuntimeMetadataProvider abstraction with Mono/Il2Cpp implementations, isolating all native metadata access behind one interface (collected-type guarding, field snapshotting at collect time, safe enum-literal reads) - Fix nested enum emission: enums inside types now generate as real managed enums with exact member values (boxed-read chain replaces raw data pointer, which returned wrong values on standalone mono) - Mark operator/conversion overloads (op_*) as specialname so stubs support `a + b` / `(int)a` syntax; include return type in operator signature keys to keep same-name conversion overloads distinct - Guard mono_thread_current() probe against SEH on non-attached threads (Unity-embedded mono throws instead of returning NULL) - Add NativeLibraryResolver: per-assembly DllImport resolver funnel with a shared ResolveRequested event; redirect Mono P/Invokes through a MONO_LIBRARY_NAME placeholder resolved at runtime - RuntimeManager: detect loaded mono runtimes on Windows (monosgen/bdwgc variants) and auto-configure library redirection; route libdl calls through Native.DL - ModLoader: load mod assemblies from bytes so DLLs are not locked on disk (regenerating UnmanagedTypeAssembly no longer requires a restart) - TestDxApp: add TestTypes fixture covering readonly/nested enums/interfaces/ operators/delegates for stub-generation validation - version.json: restructure platforms as an array with per-platform manager/sha256/entry metadata - Replace build_release.sh with package_release.sh (zip-only packaging, Android bundle no longer ships AAR)
1 parent 7f84f6a commit 4ade389

24 files changed

Lines changed: 2471 additions & 1815 deletions

‎.gitignore‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,4 +76,7 @@ log.txt
7676
imgui.ini
7777
Corehold
7878
.claude
79-
.backup
79+
.backup
80+
dotnet-tools.json
81+
Scripts/run_game.sh
82+
StArray.ModManager.Setup

‎Scripts/build_release.sh‎

Lines changed: 0 additions & 41 deletions
This file was deleted.

‎Scripts/package_release.sh‎

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
#!/bin/bash
2+
# 一键打包 release zip 包(version.json 的 platforms[].manager 对应产物):
3+
# release/modmanager-windows.zip — Windows SMM(manager/ 布局,供 Setup 热更新)
4+
# release/modmanager-android.zip — Android SMM 托管程序集
5+
# 用法: bash Scripts/package_release.sh
6+
# 环境变量 ZIP=... 可覆盖 zip 可执行文件位置
7+
set -e
8+
9+
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
10+
REL="$ROOT/release"
11+
mkdir -p "$REL"
12+
13+
ZIP="${ZIP:-zip}"
14+
15+
# 打包依赖的 SMM dll(Windows / Android 两个入口所需的公共与平台程序集)
16+
WIN_DLLS=(StArray.ModManager.dll StArray.ModManager.Windows.dll StArray.ModManager.Windows.Native.dll ImGui.NET.dll)
17+
AND_DLLS=(StArray.ModManager.dll StArray.ModManager.Android.dll ImGui.NET.dll OpenTK.Core.dll OpenTK.Graphics.dll OpenTK.Mathematics.dll)
18+
19+
echo "=== Package Release ==="
20+
echo "Root: $ROOT"
21+
echo "Zip: $($ZIP --version 2>/dev/null | head -1 || echo "$ZIP")"
22+
23+
# ─────────────────────────────────────────────
24+
# 0. 构建(Release)
25+
# ─────────────────────────────────────────────
26+
echo ""
27+
echo "--- [0/3] Build (Release) ---"
28+
(cd "$ROOT" && dotnet build StArray.ModManager.Windows/StArray.ModManager.Windows.csproj -c Release -p:BuildNativeDll=false)
29+
(cd "$ROOT" && dotnet build StArray.ModManager.Android/StArray.ModManager.Android.csproj -c Release)
30+
31+
WIN_BIN="$ROOT/StArray.ModManager.Windows/bin/Release/net10.0"
32+
AND_BIN="$ROOT/StArray.ModManager.Android/bin/Release/net10.0"
33+
34+
# ─────────────────────────────────────────────
35+
# 1. Windows 包(manager/ 布局,HotUpdater 直接解压到 manager/)
36+
# ─────────────────────────────────────────────
37+
echo ""
38+
echo "--- [1/3] modmanager-windows.zip ---"
39+
40+
STAGE_WIN="$(mktemp -d)"
41+
trap 'rm -rf "$STAGE_WIN" "$STAGE_AND"' EXIT
42+
for dll in "${WIN_DLLS[@]}"; do cp "$WIN_BIN/$dll" "$STAGE_WIN/"; done
43+
[ -d "$WIN_BIN/en" ] && cp -r "$WIN_BIN/en" "$STAGE_WIN/en"
44+
45+
WIN_ZIP="$REL/modmanager-windows.zip"
46+
rm -f "$WIN_ZIP"
47+
( cd "$STAGE_WIN" && "$ZIP" -q -r -9 "$WIN_ZIP" . )
48+
echo " → $WIN_ZIP ($(du -h "$WIN_ZIP" | cut -f1))"
49+
"$ZIP" -sf "$WIN_ZIP" 2>/dev/null | tail -n +2 | head -8 || unzip -l "$WIN_ZIP" | tail -n +4 | head -8
50+
51+
# ─────────────────────────────────────────────
52+
# 2. Android 包(托管 dll,无 AAR)
53+
# ─────────────────────────────────────────────
54+
echo ""
55+
echo "--- [2/3] modmanager-android.zip ---"
56+
57+
STAGE_AND="$(mktemp -d)"
58+
for dll in "${AND_DLLS[@]}"; do cp "$AND_BIN/$dll" "$STAGE_AND/"; done
59+
[ -d "$AND_BIN/en" ] && cp -r "$AND_BIN/en" "$STAGE_AND/en"
60+
61+
AND_ZIP="$REL/modmanager-android.zip"
62+
rm -f "$AND_ZIP"
63+
( cd "$STAGE_AND" && "$ZIP" -q -r -9 "$AND_ZIP" . )
64+
echo " → $AND_ZIP ($(du -h "$AND_ZIP" | cut -f1))"
65+
66+
# ─────────────────────────────────────────────
67+
# 3. 输出 sha256(供 version.json 填写)
68+
# ─────────────────────────────────────────────
69+
echo ""
70+
echo "=== SHA-256 ==="
71+
(cd "$REL" && sha256sum modmanager-windows.zip modmanager-android.zip)
72+
73+
echo ""
74+
echo "=== Done ==="

‎StArray.ModManager.Android/HotUpdater.cs‎

Lines changed: 0 additions & 266 deletions
This file was deleted.

0 commit comments

Comments
 (0)