-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
169 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Generated by Cargo | ||
# will have compiled files and executables | ||
debug/ | ||
target/ | ||
|
||
# These are backup files generated by rustfmt | ||
**/*.rs.bk | ||
|
||
# MSVC Windows builds of rustc generate these, which store debugging information | ||
*.pdb | ||
|
||
.idea |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
[package] | ||
name = "farcry_vr" | ||
version = "1.0.0" | ||
edition = "2021" | ||
description = "A launcher for Far Cry VR" | ||
|
||
[[bin]] | ||
name = "FarCryVR" | ||
path = "src/main.rs" | ||
|
||
[dependencies.windows] | ||
version = "0.48" | ||
features = [ | ||
"Win32_Foundation", | ||
"Win32_System_LibraryLoader", | ||
] | ||
|
||
[target.'cfg(windows)'.build-dependencies] | ||
winres = "0.1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#![windows_subsystem = "windows"] | ||
extern crate windows; | ||
|
||
use std::env; | ||
use std::path::Path; | ||
use std::process::Command; | ||
use windows::core::HSTRING; | ||
use windows::Win32::System::LibraryLoader::SetDllDirectoryW; | ||
|
||
fn main() { | ||
let exe_path = env::current_exe().expect("Failed to determine path"); | ||
let install_dir = exe_path.parent().unwrap_or(Path::new(".")); | ||
let farcry_exe_path = install_dir.join("Bin32").join("FarCry.exe"); | ||
let mod_exe_path = install_dir.join("Mods").join("CryVR").join("Bin32"); | ||
|
||
let pass_on_args: Vec<String> = env::args().skip(1).collect(); | ||
|
||
let args = vec![ | ||
"-MOD:CryVR", | ||
"-DEVMODE", | ||
]; | ||
|
||
unsafe { | ||
SetDllDirectoryW(&HSTRING::from(mod_exe_path.as_os_str())); | ||
} | ||
|
||
Command::new(farcry_exe_path) | ||
.args(pass_on_args) | ||
.args(&args) | ||
.env("DXVK_ASYNC", "0") | ||
.env("DXVK_GPLASYNCCACHE", "0") | ||
.current_dir(install_dir.join("Bin32")) | ||
.spawn() | ||
.expect("Failed to launch Far Cry") | ||
.wait() | ||
.expect("Failed to run Far Cry"); | ||
} |