Skip to content

Commit 4d13a86

Browse files
authored
Merge pull request #3 from Felix3322/main
Merge VAC bypass
2 parents 803c2aa + e2feb86 commit 4d13a86

13 files changed

Lines changed: 459 additions & 109 deletions

File tree

Agents.md

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
# SnapKey v1.2.8 Agents 自动化修改规范
2+
3+
## 1. VAC Bypass 配置可调(config.cfg 可选项)
4+
5+
### 目标
6+
7+
* 允许**VAC绕过A/B**功能在`config.cfg`配置文件中保存其开关状态。
8+
* 允许**两个模式下所有Sleep延迟**范围可在配置文件调整(区分A/B模式)。
9+
10+
### 配置文件示例(新增段落)
11+
12+
```ini
13+
# VAC Bypass 配置
14+
vac_bypass_a = 1 # 1=启用 0=关闭
15+
vac_bypass_b = 0 # 1=启用 0=关闭
16+
17+
# VAC Bypass 延迟设置(单位:毫秒)
18+
vac_a_min_delay = 15 # A模式最低 overlap 延迟
19+
vac_a_max_delay = 35 # A模式最大 overlap 延迟
20+
21+
vac_b_min_delay = 5 # B模式最小释放-按下间隔
22+
vac_b_max_delay = 15 # B模式最大释放-按下间隔
23+
```
24+
25+
* **默认值**见上。
26+
* **禁止负数、最大最小颠倒。**
27+
* 未设置时,按默认值初始化。
28+
29+
---
30+
31+
## 2. 延迟生成随机数机制升级
32+
33+
### 目标
34+
35+
* 所有 VAC 绕过相关的延迟逻辑全部替换为 C++11 标准 `std::mt19937`(Mersenne Twister)+ `std::chrono`
36+
* 不允许使用 C 的 `rand()`,保证多线程/多实例下延迟分布均匀无碰撞。
37+
38+
### 必须实现
39+
40+
* 延迟取值每次都要走同一 `std::mt19937` 实例(优先全局静态),用 `std::random_device` 进行 seed。
41+
* **调用样例:**
42+
43+
```cpp
44+
static std::mt19937 rng(std::random_device{}());
45+
std::uniform_int_distribution<int> dist(min, max);
46+
int delay = dist(rng);
47+
std::this_thread::sleep_for(std::chrono::milliseconds(delay));
48+
```
49+
50+
---
51+
52+
## 3. VAC 绕过菜单状态和图标动态切换
53+
54+
### 目标
55+
56+
* **新增一个 icon\_vac\_bypass.ico(128x128)**
57+
58+
* 图案要求:
59+
60+
* 大号 VAC 字母(可参照 Valve Anti-Cheat 原色),下方画一个长水平箭头(建议 **→ 或 --**> 结构,强调“穿透/绕过”意象)
61+
* 图标风格必须“和 icon.ico、icon\_off.ico 一致”,不可过于复杂,保证 16x16 到 128x128 兼容缩放。
62+
* **图标切换规则:**
63+
64+
* **SnapKey 启用**,且**任一 VAC bypass 功能启用**:显示 icon\_vac\_bypass.ico
65+
* **SnapKey 禁用**(isLocked=true):只显示 icon\_off.ico(无论VAC选项)
66+
* 其它情况仍为普通 icon.ico
67+
* 菜单栏**VAC bypass A/B 状态**同步菜单打钩与图标状态。
68+
69+
---
70+
71+
## 4. 稳定性与兼容性要求
72+
73+
* 任何图标读取失败时,fallback 到 icon.ico,不允许图标状态丢失或崩溃。
74+
* 菜单状态与配置文件保持一致(修改菜单选项应自动写回 config.cfg,重启自动读取)。
75+
* 保持原有的托盘右键菜单逻辑和热键绑定管理不变。
76+
77+
---
78+
79+
## 5. agents.md 生成自动化流程推荐
80+
81+
(适合 CI/CD 或脚本辅助开发环境)
82+
83+
1. 检查 config.cfg 是否存在上述新段落。不存在则自动补全默认项。
84+
2. 替换所有 `Sleep(rand() % X)` 为 std::mt19937 + chrono 方案。
85+
3. 更新 Tray 菜单栏,VAC bypass A/B 绑定菜单、菜单项与 config 状态同步。
86+
4. 插入图标切换判定逻辑:任一绕过启用 && SnapKey 启用 → icon\_vac\_bypass.ico,否则按旧逻辑。
87+
5. 变更或菜单开关时自动写 config.cfg。
88+
6. 自动检测并加载 icon\_vac\_bypass.ico,找不到 fallback。
89+
7. 强制所有配置解析后做一次合法性检查(无效配置自动回落到默认)。
90+
8. 不影响原有 Group/Key 配置、版本信息、帮助菜单等其它业务。
91+
92+
---
93+
94+
## 6. icon\_vac\_bypass.ico 设计(AI自动化图标生成描述)
95+
96+
**prompt:**
97+
98+
```
99+
A 128x128 Windows .ico file with large bold letters "VAC" in white or pale blue, on a dark or black background. Below the letters, a thick, clear, horizontal arrow (→ or --__>) passes underneath, visually suggesting "bypass" or "tunneling". The style should match classic tray icons—minimal, high-contrast, not cartoonish. Keep the icon readable at 16x16.
100+
```
101+
102+
---
103+
104+
## 7. 其它说明
105+
106+
* 所有自动化脚本与补丁操作**必须**严格遵循此 agents.md。
107+
* 具体代码注释需要使用英语
Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,28 @@
11
@echo off
2+
setlocal
3+
4+
rem ========== ·¾¶ÅäÖà ==========
5+
set THISDIR=%~dp0
6+
set CMAKE=%THISDIR%cmake-4.1.0-rc2-windows-x86_64\bin\cmake.exe
7+
set MINGW=%THISDIR%mingw64
8+
set PATH=%MINGW%\bin;%PATH%
9+
10+
rem ========== ±àÒë¹ý³Ì ==========
11+
echo [+] Configuring CMake...
12+
"%CMAKE%" -S "%THISDIR%..\.." -B "%THISDIR%build" -G "MinGW Makefiles"
13+
14+
if %errorlevel% neq 0 (
15+
echo [!] CMake configure failed.
16+
pause
17+
exit /b 1
18+
)
19+
20+
echo [+] Building with MinGW...
21+
"%CMAKE%" --build "%THISDIR%build"
22+
23+
if exist "%THISDIR%build\SnapKey.exe" (
24+
copy /Y "%THISDIR%build\SnapKey.exe" "%THISDIR%" >nul
25+
)
226

