fix: display has to be sequential after all

This commit is contained in:
2025-03-14 15:18:38 +00:00
parent 62edcdae08
commit b525e74467
6 changed files with 45 additions and 28 deletions

4
.gitignore vendored
View File

@ -20,4 +20,8 @@ dist-ssr
*.sln *.sln
*.sw? *.sw?
*.png
*.bat
*.exe
tsconfig.tsbuildinfo tsconfig.tsbuildinfo

BIN
rust/icons/ongeki.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 87 KiB

View File

@ -24,7 +24,7 @@ pub async fn startline(app: AppHandle) -> Result<(), String> {
} }
if let Some(p) = &mut appd.profile { if let Some(p) = &mut appd.profile {
log::debug!("{}", hash); log::debug!("{}", hash);
p.line_up(app.clone(), hash).await p.line_up(hash, app.clone()).await
.map_err(|e| format!("Lineup failed:\n{}", e))?; .map_err(|e| format!("Lineup failed:\n{}", e))?;
p.start(app.clone()).await p.start(app.clone()).await
.map_err(|e| format!("Startup failed:\n{}", e))?; .map_err(|e| format!("Startup failed:\n{}", e))?;

View File

@ -20,23 +20,18 @@ impl Default for DisplayInfo {
} }
impl Display { impl Display {
pub fn activate(&self, app: AppHandle) { pub fn wait_for_exit(app: AppHandle, info: DisplayInfo) {
let display = self.clone(); log::debug!("display: waiting");
tauri::async_runtime::spawn(async move { tauri::async_runtime::spawn(async move {
let info = display.line_up()?; app.listen("launch-end", move |_| {
if let Some(info) = info { if let Err(e) = Self::clean_up(&info) {
app.listen("launch-end", move |_| { log::error!("error cleaning up display: {:?}", e);
if let Err(e) = Self::clean_up(&info) { }
log::error!("Error cleaning up display: {:?}", e); });
}
});
}
Ok::<(), anyhow::Error>(())
}); });
} }
fn line_up(&self) -> Result<Option<DisplayInfo>> { pub fn line_up(&self) -> Result<Option<DisplayInfo>> {
use anyhow::anyhow; use anyhow::anyhow;
use displayz::{query_displays, Orientation, Resolution, Frequency}; use displayz::{query_displays, Orientation, Resolution, Frequency};
@ -101,7 +96,7 @@ impl Display {
Ok(Some(res)) Ok(Some(res))
} }
fn clean_up(info: &DisplayInfo) -> Result<()> { pub fn clean_up(info: &DisplayInfo) -> Result<()> {
use anyhow::anyhow; use anyhow::anyhow;
let display_set = info.set.as_ref() let display_set = info.set.as_ref()

View File

@ -3,7 +3,7 @@ use ongeki::OngekiProfile;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use tauri::AppHandle; use tauri::AppHandle;
use std::{collections::BTreeSet, path::{Path, PathBuf}}; use std::{collections::BTreeSet, path::{Path, PathBuf}};
use crate::{model::misc::Game, modules::package::prepare_packages, pkg::PkgKey, util}; use crate::{model::{config::Display, misc::Game}, modules::package::prepare_packages, pkg::PkgKey, util};
pub mod ongeki; pub mod ongeki;
@ -70,7 +70,28 @@ impl AnyProfile {
Self::OngekiProfile(p) => &mut p.mods Self::OngekiProfile(p) => &mut p.mods
} }
} }
pub async fn line_up(&self, _app: AppHandle, pkg_hash: String) -> Result<()> { pub async fn line_up(&self, pkg_hash: String, _app: AppHandle) -> Result<()> {
match self {
Self::OngekiProfile(p) => {
#[cfg(target_os = "windows")]
let info = p.display.line_up()?;
let res = self.line_up_the_rest(pkg_hash).await;
#[cfg(target_os = "windows")]
if let Some(info) = info {
if res.is_ok() {
Display::wait_for_exit(_app, info);
} else {
Display::clean_up(&info)?;
}
}
res
}
}
}
async fn line_up_the_rest(&self, pkg_hash: String) -> Result<()> {
match self { match self {
Self::OngekiProfile(p) => { Self::OngekiProfile(p) => {
if !p.data_dir().exists() { if !p.data_dir().exists() {
@ -80,9 +101,6 @@ impl AnyProfile {
let hash_path = p.data_dir().join(".sl-state"); let hash_path = p.data_dir().join(".sl-state");
let meta = self.meta(); let meta = self.meta();
#[cfg(target_os = "windows")]
p.display.activate(_app.clone());
util::clean_up_opts(p.data_dir().join("option"))?; util::clean_up_opts(p.data_dir().join("option"))?;
if Self::hash_check(&hash_path, &pkg_hash).await? == true { if Self::hash_check(&hash_path, &pkg_hash).await? == true {

View File

@ -26,12 +26,12 @@ const displayList: Ref<{ title: string; value: string }[]> = ref([
}, },
]); ]);
const hookList: Ref<{ title: string; value: string }[]> = ref([ // const hookList: Ref<{ title: string; value: string }[]> = ref([
{ // {
title: 'segatools-mu3hook', // title: 'segatools-mu3hook',
value: 'segatools-mu3hook', // value: 'segatools-mu3hook',
}, // },
]); // ]);
invoke('list_platform_capabilities') invoke('list_platform_capabilities')
.then(async (v: unknown) => { .then(async (v: unknown) => {
@ -86,14 +86,14 @@ const extraDisplayOptionsDisabled = computed(() => {
:callback="(value: string) => (prf.current!.sgt.target = value)" :callback="(value: string) => (prf.current!.sgt.target = value)"
></FilePicker> ></FilePicker>
</OptionRow> </OptionRow>
<OptionRow title="mu3hook"> <!-- <OptionRow title="mu3hook">
<Select <Select
model-value="segatools-mu3hook" model-value="segatools-mu3hook"
:options="hookList" :options="hookList"
option-label="title" option-label="title"
option-value="value" option-value="value"
></Select> ></Select>
</OptionRow> </OptionRow> -->
<OptionRow title="amfs"> <OptionRow title="amfs">
<FilePicker <FilePicker
:directory="true" :directory="true"