asp/Heapsmith

GitHub: asp/Heapsmith

面向 HashLink/Heaps 游戏的逆向工程工作站,提供静态分析、实时内存与函数调试、安全 Mod 管理及 AI 辅助工作区导出功能。

Stars: 0 | Forks: 0

# Heapsmith **一个集 HashLink / Heaps 逆向工程、Mod 管理与实时调试于一体的工作站。** 由 **[0rt](https://github.com/asp)** 构建并维护 · [github.com/asp/Heapsmith](https://github.com/asp/Heapsmith) ![Tauri](https://img.shields.io/badge/Tauri-2-FFC131?logo=tauri&logoColor=white) ![React](https://img.shields.io/badge/React-18-61DAFB?logo=react&logoColor=white) ![Rust](https://img.shields.io/badge/Rust-1.77+-DEA584?logo=rust&logoColor=white) ![hlbc](https://img.shields.io/badge/hlbc-0.7-7b4dff) ![Rhai](https://img.shields.io/badge/rhai-1.24-ff8a3d) ![Version](https://img.shields.io/badge/version-0.2.0-success) ![License: MIT](https://img.shields.io/badge/License-MIT-66bb6a) *全栈 HashLink 工作站:加载 `hlboot.dat`,检查 bytecode,为 Cursor/Claude/GPT 导出适配 AI 的工作区,通过验证备份管理 mod,并附加一个实时的进程内代理以扫描内存、挂钩函数、交换 bytecode,以及在运行的游戏中运行沙盒化的 Rhai 脚本。*
## 目录 1. [什么是 Heapsmith?](#1-what-is-heapsmith) 2. [功能矩阵](#2-feature-matrix) 3. [截图](#3-screenshots) 4. [安装说明](#4-installation) 5. [快速入门](#5-quick-start) 6. [实时工具指南](#6-live-tools-guide) 7. [AI 工作区指南](#7-ai-workspace-guide) 8. [Mod 管理器指南](#8-mod-manager-guide) 9. [系统架构](#9-architecture) 10. [配置与路径](#10-configuration--paths) 11. [键盘快捷键](#11-keyboard-shortcuts) 12. [路线图](#12-roadmap) 13. [贡献指南](#13-contributing) 14. [致谢](#14-credits) 15. [负责任地使用](#15-responsible-use) 16. [作者](#16-author) · [许可证](#17-license) ## 1. 什么是 Heapsmith? Heapsmith 是一款桌面应用程序,用于以 HashLink bytecode(Heaps 游戏所针对的 VM)发布的游戏进行**逆向工程、Mod 管理和实时调试**。它包含四个一流的职责: 1. **逆向工程工作站。** 通过上游 [`hlbc`](https://github.com/Gui-Yom/hlbc) crate 打开 `hlboot.dat` / `.hl`,解析类 / 函数 / 字符串 / 全局变量 / 原生引用 / 交叉引用,并以带有 IDA/Ghidra/VS-Code 风格的 UI 呈现它们,支持交叉引用、图形视图和全局 FTS5 搜索。 2. **AI 工作区导出器。** 生成一个对 Cursor 友好的文件夹树(Markdown 摘要、伪 Haxe 代码、JSON 交叉引用、提示词脚手架和冻结的 SQLite 快照),以便 LLM 可以通过遍历字符串 → 交叉引用 → 伪代码,零幻觉地回答“玩家生命值在哪里处理?”。 3. **安全第一的 Mod 管理器。** 管理 mod 清单、配置文件、加载顺序、冲突检测、SHA-256 验证备份、审批门控的补丁队列,以及将标准输出/错误流式传输到 Live Lab 面板的游戏启动器。 4. **实时工具代理。** 一个 Rust `cdylib`(`heapsmith_agent.hdll` / `.dll`)加载到正在运行的 HashLink 游戏中,并通过环回 TCP IPC 通道向桌面应用公开实时运行时:实时 VM bytecode 交换、带有 HL 类型覆盖的内存扫描和编辑器、带有调用跟踪的函数挂钩、HL 对象导航器、沙盒化的 Rhai 脚本引擎,以及将短暂的实时编辑转换为可重现的 `.hmod` 的 Mod 保存器。 简要政策请参见 [§15 负责任地使用](#15-responsible-use)。 ## 2. 功能矩阵 ### 实时工具 (0.2.0 "Live Forge") | 功能 | 详情 | |---|---| | **进程内代理** | Rust `cdylib`(约 4.6 MB)作为 `heapsmith_agent.hdll`(HashLink 插件)或作为注入的 `.dll` 加载。启动一个环回 TCP IPC 服务器,写入一个带有 32 字节会话令牌的按进程 ID 区分的发现文件。 | | **实时 VM bytecode 交换** | 通过 `SwapFunction { function_index, new_bytes }` 替换正在运行的运行时中的函数操作码。保留每次会话的交换日志以便回滚。 | | **内存工具** | 读取 / 写入 / 区域枚举。Windows 后端使用 `VirtualQuery` + `VirtualProtect` 进行保护写入。遇到访问冲突时软失败。 | | **内存扫描器** | 类型化值搜索(`u8/i8/u16/i16/u32/i32/u64/i64/f32/f64/bool`),带有 **18 个谓词**,包括 `eq`、`neq`、`gt`、`lt`、`between`、`changed`、`unchanged`、`increased`、`decreased`、`increased_by`、`near_float`(带 epsilon)、`prefix`、`contains`。支持逐步缩小范围循环、区域过滤、对齐感知。 | | **内存编辑器** | 带有 HL 感知覆盖层的十六进制视图(使用已解析的 bytecode 类型标记已知偏移处的结构字段)。支持内联编辑、true/false 翻转、±1 / ×2 / ÷2 / 置零快捷按钮。 | | **函数挂钩** | 按函数索引安装前置/后置挂钩。流式传输带有捕获参数和返回值的 `HookHit` 事件。条件断点(Rhai 表达式)。目标地址改变时触发的观察点。 | | **HL 对象导航器** | 遍历全局变量 → 对象 → 字段及其类型信息。支持实时刷新;一键设置字段值。 | | **Mod 脚本编写** | 沙盒化的纯 Rust 嵌入式脚本。宿主 API:`hl_get_field`、`hl_set_field`、`mem_read_*`、`mem_write_*`、`hook_function`、`unhook`、`events_on`、`log`。通过 `notify` 进行热重载。每个 mod 的持久化状态位于 `.heapsmith/script_state/.json`。 | | **实时监视** | 固定全局变量、字段或原始地址。每 1.5 秒自动刷新。带内联值翻转小部件。 | | **Mod 保存器** | 固定实时编辑(函数交换、字段写入、内存写入、脚本化应用)。一键导出带有 `live_edits` 数组的永久 `.hmod` 清单。 | ### 静态分析 - 通过 `hlbc 0.7` 进行 HashLink bytecode 解析(反序列化、反汇编、反编译) - 通过 `hlbc-decompiler 0.7` 输出伪 Haxe 代码 - 类 / 类型浏览器(树状视图、字段、方法、父类、接口) - 函数查看器(签名、反汇编、伪 Haxe、局部变量、交叉引用、控制流) - 字符串浏览器(虚拟化表、正则表达式过滤器、类别分类器) - 交叉引用 — 函数→函数、函数→字符串、字符串→函数、函数→原生 - 可视化调用/交叉引用图(React Flow) - 基于类/函数/字符串/伪 Haxe 的全局全文搜索(SQLite FTS5) - 启发式 *有趣术语扫描器* — 标记可能的 mod 目标(player、hp、damage、drop、save 等)并提供置信度 + 原因 - 持久化在每个项目的 SQLite 数据库中,位于 `/.heapsmith/project.sqlite` ### AI 工作区导出 - 一键 `导出 AI 工作区` → 规范中的精确树状结构:`README.md`、`PROJECT_OVERVIEW.md`、`MODDING_TARGETS.md`、`SEARCH_GUIDE.md`、`classes/`、`pseudo_haxe/`、`functions/`、`strings/`、`xrefs/`、`raw/`、`database/project.sqlite`、`ai/{cursor_rules.md, suggested_prompts.md, modding_research_prompt.md, reverse_engineering_notes.md}` - 附加导出器:仅 JSON、仅 Markdown、仅伪 Haxe 代码、字符串 CSV、函数 CSV、交叉引用 JSON、SQLite 快照、ImHex `.hexpat`、图 JSON、单一实体 JSON - 可配置块大小;导出完成后自动打开文件夹 ### Mod 管理器 - JSON 清单格式(`id`、`name`、`version`、`author`、`game`、`patches`、`scripts`、`live_edits`、`dependencies`、`conflicts`、`requiresRestart`) - 四种文件补丁类型:`StringPatch`、`BytecodePatch`、`FilePatch`、`AssetPatch`;0.2.0 新增:用于运行时 mod 的 `scripts[]` 和 `live_edits[]` - 每个补丁的风险等级(`Low | Medium | High | Critical`)带有安全门控 - 启用/禁用 + 拖放加载顺序、配置文件、冲突扫描器、依赖检查 - 每次应用时进行 **SHA-256 验证备份**;一键恢复 - **审批门控**:AI 生成的补丁以 `approved=false` 进入补丁队列,在用户在差异查看器中点击“批准”之前无法应用 - **从不覆盖原文件**:补丁通过 `/.heapsmith/working/` 进行处理,仅在成功后进行原子重命名 - `.hmod` 包格式(基于 zip)用于共享 mod - 文件监视器(`notify`)自动检测 mod 源和 `.rhai` 脚本更改 - 游戏启动器(Live Lab)将 `stdout`/`stderr` 流式传输到 UI;干净的重新启动/重载 ### 工作流与用户体验 - 暗色优先的 UI,带有 **9 种主题**(`dark`、`darker`、`oled`、`cyber`、`graphite`、`purple`、`blue`、`green`、`red`)+ 8 色调选择器 - `Ctrl+K` 命令面板连接到每个导航目标和主要操作 - `?` 快捷键覆盖层;`,` 打开设置;`G {key}` 引导键导航 - 顶栏附加栏在每个页面显示实时代理状态 - 右侧 AI 助手面板(默认为剪贴板模式 — 无需 API 密钥) - 每个实体的持久化笔记 / 书签 / 标签 - 最近的项目、应用内日志面板(`Ctrl+\``)、首次运行的法律免责声明和新手引导 - 隐私模式 — 除非明确启用,否则游戏数据绝不发送到外部 AI ## 3. 截图 | | | |---|---| | ![](https://raw.githubusercontent.com/asp/Heapsmith/main/docs/img/dashboard.png) | ![](https://raw.githubusercontent.com/asp/Heapsmith/main/docs/img/function-viewer.png) | | 带有项目摘要和 mod 目标卡片的仪表板 | 带有反汇编、伪 Haxe 和交叉引用的函数查看器 | | ![](https://raw.githubusercontent.com/asp/Heapsmith/main/docs/img/ai-exporter.png) | ![](https://raw.githubusercontent.com/asp/Heapsmith/main/docs/img/mods.png) | | AI 工作区导出向导 | 带有风险标记和拖放加载顺序的 Mod 管理器 | | ![](https://raw.githubusercontent.com/asp/Heapsmith/main/docs/img/live-inspector.png) | ![](https://raw.githubusercontent.com/asp/Heapsmith/main/docs/img/memory-scanner.png) | | 实时检查器 — 代理已附加,功能已激活 | 带有谓词矩阵和范围缩小的内存扫描器 | | ![](https://raw.githubusercontent.com/asp/Heapsmith/main/docs/img/memory-editor.png) | ![](https://raw.githubusercontent.com/asp/Heapsmith/main/docs/img/hook-manager.png) | | 内存编辑器 — 带有 HL 覆盖侧边栏的十六进制视图 | 挂钩管理器 — 已安装的挂钩和流式传输的调用日志 | | ![](https://raw.githubusercontent.com/asp/Heapsmith/main/docs/img/script-editor.png) | ![](https://raw.githubusercontent.com/asp/Heapsmith/main/docs/img/mod-saver.png) | | 脚本编辑器 — 带有热重载的 Monaco 和 Rhai | Mod 保存器 — 固定的实时编辑 → 可重现的 `.hmod` | ## 4. 安装说明 ### 预编译二进制文件 从 [Releases](https://github.com/asp/Heapsmith/releases) 页下载最新的安装程序: - **Windows** — `.msi` 或 `.exe` - **macOS** — `.dmg` (通用版) - **Linux** — `.AppImage` / `.deb` ### 从源码构建 前置条件: | 工具 | 版本 | 说明 | |---|---|---| | Node.js | ≥ 20 | 推荐 LTS 版本 | | pnpm | ≥ 9 | `npm i -g pnpm` | | Rust | 1.77+ | `rustup default stable` | | Tauri 2 工具链 | — | [tauri.app/start/prerequisites](https://tauri.app/start/prerequisites) | ``` git clone https://github.com/asp/Heapsmith cd Heapsmith pnpm install # 桌面应用 (开发) pnpm tauri dev # 桌面应用 (production bundle — installers in src-tauri/target/release/bundle/) pnpm tauri build # Live agent (cdylib — 放置于 hlboot.dat 旁边并命名为 heapsmith_agent.hdll) cargo build -p heapsmith-agent --release # → target/release/heapsmith_agent.dll (Windows) # → target/release/libheapsmith_agent.so (Linux) # → target/release/libheapsmith_agent.dylib (macOS) ``` 模拟模式(无需 Rust 后端,针对包括实时工具在内的内存数据集运行所有内容): ``` VITE_USE_MOCK=1 pnpm dev ``` ## 5. 快速入门 ### 静态分析 + AI 导出 1. 启动 Heapsmith → 确认免责声明 → 完成 4 步新手引导。 2. **项目 → 打开文件...** 并选择 `hlboot.dat`(或 **打开文件夹...** 并选择游戏目录 — Heapsmith 会自动检测 `hlboot.dat`、`game.hl`、`main.hl` 或它找到的第一个 `.hl` 文件)。 3. 等待解析。状态栏会显示实时计数。 4. 通过侧边栏进行探索 — **类**、**函数**、**字符串**、**交叉引用**、**图**、**Mod 目标**。 5. 点击 **AI 导出器** → 选择输出文件夹 → **导出**。将该文件夹放入 Cursor / Claude / GPT。 ### 实时工具 1. 构建代理:`cargo build -p heapsmith-agent --release`。 2. 将 `target/release/heapsmith_agent.dll`(或 `.so` / `.dylib`)复制到游戏目录并重命名为 `heapsmith_agent.hdll`。 3. 启动游戏。HashLink 会自动加载 `.hdll`。 4. 在 Heapsmith 中,打开 **实时工具 → 实时检查器** — 代理会在 3 秒内出现在发现列表中。 5. 点击 **附加**。顶部栏中的附加栏会亮起;所有实时页面将变为活动状态。 6. 打开 **内存扫描器**、**挂钩管理器** 或 **脚本编辑器**。固定你的发现 → **Mod 保存器** → 导出为 `.hmod`。 ## 6. 实时工具指南 完整的参考文档(代理安装、IPC 协议、脚本 API、故障排除)位于 [`LIVE_TOOLS.md`](LIVE_TOOLS.md) 中。以下是高级工作流程: ### 附加模式 | 模式 | 何时使用 | |---|---| | **`.hdll` 插件** | Heaps 游戏 — 首选。只需将 `heapsmith_agent.hdll` 放在 `hlboot.dat` 旁边。HashLink 在启动时加载它并调用我们的 `hl_register_module(...)` 入口点。 | | **DLL 注入** | 已经在运行的游戏。实时检查器在 Windows 上通过 `CreateRemoteThread(LoadLibraryW)` 将代理生成到进程中。`DllMain` 中的 `DLL_PROCESS_ATTACH` 路径会接管后续工作。 | ### IPC 概览 - 环回 TCP,长度前缀的 JSON 帧。 - 握手 = 第一帧的信封 `id` 等于写入发现文件的 32 字节会话令牌。不匹配 → 连接关闭。 - 发现文件:`%LOCALAPPDATA%/Heapsmith/agent/.json` (Windows) · `$XDG_RUNTIME_DIR/heapsmith/agent/.json` (Linux) · `~/Library/Application Support/Heapsmith/agent/.json` (macOS)。 - 版本控制:代理和宿主都会检查 `PROTOCOL_VERSION` 并拒绝不兼容的对端。 ### Rhai 脚本编写 — 示例 ``` // mods/topped_up_hp/scripts/main.rhai let player_obj = 0x150010000; // grabbed from the live navigator fn on_tick() { let hp = hl_get_field(player_obj, "hp"); let max = hl_get_field(player_obj, "max_hp"); if hp < max { hl_set_field(player_obj, "hp", max); log("topped up player hp -> " + max); } } events_on("tick", on_tick); ``` 脚本在保存时热重载。每个 mod 的顶层作用域在断开连接时会持久化到 `.heapsmith/script_state/.json`。 ### Mod 保存器 — 将实时编辑转换为永久 mod 在附加时,你固定的任何内容(函数交换、字段写入、内存写入、加载的脚本)都会进入 **Mod 保存器** 页面。填写 `id`/`name`/`version` 并点击 **保存 mod** — Heapsmith 会生成: ``` mods// mod.json ← live_edits[] entries describing each pinned change ``` `PinnedEdit` 分类法: ``` type PinnedEdit = | { kind: "function_swap"; function_index: number; function_name: string; new_bytes_b64: string } | { kind: "field_set"; object_path: string; field: string; value: unknown } | { kind: "mem_write"; addr: number; bytes_b64: string; label: string | null } | { kind: "script_apply"; mod_id: string; script_path: string } ``` 生成的 mod 将根据与静态 mod 相同的模式进行验证,并可直接放入现有的 mod 管理器中。 ## 7. AI 工作区指南 导出的文件夹特意设计为小文件 + 重结构: ``` game_ai_workspace/ README.md ← high-level orientation PROJECT_OVERVIEW.md ← counts, version, HDLL refs, parse warnings MODDING_TARGETS.md ← auto-detected high-confidence patch points SEARCH_GUIDE.md ← recommended investigation workflow classes/ ← one .md per class pseudo_haxe//*.hx ← best-effort decompiled source functions/ function_index.md function_index.json strings/ strings.md strings.json strings_by_category.json xrefs/ function_xrefs.json string_xrefs.json native_xrefs.json raw/ bytecode_disassembly.txt metadata.json ai/ cursor_rules.md ← drop into .cursor/rules suggested_prompts.md modding_research_prompt.md reverse_engineering_notes.md ``` **推荐的 Cursor / Claude 提示词** — 参见导出中的 `ai/suggested_prompts.md`。示例: - *“找到处理玩家生命值的地方。”* - *“找到物品掉落/战利品逻辑并提出一个低风险的补丁点。”* - *“遍历每一个引用了字符串 `inventory_full` 的函数并解释其流程。”* ## 8. Mod 管理器指南 Mod 位于 `/mods//mod.json`。完整的清单如下: ``` { "id": "better_drops", "name": "Better Drops", "version": "1.0.0", "author": "Player", "description": "Adjusts loot/drop behavior.", "game": { "name": "Demo Heaps RPG", "hashlink": true }, "patches": [ { "type": "string_patch", "target": "hlboot.dat", "match": "drop_rate=0.1", "replace": "drop_rate=0.25", "risk": "low" }, { "type": "file_patch", "target": "res/items.cdb", "source": "items.cdb", "risk": "low" } ], "scripts": [ { "path": "scripts/main.rhai", "autoload": true, "description": "Pin player hp to max" } ], "live_edits": [], "dependencies": [], "conflicts": [], "requiresRestart": false } ``` 完整的模式(包括 `live_edits`)记录在 [`MOD_MANIFEST.md`](MOD_MANIFEST.md) 中。 **风险等级**(强制执行): | 等级 | 补丁类型 | 热重载 | 游戏必须关闭 | |---|---|---|---| | `low` | 资源 / 文件 / 脚本 | ✅ (如果游戏支持) | ❌ | | `medium` | 字符串 / 数据 / live_edit (field_set) | ❌ — 需要重启 | ❌ | | `high` | bytecode / function_swap / mem_write | ❌ | ✅ | | `critical` | `.hdll` (原生库) | ❌ | ✅ + 二次确认 | **安全保证**(在代码中强制执行,而不仅仅是约定): - `Patcher::apply` 除非 `Backups::ensure_snapshot()` 已经为它将要触及的每个文件成功执行,否则拒绝运行。 - 所有 bytecode 输出都暂存在 `/.heapsmith/working/` 下,并且在计划中的每个补丁都成功后,只对活动文件进行原子重命名。 - AI 生成的补丁以 `approved=false` 进入补丁队列,在用户在差异查看器中点击“批准”之前无法应用。 - 每个备份都存储一个 SHA-256 哈希,并在恢复之前进行验证。 - `.hmod` 包在导入时会根据清单模式进行验证。 - Rhai 脚本在沙盒中运行:禁止 `import`,禁止文件系统注册,限制字符串/数组/表达式大小。 ## 9. 系统架构 ``` flowchart LR subgraph Desktop[Desktop app process] UI[React UI - shadcn] -->|invoke| Cmd[Tauri commands] UI -->|listen| Evt[Tauri events] Cmd --> Proj[project.rs] Cmd --> Parse[parser hlbc adapter] Cmd --> Ana[analysis] Cmd --> Exp[export] Cmd --> ModsMgr[mods] Cmd --> Stor[storage db] Cmd --> Set[settings] Cmd --> LiveHost[live - session client] Cmd --> Scripting[scripting - host engine] Parse --> Stor Ana --> Stor Ana --> Idx[SQLite FTS5] ModsMgr --> Watch[notify watcher] ModsMgr --> Backup[backups SHA-256] ModsMgr --> Launch[game launcher] ModsMgr --> Saver[mod saver] Watch -->|file events| Evt Launch -->|stdout/stderr| Evt end subgraph GameProc[HashLink game process] Agent[heapsmith_agent .hdll] Agent --> AgentIpc[ipc server] Agent --> AgentMem[mem r/w + scanner] Agent --> AgentHooks[hook engine] Agent --> AgentSwap[swap log] Agent --> AgentRhai[Rhai engine] Agent --> AgentHl[hl_ffi - libhl bindings] AgentHl -.runtime dlsym.-> Libhl[libhl.dll/so] end LiveHost <-->|JSON over loopback TCP, token-authed| AgentIpc AgentIpc -->|HookHit, AgentLog, ScriptOutput| LiveHost LiveHost --> Evt Disc[(discovery file pid.json)] Agent -->|write on start| Disc LiveHost -->|poll every 3s| Disc ``` ### 仓库布局 ``` heapsmith/ Cargo.toml ← workspace root src-tauri/ ← desktop app (Rust + Tauri 2) src/ live/ ← host-side agent client (session, attach, ipc, …) scripting/ ← host Rhai engine + watcher mods/ ← manifests, patcher, backups, saver, watcher, launcher parser/ ← hlbc adapter, types, parser-adapter trait analysis/ ← strings, xrefs, interesting terms, graph, search index export/ ← AI workspace, JSON, Markdown, pseudo-Haxe, CSV, ImHex, SQLite storage/ ← SQLite migrations + read/write commands.rs ← static / mod commands commands_live.rs ← live-tool commands (31 entries) agent/ ← in-process cdylib (loaded into the game) src/ lib.rs ← DllMain + hl_register_module entry points agent.rs ← AgentState singleton + discovery file hl_ffi.rs ← libhl bindings resolved at runtime via GetProcAddress/dlsym runtime.rs ← high-level wrappers (list_globals, get_field, …) mem.rs ← in-process read/write/regions + scanner hooks.rs ← hook table + trampoline scaffolding ipc.rs ← TCP server, handshake, dispatch script.rs ← agent-side Rhai sandbox ipc-protocol/ ← shared message types between host + agent src/ ← React UI pages/ ← dashboard, classes, functions, strings, xrefs, graph, modding-targets, ai-exporter, notes, settings, mods, profiles, live-lab, patch-queue, conflicts, backups, mod-export, live-inspector, memory-scanner, memory-editor, hook-manager, script-editor, live-watch, mod-saver components/ ← layout (sidebar, topbar, status-bar), ui primitives, command-palette, shortcut-overlay, disclaimer-gate, ai-assistant, onboarding, logging-panel, live/attach-bar, live/value-flipper lib/ ← api.ts, types.ts, theme, settings, mock/ LIVE_TOOLS.md DEVELOPER_NOTES.md MOD_MANIFEST.md SECURITY.md CHANGELOG.md LICENSE ``` ## 10. 配置与路径 | 内容 | 位置 | |---|---| | 每个项目附带的配置 | `/.heapsmith/` (`project.sqlite`、`backups/`、`working/`、`logs/`、`exports/`、`script_state/`、`mods.json`、`profiles.json`) | | Mods | `/mods//mod.json` + 可选的 `mods//scripts/*.rhai` | | 每个 mod 的脚本状态 | `/.heapsmith/script_state/.json` | | 应用设置 | 操作系统配置目录(Windows: `%APPDATA%\Heapsmith\settings.json` · macOS: `~/Library/Application Support/Heapsmith/` · Linux: `~/.config/Heapsmith/`) | | 代理发现文件 | `%LOCALAPPDATA%/Heapsmith/agent/.json` · `$XDG_RUNTIME_DIR/heapsmith/agent/.json` · `~/Library/Application Support/Heapsmith/agent/.json` | | 日志 | `.heapsmith/logs/` + 应用内面板 (`Ctrl+\``) | ## 11. 键盘快捷键 | 按键 | 动作 | |---|---| | `Ctrl+K` | 命令面板(跳转到任何页面 / 搜索任何实体) | | `?` | 快捷键覆盖层 | | `,` | 设置 | | `G D` | 仪表板 | | `G P` | 项目 | | `G C` | 类浏览器 | | `G F` | 函数查看器 | | `G S` | 字符串浏览器 | | `G X` | 交叉引用 | | `G E` | AI 导出器 | | `G M` | Mods | | `G L` | 实时检查器 | | `Ctrl+\`` | 切换日志面板 | | `Esc` | 关闭覆盖层 / 面板 | ## 12. 路线图 **0.2.0 "Live Forge"** 中已发布: - ✅ 进程内代理,带有 `.hdll` + DLL 注入附加路径 - ✅ 带有回滚的实时 VM bytecode 交换 - ✅ 内存扫描器与编辑器 (Windows 后端) - ✅ 带有调用跟踪和观察点的函数挂钩 - ✅ HL 对象导航器 - ✅ 带有热重载的沙盒化 Rhai 脚本编写 - ✅ 实时监视(自动刷新、内联翻转器) - ✅ Mod 保存器(实时编辑 → `.hmod`) 下一步计划: - [ ] POSIX 内存后端(`mprotect`、`/proc/self/maps`、`vm_region`) - [ ] 由 `iced-x86` 支持的序言补丁器(目前已在 cfg 门控后搭建好脚手架) - [ ] 完整的 `hl_module` 布局探测,以便 `list_globals` / `type_info` 能够在各个 HashLink 版本中返回填充的数据 - [ ] Rhai 的 `events_on` 事件总线连接(协议级的事件流已就绪) - [ ] `dashlink` 适配器(Haxe 反汇编器集成)— 参见 `DEVELOPER_NOTES.md` - [ ] `crashlink` 适配器(Python 工具集成) - [ ] Bytecode 补丁操作码重写 DSL(目前 `BytecodePatch` 延迟到 `FilePatch` 有效载荷) - [ ] 分布式 mod 托管 / `.hmod` 索引 - [ ] 面向社区解析器适配器的插件市场 ## 13. 贡献指南 1. Fork → `git clone` → `pnpm install` → `pnpm tauri dev`。 2. 新的解析器?在 `src-tauri/src/parser/` 中实现 `ParserAdapter` trait — 参见 [`DEVELOPER_NOTES.md`](DEVELOPER_NOTES.md)。 3. 新的 IPC 功能?将变体添加到 `ipc-protocol/src/lib.rs`,在 `agent/src/ipc.rs` 中实现它,然后在 `src-tauri/src/live/` 中编写宿主包装器。有关协议约定,请参见 [`LIVE_TOOLS.md §2`](LIVE_TOOLS.md)。 4. 文件大小规则:保持 `.rs` / `.tsx` / `.cs` 文件 ≤ 500 行;如果更长则拆分。 5. 代码风格:Rust 使用 `cargo fmt`,TS 使用 Prettier,样式使用 Tailwind(不使用临时 `.css`)。 6. PR 检查清单: - [ ] `cargo check --workspace` 无误 - [ ] `pnpm tsc --noEmit` 无误 - [ ] `pnpm build` 成功 - [ ] `cargo build -p heapsmith-agent --release` 成功(如果你修改了代理代码) - [ ] 新的 Tauri 命令已在 `MockBackend` 中镜像,以便 UI 在模拟模式下仍能工作 - [ ] 新的实时工具功能已记录在 `LIVE_TOOLS.md` 中 ## 14. 致谢 Heapsmith 站在巨人的肩膀上: **HashLink 生态系统** - 由 Gui-Yom 开发的 [**hlbc**](https://github.com/Gui-Yom/hlbc) — 这是实现 Heapsmith 所包装的 bytecode 解析和反编译功能的 Rust crate。 - [**dashlink**](https://github.com/N3rdL0rd/dashlink) — 基于 Haxe 的反汇编器/检查器。即将推出的 `DashlinkAdapter` 的参考实现。 - [**crashlink**](https://github.com/N3rdL0rd/crashlink) — Python 反序列化器/反汇编器。`CrashlinkAdapter` 的参考。 - [**hl-rev / ByteSto4t**](https://github.com/N3rdL0rd/HLRev) — 先前的图形界面。函数识别器和 ImHex 模式功能的灵感来源。 - 由 **Haxe Foundation** 开发的 [**HashLink**](https://hashlink.haxe.org/)。 - [**He**](https://heaps.io/) — 这些游戏所使用的引擎。 **实时调试工具** - [**Rhai**](https://rhai.rs) — 用于 mod 脚本沙盒的纯 Rust 嵌入式脚本语言。 - [**notify**](https://github.com/notify-rs/notify) — 驱动 mod 和 `.rhai` 脚本热重载的文件系统监视器。 - [**windows-sys**](https://github.com/microsoft/windows-rs) — 为进程枚举、`VirtualQuery`/`VirtualProtect` 和 `GetProcAddress` 符号解析提供支持的 Win32 绑定。 **桌面技术栈** - [**Tauri 2**](https://tauri.app) — 桌面运行时。 - [**shadcn/ui**](https://ui.shadcn.com) + [**Radix**](https://www.radix-ui.com) + [**Tailwind**](https://tailwindcss.com) — UI 基础组件与样式。 - [**Monaco Editor**](https://microsoft.github.io/monaco-editor/) — 用于函数查看器、补丁队列和脚本编辑器的代码及差异查看器。 - [**React Flow**](https://reactflow.dev) — 调用/交叉引用图。 - [**TanStack Query**](https://tanstack.com/query) — 前端 Tauri 命令缓存。 ## 15. 负责任地使用 Heapsmith 是一款逆向工程、Mod 管理和实时调试工作站。请在你拥有或有权检查的软件上使用它。你需要为自己使用它所做的事情负责。首次运行的弹窗会记录对此的单行确认。 这就是全部的策略。 ## 16. 作者 Heapsmith 由 **0rt** 创建并维护 — [github.com/asp/Heapsmith](https://github.com/asp/Heapsmith)。 ## 17. 许可证 MIT, © 0rt — 详见 [LICENSE](LICENSE)。
标签:AI工作区, Claude, Cursor, CVE检测, GPT, HashLink, Heaps, hlbc, hlboot.dat, Hook技术, Mod管理器, React, Rhai, Rust, Syscalls, Tauri 2, 云资产清单, 内存修改, 内存扫描, 可视化界面, 后端开发, 桌面应用, 沙盒脚本, 游戏Mod, 游戏安全, 漏洞管理, 网络流量审计, 虚拟机分析, 逆向工程