Merge branch 'marie/add-virtual-desktop' into 'main'

Add Virtual Desktop option

See merge request KRypt0n_/an-anime-game-launcher!28
This commit is contained in:
Observer KRypt0n_ 2022-01-30 18:30:53 +00:00
commit 6257c7fab4
14 changed files with 213 additions and 4 deletions

View file

@ -141,6 +141,15 @@ settings:
none: Aus
esync: Esync
fsync: Fsync
# Wine Virtual Desktop
winevd:
title: Virtual Desktop
settings:
title: Virtual Desktop einstellung
items:
height: Höhe
width: Breite
# GameMode
gamemode:

View file

@ -112,7 +112,7 @@ settings:
in-launcher: Launcher text
in-game: In-game text
selectIcon: Select icon
# Some buttons
buttons:
winetricks: winetricks
@ -141,6 +141,15 @@ settings:
none: None
esync: ESync
fsync: FSync
# Wine Virtual Desktop
winevd:
title: Virtual Desktop
settings:
title: Virtual Desktop settings
items:
height: Height
width: Width
# GameMode
gamemode:

View file

@ -141,6 +141,15 @@ settings:
none: Ninguna
esync: ESync
fsync: FSync
# Escritorio Virtual de Wine
winevd:
title: Escritorio Virtual
settings:
title: Opciones del Escritorio Virtual
items:
height: Alto
width: Ancho
# GameMode
gamemode:

View file

@ -143,6 +143,15 @@ settings:
none: Aucune
esync: ESync
fsync: FSync
# Wine Virtual Desktop
winevd:
title: Bureau virtuel
settings:
title: Paramètres du Bureau virtuel
items:
height: Hauteur
width: Largeur
# GameMode
gamemode:

View file

@ -155,6 +155,15 @@ settings:
tooltip: Ez az opció bekapcsolja az AMD FidelityFX Super Resolution (FSR)-t
amely emeli a játékod felbontását FPS vesztése nélkül
# Wine Virtual Desktop
winevd:
title: Virtuális Asztal
settings:
title: Virtuális Asztal beállításai
items:
height: Magasság
width: Szélesség
# Unlock FPS
fps_unlocker:
title: FPS limit kikapcsolása

View file

@ -140,6 +140,15 @@ settings:
none: None
esync: ESync
fsync: FSync
# Wine Virtual Desktop
winevd:
title: Virtual Desktop
settings:
title: Virtual Desktop settings
items:
height: Height
width: Width
# GameMode
gamemode:

View file

@ -140,6 +140,15 @@ settings:
none: Nessuno
esync: ESync
fsync: FSync
# Wine Virtual Desktop
winevd:
title: Desktop virtuale
settings:
title: Impostazioni del desktop virtuale
items:
height: Altezza
width: Larghezza
# GameMode
gamemode:

View file

@ -141,6 +141,15 @@ settings:
none: Отключена
esync: ESync
fsync: FSync
# Виртуальный рабочий стол Wine
winevd:
title: Виртуальный рабочий стол
settings:
title: Настройки виртуального рабочего стола
items:
height: Высота
width: Ширина
# GameMode
gamemode:

View file

@ -141,6 +141,15 @@ settings:
none: none
esync: Esync
fsync: Fsync
# Wine Virtual Desktop
winevd:
title: viwtuaw desktop
settings:
title: viwtuaw desktop settings
items:
height: height
width: width
# GameMode
gamemode:

View file

