fix: linux build

This commit is contained in:
2025-03-04 15:59:37 +01:00
parent 443467c3ab
commit daafe1856b
3 changed files with 12 additions and 9 deletions

View File

@ -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 {

View File

@ -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<Option<DisplayInfo>> {
use anyhow::anyhow;
use displayz::{query_displays, Orientation, Resolution};
let display_name = p.get_str("display", "default");

View File

@ -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);
}
}