查找CBasePlayerControllerSetPlayerName
tools-only2026-10-27查看 1984复制 111
使用 IDA Pro MCP 在 CS2 二进制文件中查找并识别 CBasePlayerController_SetPlayerName 函数。在逆向工程 CS2 server.dll 或 server.so 时使用此技能,通过搜索已知字符串引用并分析交叉引用来定位 SetPlayerName 函数。
📘如何使用这个技能
- 1复制技能内容·点击上方「Copy SKILL.md」复制全部内容,或 Download 下载到本地
- 2打开你的 AI 客户端·支持 Claude Code、Trae、Cursor、ChatGPT、DeepSeek、Kimi 等任意 AI 助手
- 3粘贴为系统提示/知识文件·Claude Code:放入 .claude/skills/ 目录;普通对话:作为首条消息发送并说「请严格按这份技能文档执行」
- 4直接提出你的需求·AI 会按技能定义的工作流、格式和约束来处理,无需再解释背景
💡 提示:技能生效后,每次对话只需一句需求,AI 会按 SKILL.md 的流程执行。
SKILL.md3613 chars
---
name: find-CBasePlayerController_SetPlayerName
description: Find and identify the CBasePlayerController_SetPlayerName function in CS2 binary using IDA Pro MCP. Use this skill when reverse engineering CS2 server.dll or server.so to locate the SetPlayerName function by searching for known string references and analyzing cross-references.
---
# Find CBasePlayerController_SetPlayerName
Locate `CBasePlayerController_SetPlayerName` in CS2 server.dll or server.so using IDA Pro MCP tools.
## Method
1. Search for strings `fov_desired` and `newname`:
```
mcp__ida-pro-mcp__find_regex pattern="fov_desired"
mcp__ida-pro-mcp__find_regex pattern="newname"
```
2. Get cross-references to both strings:
```
mcp__ida-pro-mcp__xrefs_to addrs=["<fov_desired_addr>", "<newname_addr>"]
```
3. Find the function that references **both** strings - this is the player info sync function.
4. Decompile that function and look for the call to `CBasePlayerController_SetPlayerName`:
```
mcp__ida-pro-mcp__decompile addr="<function_addr>"
```
5. In the decompiled output, find the pattern:
```c
CBasePlayerController_SetPlayerName(a2, v6); // after name comparison and event firing
```
6. Rename if needed:
```
mcp__ida-pro-mcp__rename batch={"func": [{"addr": "<target_addr>", "name": "CBasePlayerController_SetPlayerName"}]}
```
7. Get function details for YAML:
```
mcp__ida-pro-mcp__lookup_funcs queries="<target_addr>"
```
8. Generate and validate unique signature:
**ALWAYS** Use SKILL `/generate-signature-for-function` to generate a robust and unique signature for the function.
9. Write IDA analysis output as YAML beside the binary:
**ALWAYS** Use SKILL `/write-func-as-yaml` to write the analysis results.
Required parameters:
- `func_name`: `CBasePlayerController_SetPlayerName`
- `func_addr`: The function address from step 7
- `func_sig`: The validated signature from step 8
Note: This is NOT a virtual function, so no vtable parameters are needed.
## Signature Pattern
The function is called after:
- Creating `CMsgPlayerInfo` message
- Firing `player_changename` event with `userid`, `oldname`, `newname` fields
- Comparing old and new player names
The surrounding function also handles `fov_desired` cvar (clamps FOV between 1-135).
## Function Characteristics
- **Type**: Regular member function (NOT virtual)
- **Parameters**: `(CBasePlayerController* this, const char* name)`
- **Behavior**:
- Copies player name to `this + 0x510` using `V_strncpy` with max length 128
- Calls network state change notification
## Hex Signature
| Bytes | Instruction | Description |
|-------|-------------|-------------|
| `41 B8 80 00 00 00` | `mov r8d, 80h` | 128 byte max name length (unique) |
| `48 8D 99 10 05 00 00` | `lea rbx, [rcx+510h]` | Name storage offset 0x510 (unique) |
**Final signature**: `41 B8 80 00 00 00 48 8D 99 10 05 00 00`
## Output YAML Format
The output YAML filename depends on the platform:
- `server.dll` → `CBasePlayerController_SetPlayerName.windows.yaml`
- `server.so` → `CBasePlayerController_SetPlayerName.linux.yaml`
```yaml
func_va: 0x180A8CA10 # Virtual address of the function - This can change when game updates.
func_rva: 0xA8CA10 # Relative virtual address (VA - image base) - This can change when game updates.
func_size: 0x3F # Function size in bytes - This can change when game updates.
func_sig: 41 B8 80 00 00 00 48 8D 99 10 05 00 00 # Unique byte signature for pattern scanning.
```
Note: This is NOT a virtual function, so there are no `vfunc_*` fields.