feat: rudimentary config

This commit is contained in:
2025-02-24 00:01:25 +00:00
parent 70b8b3ae55
commit b7fe76b6ff
11 changed files with 64 additions and 20 deletions

View File

@ -20,7 +20,7 @@ const store = usePkgStore();
store.setupListeners();
const currentTab = ref('3');
const startEnabled = ref(true);
const startEnabled = ref(false);
const loadProfile = async () => {
await store.reloadProfile();
@ -42,6 +42,7 @@ const loadProfile = async () => {
}
if (store.profile !== null) {
changePrimaryColor(store.profile.game);
startEnabled.value = true;
currentTab.value = '0';
}

View File

@ -1,19 +1,25 @@
<script setup lang="ts">
import { usePkgStore } from '../stores';
import Fieldset from 'primevue/fieldset';
import Toggle from 'primevue/toggleswitch';
const store = usePkgStore();
const setValue = async (value: boolean) => {
await store.set_cfg('intel', value);
}
</script>
<template>
<Fieldset>
<div class="flex w-full flex-col">
<label for="switch" class="flex flex-row w-full p-2">
<div class="grow">Aime emulation</div>
<Toggle disabled inputId="switch" />
<div class="grow">OpenSSL crash workaround for Intel 10th gen</div>
<Toggle
inputId="switch"
:modelValue="store.cfg('intel') === 'true'"
v-on:value-change="setValue" />
</label>
<div class="flex flex-row w-full p-2">
<div class="grow">Enable console</div>
<Toggle disabled />
</div>
</div>
</Fieldset>
</template>

View File

@ -25,6 +25,7 @@ export const usePkgStore = defineStore('pkg', {
profile: (state) => state.prf,
isEnabled: (state) => (pkg: Package | undefined) =>
pkg !== undefined && state.prf?.mods.includes(pkgKey(pkg)),
cfg: (state) => (key: string) => state.prf?.cfg[key]
},
actions: {
setupListeners() {
@ -99,5 +100,11 @@ export const usePkgStore = defineStore('pkg', {
await this.reloadProfile();
await this.saveProfile();
},
async set_cfg(key: string, value: string | boolean | number) {
await invoke('set_cfg', { key, value: `${value}` });
await this.reloadProfile();
await this.saveProfile();
}
},
});
});

View File

@ -23,6 +23,7 @@ export interface Profile {
name: string;
game: 'Ongeki' | 'Chunithm';
mods: string[];
cfg: {[key: string]: string | boolean}
}
export type PackageC = Map<string, Package>;