feat: initial chunithm support

This commit is contained in:
2025-03-19 17:39:12 +00:00
parent 1191cdd95c
commit 8ac45df3e1
31 changed files with 1368 additions and 884 deletions

View File

@ -0,0 +1,99 @@
<script setup lang="ts">
import { computed, ref } from 'vue';
import InputText from 'primevue/inputtext';
import Select from 'primevue/select';
import ToggleSwitch from 'primevue/toggleswitch';
import * as path from '@tauri-apps/api/path';
import { readTextFile, writeTextFile } from '@tauri-apps/plugin-fs';
import OptionCategory from '../OptionCategory.vue';
import OptionRow from '../OptionRow.vue';
import { usePkgStore, usePrfStore } from '../../stores';
import { Feature } from '../../types';
import { hasFeature, pkgKey } from '../../util';
const pkgs = usePkgStore();
const prf = usePrfStore();
const aimeCode = ref('');
prf.reload();
const aimeCodeModel = computed({
get() {
return aimeCode.value;
},
async set(value: string) {
aimeCode.value = value;
if (value.match(/^[0-9]{20}$/) || value.length === 0) {
const aime_path = await path.join(await prf.configDir, 'aime.txt');
await writeTextFile(aime_path, aimeCode.value);
}
},
});
(async () => {
const aime_path = await path.join(await prf.configDir, 'aime.txt');
aimeCode.value = await readTextFile(aime_path).catch(() => '');
})();
</script>
<template>
<OptionCategory title="Aime">
<OptionRow title="Aime emulation">
<Select
v-model="prf.current!.data.sgt.aime"
:options="[
{ title: 'none', value: 'Disabled' },
{ title: 'segatools built-in', value: 'BuiltIn' },
...pkgs.byFeature(Feature.Aime).map((p) => {
return {
title: pkgKey(p),
value: hasFeature(p, Feature.AMNet)
? { AMNet: pkgKey(p) }
: { Other: pkgKey(p) },
};
}),
]"
placeholder="none"
option-label="title"
option-value="value"
></Select>
</OptionRow>
<OptionRow title="Aime code">
<InputText
class="shrink"
size="small"
:disabled="prf.current!.data.sgt.aime === 'Disabled'"
:maxlength="20"
placeholder="00000000000000000000"
v-model="aimeCodeModel"
/>
</OptionRow>
<div v-if="prf.current!.data.sgt.aime?.hasOwnProperty('AMNet')">
<OptionRow title="Server name">
<InputText
class="shrink"
size="small"
placeholder="CHUNI-PENGUIN"
:maxlength="50"
v-model="prf.current!.data.sgt.amnet.name"
/>
</OptionRow>
<OptionRow title="Server address">
<InputText
class="shrink"
size="small"
placeholder="http://+:6070"
:maxlength="50"
v-model="prf.current!.data.sgt.amnet.addr"
/>
</OptionRow>
<OptionRow
title="Use AiMeDB for physical cards"
tooltip="Whether physical cards should use AiMeDB to retrieve access codes. If the game is using a hosted network, enable this option to load the same account data/profile as you would get on a physical cab."
>
<ToggleSwitch v-model="prf.current!.data.sgt.amnet.physical" />
</OptionRow>
</div>
</OptionCategory>
</template>

View File

