feat: add prelaunch scripts

This commit is contained in:
2025-05-09 16:07:58 +00:00
parent 8f05a04350
commit 469ba5f574
9 changed files with 91 additions and 7 deletions

View File

@ -1,13 +1,27 @@
<script setup lang="ts">
import { ref } from 'vue';
import ToggleSwitch from 'primevue/toggleswitch';
import FileEditor from '../FileEditor.vue';
import OptionCategory from '../OptionCategory.vue';
import OptionRow from '../OptionRow.vue';
import { invoke } from '../../invoke';
import { usePrfStore } from '../../stores';
import { useI18n } from 'vue-i18n';
const { t } = useI18n();
const extension = ref('');
invoke('list_platform_capabilities').then(async (v: unknown) => {
if (Array.isArray(v)) {
if (v.includes('preload-sh')) {
extension.value = 'sh';
} else if (v.includes('preload-bat')) {
extension.value = 'bat';
}
}
});
const prf = usePrfStore();
</script>
@ -26,5 +40,20 @@ const prf = usePrfStore();
<!-- <Button icon="pi pi-refresh" size="small" /> -->
<FileEditor filename="segatools-base.ini" />
</OptionRow>
<OptionRow
:title="t('cfg.misc.prelaunch')"
:tooltip="t('cfg.misc.prelaunchTooltip')"
>
<FileEditor
v-if="extension === 'bat'"
filename="prelaunch.bat"
:defaultValue="`@echo off\n\nREM This script will be launched alongside the game\n`"
/>
<FileEditor
v-else-if="extension === 'sh'"
filename="prelaunch.sh"
:defaultValue="`#!/bin/sh\n\n# This script will be launched alongside the game\n`"
/>
</OptionRow>
</OptionCategory>
</template>