use more unwraps instead of let _ =
This commit is contained in:
@@ -6,7 +6,7 @@ use crate::util::{
|
|||||||
};
|
};
|
||||||
use std::time::{Duration, Instant};
|
use std::time::{Duration, Instant};
|
||||||
use windows::Win32::{
|
use windows::Win32::{
|
||||||
Foundation::{CloseHandle, HANDLE, NTSTATUS},
|
Foundation::{HANDLE, NTSTATUS},
|
||||||
System::Threading::{OpenProcess, PROCESS_SUSPEND_RESUME},
|
System::Threading::{OpenProcess, PROCESS_SUSPEND_RESUME},
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -70,13 +70,12 @@ pub fn activate(game_handle: &mut HANDLE, system_info: &mut SystemInfo) -> Resul
|
|||||||
return Err(());
|
return Err(());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let _ = unsafe { NtSuspendProcess(*game_handle) };
|
unsafe { NtSuspendProcess(*game_handle) }.unwrap();
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn deactivate(game_handle: &mut HANDLE) {
|
pub fn deactivate(game_handle: &mut HANDLE) {
|
||||||
if !game_handle.is_invalid() {
|
if !game_handle.is_invalid() {
|
||||||
let _ = unsafe { NtResumeProcess(*game_handle) };
|
unsafe { NtResumeProcess(*game_handle) }.unwrap();
|
||||||
let _ = unsafe { CloseHandle(*game_handle) };
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ impl GameNetworking {
|
|||||||
(FILTER_NAME_IN, NET_FW_RULE_DIR_IN),
|
(FILTER_NAME_IN, NET_FW_RULE_DIR_IN),
|
||||||
(FILTER_NAME_OUT, NET_FW_RULE_DIR_OUT),
|
(FILTER_NAME_OUT, NET_FW_RULE_DIR_OUT),
|
||||||
] {
|
] {
|
||||||
let _ = unsafe { rules.Remove(&BSTR::from(filter.0)) };
|
unsafe { rules.Remove(&BSTR::from(filter.0)) }.unwrap();
|
||||||
let rule: INetFwRule =
|
let rule: INetFwRule =
|
||||||
unsafe { CoCreateInstance(&NetFwRule, None, CLSCTX_INPROC_SERVER) }.unwrap();
|
unsafe { CoCreateInstance(&NetFwRule, None, CLSCTX_INPROC_SERVER) }.unwrap();
|
||||||
unsafe { rule.SetName(&BSTR::from(filter.0)) }.unwrap();
|
unsafe { rule.SetName(&BSTR::from(filter.0)) }.unwrap();
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ pub fn launch(platform: &Platform, version: &LaunchVersion) {
|
|||||||
LaunchVersion::Enhanced => "steam://run/3240220",
|
LaunchVersion::Enhanced => "steam://run/3240220",
|
||||||
LaunchVersion::Legacy => "steam://run/271590",
|
LaunchVersion::Legacy => "steam://run/271590",
|
||||||
};
|
};
|
||||||
let _ = open::that_detached(steam_url);
|
open::that_detached(steam_url).unwrap();
|
||||||
}
|
}
|
||||||
Platform::Rockstar => {
|
Platform::Rockstar => {
|
||||||
let hklm = RegKey::predef(HKEY_LOCAL_MACHINE);
|
let hklm = RegKey::predef(HKEY_LOCAL_MACHINE);
|
||||||
@@ -44,6 +44,7 @@ pub fn launch(platform: &Platform, version: &LaunchVersion) {
|
|||||||
};
|
};
|
||||||
let mut play_gtav_path = PathBuf::from(install_folder);
|
let mut play_gtav_path = PathBuf::from(install_folder);
|
||||||
play_gtav_path.push("PlayGTAV.exe");
|
play_gtav_path.push("PlayGTAV.exe");
|
||||||
|
// ignoring `Result` because if it errors that means GTA isn't installed via Rockstar
|
||||||
let _ = Command::new(play_gtav_path).spawn();
|
let _ = Command::new(play_gtav_path).spawn();
|
||||||
}
|
}
|
||||||
Platform::Epic => {
|
Platform::Epic => {
|
||||||
@@ -55,7 +56,7 @@ pub fn launch(platform: &Platform, version: &LaunchVersion) {
|
|||||||
"com.epicgames.launcher://apps/9d2d0eb64d5c44529cece33fe2a46482?action=launch&silent=true"
|
"com.epicgames.launcher://apps/9d2d0eb64d5c44529cece33fe2a46482?action=launch&silent=true"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
let _ = open::that_detached(epic_url);
|
open::that_detached(epic_url).unwrap();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -243,8 +243,8 @@ impl App {
|
|||||||
.button("⬇")
|
.button("⬇")
|
||||||
.on_hover_text("Go to current latest version.");
|
.on_hover_text("Go to current latest version.");
|
||||||
if button.clicked() {
|
if button.clicked() {
|
||||||
let _ =
|
open::that("https://github.com/elituf/gta-tools/releases/latest")
|
||||||
open::that("https://github.com/elituf/gta-tools/releases/latest");
|
.unwrap();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user