@ -0,0 +1,161 @@
<script setup lang="ts">
import { Ref, computed, ref } from 'vue';
import InputNumber from 'primevue/inputnumber';
import Select from 'primevue/select';
import SelectButton from 'primevue/selectbutton';
import ToggleSwitch from 'primevue/toggleswitch';
import OptionCategory from '../OptionCategory.vue';
import OptionRow from '../OptionRow.vue';
import { invoke } from '../../invoke';
import { usePrfStore } from '../../stores';
const capabilities: Ref<string[]> = ref([]);
const displayList: Ref<{ title: string; value: string }[]> = ref([
{
title: 'Primary',
value: 'default',
},
]);
const prf = usePrfStore();
const extraDisplayOptionsDisabled = computed(() => {
return prf.current?.data.display.target === 'default';
});
const loadDisplays = () => {
const newList = [
{
title: 'Primary',
value: 'default',
},
];
invoke('list_platform_capabilities')
.then(async (v: unknown) => {
let different = false;
if (Array.isArray(v)) {
capabilities.value.push(...v);
}
if (capabilities.value.includes('display')) {
for (const [devName, devString] of (await invoke(
'list_displays'
)) as Array<[string, string]>) {
newList.push({
title: `${devName.replace('\\\\.\\', '')} (${devString})`,
value: devName,
});
if (
displayList.value.find(
(item) => item.value === devName
) === undefined
) {
different = true;
}
}
}
if (displayList.value.length !== newList.length) {
different = true;
}
if (different) {
displayList.value = newList;
}
})
.catch(() => {});
};
loadDisplays();
</script>
<template>
<OptionCategory title="Display">
<OptionRow
v-if="capabilities.includes('display')"
title="Target display"
>
<Select
v-model="prf.current!.data.display.target"
:options="displayList"
option-label="title"
option-value="value"
placeholder="(Disconnected)"
@show="loadDisplays"
></Select>
</OptionRow>
<OptionRow class="number-input" title="Game resolution">
<InputNumber
class="shrink"
size="small"
:min="480"
:max="9999"
:use-grouping="false"
v-model="prf.current!.data.display.rez[0]"
/>
x
<InputNumber
class="shrink"
size="small"
:min="640"
:max="9999"
:use-grouping="false"
v-model="prf.current!.data.display.rez[1]"
/>
</OptionRow>
<OptionRow title="Display mode">
<SelectButton
v-model="prf.current!.data.display.mode"
:options="[
{ title: 'Window', value: 'Window' },
{ title: 'Borderless window', value: 'Borderless' },
{ title: 'Fullscreen', value: 'Fullscreen' },
]"
:allow-empty="false"
option-label="title"
option-value="value"
/>
</OptionRow>
<OptionRow
title="Display rotation"
v-if="capabilities.includes('display')"
>
<SelectButton
v-model="prf.current!.data.display.rotation"
:options="[
{ title: 'Unchanged', value: 0 },
{ title: 'Portrait', value: 90 },
{ title: 'Portrait (flipped)', value: 270 },
]"
:allow-empty="false"
option-label="title"
option-value="value"
:disabled="extraDisplayOptionsDisabled"
/>
</OptionRow>
<OptionRow
v-if="capabilities.includes('display')"
class="number-input"
title="Refresh Rate"
>
<InputNumber
class="shrink"
size="small"
:min="60"
:max="999"
:use-grouping="false"
v-model="prf.current!.data.display.frequency"
:disabled="extraDisplayOptionsDisabled"
/>
</OptionRow>
<OptionRow
title="Borderless fullscreen"
v-if="capabilities.includes('display')"
tooltip="Match display resolution with the game."
>
<ToggleSwitch
:disabled="
extraDisplayOptionsDisabled ||
prf.current?.data.display.mode !== 'Borderless'
"
v-model="prf.current!.data.display.borderless_fullscreen"
/>
</OptionRow>
</OptionCategory>
</template>

View File

@ -0,0 +1,20 @@
<script setup lang="ts">
import ToggleSwitch from 'primevue/toggleswitch';
import FileEditor from '../FileEditor.vue';
import OptionCategory from '../OptionCategory.vue';
import OptionRow from '../OptionRow.vue';
import { usePrfStore } from '../../stores';
const prf = usePrfStore();
</script>
<template>
<OptionCategory title="Misc">
<OptionRow title="OpenSSL bug workaround for Intel ≥10th gen">
<ToggleSwitch v-model="prf.current!.data.sgt.intel" />
</OptionRow>
<OptionRow title="More segatools options">
<FileEditor filename="segatools-base.ini" />
</OptionRow>
</OptionCategory>
</template>

View File

