feat: more options
This commit is contained in:
@ -4,8 +4,10 @@ import InputNumber from 'primevue/inputnumber';
|
||||
import InputText from 'primevue/inputtext';
|
||||
import Select from 'primevue/select';
|
||||
import SelectButton from 'primevue/selectbutton';
|
||||
import Toggle from 'primevue/toggleswitch';
|
||||
import ToggleSwitch from 'primevue/toggleswitch';
|
||||
import { invoke as unproxied_invoke } from '@tauri-apps/api/core';
|
||||
import FileEditor from './FileEditor.vue';
|
||||
import FilePicker from './FilePicker.vue';
|
||||
import OptionCategory from './OptionCategory.vue';
|
||||
import OptionRow from './OptionRow.vue';
|
||||
import { invoke } from '../invoke';
|
||||
@ -13,37 +15,9 @@ import { usePrfStore } from '../stores';
|
||||
|
||||
const prf = usePrfStore();
|
||||
|
||||
const _cfg = <T extends string | number | boolean>(key: string, dflt: T) =>
|
||||
computed({
|
||||
get() {
|
||||
return (prf.cfg(key) as T) ?? dflt;
|
||||
},
|
||||
async set(value) {
|
||||
await prf.setCfg(key, value ?? dflt);
|
||||
},
|
||||
});
|
||||
|
||||
const cfgIntel = _cfg('intel', false);
|
||||
const cfgRezW = _cfg('rez-w', 1080);
|
||||
const cfgRezH = _cfg('rez-h', 1920);
|
||||
const cfgDisplayMode = _cfg('display-mode', 'borderless');
|
||||
const displayModeList = [
|
||||
{ title: 'Window', value: 'window' },
|
||||
{ title: 'Borderless window', value: 'borderless' },
|
||||
{ title: 'Fullscreen', value: 'fullscreen' },
|
||||
];
|
||||
const cfgDisplay = _cfg('display', 'default');
|
||||
const cfgDisplayRotation = _cfg('display-rotation', 0);
|
||||
const displayRotationList = [
|
||||
{ title: 'Unchanged', value: 0 },
|
||||
{ title: 'Portrait', value: 90 },
|
||||
{ title: 'Portrait (flipped)', value: 270 },
|
||||
];
|
||||
const cfgBorderlessFullscreen = _cfg('borderless-fullscreen', false);
|
||||
|
||||
const cfgAime = _cfg('aime', false);
|
||||
const aimeCode = ref('');
|
||||
const capabilities: Ref<string[]> = ref([]);
|
||||
|
||||
const displayList: Ref<{ title: string; value: string }[]> = ref([
|
||||
{
|
||||
title: 'Primary',
|
||||
@ -51,6 +25,13 @@ const displayList: Ref<{ title: string; value: string }[]> = ref([
|
||||
},
|
||||
]);
|
||||
|
||||
const hookList: Ref<{ title: string; value: string }[]> = ref([
|
||||
{
|
||||
title: 'segatools-mu3hook',
|
||||
value: 'segatools-mu3hook',
|
||||
},
|
||||
]);
|
||||
|
||||
unproxied_invoke('read_profile_data', {
|
||||
path: 'aime.txt',
|
||||
})
|
||||
@ -101,13 +82,54 @@ const aimeCodeModel = computed({
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<OptionCategory title="Display options">
|
||||
<OptionCategory title="General">
|
||||
<!-- <OptionRow title="mu3.exe">
|
||||
<FilePicker
|
||||
field="game-dir"
|
||||
default=""
|
||||
:directory="false"
|
||||
promptname="mu3.exe"
|
||||
extension="exe"
|
||||
></FilePicker>
|
||||
</OptionRow> -->
|
||||
<OptionRow title="mu3hook">
|
||||
<Select
|
||||
:model-value="prf.cfg('hook', 'segatools-mu3hook')"
|
||||
:options="hookList"
|
||||
option-label="title"
|
||||
option-value="value"
|
||||
></Select>
|
||||
</OptionRow>
|
||||
<OptionRow title="amfs">
|
||||
<FilePicker
|
||||
field="amfs"
|
||||
default=""
|
||||
placeholder="amfs"
|
||||
:directory="true"
|
||||
></FilePicker>
|
||||
</OptionRow>
|
||||
<OptionRow title="option">
|
||||
<FilePicker
|
||||
field="option"
|
||||
default="option"
|
||||
:directory="true"
|
||||
></FilePicker>
|
||||
</OptionRow>
|
||||
<OptionRow title="appdata">
|
||||
<FilePicker
|
||||
field="appdata"
|
||||
default="appdata"
|
||||
:directory="true"
|
||||
></FilePicker>
|
||||
</OptionRow>
|
||||
</OptionCategory>
|
||||
<OptionCategory title="Display">
|
||||
<OptionRow
|
||||
v-if="capabilities.includes('display')"
|
||||
title="Target display"
|
||||
>
|
||||
<Select
|
||||
v-model="cfgDisplay"
|
||||
:model-value="prf.cfg('display', 'default')"
|
||||
:options="displayList"
|
||||
option-label="title"
|
||||
option-value="value"
|
||||
@ -120,7 +142,10 @@ const aimeCodeModel = computed({
|
||||
:min="480"
|
||||
:max="9999"
|
||||
:use-grouping="false"
|
||||
v-model="cfgRezW"
|
||||
:model-value="
|
||||
// prettier-ignore Because primevue fucked up
|
||||
prf.cfg('rez-w', 1080) as any
|
||||
"
|
||||
/>
|
||||
x
|
||||
<InputNumber
|
||||
@ -129,13 +154,20 @@ const aimeCodeModel = computed({
|
||||
:min="640"
|
||||
:max="9999"
|
||||
:use-grouping="false"
|
||||
v-model="cfgRezH"
|
||||
:model-value="
|
||||
// prettier-ignore
|
||||
prf.cfg('rez-h', 1920) as any
|
||||
"
|
||||
/>
|
||||
</OptionRow>
|
||||
<OptionRow title="Display mode">
|
||||
<SelectButton
|
||||
v-model="cfgDisplayMode"
|
||||
:options="displayModeList"
|
||||
:model-value="prf.cfg('display-mode', 'borderless')"
|
||||
:options="[
|
||||
{ title: 'Window', value: 'window' },
|
||||
{ title: 'Borderless window', value: 'borderless' },
|
||||
{ title: 'Fullscreen', value: 'fullscreen' },
|
||||
]"
|
||||
option-label="title"
|
||||
option-value="value"
|
||||
/>
|
||||
@ -145,42 +177,96 @@ const aimeCodeModel = computed({
|
||||
v-if="capabilities.includes('display')"
|
||||
>
|
||||
<SelectButton
|
||||
v-model="cfgDisplayRotation"
|
||||
:options="displayRotationList"
|
||||
:model-value="prf.cfg('display-rotation', 0)"
|
||||
:options="[
|
||||
{ title: 'Unchanged', value: 0 },
|
||||
{ title: 'Portrait', value: 90 },
|
||||
{ title: 'Portrait (flipped)', value: 270 },
|
||||
]"
|
||||
option-label="title"
|
||||
option-value="value"
|
||||
:disabled="cfgDisplay === 'default'"
|
||||
:disabled="prf.cfg('display', 'default').value === 'default'"
|
||||
/>
|
||||
</OptionRow>
|
||||
<OptionRow
|
||||
title="Match display resolution with the game"
|
||||
v-if="capabilities.includes('display')"
|
||||
>
|
||||
<Toggle
|
||||
<!-- @vue-expect-error -->
|
||||
<ToggleSwitch
|
||||
:disabled="
|
||||
cfgDisplay === 'default' || cfgDisplayMode != 'borderless'
|
||||
prf.cfg('display', 'default').value === 'default' ||
|
||||
prf.cfg('display-mode', 'borderless').value != 'borderless'
|
||||
"
|
||||
:model-value="prf.cfg('borderless-fullscreen', false)"
|
||||
/>
|
||||
</OptionRow>
|
||||
</OptionCategory>
|
||||
<OptionCategory title="Network">
|
||||
<OptionRow title="Server address">
|
||||
<InputText
|
||||
class="shrink"
|
||||
size="small"
|
||||
:maxlength="40"
|
||||
placeholder="192.168.1.234"
|
||||
:model-value="
|
||||
// prettier-ignore
|
||||
prf.cfg<string>('dns-default', '') as any
|
||||
"
|
||||
/> </OptionRow
|
||||
><OptionRow title="Keychip">
|
||||
<InputText
|
||||
class="shrink"
|
||||
size="small"
|
||||
:maxlength="16"
|
||||
placeholder="A123-01234567890"
|
||||
:model-value="
|
||||
// prettier-ignore
|
||||
prf.cfg('keychip', '') as any
|
||||
"
|
||||
/> </OptionRow
|
||||
><OptionRow title="Subnet">
|
||||
<InputText
|
||||
class="shrink"
|
||||
size="small"
|
||||
:maxlength="15"
|
||||
placeholder="192.168.1.0"
|
||||
:model-value="
|
||||
// prettier-ignore
|
||||
prf.cfg('subnet', '') as any
|
||||
"
|
||||
v-model="cfgBorderlessFullscreen"
|
||||
/>
|
||||
</OptionRow>
|
||||
</OptionCategory>
|
||||
<OptionCategory title="Misc">
|
||||
<OptionRow title="OpenSSL bug workaround for Intel ≥10th gen">
|
||||
<Toggle v-model="cfgIntel" />
|
||||
<!-- @vue-expect-error -->
|
||||
<ToggleSwitch :model-value="prf.cfg('intel', false)" />
|
||||
</OptionRow>
|
||||
<OptionRow title="Aime emulation">
|
||||
<Toggle v-model="cfgAime" />
|
||||
<!-- @vue-expect-error -->
|
||||
<ToggleSwitch :model-value="prf.cfg('aime', false)" />
|
||||
</OptionRow>
|
||||
<OptionRow title="Aime code">
|
||||
<InputText
|
||||
class="shrink"
|
||||
size="small"
|
||||
:disabled="prf.cfg('aime') !== true"
|
||||
:disabled="prf.cfg<boolean>('aime', false).value !== true"
|
||||
:maxlength="20"
|
||||
placeholder="00000000000000000000"
|
||||
v-model="aimeCodeModel"
|
||||
/>
|
||||
</OptionRow>
|
||||
<OptionRow title="More segatools options">
|
||||
<FileEditor filename="segatools-base.ini" />
|
||||
</OptionRow>
|
||||
<OptionRow title="Inohara config">
|
||||
<FileEditor
|
||||
filename="inohara.cfg"
|
||||
promptname="inohara config file"
|
||||
extension="cfg"
|
||||
/>
|
||||
</OptionRow>
|
||||
</OptionCategory>
|
||||
</template>
|
||||
|
||||
|
Reference in New Issue
Block a user