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