@ -0,0 +1,91 @@
<script setup lang="ts">
import InputNumber from 'primevue/inputnumber';
import InputText from 'primevue/inputtext';
import SelectButton from 'primevue/selectbutton';
import FilePicker from '../FilePicker.vue';
import OptionCategory from '../OptionCategory.vue';
import OptionRow from '../OptionRow.vue';
import { usePrfStore } from '../../stores';
const prf = usePrfStore();
</script>
<template>
<OptionCategory title="Network">
<OptionRow title="Network type">
<SelectButton
v-model="prf.current!.data.network.network_type"
:options="[
{ title: 'Remote', value: 'Remote' },
{ title: 'Local (ARTEMiS)', value: 'Artemis' },
]"
:allow-empty="false"
option-label="title"
option-value="value"
/>
</OptionRow>
<OptionRow
v-if="prf.current!.data.network.network_type == 'Artemis'"
title="ARTEMiS path"
>
<FilePicker
:directory="false"
promptname="index.py"
extension="py"
:value="prf.current!.data.network.local_path"
:callback="
(value: string) =>
(prf.current!.data.network.local_path = value)
"
></FilePicker>
</OptionRow>
<!-- <OptionRow
v-if="prf.current!.data.network.network_type == 'Artemis'"
title="ARTEMiS console"
>
<ToggleSwitch v-model="prf.current!.data.network.local_console" />
</OptionRow> -->
<OptionRow
v-if="prf.current!.data.network.network_type == 'Remote'"
title="Server address"
>
<InputText
class="shrink"
size="small"
:maxlength="40"
placeholder="192.168.1.234"
v-model="prf.current!.data.network.remote_address"
/> </OptionRow
><OptionRow
v-if="prf.current!.data.network.network_type == 'Remote'"
title="Keychip"
>
<InputText
class="shrink"
size="small"
:maxlength="16"
placeholder="A123-01234567890"
v-model="prf.current!.data.network.keychip"
/> </OptionRow
><OptionRow title="Subnet">
<InputText
class="shrink"
size="small"
:maxlength="15"
placeholder="192.168.1.0"
v-model="prf.current!.data.network.subnet"
/>
</OptionRow>
<OptionRow title="Address suffix">
<InputNumber
class="shrink"
size="small"
:maxlength="3"
:min="0"
:max="255"
placeholder="12"
v-model="prf.current!.data.network.suffix"
/>
</OptionRow>
</OptionCategory>
</template>

View File

@ -0,0 +1,112 @@
<script setup lang="ts">
import { computed } from 'vue';
import Select from 'primevue/select';
import FilePicker from '../FilePicker.vue';
import OptionCategory from '../OptionCategory.vue';
import OptionRow from '../OptionRow.vue';
import { usePkgStore, usePrfStore } from '../../stores';
import { Feature } from '../../types';
import { pkgKey } from '../../util';
const prf = usePrfStore();
const pkgs = usePkgStore();
const names = computed(() => {
switch (prf.current?.meta.game) {
case 'ongeki': {
return {
exe: 'mu3.exe',
hook: 'mu3hook',
io: 'mu3io',
};
}
case 'chunithm': {
return {
exe: 'chusanApp.exe',
hook: 'chusanhook',
io: 'chuniio',
};
}
case undefined:
throw new Error('Option tab without a profile');
}
});
</script>
<template>
<OptionCategory title="General">
<OptionRow :title="names.exe">
<FilePicker
:directory="false"
:promptname="names.exe"
extension="exe"
:value="prf.current!.data.sgt.target"
:callback="
(value: string) => (prf.current!.data.sgt.target = value)
"
></FilePicker>
</OptionRow>
<OptionRow title="amfs">
<FilePicker
:directory="true"
placeholder="amfs"
:value="prf.current!.data.sgt.amfs"
:callback="
(value: string) => (prf.current!.data.sgt.amfs = value)
"
></FilePicker>
</OptionRow>
<OptionRow title="option">
<FilePicker
:directory="true"
placeholder="option"
:value="prf.current!.data.sgt.option"
:callback="
(value: string) => (prf.current!.data.sgt.option = value)
"
></FilePicker>
</OptionRow>
<OptionRow title="appdata">
<FilePicker
:directory="true"
:value="prf.current!.data.sgt.appdata"
:callback="
(value: string) => (prf.current!.data.sgt.appdata = value)
"
></FilePicker>
</OptionRow>
<OptionRow :title="names.hook">
<Select
v-model="prf.current!.data.sgt.hook"
:options="
pkgs
.byFeature(
prf.current?.meta.game === 'ongeki'
? Feature.Mu3Hook
: Feature.ChusanHook
)
.map((p) => {
return { title: pkgKey(p), value: pkgKey(p) };
})
"
option-label="title"
option-value="value"
></Select>
</OptionRow>
<OptionRow :title="names.io" v-if="prf.current?.meta.game === 'ongeki'">
<Select
v-model="prf.current!.data.sgt.io"
placeholder="segatools built-in"
:options="[
{ title: 'segatools built-in', value: null },
...pkgs.byFeature(Feature.Mu3IO).map((p) => {
return { title: pkgKey(p), value: pkgKey(p) };
}),
]"
option-label="title"
option-value="value"
></Select>
</OptionRow>
</OptionCategory>
</template>