Skip to content

Commit 153e5df

Browse files
committed
bump version, add no-omp cli arg
1 parent 35291ad commit 153e5df

File tree

12 files changed

+62
-19
lines changed

12 files changed

+62
-19
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,5 +53,5 @@ jobs:
5353
uses: actions/upload-artifact@v4
5454
with:
5555
name: ${{ steps.vars.outputs.setup_artifact_name }}
56-
path: src-tauri/target/i686-pc-windows-msvc/release/bundle/nsis/omp-launcher_1.6.1_x86-setup.exe
56+
path: src-tauri/target/i686-pc-windows-msvc/release/bundle/nsis/omp-launcher_1.6.3_x86-setup.exe
5757
if-no-files-found: error

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "omp-launcher",
33
"private": true,
4-
"version": "1.6.1",
4+
"version": "1.6.3",
55
"type": "module",
66
"homepage": "https://github.com/openmultiplayer/launcher",
77
"author": "Amyr (iAmir) Ahmady (https://github.com/AmyrAhmady)",

src-tauri/Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src-tauri/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "omp-launcher"
3-
version = "1.6.1"
3+
version = "1.6.3"
44
description = "Open Multiplayer Launcher"
55
authors = ["Amyr Ahmady (iAmir)"]
66
license = ""
@@ -48,6 +48,7 @@ windows-sys = { version = "0.52.0", features = [
4848
"Win32_UI_Input_KeyboardAndMouse",
4949
"Win32_UI_Shell",
5050
"Win32_UI_WindowsAndMessaging",
51+
"Win32_System_JobObjects"
5152
] }
5253
winreg = "0.52.0"
5354
dll-syringe = "0.15.2"

src-tauri/nsis/installer.nsi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ ${StrLoc}
1818

1919
!define MANUFACTURER "open"
2020
!define PRODUCTNAME "Open Multiplayer Launcher"
21-
!define VERSION "1.6.1"
22-
!define VERSIONWITHBUILD "1.6.1.0"
21+
!define VERSION "1.6.3"
22+
!define VERSIONWITHBUILD "1.6.3.0"
2323
!define SHORTDESCRIPTION "Open Multiplayer Launcher"
2424
!define INSTALLMODE "perMachine"
2525
!define LICENSE ""

src-tauri/nsis/installer_manual.nsi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ ${StrLoc}
1818

1919
!define MANUFACTURER "open"
2020
!define PRODUCTNAME "Open Multiplayer Launcher"
21-
!define VERSION "1.6.1"
22-
!define VERSIONWITHBUILD "1.6.1.0"
21+
!define VERSION "1.6.3"
22+
!define VERSIONWITHBUILD "1.6.3.0"
2323
!define SHORTDESCRIPTION "Open Multiplayer Launcher"
2424
!define INSTALLMODE "perMachine"
2525
!define LICENSE ""

src-tauri/src/cli.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ pub struct CliArgs {
2121

2222
#[options(help = "game path to use for both game executable and samp.dll")]
2323
pub gamepath: Option<String>,
24+
25+
#[options(help = "disable omp-client injection")]
26+
pub no_omp: bool,
2427
}
2528

2629
impl CliArgs {
@@ -66,6 +69,7 @@ Options:
6669
-P, --password <PASSWORD> Server password
6770
-n, --name <NAME> Nickname
6871
-g, --gamepath <GAMEPATH> Game path
72+
--no-omp Disable omp-client injection
6973
",
7074
program_name
7175
);

