std::string rule_name = "LagSwitch";
std::string executable_path = "";
std::cout << xorstr_("Enter game path folder: ");
std::cin >> executable_path;
int lag_key = VK_F2;
int exit_key = VK_END;
int lag_time = 3500;
ShowWindow(GetConsoleWindow(), SW_HIDE);
MessageBox(NULL, "F2 - ON/OFF Key \nEND - Exit application", "LagSwitch", MB_OK);
std::string cmd = "netsh advfirewall firewall delete rule name=\"" + rule_name + "\"";
WinExec(cmd.c_str(), 0);
while (!(GetAsyncKeyState(exit_key) & 0x8000)) { // loop until exit key is pressed
if (GetAsyncKeyState(lag_key) & 0x8000) {
Beep(800, 200);
cmd = "netsh advfirewall firewall add rule name =\"" + rule_name + "\" dir=out action=block program=\"" + executable_path + "\"";
WinExec(cmd.c_str(), 0);
cmd = "netsh advfirewall firewall add rule name =\"" + rule_name + "\" dir=in action=block program=\"" + executable_path + "\"";
WinExec(cmd.c_str(), 0);
sleep(lag_time);
cmd = "netsh advfirewall firewall delete rule name=\"" + rule_name + "\"";
WinExec(cmd.c_str(), 0);
Beep(500, 200);
}
sleep(5);
}
Beep(200, 200);
return 0;
}