Files
Spine_lab/viewpanel/run.sh
T
tianmo 2e7ab7c33c 阶段四:Spine 3.8.99 编辑器里挂上自建视图面板
目标:在 Spine 编辑器窗口内部加一个自己的视图面板(按钮 + 文字显示),
点击读取场景对象,并像原生面板一样出现在 Views 菜单、可停靠可折叠。

本轮打通:
1. 编辑器在我们自己的进程里完整启动
   - 类加载器必须是 URLClassLoader 本身(自检要求)
   - Editor.main 必须在 AWT EDT 上调用
   - jvm.cfg 第 21 行要以两个空格结尾 + -DSpineJava
   - Editor.D:I 版本号、fonts/、/tzax 资源、Java8 版 launcher.Launcher 替身
2. 3.8.99 全量解密 → 可读源码
   - 字符串 17251/17461(伪造同名调用帧对齐 key)
   - 混淆动态派发还原 53871 处(调引导方法取 MemberName)
3. 自建视图
   - agent 在内存里给 us 枚举加 spineView 常量(不改磁盘,避开完整性自检)
   - 面板 Actor 由外部反射填进 us.spineView.D
   - 复用已有图标做别名(不新建图片资源)
   最终 "Spine View" 出现在 Views 菜单,可与 Tree 并排停靠、折叠展开

另外:
- ViewPatcher/ViewAgent:视图枚举与面板挂载的字节码插桩
- DecAll/ObMap/rewrite_source:字符串解密、派发还原、可读源码生成
- 阶段四-视图面板挂载.md:完整记录做法与踩过的坑

不纳入版本管理:rea/(独立仓库)、tools 下的 JDK/Ghidra 工具链、
Spine.app 与 spine-lab 副本、从载荷派生的批量产物。
2026-10-16 13:34:18 +08:00

34 lines
1.1 KiB
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/zsh
# 启动实验室副本并注入 ViewPanel。
# 用 LaunchServices(open -n)启动,这样进程有启动时间,REA 的运行时 UI 观测才认。
set -e
HERE="$(cd "$(dirname "$0")" && pwd)"
LAB="$HERE/../spine-lab"
[[ -f "$HERE/build/inject.dylib" ]] || { echo "先跑 ./build.sh" >&2; exit 1; }
# 先关掉旧的实验室实例,避免测试时越开越多。
for pid in $(/bin/ps -eo pid,command | grep "$LAB/Spine.app/Contents/MacOS/Spine" | grep -v grep | awk '{print $1}'); do
kill "$pid" 2>/dev/null && echo "关掉旧实例 pid=$pid"
done
sleep 2
echo "注入器 : $HERE/build/inject.dylib"
echo "面板类 : $HERE/build/classes"
echo "日志 : /tmp/spine-viewpanel.log"
# 可选:把工程文件一起打开(第一个参数)
PROJECT_ARGS=()
if [[ -n "$1" ]]; then
PROJECT_ARGS=(--args "$1")
echo "工程 : $1"
fi
open -n \
--env "DYLD_INSERT_LIBRARIES=$HERE/build/inject.dylib" \
--env "SPINE_VIEWPANEL_CLASSES=$HERE/build/classes" \
--env "SPINE_VIEWPANEL_MAIN=com/spineview/SceneScan" \
--env "SPINE_USER_HOME=$LAB/home" \
"$LAB/Spine.app" "${PROJECT_ARGS[@]}"