change stuff and add stuff

This commit is contained in:
2025-04-05 07:06:41 +01:00
parent 57db451958
commit c284bad06b
5 changed files with 51 additions and 14 deletions
+2
View File
@@ -14,6 +14,8 @@ sysinfo = "0.33.1"
windows = { version = "0.61.1", features = [
"Win32_UI_Input_KeyboardAndMouse",
"Win32_System_Threading",
"Win32_UI_Shell",
"Win32_UI_WindowsAndMessaging",
] }
winreg = "0.55.0"
+2 -2
View File
@@ -11,7 +11,7 @@ const ENHANCED: &str = "GTA5_Enhanced.exe";
const LEGACY: &str = "GTA5.exe";
pub struct EmptySession {
pub enabled: bool,
pub disabled: bool,
pub interval: Instant,
pub countdown: Countdown,
}
@@ -19,7 +19,7 @@ pub struct EmptySession {
impl Default for EmptySession {
fn default() -> Self {
Self {
enabled: true,
disabled: false,
interval: Instant::now(),
countdown: Countdown::new(features::empty_session::INTERVAL.as_secs() as usize),
}
+27 -12
View File
@@ -1,9 +1,12 @@
use crate::features::{
self,
anti_afk::AntiAfk,
empty_session::EmptySession,
force_close::ForceClose,
launch::{Launch, Platform},
use crate::{
features::{
self,
anti_afk::AntiAfk,
empty_session::EmptySession,
force_close::ForceClose,
launch::{Launch, Platform},
},
util::elevate,
};
use eframe::egui;
use std::time::{Duration, Instant};
@@ -92,21 +95,21 @@ impl eframe::App for App {
ui.label("Session");
ui.add(egui::Separator::default().horizontal());
});
ui.add_enabled_ui(self.empty_session.enabled, |ui| {
ui.add_enabled_ui(!self.empty_session.disabled, |ui| {
ui.horizontal(|ui| {
if ui.button("Empty current session").clicked() {
self.empty_session.interval = Instant::now();
self.empty_session.enabled = false;
self.empty_session.disabled = true;
features::empty_session::activate(self);
}
if !self.empty_session.enabled {
if self.empty_session.disabled {
self.empty_session.countdown.count();
} else {
self.empty_session.countdown.reset();
}
if self.empty_session.interval.elapsed() >= features::empty_session::INTERVAL {
features::empty_session::deactivate(self);
self.empty_session.enabled = true;
self.empty_session.disabled = false;
}
ui.label(&self.empty_session.countdown.i_string);
});
@@ -119,6 +122,14 @@ impl eframe::App for App {
features::anti_afk::activate();
self.anti_afk.interval = Instant::now();
}
// ui.horizontal(|ui| {
// ui.label("Network");
// ui.add(egui::Separator::default().horizontal());
// });
// if ui.button("Elevate").clicked() {
// elevate::elevate();
// }
// ui.checkbox(&mut false, "Block connections to Rockstar");
ui.with_layout(egui::Layout::bottom_up(egui::Align::Center), |ui| {
ui.horizontal(|ui| {
ui.horizontal(|ui| {
@@ -127,7 +138,11 @@ impl eframe::App for App {
ui.hyperlink_to("futile", "http://futile.eu");
});
ui.separator();
ui.label(format!("v{}", env!("CARGO_PKG_VERSION")));
ui.label(format!(
"v{} {}",
env!("CARGO_PKG_VERSION"),
if cfg!(debug_assertions) { "(dev)" } else { "" }
));
});
// ui.separator();
});
@@ -156,7 +171,7 @@ pub fn run() {
viewport: egui::ViewportBuilder::default()
.with_resizable(false)
.with_maximize_button(false)
.with_inner_size([250.0, 180.0])
.with_inner_size([250.0, 225.0])
.with_icon(load_icon()),
centered: true,
..Default::default()
+19
View File
@@ -0,0 +1,19 @@
use windows::{
Win32::UI::{Shell::ShellExecuteW, WindowsAndMessaging::SW_HIDE},
core::{HSTRING, PCWSTR},
};
pub fn elevate() {
let exe = std::env::current_exe().unwrap();
unsafe {
ShellExecuteW(
None,
&HSTRING::from("runas"),
&HSTRING::from(exe.as_path()),
PCWSTR::null(),
PCWSTR::null(),
SW_HIDE,
);
}
std::process::exit(0);
}
+1
View File
@@ -1 +1,2 @@
pub mod countdown;
pub mod elevate;