src-tauri/src/commands.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,19 @@ pub async fn inject(
1616
password: &str,
1717
custom_game_exe: &str,
1818
) -> std::result::Result<(), String> {
19+
let actual_omp_file = if *crate::NO_OMP_FLAG.lock().unwrap() {
20+
""
21+
} else {
22+
omp_file
23+
};
24+
1925
match injector::run_samp(
2026
name,
2127
ip,
2228
port,
2329
exe,
2430
dll,
25-
omp_file,
31+
actual_omp_file,
2632
password,
2733
custom_game_exe,
2834
)

src-tauri/src/injector.rs

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ use dll_syringe::{process::OwnedProcess, Syringe};
33
#[cfg(target_os = "windows")]
44
use log::info;
55
#[cfg(target_os = "windows")]
6-
use std::process::Command;
6+
use std::path::PathBuf;
7+
#[cfg(target_os = "windows")]
8+
use std::process::{Command, Stdio};
79

810
#[cfg(target_os = "windows")]
911
use crate::{constants::*, errors::*};
@@ -34,13 +36,25 @@ pub async fn run_samp(
3436
custom_game_exe: &str,
3537
) -> Result<()> {
3638
// Prepare the command to spawn the executable
37-
let mut target_game_exe = GTA_SA_EXECUTABLE.to_string();
38-
if custom_game_exe.len() > 0 {
39-
target_game_exe = custom_game_exe.to_string();
40-
}
41-
let mut cmd = Command::new(format!("{}/{}", executable_dir, target_game_exe));
39+
let target_game_exe = if custom_game_exe.len() > 0 {
40+
custom_game_exe.to_string()
41+
} else {
42+
GTA_SA_EXECUTABLE.to_string()
43+
};
44+
45+
let exe_path = PathBuf::from(executable_dir).join(&target_game_exe);
46+
47+
let exe_path = exe_path.canonicalize().map_err(|e| {
48+
LauncherError::Process(format!("Invalid executable path {:?}: {}", exe_path, e))
49+
})?;
50+
51+
let mut cmd = Command::new(&exe_path);
4252

4353
let mut ready_for_exec = cmd
54+
.stdin(Stdio::null())
55+
.stdout(Stdio::null())
56+
.stderr(Stdio::null())
57+
.current_dir(executable_dir)
4458
.arg("-c")
4559
.arg("-n")
4660
.arg(name)
@@ -58,7 +72,12 @@ pub async fn run_samp(
5872
match process {
5973
Ok(p) => {
6074
inject_dll(p.id(), dll_path, 0, false)?;
61-
inject_dll(p.id(), omp_file, 0, false)
75+
info!("[run_samp] omp_file.is_empty(): {}", omp_file.is_empty());
76+
if !omp_file.is_empty() {
77+
inject_dll(p.id(), omp_file, 0, false)
78+
} else {
79+
Ok(())
80+
}
6281
}
6382
Err(e) => {
6483
info!("[injector.rs] Process creation failed: {}", e);

src-tauri/src/main.rs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ use tauri::Manager;
3232
use tauri::PhysicalSize;
3333

3434
static URI_SCHEME_VALUE: Mutex<String> = Mutex::new(String::new());
35+
static NO_OMP_FLAG: Mutex<bool> = Mutex::new(false);
3536

3637
#[tauri::command]
3738
async fn get_uri_scheme_value() -> String {
@@ -95,6 +96,12 @@ async fn handle_cli_args() -> Result<()> {
9596
Ok(args) => {
9697
args.validate()?;
9798

99+
if args.no_omp {
100+
if let Ok(mut flag) = NO_OMP_FLAG.lock() {
101+
*flag = true;
102+
}
103+
}
104+
98105
if args.help {
99106
CliArgs::print_help_and_exit(&raw_args[0]);
100107
}
@@ -117,13 +124,19 @@ async fn handle_cli_args() -> Result<()> {
117124
OMP_CLIENT_DLL
118125
);
119126

127+
let omp_path = if args.no_omp {
128+
""
129+
} else {
130+
&omp_client_path
131+
};
132+
120133
run_samp(
121134
args.name.as_ref().unwrap(),
122135
args.host.as_ref().unwrap(),
123136
args.port.unwrap(),
124137
gamepath,
125138
&format!("{}/{}", gamepath, SAMP_DLL),
126-
&omp_client_path,
139+
omp_path,
127140
&password,
128141
"",
129142
)

0 commit comments

Comments
 (0)