mirror of
https://github.com/Grasscutters/Cultivation.git
synced 2025-12-13 23:54:48 +01:00
write game path to migoto config autmatically
This commit is contained in:
41
src-tauri/Cargo.lock
generated
41
src-tauri/Cargo.lock
generated
@@ -26,6 +26,17 @@ dependencies = [
|
|||||||
"opaque-debug",
|
"opaque-debug",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "ahash"
|
||||||
|
version = "0.7.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47"
|
||||||
|
dependencies = [
|
||||||
|
"getrandom 0.2.7",
|
||||||
|
"once_cell",
|
||||||
|
"version_check",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "aho-corasick"
|
name = "aho-corasick"
|
||||||
version = "0.7.18"
|
version = "0.7.18"
|
||||||
@@ -725,6 +736,7 @@ dependencies = [
|
|||||||
"regex",
|
"regex",
|
||||||
"registry",
|
"registry",
|
||||||
"reqwest",
|
"reqwest",
|
||||||
|
"rust-ini",
|
||||||
"rustls-pemfile",
|
"rustls-pemfile",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
@@ -888,6 +900,12 @@ dependencies = [
|
|||||||
"syn",
|
"syn",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "dlv-list"
|
||||||
|
version = "0.3.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "0688c2a7f92e427f44895cd63841bff7b29f8d7a1648b9e7e07a4a365b2e1257"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "dtoa"
|
name = "dtoa"
|
||||||
version = "0.4.8"
|
version = "0.4.8"
|
||||||
@@ -1481,6 +1499,9 @@ name = "hashbrown"
|
|||||||
version = "0.12.3"
|
version = "0.12.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
|
checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
|
||||||
|
dependencies = [
|
||||||
|
"ahash",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "heck"
|
name = "heck"
|
||||||
@@ -2451,6 +2472,16 @@ dependencies = [
|
|||||||
"vcpkg",
|
"vcpkg",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "ordered-multimap"
|
||||||
|
version = "0.4.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ccd746e37177e1711c20dd619a1620f34f5c8b569c53590a72dedd5344d8924a"
|
||||||
|
dependencies = [
|
||||||
|
"dlv-list",
|
||||||
|
"hashbrown",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "os_info"
|
name = "os_info"
|
||||||
version = "3.4.0"
|
version = "3.4.0"
|
||||||
@@ -3223,6 +3254,16 @@ dependencies = [
|
|||||||
"winapi",
|
"winapi",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rust-ini"
|
||||||
|
version = "0.18.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "f6d5f2436026b4f6e79dc829837d467cc7e9a55ee40e750d716713540715a2df"
|
||||||
|
dependencies = [
|
||||||
|
"cfg-if 1.0.0",
|
||||||
|
"ordered-multimap",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rustc-serialize"
|
name = "rustc-serialize"
|
||||||
version = "0.3.24"
|
version = "0.3.24"
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ regex = "1"
|
|||||||
|
|
||||||
# other
|
# other
|
||||||
file_diff = "1.0.0"
|
file_diff = "1.0.0"
|
||||||
|
rust-ini = "0.18.0"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
# by default Tauri runs in production mode
|
# by default Tauri runs in production mode
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ fn main() {
|
|||||||
system_helpers::open_in_browser,
|
system_helpers::open_in_browser,
|
||||||
system_helpers::install_location,
|
system_helpers::install_location,
|
||||||
system_helpers::is_elevated,
|
system_helpers::is_elevated,
|
||||||
|
system_helpers::set_migoto_target,
|
||||||
proxy::set_proxy_addr,
|
proxy::set_proxy_addr,
|
||||||
proxy::generate_ca_files,
|
proxy::generate_ca_files,
|
||||||
unzip::unzip,
|
unzip::unzip,
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
use duct::cmd;
|
use duct::cmd;
|
||||||
|
use ini::Ini;
|
||||||
|
use std::path::PathBuf;
|
||||||
|
|
||||||
#[tauri::command]
|
#[tauri::command]
|
||||||
pub fn run_program(path: String, args: Option<String>) {
|
pub fn run_program(path: String, args: Option<String>) {
|
||||||
@@ -88,6 +90,43 @@ pub fn install_location() -> String {
|
|||||||
return exe_path.to_str().unwrap().to_string();
|
return exe_path.to_str().unwrap().to_string();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[tauri::command]
|
||||||
|
pub fn set_migoto_target(path: String, migoto_path: String) -> bool {
|
||||||
|
let pathbuf = PathBuf::from(path);
|
||||||
|
let mut migoto_pathbuf = PathBuf::from(migoto_path);
|
||||||
|
|
||||||
|
migoto_pathbuf.pop();
|
||||||
|
migoto_pathbuf.push("d3dx.ini");
|
||||||
|
|
||||||
|
let mut conf = match Ini::load_from_file(&migoto_pathbuf) {
|
||||||
|
Ok(c) => {
|
||||||
|
println!("Loaded migoto ini");
|
||||||
|
c
|
||||||
|
}
|
||||||
|
Err(e) => {
|
||||||
|
println!("Error loading migoto config: {}", e);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Set options
|
||||||
|
conf
|
||||||
|
.with_section(Some("Loader"))
|
||||||
|
.set("target", pathbuf.to_str().unwrap());
|
||||||
|
|
||||||
|
// Write file
|
||||||
|
match conf.write_to_file(&migoto_pathbuf) {
|
||||||
|
Ok(_) => {
|
||||||
|
println!("Wrote config!");
|
||||||
|
true
|
||||||
|
}
|
||||||
|
Err(e) => {
|
||||||
|
println!("Error writing config: {}", e);
|
||||||
|
false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
#[tauri::command]
|
#[tauri::command]
|
||||||
pub fn is_elevated() -> bool {
|
pub fn is_elevated() -> bool {
|
||||||
|
|||||||
@@ -151,6 +151,12 @@ export default class Options extends React.Component<IProps, IState> {
|
|||||||
this.setState({
|
this.setState({
|
||||||
migoto_path: value,
|
migoto_path: value,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// Set game exe in Migoto ini
|
||||||
|
invoke('set_migoto_target', {
|
||||||
|
path: this.state.game_install_path,
|
||||||
|
migotoPath: value,
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
setReshade(value: string) {
|
setReshade(value: string) {
|
||||||
|
|||||||
Reference in New Issue
Block a user