Community编程与开发github.com

逆向工程

通过反编译、动态分析和数据格式逆向,深入理解游戏内部机制,为模组开发提供准确的技术基础。

逆向工程 是什么?

该技能为游戏模组开发者提供全面的逆向工程方法论,涵盖多种代码类型(.NET/Mono、IL2CPP、Java、原生C/C++)的反编译与动态分析工具链。它指导用户如何通过ILSpy、Cpp2IL、Ghidra、Cheat Engine、Frida、RenderDoc等工具读取真实数据(而非猜测),并维护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、偏移量、格式)。

将所有反编译输出和提取的资产保留在模组仓库之外(例如 ~/<game>-decomp/),且绝不发布它们。仅限单人、离线或用户自己运行的服务器。切勿将调试器或扫描器附加到带有反作弊系统的游戏(参见 skills/mod-any-game/references/safety.md)。

根据代码类型选择合适的工具(um scan 会告诉你)

托管 .NET(XNA/FNA、Unity Mono、大多数独立C#游戏)

  • dotnet tool install -g ilspycmd,然后 ilspycmd -p -o ~/<game>-decomp <Game>.exe(或 Assembly-CSharp.dll)。这将生成一个完整的可grep的C#项目。
  • dnSpyEx:使用调试器单步执行、设置断点、编辑方法。
  • MCP:ILSpy-MCP / dnspy-mcp 允许AI代理直接查询类型和方法。

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;“代码模式”运行 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:genieutils
  • 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. 仅在此时编写新文件。在批量转换之前,先用一个资产在游戏中测试它们。

使其成为预言机

  • 你移植的引擎逻辑(用于模拟器、训练器、重新实现):录制游戏中的真实轨迹(每tick的位置、速度)并针对你的移植版本回放这些轨迹。在泰拉瑞亚的克苏鲁之眼工作中,一旦移植版使用了在帧 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

相关技能