CS2振动信号
这是一个主要用于为CS2生成签名/偏移的项目,通过Agent SKILLS和MCP调用更新HL2SDK_CS2 cpp标头。
我们的目标是在无人参与的情况下更新签名/偏移/cppheaders。
目前,所有签名/偏移 反击夏普 和 CS2像素 可以使用此项目自动更新。
需求
- 克劳德/法典
- IDA Pro 9.0+
- idalib (强制性
ida_analyze_bin.py)
- Clang LLVM(必填)
run_cpp_tests.py)
总体工作流程
1.下载CS2仓库并将二进制文件复制到工作区
uv run download_depot.py -tag 14156
uv run copy_depot_bin.py -gamever 14156 -platform all-platform
uv run copy_depot_bin.py -gamever 14156 -platform all-platform -checkonly使用 -checkonly 在CI或飞行前脚本中,您只需要知道所有预期的目标二进制文件是否已经存在于 bin//...在这种模式下,脚本只检查目标路径,不需要填充 cs2_depot,返回 0 当所有预期的二进制文件都准备就绪时, 1 当任何目标丢失时,以及 2 配置或参数错误。
2.查找并生成中声明的所有符号的签名 config.yaml
uv run ida_analyze_bin.py -gamever 14156 [-oldgamever=14155] [-configyaml=path/to/config.yaml] [-modules=server] [-platform=windows] [-agent=claude/codex/"claude.cmd"/"codex.cmd"] [-maxretry=3] [-vcall_finder=g_pNetworkMessages|*] [-llm_model=gpt-4o] [-llm_apikey=your-key] [-llm_baseurl=https://api.example.com/v1] [-llm_temperature=0.2] [-llm_effort=medium] [-llm_fake_as=codex] [-rename] [-debug]- 共享LLM CLI参数:
- -llm_apikey:启用LLM支持的工作流时需要,包括 vcall_finder 聚合和 LLM_DECOMPILE - -llm_baseurl:可选的自定义兼容基本URL(当 -llm_fake_as=codex) - -llm_model:可选,默认为 gpt-4o - -llm_temperature:可选;仅在明确设置时发送 - -llm_effort:可选;默认为 medium;支持 none|minimal|low|medium|high|xhigh - -llm_fake_as:可选; codex 切换到直接 /v1/responses SSE运输 - 环境倒退: CS2VIBE_LLM_APIKEY, CS2VIBE_LLM_BASEURL, CS2VIBE_LLM_MODEL, CS2VIBE_LLM_TEMPERATURE, CS2VIBE_LLM_EFFORT, CS2VIBE_LLM_FAKE_AS - LLM工作流无法读取 OPENAI_API_KEY, OPENAI_API_BASE,或 OPENAI_API_MODEL
- 旧签名来自
bin/{previous_gamever}/{module}/{symbol}.{platform}.yaml在实际运行Agent SKILL之前,将直接通过mcp调用在当前版本的游戏二进制文件中查找符号。在这种情况下,不会消耗任何令牌。
-agent="claude.cmd"适用于从Windows npm安装的claude-cli
- 我们更喜欢程序化预处理器脚本>基于LLM_DECOMPILE的预处理器脚本>Agent
SKILL.md
- 当
-rename指定后,对现有的预期输出YAML文件运行重命名/注释后处理。
vcall_finder相关
-vcall_finder=g_pNetworkMessages按模块级别声明的对象进行筛选vcall_finder配置;-vcall_finder=*处理来自的每个声明对象config.yaml.
- 当
-vcall_finder启用后,脚本将每个引用函数的完整反汇编和伪代码导出到vcall_finder/{gamever}/{object_name}/{module}/{platform}/,然后在所有模块/平台IDA工作完成后运行LLM聚合;如果一个细节YAML已经有一个顶级found_vcall,该函数跳过LLM调用,直接重用缓存的结果。
- LLM响应成功后,脚本会立即写回
found_vcall: [...]或found_vcall: []因此重新运行可以跳过该函数的LLM调用。
vcall_finder/{gamever}/{object_name}.txt现在是一个附加的YAML文档流;每条记录直接包含insn_va,insn_disasm,以及vfunc_offset没有嵌套found_vcall:包装。
uv run ida_analyze_bin.py -gamever=14141 -modules=networksystem -platform=windows -vcall_finder=g_pNetworkMessages -llm_model=gpt-5.4 -llm_apikey=your-key -llm_effort=high -llm_fake_as=codex -llm_baseurl=http://127.0.0.1:8080/v1示例输出:
vcall_finder/14141/g_pNetworkMessages/networksystem/windows/sub_140123450.yamlvcall_finder/14141/g_pNetworkMessages.txt
- IDA预处理器环境:
- CS2VIBE_STRING_MIN_LENGTH:仅控制预处理器字符串枚举的可选IDA字符串列表设置 - 未设置或为空:不调用 idautils.Strings.setup;使用IDB的当前字符串列表状态 - 整数 >=1:呼叫 idautils.Strings.setup(strtypes=[ida_nalt.STRTYPE_C], minlen=) 当前IDB尚未设置相同参数时 - 非整数或值 /. .yaml
准备步骤:
- 确认目标函数已经具有当前版本的YAML
func_va,或者可以在IDA中通过符号名称/别名解析config.yaml. - 运行独立CLI:
uv run generate_reference_yaml.py -gamever 14141 -module engine -platform windows -func_name CNetworkGameClient_RecordEntityBandwidth -mcp_host 127.0.0.1 -mcp_port 13337自动启动 idalib-mcp 例子:
uv run generate_reference_yaml.py -gamever 14141 -module engine -platform windows -func_name CNetworkGameClient_RecordEntityBandwidth -auto_start_mcp -binary bin/14141/engine/engine2.dll- 检查生成的YAML:
- func_va 是可信的 - disasm_code 非空,与目标函数语义匹配 - procedure 在可用时匹配预期语义(当十六进制射线不可用时,它可以是空字符串) - func_name 仅确认输出文件针对您请求的规范名称;它不能证明地址解析的正确性
- 将其连接到目标中
find-*.pyLLM_DECOMPILE:
- 存储库中生成的文件路径: - ida_preprocessor_scripts/references//. .yaml - 如果 LLM_DECOMPILE 使用相对路径,写: - references//. .yaml - 示例元组: - ("CNetworkMessages_FindNetworkGroup", "prompt/call_llm_decompile.md", "references/engine/CNetworkGameClient_RecordEntityBandwidth.windows.yaml") - LLM_DECOMPILE 使用相同的共享 ida_analyze_bin.py -llm_* 旗帜: -llm_model, -llm_apikey, -llm_baseurl, -llm_temperature, -llm_effort, -llm_fake_as
3.将yaml转换为gamedata json.txt
uv run update_gamedata.py -gamever 14141 [-debug]4.运行cpp测试,检查cpp标头是否与yaml不匹配
uv run run_cpp_tests.py -gamever 14141 [-debug] [-fixheader] [-agent=claude/codex/"claude.cmd"/"codex.cmd"] - 当与
-fixheader,将启动一个代理来修复cpp标头中的不匹配。
当前支持的游戏数据
dist/CounterStrikeSharp/config/addons/counterstrikesharp/gamedata/gamedata.json
- 2个跳过的符号。
GameEventManager:CSS不再使用。
CEntityResourceManifest_AddResource:游戏更新时几乎没有变化。
dist/CS2Fixes/gamedata/cs2fixes.games.txt
CCSPlayerPawn_GetMaxSpeed跳过,因为它不是server.dll
dist/swiftlys2/plugin_files/gamedata/cs2/core/offsets.jsonc
dist/swiftlys2/plugin_files/gamedata/cs2/core/signatures.jsonc
dist/plugify-plugin-s2sdk/assets/gamedata.jsonc
dist/cs2kz-metamod/gamedata/cs2kz-core.games.txt
dist/modsharp-public/.asset/gamedata/core.games.jsonc
dist/modsharp-public/.asset/gamedata/engine.games.jsonc
dist/modsharp-public/.asset/gamedata/EntityEnhancement.games.jsonc
dist/modsharp-public/.asset/gamedata/log.games.jsonc
dist/modsharp-public/.asset/gamedata/server.games.jsonc
dist/modsharp-public/.asset/gamedata/tier0.games.jsonc
dist/cs2surf/gamedata/cs2surf-core.games.jsonc
如何为vtable创建SKILL
CCSPlayerPawn 例如。
克劳德代码:
/create-preprocessor-scripts Create "find-CCSPlayerPawn_vtable" in server.如何为常规功能创建技能
CItemDefuser_Spawn 和 CBaseModelEntity_SetModel 例如
1.在IDA中查找所需的符号
- 在IDA中搜索字符串“武器/模型/拆除者/拆除者.vmdl”,在字符串的外部参照中查找具有以下模式的代码段:
v2 = a2;
v3 = (__int64)a1;
sub_180XXXXXX(a1, (__int64)"weapons/models/defuser/defuser.vmdl"); //This is CBaseModelEntity_SetModel, rename it to CBaseModelEntity_SetModel
sub_180YYYYYY(v3, v2);
v4 = (_DWORD *)sub_180ZZZZZZ(&unk_181AAAAAA, 0xFFFFFFFFi64);
if ( !v4 )
v4 = *(_DWORD **)(qword_181BBBBBB + 8);
if ( *v4 == 1 )
{
v5 = (__int64 *)(*(__int64 (__fastcall **)(__int64, const char *, _QWORD, _QWORD))(*(_QWORD *)qword_181CCCCCC + 48i64))(
qword_181CCCCCC,
"defuser_dropped",
0i64,
0i64);具有此代码段的函数是 CItemDefuser_Spawn
2.创建预处理器脚本并更新 config.yaml
克劳德代码:
/create-preprocessor-scripts Create "find-CItemDefuser_Spawn" in server by xref_strings "weapons/models/defuser/defuser.vmdl" "defuser_dropped", where CItemDefuser_Spawn is a vfunc of CItemDefuser_vtable.克劳德代码:
/create-preprocessor-scripts Create "find-CBaseModelEntity_SetModel" in server by LLM_DECOMPILE with "CItemDefuser_Spawn", where CBaseModelEntity_SetModel is a regular function being called in "CItemDefuser_Spawn".如何为全局变量创建SKILL
IGameSystem_InitAllSystems_pFirst 例如
1.在IDA中查找所需的符号
- 在IDA中搜索字符串“IGameSystem::InitAllSystems”,在外部参照中搜索该字符串。具有该字符串外部参照的函数为
IGameSystem_InitAllSystems.
- 将其重命名为
IGameSystem_InitAllSystems如果尚未重命名。
- 在IGameSystem_InitAllSystems的开头查找代码模式:“(i=qword_XXXXXX;i;i=\*(\_qword\*)(i+8)”
- 重命名
qword_XXXXXX以前发现IGameSystem_InitAllSystems_pFirst如果它还没有重命名。
2.创建预处理器脚本并更新 config.yaml
克劳德代码:
/create-preprocessor-scripts Create "find-IGameSystem_InitAllSystems" in server by xref_strings "IGameSystem::InitAllSystems", where IGameSystem_InitAllSystems is a regular func.克劳德代码:
/create-preprocessor-scripts Create "find-IGameSystem_InitAllSystems_pFirst" in server by LLM_DECOMPILE with "IGameSystem_InitAllSystems", where IGameSystem_InitAllSystems_pFirst is a global variable being used in "IGameSystem_InitAllSystems".如何为结构体偏移量创建SKILL
CGameResourceService_m_pEntitySystem 例如。
1.在IDA中查找所需的符号
- 在IDA中搜索字符串“CGameResourceService::BuildResourceManifest(start)”,在外部参照中搜索该字符串。
- 外部参照应指向一个函数-这是
CGameResourceService_BuildResourceManifest.将其重命名为CGameResourceService_BuildResourceManifest如果尚未重命名。
2.创建预处理器脚本并更新 config.yaml
克劳德代码:
/create-preprocessor-scripts Create "find-CGameResourceService_BuildResourceManifest" in engine by xref_strings "CGameResourceService::BuildResourceManifest(start)" , where CGameResourceService_BuildResourceManifest is a vfunc of CGameResourceService_vtable./create-preprocessor-scripts Create "find-CGameResourceService_m_pEntitySystem" in engine by LLM_DECOMPILE with "CGameResourceService_BuildResourceManifest", where CGameResourceService_m_pEntitySystem is a struct offset.如何为补丁创建SKILL
- 补丁SKILL在已知函数内定位特定指令,并生成替换字节以在运行时更改其行为(例如,强制/跳过分支,NOP调用)。目标函数应该已经有相应的查找技能输出可用(通常通过
expected_input).
- 始终确保您的ida pro mcp服务器正在运行。
- 对于人类贡献者:在查找新符号时,您应该编写新的初始提示, 不要 复制粘贴README中的初始提示!!!
CCSPlayer_MovementServices_FullWalkMove_SpeedClamp 例如,修补速度夹紧 jbe 无条件 jmp 里面 CCSPlayer_MovementServices_FullWalkMove.
1.在IDA中查找所需的符号
- 分解CCSPlayer_MovementServices_FullWalkMove并查找代码模式-无论是什么浮点数>任何浮点数的平方:
v20 = (float)((float)(v16 * v16) + (float)(v19 * v19)) + (float)(v17 * v17);
if ( v20 > (float)(v18 * v18) )
{
...velocity clamping logic...
}- 围绕比较进行拆解,以找到确切的条件跳转指令。
- 围绕比较地址进行拆解,找到comiss+jbe指令对。
Expected assembly pattern:
addss xmm2, xmm1 ; v20 = sum of squares
comiss xmm2, xmm0 ; compare v20 vs v18*v18
jbe loc_XXXXXXXX ; skip clamp block if v20 90` (unconditional `jmp` + `nop`)
* Short `jbe` (`76 rel8` — 2 bytes) → `EB rel8` (unconditional `jmp short`)2.创建预处理器脚本并更新 config.yaml
按照中的步骤进行操作 .claude/skills/create-preprocessor-scripts/SKILL.md 创建预处理器脚本并更新 config.yaml.
故障排除
错误:无法创建“ida.egg-info”:访问被拒绝
缓解措施:你应该跑步 python py-activate-idalib.py 在...之下 C:\Program Files\IDA Professional 9.0\idalib\python 和 管理员 特权。
在中找不到idalib64.dll。........
缓解措施:尝试 set IDADIR=C:\Program Files\IDA Professional 9.0 或添加 IDADIR=C:\Program Files\IDA Professional 9.0 您的系统环境。
CI/CD工作流程参考
@echo Download latest game binaries
uv run download_bin.py -gamever %CS2_GAMEVER%@echo Analyze game binaries
uv run ida_analyze_bin.py -gamever %CS2_GAMEVER% -agent="claude.cmd" -platform %CS2_PLATFORM% -debug@echo Update gamedata with generated yamls
uv run update_gamedata.py -gamever %CS2_GAMEVER% -debug@echo Find mismatches in CS2SDK headers and fix them
uv run run_cpp_tests.py -gamever %CS2_GAMEVER% -debug -fixheader -agent="claude.cmd"