@ -16,12 +16,12 @@
Configs.get(prop).then((value) => active = value as boolean);
function updateCheckbox()
async function updateCheckbox()
{
active = !active;
if (prop)
Configs.set(prop, active);
await Configs.set(prop, active);
if (valueChanged)
valueChanged(active);

View file

@ -0,0 +1,61 @@
<script lang="ts">
import { _ } from 'svelte-i18n';
import { Configs } from '../empathize';
export let visible: boolean = false;
export let valueChanged: (field: 'height' | 'width', value: string) => void = () => {};
let winevdhandw = {
height: '0',
width: '0'
}
Configs.get('winevd.height').then(height => winevdhandw.height = height!.toString());
Configs.get('winevd.width').then(width => winevdhandw.width = width!.toString());
const textareaHandler = (event: KeyboardEvent, field: 'height' | 'width') => {
const textArea = event.srcElement as HTMLTextAreaElement;
const content = textArea.value
.replace(/\b0+/g, '')
.replace(/[^0-9.]/g, '')
.replace(/(\..*?)\..*/g, '$1')
.replace(/([0-9]{0,6}(\.[0-9]{0,2})?).*/g, '$1');
valueChanged(field, content);
};
</script>
<div style="display: {visible ? 'block' : 'none'}">
<h3>{$_('settings.enhancements.items.winevd.settings.title')}</h3>
<table class="table" style="margin-top: 16px">
<tr>
<td>
<span>{$_('settings.enhancements.items.winevd.settings.items.height')}</span>
</td>
<td>
<textarea rows="2" on:keyup={(e) => textareaHandler(e, 'height')}>{winevdhandw.height}</textarea>
</td>
</tr>
<tr>
<td>
<span>{$_('settings.enhancements.items.winevd.settings.items.width')}</span>
</td>
<td>
<textarea rows="2" on:keyup={(e) => textareaHandler(e, 'width')}>{winevdhandw.width}</textarea>
</td>
</tr>
</table>
</div>
<style lang="sass">
table.table
td:last-child
display: inline-flex
align-items: center
width: 100%
</style>

View file

@ -84,6 +84,33 @@ promisify(async () => {
* @defaul "esync"
*/
winesync: 'esync',
/**
* Wine Virtual Desktop
*/
winevd: {
/**
* If it is enabled
*
* @default false
*/
enabled: false,
/**
* Virtual Desktop Height
*
* @default 1280
*/
height: 1280,
/**
* Virtual Desktop Width
*
* @default 720
*/
width: 720
},
/**
* vkBasalt preset to use

View file

@ -18,6 +18,7 @@
import SelectionBox from './components/SelectionBox.svelte';
import DropdownCheckboxes from './components/DropdownCheckboxes.svelte';
import DiscordSettings from './components/DiscordSettings.svelte';
import WineVDSettings from './components/WineVDSettings.svelte';
import DXVKSelectionList from './components/DXVKSelectionList.svelte';
import RunnerSelectionList from './components/RunnerSelectionList.svelte';
import ShadersSelection from './components/ShadersSelection.svelte';
@ -42,6 +43,35 @@
fpsUnlockerAvailable = true,
voiceUpdateRequired = false;
let winevdSettings: object = {}, winevdSettingsUpdater = false;
Configs.get('winevd').then((settings) => winevdSettings = settings as object);
const WineVDBox = (value: boolean) => {
winevdSettings['enabled'] = value;
if (value)
Configs.set('fsr', false);
}
const handleWineVD = (field: 'height' | 'width', value: string) => {
winevdSettings[field] = parseInt(value);
// This thing will update config file only after a second
// so we'll not update it every time user prints some character
// in textarea
if (!winevdSettingsUpdater)
{
winevdSettingsUpdater = true;
setTimeout(() => {
winevdSettingsUpdater = false;
Configs.set('winevd', winevdSettings);
}, 1000);
}
};
let discordSettings: object = {}, discordSettingsUpdater = false;
Configs.get('discord').then((settings) => discordSettings = settings as object);
@ -299,6 +329,15 @@
}}
/>
<Checkbox
lang="settings.enhancements.items.winevd.title"
prop="winevd.enabled"
valueChanged={(value) => WineVDBox(value)}
/>
<WineVDSettings visible={winevdSettings['enabled']} valueChanged={handleWineVD} />
<br>
<Checkbox
lang="settings.enhancements.items.gamemode.title"
prop="gamemode"
@ -310,6 +349,7 @@
lang="settings.enhancements.items.fsr.title"
tooltip="settings.enhancements.items.fsr.tooltip"
prop="fsr"
disabled={winevdSettings['enabled']}
/>
<Checkbox

View file

@ -138,7 +138,7 @@ export default (launcher: Launcher): Promise<void> => {
else console.warn(`GPU ${LauncherLib.getConfig('gpu')} not found. Launching on the default GPU`);
}*/
let command = `"${path.addSlashes(wineExeutable)}" ${await Configs.get('fps_unlocker') ? 'unlockfps.bat' : 'launcher.bat'}`;
let command = `"${path.addSlashes(wineExeutable)}" ${await Configs.get('winevd.enabled') ? `explorer /desktop=animegame,${await Configs.get('winevd.height')}x${await Configs.get('winevd.width')}` : ''} ${await Configs.get('fps_unlocker') ? 'unlockfps.bat' : 'launcher.bat'}`;
/**
* Gamemode integration