mirror of
https://github.com/an-anime-team/an-anime-game-launcher.git
synced 2024-12-23 18:20:19 +03:00
Several changes
- changed shaders config file format - added shaders selection menu section template - made `Shaders` class to manage shaders
This commit is contained in:
parent
25e4c3f6f2
commit
35d9e82222
14 changed files with 183 additions and 36 deletions
|
@ -22,7 +22,7 @@
|
||||||
"fullScreen": false,
|
"fullScreen": false,
|
||||||
"alwaysOnTop": false,
|
"alwaysOnTop": false,
|
||||||
"icon": "/public/icons/64x64.png",
|
"icon": "/public/icons/64x64.png",
|
||||||
"enableInspector": false,
|
"enableInspector": true,
|
||||||
"borderless": false,
|
"borderless": false,
|
||||||
"maximize": false,
|
"maximize": false,
|
||||||
"hidden": true,
|
"hidden": true,
|
||||||
|
|
|
@ -44,7 +44,7 @@ settings:
|
||||||
dxvk: DXVK
|
dxvk: DXVK
|
||||||
mangohud: MangoHUD
|
mangohud: MangoHUD
|
||||||
|
|
||||||
gamemode: GameMode
|
gamemode: Use GameMode
|
||||||
fps_unlocker: Unlock FPS
|
fps_unlocker: Unlock FPS
|
||||||
purge_dxvk_logs: Delete DXVK logs
|
purge_dxvk_logs: Delete DXVK logs
|
||||||
|
|
||||||
|
@ -59,3 +59,12 @@ settings:
|
||||||
title: DXVK
|
title: DXVK
|
||||||
items:
|
items:
|
||||||
recommended: Show recommendable only
|
recommended: Show recommendable only
|
||||||
|
|
||||||
|
# Shaders
|
||||||
|
shaders:
|
||||||
|
title: Shaders
|
||||||
|
items:
|
||||||
|
shaders:
|
||||||
|
title: Shaders
|
||||||
|
items:
|
||||||
|
none: None
|
|
@ -45,18 +45,27 @@ settings:
|
||||||
mangohud: MangoHUD
|
mangohud: MangoHUD
|
||||||
|
|
||||||
# TODO: add hints to the components so I could describe what these options means
|
# TODO: add hints to the components so I could describe what these options means
|
||||||
gamemode: GameMode
|
gamemode: Использовать GameMode
|
||||||
fps_unlocker: Разблокировать FPS
|
fps_unlocker: Разблокировать FPS
|
||||||
purge_dxvk_logs: Удалять логи DXVK
|
purge_dxvk_logs: Удалять логи DXVK
|
||||||
|
|
||||||
# Runners
|
# Версии Wine
|
||||||
runners:
|
runners:
|
||||||
title: Версия Wine
|
title: Версия Wine
|
||||||
items:
|
items:
|
||||||
recommended: Показывать только рекомендуемое
|
recommended: Показывать только рекомендуемое
|
||||||
|
|
||||||
# DXVKs
|
# DXVK
|
||||||
dxvks:
|
dxvks:
|
||||||
title: DXVK
|
title: DXVK
|
||||||
items:
|
items:
|
||||||
recommended: Показывать только рекомендуемое
|
recommended: Показывать только рекомендуемое
|
||||||
|
|
||||||
|
# Шейдеры
|
||||||
|
shaders:
|
||||||
|
title: Шейдеры
|
||||||
|
items:
|
||||||
|
shaders:
|
||||||
|
title: Шейдеры
|
||||||
|
items:
|
||||||
|
none: Отключены
|
|
@ -1,18 +0,0 @@
|
||||||
{
|
|
||||||
"name": "Prime Preset v2",
|
|
||||||
"author": "notahuman",
|
|
||||||
"uri": "https://notabug.org/Krock/GI-on-Linux/issues/200",
|
|
||||||
"images": [
|
|
||||||
{
|
|
||||||
"file": "preview.png",
|
|
||||||
"caption": {
|
|
||||||
"en": "Characters' faces",
|
|
||||||
"en-us": "Characters' faces",
|
|
||||||
"de": "Gesichter der Charaktere",
|
|
||||||
"ja": "キャラクターの顔",
|
|
||||||
"ko": "캐릭터의 얼굴",
|
|
||||||
"ru": "Лица персонажей"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
11
public/shaders/notahuman/shaders.yaml
Normal file
11
public/shaders/notahuman/shaders.yaml
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
name: Prime Preset v2
|
||||||
|
author: notahuman
|
||||||
|
uri: https://notabug.org/Krock/GI-on-Linux/issues/200
|
||||||
|
images:
|
||||||
|
- file: preview.png
|
||||||
|
caption:
|
||||||
|
en-us: Characters' faces
|
||||||
|
de-de: Gesichter der Charaktere
|
||||||
|
ja-jp: キャラクターの顔
|
||||||
|
ko-kr: 캐릭터의 얼굴
|
||||||
|
ru-ru: Лица персонажей
|
|
@ -1,6 +0,0 @@
|
||||||
{
|
|
||||||
"name": "Basic sharpening preset",
|
|
||||||
"author": "yagocl",
|
|
||||||
"uri": null,
|
|
||||||
"images": []
|
|
||||||
}
|
|
2
public/shaders/yagocl/shaders.yaml
Normal file
2
public/shaders/yagocl/shaders.yaml
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
name: Basic sharpening preset
|
||||||
|
author: yagocl
|
|
@ -6,6 +6,7 @@
|
||||||
export let prop: string = '';
|
export let prop: string = '';
|
||||||
export let lang: string = '';
|
export let lang: string = '';
|
||||||
export let items = {};
|
export let items = {};
|
||||||
|
|
||||||
export let valueChanged: (value: string) => void = () => {};
|
export let valueChanged: (value: string) => void = () => {};
|
||||||
|
|
||||||
import Arrow from '../assets/svgs/arrow.svg';
|
import Arrow from '../assets/svgs/arrow.svg';
|
||||||
|
|
27
src/components/ShadersSelection.svelte
Normal file
27
src/components/ShadersSelection.svelte
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
<script lang="ts">
|
||||||
|
import { _ } from 'svelte-i18n';
|
||||||
|
|
||||||
|
import type { Shader } from '../ts/types/Shaders';
|
||||||
|
import Shaders from '../ts/core/Shaders';
|
||||||
|
|
||||||
|
import SelectionBox from './SelectionBox.svelte';
|
||||||
|
|
||||||
|
let shaders: Shader[] = [],
|
||||||
|
shadersOptions = {
|
||||||
|
'none': 'settings.shaders.items.shaders.items.none'
|
||||||
|
};
|
||||||
|
|
||||||
|
Shaders.list().then((list) => {
|
||||||
|
shaders = list;
|
||||||
|
|
||||||
|
list.forEach((shader) => {
|
||||||
|
shadersOptions[shader.folder] = shader.name;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<SelectionBox
|
||||||
|
lang="settings.shaders.items.shaders.title"
|
||||||
|
prop="shaders"
|
||||||
|
items={shadersOptions}
|
||||||
|
/>
|
|
@ -51,11 +51,11 @@ promisify(async () => {
|
||||||
/**
|
/**
|
||||||
* vkBasalt preset to use
|
* vkBasalt preset to use
|
||||||
*
|
*
|
||||||
* null if not in use. Otherwise it should be a folder name from the "shaders" folder
|
* "none" if not in use. Otherwise it should be a folder name from the "shaders" folder
|
||||||
*
|
*
|
||||||
* @default null
|
* @default "none"
|
||||||
*/
|
*/
|
||||||
shaders: null,
|
shaders: 'none',
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Discord RPC integration
|
* Discord RPC integration
|
||||||
|
|
|
@ -2,10 +2,13 @@
|
||||||
import { onMount } from 'svelte';
|
import { onMount } from 'svelte';
|
||||||
import { _, locale, locales } from 'svelte-i18n';
|
import { _, locale, locales } from 'svelte-i18n';
|
||||||
|
|
||||||
|
import Shaders from './ts/core/Shaders';
|
||||||
|
|
||||||
import Checkbox from './components/Checkbox.svelte';
|
import Checkbox from './components/Checkbox.svelte';
|
||||||
import SelectionBox from './components/SelectionBox.svelte';
|
import SelectionBox from './components/SelectionBox.svelte';
|
||||||
import DXVKSelectionList from './components/DXVKSelectionList.svelte';
|
import DXVKSelectionList from './components/DXVKSelectionList.svelte';
|
||||||
import RunnerSelectionList from './components/RunnerSelectionList.svelte';
|
import RunnerSelectionList from './components/RunnerSelectionList.svelte';
|
||||||
|
import ShadersSelection from './components/ShadersSelection.svelte';
|
||||||
|
|
||||||
import Window from './ts/neutralino/Window';
|
import Window from './ts/neutralino/Window';
|
||||||
|
|
||||||
|
@ -53,11 +56,15 @@
|
||||||
'mangohud': 'settings.enhancements.items.hud.items.mangohud'
|
'mangohud': 'settings.enhancements.items.hud.items.mangohud'
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Menu items
|
||||||
|
*/
|
||||||
const menuItems = [
|
const menuItems = [
|
||||||
'general',
|
'general',
|
||||||
'enhancements',
|
'enhancements',
|
||||||
'runners',
|
'runners',
|
||||||
'dxvks'
|
'dxvks',
|
||||||
|
'shaders'
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -160,5 +167,11 @@
|
||||||
|
|
||||||
<DXVKSelectionList recommendable={dxvkRecommendable} />
|
<DXVKSelectionList recommendable={dxvkRecommendable} />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="settings-item" id="shaders">
|
||||||
|
<h1>{$_('settings.shaders.title')}</h1>
|
||||||
|
|
||||||
|
<ShadersSelection />
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
|
@ -36,7 +36,7 @@ export default class Launcher
|
||||||
title: 'Settings',
|
title: 'Settings',
|
||||||
width: 900,
|
width: 900,
|
||||||
height: 600,
|
height: 600,
|
||||||
enableInspector: false
|
enableInspector: true
|
||||||
});
|
});
|
||||||
|
|
||||||
if (window.status)
|
if (window.status)
|
||||||
|
|
87
src/ts/core/Shaders.ts
Normal file
87
src/ts/core/Shaders.ts
Normal file
|
@ -0,0 +1,87 @@
|
||||||
|
import YAML from 'yaml';
|
||||||
|
|
||||||
|
import type { Shader } from '../types/Shaders';
|
||||||
|
|
||||||
|
import Configs from '../Configs';
|
||||||
|
import constants from '../Constants';
|
||||||
|
import promisify from './promisify';
|
||||||
|
|
||||||
|
declare const Neutralino;
|
||||||
|
|
||||||
|
export default class Shaders
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Get or set shaders to the config file
|
||||||
|
*/
|
||||||
|
public static current(shader: Shader|null = null): Promise<Shader|null>
|
||||||
|
{
|
||||||
|
return new Promise(async (resolve) => {
|
||||||
|
if (shader === null)
|
||||||
|
{
|
||||||
|
Configs.get('shaders').then(async (shader) => {
|
||||||
|
resolve(shader ? await this.get(shader as string) : null);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Configs.set('shaders', typeof shader === 'string' ? shader : shader.folder);
|
||||||
|
|
||||||
|
resolve(typeof shader === 'string' ? await this.get(shader) : shader);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get list of available shaders
|
||||||
|
*/
|
||||||
|
public static list(): Promise<Shader[]>
|
||||||
|
{
|
||||||
|
return new Promise((resolve) => {
|
||||||
|
Neutralino.filesystem.readDirectory(constants.paths.shadersDir)
|
||||||
|
.then((dirs) => {
|
||||||
|
let callbacks: any[] = [];
|
||||||
|
|
||||||
|
dirs.forEach((dir) => {
|
||||||
|
if (dir.entry != '.' && dir.entry != '..')
|
||||||
|
{
|
||||||
|
callbacks.push((): Promise<Shader|null> => {
|
||||||
|
return new Promise((resolve) => {
|
||||||
|
Neutralino.filesystem.readFile(`${constants.paths.shadersDir}/${dir.entry}/shaders.yaml`)
|
||||||
|
.then((shaders) => resolve({
|
||||||
|
...YAML.parse(shaders),
|
||||||
|
folder: dir.entry
|
||||||
|
}))
|
||||||
|
.catch(() => resolve(null));
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const pipeline = promisify({
|
||||||
|
callbacks,
|
||||||
|
callAtOnce: true
|
||||||
|
});
|
||||||
|
|
||||||
|
pipeline.then((output: object) => {
|
||||||
|
resolve(Object.values(output).filter((shader) => shader !== null));
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.catch(() => resolve([]));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get shader info
|
||||||
|
*/
|
||||||
|
public static get(folder: string): Promise<Shader|null>
|
||||||
|
{
|
||||||
|
return new Promise((resolve) => {
|
||||||
|
Neutralino.filesystem.readFile(`${constants.paths.shadersDir}/${folder}/shaders.yaml`)
|
||||||
|
.then((shaders) => {
|
||||||
|
resolve(YAML.parse(shaders));
|
||||||
|
})
|
||||||
|
.catch(() => resolve(null));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
12
src/ts/types/Shaders.d.ts
vendored
Normal file
12
src/ts/types/Shaders.d.ts
vendored
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
type Shader = {
|
||||||
|
name: string;
|
||||||
|
folder: string;
|
||||||
|
author: string;
|
||||||
|
uri?: string;
|
||||||
|
images?: {
|
||||||
|
file: string;
|
||||||
|
captions?: string[];
|
||||||
|
}[];
|
||||||
|
};
|
||||||
|
|
||||||
|
export type { Shader };
|
Loading…
Reference in a new issue