diff --git a/rust/src/cmd.rs b/rust/src/cmd.rs index 4b2ee5d..669b0e6 100644 --- a/rust/src/cmd.rs +++ b/rust/src/cmd.rs @@ -231,7 +231,7 @@ pub async fn set_cfg( key: String, value: serde_json::Value ) -> Result<(), ()> { - log::debug!("invoke: sync_cfg({}, {})", key, value); + log::debug!("invoke: set_cfg({}, {})", key, value); let mut appd = state.lock().await; if let Some(p) = &mut appd.profile { diff --git a/rust/src/display.rs b/rust/src/display.rs index e095358..3184912 100644 --- a/rust/src/display.rs +++ b/rust/src/display.rs @@ -1,5 +1,5 @@ use crate::profile::Profile; -use anyhow::{Result, anyhow}; +use anyhow::Result; #[cfg(target_os = "windows")] pub struct DisplayInfo { @@ -8,13 +8,15 @@ pub struct DisplayInfo { target_settings: displayz::DisplaySettings } +#[allow(dead_code)] #[cfg(not(target_os = "windows"))] -pub async fn prepare_display(p: &Profile) -> Result<()> { +pub async fn prepare_display(_: &Profile) -> Result<()> { Ok(()) } #[cfg(target_os = "windows")] pub async fn prepare_display(p: &Profile) -> Result> { + use anyhow::anyhow; use displayz::{query_displays, Orientation, Resolution}; let display_name = p.get_str("display", "default"); diff --git a/rust/src/start.rs b/rust/src/start.rs index 7136a4e..0da0cca 100644 --- a/rust/src/start.rs +++ b/rust/src/start.rs @@ -3,7 +3,6 @@ use std::fs::File; use tokio::process::Command; use tauri::{AppHandle, Emitter}; use std::process::Stdio; -use crate::display::{prepare_display, undo_display}; use crate::profile::Profile; use crate::util; @@ -20,15 +19,13 @@ pub async fn start(p: &Profile, app: AppHandle) -> Result<()> { let mut game_builder; let mut amd_builder; - #[allow(unused_variables)] - let display_info; + #[cfg(target_os = "windows")] + let display_info = crate::display::prepare_display(p).await?; #[cfg(target_os = "windows")] { game_builder = Command::new(p.data.exe_dir.join("inject.exe")); amd_builder = Command::new("cmd.exe"); - - display_info = prepare_display(p).await?; } #[cfg(target_os = "linux")] { @@ -59,6 +56,10 @@ pub async fn start(p: &Profile, app: AppHandle) -> Result<()> { "SEGATOOLS_CONFIG_PATH", ini_path, ) + .env( + "INOHARA_CONFIG_PATH", + p.dir().join("inohara.cfg"), + ) .current_dir(&p.data.exe_dir) .args([ "-d", "-k", "mu3hook.dll", @@ -143,7 +144,7 @@ pub async fn start(p: &Profile, app: AppHandle) -> Result<()> { #[cfg(target_os = "windows")] { if let Some(display_info) = display_info { - if let Err(e) = undo_display(display_info).await { + if let Err(e) = crate::display::undo_display(display_info).await { log::error!("undo display failed: {}", e); } }