cheatengine 5.8.12 → 5.8.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bin/cheatengine CHANGED
@@ -4,10 +4,18 @@
4
4
  * 调用Python运行ce_mcp_server.py
5
5
  */
6
6
 
7
- const { spawn } = require('child_process');
7
+ const { spawn, execSync } = require('child_process');
8
8
  const path = require('path');
9
9
  const fs = require('fs');
10
10
 
11
+ // 调试模式
12
+ const DEBUG = process.env.DEBUG === '1';
13
+ function log(...args) {
14
+ if (DEBUG) console.error('[cheatengine]', ...args);
15
+ }
16
+
17
+ log('Starting cheatengine wrapper...');
18
+
11
19
  // 找到包根目录(兼容 npx/npm install 各种情况)
12
20
  function findPackageRoot() {
13
21
  // 方法1: 通过 package.json 定位
@@ -21,7 +29,10 @@ function findPackageRoot() {
21
29
  }
22
30
 
23
31
  const packageRoot = findPackageRoot();
32
+ log('Package root:', packageRoot);
33
+
24
34
  const pythonScript = path.join(packageRoot, 'ce_mcp_server.py');
35
+ log('Python script path:', pythonScript);
25
36
 
26
37
  // 验证Python脚本存在
27
38
  if (!fs.existsSync(pythonScript)) {
@@ -31,20 +42,38 @@ if (!fs.existsSync(pythonScript)) {
31
42
  process.exit(1);
32
43
  }
33
44
 
34
- // 检测Python命令
35
- const pythonCmd = process.platform === 'win32' ? 'python' : 'python3';
45
+ // 检测Python命令 - Windows上尝试多个选项
46
+ let pythonCmd = 'python';
47
+ if (process.platform === 'win32') {
48
+ // Windows: 尝试 python, python3, py
49
+ for (const cmd of ['python', 'python3', 'py']) {
50
+ try {
51
+ execSync(`${cmd} --version`, { stdio: 'ignore' });
52
+ pythonCmd = cmd;
53
+ log('Found Python:', cmd);
54
+ break;
55
+ } catch (e) {
56
+ // 尝试下一个
57
+ }
58
+ }
59
+ }
60
+
61
+ log('Using Python command:', pythonCmd);
36
62
 
37
63
  const proc = spawn(pythonCmd, [pythonScript], {
38
64
  stdio: ['pipe', 'pipe', 'pipe'],
39
65
  windowsHide: true
40
66
  });
41
67
 
68
+ log('Python process spawned, PID:', proc.pid);
69
+
42
70
  // 透传stdin/stdout/stderr
43
71
  process.stdin.pipe(proc.stdin);
44
72
  proc.stdout.pipe(process.stdout);
45
73
  proc.stderr.pipe(process.stderr);
46
74
 
47
- proc.on('exit', (code) => {
75
+ proc.on('exit', (code, signal) => {
76
+ log('Python process exited, code:', code, 'signal:', signal);
48
77
  process.exit(code ?? 0);
49
78
  });
50
79
 
@@ -53,3 +82,8 @@ proc.on('error', (err) => {
53
82
  console.error('请确保已安装Python和pywin32: pip install pywin32');
54
83
  process.exit(1);
55
84
  });
85
+
86
+ // 如果3秒内没有退出,说明启动成功
87
+ setTimeout(() => {
88
+ log('Python process still running after 3s');
89
+ }, 3000);
package/ce_mcp_server.py CHANGED
@@ -2356,7 +2356,7 @@ class CEMCPServer:
2356
2356
  "result": {
2357
2357
  "protocolVersion": "2024-11-05",
2358
2358
  "capabilities": {"tools": {}},
2359
- "serverInfo": {"name": "cheatengine-mcp-bridge"},
2359
+ "serverInfo": {"name": "cheatengine-mcp-bridge", "version": "5.8.13"},
2360
2360
  "instructions": (
2361
2361
  "# Cheat Engine MCP - AI Usage Guide\n\n"
2362
2362
  "## Tool Selection Decision Tree\n\n"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cheatengine",
3
- "version": "5.8.12",
3
+ "version": "5.8.14",
4
4
  "description": "Cheat Engine MCP Server - AI-assisted reverse engineering bridge",
5
5
  "main": "bin/cheatengine",
6
6
  "bin": {