Community程式設計與開發github.com

逆向工程

了解遊戲的真實運作方式,以便模組能夠掛接。反編譯 .NET/Mono (ILSpy)、IL2CPP (Cpp2IL, Il2CppDumper)、Java (Vineflower) 和原生程式碼 (Ghidra, IDA, 透過 MCP 伺服器);傾印資料和資源格式;逆向工程二進位檔案格式並透過往返測試驗證;讀取即時記憶體 (Cheat Engine, Frida, x64dbg);尋找渲染管線 (RenderDoc)。當模組需要遊戲內部資訊時使用。

逆向工程 是什麼?

此技能為遊戲模組開發提供完整的逆向工程工作流程,涵蓋多種程式碼執行環境:針對 .NET/Mono 使用 ILSpy 和 dnSpyEx,針對 Unity IL2CPP 使用 Cpp2IL 和 Ghidra/IDA,針對 Java 使用 Vineflower,以及針對原生 C/C++ 引擎使用 Ghidra/IDA 搭配 MCP 伺服器進行互動式反編譯與重新命名。它支援動態分析工具如 Cheat Engine、x64dbg 和 Frida,以及圖形偵錯工具 RenderDoc。 技能詳細說明如何從已建立的社群資源(如 XeNTaX 和 ZenHAX 的封存)取得格式知識,並處理未記錄的檔案格式,包括收集樣本、解讀標頭、實作讀取器和寫入器,並透過往返測試驗證正確性。對於移植的引擎邏輯,它強調使用來自遊戲的真實追蹤資料進行驗證,以達到高度準確性。 此技能支援主要的 AI 代理平台(Claude Code、Cursor、Codex 等),並提供結構化方法,確保所有逆向工程輸出保存在模組儲存庫外部,避免包含反作弊系統的遊戲,並將每個確認的事實記錄到 MODLOG.md 中。它提倡小步驟、有紀律的驗證,以及每次證據不足時改變方法。

相容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/rehan-remade/universal-modder/tree/main/skills/reverse-engineering

Installed? Explore more 程式設計與開發 skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

模組逆向工程

第零條規則:讀取真實資料,不要猜測。 反編譯的程式碼、實際資料、即時記憶體檢視或 GPU 捕捉結果就是規格。邊做邊將你所學到的內容記錄到 MODLOG.md(名稱、ID、偏移量、格式)。

將所有反編譯輸出和提取的資源保存在模組儲存庫外部(例如 ~/<遊戲名稱>-decomp/),切勿發布它們。僅限單人遊戲、離線遊戲或使用者執行的伺服器。切勿將偵錯器或掃描器附加到具有反作弊系統的遊戲(參閱 skills/mod-any-game/references/safety.md)。

根據程式碼類型選擇工具(um scan 可以告訴你)

