feat: hardware aime

This commit is contained in:
2025-04-11 23:07:45 +00:00
parent 1a68eda8c1
commit 28269c5d75
13 changed files with 276 additions and 68 deletions

View File

@ -1,5 +1,5 @@
<script setup lang="ts">
import { computed, ref } from 'vue';
import { Ref, computed, ref } from 'vue';
import InputText from 'primevue/inputtext';
import Select from 'primevue/select';
import ToggleSwitch from 'primevue/toggleswitch';
@ -8,6 +8,7 @@ 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 { invoke } from '../../invoke';
import { usePkgStore, usePrfStore } from '../../stores';
import { Feature } from '../../types';
import { hasFeature, pkgKey } from '../../util';
@ -16,6 +17,7 @@ const pkgs = usePkgStore();
const prf = usePrfStore();
const aimeCode = ref('');
const coms: Ref<{ [key: string]: number }> = ref({});
prf.reload();
@ -46,6 +48,10 @@ const load = async () => {
aimeCode.value = await readTextFile(aime_path).catch(() => '');
};
invoke('list_com_ports').then((newComs) => {
coms.value = newComs as typeof coms.value;
});
listen('reload-aime-code', load);
load();
@ -54,14 +60,14 @@ load();
<template>
<OptionCategory title="Aime">
<OptionRow
title="Aime emulation"
tooltip="Aime plugins can be downloaded from the package store."
title="Aime type"
tooltip="Additional Aime plugins can be downloaded from the package store."
>
<Select
v-model="prf.current!.data.sgt.aime"
:options="[
{ title: 'none', value: 'Disabled' },
{ title: 'segatools built-in', value: 'BuiltIn' },
{ title: 'hardware', value: 'Disabled' },
{ title: 'segatools built-in emulation', value: 'BuiltIn' },
...pkgs.byFeature(Feature.Aime).map((p) => {
return {
title: pkgKey(p),
@ -76,11 +82,13 @@ load();
option-value="value"
></Select>
</OptionRow>
<OptionRow title="Aime code">
<OptionRow
title="Aime code"
v-if="prf.current!.data.sgt.aime !== 'Disabled'"
>
<InputText
class="shrink"
size="small"
:disabled="prf.current!.data.sgt.aime === 'Disabled'"
:maxlength="20"
placeholder="00000000000000000000"
v-model="aimeCodeModel"
@ -113,5 +121,26 @@ load();
<ToggleSwitch v-model="prf.current!.data.sgt.amnet.physical" />
</OptionRow>
</div>
<OptionRow
title="Aime serial port"
tooltip="Ports can be checked in Devices and Printers or at googlechromelabs.github.io/serial-terminal
For AIC Pico, the AIME port should be selected."
v-if="prf.current!.data.sgt.aime === 'Disabled'"
>
<Select
v-model="prf.current!.data.sgt.aime_port"
:options="[
{ title: 'default', value: 'Disabled' },
...Object.entries(coms ?? {}).map(([title, value]) => {
return {
title,
value,
};
}),
]"
option-label="title"
option-value="value"
></Select>
</OptionRow>
</OptionCategory>
</template>