forked from akanyan/STARTLINER
fix: begin fixing linux support
This commit is contained in:
@ -75,6 +75,7 @@ pub async fn startline(app: AppHandle, refresh: bool) -> Result<(), String> {
|
||||
&p.data.sgt.target.parent().unwrap().join("amdaemon.exe")
|
||||
).map_err(|e| e.to_string())?;
|
||||
|
||||
#[cfg(target_os = "windows")]
|
||||
let info = p.prepare_display()
|
||||
.map_err(|e| e.to_string())?;
|
||||
let lineup_res = p.line_up(hash, refresh, patches_enabled).await
|
||||
@ -408,10 +409,14 @@ pub async fn load_segatools_ini(state: State<'_, Mutex<AppData>>, path: PathBuf)
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn create_shortcut(app: AppHandle, profile_meta: ProfileMeta) -> Result<(), String> {
|
||||
pub async fn create_shortcut(_app: AppHandle, profile_meta: ProfileMeta) -> Result<(), String> {
|
||||
log::debug!("invoke: create_shortcut({:?})", profile_meta);
|
||||
|
||||
util::create_shortcut(app, &profile_meta).map_err(|e| e.to_string())
|
||||
#[cfg(target_os = "windows")]
|
||||
return util::create_shortcut(_app, &profile_meta).map_err(|e| e.to_string());
|
||||
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
return Err("unsupported".to_owned());
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
@ -466,7 +471,7 @@ pub async fn list_platform_capabilities() -> Result<Vec<String>, ()> {
|
||||
log::debug!("invoke: list_platform_capabilities");
|
||||
|
||||
#[cfg(target_os = "windows")]
|
||||
return Ok(vec!["display".to_owned()]);
|
||||
return Ok(vec!["display".to_owned(), "shortcut".to_owned(), "chunithm".to_owned()]);
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
return Ok(vec!["wine".to_owned()]);
|
||||
|
@ -108,7 +108,10 @@ impl Display {
|
||||
Game::Ongeki => 60,
|
||||
},
|
||||
borderless_fullscreen: true,
|
||||
#[cfg(target_os = "windows")]
|
||||
dont_switch_primary: false,
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
dont_switch_primary: true,
|
||||
monitor_index_override: None,
|
||||
}
|
||||
}
|
||||
@ -141,7 +144,7 @@ pub struct BepInEx {
|
||||
pub console: bool,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize, Clone)]
|
||||
#[derive(Deserialize, Serialize, Clone, Debug)]
|
||||
#[serde(default)]
|
||||
pub struct Wine {
|
||||
pub runtime: PathBuf,
|
||||
|
8
rust/src/modules/display_linux.rs
Normal file
8
rust/src/modules/display_linux.rs
Normal file
@ -0,0 +1,8 @@
|
||||
use ini::Ini;
|
||||
use crate::model::{misc::Game, profile::Display};
|
||||
|
||||
impl Display {
|
||||
pub fn line_up(&self, _game: Game, _ini: &mut Ini) {
|
||||
// nop
|
||||
}
|
||||
}
|
@ -7,4 +7,7 @@ pub mod keyboard;
|
||||
pub mod mempatcher;
|
||||
|
||||
#[cfg(target_os = "windows")]
|
||||
pub mod display_windows;
|
||||
pub mod display_windows;
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
pub mod display_linux;
|
@ -1,6 +1,6 @@
|
||||
pub use types::{Profile, ProfileData, ProfileMeta, ProfilePaths, StartPayload};
|
||||
use std::{collections::{BTreeMap, BTreeSet}, path::{Path, PathBuf}};
|
||||
use crate::{model::{misc::Game, patch::{PatchList, PatchSelection}, profile::{Aime, ChunithmKeyboard, IOSelection, Keyboard, Mu3Ini, OngekiKeyboard, ProfileModule}}, modules::{display_windows::DisplayInfo, package::prepare_packages}, pkg::PkgKey, pkg_store::PackageStore, util};
|
||||
use crate::{model::{misc::Game, patch::{PatchList, PatchSelection}, profile::{Aime, ChunithmKeyboard, IOSelection, Keyboard, Mu3Ini, OngekiKeyboard, ProfileModule}}, modules::package::prepare_packages, pkg::PkgKey, pkg_store::PackageStore, util};
|
||||
use tauri::Emitter;
|
||||
use std::process::Stdio;
|
||||
use crate::model::profile::BepInEx;
|
||||
@ -10,9 +10,23 @@ use std::fs::File;
|
||||
use tokio::process::Command;
|
||||
use tokio::task::JoinSet;
|
||||
|
||||
#[cfg(target_os = "windows")]
|
||||
use crate::modules::display_windows::DisplayInfo;
|
||||
|
||||
pub mod template;
|
||||
pub mod types;
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
pub trait RawArg {
|
||||
fn raw_arg<S: AsRef<std::ffi::OsStr>>(&mut self, arg: S) -> &mut Command;
|
||||
}
|
||||
#[cfg(target_os = "linux")]
|
||||
impl RawArg for Command {
|
||||
fn raw_arg<S: AsRef<std::ffi::OsStr>>(&mut self, arg: S) -> &mut Command {
|
||||
return self.arg::<S>(arg);
|
||||
}
|
||||
}
|
||||
|
||||
impl Profile {
|
||||
pub fn new(mut meta: ProfileMeta) -> Result<Self> {
|
||||
meta.name = fixed_name(&meta, true);
|
||||
@ -176,6 +190,7 @@ impl Profile {
|
||||
self.data.patches = source.patches;
|
||||
}
|
||||
}
|
||||
#[cfg(target_os = "windows")]
|
||||
pub fn prepare_display(&self) -> Result<Option<DisplayInfo>> {
|
||||
let info = match &self.data.display {
|
||||
None => None,
|
||||
@ -252,8 +267,8 @@ impl Profile {
|
||||
}
|
||||
#[cfg(target_os = "linux")]
|
||||
{
|
||||
game_builder = Command::new(&self.wine.runtime);
|
||||
amd_builder = Command::new(&self.wine.runtime);
|
||||
game_builder = Command::new(&self.data.wine.runtime);
|
||||
amd_builder = Command::new(&self.data.wine.runtime);
|
||||
|
||||
game_builder.arg(sgt_dir.join(self.meta.game.inject_exe()));
|
||||
amd_builder.arg("cmd.exe");
|
||||
@ -349,8 +364,8 @@ impl Profile {
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
{
|
||||
amd_builder.env("WINEPREFIX", &self.wine.prefix);
|
||||
game_builder.env("WINEPREFIX", &self.wine.prefix);
|
||||
amd_builder.env("WINEPREFIX", &self.data.wine.prefix);
|
||||
game_builder.env("WINEPREFIX", &self.data.wine.prefix);
|
||||
}
|
||||
|
||||
let amd_log = File::create(self.data_dir().join("amdaemon.exe.log"))?;
|
||||
|
@ -152,6 +152,7 @@ impl PathStr for PathBuf {
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn bool_to_01(val: bool) -> &'static str {
|
||||
return if val { "1" } else { "0" }
|
||||
}
|
||||
|
@ -27,7 +27,6 @@ import {
|
||||
usePkgStore,
|
||||
usePrfStore,
|
||||
} from '../stores';
|
||||
import { Dirs } from '../types';
|
||||
import { messageSplit, shouldPreferDark } from '../util';
|
||||
|
||||
document.documentElement.classList.toggle('use-dark-mode', shouldPreferDark());
|
||||
|
@ -18,10 +18,17 @@ const prf = usePrfStore();
|
||||
const client = useClientStore();
|
||||
const general = useGeneralStore();
|
||||
|
||||
const hasChunithm = ref(false);
|
||||
const exportVisible = ref(false);
|
||||
const exportKeychip = ref(false);
|
||||
const files = new Set<string>();
|
||||
|
||||
(async () => {
|
||||
hasChunithm.value = (
|
||||
(await invoke('list_platform_capabilities')) as string[]
|
||||
).includes('chunithm');
|
||||
})();
|
||||
|
||||
const exportTemplate = async () => {
|
||||
const fl = [...files.values()];
|
||||
exportVisible.value = false;
|
||||
@ -134,6 +141,7 @@ const importPick = async () => {
|
||||
@click="() => prf.create('ongeki')"
|
||||
/>
|
||||
<Button
|
||||
v-if="hasChunithm"
|
||||
:label="t('profile.create', { game: t('game.chunithm') })"
|
||||
icon="pi pi-file-plus"
|
||||
class="chunithm-button profile-button"
|
||||
|
@ -99,18 +99,21 @@ const createShortcut = async () => {
|
||||
}
|
||||
};
|
||||
|
||||
const hasShortcut = ref(false);
|
||||
|
||||
(async () => {
|
||||
hasShortcut.value = (
|
||||
(await invoke('list_platform_capabilities')) as string[]
|
||||
).includes('shortcut');
|
||||
})();
|
||||
|
||||
const menuItems = computed(() => {
|
||||
const base = [
|
||||
let base = [
|
||||
{
|
||||
label: t('start.button.unchecked'),
|
||||
icon: 'pi pi-exclamation-circle',
|
||||
command: async () => await startline(true, false),
|
||||
},
|
||||
{
|
||||
label: t('start.button.shortcut'),
|
||||
icon: 'pi pi-link',
|
||||
command: createShortcut,
|
||||
},
|
||||
{
|
||||
label: t('start.button.help'),
|
||||
icon: 'pi pi-question-circle',
|
||||
@ -123,6 +126,16 @@ const menuItems = computed(() => {
|
||||
if (prf.current === null) {
|
||||
return [];
|
||||
}
|
||||
if (hasShortcut.value === true) {
|
||||
base = [
|
||||
...base,
|
||||
{
|
||||
label: t('start.button.shortcut'),
|
||||
icon: 'pi pi-link',
|
||||
command: createShortcut,
|
||||
},
|
||||
];
|
||||
}
|
||||
if (prf.current.meta.game === 'chunithm') {
|
||||
return base;
|
||||
}
|
||||
@ -181,7 +194,9 @@ const tryStart = () => {
|
||||
}
|
||||
"
|
||||
/>
|
||||
<ContextMenu ref="menu" :model="menuItems" />
|
||||
<Lazy>
|
||||
<ContextMenu ref="menu" :model="menuItems" />
|
||||
</Lazy>
|
||||
<Button
|
||||
v-if="startStatus === 'ready'"
|
||||
v-tooltip="disabledTooltip"
|
||||
|
@ -199,16 +199,19 @@ const canSkipPrimarySwitch = computed(
|
||||
<OptionRow
|
||||
:title="t('cfg.display.dontSwitchPrimary')"
|
||||
v-if="
|
||||
capabilities.includes('display') &&
|
||||
prf.current?.data.display.target !== 'default' &&
|
||||
(prf.current!.data.display.dont_switch_primary ||
|
||||
displayList.length > 2) &&
|
||||
canSkipPrimarySwitch
|
||||
!capabilities.includes('display') ||
|
||||
(prf.current?.data.display.target !== 'default' &&
|
||||
(prf.current!.data.display.dont_switch_primary ||
|
||||
displayList.length > 2) &&
|
||||
canSkipPrimarySwitch)
|
||||
"
|
||||
:dangerous-tooltip="t('cfg.display.dontSwitchPrimaryTooltip')"
|
||||
>
|
||||
<ToggleSwitch
|
||||
:disabled="extraDisplayOptionsDisabled"
|
||||
:disabled="
|
||||
extraDisplayOptionsDisabled &&
|
||||
capabilities.includes('display')
|
||||
"
|
||||
v-model="prf.current!.data.display.dont_switch_primary"
|
||||
/>
|
||||
</OptionRow>
|
||||
@ -216,9 +219,9 @@ const canSkipPrimarySwitch = computed(
|
||||
:title="t('cfg.display.index')"
|
||||
class="number-input"
|
||||
v-if="
|
||||
capabilities.includes('display') &&
|
||||
prf.current?.data.display.target !== 'default' &&
|
||||
prf.current!.data.display.dont_switch_primary
|
||||
!capabilities.includes('display') ||
|
||||
(prf.current?.data.display.target !== 'default' &&
|
||||
prf.current!.data.display.dont_switch_primary)
|
||||
"
|
||||
>
|
||||
<InputNumber
|
||||
@ -227,8 +230,12 @@ const canSkipPrimarySwitch = computed(
|
||||
:min="game === 'chunithm' ? 0 : 1"
|
||||
:max="32"
|
||||
:use-grouping="false"
|
||||
placeholder="1"
|
||||
v-model="prf.current!.data.display.monitor_index_override"
|
||||
:disabled="extraDisplayOptionsDisabled"
|
||||
:disabled="
|
||||
extraDisplayOptionsDisabled &&
|
||||
capabilities.includes('display')
|
||||
"
|
||||
:allow-empty="true"
|
||||
/>
|
||||
</OptionRow>
|
||||
|
@ -1,5 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue';
|
||||
import { Ref, computed, ref } from 'vue';
|
||||
import Select from 'primevue/select';
|
||||
import { useConfirm } from 'primevue/useconfirm';
|
||||
import { emit } from '@tauri-apps/api/event';
|
||||
@ -19,6 +19,14 @@ const prf = usePrfStore();
|
||||
const pkgs = usePkgStore();
|
||||
const confirmDialog = useConfirm();
|
||||
|
||||
const capabilities: Ref<string[]> = ref([]);
|
||||
|
||||
invoke('list_platform_capabilities').then(async (v: unknown) => {
|
||||
if (Array.isArray(v)) {
|
||||
capabilities.value.push(...v);
|
||||
}
|
||||
});
|
||||
|
||||
const names = computed(() => {
|
||||
switch (prf.current?.meta.game) {
|
||||
case 'ongeki': {
|
||||
@ -162,5 +170,29 @@ const checkSegatoolsIni = async (target: string) => {
|
||||
option-value="value"
|
||||
></Select>
|
||||
</OptionRow>
|
||||
<OptionRow
|
||||
v-if="capabilities.includes('wine')"
|
||||
:title="t('cfg.wine.runtime')"
|
||||
>
|
||||
<FilePicker
|
||||
:directory="false"
|
||||
:value="prf.current!.data.wine.runtime"
|
||||
:callback="
|
||||
(value: string) => (prf.current!.data.wine.runtime = value)
|
||||
"
|
||||
></FilePicker>
|
||||
</OptionRow>
|
||||
<OptionRow
|
||||
v-if="capabilities.includes('wine')"
|
||||
:title="t('cfg.wine.prefix')"
|
||||
>
|
||||
<FilePicker
|
||||
:directory="true"
|
||||
:value="prf.current!.data.wine.prefix"
|
||||
:callback="
|
||||
(value: string) => (prf.current!.data.wine.prefix = value)
|
||||
"
|
||||
></FilePicker>
|
||||
</OptionRow>
|
||||
</OptionCategory>
|
||||
</template>
|
||||
|
@ -142,7 +142,10 @@ export default {
|
||||
leverMode: 'Lever mode',
|
||||
mouse: 'Mouse',
|
||||
},
|
||||
|
||||
wine: {
|
||||
prefix: 'Wine prefix',
|
||||
runtime: 'Wine runtime',
|
||||
},
|
||||
startliner: {
|
||||
offlineMode: 'Offline mode',
|
||||
offlineModeTooltip: 'Disables the package store.',
|
||||
|
@ -56,6 +56,7 @@ export interface ProfileData {
|
||||
display: DisplayConfig;
|
||||
network: NetworkConfig;
|
||||
bepinex: BepInExConfig;
|
||||
wine: WineConfig;
|
||||
mu3_ini: Mu3IniConfig | undefined;
|
||||
keyboard: KeyboardConfig | undefined;
|
||||
patches: {
|
||||
@ -105,6 +106,11 @@ export interface BepInExConfig {
|
||||
console: boolean;
|
||||
}
|
||||
|
||||
export interface WineConfig {
|
||||
runtime: string;
|
||||
prefix: string;
|
||||
}
|
||||
|
||||
export interface Mu3IniConfig {
|
||||
audio?: 'Shared' | 'Excl6Ch' | 'Excl2Ch';
|
||||
sample_rate: number;
|
||||
|
Reference in New Issue
Block a user