托管 .NET(XNA/FNA、Unity Mono、大多數獨立 C# 遊戲)

  • dotnet tool install -g ilspycmd,然後執行 ilspycmd -p -o ~/<遊戲名稱>-decomp <遊戲>.exe(或 Assembly-CSharp.dll)。這會產生一個完整的 C# 專案,可供你 grep。
  • dnSpyEx:使用偵錯器逐步執行、設定中斷點、編輯方法。
  • MCP:ILSpy-MCP / dnspy-mcp 讓代理程式直接查詢類型和方法。

Unity IL2CPP

  • 在 GameAssembly.dll + global-metadata.dat 上使用 Cpp2IL(或 Il2CppDumper)可取得類型、欄位、方法簽章和位址,以及供 ILSpy 使用的虛擬 DLL。
  • 方法本體是原生的:在 Ghidra/IDA 中載入 GameAssembly.dll,並套用產生的腳本為函式命名。
  • 即時:UnityExplorer 或 il2cpp-frida-mcp。

Java(Minecraft、Slay the Spire...) Vineflower / CFR / Recaf。對於 Minecraft,使用 Loom genSources 搭配 Mojang 對應。

原生 C/C++(自訂引擎、Unreal 遊戲程式碼、主機重編譯)

  • Ghidra(免費)或 IDA,透過 MCP 驅動,讓代理程式可以反編譯、重新命名、重新鍵入和追蹤交叉引用:
    • Ghidra:GhidraMCP (LaurieWired)、pyghidra-mcp(無頭模式,附帶執行腳本工具;能處理程式碼的工具勝過數百個小工具)、ReVa。
    • IDA:官方的 Hex-Rays IDA MCP(IDA 9.4+ Pro/Home;"code mode" 執行 IDAPython),或 ida-pro-mcp。
    • Binary Ninja 和 radare2 也有 MCP 伺服器。
  • 工作流程:
    1. 先找字串,再找交叉引用,然後找函式。
    2. 為所有你理解的東西命名和鍵入。重新命名會累積成可讀的程式。
    3. 在基於猜測進行建構之前,透過動態分析(如下)進行確認。代理程式可能會自信地錯誤識別事物。
  • Unreal:首先傾印反射資料(UE4SS dumper 或 Dumper-7);它會自動為大多數遊戲類別和屬性命名。

動態 / 即時

  • Cheat Engine:數值掃描 → "找出對這個位址進行寫入的內容" → 結構 → 擁有者。有 CheatEngine MCP 伺服器可用。
  • x64dbg:中斷點和追蹤(x64dbg-mcp;將其綁定到 127.0.0.1,因為有些預設為 0.0.0.0)。
  • Frida(frida-mcp、frida-game-hacking-mcp):從 JavaScript 掛接函式,記錄參數。
  • ReClass.NET 從即時記憶體重建結構。

圖形

  • RenderDoc(renderdoc-mcp)捕捉一個畫面,並顯示每個繪圖呼叫、渲染目標、常數緩衝區(檢視/投影矩陣)和深度緩衝區。
  • 這就是你找出在哪裡注入幾何圖形或效果(混搭模組)的方法,以及哪個紋理包含精靈圖集。

資料檔案和資源格式

首先使用社群工具:

  • Unity:UABEA、AssetRipper
  • Unreal:FModel、UAssetGUI
    • 完全壓縮的 UE3 .upk(UELib 顯示 Exports=0):使用 Gildor 的 decompress(來自 UE Viewer)解壓縮副本,或者對於 LZO 套件,使用 unpack_upk.py。
  • Bethesda:xEdit、BSArch
  • GameMaker:UndertaleModTool
  • Genie:genutils
  • Source:VRF、Crowbar
  • FromSoft:WitchyBND、Smithbox
  • Godot:GDRE Tools

在自行逆向工程格式之前,請先搜尋社群封存檔案。2000 年代和 2010 年代的大部分遊戲格式都已在那裡被解析出來:

使用它們來獲取格式知識和工具,無論其來源為何(測試版、洩漏的 SDK)。不要從它們那裡下載遊戲檔案、洩漏的程式碼、SDK 或授權金鑰。

對於未記錄的格式:

  1. 收集幾個庫存檔案。比較大小,並以十六進位傾印標頭(xxd | head)。尋找魔術數字、計數、偏移量和固定大小記錄的表格。
  2. 對標頭形成假設,然後是幀/記錄佈局,然後是壓縮方式。透過無錯誤地解析每個庫存檔案來驗證。
  3. 撰寫一個讀取器,將其解碼為可檢視的內容(PNG、JSON),然後檢視它。
  4. 撰寫寫入器,並透過往返測試驗證:解碼 → 編碼 → 解碼,並與原始檔案比較。AoE2 SLD 精靈寫入器只有在它以 0.9/255 的平均誤差往返測試庫存騎士時才被接受(examples/aoe2-de-civ/sld.py)。
  5. 只有這樣才能撰寫新檔案。在批次轉換之前,先使用一個資源在遊戲中進行測試。

使其成為神諭

  • 你移植的引擎邏輯(用於模擬器、訓練器、重新實作):從遊戲記錄真實追蹤資料(每個刻度的位置、速度),並將其與你的移植版本進行比對。在 Terraria 的克蘇魯之眼工作中,一旦移植版本使用在幀 t+1 上套用的動作,眼睛的速度就匹配了 99.9%。Float32 常數也很重要(0.2f 不等於 0.2)。一個殘留的不匹配被追蹤到一個隱藏的增益效果(Happy!,x1.21 移動速度)。重播會發現閱讀程式碼時遺漏的內容。
  • 對於長時間的逆向工程執行:
    • 一個日誌檔案;
    • 小步驟驗證;
    • 每個問題限制嘗試次數(大約連續 3 次相同失敗,然後改變方法);
    • 提交每個確認的事實。

Individual skills in this repo

This repo contains 11 individual skills — each has its own dedicated page.

asset-pipeline

Turn generated or hand-made art into exactly what a game engine loads. Covers sprite cutout, trim and nearest-neighbour fitting to frame sizes, pixelation to a palette, sprite sheets and strips, player/team-colour masks, seamless textures, and rendering a 3D model into sprite frames from the game

fal-assets

Generate game assets with fal (fal.ai) through the fal MCP server, the `um fal` CLI (REST) or `fal api`. Covers sprites and icons with transparent backgrounds, consistent variants and animation frames, pixel art, seamless textures, PBR material maps, image-to-3D models, remeshing, auto-rigging, sound effects, music, voice lines, and trailer or cutscene video. Use whenever a mod needs new art, audio or 3D models, or the user mentions fal, generating sprites, textures, models, SFX or music for a game.

game-automation

Launch, see and drive a real game so an agent can test its own mods. Covers launching via Steam or the exe, windowed mode at a fixed size, screenshots of the game window (GPU-safe capture), clicking and typing into menus, holding keys, relative mouse, crash-reporter cleanup, killing by PID, reading logs, scripted test scenes, and an in-game JSON bridge that lets an agent observe and act. Windows-first (also from WSL), with notes for Linux and macOS. Use when a mod must be verified in game, when navigating menus automatically, or when building a repeatable test or demo scene.

game-recon

Figure out how a specific installed game can be modded, before writing any mod code. Covers where it

game-research-websearch

Research a game, engine or modding technique on the open web with archive-aware, rate-limit-safe searches — Wayback Machine/archive.today for dead forums (XeNTaX, Zenhax, old threads), GitHub code/repo search, Nexus/Steam Workshop/Thunderstore APIs, Reddit JSON, YouTube transcripts, plus archive snapshots as evidence. Use when starting work on a game (

mashup-mods

Build cross-game mashups and total conversions, the

mod-any-game

Mod a PC game the user owns, taking an idea to working in the real game and recorded. It covers new items, weapons, enemies, bosses, units, civilizations, mechanics, art, sound, VR and cross-game mashups. Use when the user wants to mod, extend, hack on, reverse engineer or mash up a game (

port-a-mod

Port an existing mod to a newer game version or another mod loader while keeping its behaviour, values and quirks. Typical cases are an old Forge 1.7.10 or 1.12 Minecraft mod moving to modern Fabric or NeoForge, a Skyrim LE plugin moving to SE/AE, or a tModLoader 1.3 mod moving to 1.4. It covers pinning one source version, a private decompiled reference, an adaptation matrix, extracting the mod

publish-mod

Package and release a finished game mod. Covers the pre-release lint (no game files, decompiled code or leaked keys), README and install steps, credits and AI disclosure, versioning, where to upload (Nexus Mods, Steam Workshop, Thunderstore, mod.io, GitHub releases), and the post with a video. Use when the user wants to ship, share, upload, release or post a mod.

share-field-notes

Search and contribute to the shared AI-modding knowledge base, where field notes record how specific games were modded, decompiled or reverse-engineered (exact versions, route, engine facts, verification, gotchas). Use before starting work on a game (

showcase-video

Record and cut a short showcase video of a game mod, or a compilation of clips, ready to post on X/YouTube. Records the game window with only the game

相關技能