forked from akanyan/STARTLINER
fix: display has to be sequential after all
This commit is contained in:
4
.gitignore
vendored
4
.gitignore
vendored
@ -20,4 +20,8 @@ dist-ssr
|
||||
*.sln
|
||||
*.sw?
|
||||
|
||||
*.png
|
||||
*.bat
|
||||
*.exe
|
||||
|
||||
tsconfig.tsbuildinfo
|
BIN
rust/icons/ongeki.ico
Normal file
BIN
rust/icons/ongeki.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 87 KiB |
@ -24,7 +24,7 @@ pub async fn startline(app: AppHandle) -> Result<(), String> {
|
||||
}
|
||||
if let Some(p) = &mut appd.profile {
|
||||
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))?;
|
||||
p.start(app.clone()).await
|
||||
.map_err(|e| format!("Startup failed:\n{}", e))?;
|
||||
|
@ -20,23 +20,18 @@ impl Default for DisplayInfo {
|
||||
}
|
||||
|
||||
impl Display {
|
||||
pub fn activate(&self, app: AppHandle) {
|
||||
let display = self.clone();
|
||||
pub fn wait_for_exit(app: AppHandle, info: DisplayInfo) {
|
||||
log::debug!("display: waiting");
|
||||
tauri::async_runtime::spawn(async move {
|
||||
let info = display.line_up()?;
|
||||
if let Some(info) = info {
|
||||
app.listen("launch-end", move |_| {
|
||||
if let Err(e) = Self::clean_up(&info) {
|
||||
log::error!("Error cleaning up display: {:?}", e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Ok::<(), anyhow::Error>(())
|
||||
app.listen("launch-end", move |_| {
|
||||
if let Err(e) = Self::clean_up(&info) {
|
||||
log::error!("error cleaning up display: {:?}", e);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
fn line_up(&self) -> Result<Option<DisplayInfo>> {
|
||||
pub fn line_up(&self) -> Result<Option<DisplayInfo>> {
|
||||
use anyhow::anyhow;
|
||||
use displayz::{query_displays, Orientation, Resolution, Frequency};
|
||||
|
||||
@ -101,7 +96,7 @@ impl Display {
|
||||
Ok(Some(res))
|
||||
}
|
||||
|
||||
fn clean_up(info: &DisplayInfo) -> Result<()> {
|
||||
pub fn clean_up(info: &DisplayInfo) -> Result<()> {
|
||||
use anyhow::anyhow;
|
||||
|
||||
let display_set = info.set.as_ref()
|
||||
|
@ -3,7 +3,7 @@ use ongeki::OngekiProfile;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use tauri::AppHandle;
|
||||
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;
|
||||
|
||||
@ -70,7 +70,28 @@ impl AnyProfile {
|
||||
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 {
|
||||
Self::OngekiProfile(p) => {
|
||||
if !p.data_dir().exists() {
|
||||
@ -80,9 +101,6 @@ impl AnyProfile {
|
||||
let hash_path = p.data_dir().join(".sl-state");
|
||||
let meta = self.meta();
|
||||
|
||||
#[cfg(target_os = "windows")]
|
||||
p.display.activate(_app.clone());
|
||||
|
||||
util::clean_up_opts(p.data_dir().join("option"))?;
|
||||
|
||||
if Self::hash_check(&hash_path, &pkg_hash).await? == true {
|
||||
|
@ -26,12 +26,12 @@ const displayList: Ref<{ title: string; value: string }[]> = ref([
|
||||
},
|
||||
]);
|
||||
|
||||
const hookList: Ref<{ title: string; value: string }[]> = ref([
|
||||
{
|
||||
title: 'segatools-mu3hook',
|
||||
value: 'segatools-mu3hook',
|
||||
},
|
||||
]);
|
||||
// const hookList: Ref<{ title: string; value: string }[]> = ref([
|
||||
// {
|
||||
// title: 'segatools-mu3hook',
|
||||
// value: 'segatools-mu3hook',
|
||||
// },
|
||||
// ]);
|
||||
|
||||
invoke('list_platform_capabilities')
|
||||
.then(async (v: unknown) => {
|
||||
@ -86,14 +86,14 @@ const extraDisplayOptionsDisabled = computed(() => {
|
||||
:callback="(value: string) => (prf.current!.sgt.target = value)"
|
||||
></FilePicker>
|
||||
</OptionRow>
|
||||
<OptionRow title="mu3hook">
|
||||
<!-- <OptionRow title="mu3hook">
|
||||
<Select
|
||||
model-value="segatools-mu3hook"
|
||||
:options="hookList"
|
||||
option-label="title"
|
||||
option-value="value"
|
||||
></Select>
|
||||
</OptionRow>
|
||||
</OptionRow> -->
|
||||
<OptionRow title="amfs">
|
||||
<FilePicker
|
||||
:directory="true"
|
||||
|
Reference in New Issue
Block a user