reorganize some consts
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
#![allow(clippy::cast_possible_truncation)]
|
||||
|
||||
use crate::util::{self, consts::GTA_WINDOW_TITLE};
|
||||
use crate::util::{self, consts::game::WINDOW_TITLE};
|
||||
use std::time::{Duration, Instant};
|
||||
use windows::Win32::UI::Input::KeyboardAndMouse::{
|
||||
KEYBD_EVENT_FLAGS, MAP_VIRTUAL_KEY_TYPE, MapVirtualKeyW, VK_NUMPAD4, VK_NUMPAD6, keybd_event,
|
||||
@@ -35,7 +35,7 @@ impl AntiAfk {
|
||||
|
||||
pub fn can_activate() -> bool {
|
||||
use util::win::{is_any_key_pressed, is_cursor_visible, is_window_focused};
|
||||
is_window_focused(GTA_WINDOW_TITLE) && !is_any_key_pressed(&PRESS_KEYS) && !is_cursor_visible()
|
||||
is_window_focused(WINDOW_TITLE) && !is_any_key_pressed(&PRESS_KEYS) && !is_cursor_visible()
|
||||
}
|
||||
|
||||
pub fn send(vk_codes: &[u8]) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use crate::util::{
|
||||
consts::{ENHANCED, LEGACY},
|
||||
consts::game::{EXE_ENHANCED, EXE_LEGACY},
|
||||
countdown::Countdown,
|
||||
};
|
||||
use std::time::{Duration, Instant};
|
||||
@@ -39,7 +39,7 @@ fn get_gta_pid(sysinfo: &mut System) -> u32 {
|
||||
if let Some((pid, _)) = sysinfo
|
||||
.processes()
|
||||
.iter()
|
||||
.find(|(_, p)| p.name() == ENHANCED || p.name() == LEGACY)
|
||||
.find(|(_, p)| p.name() == EXE_ENHANCED || p.name() == EXE_LEGACY)
|
||||
{
|
||||
return pid.as_u32();
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use crate::util::consts::{ENHANCED, LEGACY};
|
||||
use crate::util::consts::game::{EXE_ENHANCED, EXE_LEGACY};
|
||||
use std::time::Instant;
|
||||
use sysinfo::System;
|
||||
|
||||
@@ -32,7 +32,7 @@ pub fn activate(sysinfo: &mut System) {
|
||||
sysinfo
|
||||
.processes()
|
||||
.iter()
|
||||
.filter(|(_, p)| p.name() == ENHANCED || p.name() == LEGACY)
|
||||
.filter(|(_, p)| p.name() == EXE_ENHANCED || p.name() == EXE_LEGACY)
|
||||
.for_each(|(_, p)| {
|
||||
p.kill();
|
||||
});
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#![allow(clippy::zombie_processes)]
|
||||
|
||||
use crate::util::consts::{ENHANCED, LEGACY};
|
||||
use crate::util::consts::game::{EXE_ENHANCED, EXE_LEGACY};
|
||||
use std::{os::windows::process::CommandExt, path::Path, process::Command};
|
||||
use sysinfo::System;
|
||||
use windows::Win32::System::Threading::CREATE_NO_WINDOW;
|
||||
@@ -12,7 +12,7 @@ fn get_game_exe_path(sysinfo: &mut System) -> Option<&Path> {
|
||||
if let Some((_, process)) = sysinfo
|
||||
.processes()
|
||||
.iter()
|
||||
.find(|(_, p)| p.name() == ENHANCED || p.name() == LEGACY)
|
||||
.find(|(_, p)| p.name() == EXE_ENHANCED || p.name() == EXE_LEGACY)
|
||||
{
|
||||
process.exe()
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user