3-
mkdir build > nul
4-
cd build > nul
5-
echo [+] Preparing files...
6-
cmake .. > nul
7-
echo [+] Compiling...
8-
cmake --build . > nul
9-
cd .. > nul
10-
move "build\Debug\SnapKey.exe" "." > nul
1127
echo [+] Done!
12-
rmdir /s /q build > nul
13-
echo [+] Press a key to exit...
14-
pause > nul
28+
pause

Build SnapKey/CMAKE-Build/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /MT")
99
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /MTd")
1010
set(BUILD_SHARED_LIBS OFF)
1111

12-
add_executable(SnapKey SnapKey.cpp resources.rc)
12+
add_executable(SnapKey WIN32 SnapKey.cpp resources.rc)
1313

1414
if (WIN32)
1515
set_target_properties(SnapKey PROPERTIES
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
#define MyAppName "SnapKey"
2+
#define MyAppVersion "0.0.0"
3+
#define MyAppPublisher "cafali"
4+
#define MyAppURL "https://github.com/cafali/SnapKey"
5+
#define MyAppExeName "SnapKey.exe"
6+
#define User "cafali"
7+
#define Folder "SnapKeyDEV"
8+
9+
[Setup]
10+
AppId={{72AF690F-C35B-4E3F-B82B-8F75A06B960E}
11+
AppName={#MyAppName}
12+
AppVersion={#MyAppVersion}
13+
AppVerName={#MyAppName} {#MyAppVersion}
14+
AppPublisher={#MyAppPublisher}
15+
AppPublisherURL={#MyAppURL}
16+
AppSupportURL={#MyAppURL}
17+
AppUpdatesURL={#MyAppURL}
18+
DefaultDirName={localappdata}\{#MyAppName}
19+
DisableDirPage=yes
20+
UninstallDisplayIcon={app}\{#MyAppExeName}
21+
UninstallDisplayName=SnapKey
22+
ArchitecturesAllowed=x64compatible
23+
ArchitecturesInstallIn64BitMode=x64compatible
24+
DisableProgramGroupPage=yes
25+
LicenseFile=C:\Users\{#User}\AppData\Local\{#Folder}\LICENSE
26+
OutputDir=C:\Users\{#User}\Desktop
27+
OutputBaseFilename={#MyAppName}-{#MyAppVersion}-Setup
28+
SetupIconFile=Z:\dev\DEV SnapKey\snapkey.ico
29+
SolidCompression=yes
30+
WizardStyle=classic
31+
WizardImageFile=C:\Users\cafali\Desktop\wizard_large.bmp
32+
WizardSmallImageFile=C:\Users\cafali\Desktop\wizard_small.bmp
33+
VersionInfoVersion={#MyAppVersion}
34+
35+
36+
[Languages]
37+
Name: "english"; MessagesFile: "compiler:Default.isl"
38+
39+
[Tasks]
40+
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
41+
42+
[Files]
43+
Source: "C:\Users\{#user}\AppData\Local\{#Folder}\{#MyAppExeName}"; DestDir: "{app}"; Flags: ignoreversion
44+
Source: "C:\Users\{#user}\AppData\Local\{#Folder}\config.cfg"; DestDir: "{app}"; Flags: ignoreversion
45+
Source: "C:\Users\{#user}\AppData\Local\{#Folder}\icon.ico"; DestDir: "{app}"; Flags: ignoreversion
46+
Source: "C:\Users\{#user}\AppData\Local\{#Folder}\icon_off.ico"; DestDir: "{app}"; Flags: ignoreversion
47+
Source: "C:\Users\{#user}\AppData\Local\{#Folder}\LICENSE"; DestDir: "{app}"; Flags: ignoreversion
48+
Source: "C:\Users\{#user}\AppData\Local\{#Folder}\README.pdf"; DestDir: "{app}"; Flags: ignoreversion
49+
Source: "C:\Users\{#user}\AppData\Local\{#Folder}\SnapKey.exe"; DestDir: "{app}"; Flags: ignoreversion
50+
Source: "C:\Users\{#user}\AppData\Local\{#Folder}\meta\*"; DestDir: "{app}\meta"; Flags: ignoreversion recursesubdirs createallsubdirs
51+
52+
[Icons]
53+
Name: "{autoprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
54+
Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
55+
Name: "{group}\Uninstall SnapKey"; Filename: "{uninstallexe}"
56+
57+
58+
[Run]
59+
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent
60+
15.9 MB
Binary file not shown.
768 KB
Binary file not shown.
5.93 MB
Binary file not shown.

README.md

Lines changed: 36 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,25 @@ SnapKey is a lightweight, open-source tool that operates from the system tray an
1212

1313
**Need More Info on SnapKey?** Visit the [**SnapKey Wiki**](https://github.com/cafali/SnapKey/wiki)
1414

15+
[![COMPATIBLE](https://github.com/user-attachments/assets/069a7a23-cfe4-47eb-8ac2-05872fcc2028)](https://github.com/cafali/SnapKey/wiki/Compatibility-List)
16+
17+
### **New in v1.2.9 – Experimental VAC/CS2 Bypass Modes 🚫🎮**
18+
--------------------------------------------------------------------------------------------------
19+
SnapKeyPlus v1.2.9 introduces two **experimental bypass modes** aimed at improving compatibility with games that impose stricter input policies, such as **Counter-Strike 2 (CS2)**. These modes can be toggled independently in the configuration file and allow SnapKey to remain active while circumventing CS2’s built-in restrictions on background input automation.
20+
21+
> ⚙️ **VAC Bypass A** — Simulates real-time user input using a lower-level system call chain.
22+
> ⚙️ **VAC Bypass B** — Uses synthetic input injection with randomized timings to mimic human behavior more accurately.
23+
24+
Both modes are entirely optional and **disabled by default**. When enabled, SnapKey will change its tray icon to indicate **VAC bypass mode** is active:
25+
26+
* ✅ A curved arrow wrapping around the "VAC" label appears.
27+
* ⛔ This visually reminds users that advanced compatibility workarounds are enabled.
28+
<img width="239" height="274" alt="image" src="https://github.com/user-attachments/assets/a1019787-0420-49e6-aa87-1e79f78bb66c" />
29+
30+
> \[!WARNING]
31+
> These features are **experimental** and **not officially endorsed by Valve or any game publisher**. While SnapKey does not directly modify any game files or memory, **use of automation tools may still violate Terms of Service** for certain games.
32+
> **Use at your own risk.**
33+
1534
Download
1635
--------------------------------------------------------------------------------------------------
1736
<p align="center">
@@ -20,7 +39,6 @@ Download
2039
<a href="https://www.softpedia.com/get/Tweak/System-Tweak/SnapKey.shtml">Download from Softpedia</a>
2140
</p>
2241

23-
2442
[![latesver](https://github.com/user-attachments/assets/09694f7c-6eeb-4c80-9a02-1d777956d181)](https://github.com/cafali/SnapKey/wiki/Updates)
2543

2644
**SnapKey Features**
@@ -42,8 +60,6 @@ Download
4260

4361
**SnapKey in Action**
4462
--------------------------------------------------------------------------------------------------
45-
![Explain](https://github.com/user-attachments/assets/7d11c221-33d8-43ea-839b-bfe276332593)
46-
4763
- When you press and hold down the **"A"** key, SnapKey remembers it.
4864
- If you then press the **"D"** key while still holding down **"A"** SnapKey automatically releases the **"A"** key for you.
4965
- The same happens if you press **"A"** while holding **"D"** — SnapKey releases the **"D"** key.
@@ -59,7 +75,10 @@ Download
5975
hold down the **"A"** key and tap the **"D"** key repeatedly, each press of **"D"** will temporarily override
6076
the **"A"** key. When you release the **"D"** key, the action associated with the **"A"** key will resume, as
6177
long as you're still holding it down. The same principle applies if you start with **"D"** held down and
62-
press **"A"** instead.
78+
press **"A"** instead.
79+
80+
> [!NOTE]
81+
> SnapKey and similar solutions have been disallowed in certain games; illustrations shown are for demonstrative purposes only.
6382
6483
![Snapkey](https://github.com/user-attachments/assets/504ffa5e-50d3-4a77-9016-70f22d143cb1)
6584

@@ -73,29 +92,19 @@ press **"A"** instead.
7392
--------------------------------------------------------------------------------------------------
7493
![use](https://github.com/user-attachments/assets/4d9fdf11-ec72-459c-995e-364bf1fc8d66)
7594

76-
77-
7895
1. Get SnapKey:
7996
- [Download](https://github.com/kaxlabs/SnapKeyPlus/releases), Unzip and Launch SnapKey.exe
8097

8198
<img src="https://github.com/user-attachments/assets/7f8f1b06-01a8-4bc9-af9f-87d0b19b4e15" alt="Folder" width="80%">
8299

83-
84-
85-
86-
87-
88100
2. System Tray:
89101
- SnapKey will appear in your system tray
90102

91103
![tray](https://github.com/user-attachments/assets/26c08735-76f2-4bc0-aa75-44c9a866b453)
92104

93-
94-
95105
3. You're All Set:
96106
- SnapKey is now running and is ready to use
97-
98-
107+
99108
4. Rebind Keys (Optional):
100109
- [Rebind your keys](https://github.com/cafali/SnapKey/wiki/Rebinding-Keys) if you're using a nonstandard keyboard layout or if you want to map different keys
101110

@@ -105,19 +114,12 @@ Disable SnapKey
105114

106115
![image](https://github.com/user-attachments/assets/4f9d8d30-4674-4361-bc87-84ee70ce4116)
107116

108-
109-
110-
111117
Exit SnapKey
112118
--------------------------------------------------------------------------------------------------
113119
- Right-click the SnapKey icon in the system tray and select "Exit SnapKey"
114120

115121
![image](https://github.com/user-attachments/assets/c3a9534e-ed8b-4258-be56-37b6117c1814)
116122

117-
118-
119-
120-
121123
**Linux Support**
122124
--------------------------------------------------------------------------------------------------
123125
Since SnapKey isn’t natively supported on Linux, it’s recommended to check out @Dillacorn's guide on **[running SnapKey on Linux](https://github.com/cafali/SnapKey/issues/4#issuecomment-2251568839)**.
@@ -129,37 +131,37 @@ Looking for More Information? Got Questions or Need Help?
129131
[<img src="https://github.com/user-attachments/assets/0c6d7564-6471-49f2-9367-64f7bffb7e37" alt="Wikitest" width="50%" />](https://github.com/cafali/SnapKey/wiki)
130132

131133
- **[About ℹ️](https://github.com/cafali/SnapKey/wiki/About)**
132-
Discover Snapkey, explore its features, and see how it can benefit you.
134+
Discover SnapKey, explore its features and see how it can benefit you
133135

134136
- **[Code Breakdown 🧠](https://github.com/cafali/SnapKey/wiki/Code-Breakdown)**
135-
Dive into the details of SnapKey’s code structure.
137+
Dive into the details of SnapKey’s code structure
136138

137139
- **[Compatibility List 🎮](https://github.com/cafali/SnapKey/wiki/Compatibility-List)**
138-
Games that work with SnapKey and those that don't.
140+
Compatibility status of games with SnapKey
139141

140142
- **[FAQ❓](https://github.com/cafali/SnapKey/wiki/FAQ)**
141-
Find answers to common questions about Snapkey.
143+
Find answers to common questions about SnapKey
142144

143145
- **[License 📜](https://github.com/cafali/SnapKey/wiki/License)**
144-
Overview of Snapkey’s licensing.
146+
Overview of SnapKey’s licensing
145147

146148
- **[Rebinding Keys ⌨️](https://github.com/cafali/SnapKey/wiki/Rebinding-Keys)**
147-
Instructions on how to rebind keys.
149+
Instructions on how to rebind keys
148150

149151
- **[Setup 🛠️](https://github.com/cafali/SnapKey/wiki/Setup)**
150-
General setup instructions for getting Snapkey up and running on your system.
152+
General setup instructions for getting Snapkey up and running on your system
151153

152154
- **[Setup Linux 🐧](https://github.com/cafali/SnapKey/wiki/Setup-Linux)**
153-
Setting up Snapkey on Linux distributions.
155+
Setting up SnapKey on Linux distributions
154156

155157
- **[System Requirements 🖥️](https://github.com/cafali/SnapKey/wiki/System-Requirements)**
156-
SnapKey System Requirments.
158+
SnapKey System Requirements
157159

158160
- **[Troubleshoot 🔧](https://github.com/cafali/SnapKey/wiki/Troubleshoot)**
159-
Solutions and tips for troubleshooting common issues with Snapkey.
161+
Solutions and tips for troubleshooting common issues with SnapKey
160162

161-
- **[Updates 🔄](https://github.com/cafali/SnapKey/wiki/Updates)**
162-
SnapKey Version Updates.
163+
- **[Changelog 🔄](https://github.com/cafali/SnapKey/wiki/Updates)**
164+
View SnapKey releases and changes
163165
----
164166

165167
<p align="center">

0 commit comments

Comments
 (0)