forked from akanyan/STARTLINER
feat: amnet integration
This commit is contained in:
@ -58,11 +58,19 @@ const iconSrc = () => {
|
||||
>
|
||||
</span>
|
||||
<span
|
||||
v-if="pkg?.loc?.kind === 'IO'"
|
||||
v-if="pkg?.loc?.kind === 'GameIO'"
|
||||
v-tooltip="'IO'"
|
||||
class="pi pi-wrench ml-1 text-green-400"
|
||||
>
|
||||
</span>
|
||||
<span
|
||||
v-if="
|
||||
pkg?.loc?.kind === 'AMNet' || pkg?.loc?.kind === 'AimeOther'
|
||||
"
|
||||
v-tooltip="'Aime'"
|
||||
class="pi pi-wrench ml-1 text-purple-400"
|
||||
>
|
||||
</span>
|
||||
<span
|
||||
v-if="showNamespace && pkg?.namespace"
|
||||
class="text-sm opacity-75"
|
||||
|
@ -13,9 +13,10 @@ import OptionCategory from './OptionCategory.vue';
|
||||
import OptionRow from './OptionRow.vue';
|
||||
import { invoke } from '../invoke';
|
||||
import { usePkgStore, usePrfStore } from '../stores';
|
||||
import { pkgKey } from '../util';
|
||||
import { Feature } from '../types';
|
||||
import { hasFeature, pkgKey } from '../util';
|
||||
|
||||
const pkg = usePkgStore();
|
||||
const pkgs = usePkgStore();
|
||||
const prf = usePrfStore();
|
||||
|
||||
const aimeCode = ref('');
|
||||
@ -53,7 +54,7 @@ const aimeCodeModel = computed({
|
||||
},
|
||||
async set(value: string) {
|
||||
aimeCode.value = value;
|
||||
if (value.match(/^[0-9]{20}$/)) {
|
||||
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);
|
||||
}
|
||||
@ -111,7 +112,7 @@ const extraDisplayOptionsDisabled = computed(() => {
|
||||
<Select
|
||||
v-model="prf.current!.sgt.hook"
|
||||
:options="
|
||||
pkg.hooks.map((p) => {
|
||||
pkgs.hooks.map((p) => {
|
||||
return { title: pkgKey(p), value: pkgKey(p) };
|
||||
})
|
||||
"
|
||||
@ -125,7 +126,7 @@ const extraDisplayOptionsDisabled = computed(() => {
|
||||
placeholder="segatools built-in"
|
||||
:options="[
|
||||
{ title: 'segatools built-in', value: null },
|
||||
...pkg.ios.map((p) => {
|
||||
...pkgs.gameIOs.map((p) => {
|
||||
return { title: pkgKey(p), value: pkgKey(p) };
|
||||
}),
|
||||
]"
|
||||
@ -299,23 +300,65 @@ const extraDisplayOptionsDisabled = computed(() => {
|
||||
/>
|
||||
</OptionRow>
|
||||
</OptionCategory>
|
||||
<OptionCategory title="Misc">
|
||||
<OptionRow title="OpenSSL bug workaround for Intel ≥10th gen">
|
||||
<ToggleSwitch v-model="prf.current!.sgt.intel" />
|
||||
</OptionRow>
|
||||
<OptionCategory title="Aime">
|
||||
<OptionRow title="Aime emulation">
|
||||
<ToggleSwitch v-model="prf.current!.sgt.enable_aime" />
|
||||
<Select
|
||||
v-model="prf.current!.sgt.aime"
|
||||
:options="[
|
||||
{ title: 'disabled', value: null },
|
||||
{ title: 'segatools built-in', value: 'BuiltIn' },
|
||||
...pkgs.aimes.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?.sgt.enable_aime !== true"
|
||||
:disabled="prf.current!.sgt.aime === null"
|
||||
:maxlength="20"
|
||||
placeholder="00000000000000000000"
|
||||
v-model="aimeCodeModel"
|
||||
/>
|
||||
</OptionRow>
|
||||
<div v-if="prf.current!.sgt.aime?.hasOwnProperty('AMNet')">
|
||||
<OptionRow title="Server name">
|
||||
<InputText
|
||||
class="shrink"
|
||||
size="small"
|
||||
placeholder="CHUNI-PENGUIN"
|
||||
:maxlength="50"
|
||||
v-model="prf.current!.sgt.amnet.name"
|
||||
/>
|
||||
</OptionRow>
|
||||
<OptionRow title="Server address">
|
||||
<InputText
|
||||
class="shrink"
|
||||
size="small"
|
||||
placeholder="http://+:6070"
|
||||
:maxlength="50"
|
||||
v-model="prf.current!.sgt.amnet.addr"
|
||||
/>
|
||||
</OptionRow>
|
||||
<OptionRow title="Use AiMeDB for physical cards">
|
||||
<ToggleSwitch v-model="prf.current!.sgt.amnet.physical" />
|
||||
</OptionRow>
|
||||
</div>
|
||||
</OptionCategory>
|
||||
<OptionCategory title="Misc">
|
||||
<OptionRow title="OpenSSL bug workaround for Intel ≥10th gen">
|
||||
<ToggleSwitch v-model="prf.current!.sgt.intel" />
|
||||
</OptionRow>
|
||||
<OptionRow title="More segatools options">
|
||||
<FileEditor filename="segatools-base.ini" />
|
||||
</OptionRow>
|
||||
|
@ -3,8 +3,8 @@ import { defineStore } from 'pinia';
|
||||
import { listen } from '@tauri-apps/api/event';
|
||||
import * as path from '@tauri-apps/api/path';
|
||||
import { invoke, invoke_nopopup } from './invoke';
|
||||
import { Dirs, Game, Package, Profile, ProfileMeta } from './types';
|
||||
import { changePrimaryColor, pkgKey } from './util';
|
||||
import { Dirs, Feature, Game, Package, Profile, ProfileMeta } from './types';
|
||||
import { changePrimaryColor, hasFeature, pkgKey } from './util';
|
||||
|
||||
type InstallStatus = {
|
||||
pkg: string;
|
||||
@ -101,9 +101,13 @@ export const usePkgStore = defineStore('pkg', {
|
||||
))
|
||||
),
|
||||
hooks: (state) =>
|
||||
Object.values(state.pkg).filter((p) => p.loc?.kind === 'Hook'),
|
||||
ios: (state) =>
|
||||
Object.values(state.pkg).filter((p) => p.loc?.kind === 'IO'),
|
||||
Object.values(state.pkg).filter((p) => hasFeature(p, Feature.Hook)),
|
||||
gameIOs: (state) =>
|
||||
Object.values(state.pkg).filter((p) =>
|
||||
hasFeature(p, Feature.GameIO)
|
||||
),
|
||||
aimes: (state) =>
|
||||
Object.values(state.pkg).filter((p) => hasFeature(p, Feature.Aime)),
|
||||
},
|
||||
actions: {
|
||||
setupListeners() {
|
||||
|
23
src/types.ts
23
src/types.ts
@ -7,7 +7,7 @@ export interface Package {
|
||||
version: string;
|
||||
path: string;
|
||||
dependencies: string[];
|
||||
kind: 'Unchecked' | 'Unsupported' | 'Mod' | 'Hook' | 'IO';
|
||||
status: Status;
|
||||
} | null;
|
||||
rmt: {
|
||||
version: string;
|
||||
@ -22,6 +22,20 @@ export interface Package {
|
||||
};
|
||||
}
|
||||
|
||||
export enum Feature {
|
||||
Hook = 0b00001,
|
||||
GameIO = 0b00010,
|
||||
Aime = 0b00100,
|
||||
AMNet = 0b01000,
|
||||
}
|
||||
|
||||
export type Status =
|
||||
| 'Unchecked'
|
||||
| 'Unsupported'
|
||||
| {
|
||||
OK: Feature;
|
||||
};
|
||||
|
||||
export type Game = 'ongeki' | 'chunithm';
|
||||
|
||||
export interface ProfileMeta {
|
||||
@ -36,8 +50,13 @@ export interface SegatoolsConfig {
|
||||
amfs: string;
|
||||
option: string;
|
||||
appdata: string;
|
||||
enable_aime: boolean;
|
||||
aime: { AMNet: string } | { Other: string } | null;
|
||||
intel: boolean;
|
||||
amnet: {
|
||||
name: string;
|
||||
addr: string;
|
||||
physical: boolean;
|
||||
};
|
||||
}
|
||||
|
||||
export interface DisplayConfig {
|
||||
|
10
src/util.ts
10
src/util.ts
@ -1,5 +1,5 @@
|
||||
import { updatePrimaryPalette } from '@primevue/themes';
|
||||
import { Game, Package } from './types';
|
||||
import { Feature, Game, Package } from './types';
|
||||
|
||||
export const changePrimaryColor = (game: Game | null) => {
|
||||
const color =
|
||||
@ -45,3 +45,11 @@ export const needsUpdate = (pkg: Package | undefined) => {
|
||||
}
|
||||
return l1 < r1;
|
||||
};
|
||||
|
||||
export const hasFeature = (pkg: Package, feature: Feature) => {
|
||||
return (
|
||||
pkg.loc !== null &&
|
||||
typeof pkg.loc?.status !== 'string' &&
|
||||
pkg.loc.status.OK & feature
|
||||
);
|
||||
};
|
||||
|
Reference in New Issue
Block a user